1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Copyright (C) 2014 Linaro Ltd 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Author: Ulf Hansson <ulf.hansson@linaro.org> 6*4882a593Smuzhiyun */ 7*4882a593Smuzhiyun #ifndef _MMC_CORE_PWRSEQ_H 8*4882a593Smuzhiyun #define _MMC_CORE_PWRSEQ_H 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun #include <linux/types.h> 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun struct mmc_host; 13*4882a593Smuzhiyun struct device; 14*4882a593Smuzhiyun struct module; 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun struct mmc_pwrseq_ops { 17*4882a593Smuzhiyun void (*pre_power_on)(struct mmc_host *host); 18*4882a593Smuzhiyun void (*post_power_on)(struct mmc_host *host); 19*4882a593Smuzhiyun void (*power_off)(struct mmc_host *host); 20*4882a593Smuzhiyun void (*reset)(struct mmc_host *host); 21*4882a593Smuzhiyun }; 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun struct mmc_pwrseq { 24*4882a593Smuzhiyun const struct mmc_pwrseq_ops *ops; 25*4882a593Smuzhiyun struct device *dev; 26*4882a593Smuzhiyun struct list_head pwrseq_node; 27*4882a593Smuzhiyun struct module *owner; 28*4882a593Smuzhiyun }; 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun #ifdef CONFIG_OF 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq); 33*4882a593Smuzhiyun void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq); 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun int mmc_pwrseq_alloc(struct mmc_host *host); 36*4882a593Smuzhiyun void mmc_pwrseq_pre_power_on(struct mmc_host *host); 37*4882a593Smuzhiyun void mmc_pwrseq_post_power_on(struct mmc_host *host); 38*4882a593Smuzhiyun void mmc_pwrseq_power_off(struct mmc_host *host); 39*4882a593Smuzhiyun void mmc_pwrseq_reset(struct mmc_host *host); 40*4882a593Smuzhiyun void mmc_pwrseq_free(struct mmc_host *host); 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun #else 43*4882a593Smuzhiyun mmc_pwrseq_register(struct mmc_pwrseq * pwrseq)44*4882a593Smuzhiyunstatic inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq) 45*4882a593Smuzhiyun { 46*4882a593Smuzhiyun return -ENOSYS; 47*4882a593Smuzhiyun } mmc_pwrseq_unregister(struct mmc_pwrseq * pwrseq)48*4882a593Smuzhiyunstatic inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {} mmc_pwrseq_alloc(struct mmc_host * host)49*4882a593Smuzhiyunstatic inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; } mmc_pwrseq_pre_power_on(struct mmc_host * host)50*4882a593Smuzhiyunstatic inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {} mmc_pwrseq_post_power_on(struct mmc_host * host)51*4882a593Smuzhiyunstatic inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {} mmc_pwrseq_power_off(struct mmc_host * host)52*4882a593Smuzhiyunstatic inline void mmc_pwrseq_power_off(struct mmc_host *host) {} mmc_pwrseq_reset(struct mmc_host * host)53*4882a593Smuzhiyunstatic inline void mmc_pwrseq_reset(struct mmc_host *host) {} mmc_pwrseq_free(struct mmc_host * host)54*4882a593Smuzhiyunstatic inline void mmc_pwrseq_free(struct mmc_host *host) {} 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun #endif 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun #endif 59