Re: [PATCH] hwmon: (gpd-fan) Reset both fans to automatic on duo boards

From: Guenter Roeck

Date: Fri Sep 25 2026 - 21:46:49 EST


On Fri, Sep 25, 2026 at 08:13:26PM -0400, Alexei Solcanu via B4 Relay wrote:
> From: Alexei Solcanu <alexei.solcanu@xxxxx>
>
> 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@xxxxx>
> ---
> 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@xxxxx>
>
>
>