linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/1] Mediatek PMIC patch
@ 2022-04-24  2:57 Zhiyong Tao
  2022-04-24  2:57 ` [PATCH v3 1/1] pwrap: mediatek: fix FSM timeout issue Zhiyong Tao
  0 siblings, 1 reply; 4+ messages in thread
From: Zhiyong Tao @ 2022-04-24  2:57 UTC (permalink / raw)
  To: lee.jones, robh+dt, matthias.bgg, lgirdwood, broonie,
	eddie.huang, a.zummo, alexandre.belloni, fshao
  Cc: srv_heupstream, hui.liu, tinghan.shen, zhiyong.tao,
	hsin-hsiung.wang, sean.wang, macpaul.lin, wen.su, devicetree,
	linux-kernel, linux-rtc, Project_Global_Chrome_Upstream_Group,
	linux-arm-kernel, linux-mediatek

This patch fix pwrap time out issue.

Changes in patch v3:
1)add fix tag in patch commmit message
2)fix file mode from "100755" to "100644"

Changes in patch v2:
1)add explation commit message on the patch.

Zhiyong.Tao (1):
  pwrap: mediatek: fix FSM timeout issue

 drivers/soc/mediatek/mtk-pmic-wrap.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--
2.18.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/1] pwrap: mediatek: fix FSM timeout issue
  2022-04-24  2:57 [PATCH v3 0/1] Mediatek PMIC patch Zhiyong Tao
@ 2022-04-24  2:57 ` Zhiyong Tao
  2022-04-25  2:05   ` Rex-BC Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Zhiyong Tao @ 2022-04-24  2:57 UTC (permalink / raw)
  To: lee.jones, robh+dt, matthias.bgg, lgirdwood, broonie,
	eddie.huang, a.zummo, alexandre.belloni, fshao
  Cc: srv_heupstream, hui.liu, tinghan.shen, zhiyong.tao,
	hsin-hsiung.wang, sean.wang, macpaul.lin, wen.su, devicetree,
	linux-kernel, linux-rtc, Project_Global_Chrome_Upstream_Group,
	linux-arm-kernel, linux-mediatek

From: "Zhiyong.Tao" <zhiyong.tao@mediatek.com>

Fix pwrap FSM timeout issue which leads the system crash on GFX VSRAM
power on.
Add a usleep delay to avoid busy read for the H/W status.
For avoiding the system behavior(ex. disable interrupt in suspend/resume
flow, schedule block task)cause if (time_after()) be turn first,
we change it after sleep delay.
Fixes: 1f022d84bd19 ("soc: mediatek: Add PMIC wrapper for MT8135 and
MT8173 SoCs")

Signed-off-by: Zhiyong.Tao <zhiyong.tao@mediatek.com>
---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index 952bc554f443..ac7139a67e87 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -12,6 +12,7 @@
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
+#include <linux/delay.h>
 
 #define PWRAP_MT8135_BRIDGE_IORD_ARB_EN		0x4
 #define PWRAP_MT8135_BRIDGE_WACS3_EN		0x10
@@ -1197,10 +1198,13 @@ static int pwrap_wait_for_state(struct pmic_wrapper *wrp,
 	timeout = jiffies + usecs_to_jiffies(10000);
 
 	do {
-		if (time_after(jiffies, timeout))
-			return fp(wrp) ? 0 : -ETIMEDOUT;
 		if (fp(wrp))
 			return 0;
+
+		usleep_range(10, 11);
+
+		if (time_after(jiffies, timeout))
+			return fp(wrp) ? 0 : -ETIMEDOUT;
 	} while (1);
 }
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/1] pwrap: mediatek: fix FSM timeout issue
  2022-04-24  2:57 ` [PATCH v3 1/1] pwrap: mediatek: fix FSM timeout issue Zhiyong Tao
@ 2022-04-25  2:05   ` Rex-BC Chen
  2022-04-25 10:50     ` Matthias Brugger
  0 siblings, 1 reply; 4+ messages in thread
From: Rex-BC Chen @ 2022-04-25  2:05 UTC (permalink / raw)
  To: Zhiyong Tao, lee.jones, robh+dt, matthias.bgg, lgirdwood,
	broonie, eddie.huang, a.zummo, alexandre.belloni, fshao
  Cc: srv_heupstream, hui.liu, tinghan.shen, hsin-hsiung.wang,
	sean.wang, macpaul.lin, wen.su, devicetree, linux-kernel,
	linux-rtc, Project_Global_Chrome_Upstream_Group,
	linux-arm-kernel, linux-mediatek

