mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: florin.leotescu@oss.nxp.com, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: daniel.baluta@nxp.com, linux-arm-kernel@lists.infradead.org,
	imx@lists.linux.dev, festevam@gmail.com,
	Florin Leotescu <florin.leotescu@nxp.com>
Subject: Re: [RFC PATCH 1/1] hwmon: emc2305: Set max PWM state during shutdown
Date: Fri, 6 Mar 2026 07:55:42 -0800	[thread overview]
Message-ID: <0aaa530c-ff61-4e49-81ca-fd3c98a29f58@roeck-us.net> (raw)
In-Reply-To: <20260306133439.564033-2-florin.leotescu@oss.nxp.com>

On 3/6/26 05:34, florin.leotescu@oss.nxp.com wrote:
> From: Florin Leotescu <florin.leotescu@nxp.com>
> 
> Some platforms rely on Linux to leave the EMC2305 fan controller in a
> safe fan state before the system restart handoff.
> 
> If a soft reboot is initiated, the controller may retain the last PWM
> duty cycle written by the kernel until another software stage
> reconfigures it. On systems where no later stage immediately takes over
> fan control, this may leave the fans running below a desired fail-safe
> level.
> 
> Signed-off-by: Florin Leotescu <florin.leotescu@nxp.com>
> ---
>   drivers/hwmon/emc2305.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c
> index 64b213e1451e..d631d972c40e 100644
> --- a/drivers/hwmon/emc2305.c
> +++ b/drivers/hwmon/emc2305.c
> @@ -714,6 +714,20 @@ static int emc2305_probe(struct i2c_client *client)
>   	return 0;
>   }
>   
> +static void emc2305_shutdown(struct i2c_client *client)
> +{
> +	int i;
> +	int ret;
> +	struct emc2305_data *data = i2c_get_clientdata(client);
> +
> +	for (i = 0; i < data->pwm_num; i++) {
> +		ret = i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_DRIVE(i), EMC2305_FAN_MAX);
> +		if (ret < 0)
> +			dev_warn(&client->dev,
> +				 "Failed to set max PWM on for ch %d during shudown", i);

s/shudown/shutdown, and newline missing

> +	}
> +}
> +

We can not do this unconditionally. This would have to be configurable.
The driver could use the optional fan-shutdown-percent devicetree
property for that purpose.

Thanks,
Guenter


      reply	other threads:[~2026-03-06 15:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 13:34 [RFC PATCH 0/1] Ensure safe fan state during restart florin.leotescu
2026-03-06 13:34 ` [RFC PATCH 1/1] hwmon: emc2305: Set max PWM state during shutdown florin.leotescu
2026-03-06 15:55   ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0aaa530c-ff61-4e49-81ca-fd3c98a29f58@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=daniel.baluta@nxp.com \
    --cc=festevam@gmail.com \
    --cc=florin.leotescu@nxp.com \
    --cc=florin.leotescu@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®