[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+Px+wXePF0Pi1binoZyhZY=9QSX53N-ThWN4mn+fGBoHk1s3A@mail.gmail.com>
Date: Mon, 17 May 2021 17:05:18 +0800
From: Tzung-Bi Shih <tzungbi@...gle.com>
To: Pi-Hsun Shih <pihsun@...omium.org>
Cc: Andrzej Hajda <a.hajda@...sung.com>,
Neil Armstrong <narmstrong@...libre.com>,
Robert Foss <robert.foss@...aro.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...l.net>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, Xin Ji <xji@...logixsemi.com>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Sam Ravnborg <sam@...nborg.org>,
"open list:DRM DRIVERS" <dri-devel@...ts.freedesktop.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 1/2] drm/bridge: anx7625: refactor power control to use
runtime PM framework
On Mon, May 17, 2021 at 2:36 PM Pi-Hsun Shih <pihsun@...omium.org> wrote:
>
> Signed-off-by: Pi-Hsun Shih <pihsun@...omium.org>
With some minor comments,
Reviewed-by: Tzung-Bi Shih <tzungbi@...gle.com>
> @@ -1228,22 +1173,25 @@ static void anx7625_work_func(struct work_struct *work)
> struct anx7625_data, work);
>
> mutex_lock(&ctx->lock);
> +
> + if (pm_runtime_suspended(&ctx->client->dev))
> + goto unlock;
> +
> event = anx7625_hpd_change_detect(ctx);
> - mutex_unlock(&ctx->lock);
> if (event < 0)
> - return;
> + goto unlock;
>
> if (ctx->bridge_attached)
> drm_helper_hpd_irq_event(ctx->bridge.dev);
> +
> +unlock:
> + mutex_unlock(&ctx->lock);
> }
Reminder: the lock now also protects the invoke of drm_helper_hpd_irq_event().
> +static int __maybe_unused anx7625_runtime_pm_suspend(struct device *dev)
> +{
> + struct anx7625_data *ctx = dev_get_drvdata(dev);
> +
> + mutex_lock(&ctx->lock);
> +
> + anx7625_stop_dp_work(ctx);
> + anx7625_power_standby(ctx);
> +
> + mutex_unlock(&ctx->lock);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused anx7625_runtime_pm_resume(struct device *dev)
> +{
> + struct anx7625_data *ctx = dev_get_drvdata(dev);
> +
> + mutex_lock(&ctx->lock);
> +
> + anx7625_power_on_init(ctx);
> + anx7625_hpd_polling(ctx);
> +
> + mutex_unlock(&ctx->lock);
> +
> + return 0;
> +}
Maybe in another patch: the ctx->lock looks to protect too much code.
Powered by blists - more mailing lists