pwrseq.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. void (*reset)(struct mmc_host *host);
  19. };
  20. struct mmc_pwrseq {
  21. const struct mmc_pwrseq_ops *ops;
  22. struct device *dev;
  23. struct list_head pwrseq_node;
  24. struct module *owner;
  25. };
  26. #ifdef CONFIG_OF
  27. int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq);
  28. void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq);
  29. int mmc_pwrseq_alloc(struct mmc_host *host);
  30. void mmc_pwrseq_pre_power_on(struct mmc_host *host);
  31. void mmc_pwrseq_post_power_on(struct mmc_host *host);
  32. void mmc_pwrseq_power_off(struct mmc_host *host);
  33. void mmc_pwrseq_reset(struct mmc_host *host);
  34. void mmc_pwrseq_free(struct mmc_host *host);
  35. #else
  36. static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq)
  37. {
  38. return -ENOSYS;
  39. }
  40. static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {}
  41. static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
  42. static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
  43. static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
  44. static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
  45. static inline void mmc_pwrseq_reset(struct mmc_host *host) {}
  46. static inline void mmc_pwrseq_free(struct mmc_host *host) {}
  47. #endif
  48. #endif