public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Navon John Lukose <navonjohnlukose@gmail.com>
To: hansg@kernel.org
Cc: ilpo.jarvinen@linux.intel.com, jorge.lopez2@hp.com,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, sre@kernel.org
Subject: Re: [RFC] HP laptop charge mode control via POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR
Date: Tue, 28 Apr 2026 19:48:51 +0530	[thread overview]
Message-ID: <20260428141851.549364-1-navonjohnlukose@gmail.com> (raw)
In-Reply-To: <abfc9469-5d47-4e83-8c3c-03138f1b2ade@kernel.org>

Hi Hans,

Thanks, that was the right hint. The path from the EC to ACPI methods to WMI
has been fun to trace, and I learned quite a bit.

I checked the WMI path, and the charge methods are reachable through the
existing HP BIOS WMI GUID:

  5FB7F034-2C63-45E9-BE91-3D44E2C707E4

The _WDG entry exposes object "AA" as a method. In this firmware that maps to:

  \_SB.WMID.WMAA

and WMAA calls:

  \_SB.WMID.WHCM(Arg1, Arg2)

Inside WHCM, the command dispatch maps the charge-control methods like this:

  read  commandtype 0x1f -> \GBCC()
  read  commandtype 0x2b -> \GBCO()
  write commandtype 0x1f -> \SBCC(DDWD)
  write commandtype 0x2b -> \SBCO(DDWD)

Calling the WMI wrapper for the three modes works as expected:

  \SBCC 0x0000 -> normal charging / auto
  \SBCO 0x0500 -> inhibit charge
  \SBCO 0x0200 -> force discharge while on AC

So the raw ACPI methods do not need to be called directly; the existing HP BIOS
WMI transport reaches them.

Given that, I think the implementation can use hp_wmi_perform_query() with the
existing HPWMI_BIOS_GUID.

I am still unsure about where to put it. The smallest patch would be to add the
power_supply extension code directly to hp-wmi.c, but that file currently does
not have any battery-specific code paths. Should I add it to hp-wmi.c, add a
small HP-specific file under drivers/platform/x86/hp/, or is there another file
I missed?

Thanks,
Navon

      reply	other threads:[~2026-04-28 14:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 14:08 [RFC] HP laptop charge mode control via POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR Navon John Lukose
2026-04-27 15:45 ` Hans de Goede
2026-04-28 14:18   ` Navon John Lukose [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=20260428141851.549364-1-navonjohnlukose@gmail.com \
    --to=navonjohnlukose@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jorge.lopez2@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sre@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