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/types.h> 12 13struct mmc_host; 14struct device; 15struct module; 16 17struct 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); 21 void (*reset)(struct mmc_host *host); 22}; 23 24struct mmc_pwrseq { 25 const struct mmc_pwrseq_ops *ops; 26 struct device *dev; 27 struct list_head pwrseq_node; 28 struct module *owner; 29}; 30 31#ifdef CONFIG_OF 32 33int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq); 34void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq); 35 36int mmc_pwrseq_alloc(struct mmc_host *host); 37void mmc_pwrseq_pre_power_on(struct mmc_host *host); 38void mmc_pwrseq_post_power_on(struct mmc_host *host); 39void mmc_pwrseq_power_off(struct mmc_host *host); 40void mmc_pwrseq_reset(struct mmc_host *host); 41void mmc_pwrseq_free(struct mmc_host *host); 42 43#else 44 45static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq) 46{ 47 return -ENOSYS; 48} 49static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {} 50static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; } 51static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {} 52static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {} 53static inline void mmc_pwrseq_power_off(struct mmc_host *host) {} 54static inline void mmc_pwrseq_reset(struct mmc_host *host) {} 55static inline void mmc_pwrseq_free(struct mmc_host *host) {} 56 57#endif 58 59#endif 60