[PATCH v3 2/2] drm/bridge: analogix_dp: Enable autosuspend
Doug Anderson
dianders at chromium.org
Tue Feb 22 14:09:51 PST 2022
Hi,
On Thu, Feb 17, 2022 at 2:42 PM Brian Norris <briannorris at chromium.org> wrote:
>
> DP AUX transactions can consist of many short operations. There's no
> need to power things up/down in short intervals.
>
> I pick an arbitrary 100ms; for the systems I'm testing (Rockchip
> RK3399), runtime-PM transitions only take a few microseconds.
>
> Signed-off-by: Brian Norris <briannorris at chromium.org>
> ---
>
> Changes in v3:
> - New in v3
>
> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 16be279aed2c..d82a4ddf44e7 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1121,7 +1121,7 @@ static int analogix_dp_get_modes(struct drm_connector *connector)
>
> pm_runtime_get_sync(dp->dev);
> edid = drm_get_edid(connector, &dp->aux.ddc);
> - pm_runtime_put(dp->dev);
> + pm_runtime_put_autosuspend(dp->dev);
So I think you can fully get rid of these ones now and rely on the
ones in the aux transfer, right?
> if (edid) {
> drm_connector_update_edid_property(&dp->connector,
> edid);
> @@ -1642,7 +1642,7 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux,
>
> ret = analogix_dp_transfer(dp, msg);
> out:
> - pm_runtime_put(dp->dev);
> + pm_runtime_put_autosuspend(dp->dev);
>
> return ret;
> }
> @@ -1775,6 +1775,8 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
> if (ret)
> return ret;
>
> + pm_runtime_use_autosuspend(dp->dev);
> + pm_runtime_set_autosuspend_delay(dp->dev, 100);
It's explicitly listed in the Documentation that you need the
corresponding pm_runtime_dont_use_autosuspend(). Specifically, it
says:
> Drivers in ->remove() callback should undo the runtime PM changes done
> in ->probe(). Usually this means calling pm_runtime_disable(),
> pm_runtime_dont_use_autosuspend() etc.
Not that it's very common to see anyone actually get it right, but I
seem to remember running into an issue when I didn't do it. I think
ti-sn65dsi86 still has it wrong since I found out about this later.
Need to write a patch up for that... Basically you want to put it
right before the two calls in your driver to pm_runtime_disable().
-Doug
More information about the Linux-rockchip
mailing list