diff mbox series

venus: core: Fix platform driver shutdown

Message ID 20201221095820.27192-1-stanimir.varbanov@linaro.org
State Accepted
Commit 9eb09dc2f4650de8c6ce286d3153511e6f6314c0
Headers show
Series venus: core: Fix platform driver shutdown | expand

Commit Message

Stanimir Varbanov Dec. 21, 2020, 9:58 a.m. UTC
With TZ system reboot cannot finish successfully. To fix that
enable core clocks by runtime pm before TZ calls and disable
clocks after that.

Fixes: 7399139be6b2 ("media: venus: core: add shutdown callback for venus")
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

---
 drivers/media/platform/qcom/venus/core.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.17.1

Comments

Shawn Guo Dec. 21, 2020, 10:40 a.m. UTC | #1
On Mon, Dec 21, 2020 at 5:58 PM Stanimir Varbanov
<stanimir.varbanov@linaro.org> wrote:
>

> With TZ system reboot cannot finish successfully. To fix that

> enable core clocks by runtime pm before TZ calls and disable

> clocks after that.

>

> Fixes: 7399139be6b2 ("media: venus: core: add shutdown callback for venus")

> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>


It fixes reboot on Lenovo Yoga C630 laptop for me, so:

Tested-by: Shawn Guo <shawn.guo@linaro.org>
Shawn Guo Jan. 19, 2021, 7:40 a.m. UTC | #2
On Mon, Dec 21, 2020 at 11:58:20AM +0200, Stanimir Varbanov wrote:
> With TZ system reboot cannot finish successfully. To fix that
> enable core clocks by runtime pm before TZ calls and disable
> clocks after that.
> 
> Fixes: 7399139be6b2 ("media: venus: core: add shutdown callback for venus")
> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

Hi Mauro,

Could you help pick this fix up?

Shawn

> ---
>  drivers/media/platform/qcom/venus/core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index bdd293faaad0..7233a7311757 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -349,8 +349,10 @@ static void venus_core_shutdown(struct platform_device *pdev)
>  {
>  	struct venus_core *core = platform_get_drvdata(pdev);
>  
> +	pm_runtime_get_sync(core->dev);
>  	venus_shutdown(core);
>  	venus_firmware_deinit(core);
> +	pm_runtime_put_sync(core->dev);
>  }
>  
>  static __maybe_unused int venus_runtime_suspend(struct device *dev)
> -- 
> 2.17.1
>
Stanimir Varbanov Jan. 19, 2021, 7:59 a.m. UTC | #3
On 1/19/21 9:40 AM, Shawn Guo wrote:
> On Mon, Dec 21, 2020 at 11:58:20AM +0200, Stanimir Varbanov wrote:

>> With TZ system reboot cannot finish successfully. To fix that

>> enable core clocks by runtime pm before TZ calls and disable

>> clocks after that.

>>

>> Fixes: 7399139be6b2 ("media: venus: core: add shutdown callback for venus")

>> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> 

> Hi Mauro,

> 

> Could you help pick this fix up?


Shawn, it is part of linux-next already.

> 

> Shawn

> 

>> ---

>>  drivers/media/platform/qcom/venus/core.c | 2 ++

>>  1 file changed, 2 insertions(+)

>>

>> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c

>> index bdd293faaad0..7233a7311757 100644

>> --- a/drivers/media/platform/qcom/venus/core.c

>> +++ b/drivers/media/platform/qcom/venus/core.c

>> @@ -349,8 +349,10 @@ static void venus_core_shutdown(struct platform_device *pdev)

>>  {

>>  	struct venus_core *core = platform_get_drvdata(pdev);

>>  

>> +	pm_runtime_get_sync(core->dev);

>>  	venus_shutdown(core);

>>  	venus_firmware_deinit(core);

>> +	pm_runtime_put_sync(core->dev);

>>  }

>>  

>>  static __maybe_unused int venus_runtime_suspend(struct device *dev)

>> -- 

>> 2.17.1

>>


-- 
regards,
Stan
Shawn Guo Jan. 19, 2021, 8:22 a.m. UTC | #4
On Tue, Jan 19, 2021 at 09:59:41AM +0200, Stanimir Varbanov wrote:
> On 1/19/21 9:40 AM, Shawn Guo wrote:

> > On Mon, Dec 21, 2020 at 11:58:20AM +0200, Stanimir Varbanov wrote:

> >> With TZ system reboot cannot finish successfully. To fix that

> >> enable core clocks by runtime pm before TZ calls and disable

> >> clocks after that.

> >>

> >> Fixes: 7399139be6b2 ("media: venus: core: add shutdown callback for venus")

> >> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> > 

> > Hi Mauro,

> > 

> > Could you help pick this fix up?

> 

> Shawn, it is part of linux-next already.


Ha, sorry, I did not check linux-next.  I sent the message because
I see this fix is still missing after I rebase my Yoga C630 branch
to 5.11-rc4.  We will get this fix into 5.11, right?

Shawn
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index bdd293faaad0..7233a7311757 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -349,8 +349,10 @@  static void venus_core_shutdown(struct platform_device *pdev)
 {
 	struct venus_core *core = platform_get_drvdata(pdev);
 
+	pm_runtime_get_sync(core->dev);
 	venus_shutdown(core);
 	venus_firmware_deinit(core);
+	pm_runtime_put_sync(core->dev);
 }
 
 static __maybe_unused int venus_runtime_suspend(struct device *dev)