From nobody Tue Nov 24 04:25:09 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793965389; b=Wdk8Tc61t5iC6vURDJXhE04y52H1a9JoDBp9coayutMmiRXdfdXRmHVwTf/yp4kw6Q8W bfCm0pODamWo4wrINs26L7C8rLvUm4Ad7+ejpOa4jsii3nDllD1NiOWUNXCp5cR1WR65i 0pc/hczLKBCTXE2Z/lFeqtuABCNdxGP5ra47HVkgn6TFqTGe9h+7pgbyDRS9y0cKEsu1e JGsro9+P7hjUpwelE4BPPY9nYzbIyYWYJe9bOLbfOf1TxRcYvUowF5wYuhjiRsctoOlWu CngMFPL4NhCZ2flArBmY6uojrRjZ5AS6QL8qg6pwJXAAOpvhC6Qq6WyFJPNHkaw+QEw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793965389; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=Jmeqz7ThXoYjgNQNs/BH69z8JNkAj1VbRCWi7gnmfKU=; b=Hq/yuAUYk7DTDiRo9shEyCnJwAI0Q0XQW20QgkWcDA90LtClMjhXes6tMXRfHKFTefmh rhxytfDD6EpDLYrsYAzfR+LolxOlg9HNtcF7tmaIBTKrdSQs6iXLfhLu0cB4tIadY2B/D IzsIWi+5YFg3YOC0hMyTmWuJw5IWd29YHTXLamjE9ngk0uPZUHQu6GLienxAsQA3HMoeG jESuFXPJB+GlBp1F1oqhOImkqUuMrhQq1X68L6q4nJMZXRHKtDhWjpoPJdSlNbDLhnrv3 9CmSCirxbF28lHa04a0yIRu3ClZfwZfcqMA+CEcUVv/sJWDMcbO1vNQPc5eupwOqKmg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=miget.com; spf=pass smtp.mailfrom=miget.com; dkim=pass header.d=miget.com header.i=@miget.com header.a=rsa-sha256 header.s=google header.b=L72Qd1f8; arc=none smtp.remote-ip=209.85.208.44 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92B84606BD41 for ; Fri, 6 Nov 2026 11:43:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 92B84606BD41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=miget.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=miget.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=miget.com header.i=@miget.com header.a=rsa-sha256 header.s=google header.b=L72Qd1f8 Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-6b2237b596cso941716a12.0 for ; Fri, 06 Nov 2026 03:43:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miget.com; s=google; t=1793965387; x=1794570187; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Jmeqz7ThXoYjgNQNs/BH69z8JNkAj1VbRCWi7gnmfKU=; b=L72Qd1f8s8gEBjZGCDBGGLvrag5LZMvHh/SASFvbSA1Nob80vfanySWiYM8sfoYBb2 KWd2PBYiVYPIT8KQlq/U7emnRK6E3voeig60taWTHuGC8mJoBA9ssPwSz2NaXYuxU2XE KlBucOXx2yj2qHRWW6jsnQ0ypVVfVX2tGHaWs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793965387; x=1794570187; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Jmeqz7ThXoYjgNQNs/BH69z8JNkAj1VbRCWi7gnmfKU=; b=ZaMuCWLfeoEEP1SAu7Vcc+VEbwKYhHKMTcrRgbK3PzwtuBwvFuUJwBmoi3DANzQI3z HQfq8u3NEayv30ELVhb/TZ46RoZHtllTeyiQpaI66yhCvLuhzFzJYfAH6JQ3f/xRsNJU oVXm7ksNGN2Bd0VBCc2/OPIH0iXSXwURvd5w8o6Aspb2aCkw4uXPKqW94LmXTeVDpDy7 u3/26r3XQ2281+PDy+MSsLWbxKg5W9oVVMxQbR0+ayQux5wFG/1/LAeJwdyNYUMJRaDa 6nR5Mi2B+6ZbgGfOf/t5d/EkvrVazOMrFSNihrEMKnVqBNPqhoZqHLUhIYGKA58DapB5 L3ZA== X-Forwarded-Encrypted: i=1; AKwUvBxu/3xQsk79Ejag1NVCCe5nfS5h0H9jgF5SlPFTeW/HDYsDSs9p3SMS14XplQQHMIBvvCAFeyRlbmcHgW4=@vger.kernel.org X-Gm-Message-State: APuU4Z9auxMnyXmAU3DN6s0Gj0dI3acZeI9lA8jRub5Ycu5zV8aeRqQV tOwnr20l0Q13vbieQxfZExbHT9F24ihvcW/sO/sRt25cxJAqz6f9a12yaacSsAR0mbo= X-Gm-Gg: AYBFou0gNbMdvQCMUMfEBgFYp7NT3XNhshfuSPxD/yvsnQb13m2f5dTJKUhRcLgJJsE yDXJOjP4ooNlHvnlrs4WBpmcmLC3bmKjgMds3/7dYnW9NptRng+osqokX4FG9QjVfZRUuMi32VY hdeFBJS6b0Me7kL5Bav16xgzOhix0MA1vWSEovem/99g3atTHn0iaTt9rx3woiugv20aG+8xNaD izIostxnTupx0qyc9PkO6jYCKFYqEip1NCuNHXpPFAYk5Ycg/tXqBb20nAi4kJ30ySFCbEB5np/ Y1ogECUCfPXuv8rnnRKOtxgOc7Php0MfgOJcgkcX8JOKsYnirCJj6ezOoi+/k1dpgSbK+TJ87ct BTbU4vGEcfGzyERdeLuYQNVzj7VAgVsjfA8ZC56s+5DrICrAfxuiHtgWYmNBSthWr/v8JPkJr+4 OV12kkmgX48eNf09DrEOgQaWDRctwdES+VSpF616w/w+r9mSsIfxfxtLlerXU7v+LDkep+KMXAp gV5I7HbC+5zgbdzuzbe9p0fHZsD4/Y9g5KB9clOlL+36FWI4ODV9iwUFlG1NydswNzkqo4Jhim8 k/C7vIWJ+Ym4vecMJJpzd3M4EveUkvHXV+lkwbtfTFM7yo0= X-Received: by 2002:a17:907:97c3:b0:c46:5973:2a1c with SMTP id a640c23a62f3a-c4d354f2af0mr203412466b.37.1793965386960; Fri, 06 Nov 2026 03:43:06 -0800 (PST) Received: from xia ([83.142.187.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c4d356e7035sm71377866b.80.2026.11.06.03.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 03:43:06 -0800 (PST) From: Chris Taraszka To: Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mingyou Chen , Ilya Gladyshev , Armin Wolf , KentoNion , Matias Civadda , Arsenova <7z0423arsenova@proton.me>, Chris Taraszka Subject: [PATCH v4 1/4] platform/x86: bitland-mifs-wmi: Don't fail suspend or resume on profile errors Date: Fri, 6 Nov 2026 12:42:57 +0100 Message-ID: <20261106114300.936782-2-chris@miget.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261106114300.936782-1-chris@miget.com> References: <20261106114300.936782-1-chris@miget.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" bitland_mifs_wmi_suspend() returns the laptop_profile_get() error to the PM core, which aborts the whole system suspend. This happens on any machine whose firmware reports a SystemPerMode value that is missing from its profile table, and on such a laptop with the lid closed logind keeps retrying the suspend, so the machine stays awake and drains its battery. bitland_mifs_wmi_resume() likewise returns any error other than -EOPNOTSUPP from restoring the profile, so the resume is reported as failed although the machine is fully usable. Saving and restoring the platform profile is best effort. Warn and continue instead of failing the system transition, and skip the restore when nothing was saved, so resume does not write a stale or default profile. Fixes: dc1ec4fa86b2 ("platform/x86: bitland-mifs-wmi: Add new Bitland MIFS = WMI driver") Reviewed-by: Mingyou Chen Signed-off-by: Chris Taraszka --- Notes: Unchanged since v3. Moved to the front, as it does not depend on the other patches. drivers/platform/x86/bitland-mifs-wmi.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index a431d3fef774..d092dc696293 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -213,6 +213,7 @@ struct bitland_mifs_wmi_data { struct device *pp_dev; const struct bitland_mifs_quirks *quirks; enum platform_profile_option saved_profile; + bool profile_saved; }; =20 static int bitland_mifs_wmi_call(struct bitland_mifs_wmi_data *data, @@ -383,10 +384,15 @@ static int bitland_mifs_wmi_suspend(struct device *de= v) return 0; =20 ret =3D laptop_profile_get(data->pp_dev, &profile); - if (ret =3D=3D 0) - data->saved_profile =3D profile; + data->profile_saved =3D !ret; + if (ret) { + dev_warn(dev, "Failed to save platform profile: %d\n", ret); + return 0; + } =20 - return ret; + data->saved_profile =3D profile; + + return 0; } =20 static int bitland_mifs_wmi_resume(struct device *dev) @@ -394,8 +400,8 @@ static int bitland_mifs_wmi_resume(struct device *dev) struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); int ret; =20 - /* Skip event device */ - if (!data->pp_dev) + /* Skip event device, or nothing was saved on suspend */ + if (!data->pp_dev || !data->profile_saved) return 0; =20 ret =3D laptop_profile_set(dev, data->saved_profile); @@ -411,8 +417,10 @@ static int bitland_mifs_wmi_resume(struct device *dev) } } =20 - dev_dbg(dev, "Resuming, restoring profile %d\n", data->saved_profile); - return ret; + if (ret) + dev_warn(dev, "Failed to restore platform profile: %d\n", ret); + + return 0; } =20 static DEFINE_SIMPLE_DEV_PM_OPS(bitland_mifs_wmi_pm_ops, --=20 2.56.0 From nobody Tue Nov 24 04:25:09 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793965391; b=n2SB7Lw/igLCQTaFrrM4NTyQs+WusFgfAGj0KSycp+xiMNELRja54NTFLR6eWxr7OtVz 0STxXZ6/sXgJVDu+TuqEyQlXsVxcOoMD8s5fLnU8TV5uCz8cmunR5B6/nqMRc5KWJ77Ia Awr9c8FFg/7RLsnLyv15ck3HhKNkFaaKVYXKDsm7z0BpLo/InWDpJhVWWHWxp8tHv1vuA +pdBMNRXjDqmBxebhheP9KmVr24TFFMftGQipIsXutRz00EOAwEK0by/TEs+6UZDPDpPL 9Ab4vFPF521q8uZH1Z+ELdL+5o8pPCZSbUl/cFc1kzdNEdKo3EeXQCn7nPirRdnNTdQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793965391; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=LnnIdamjDHO6+FMBze92j/z9JQUuUcWbUWtszHcXFKA=; b=2A2LCmNps35+2imMTJy91nJniN5caPAaNflxF4pgvebPVRtoJFKlF9EsVWNa4YdPSnVI KFSg8Ox9gsSATc8P8ufWmarpYTnZAA1/+mxh74ix4Rccz6jGlTP2d8YOsPXrI8hNzgxsQ gvy35nPyPxcWjpvZByETp52s5vXljA47wof8Rron+k4m2OWP1RdIdUyaFI1N5/gLGBP0B By3d3iR4zkUJiqgak79yj3t0ll5xkvsQpzlxXRthmca1b2YQib1u7IwRYJxNKTiDd+n8w JD/CO4AvGPygny4Bkj57+kZJmC38jkpHItdLab+cv3Di6Dh7yFTCCz0J9LiogK7Uw3g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=miget.com; spf=pass smtp.mailfrom=miget.com; dkim=pass header.d=miget.com header.i=@miget.com header.a=rsa-sha256 header.s=google header.b=UIjr4Nne; arc=none smtp.remote-ip=209.85.208.45 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6E9F606C7CF for ; Fri, 6 Nov 2026 11:43:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E6E9F606C7CF Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=miget.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=miget.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=miget.com header.i=@miget.com header.a=rsa-sha256 header.s=google header.b=UIjr4Nne Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-6b561b60b78so2419352a12.1 for ; Fri, 06 Nov 2026 03:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miget.com; s=google; t=1793965389; x=1794570189; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LnnIdamjDHO6+FMBze92j/z9JQUuUcWbUWtszHcXFKA=; b=UIjr4NneYi82jFQr8OTb4FhRUeIk7tGTtSIIVcpxIVFiMqIfVSZNa9jsbCYsiMSG04 Nj7sWwcz96lWyrjafF44fbZIwrh6mp6VnBYpVayRbVshMXvBdzO67P7za92g/CWdPLY1 9uPd6i05V72GgqykfaBQUGIuxxfhn8o1bn2pE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793965389; x=1794570189; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=LnnIdamjDHO6+FMBze92j/z9JQUuUcWbUWtszHcXFKA=; b=Or8J3iafmo0CjBKNdUF3/BZeimHBkeIDzEOYzEtu8zEobbzFc4ccWqUvKChtIw3+Df +DFVNNvzqSkmxfcpQGtiYwcYU3Th7tMkRFJnvdKg2tpi7IIK19U4tcp8gM66qWO6htjl bC8/TA30Ysd48h2i1X7bvvu534luXC9LosZEd9k/n9gLwGnL2nl+ProJ2/SZHgwWlo5h P8mXckm91dUZgoNLELLTv0p/UoNihB4bY9EhIE0Zd+/kqqEho9BzHz1cwW/lf/Ks8TU+ EPqsMcLp6xe++YNRtVlxYqQBPr29VTUceLLxguTqUqdVomODAvs6W3/dLgzyxDfeFsyA m5uw== X-Forwarded-Encrypted: i=1; AKwUvByA81tJQ6gG4FejBtho0mVEYCPYNgDQZvrbMVfnNEPozFL7TVmnHYd1jzhK8qb1DKrYNXAAdl43EthJ9Xg=@vger.kernel.org X-Gm-Message-State: APuU4Z/DVs9MC7J6BpoTCCjPT/F8Ju17vQCK5jUxHGNWVZ+70GMv4FKU 4JVSmsVO6wHrbW0iZC+ymPVfU3rqHsyhaTQSEA7eQ6CaRbkC3nx1MIQhgI/EG7R6wdH/ntEUW0Y dLc5YYlw/zg== X-Gm-Gg: AYBFou1a8GtXTbHE0srdEE5Bed1SsV1XvXsgYbSqRzUh7eE4pJGIkX4TyIfLw4j3ajN 6fHFKODsKHaYwcU27akrNx2YLcVibmZnWDa22yTgBCwBjkgZEFaGJilc1OqKPYopBfisHMsXFKF uxW1Joo65EGUxGNtLlx01own0Qof/r2snk2+cOD7/koLBOdI3ET5cpnZl8jZWHA5NpBO1I7+gUu MvDajZ6XB0itvy79wHBWpWR0rYR2G8m6fR62xi5MtTSQrfaEZGpnWdQBj76DpbihU02Ux4QXZ/s 9AtHnYfsCES+BlRnljcrS9si1NxhsdusTuT0fEqEd0Ai2QfVD7BN+GKZG/wqVqLwNNgoS5CVC9Y X0ZjjnEvdzapDvd7pASnenNdOSVm8dbig5q9hbrXYp2eJC9HyTEacnG4jhhtPuiBPOyASghGLAp P6PdCJadYfv2uWtOaHnvu0nHQKSW1IHN4XU51gTg9I0uGS2ZpMD7/KpW/oxJjqh8YG+7puWMqM/ 6kO3lO7bf+9jw5hRlxZ8POp42PthODYIcqbhTSdnxlksd/j1meHQByvvLJXYAAOhEP5RtiKICj3 AmV3kqr83hbot/2SWXvBo5ARQBObt/44cW6OZcKzGFPUixU= X-Received: by 2002:a17:907:3906:b0:c2a:4847:231b with SMTP id a640c23a62f3a-c4d3557096amr169438366b.24.1793965388650; Fri, 06 Nov 2026 03:43:08 -0800 (PST) Received: from xia ([83.142.187.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c4d356e7035sm71377866b.80.2026.11.06.03.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 03:43:08 -0800 (PST) From: Chris Taraszka To: Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mingyou Chen , Ilya Gladyshev , Armin Wolf , KentoNion , Matias Civadda , Arsenova <7z0423arsenova@proton.me>, Chris Taraszka Subject: [PATCH v4 2/4] platform/x86: bitland-mifs-wmi: Support a separate profile value on battery Date: Fri, 6 Nov 2026 12:42:58 +0100 Message-ID: <20261106114300.936782-3-chris@miget.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261106114300.936782-1-chris@miget.com> References: <20261106114300.936782-1-chris@miget.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some firmware uses a different SystemPerMode value for a profile depending on the power source. The Xiaomi Book Pro 14 uses 0x04 for performance on AC and 0x03 on battery, both with a 50-58 W sustained power limit. Its DTT tables have no battery entry for 0x04, and BIOS 0707 refuses 0x04 on battery. Let a profile entry be marked for battery use. It is set in place of the AC entry for the same profile while the system runs on battery, without the AC check. The firmware does not change the mode when the power source changes, so re-apply the current profile from an ACPI AC notifier, taking the AC state from the event. A mutex keeps this from racing with profile changes from userspace. The notifier is only registered when the quirks have a battery entry, so models without one are not affected. Suggested-by: KentoNion Signed-off-by: Chris Taraszka --- Notes: v4: no longer edits the TM2424 entry. Patch 3 now adds the quirk with 0x03 as the battery entry (Mingyou). =20 Tested together with patch 3, with ftrace kprobes on the AC notifier and on the WMI calls: =20 AC, performance (0x04), unplug: the notifier sets 0x03 within 1 ms battery, performance: set 0x03, PL1 58 W battery, performance (0x03), plug in: the notifier sets 0x04 s2idle from performance on AC: resume restores 0x04 =20 Battery class events are ignored. Here Omarchy also switches to its saved per-source profile about a second later, which goes through laptop_profile_set() after the notifier. drivers/platform/x86/bitland-mifs-wmi.c | 120 +++++++++++++++++++++--- 1 file changed, 107 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index d092dc696293..97dafd510ba8 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -91,6 +91,7 @@ struct bitland_profile_entry { enum platform_profile_option profile; u8 wmi_val; bool no_set; + bool battery; /* Set in place of the AC entry while on battery */ }; =20 struct bitland_mifs_quirks { @@ -206,8 +207,10 @@ struct bitland_fan_notify_data { struct bitland_mifs_wmi_data { struct wmi_device *wdev; struct mutex lock; /* Protects WMI calls */ + struct mutex profile_lock; /* Serializes profile changes */ struct led_classdev kbd_led; struct notifier_block notifier; + struct notifier_block ac_notifier; struct input_dev *input_dev; struct device *hwmon_dev; struct device *pp_dev; @@ -329,34 +332,108 @@ static int bitland_pp_check_capability(struct bitlan= d_mifs_wmi_data *data) return 0; } =20 -static int laptop_profile_set(struct device *dev, - enum platform_profile_option profile) +static const struct bitland_profile_entry * +bitland_profile_set_entry(const struct bitland_mifs_quirks *quirks, + enum platform_profile_option profile, bool on_battery) +{ + const struct bitland_profile_entry *entry =3D NULL; + size_t i; + + for (i =3D 0; i < quirks->num_profile_entries; i++) { + const struct bitland_profile_entry *e =3D &quirks->profile_entries[i]; + + if (e->profile !=3D profile || e->no_set) + continue; + + if (e->battery && on_battery) + return e; + + if (!e->battery && !entry) + entry =3D e; + } + + return entry; +} + +static int bitland_profile_set(struct bitland_mifs_wmi_data *data, + enum platform_profile_option profile, + bool on_battery) { - struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); - const struct bitland_mifs_quirks *quirks =3D data->quirks; struct bitland_mifs_input input =3D { .operation =3D cpu_to_le16(WMI_METHOD_SET), .function =3D cpu_to_le16(WMI_FN_SYSTEM_PER_MODE), }; - size_t i; + const struct bitland_profile_entry *entry; int ret; =20 - if (profile =3D=3D PLATFORM_PROFILE_PERFORMANCE || - profile =3D=3D PLATFORM_PROFILE_BALANCED_PERFORMANCE) { + entry =3D bitland_profile_set_entry(data->quirks, profile, on_battery); + if (!entry) + return -EOPNOTSUPP; + + if (!entry->battery && + (profile =3D=3D PLATFORM_PROFILE_PERFORMANCE || + profile =3D=3D PLATFORM_PROFILE_BALANCED_PERFORMANCE)) { ret =3D bitland_pp_check_capability(data); if (ret) return ret; } =20 + input.payload[0] =3D entry->wmi_val; + + return bitland_mifs_wmi_call(data, &input, NULL); +} + +static int laptop_profile_set(struct device *dev, + enum platform_profile_option profile) +{ + struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); + + guard(mutex)(&data->profile_lock); + + return bitland_profile_set(data, profile, + !power_supply_is_system_supplied()); +} + +static int bitland_ac_notify(struct notifier_block *nb, unsigned long acti= on, + void *data) +{ + struct bitland_mifs_wmi_data *drv_data =3D + container_of(nb, struct bitland_mifs_wmi_data, ac_notifier); + struct acpi_bus_event *event =3D data; + enum platform_profile_option profile; + int ret; + + if (strcmp(event->device_class, ACPI_AC_CLASS)) + return NOTIFY_DONE; + + guard(mutex)(&drv_data->profile_lock); + + /* Switch to the AC or battery value of the current profile */ + ret =3D laptop_profile_get(drv_data->pp_dev, &profile); + if (!ret) + ret =3D bitland_profile_set(drv_data, profile, !event->data); + if (ret) + dev_warn(&drv_data->wdev->dev, + "Failed to update platform profile on AC change: %d\n", ret); + + return NOTIFY_DONE; +} + +static void bitland_ac_notifier_unregister(void *data) +{ + unregister_acpi_notifier(data); +} + +static bool bitland_has_battery_entries(const struct bitland_mifs_quirks *= quirks) +{ + size_t i; + for (i =3D 0; i < quirks->num_profile_entries; i++) { - if (quirks->profile_entries[i].profile =3D=3D profile && - !quirks->profile_entries[i].no_set) { - input.payload[0] =3D quirks->profile_entries[i].wmi_val; - return bitland_mifs_wmi_call(data, &input, NULL); - } + if (quirks->profile_entries[i].battery) + return true; } =20 - return -EOPNOTSUPP; + return false; } =20 static int platform_profile_probe(void *drvdata, unsigned long *choices) @@ -805,6 +882,10 @@ static int bitland_mifs_wmi_probe(struct wmi_device *w= dev, const void *context) if (ret) return ret; =20 + ret =3D devm_mutex_init(&wdev->dev, &drv_data->profile_lock); + if (ret) + return ret; + dev_set_drvdata(&wdev->dev, drv_data); =20 drv_data->quirks =3D &default_quirks; @@ -837,6 +918,19 @@ static int bitland_mifs_wmi_probe(struct wmi_device *w= dev, const void *context) if (IS_ERR(drv_data->pp_dev)) return PTR_ERR(drv_data->pp_dev); =20 + if (bitland_has_battery_entries(drv_data->quirks)) { + drv_data->ac_notifier.notifier_call =3D bitland_ac_notify; + ret =3D register_acpi_notifier(&drv_data->ac_notifier); + if (ret) + return ret; + + ret =3D devm_add_action_or_reset(&wdev->dev, + bitland_ac_notifier_unregister, + &drv_data->ac_notifier); + if (ret) + return ret; + } + /* Register hwmon */ drv_data->hwmon_dev =3D devm_hwmon_device_register_with_info(&wdev->dev, "bitland_mifs", --=20 2.56.0 From nobody Tue Nov 24 04:25:09 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793965393; b=WqCdRVC+u0Ty4krKjkmpNpjfAA7ENzOXoiTPZcJAbuRuggxm5wELbvnowxg8XZtAeNHT YzXJ3zZqXXZygccvGVXNGj8Uj/KBlka1IvKc560YxKdVgxdjrsn9shxB4m2lpea3dupnr J9Mp7/LIPDBuQxWrKTXhDYEi3nIKvOlms48xlPt44paZ7YMDhp2uISk3U4au1w/Pakr4I 4HD4XzxIvtjfYX+tKteJ4RSPEvabeEacRJmb7PAMJvIabK7bVXBMKauB9h3CnwDDtzUHD V3BxiKI3UMVu1AN126OH62sFGBBTo6Yrc8N22T6Lyb5tszMHFDZp2pt+gugGoLI2Odg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793965393; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=vGWDvyTZcD/X4Tcli9Wn0Aq/2+luEsPmy4hQ7ZtpaL8=; b=0jeFDSaNRXg9VPLc6SeQTbGMh4TexzLUEhtVUV8zWfbMW9OHZI75Xel4QXZ/p91GP/aL Bvg29n45Lp71AklhbzQEF/Fdfg03dD/3CcKgVEsvXffKbx8CH8kNfunmysIvGM2AaDTu7 mDybEL3nFKsfaUbJ1f3gCAxpqMct05tYasXV3av23YAavFqVjbwZBzVPAkfn+BVSHksEA Xc0ZU9YBglS51RBw8B04a/9ChqIL3SRqIZhPWIQCJ7sltoygPtm3s8JSd2ikUcC/IqB7l sB+2Vi689l0H2+t8NT7CPYZY5ieP8vFh+446uhnE+67zOeYkR/XItwLNOlnLFHu1PbQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=miget.com; spf=pass smtp.mailfrom=miget.com; dkim=pass header.d=miget.com header.i=@miget.com header.a=rsa-sha256 header.s=google header.b=c1KQp4gq; arc=none smtp.remote-ip=209.85.218.50 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87388606EE97 for ; Fri, 6 Nov 2026 11:43:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 87388606EE97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=miget.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=miget.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=miget.com header.i=@miget.com header.a=rsa-sha256 header.s=google header.b=c1KQp4gq Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-c45551fa84eso78234066b.3 for ; Fri, 06 Nov 2026 03:43:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miget.com; s=google; t=1793965391; x=1794570191; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=vGWDvyTZcD/X4Tcli9Wn0Aq/2+luEsPmy4hQ7ZtpaL8=; b=c1KQp4gqdZGxoOCGa/RfgQZ+zO07LYra6iMg591qnQblSZcT1F0fUywCGO4BdaB/t4 QqR5qFNTheKqi5DAYz+UmqQdwOE5s9bfohMp0eDs+ecHHCHu16M9wNxeU/VccdoKsarq 3fapVuynIHn8TZTK2AK6K71YsbnIrlvush6Sc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793965391; x=1794570191; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=vGWDvyTZcD/X4Tcli9Wn0Aq/2+luEsPmy4hQ7ZtpaL8=; b=oqcV24JqBt9htCRDF4Sv1hqzNmcn1mAC0Tv7bvF21TeJDQAI0Fx1CAESHRq9xF6fB+ qdalFocZQL3A8/zYI5ZJuJfEOzXSNJNhR2D07aOwHldYN3yyGqHh04nlUnl103aB92W7 dbQcGYRdmUGV0d8waXWfWGckpsem7PjGcY8ryGMwgZYiafHBSSA/nxk/qlhUzVRMGq+w 9Ur2VGtKEGfU4fg0ousgMXu9v5vLHUjqFQcLomnCfEBgtNTSg4f6Mxx9Xp2fvKBDXgI4 1xGtTpBJEWJqoOWusZSx1BCpx+V4OLYRm6NevzQJspAjKuBIrkkhA+ooevcS94RHWHiZ Ep/Q== X-Forwarded-Encrypted: i=1; AKwUvBwlni/oLUEDJ1Vd7ahgs4iGhO2s/SLUAZARtWMmDKyCBgYXFE+/JhvWAIgI4LwKOoe0JQD4n3RzrYZkwfE=@vger.kernel.org X-Gm-Message-State: APuU4Z/QIlnz/p4F8QGSa5HXQ05jl/FFCUGcNLQwXJy2Mhi6dI8h6ekS yth6XQGlHNFrmeaB/DdCTwMbVsJEkkFAG79iRuaH3RPw2YtNweYDm6OkcvQzQliW6fY= X-Gm-Gg: AYBFou1YSQu95E3so4o8TSLRX3r8szwVI3sF0UjVcN3DZAZ18JbreoOCAU3V9/gcNo4 9wLiNiFEmhEXhDn7eM7BGLtJ9nqBW2viwMmX3v9xyGxAzT1iXzgrC3VKJZ2JE6alDKGecHOw5gc 9rHTXBH95a+4wKdhTRW4Abz0YRDK73Fet+2gUSLbEWF+RokJD2mkPKCIhFbbUwLJkwjEtKVl6Tn iMUmqspecW3B7gC5zr/kwNseKX0v1x0V3oHqB3sxNKQLR43VLRsgFvTmb2LYURN/vhCJ+fCsHqi 6vjpTWN4SpfzoysRE+9lzVj0H8HcDOcyrfOWcPiXF66TCEEG/PCaQxC6KuPmyf60zsmk8iex7SL /cQOW7QrNtLBQT8tr4T7S+p2JxcDAEDb2ey6zd3x+39zq4UgTBAl5erXze4XQ/FXgvaF2iSHewk GsDjrCs1U3mpYsE7zmiJGl9bcgAuLM+zv9xzTTvawKpL+m0xAnSY4qs3OEDmchBsyC3j2uXN7PZ o6tZ6kj89VzsXoHBpN5wAckhsLVS8XKA184Mxu4LHNm415wQnEnJM4z/T3/GsRjVEHq8pkyom/U CgMixc9v/0ZivIaqfjvKtQ8gLIOuHcIcc/iLnqEW1nA+vv0= X-Received: by 2002:a17:907:7b86:b0:c4c:f85f:aa12 with SMTP id a640c23a62f3a-c4d35538423mr176866466b.31.1793965390484; Fri, 06 Nov 2026 03:43:10 -0800 (PST) Received: from xia ([83.142.187.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c4d356e7035sm71377866b.80.2026.11.06.03.43.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 03:43:09 -0800 (PST) From: Chris Taraszka To: Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mingyou Chen , Ilya Gladyshev , Armin Wolf , KentoNion , Matias Civadda , Arsenova <7z0423arsenova@proton.me>, Chris Taraszka Subject: [PATCH v4 3/4] platform/x86: bitland-mifs-wmi: Add Xiaomi Book Pro 14 quirk Date: Fri, 6 Nov 2026 12:42:59 +0100 Message-ID: <20261106114300.936782-4-chris@miget.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261106114300.936782-1-chris@miget.com> References: <20261106114300.936782-1-chris@miget.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The Xiaomi Book Pro 14 (board TM2424) implements SystemPerMode with its own values. Its firmware ignores 0x00 and 0x01, and GET returns one of 0x02, 0x03, 0x04, 0x09 or 0x0a, so with the default table balanced and balanced-performance are no-ops and reading the profile fails with -EINVAL whenever the firmware is in 0x04, 0x09 or 0x0a. The failed read also aborts system suspend. The firmware passes the mode to Intel DTT as an OEM design variable. The DTT tables in its data vault name the modes and set the sustained package power limit (PL1) for each, by power source. For the H484 CPU variant (H404 has the same layout with lower limits): value AC battery 0x02 Silent 15-25 W Silent 15-25 W 0x0a Silent 15-25 W Silent 15-25 W 0x09 Balance 35-45 W Balance 32-40 W 0x03 Smart 36-37 W Turbo 50-58 W 0x04 Crazy 50-58 W no entry Map low-power, balanced and performance to 0x02, 0x09 and 0x04, and use 0x03 for performance on battery, where it gives what 0x04 gives on AC. 0x0a selects the same tables as 0x02, so report it as low-power without offering it for SET. There is no balanced-performance mode. The machine is USB-C only and WMI_FN_SYSTEM_AC_TYPE is not implemented, so skip the AC type check. Signed-off-by: Chris Taraszka Reviewed-by: Mingyou Chen --- Notes: v4: moved after the battery support (Mingyou), so 0x03 is the battery entry from the start. The code at the end of the series is unchanged. =20 Tested on the Xiaomi Book Pro 14 (TM2424, BIOS XMAPT4B0P0A0A, H484) with this series on top of v15. Firmware mode (EC 0x68), DTT OEM variable 1 and PL1 a few seconds after each set: =20 AC low-power 0x02 ODV1 2 25 W balanced 0x09 ODV1 0 45 W performance 0x04 ODV1 4 58 W battery low-power 0x02 ODV1 2 25 W performance 0x03 ODV1 1 58 W =20 Rechecked on v7.4-rc1: on battery, balanced, performance and low-power set 0x09, 0x03 and 0x02. drivers/platform/x86/bitland-mifs-wmi.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index 97dafd510ba8..4d02cd9e8a6b 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -114,7 +114,28 @@ static const struct bitland_mifs_quirks default_quirks= =3D { .num_profile_entries =3D ARRAY_SIZE(default_profile_entries), }; =20 +static const struct bitland_profile_entry tm2424_profile_entries[] =3D { + { PLATFORM_PROFILE_LOW_POWER, 0x02 }, + { PLATFORM_PROFILE_LOW_POWER, 0x0a, true }, + { PLATFORM_PROFILE_BALANCED, 0x09 }, + { PLATFORM_PROFILE_PERFORMANCE, 0x04 }, + { PLATFORM_PROFILE_PERFORMANCE, 0x03, .battery =3D true }, +}; + +static const struct bitland_mifs_quirks tm2424_quirks =3D { + .profile_entries =3D tm2424_profile_entries, + .num_profile_entries =3D ARRAY_SIZE(tm2424_profile_entries), + .skip_ac_type_check =3D true, +}; + static const struct dmi_system_id bitland_mifs_dmi_table[] =3D { + { + .matches =3D { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "XIAOMI"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "TM2424"), + }, + .driver_data =3D (void *)&tm2424_quirks, + }, {} }; =20 --=20 2.56.0 From nobody Tue Nov 24 04:25:09 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793965394; b=JS33DfDwKVQkuAcHYfMDXyp7CenAY5R5scO58DsYXavfE+0afL64yWXIyP5g4zN8Mpif x7Z6TCCmgXHrCfLlTNRuzVZ/p/M8pIRVzw3oDprx8YbLbtOY01j0J//ItVA/6wT5DApcM us080iG9TeToqQO/XwHmECpI3zr7lBYR5FbCh37omezk0l5KPAvtahQOdrn7Yfur9iHxt G3U+yksxssGNzv3DjZ6iCJIEitPz+VIXbtPZ90xGM878yVVw1a1CtdYEDHiLCZgOJWuYZ O9mtCdDfG3QkRq9nr9SkDCTveoIJVK7r9BWc8ypq1RDt+vqBSNxzE1hcfbovkR33MUA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793965394; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=VvltagtRFlSaR5juyoaIfz6fk6xoC7R6iygJelqiFGo=; b=bxEDaxgTFfIrABvnLcNpzkfUDHc5VgCWoz6hcIxcXzEP8qjQgx7stp1NqXcDIjELnk9e HJZBYE7HLOYukbG5t7Cnyz8PgjzvvJ4pQzjwyw/d9Gnyb2lnPadffI7zLztyy2bayLg1B r6wPenY8Qnetn7KJZod2JEAnPaUGOAcFuvMbsINIg6C8655xVHZz2dVmk9gi73qmm6MYO JegXmdoLZiESUdaiooubbTXY5foR+MQyFg7gf0Y1iJL2HrpqI8UIFpppIhfJuU/TlLQDO c8fmPunPFZvQ+KiKjVxp4f+adBMQh388uNeAXf9YL52hLGqSFd78dQxXWG7IKvNKKag== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=miget.com; spf=pass smtp.mailfrom=miget.com; dkim=pass header.d=miget.com header.i=@miget.com header.a=rsa-sha256 header.s=google header.b=D60vlBkY; arc=none smtp.remote-ip=209.85.208.44 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9E08606EEB8 for ; Fri, 6 Nov 2026 11:43:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C9E08606EEB8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=miget.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=miget.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=miget.com header.i=@miget.com header.a=rsa-sha256 header.s=google header.b=D60vlBkY Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-6b596afb4c5so495558a12.1 for ; Fri, 06 Nov 2026 03:43:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miget.com; s=google; t=1793965392; x=1794570192; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VvltagtRFlSaR5juyoaIfz6fk6xoC7R6iygJelqiFGo=; b=D60vlBkYuKtEqin4bZZJ/HOxOok5oZjszT1y2CO6FHmh17Sun87rGX71po82rRLn+q lwj2La/3xfeoaLT+qk4l5qT6xZrwmbjGZccMDYwzdu/0xPiJWqIhlxWdE+8Y2NXbViRE o7vqDjtn44xmPj8WU/wUPOtrdU3DV1ii5wqF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793965392; x=1794570192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=VvltagtRFlSaR5juyoaIfz6fk6xoC7R6iygJelqiFGo=; b=EiJ831JdmlE2b6Kl3BNtI+bq5t2ALOtHgmzn0XUKt27ir4d457d0UtQqgQHNyVZf+E 90+PA16ko2sVlIcbyACAr1Cy4Y6nYSQXvB5+biZzBBo9RfFixTdaBUHwFJbWRMvTc+ca qnZ0jGEy55+MfgH8i/S1vlh6DMKjdieAW5moo9MEniepr7hYxvKaCCm4Io80qZygWCBt LPIzh7Q45LR4HaxNXYu2NjopiEeCNmKaDJhfi+woj8jLEzqdHVEWGCTMqtMq1cHn8PTa WCTLvhpFjBpe1MHdwiRE/m79/YsiMJJ0HPPx5xkYrWGg1TZC2rs7DBOCtiYbIbR4v8Gp mKQQ== X-Forwarded-Encrypted: i=1; AKwUvBzd5QZCEQBmHBBTacFWWA29B7UVCWPq/J0YlYXQXFnicDpjsFirJeAmoKQif8gXKgnIwOuW8gH1G12+q20=@vger.kernel.org X-Gm-Message-State: APuU4Z8dzsETq3WR+1N/e2IgLR05QBBICRCq3OkNnbtYqw+3F5GBFf9H +OeDYlIGvxqJOXLLnSztuAeAhPkRb0osm0zO/n6bDEy/rPGwq+tcpPPF5tOWLnoMT9c= X-Gm-Gg: AYBFou09Y13UKlT58Z31DINjrhPDnww5WF1QfeITo17aJDnj/xzhRf16Dj5t129Xtxr itm323CUNhfXUt8HcpRxSSXBQfZ87YpDs+QQsgiAiBlOlA6SuPP+z0B3LnUHcBC9hyYOswVI02k oEVltDPqjybnXNBswizbSzrlTpNGKrwh/SIzvZU950cUU06ixBLCd2e3Al/R+6nXcck+6AdRm4u fuarNfTDaJAuj1LV76Fb/lsFTqlQNiaJrbjT+b4uxlFTfFAE0floBoptZxAlydil2sOh+qnfqbd Vc5QmRaG3Ms4eM3Y1iJjAyu+Ae2MwJdfCfup0tf1te0t65doL5jT8XY1e9ahWfOocGwhn/Gmwag XcA/aPT+sK68hXqiwATEyCyVNpQa3N6Fq+tGvrV3hBySuTHZ15w7hHlDi+uUZ8MJ9DarlRmhoaP hbrkSeTOeEI927KGL2PI6xqYsKkXFj2GDgP1X3OdJDkkA65nfu+DLMdz5qqJzuMHbkF454a61Lx bkVAcljm4HPXvWpXFMDxk4bhh5SylL5FK/IyAgoi7/y2cjT4XLq9KD3vOPTBw5hSFr3LbJh1RSC NxduG8CZWe7QtcN6/STFFyYeRtdwvsAQ1EtilbqLd4f2J/E= X-Received: by 2002:a17:907:2d88:b0:c21:9b4b:2690 with SMTP id a640c23a62f3a-c4d34a71f0amr201745966b.17.1793965392124; Fri, 06 Nov 2026 03:43:12 -0800 (PST) Received: from xia ([83.142.187.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c4d356e7035sm71377866b.80.2026.11.06.03.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 03:43:11 -0800 (PST) From: Chris Taraszka To: Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mingyou Chen , Ilya Gladyshev , Armin Wolf , KentoNion , Matias Civadda , Arsenova <7z0423arsenova@proton.me>, Chris Taraszka Subject: [PATCH v4 4/4] platform/x86: bitland-mifs-wmi: Cycle the platform profile on Fn+K Date: Fri, 6 Nov 2026 12:43:00 +0100 Message-ID: <20261106114300.936782-5-chris@miget.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261106114300.936782-1-chris@miget.com> References: <20261106114300.936782-1-chris@miget.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On the Xiaomi Book Pro 14 (TM2424), Fn+K sends hotkey event 0x28 and the firmware does not change SystemPerMode itself. The event is a request that the vendor software acts on; without that software Fn+K does nothing on Windows either, and on Linux it is currently logged as an unknown event. Add a quirk for this and call platform_profile_cycle() from the control device when the event arrives, so Fn+K cycles through the profiles that all platform profile handlers support. Models without the quirk keep ignoring the event. Suggested-by: Hans de Goede Signed-off-by: Chris Taraszka --- Notes: Unchanged since v3. drivers/platform/x86/bitland-mifs-wmi.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index 4d02cd9e8a6b..84d1223d0ec6 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -100,6 +100,9 @@ struct bitland_mifs_quirks { =20 bool return_code_at_end; bool skip_ac_type_check; + + /* Fn+K sends WMI_EVENT_PERFORMANCE_CYCLE and leaves the mode to the OS */ + bool cycle_profile_on_key; }; =20 static const struct bitland_profile_entry default_profile_entries[] =3D { @@ -126,6 +129,7 @@ static const struct bitland_mifs_quirks tm2424_quirks = =3D { .profile_entries =3D tm2424_profile_entries, .num_profile_entries =3D ARRAY_SIZE(tm2424_profile_entries), .skip_ac_type_check =3D true, + .cycle_profile_on_key =3D true, }; =20 static const struct dmi_system_id bitland_mifs_dmi_table[] =3D { @@ -169,6 +173,7 @@ enum bitland_mifs_event_id { WMI_EVENT_MIC_MUTE =3D 33, WMI_EVENT_RESERVED_23 =3D 34, WMI_EVENT_OPEN_APP =3D 35, + WMI_EVENT_PERFORMANCE_CYCLE =3D 40, }; =20 enum bitland_mifs_event_type { @@ -217,6 +222,7 @@ static BLOCKING_NOTIFIER_HEAD(bitland_notifier_list); enum bitland_notifier_actions { BITLAND_NOTIFY_KBD_BRIGHTNESS, BITLAND_NOTIFY_PLATFORM_PROFILE, + BITLAND_NOTIFY_PLATFORM_PROFILE_CYCLE, BITLAND_NOTIFY_HWMON, }; =20 @@ -869,6 +875,10 @@ static int bitland_notifier_callback(struct notifier_b= lock *nb, case BITLAND_NOTIFY_PLATFORM_PROFILE: platform_profile_notify(data_ctx->pp_dev); break; + case BITLAND_NOTIFY_PLATFORM_PROFILE_CYCLE: + if (data_ctx->pp_dev) + platform_profile_cycle(); + break; case BITLAND_NOTIFY_HWMON: fan_info =3D data; =20 @@ -1015,6 +1025,7 @@ static void bitland_mifs_wmi_report_key(struct wmi_de= vice *wdev, u32 payload) static void bitland_mifs_wmi_notify(struct wmi_device *wdev, const struct wmi_buffer *buffer) { + struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(&wdev->dev); const struct bitland_mifs_event *event =3D buffer->data; struct bitland_fan_notify_data fan_data; u8 brightness; @@ -1043,6 +1054,15 @@ static void bitland_mifs_wmi_notify(struct wmi_devic= e *wdev, NULL); return; =20 + case WMI_EVENT_PERFORMANCE_CYCLE: + if (!data->quirks->cycle_profile_on_key) + break; + + blocking_notifier_call_chain(&bitland_notifier_list, + BITLAND_NOTIFY_PLATFORM_PROFILE_CYCLE, + NULL); + return; + /* * The device has 3 fans (CPU, GPU, SYS), * but there are only the CPU and GPU fan has events --=20 2.56.0