Lines Matching full:pwrseq

23 #include "pwrseq.h"
26 struct mmc_pwrseq pwrseq; member
34 #define to_pwrseq_simple(p) container_of(p, struct mmc_pwrseq_simple, pwrseq)
36 static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, in mmc_pwrseq_simple_set_gpios_value() argument
39 struct gpio_descs *reset_gpios = pwrseq->reset_gpios; in mmc_pwrseq_simple_set_gpios_value()
63 struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); in mmc_pwrseq_simple_pre_power_on() local
65 if (!IS_ERR(pwrseq->ext_clk) && !pwrseq->clk_enabled) { in mmc_pwrseq_simple_pre_power_on()
66 clk_prepare_enable(pwrseq->ext_clk); in mmc_pwrseq_simple_pre_power_on()
67 pwrseq->clk_enabled = true; in mmc_pwrseq_simple_pre_power_on()
70 mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); in mmc_pwrseq_simple_pre_power_on()
75 struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); in mmc_pwrseq_simple_post_power_on() local
77 mmc_pwrseq_simple_set_gpios_value(pwrseq, 0); in mmc_pwrseq_simple_post_power_on()
79 if (pwrseq->post_power_on_delay_ms) in mmc_pwrseq_simple_post_power_on()
80 msleep(pwrseq->post_power_on_delay_ms); in mmc_pwrseq_simple_post_power_on()
85 struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); in mmc_pwrseq_simple_power_off() local
87 mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); in mmc_pwrseq_simple_power_off()
89 if (pwrseq->power_off_delay_us) in mmc_pwrseq_simple_power_off()
90 usleep_range(pwrseq->power_off_delay_us, in mmc_pwrseq_simple_power_off()
91 2 * pwrseq->power_off_delay_us); in mmc_pwrseq_simple_power_off()
93 if (!IS_ERR(pwrseq->ext_clk) && pwrseq->clk_enabled) { in mmc_pwrseq_simple_power_off()
94 clk_disable_unprepare(pwrseq->ext_clk); in mmc_pwrseq_simple_power_off()
95 pwrseq->clk_enabled = false; in mmc_pwrseq_simple_power_off()
106 { .compatible = "mmc-pwrseq-simple",},
113 struct mmc_pwrseq_simple *pwrseq; in mmc_pwrseq_simple_probe() local
116 pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); in mmc_pwrseq_simple_probe()
117 if (!pwrseq) in mmc_pwrseq_simple_probe()
120 pwrseq->ext_clk = devm_clk_get(dev, "ext_clock"); in mmc_pwrseq_simple_probe()
121 if (IS_ERR(pwrseq->ext_clk) && PTR_ERR(pwrseq->ext_clk) != -ENOENT) in mmc_pwrseq_simple_probe()
122 return dev_err_probe(dev, PTR_ERR(pwrseq->ext_clk), "external clock not ready\n"); in mmc_pwrseq_simple_probe()
124 pwrseq->reset_gpios = devm_gpiod_get_array(dev, "reset", in mmc_pwrseq_simple_probe()
126 if (IS_ERR(pwrseq->reset_gpios) && in mmc_pwrseq_simple_probe()
127 PTR_ERR(pwrseq->reset_gpios) != -ENOENT && in mmc_pwrseq_simple_probe()
128 PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) { in mmc_pwrseq_simple_probe()
129 return dev_err_probe(dev, PTR_ERR(pwrseq->reset_gpios), "reset GPIOs not ready\n"); in mmc_pwrseq_simple_probe()
133 &pwrseq->post_power_on_delay_ms); in mmc_pwrseq_simple_probe()
135 &pwrseq->power_off_delay_us); in mmc_pwrseq_simple_probe()
137 pwrseq->pwrseq.dev = dev; in mmc_pwrseq_simple_probe()
138 pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops; in mmc_pwrseq_simple_probe()
139 pwrseq->pwrseq.owner = THIS_MODULE; in mmc_pwrseq_simple_probe()
140 platform_set_drvdata(pdev, pwrseq); in mmc_pwrseq_simple_probe()
142 return mmc_pwrseq_register(&pwrseq->pwrseq); in mmc_pwrseq_simple_probe()
147 struct mmc_pwrseq_simple *pwrseq = platform_get_drvdata(pdev); in mmc_pwrseq_simple_remove() local
149 mmc_pwrseq_unregister(&pwrseq->pwrseq); in mmc_pwrseq_simple_remove()