pwrseq.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (C) 2014 Linaro Ltd
  3. *
  4. * Author: Ulf Hansson <ulf.hansson@linaro.org>
  5. *
  6. * License terms: GNU General Public License (GPL) version 2
  7. */
  8. #ifndef _MMC_CORE_PWRSEQ_H
  9. #define _MMC_CORE_PWRSEQ_H
  10. #include <linux/types.h>
  11. struct mmc_host;
  12. struct device;
  13. struct module;
  14. struct mmc_pwrseq_ops {
  15. void (*pre_power_on)(struct mmc_host *host);
  16. void (*post_power_on)(struct mmc_host *host);
  17. void (*power_off)(struct mmc_host *host);
  18. };
  19. struct mmc_pwrseq {
  20. const struct mmc_pwrseq_ops *ops;
  21. struct device *dev;
  22. struct list_head pwrseq_node;
  23. struct module *owner;
  24. };
  25. #ifdef CONFIG_OF
  26. int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq);
  27. void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq);
  28. int mmc_pwrseq_alloc(struct mmc_host *host);
  29. void mmc_pwrseq_pre_power_on(struct mmc_host *host);
  30. void mmc_pwrseq_post_power_on(struct mmc_host *host);
  31. void mmc_pwrseq_power_off(struct mmc_host *host);
  32. void mmc_pwrseq_free(struct mmc_host *host);
  33. #else
  34. static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq)
  35. {
  36. return -ENOSYS;
  37. }
  38. static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {}
  39. static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
  40. static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
  41. static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
  42. static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
  43. static inline void mmc_pwrseq_free(struct mmc_host *host) {}
  44. #endif
  45. #endif