Ulf Hansson | 3aa8793 | 2014-11-28 14:38:36 +0100 | [diff] [blame] | 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 | |
Ulf Hansson | 066185d | 2017-01-13 14:14:07 +0100 | [diff] [blame] | 11 | #include <linux/types.h> |
| 12 | |
| 13 | struct mmc_host; |
| 14 | struct device; |
| 15 | struct module; |
Srinivas Kandagatla | d97a1e5 | 2016-04-14 14:02:16 +0100 | [diff] [blame] | 16 | |
Ulf Hansson | 3aa8793 | 2014-11-28 14:38:36 +0100 | [diff] [blame] | 17 | struct mmc_pwrseq_ops { |
| 18 | void (*pre_power_on)(struct mmc_host *host); |
| 19 | void (*post_power_on)(struct mmc_host *host); |
| 20 | void (*power_off)(struct mmc_host *host); |
Ulf Hansson | 3aa8793 | 2014-11-28 14:38:36 +0100 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | struct mmc_pwrseq { |
Julia Lawall | ffedbd2 | 2015-11-14 18:05:20 +0100 | [diff] [blame] | 24 | const struct mmc_pwrseq_ops *ops; |
Srinivas Kandagatla | d97a1e5 | 2016-04-14 14:02:16 +0100 | [diff] [blame] | 25 | struct device *dev; |
| 26 | struct list_head pwrseq_node; |
| 27 | struct module *owner; |
Ulf Hansson | 3aa8793 | 2014-11-28 14:38:36 +0100 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | #ifdef CONFIG_OF |
| 31 | |
Srinivas Kandagatla | d97a1e5 | 2016-04-14 14:02:16 +0100 | [diff] [blame] | 32 | int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq); |
| 33 | void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq); |
| 34 | |
Ulf Hansson | 3aa8793 | 2014-11-28 14:38:36 +0100 | [diff] [blame] | 35 | int mmc_pwrseq_alloc(struct mmc_host *host); |
| 36 | void mmc_pwrseq_pre_power_on(struct mmc_host *host); |
| 37 | void mmc_pwrseq_post_power_on(struct mmc_host *host); |
| 38 | void mmc_pwrseq_power_off(struct mmc_host *host); |
| 39 | void mmc_pwrseq_free(struct mmc_host *host); |
| 40 | |
Ulf Hansson | 3aa8793 | 2014-11-28 14:38:36 +0100 | [diff] [blame] | 41 | #else |
| 42 | |
Srinivas Kandagatla | d97a1e5 | 2016-04-14 14:02:16 +0100 | [diff] [blame] | 43 | static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq) |
| 44 | { |
| 45 | return -ENOSYS; |
| 46 | } |
| 47 | static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {} |
Ulf Hansson | 3aa8793 | 2014-11-28 14:38:36 +0100 | [diff] [blame] | 48 | static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; } |
| 49 | static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {} |
| 50 | static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {} |
| 51 | static inline void mmc_pwrseq_power_off(struct mmc_host *host) {} |
| 52 | static inline void mmc_pwrseq_free(struct mmc_host *host) {} |
| 53 | |
| 54 | #endif |
| 55 | |
| 56 | #endif |