mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rong Zhang <i@rong.moe>
To: Tom Hu <huxiaoying@kylinos.cn>,
	linux-kernel@vger.kernel.org,
	 platform-driver-x86@vger.kernel.org
Cc: "Mark Pearson" <mpearson-lenovo@squebb.ca>,
	"Henrique de Moraes Holschuh" <hmh@hmh.eng.br>,
	"Derek J . Clark" <derekjohn.clark@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	xiaoying_hu@126.com
Subject: Re: [PATCH v3 2/2] platform/x86: thinkpad_acpi: Default charge_stop to 100 when unsupported
Date: Thu, 26 Nov 2026 20:16:06 +0800	[thread overview]
Message-ID: <28df34b19682af96231caaf30185113972d2f735.camel@rong.moe> (raw)
In-Reply-To: <20261126011058.39175-3-huxiaoying@kylinos.cn>

Hi Tom,

On Thu, 2026-11-26 at 09:10 +0800, Tom Hu wrote:
> From: huxiaoying <huxiaoying@kylinos.cn>
> 
> When the EC does not provide GET_STOP, stop_support stays clear and the
> cached charge_stop is never probed, so it remains 0.  charge_start is
> still validated against that value, which rejects every level above 0
> even though the start threshold is supported.
> 
> Default the cached charge_stop to 100 in tpacpi_battery_probe().  The
> store path already limits charge_start to [0, 99], so the
> `value > charge_stop` cross check can then never trigger when no stop
> threshold is known, and stop_support does not have to be consulted in
> that path.  A successful GET_STOP probe overwrites the default with the
> value reported by the EC.
> 
> Suggested-by: Rong Zhang <i@rong.moe>
> Link: https://lore.kernel.org/all/8aceee902d146619d2d5b92b84942baeb27d111f.camel@rong.moe/
> Reviewed-by: Rong Zhang <i@rong.moe>
> Reviewed-by: Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>

You didn't fix the corrupted tag, but claimed it as fixed in your
previous reply!?

Thanks,
Rong

> Signed-off-by: huxiaoying <huxiaoying@kylinos.cn>
> 
> Changes in v3:
> - Add the missing Link: tag after Suggested-by (Rong Zhang).
> - Fix the duplicated "Reviewed-by:" prefix on Mark Pearson's tag.
> - No code changes.
> 
> Changes in v2:
> - Default charge_stop to 100 in tpacpi_battery_probe() instead of
>   guarding the cross check with stop_support
> ---
>  drivers/platform/x86/lenovo/thinkpad_acpi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> index 8fc5569131f6..0c27e0b74b48 100644
> --- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
> +++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> @@ -9698,6 +9698,14 @@ static int tpacpi_battery_probe(int battery)
>  	memset(&battery_info.batteries[battery], 0,
>  		sizeof(battery_info.batteries[battery]));
>  
> +	/*
> +	 * If the EC does not provide GET_STOP, stop_support stays clear and
> +	 * charge_stop is never probed.  Default it to 100 (no upper limit)
> +	 * so that the cross check in tpacpi_battery_store() does not reject
> +	 * every charge_start value.
> +	 */
> +	battery_info.batteries[battery].charge_stop = 100;
> +
>  	/*
>  	 * 1) Get the current start threshold
>  	 * 2) Check for support

  reply	other threads:[~2026-11-26 12:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 10:39 [PATCH 1/2] platform/x86: thinkpad_acpi: Update charge_stop only after it was applied Tom Hu
2026-11-24 10:39 ` [PATCH 2/2] platform/x86: thinkpad_acpi: Only check charge_start against a known charge_stop Tom Hu
2026-11-24 14:02   ` Rong Zhang
2026-11-24 18:00   ` Mark Pearson
2026-11-25 12:52     ` Tom Hu
2026-11-25 12:52       ` [PATCH v2 1/2] platform/x86: thinkpad_acpi: Update charge_stop only after it was applied Tom Hu
2026-11-25 14:09         ` Rong Zhang
2026-11-25 12:52       ` [PATCH v2 2/2] platform/x86: thinkpad_acpi: Default charge_stop to 100 when unsupported Tom Hu
2026-11-25 14:10         ` Rong Zhang
2026-11-25 17:05       ` [PATCH 2/2] platform/x86: thinkpad_acpi: Only check charge_start against a known charge_stop Mark Pearson
2026-11-26  1:10     ` [PATCH v2 2/2] platform/x86: thinkpad_acpi: Default charge_stop to 100 when unsupported Tom Hu
2026-11-26  1:10       ` [PATCH v3 1/2] platform/x86: thinkpad_acpi: Update charge_stop only after it was applied Tom Hu
2026-11-26 12:16         ` Rong Zhang
2026-11-26  1:10       ` [PATCH v3 2/2] platform/x86: thinkpad_acpi: Default charge_stop to 100 when unsupported Tom Hu
2026-11-26 12:16         ` Rong Zhang [this message]
2026-11-27  1:47     ` Tom Hu
2026-11-27  1:50     ` [PATCH v4 1/2] platform/x86: thinkpad_acpi: Update charge_stop only after it was applied Tom Hu
2026-11-27  1:50       ` [PATCH v4 2/2] platform/x86: thinkpad_acpi: Default charge_stop to 100 when unsupported Tom Hu
2026-11-24 14:02 ` [PATCH 1/2] platform/x86: thinkpad_acpi: Update charge_stop only after it was applied Rong Zhang

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=28df34b19682af96231caaf30185113972d2f735.camel@rong.moe \
    --to=i@rong.moe \
    --cc=derekjohn.clark@gmail.com \
    --cc=hansg@kernel.org \
    --cc=hmh@hmh.eng.br \
    --cc=huxiaoying@kylinos.cn \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=xiaoying_hu@126.com \
    /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®