On Sun, 2022-04-24 at 10:57 +0800, Zhiyong Tao wrote:
> From: "Zhiyong.Tao" <zhiyong.tao@mediatek.com>
> 
> Fix pwrap FSM timeout issue which leads the system crash on GFX VSRAM
> power on.
> Add a usleep delay to avoid busy read for the H/W status.
> For avoiding the system behavior(ex. disable interrupt in
> suspend/resume
> flow, schedule block task)cause if (time_after()) be turn first,
> we change it after sleep delay.
> Fixes: 1f022d84bd19 ("soc: mediatek: Add PMIC wrapper for MT8135 and
> MT8173 SoCs")
> 
> Signed-off-by: Zhiyong.Tao <zhiyong.tao@mediatek.com>
> ---

Hello Zhiyong,

IMO, commit messages should be

Fix pwrap FSM timeout issue....
...we change it after sleep delay.

(=> one blank)
Fixes: 1f022d84bd19 ("soc: mediatek: Add PMIC wrapper for MT8135 and
MT8173 SoCs")
(=> oneline)

Signed-off-by: Zhiyong.Tao <zhiyong.tao@mediatek.com>

>  drivers/soc/mediatek/mtk-pmic-wrap.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c
> b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index 952bc554f443..ac7139a67e87 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
> @@ -12,6 +12,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/reset.h>
> +#include <linux/delay.h>

Sorry, I do not notice this in previous version. It will proper order
the header in alphabet.

 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>

BRs,
Rex
>  
>  #define PWRAP_MT8135_BRIDGE_IORD_ARB_EN		0x4
>  #define PWRAP_MT8135_BRIDGE_WACS3_EN		0x10
> @@ -1197,10 +1198,13 @@ static int pwrap_wait_for_state(struct
> pmic_wrapper *wrp,
>  	timeout = jiffies + usecs_to_jiffies(10000);
>  
>  	do {
> -		if (time_after(jiffies, timeout))
> -			return fp(wrp) ? 0 : -ETIMEDOUT;
>  		if (fp(wrp))
>  			return 0;
> +
> +		usleep_range(10, 11);
> +
> +		if (time_after(jiffies, timeout))
> +			return fp(wrp) ? 0 : -ETIMEDOUT;
>  	} while (1);
>  }
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/1] pwrap: mediatek: fix FSM timeout issue
  2022-04-25  2:05   ` Rex-BC Chen
@ 2022-04-25 10:50     ` Matthias Brugger
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Brugger @ 2022-04-25 10:50 UTC (permalink / raw)
  To: Rex-BC Chen, Zhiyong Tao, lee.jones, robh+dt, lgirdwood, broonie,
	eddie.huang, a.zummo, alexandre.belloni, fshao
  Cc: srv_heupstream, hui.liu, tinghan.shen, hsin-hsiung.wang,
	sean.wang, macpaul.lin, wen.su, devicetree, linux-kernel,
	linux-rtc, Project_Global_Chrome_Upstream_Group,
	linux-arm-kernel, linux-mediatek



On 25/04/2022 04:05, Rex-BC Chen wrote:
> On Sun, 2022-04-24 at 10:57 +0800, Zhiyong Tao wrote:
>> From: "Zhiyong.Tao" <zhiyong.tao@mediatek.com>
>>
>> Fix pwrap FSM timeout issue which leads the system crash on GFX VSRAM
>> power on.
>> Add a usleep delay to avoid busy read for the H/W status.
>> For avoiding the system behavior(ex. disable interrupt in
>> suspend/resume
>> flow, schedule block task)cause if (time_after()) be turn first,
>> we change it after sleep delay.

I'm not sure what you mean with this sentence. But it sound's like we want to 
paper about some issue. Can you please explain better?

Thanks,
Matthias

>> Fixes: 1f022d84bd19 ("soc: mediatek: Add PMIC wrapper for MT8135 and
>> MT8173 SoCs")
>>
>> Signed-off-by: Zhiyong.Tao <zhiyong.tao@mediatek.com>
>> ---
> 
> Hello Zhiyong,
> 
> IMO, commit messages should be
> 
> Fix pwrap FSM timeout issue....
> ...we change it after sleep delay.
> 
> (=> one blank)
> Fixes: 1f022d84bd19 ("soc: mediatek: Add PMIC wrapper for MT8135 and
> MT8173 SoCs")
> (=> oneline)
> 
> Signed-off-by: Zhiyong.Tao <zhiyong.tao@mediatek.com>
> 
>>   drivers/soc/mediatek/mtk-pmic-wrap.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c
>> b/drivers/soc/mediatek/mtk-pmic-wrap.c
>> index 952bc554f443..ac7139a67e87 100644
>> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
>> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
>> @@ -12,6 +12,7 @@
>>   #include <linux/platform_device.h>
>>   #include <linux/regmap.h>
>>   #include <linux/reset.h>
>> +#include <linux/delay.h>
> 
> Sorry, I do not notice this in previous version. It will proper order
> the header in alphabet.
> 
>   #include <linux/delay.h>
>   #include <linux/platform_device.h>
>   #include <linux/regmap.h>
>   #include <linux/reset.h>
> 
> BRs,
> Rex
>>   
>>   #define PWRAP_MT8135_BRIDGE_IORD_ARB_EN		0x4
>>   #define PWRAP_MT8135_BRIDGE_WACS3_EN		0x10
>> @@ -1197,10 +1198,13 @@ static int pwrap_wait_for_state(struct
>> pmic_wrapper *wrp,
>>   	timeout = jiffies + usecs_to_jiffies(10000);
>>   
>>   	do {
>> -		if (time_after(jiffies, timeout))
>> -			return fp(wrp) ? 0 : -ETIMEDOUT;
>>   		if (fp(wrp))
>>   			return 0;
>> +
>> +		usleep_range(10, 11);
>> +
>> +		if (time_after(jiffies, timeout))
>> +			return fp(wrp) ? 0 : -ETIMEDOUT;
>>   	} while (1);
>>   }
>>   
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-25 10:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24  2:57 [PATCH v3 0/1] Mediatek PMIC patch Zhiyong Tao
2022-04-24  2:57 ` [PATCH v3 1/1] pwrap: mediatek: fix FSM timeout issue Zhiyong Tao
2022-04-25  2:05   ` Rex-BC Chen
2022-04-25 10:50     ` Matthias Brugger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).