All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (gpd-fan) Reset both fans to automatic on duo boards
@ 2026-09-26  0:13 ` Alexei Solcanu
  0 siblings, 0 replies; 4+ messages in thread
From: Alexei Solcanu via B4 Relay @ 2026-09-26  0:13 UTC (permalink / raw)
  To: Guenter Roeck, Cryolitia PukNgae
  Cc: linux-hwmon, linux-kernel, Antheas Kapenekakis, Alexei Solcanu

From: Alexei Solcanu <alexei.solcanu@pm.me>

On boards using gpd_duo_drvdata (GPD Duo, GPD Win 5), writing
pwm1_enable=2 only returns the first fan to EC control. The second fan
keeps its last manual duty cycle, e.g. full speed after pwm1=255, so a
fan control tool that exits leaves it running at that speed.

gpd_duo_write_pwm() writes both fan registers (pwm_write and
pwm_write + 1), but switching to automatic only clears pwm_write.
Also clear pwm_write + 1, so both fans return to EC control.

Tested on a GPD Win 5 (G1618-05). Not tested on the GPD Duo.

Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
Assisted-by: LLM
Signed-off-by: Alexei Solcanu <alexei.solcanu@pm.me>
---
Both fans were set to full speed (pwm1_enable=1, pwm1=255), then
switched to automatic (pwm1_enable=2). Values read from the EC 15
seconds later:

                 0x047A  0x047B  fan 1     fan 2
  without patch  0x00    0xf4    2542 rpm  6379 rpm
  with patch     0x00    0x00    2545 rpm  2560 rpm

Fan 2's RPM, found by probing, is at EC 0x0476/0x0477.
---
 drivers/hwmon/gpd-fan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c
index ed212615b2f..b3b75f99f58 100644
--- a/drivers/hwmon/gpd-fan.c
+++ b/drivers/hwmon/gpd-fan.c
@@ -444,6 +444,7 @@ static void gpd_duo_set_pwm_enable(struct gpd_fan_data *data, enum FAN_PWM_ENABL
 		break;
 	case AUTOMATIC:
 		gpd_ecram_write(data->drvdata, data->drvdata->pwm_write, 0);
+		gpd_ecram_write(data->drvdata, data->drvdata->pwm_write + 1, 0);
 		break;
 	}
 }

---
base-commit: 3cbb5f15e464583e59c8501a7085ec12b53e23ac
change-id: 20260925-gpd-fan-duo-auto-871de9e006dc

Best regards,
--  
Alexei Solcanu <alexei.solcanu@pm.me>



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

* [PATCH] hwmon: (gpd-fan) Reset both fans to automatic on duo boards
@ 2026-09-26  0:13 ` Alexei Solcanu
  0 siblings, 0 replies; 4+ messages in thread
From: Alexei Solcanu @ 2026-09-26  0:13 UTC (permalink / raw)
  To: Guenter Roeck, Cryolitia PukNgae
  Cc: linux-hwmon, linux-kernel, Antheas Kapenekakis, Alexei Solcanu

On boards using gpd_duo_drvdata (GPD Duo, GPD Win 5), writing
pwm1_enable=2 only returns the first fan to EC control. The second fan
keeps its last manual duty cycle, e.g. full speed after pwm1=255, so a
fan control tool that exits leaves it running at that speed.

gpd_duo_write_pwm() writes both fan registers (pwm_write and
pwm_write + 1), but switching to automatic only clears pwm_write.
Also clear pwm_write + 1, so both fans return to EC control.

Tested on a GPD Win 5 (G1618-05). Not tested on the GPD Duo.

Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
Assisted-by: LLM
Signed-off-by: Alexei Solcanu <alexei.solcanu@pm.me>
---
Both fans were set to full speed (pwm1_enable=1, pwm1=255), then
switched to automatic (pwm1_enable=2). Values read from the EC 15
seconds later:

                 0x047A  0x047B  fan 1     fan 2
  without patch  0x00    0xf4    2542 rpm  6379 rpm
  with patch     0x00    0x00    2545 rpm  2560 rpm

Fan 2's RPM, found by probing, is at EC 0x0476/0x0477.
---
 drivers/hwmon/gpd-fan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c
index ed212615b2f..b3b75f99f58 100644
--- a/drivers/hwmon/gpd-fan.c
+++ b/drivers/hwmon/gpd-fan.c
@@ -444,6 +444,7 @@ static void gpd_duo_set_pwm_enable(struct gpd_fan_data *data, enum FAN_PWM_ENABL
 		break;
 	case AUTOMATIC:
 		gpd_ecram_write(data->drvdata, data->drvdata->pwm_write, 0);
+		gpd_ecram_write(data->drvdata, data->drvdata->pwm_write + 1, 0);
 		break;
 	}
 }

