Lines Matching +full:autosuspend +full:- +full:delay +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0
6 * by the DRM_PANEL_SIMPLE driver because its power sequencing is non-standard.
10 #include <linux/delay.h>
22 /* T3 VCC to HPD high is max 200 ms */
69 * specifies to wait 150 ms after deasserting EL3_ON before in atana33xc20_suspend()
72 if (p->el3_was_on) in atana33xc20_suspend()
73 atana33xc20_wait(p->el_on3_off_time, 150); in atana33xc20_suspend()
75 ret = regulator_disable(p->supply); in atana33xc20_suspend()
78 p->powered_off_time = ktime_get(); in atana33xc20_suspend()
79 p->el3_was_on = false; in atana33xc20_suspend()
90 /* T12 (Power off time) is min 500 ms */ in atana33xc20_resume()
91 atana33xc20_wait(p->powered_off_time, 500); in atana33xc20_resume()
93 ret = regulator_enable(p->supply); in atana33xc20_resume()
96 p->powered_on_time = ktime_get(); in atana33xc20_resume()
98 if (p->no_hpd) { in atana33xc20_resume()
103 if (p->hpd_gpio) { in atana33xc20_resume()
104 ret = readx_poll_timeout(gpiod_get_value_cansleep, p->hpd_gpio, in atana33xc20_resume()
116 if (p->aux->wait_hpd_asserted) { in atana33xc20_resume()
117 ret = p->aux->wait_hpd_asserted(p->aux, HPD_MAX_US); in atana33xc20_resume()
140 /* Disabling when already disabled is a no-op */ in atana33xc20_disable()
141 if (!p->enabled) in atana33xc20_disable()
144 gpiod_set_value_cansleep(p->el_on3_gpio, 0); in atana33xc20_disable()
145 p->el_on3_off_time = ktime_get(); in atana33xc20_disable()
146 p->enabled = false; in atana33xc20_disable()
155 p->el3_was_on = true; in atana33xc20_disable()
158 * Sleeping 20 ms here (after setting the GPIO) avoids a glitch when in atana33xc20_disable()
170 /* Enabling when already enabled is a no-op */ in atana33xc20_enable()
171 if (p->enabled) in atana33xc20_enable()
180 * non-obvious. in atana33xc20_enable()
182 if (WARN_ON(p->el3_was_on)) in atana33xc20_enable()
183 return -EIO; in atana33xc20_enable()
187 * to wait 400 ms after powering on before asserting EL3_on. in atana33xc20_enable()
189 atana33xc20_wait(p->powered_on_time, 400); in atana33xc20_enable()
191 gpiod_set_value_cansleep(p->el_on3_gpio, 1); in atana33xc20_enable()
192 p->enabled = true; in atana33xc20_enable()
202 /* Unpreparing when already unprepared is a no-op */ in atana33xc20_unprepare()
203 if (!p->prepared) in atana33xc20_unprepare()
207 * Purposely do a put_sync, don't use autosuspend. The panel's tcon in atana33xc20_unprepare()
211 * NOTE: we still want autosuspend for cases where we only turn on in atana33xc20_unprepare()
214 ret = pm_runtime_put_sync_suspend(panel->dev); in atana33xc20_unprepare()
217 p->prepared = false; in atana33xc20_unprepare()
227 /* Preparing when already prepared is a no-op */ in atana33xc20_prepare()
228 if (p->prepared) in atana33xc20_prepare()
231 ret = pm_runtime_get_sync(panel->dev); in atana33xc20_prepare()
233 pm_runtime_put_autosuspend(panel->dev); in atana33xc20_prepare()
236 p->prepared = true; in atana33xc20_prepare()
245 struct dp_aux_ep_device *aux_ep = to_dp_aux_ep_dev(panel->dev); in atana33xc20_get_modes()
248 pm_runtime_get_sync(panel->dev); in atana33xc20_get_modes()
250 if (!p->edid) in atana33xc20_get_modes()
251 p->edid = drm_get_edid(connector, &aux_ep->aux->ddc); in atana33xc20_get_modes()
252 num = drm_add_edid_modes(connector, p->edid); in atana33xc20_get_modes()
254 pm_runtime_mark_last_busy(panel->dev); in atana33xc20_get_modes()
255 pm_runtime_put_autosuspend(panel->dev); in atana33xc20_get_modes()
281 struct device *dev = &aux_ep->dev; in atana33xc20_probe()
286 return -ENOMEM; in atana33xc20_probe()
289 panel->aux = aux_ep->aux; in atana33xc20_probe()
291 panel->supply = devm_regulator_get(dev, "power"); in atana33xc20_probe()
292 if (IS_ERR(panel->supply)) in atana33xc20_probe()
293 return dev_err_probe(dev, PTR_ERR(panel->supply), in atana33xc20_probe()
296 panel->el_on3_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); in atana33xc20_probe()
297 if (IS_ERR(panel->el_on3_gpio)) in atana33xc20_probe()
298 return dev_err_probe(dev, PTR_ERR(panel->el_on3_gpio), in atana33xc20_probe()
301 panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd"); in atana33xc20_probe()
302 if (!panel->no_hpd) { in atana33xc20_probe()
303 panel->hpd_gpio = devm_gpiod_get_optional(dev, "hpd", GPIOD_IN); in atana33xc20_probe()
304 if (IS_ERR(panel->hpd_gpio)) in atana33xc20_probe()
305 return dev_err_probe(dev, PTR_ERR(panel->hpd_gpio), in atana33xc20_probe()
319 drm_panel_init(&panel->base, dev, &atana33xc20_funcs, DRM_MODE_CONNECTOR_eDP); in atana33xc20_probe()
322 ret = drm_panel_dp_aux_backlight(&panel->base, aux_ep->aux); in atana33xc20_probe()
329 drm_panel_add(&panel->base); in atana33xc20_probe()
336 struct device *dev = &aux_ep->dev; in atana33xc20_remove()
339 drm_panel_remove(&panel->base); in atana33xc20_remove()
340 drm_panel_disable(&panel->base); in atana33xc20_remove()
341 drm_panel_unprepare(&panel->base); in atana33xc20_remove()
343 kfree(panel->edid); in atana33xc20_remove()
348 struct device *dev = &aux_ep->dev; in atana33xc20_shutdown()
351 drm_panel_disable(&panel->base); in atana33xc20_shutdown()
352 drm_panel_unprepare(&panel->base); in atana33xc20_shutdown()