pwrseq.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/mmc/host.h>
  11. struct mmc_pwrseq_ops {
  12. void (*pre_power_on)(struct mmc_host *host);
  13. void (*post_power_on)(struct mmc_host *host);
  14. void (*power_off)(struct mmc_host *host);
  15. };
  16. struct mmc_pwrseq {
  17. const struct mmc_pwrseq_ops *ops;
  18. struct device *dev;
  19. struct list_head pwrseq_node;
  20. struct module *owner;
  21. };
  22. #ifdef CONFIG_OF
  23. int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq);
  24. void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq);
  25. int mmc_pwrseq_alloc(struct mmc_host *host);
  26. void mmc_pwrseq_pre_power_on(struct mmc_host *host);
  27. void mmc_pwrseq_post_power_on(struct mmc_host *host);
  28. void mmc_pwrseq_power_off(struct mmc_host *host);
  29. void mmc_pwrseq_free(struct mmc_host *host);
  30. #else
  31. static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq)
  32. {
  33. return -ENOSYS;
  34. }
  35. static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {}
  36. static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
  37. static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
  38. static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
  39. static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
  40. static inline void mmc_pwrseq_free(struct mmc_host *host) {}
  41. #endif
  42. #endif