blob: d69e751f148b85f26d89e748a51c0486d215695c [file] [log] [blame]
Ulf Hansson3aa87932014-11-28 14:38:36 +01001/*
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
Srinivas Kandagatlad97a1e52016-04-14 14:02:16 +010011#include <linux/mmc/host.h>
12
Ulf Hansson3aa87932014-11-28 14:38:36 +010013struct 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);
Ulf Hansson3aa87932014-11-28 14:38:36 +010017};
18
19struct mmc_pwrseq {
Julia Lawallffedbd22015-11-14 18:05:20 +010020 const struct mmc_pwrseq_ops *ops;
Srinivas Kandagatlad97a1e52016-04-14 14:02:16 +010021 struct device *dev;
22 struct list_head pwrseq_node;
23 struct module *owner;
Ulf Hansson3aa87932014-11-28 14:38:36 +010024};
25
26#ifdef CONFIG_OF
27
Srinivas Kandagatlad97a1e52016-04-14 14:02:16 +010028int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq);
29void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq);
30
Ulf Hansson3aa87932014-11-28 14:38:36 +010031int mmc_pwrseq_alloc(struct mmc_host *host);
32void mmc_pwrseq_pre_power_on(struct mmc_host *host);
33void mmc_pwrseq_post_power_on(struct mmc_host *host);
34void mmc_pwrseq_power_off(struct mmc_host *host);
35void mmc_pwrseq_free(struct mmc_host *host);
36
Ulf Hansson3aa87932014-11-28 14:38:36 +010037#else
38
Srinivas Kandagatlad97a1e52016-04-14 14:02:16 +010039static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq)
40{
41 return -ENOSYS;
42}
43static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {}
Ulf Hansson3aa87932014-11-28 14:38:36 +010044static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
45static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
46static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
47static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
48static inline void mmc_pwrseq_free(struct mmc_host *host) {}
49
50#endif
51
52#endif