Re: [RFC PATCH v3 0/5] platform/x86: huawei-wmi: expose native firmware power profiles

From: Eren Özen

Date: Tue Nov 24 2026 - 23:39:41 EST


Hi Fuwei,

Thanks for keeping the charge-mode patch in mind. I tried rebasing it
onto v3 to see how the two fit together. Updating the calls for the new
huawei_wmi_cmd() signature is straightforward, but two of v3's changes
still compile fine and change what the charge-mode code does:

- huawei_wmi_cmd() now returns the number of data bytes on success, but
huawei_wmi_charge_mode_get() still does "if (err) return err;". With
only the calls updated, every successful \GBCM call would come back
as an error (a positive length), so probe would leave
charge_mode_available false and the driver would quietly fall back to
\SBTT, which is the bug the patch fixes.

- The reply no longer starts with the status byte, so the mode and the
parameter move from ret[1]/ret[2] to data[0]/data[1].

With patch 4 the callers hold wmi_lock, so I also took the lock once in
huawei_wmi_charge_mode_set() around both the \GBCM read and the \SBCM
write. The getter ends up as:

static int huawei_wmi_charge_mode_get(struct huawei_wmi *huawei, u8 *mode, u8 *param)
{
u8 data[0xff];
int len;

len = huawei_wmi_cmd(huawei, BATTERY_CHARGE_MODE_GET, data, sizeof(data));
if (len < 0)
return len;
if (len < 2)
return -ENODATA;

if (mode)
*mode = data[0];
if (param)
*param = data[1];

return 0;
}

With that, the charge-mode patch plus your five patches on top of the
current for-next (61c0dac952b9) build cleanly in-tree with W=1 and
sparse. I haven't run the combination on the CREM-WXX9 yet. I'm happy
to send the whole rebased diff if it saves you time.

Ilpo, since Fuwei plans to rebase on top of the charge-mode patch,
would it work for you to take that one first? It still applies cleanly
to for-next.

I used Claude to work through the rebase and to draft
this reply, I checked both.

Thanks,
Eren