mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jelle van der Waa <jelle@vdwaa.nl>
To: "Rong Zhang" <i@rong.moe>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Ike Panhc <ikepanhc@gmail.com>,
	Mark Pearson <mpearson-lenovo@squebb.ca>,
	"Derek J. Clark" <derekjohn.clark@gmail.com>,
	Hans de Goede <hansg@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] platform/x86: ideapad-laptop: Add charge_types:Fast (Rapid Charge)
Date: Mon, 3 Nov 2025 22:31:01 +0100	[thread overview]
Message-ID: <6bdbfe74-1765-408e-9192-e54accaa22f4@vdwaa.nl> (raw)
In-Reply-To: <1fd710f18bdfcf5d5c157697cdbe874465ee0130.camel@rong.moe>

On 11/2/25 20:24, Rong Zhang wrote:
> On Mon, 2025-11-03 at 02:57 +0800, Rong Zhang wrote:
>> Hi Jelle,
>>
>> On Sun, 2025-11-02 at 17:09 +0100, Jelle van der Waa wrote:
>>> On 10/20/25 21:24, Rong Zhang wrote:
>>>> The GBMD/SBMC interface on IdeaPad/ThinkBook supports Rapid Charge mode
>>>> (charge_types: Fast) in addition to Conservation Mode (charge_types:
>>>> Long_Life).
>>>>
>>>> This patchset exposes these two modes while carefully maintaining their
>>>> mutually exclusive state, which aligns with the behavior of manufacturer
>>>> utilities on Windows.
>>>>
>>>> Tested on ThinkBook 14 G7+ ASP.
>>>
>>> Tested this patch on my Lenovo Ideapad U330p, it now advertises that
>>> `Fast` is a supported charge_type although my laptop does not seem to
>>> support it:
>>>
>>> [root@archlinux jelle]# cat /sys/class/power_supply/BAT1/charge_types
>>> Fast [Standard] Long_Life
>>> [root@archlinux jelle]# echo 'Fast' >
>>> /sys/class/power_supply/BAT1/charge_types
>>> [root@archlinux jelle]# cat /sys/class/power_supply/BAT1/charge_types
>>> Fast [Standard] Long_Life
>>
>> Ahh, then we need an approach to determine if it is supported on a
>> specific device.
>>
>> Glancing at the disassembled DSDT.dsl of my device, I found:
>>
>>     Method (GBMD, 0, NotSerialized)
>>     {
>>     	[...]
>>     	If ((One == QCGS))
>>     	{
>>     		Local0 |= 0x00020000
>>     	}
>>     	[...]
>>     }
>>
>> BIT(17) of GBMD is 1 on my device. Maybe QCGS means "Quick CharGe
>> Supported?"
>>
>> With this assumption, I did some random Internet digging. The same bit
>> on other devices is called QKSP ("QuicK charge SuPported?"), SQCG
>> ("Support Quick CharGe?"), or QCBX (see below).
>>
>>     Method (GBMD, 0, NotSerialized)
>>     {
>>     	[...]
>>     	If ((One == QCBX))
>>     	{
>>     		If ((One == QCHO))
>>     		{
>>     			Local0 |= 0x04
>>     		}
>>     	}
>>     	[...]
>>     	If ((One == QCBX))
>>     	{
>>     		Local0 |= 0x00020000
>>     	}
>>     	[...]
>>     }
>>
>> https://badland.io/static/acpidump.txt
>>
>> 0x04 is BIT(2)/GBMD_RAPID_CHARGE_STATE_BIT. With all these pieces of
>> information, I presume BIT(17) of GBMD is what we are searching for.
>>
>>> I'm wondering if the battery extension API allows to not advertise a
>>> property if it isn't supported or if it should at least return -EINVAL.
>>
>> We can achieve this by defining multiple struct power_supply_ext. See
>> drivers/power/supply/cros_charge-control.c.
>>
>> Could you test the patch below (based on "review-ilpo-next")?
> 
> Note: this patch is just a quick PoC (I am going to sleep now, zzz...).
> ideapad_psy_ext_{get,set}_prop need to be reorganized to properly
> support your device. If `cat charge_types' doesn't show `Fast', we're
> in the right direction.

Thanks for the quick patch!

Tested it on my Ideapad U330p:

[root@archlinux ~]# cat /sys/class/power_supply/BAT1/charge_types
[Standard] Long_Life
[root@archlinux ~]# echo Long_Life > 
/sys/class/power_supply/BAT1/charge_types
[root@archlinux ~]# cat /sys/class/power_supply/BAT1/charge_types
Standard [Long_Life]

I'm however still waiting on the laptop to slowly charge to 80% to 
confirm that charge limits are applied.

Greetings,

Jelle van der Waa

  reply	other threads:[~2025-11-03 21:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 19:24 Rong Zhang
2025-10-20 19:24 ` [PATCH 1/2] platform/x86: ideapad-laptop: Protect GBMD/SBMC calls with mutex Rong Zhang
2025-10-30 16:40   ` Ilpo Järvinen
2025-10-20 19:24 ` [PATCH 2/2] platform/x86: ideapad-laptop: Add charge_types:Fast (Rapid Charge) Rong Zhang
2025-10-22 18:43   ` Mark Pearson
2025-11-02 16:09 ` [PATCH 0/2] " Jelle van der Waa
2025-11-02 18:57   ` Rong Zhang
2025-11-02 19:24     ` Rong Zhang
2025-11-03 21:31       ` Jelle van der Waa [this message]
2025-11-05  8:59     ` Ilpo Järvinen

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=6bdbfe74-1765-408e-9192-e54accaa22f4@vdwaa.nl \
    --to=jelle@vdwaa.nl \
    --cc=derekjohn.clark@gmail.com \
    --cc=hansg@kernel.org \
    --cc=i@rong.moe \
    --cc=ikepanhc@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --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 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®