pwrseq.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2014 Linaro Ltd
  4. *
  5. * Author: Ulf Hansson <ulf.hansson@linaro.org>
  6. */
  7. #ifndef _MMC_CORE_PWRSEQ_H
  8. #define _MMC_CORE_PWRSEQ_H
  9. #include <linux/types.h>
  10. struct mmc_host;
  11. struct device;
  12. struct module;
  13. struct mmc_pwrseq_ops {
  14. void (*pre_power_on)(struct mmc_host *host);
  15. void (*post_power_on)(struct mmc_host *host);
  16. void (*power_off)(struct mmc_host *host);
  17. void (*reset)(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_reset(struct mmc_host *host);
  33. void mmc_pwrseq_free(struct mmc_host *host);
  34. #else
  35. static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq)
  36. {
  37. return -ENOSYS;
  38. }
  39. static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {}
  40. static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
  41. static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
  42. static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
  43. static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
  44. static inline void mmc_pwrseq_reset(struct mmc_host *host) {}
  45. static inline void mmc_pwrseq_free(struct mmc_host *host) {}
  46. #endif
  47. #endif