[PATCH] clk: qcom: gcc-sm6350: Update the .pwrsts for usb gdscs

Luca Weiss posted 1 patch 1 year, 7 months ago
drivers/clk/qcom/gcc-sm6350.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] clk: qcom: gcc-sm6350: Update the .pwrsts for usb gdscs
Posted by Luca Weiss 1 year, 7 months ago
The USB controllers on sm6350 do not retain the state when
the system goes into low power state and the GDSCs are
turned off.

This can be observed by the USB connection not coming back alive after
putting the device into suspend, essentially breaking USB.

Fix this by updating the .pwrsts for the USB GDSCs so they only
transition to retention state in low power.

Cc: Rajendra Nayak <quic_rjendra@quicinc.com>
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
Similar to sc7180 & sc7280 patches that have been applied recently:
https://lore.kernel.org/linux-arm-msm/20220927170516.zrkzn3xl7oedzi4l@builder.lan/T/

@Rajendra Nayak: Maybe you know a bit more about the internals of
sm6350&sm7225. As described in the commit message USB just stops working
after suspend, with this it comes back after wakeup from suspend and
continues working. If any details in the commit message are somehow
wrong or I can add something, please let me know!
Thanks for fixing this on sc7180&sc7280!

 drivers/clk/qcom/gcc-sm6350.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/gcc-sm6350.c b/drivers/clk/qcom/gcc-sm6350.c
index 69412400efa4..9b4e4bb05963 100644
--- a/drivers/clk/qcom/gcc-sm6350.c
+++ b/drivers/clk/qcom/gcc-sm6350.c
@@ -2316,7 +2316,7 @@ static struct gdsc usb30_prim_gdsc = {
 	.pd = {
 		.name = "usb30_prim_gdsc",
 	},
-	.pwrsts = PWRSTS_OFF_ON,
+	.pwrsts = PWRSTS_RET_ON,
 };
 
 static struct gdsc ufs_phy_gdsc = {
-- 
2.37.3
Re: [PATCH] clk: qcom: gcc-sm6350: Update the .pwrsts for usb gdscs
Posted by Bjorn Andersson 1 year, 7 months ago
On Wed, 28 Sep 2022 15:28:54 +0200, Luca Weiss wrote:
> The USB controllers on sm6350 do not retain the state when
> the system goes into low power state and the GDSCs are
> turned off.
> 
> This can be observed by the USB connection not coming back alive after
> putting the device into suspend, essentially breaking USB.
> 
> [...]

Applied, thanks!

[1/1] clk: qcom: gcc-sm6350: Update the .pwrsts for usb gdscs
      commit: a01ef02093ac45cc4991dbf93134c3cb4c293c32

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>
Re: [PATCH] clk: qcom: gcc-sm6350: Update the .pwrsts for usb gdscs
Posted by Rajendra Nayak 1 year, 7 months ago
On 9/28/2022 6:58 PM, Luca Weiss wrote:
> The USB controllers on sm6350 do not retain the state when
> the system goes into low power state and the GDSCs are
> turned off.
> 
> This can be observed by the USB connection not coming back alive after
> putting the device into suspend, essentially breaking USB.
> 
> Fix this by updating the .pwrsts for the USB GDSCs so they only
> transition to retention state in low power.
> 
> Cc: Rajendra Nayak <quic_rjendra@quicinc.com>
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
> Similar to sc7180 & sc7280 patches that have been applied recently:
> https://lore.kernel.org/linux-arm-msm/20220927170516.zrkzn3xl7oedzi4l@builder.lan/T/
> 
> @Rajendra Nayak: Maybe you know a bit more about the internals of
> sm6350&sm7225. As described in the commit message USB just stops working
> after suspend, with this it comes back after wakeup from suspend and
> continues working. If any details in the commit message are somehow
> wrong or I can add something, please let me know!

ah right, this seems like the exact same case as sc7180 and sc7280,
the only additional thing to mention perhaps is that these SoCs
only support CX RET (I don't know but I am guessing they don't support
CX PowerCollapse since you said your change worked) and hence there are
no cxcs entries populated.

> Thanks for fixing this on sc7180&sc7280!
> 
>   drivers/clk/qcom/gcc-sm6350.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/qcom/gcc-sm6350.c b/drivers/clk/qcom/gcc-sm6350.c
> index 69412400efa4..9b4e4bb05963 100644
> --- a/drivers/clk/qcom/gcc-sm6350.c
> +++ b/drivers/clk/qcom/gcc-sm6350.c
> @@ -2316,7 +2316,7 @@ static struct gdsc usb30_prim_gdsc = {
>   	.pd = {
>   		.name = "usb30_prim_gdsc",
>   	},
> -	.pwrsts = PWRSTS_OFF_ON,
> +	.pwrsts = PWRSTS_RET_ON,
>   };
>   
>   static struct gdsc ufs_phy_gdsc = {