[PATCH v5 1/2] drm/bridge: anx7625: refactor power control to use runtime PM framework

Tzung-Bi Shih tzungbi at google.com
Mon May 17 09:05:18 UTC 2021


On Mon, May 17, 2021 at 2:36 PM Pi-Hsun Shih <pihsun at chromium.org> wrote:
>
> Signed-off-by: Pi-Hsun Shih <pihsun at chromium.org>

With some minor comments,
Reviewed-by: Tzung-Bi Shih <tzungbi at google.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.


More information about the dri-devel mailing list