* [PATCH] drm/exynos: dp: Enable pipe clock from encoder enable/disable callbacks [not found] <CGME20261119223849eucas1p1ead1f9ecc9bab76245a4cb6cb91d8e00@eucas1p1.samsung.com> @ 2026-11-19 22:38 ` Marek Szyprowski 2026-12-06 0:14 ` Alexandre Marquet 0 siblings, 1 reply; 2+ messages in thread From: Marek Szyprowski @ 2026-11-19 22:38 UTC (permalink / raw) To: dri-devel, linux-samsung-soc Cc: Marek Szyprowski, Jingoo Han, Inki Dae, Krzysztof Kozlowski, Peter Griffin, Alim Akhtar The FIMD -> DP video (pipe) clock is switched from the analogix_dp runtime PM callbacks through plat_data->power_on()/power_off(). This only works if the DP device runtime suspends while the encoder is still attached to the CRTC, i.e. synchronously from the bridge disable path, and runtime resumes from the bridge enable path. Otherwise power_off() bails out with -EPERM because encoder->crtc is already NULL, the FIMD driver keeps its cached dp_clk_enabled state set, and after FIMD loses power during system suspend the clock is never enabled again. Enabling the bridge on resume then fails on Exynos5250 Snow: exynos-dp 145b0000.dp-controller: Timeout of slave video streamclk ok exynos-dp 145b0000.dp-controller: unable to config video [drm:analogix_dp_bridge_atomic_enable [analogix_dp]] *ERROR* dp commit error, ret = -110 exynos-dp 145b0000.dp-controller: failed to set bridge, retry: 0 ... exynos-dp 145b0000.dp-controller: too many times retry set bridge, give it up This happens whenever the DP device stays runtime active across the display disable, for example when runtime PM is blocked by writing "on" to its power/control sysfs attribute. Since commit f2b556e3dad6 ("PM: runtime: Update last_busy before calling rpm_suspend() in rpm_idle()") it also happens by default, because pm_runtime_put_sync() in the bridge disable path now only schedules an autosuspend after the 100ms delay and the device is runtime suspended only later by pm_runtime_force_suspend(). Tie the pipe clock to the display state instead of the DP device power state: enable it from the encoder .enable callback and disable it from the encoder .disable callback. The atomic helpers call them after the CRTC is enabled and before the bridge enable, and after the bridge disable and before the CRTC disable, so the FIMD is active, the clock is running when the analogix DP configures the video input, and encoder->crtc is valid in both cases. This also matches the other Exynos DRM drivers, which switch the pipe clock from their enable/disable callbacks. Fixes: 3424e3a4f844 ("drm: bridge: analogix/dp: split exynos dp driver to bridge directory") Fixes: 73f613908eb1 ("drm/bridge: analogix_dp: move platform and PHY power handling into runtime PM") Closes: https://lore.kernel.org/all/av9AkwQDhB7O4wgl@google.com/ Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- This patch has been developed with LLM assistance and have been tested on the real Exynos5250-based Snow Chromebook device. Best regards Marek Szyprowski, PhD Samsung R&D Institute Poland --- drivers/gpu/drm/exynos/exynos_dp.c | 41 +++++++----------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c index 4db7400c8a23..8beae1132dfa 100644 --- a/drivers/gpu/drm/exynos/exynos_dp.c +++ b/drivers/gpu/drm/exynos/exynos_dp.c @@ -32,8 +32,6 @@ #include "exynos_drm_crtc.h" -#define to_dp(nm) container_of(nm, struct exynos_dp_device, nm) - struct exynos_dp_device { struct drm_encoder encoder; struct drm_device *drm_dev; @@ -43,39 +41,20 @@ struct exynos_dp_device { struct analogix_dp_plat_data plat_data; }; -static int exynos_dp_crtc_clock_enable(struct analogix_dp_plat_data *plat_data, - bool enable) -{ - struct exynos_dp_device *dp = to_dp(plat_data); - struct drm_encoder *encoder = &dp->encoder; - - if (!encoder->crtc) - return -EPERM; - - exynos_drm_pipe_clk_enable(to_exynos_crtc(encoder->crtc), enable); - - return 0; -} - -static int exynos_dp_poweron(struct analogix_dp_plat_data *plat_data) -{ - return exynos_dp_crtc_clock_enable(plat_data, true); -} - -static int exynos_dp_poweroff(struct analogix_dp_plat_data *plat_data) -{ - return exynos_dp_crtc_clock_enable(plat_data, false); -} - static void exynos_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { } -static void exynos_dp_nop(struct drm_encoder *encoder) +static void exynos_dp_enable(struct drm_encoder *encoder) +{ + exynos_drm_pipe_clk_enable(to_exynos_crtc(encoder->crtc), true); +} + +static void exynos_dp_disable(struct drm_encoder *encoder) { - /* do nothing */ + exynos_drm_pipe_clk_enable(to_exynos_crtc(encoder->crtc), false); } static const struct drm_encoder_funcs exynos_dp_encoder_funcs = { @@ -84,8 +63,8 @@ static const struct drm_encoder_funcs exynos_dp_encoder_funcs = { static const struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = { .mode_set = exynos_dp_mode_set, - .enable = exynos_dp_nop, - .disable = exynos_dp_nop, + .enable = exynos_dp_enable, + .disable = exynos_dp_disable, }; static int exynos_dp_bind(struct device *dev, struct device *master, void *data) @@ -170,8 +149,6 @@ static int exynos_dp_probe(struct platform_device *pdev) /* The remote port can be either a panel or a bridge */ dp->plat_data.dev_type = EXYNOS_DP; - dp->plat_data.power_on = exynos_dp_poweron; - dp->plat_data.power_off = exynos_dp_poweroff; dp->plat_data.ops = &exynos_dp_ops; dp->adp = analogix_dp_probe(dev, &dp->plat_data); -- 2.43.0 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/exynos: dp: Enable pipe clock from encoder enable/disable callbacks 2026-11-19 22:38 ` [PATCH] drm/exynos: dp: Enable pipe clock from encoder enable/disable callbacks Marek Szyprowski @ 2026-12-06 0:14 ` Alexandre Marquet 0 siblings, 0 replies; 2+ messages in thread From: Alexandre Marquet @ 2026-12-06 0:14 UTC (permalink / raw) To: Marek Szyprowski Cc: dri-devel, linux-samsung-soc, Jingoo Han, Inki Dae, Krzysztof Kozlowski, Peter Griffin, Alim Akhtar Le Thu, Nov 19, 2026 at 11:38:42PM +0100, Marek Szyprowski a écrit : > The FIMD -> DP video (pipe) clock is switched from the analogix_dp > runtime PM callbacks through plat_data->power_on()/power_off(). This > only works if the DP device runtime suspends while the encoder is still > attached to the CRTC, i.e. synchronously from the bridge disable path, > and runtime resumes from the bridge enable path. Otherwise power_off() > bails out with -EPERM because encoder->crtc is already NULL, the FIMD > driver keeps its cached dp_clk_enabled state set, and after FIMD loses > power during system suspend the clock is never enabled again. Enabling > the bridge on resume then fails on Exynos5250 Snow: > > exynos-dp 145b0000.dp-controller: Timeout of slave video streamclk ok > exynos-dp 145b0000.dp-controller: unable to config video > [drm:analogix_dp_bridge_atomic_enable [analogix_dp]] *ERROR* dp commit error, ret = -110 > exynos-dp 145b0000.dp-controller: failed to set bridge, retry: 0 > ... > exynos-dp 145b0000.dp-controller: too many times retry set bridge, give it up > > This happens whenever the DP device stays runtime active across the > display disable, for example when runtime PM is blocked by writing "on" > to its power/control sysfs attribute. Since commit f2b556e3dad6 ("PM: > runtime: Update last_busy before calling rpm_suspend() in rpm_idle()") > it also happens by default, because pm_runtime_put_sync() in the bridge > disable path now only schedules an autosuspend after the 100ms delay and > the device is runtime suspended only later by > pm_runtime_force_suspend(). > > Tie the pipe clock to the display state instead of the DP device power > state: enable it from the encoder .enable callback and disable it from > the encoder .disable callback. The atomic helpers call them after the > CRTC is enabled and before the bridge enable, and after the bridge > disable and before the CRTC disable, so the FIMD is active, the clock > is running when the analogix DP configures the video input, and > encoder->crtc is valid in both cases. This also matches the other Exynos > DRM drivers, which switch the pipe clock from their enable/disable > callbacks. > > Fixes: 3424e3a4f844 ("drm: bridge: analogix/dp: split exynos dp driver to bridge directory") > Fixes: 73f613908eb1 ("drm/bridge: analogix_dp: move platform and PHY power handling into runtime PM") > Closes: https://lore.kernel.org/all/av9AkwQDhB7O4wgl@google.com/ > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > This patch has been developed with LLM assistance and have been tested > on the real Exynos5250-based Snow Chromebook device. > > Best regards > Marek Szyprowski, PhD > Samsung R&D Institute Poland Tested-by: Alexandre Marquet <tb@a-marquet.fr> Works fine on Google Nexus 10 (using this patch as a drop-in replacement for PATCH 2/4 of [1]. [1] https://lore.kernel.org/all/20261206-drm-misc-next-manta-auxbus-v2-0-390b739ce0db@a-marquet.fr/ > --- > drivers/gpu/drm/exynos/exynos_dp.c | 41 +++++++----------------------- > 1 file changed, 9 insertions(+), 32 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c > index 4db7400c8a23..8beae1132dfa 100644 > --- a/drivers/gpu/drm/exynos/exynos_dp.c > +++ b/drivers/gpu/drm/exynos/exynos_dp.c > @@ -32,8 +32,6 @@ > > #include "exynos_drm_crtc.h" > > -#define to_dp(nm) container_of(nm, struct exynos_dp_device, nm) > - > struct exynos_dp_device { > struct drm_encoder encoder; > struct drm_device *drm_dev; > @@ -43,39 +41,20 @@ struct exynos_dp_device { > struct analogix_dp_plat_data plat_data; > }; > > -static int exynos_dp_crtc_clock_enable(struct analogix_dp_plat_data *plat_data, > - bool enable) > -{ > - struct exynos_dp_device *dp = to_dp(plat_data); > - struct drm_encoder *encoder = &dp->encoder; > - > - if (!encoder->crtc) > - return -EPERM; > - > - exynos_drm_pipe_clk_enable(to_exynos_crtc(encoder->crtc), enable); > - > - return 0; > -} > - > -static int exynos_dp_poweron(struct analogix_dp_plat_data *plat_data) > -{ > - return exynos_dp_crtc_clock_enable(plat_data, true); > -} > - > -static int exynos_dp_poweroff(struct analogix_dp_plat_data *plat_data) > -{ > - return exynos_dp_crtc_clock_enable(plat_data, false); > -} > - > static void exynos_dp_mode_set(struct drm_encoder *encoder, > struct drm_display_mode *mode, > struct drm_display_mode *adjusted_mode) > { > } > > -static void exynos_dp_nop(struct drm_encoder *encoder) > +static void exynos_dp_enable(struct drm_encoder *encoder) > +{ > + exynos_drm_pipe_clk_enable(to_exynos_crtc(encoder->crtc), true); > +} > + > +static void exynos_dp_disable(struct drm_encoder *encoder) > { > - /* do nothing */ > + exynos_drm_pipe_clk_enable(to_exynos_crtc(encoder->crtc), false); > } > > static const struct drm_encoder_funcs exynos_dp_encoder_funcs = { > @@ -84,8 +63,8 @@ static const struct drm_encoder_funcs exynos_dp_encoder_funcs = { > > static const struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = { > .mode_set = exynos_dp_mode_set, > - .enable = exynos_dp_nop, > - .disable = exynos_dp_nop, > + .enable = exynos_dp_enable, > + .disable = exynos_dp_disable, > }; > > static int exynos_dp_bind(struct device *dev, struct device *master, void *data) > @@ -170,8 +149,6 @@ static int exynos_dp_probe(struct platform_device *pdev) > > /* The remote port can be either a panel or a bridge */ > dp->plat_data.dev_type = EXYNOS_DP; > - dp->plat_data.power_on = exynos_dp_poweron; > - dp->plat_data.power_off = exynos_dp_poweroff; > dp->plat_data.ops = &exynos_dp_ops; > > dp->adp = analogix_dp_probe(dev, &dp->plat_data); > -- > 2.43.0 > > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-06 0:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20261119223849eucas1p1ead1f9ecc9bab76245a4cb6cb91d8e00@eucas1p1.samsung.com>
2026-11-19 22:38 ` [PATCH] drm/exynos: dp: Enable pipe clock from encoder enable/disable callbacks Marek Szyprowski
2026-12-06 0:14 ` Alexandre Marquet
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.