---
base-commit: 3cbb5f15e464583e59c8501a7085ec12b53e23ac
change-id: 20260925-gpd-fan-duo-auto-871de9e006dc

Best regards,
--  
Alexei Solcanu <alexei.solcanu@pm.me>


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

* Re: [PATCH] hwmon: (gpd-fan) Reset both fans to automatic on duo boards
  2026-09-26  0:13 ` Alexei Solcanu
  (?)
@ 2026-09-26  0:22 ` sashiko-bot
  -1 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-09-26  0:22 UTC (permalink / raw)
  To: Alexei Solcanu; +Cc: linux-hwmon

> From: Alexei Solcanu <alexei.solcanu@pm.me>
> 
> On boards using gpd_duo_drvdata (GPD Duo, GPD Win 5), writing
> pwm1_enable=2 only returns the first fan to EC control. The second fan
> keeps its last manual duty cycle, e.g. full speed after pwm1=255, so a
> fan control tool that exits leaves it running at that speed.
> 
> gpd_duo_write_pwm() writes both fan registers (pwm_write and
> pwm_write + 1), but switching to automatic only clears pwm_write.
> Also clear pwm_write + 1, so both fans return to EC control.
> 
> Tested on a GPD Win 5 (G1618-05). Not tested on the GPD Duo.
> 
> Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
> Assisted-by: LLM
> Signed-off-by: Alexei Solcanu <alexei.solcanu@pm.me>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925-gpd-fan-duo-auto-v1-1-29bb670b3331@pm.me?part=1


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

* Re: [PATCH] hwmon: (gpd-fan) Reset both fans to automatic on duo boards
  2026-09-26  0:13 ` Alexei Solcanu
  (?)
  (?)
@ 2026-09-26  1:46 ` Guenter Roeck
  -1 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2026-09-26  1:46 UTC (permalink / raw)
  To: alexei.solcanu
  Cc: Cryolitia PukNgae, linux-hwmon, linux-kernel, Antheas Kapenekakis

On Fri, Sep 25, 2026 at 08:13:26PM -0400, Alexei Solcanu via B4 Relay wrote:
> From: Alexei Solcanu <alexei.solcanu@pm.me>
> 
> On boards using gpd_duo_drvdata (GPD Duo, GPD Win 5), writing
> pwm1_enable=2 only returns the first fan to EC control. The second fan
> keeps its last manual duty cycle, e.g. full speed after pwm1=255, so a
> fan control tool that exits leaves it running at that speed.
> 
> gpd_duo_write_pwm() writes both fan registers (pwm_write and
> pwm_write + 1), but switching to automatic only clears pwm_write.
> Also clear pwm_write + 1, so both fans return to EC control.
> 
> Tested on a GPD Win 5 (G1618-05). Not tested on the GPD Duo.
> 
> Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
> Assisted-by: LLM
> Signed-off-by: Alexei Solcanu <alexei.solcanu@pm.me>
> ---
> Both fans were set to full speed (pwm1_enable=1, pwm1=255), then
> switched to automatic (pwm1_enable=2). Values read from the EC 15
> seconds later:
> 
>                  0x047A  0x047B  fan 1     fan 2
>   without patch  0x00    0xf4    2542 rpm  6379 rpm
>   with patch     0x00    0x00    2545 rpm  2560 rpm
> 
> Fan 2's RPM, found by probing, is at EC 0x0476/0x0477.

If this system has two fans, why does it register only one 
fan and pwm channel ? This seems conceptually wrong.

Guenter

> ---
>  drivers/hwmon/gpd-fan.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hwmon/gpd-fan.c b/drivers/hwmon/gpd-fan.c
> index ed212615b2f..b3b75f99f58 100644
> --- a/drivers/hwmon/gpd-fan.c
> +++ b/drivers/hwmon/gpd-fan.c
> @@ -444,6 +444,7 @@ static void gpd_duo_set_pwm_enable(struct gpd_fan_data *data, enum FAN_PWM_ENABL
>  		break;
>  	case AUTOMATIC:
>  		gpd_ecram_write(data->drvdata, data->drvdata->pwm_write, 0);
> +		gpd_ecram_write(data->drvdata, data->drvdata->pwm_write + 1, 0);
>  		break;
>  	}
>  }
> 
> ---
> base-commit: 3cbb5f15e464583e59c8501a7085ec12b53e23ac
> change-id: 20260925-gpd-fan-duo-auto-871de9e006dc
> 
> Best regards,
> --  
> Alexei Solcanu <alexei.solcanu@pm.me>
> 
> 
> 

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

end of thread, other threads:[~2026-09-26  1:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-26  0:13 [PATCH] hwmon: (gpd-fan) Reset both fans to automatic on duo boards Alexei Solcanu via B4 Relay
2026-09-26  0:13 ` Alexei Solcanu
2026-09-26  0:22 ` sashiko-bot
2026-09-26  1:46 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.