Skip to contentSkip to conversation

pwm: berlin: Fix wrong register in suspend/resume

PATCH Superseded Jisheng Zhang 2 participants 4 messages Aug 15, 2025 – Aug 19, 2025 PWM

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwm: berlin: Fix wrong register in suspend/resume

The 'enable' register should be BERLIN_PWM_EN rather than BERLIN_PWM_ENABLE.

Fixes bbf0722c1c66 ("pwm: berlin: Add suspend/resume support")
---
 drivers/pwm/pwm-berlin.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-berlin.c +2 -2
index 831aed228caf..858d36991374 100644
@@ -234,7 +234,7 @@ static int berlin_pwm_suspend(struct device *dev)
 	for (i = 0; i < chip->npwm; i++) {
 		struct berlin_pwm_channel *channel = &bpc->channel[i];
 
-		channel->enable = berlin_pwm_readl(bpc, i, BERLIN_PWM_ENABLE);
+		channel->enable = berlin_pwm_readl(bpc, i, BERLIN_PWM_EN);
 		channel->ctrl = berlin_pwm_readl(bpc, i, BERLIN_PWM_CONTROL);
 		channel->duty = berlin_pwm_readl(bpc, i, BERLIN_PWM_DUTY);
 		channel->tcnt = berlin_pwm_readl(bpc, i, BERLIN_PWM_TCNT);
@@ -262,7 +262,7 @@ static int berlin_pwm_resume(struct device *dev)
 		berlin_pwm_writel(bpc, i, channel->ctrl, BERLIN_PWM_CONTROL);
 		berlin_pwm_writel(bpc, i, channel->duty, BERLIN_PWM_DUTY);
 		berlin_pwm_writel(bpc, i, channel->tcnt, BERLIN_PWM_TCNT);
-		berlin_pwm_writel(bpc, i, channel->enable, BERLIN_PWM_ENABLE);
+		berlin_pwm_writel(bpc, i, channel->enable, BERLIN_PWM_EN);
 	}
 
 	return 0;
Signature · 1 line
2.50.0
#1 lore raw

Hello,

Quoted 14 lines · Jisheng Zhang

The 'enable' register should be BERLIN_PWM_EN rather than BERLIN_PWM_ENABLE.

Fixes bbf0722c1c66 ("pwm: berlin: Add suspend/resume support")
---
 drivers/pwm/pwm-berlin.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-berlin.c +0 -0
index 831aed228caf..858d36991374 100644

drivers/pwm/pwm-berlin.c static int berlin_pwm_suspend(struct device *dev) · line 237

Quoted 5 lines
drivers/pwm/pwm-berlin.c +1 -1
@@ -234,7 +234,7 @@ static int berlin_pwm_suspend(struct device *dev)
 	for (i = 0; i < chip->npwm; i++) {
 		struct berlin_pwm_channel *channel = &bpc->channel[i];
 
-		channel->enable = berlin_pwm_readl(bpc, i, BERLIN_PWM_ENABLE);
+		channel->enable = berlin_pwm_readl(bpc, i, BERLIN_PWM_EN);

BERLIN_PWM_ENABLE is 1 and BERLIN_PWM_EN is 0. What is the effect? Is the low bit just ignored and the right thing happens? Or does this result in a bus exception and the machine catches fire?

If it's more the latter than the former, I wonder how that didn't pop up earlier.

Best regards
Uwe

#2 lore raw
Quoted 1 line · Uwe Kleine-König

Hello,

Hi,

Quoted 19 lines · Jisheng Zhang
Quoted 17 lines

The 'enable' register should be BERLIN_PWM_EN rather than BERLIN_PWM_ENABLE.

Fixes bbf0722c1c66 ("pwm: berlin: Add suspend/resume support")
---
 drivers/pwm/pwm-berlin.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-berlin.c +0 -0
index 831aed228caf..858d36991374 100644
@@ -234,7 +234,7 @@ static int berlin_pwm_suspend(struct device *dev)
 	for (i = 0; i < chip->npwm; i++) {
 		struct berlin_pwm_channel *channel = &bpc->channel[i];
 
Quoted 5 lines

drivers/pwm/pwm-berlin.c static int berlin_pwm_suspend(struct device *dev) · line 237

Quoted 2 lines
drivers/pwm/pwm-berlin.c +1 -1
-		channel->enable = berlin_pwm_readl(bpc, i, BERLIN_PWM_ENABLE);
+		channel->enable = berlin_pwm_readl(bpc, i, BERLIN_PWM_EN);

BERLIN_PWM_ENABLE is 1 and BERLIN_PWM_EN is 0. What is the effect? Is the low bit just ignored and the right thing happens? Or does this

operate the wrong address then kernel panic

Quoted 1 line

result in a bus exception and the machine catches fire?

Yep, cpu exception then kernel panic.

Quoted 3 lines

If it's more the latter than the former, I wonder how that didn't pop up earlier.

This bug has been fixed in vendor's repo for a long time, it's just because we didn't upstream the fix.

Thanks

#3 lore raw

Hello,

Quoted 16 lines · Jisheng Zhang
Quoted 9 lines · Uwe Kleine-König
Quoted 8 lines · Jisheng Zhang
drivers/pwm/pwm-berlin.c +0 -0
index 831aed228caf..858d36991374 100644
@@ -234,7 +234,7 @@ static int berlin_pwm_suspend(struct device *dev)
 	for (i = 0; i < chip->npwm; i++) {
 		struct berlin_pwm_channel *channel = &bpc->channel[i];
 
Quoted 5 lines

drivers/pwm/pwm-berlin.c static int berlin_pwm_suspend(struct device *dev) · line 237

Quoted 2 lines
drivers/pwm/pwm-berlin.c +1 -1
-		channel->enable = berlin_pwm_readl(bpc, i, BERLIN_PWM_ENABLE);
+		channel->enable = berlin_pwm_readl(bpc, i, BERLIN_PWM_EN);

BERLIN_PWM_ENABLE is 1 and BERLIN_PWM_EN is 0. What is the effect? Is the low bit just ignored and the right thing happens? Or does this

Quoted 5 lines

operate the wrong address then kernel panic

Quoted 1 line

result in a bus exception and the machine catches fire?

Yep, cpu exception then kernel panic.

Can you please mention that in the commit log to make reader able to judge the importance, please?

Quoted 5 lines
Quoted 2 lines

If it's more the latter than the former, I wonder how that didn't pop up earlier.

This bug has been fixed in vendor's repo for a long time, it's just because we didn't upstream the fix.

Wow.

Best regards
Uwe