Re: [PATCH v15 12/39] drm/tegra: gr2d: Support generic power domain and runtime PM
From: Michał Mirosław
Date: Sun Nov 28 2021 - 00:49:59 EST
On Sun, Nov 14, 2021 at 10:34:08PM +0300, Dmitry Osipenko wrote:
> Add runtime power management and support generic power domains.
[...]
> @@ -104,10 +127,17 @@ static int gr2d_open_channel(struct tegra_drm_client *client,
> struct tegra_drm_context *context)
> {
> struct gr2d *gr2d = to_gr2d(client);
> + int err;
> +
> + err = pm_runtime_resume_and_get(client->base.dev);
> + if (err)
> + return err;
>
> context->channel = host1x_channel_get(gr2d->channel);
> - if (!context->channel)
> + if (!context->channel) {
> + pm_runtime_put(context->client->base.dev);
Could host1x_channel_get/put() handle pm_runtime* calls ? I would expect
this to be common code for the users.
BTW, pm_runtime_resume_and_get() uses different dev than
pm_runtime_put() in the error path - is this intended?
Best Regards
Michał Mirosław