mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Taraszka <chris@miget.com>
To: "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, Chris Taraszka <chris@miget.com>,
	Armin Wolf <W_Armin@gmx.de>
Subject: [PATCH] platform/x86: bitland-mifs-wmi: Only check the function id of GET responses
Date: Mon, 28 Sep 2026 17:43:37 +0200	[thread overview]
Message-ID: <20260928154337.154969-1-chris@miget.com> (raw)

Commit 23cc56f6dea6 ("platform/x86: bitland-mifs-wmi: Detect failed
function calls") rejects every response whose function id does not
match the request.

The Xiaomi Book Pro 14 firmware (BIOS XMAPT4B0P0909) only fills in the
function id for GET operations. Its SET handlers clear the output buffer
and set only the return code, so a successful SystemPerMode SET returns

  00 80 00 00 ...

instead of 00 80 00 08. The new mode is applied, but the driver returns
-ENOMSG, so every platform profile change is reported as failed:

  Failed to write to acpi_platform_profile: Error writing
  '/sys/firmware/acpi/platform_profile': No message of desired type

SET callers pass no output buffer and do not use the response, so only
validate the echoed function id when the caller asks for the output.

Fixes: 23cc56f6dea6 ("platform/x86: bitland-mifs-wmi: Detect failed function calls")
Cc: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Chris Taraszka <chris@miget.com>
---

Notes:
    This is the separate fix mentioned in "[PATCH] platform/x86:
    bitland-mifs-wmi: Add Xiaomi Book Pro 14 platform profile values".
    
    All SET handlers in this firmware's WMAA method behave the same way:
    only the GET handlers set the function id field. 23cc56f6dea6 is only in
    pdx86 for-next so far, so no stable Cc.
    
    Tested on the Xiaomi Book Pro 14 on AC with bitland-mifs-wmi from pdx86
    for-next plus this patch and the Xiaomi profile values patch, loaded on
    v7.3-rc5: every profile change through power-profiles-daemon succeeds,
    where before each one failed with -ENOMSG despite being applied.

 drivers/platform/x86/bitland-mifs-wmi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index dd1648b7de77..f4817b59dcac 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -189,11 +189,14 @@ static int bitland_mifs_wmi_call(struct bitland_mifs_wmi_data *data,
 		return -EIO;
 	}
 
+	if (!output)
+		return 0;
+
+	/* Some firmware only echoes the function id for GET operations */
 	if (result->function != input->function)
 		return -ENOMSG;
 
-	if (output)
-		memcpy(output, result, sizeof(*output));
+	memcpy(output, result, sizeof(*output));
 
 	return 0;
 }

base-commit: fe5030c8cc7156223f48530e9b49aa87c0305bcd
-- 
2.55.0


                 reply	other threads:[~2026-09-28 15:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260928154337.154969-1-chris@miget.com \
    --to=chris@miget.com \
    --cc=W_Armin@gmx.de \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®