pwrseq.h (9938b04472d5c59f8bd8152a548533a8599596a2) pwrseq.h (d97a1e5d7cd2b5b0edc02a40fe6897b710c9e10f)
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
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
11#include <linux/mmc/host.h>
12
11struct mmc_pwrseq_ops {
12 void (*pre_power_on)(struct mmc_host *host);
13 void (*post_power_on)(struct mmc_host *host);
14 void (*power_off)(struct mmc_host *host);
13struct 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);
15 void (*free)(struct mmc_host *host);
16};
17
18struct mmc_pwrseq {
19 const struct mmc_pwrseq_ops *ops;
17};
18
19struct mmc_pwrseq {
20 const struct mmc_pwrseq_ops *ops;
21 struct device *dev;
22 struct list_head pwrseq_node;
23 struct module *owner;
20};
21
22#ifdef CONFIG_OF
23
24};
25
26#ifdef CONFIG_OF
27
28int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq);
29void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq);
30
24int mmc_pwrseq_alloc(struct mmc_host *host);
25void mmc_pwrseq_pre_power_on(struct mmc_host *host);
26void mmc_pwrseq_post_power_on(struct mmc_host *host);
27void mmc_pwrseq_power_off(struct mmc_host *host);
28void mmc_pwrseq_free(struct mmc_host *host);
29
31int 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
30struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host,
31 struct device *dev);
32struct mmc_pwrseq *mmc_pwrseq_emmc_alloc(struct mmc_host *host,
33 struct device *dev);
34
35#else
36
37#else
38
39static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq)
40{
41 return -ENOSYS;
42}
43static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {}
37static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
38static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
39static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
40static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
41static inline void mmc_pwrseq_free(struct mmc_host *host) {}
42
43#endif
44
45#endif
44static 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