blob: 39c911aa6ebba3204b52c93f857cfe2e9c9bdaf9 [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
Ulf Hansson066185d2017-01-13 14:14:07 +010011#include <linux/types.h>
12
13struct mmc_host;
14struct device;
15struct module;
Srinivas Kandagatlad97a1e52016-04-14 14:02:16 +010016
Ulf Hansson3aa87932014-11-28 14:38:36 +010017struct 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 Hansson3aa87932014-11-28 14:38:36 +010021};
22
23struct mmc_pwrseq {
Julia Lawallffedbd22015-11-14 18:05:20 +010024 const struct mmc_pwrseq_ops *ops;
Srinivas Kandagatlad97a1e52016-04-14 14:02:16 +010025 struct device *dev;
26 struct list_head pwrseq_node;
27 struct module *owner;
Ulf Hansson3aa87932014-11-28 14:38:36 +010028};
29
30#ifdef CONFIG_OF
31
Srinivas Kandagatlad97a1e52016-04-14 14:02:16 +010032int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq);
33void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq);
34
Ulf Hansson3aa87932014-11-28 14:38:36 +010035int mmc_pwrseq_alloc(struct mmc_host *host);
36void mmc_pwrseq_pre_power_on(struct mmc_host *host);
37void mmc_pwrseq_post_power_on(struct mmc_host *host);
38void mmc_pwrseq_power_off(struct mmc_host *host);
39void mmc_pwrseq_free(struct mmc_host *host);
40
Ulf Hansson3aa87932014-11-28 14:38:36 +010041#else
42
Srinivas Kandagatlad97a1e52016-04-14 14:02:16 +010043static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq)
44{
45 return -ENOSYS;
46}
47static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {}
Ulf Hansson3aa87932014-11-28 14:38:36 +010048static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
49static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
50static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
51static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
52static inline void mmc_pwrseq_free(struct mmc_host *host) {}
53
54#endif
55
56#endif