Re: [PATCH 58/78] media: exynos-gsc: use pm_runtime_resume_and_get()

From: Sylwester Nawrocki
Date: Wed Apr 28 2021 - 04:27:37 EST


On 28.04.2021 09:17, Mauro Carvalho Chehab wrote:
Em Wed, 28 Apr 2021 09:13:02 +0200
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> escreveu:

Em Tue, 27 Apr 2021 13:50:44 +0200
Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx> escreveu:

On 27.04.2021 11:42, Mauro Carvalho Chehab wrote:

I think if the device is brought into suspended state (e.g. by
disabling clocks as above) the pm_runtime_set_suspended() call
should be there. IOW a following sequence:

pm_runtime_disable(dev);
if (!pm_runtime_status_suspended(dev))
/* put device into suspended state (disable clocks,
voltage regulators, assert GPIOs, etc. */
pm_runtime_set_suspended(dev);

Not sure if this would work, as the clock framework would try
to do things like calling clk_pm_runtime_put().

It's done in multiple drivers this way. clk_pm_runtime_put() operates
on different device - the clock supplier, not the consumer device.
We just need to disable runtime PM for GSC as the last step, to avoid
any possible v4l2 m2m device_run() call with runtime PM disabled.

Perhaps an alternative would be to just return an error if it
can't resume PM runtime, e. g.:
[...]
Nah, forget about that. Despite the platform driver having a return code,
support for it bogus:

Yes, we can't really stop remove() from driver level so as much complete
resource release is being done as possible.


Regards,
Sylwester