Re: [PATCH 08/25] media: atmel: properly get pm_runtime
From: <hidden>
Date: 2021-09-13 10:26:50
Also in:
linux-media, lkml
On 9/6/21 11:13 AM, Eugen Hristev - M18282 wrote:
On 9/6/21 11:03 AM, Mauro Carvalho Chehab wrote:quoted
Hi Eugen, Em Thu, 10 Jun 2021 12:00:42 +0000 [off-list ref] escreveu:quoted
On 6/10/21 12:38 PM, Mauro Carvalho Chehab wrote:quoted
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe Em Thu, 10 Jun 2021 09:04:07 +0000 [off-list ref] escreveu:quoted
quoted
quoted
diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c index fe3ec8d0eaee..ce8e1351fa53 100644 --- a/drivers/media/platform/atmel/atmel-isc-base.c +++ b/drivers/media/platform/atmel/atmel-isc-base.c@@ -294,9 +294,13 @@ static int isc_wait_clk_stable(struct clk_hw *hw) static int isc_clk_prepare(struct clk_hw *hw) { struct isc_clk *isc_clk = to_isc_clk(hw); + int ret; - if (isc_clk->id == ISC_ISPCK) - pm_runtime_get_sync(isc_clk->dev); + if (isc_clk->id == ISC_ISPCK) { + ret = pm_runtime_resume_and_get(isc_clk->dev); + if (ret < 0) + return ret; + }Hi Mauro, With this patch, the ISC is broken on latest media tree. It looks like pm_runtime_resume_and_get for the ISC_ISPCK clock returns -ENOACCESS and thus, the probe of the driver fails: atmel-sama5d2-isc f0008000.isc: failed to enable ispck: -13 atmel-sama5d2-isc: probe of f0008000.isc failed with error -13What's the current status of this issue?Hi Mauro, Currently, as far as I know, the ISC is broken in 5.14 and current Linux master. I plan to investigate this issue this week (or the next...), together with some other things. I want to tryout the PM part of the driver to see where is the problem. When I come up with a fix or patch, I will send it on the mailing list. If you have any ideas that I can try meanwhile, feel free to contact me to send a patch that I can test.
Hi Mauro, Regarding this issue, I sent a patch on the ML that should solve it. https://patchwork.linuxtv.org/project/linux-media/patch/20210913102254.108638-1-eugen.hristev@microchip.com/ Eugen
Eugenquoted
If the bug still happens, we need a fix for it. We might revert this patch, but this would just be masking some other hidden bug. Regards, Mauroquoted
quoted
quoted
Could you point out how I could fix this ? Maybe the isc_clk->dev is not properly handled/initialized in some other part of the code ?Looking at RPM implementation: static int rpm_resume(struct device *dev, int rpmflags) { ... if (dev->power.runtime_error) retval = -EINVAL; else if (dev->power.disable_depth == 1 && dev->power.is_suspended && dev->power.runtime_status == RPM_ACTIVE) retval = 1; else if (dev->power.disable_depth > 0) retval = -EACCES; ... It sounds that RPM is disabled for this clock. Did you call pm_runtime_enable() before calling isc_clk_prepare()? Thanks, MauroI tried to call pm_runtime_enable for the clk at clk_init time, but doing that makes the runtime for the ISC fail like this: atmel-sama5d2-isc f0008000.isc: Unbalanced pm_runtime_enable!Thanks, Mauro
_______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel