From: Krishna Chomal <krishna.chomal108@gmail.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hansg@kernel.org>,
linux@roeck-us.net, platform-driver-x86@vger.kernel.org,
linux-hwmon@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] platform/x86: hp-wmi: implement fan keep-alive
Date: Tue, 30 Dec 2025 20:03:04 +0530 [thread overview]
Message-ID: <aVPgW8uAi4RNOUbd@archlinux> (raw)
In-Reply-To: <7072d96f-455a-5249-2553-6e72e6a00577@linux.intel.com>
On Mon, Dec 29, 2025 at 03:21:42PM +0200, Ilpo Järvinen wrote:
[snip]
>> +/*
>> + * 90s delay to prevent the firmware from resetting fan mode after fixed
>> + * 120s timeout
>> + */
>> +#define KEEP_ALIVE_DELAY 90
>
>For any time related define, please include its unit in the name so a
>person reading code can immediately know it.
>
Renamed to KEEP_ALIVE_DELAY_SECS v2.
[snip]
>> @@ -2159,23 +2174,36 @@ static int hp_wmi_hwmon_enforce_ctx(struct hp_wmi_hwmon_priv *ctx)
>> case PWM_MODE_MAX:
>> if (is_victus_s_thermal_profile())
>> hp_wmi_get_fan_count_userdefine_trigger();
>> - return hp_wmi_fan_speed_max_set(1);
>> + ret = hp_wmi_fan_speed_max_set(1);
>> + break;
>> case PWM_MODE_MANUAL:
>> if (!is_victus_s_thermal_profile())
>> return -EOPNOTSUPP;
>> - return hp_wmi_fan_speed_set(ctx, PWM_TO_RPM(ctx->pwm, ctx));
>> + ret = hp_wmi_fan_speed_set(ctx, PWM_TO_RPM(ctx->pwm, ctx));
>> + break;
>> case PWM_MODE_AUTO:
>> if (is_victus_s_thermal_profile()) {
>> hp_wmi_get_fan_count_userdefine_trigger();
>> - return hp_wmi_fan_speed_max_reset(ctx);
>> + ret = hp_wmi_fan_speed_max_reset(ctx);
>> } else {
>> - return hp_wmi_fan_speed_max_set(0);
>> + ret = hp_wmi_fan_speed_max_set(0);
>> }
>> + break;
>> default:
>> /* shouldn't happen */
>> return -EINVAL;
>> }
>>
>> + if (ret < 0)
>> + return ret;
>> +
>> + /* Reschedule keep-alive work based on the new state */
>> + if (ctx->mode == PWM_MODE_MAX || ctx->mode == PWM_MODE_MANUAL)
>> + schedule_delayed_work(&ctx->keep_alive_dwork,
>> + secs_to_jiffies(KEEP_ALIVE_DELAY));
>> + else
>> + cancel_delayed_work_sync(&ctx->keep_alive_dwork);
>
>This is now duplicating the switch/case, just add these to the existing
>cases.
>
>You may want to introduce ret variable already in PATCH 1/2 and add a note
>there that an upcoming change is going to add keep-alive so the return
>value has to be stored temporarily.
>
Yes, handled the re-scheduling in switch/case itself in v2 and introduced
the temporary ret variable in patch 1/2.
>> +
>> return 0;
>> }
>>
>> @@ -2321,6 +2349,20 @@ static const struct hwmon_chip_info chip_info = {
>> .info = info,
>> };
>>
>> +static void hp_wmi_hwmon_keep_alive_handler(struct work_struct *work)
>> +{
>> + struct delayed_work *dwork;
>> + struct hp_wmi_hwmon_priv *ctx;
>> +
>> + dwork = to_delayed_work(work);
>> + ctx = container_of(dwork, struct hp_wmi_hwmon_priv, keep_alive_dwork);
>> + /*
>> + * Re-apply the current hwmon context settings.
>> + * NOTE: hp_wmi_hwmon_enforce_ctx will handle the re-scheduling.
>> + */
>> + hp_wmi_hwmon_enforce_ctx(ctx);
>
>(I only now understand why you named this function like this, and I still
>don't think it's a good name for it as you've other callers besides this
>one real "enforcing" case.)
>
Yes named to "apply_fan_settings" in patch 1/2 of this series.
next prev parent reply other threads:[~2025-12-30 14:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-25 14:23 [PATCH 0/2] platform/x86: hp-wmi: Add manual fan support for Victus S laptops Krishna Chomal
2025-12-25 14:23 ` [PATCH 1/2] platform/x86: hp-wmi: add manual fan control for Victus S models Krishna Chomal
2025-12-29 13:08 ` Ilpo Järvinen
2025-12-30 14:22 ` Krishna Chomal
2025-12-25 14:23 ` [PATCH 2/2] platform/x86: hp-wmi: implement fan keep-alive Krishna Chomal
2025-12-29 13:21 ` Ilpo Järvinen
2025-12-30 14:33 ` Krishna Chomal [this message]
2025-12-30 14:50 ` [PATCH v2 0/2] platform/x86: hp-wmi: Add manual fan support for Victus S laptops Krishna Chomal
2025-12-30 14:50 ` [PATCH v2 1/2] platform/x86: hp-wmi: add manual fan control for Victus S models Krishna Chomal
2026-01-12 15:13 ` Ilpo Järvinen
2026-01-12 18:03 ` Krishna Chomal
2026-01-12 18:08 ` Ilpo Järvinen
2026-01-12 18:17 ` Krishna Chomal
2025-12-30 14:50 ` [PATCH v2 2/2] platform/x86: hp-wmi: implement fan keep-alive Krishna Chomal
2026-01-12 15:14 ` Ilpo Järvinen
2026-01-12 18:07 ` Krishna Chomal
2026-01-13 12:37 ` [PATCH v3 0/3] platform/x86: hp-wmi: Add manual fan support for Victus S laptops Krishna Chomal
2026-01-13 12:37 ` [PATCH v3 1/3] platform/x86: hp-wmi: order include headers Krishna Chomal
2026-01-13 12:37 ` [PATCH v3 2/3] platform/x86: hp-wmi: add manual fan control for Victus S models Krishna Chomal
2026-01-13 12:37 ` [PATCH v3 3/3] platform/x86: hp-wmi: implement fan keep-alive Krishna Chomal
2026-01-15 13:45 ` [PATCH v3 0/3] platform/x86: hp-wmi: Add manual fan support for Victus S laptops Ilpo Järvinen
2026-01-16 14:23 ` Krishna Chomal
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=aVPgW8uAi4RNOUbd@archlinux \
--to=krishna.chomal108@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=platform-driver-x86@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 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.