From nobody Mon Sep 28 22:28:42 2026 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CB2F3DDB00 for ; Sun, 16 Aug 2026 10:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874921; cv=none; b=Yc0KDI5UyYLYvrz/TL9OXWoJ5eFUF8hnTX8St5ZJfER2HBV7MxO9pdMFoKQfnZM5OYSQo043bEjiC370G1+rk+6TFDEjCKfkfvK84p8c3tcHbQref+J6OttrR5IjhDWlhKggn6Uea6cfz++tXKeRPhaRk8nC/Nh7qo9vHHdQcEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874921; c=relaxed/simple; bh=QY5aebFr1evE8tRE7OmTPb6tag7jx6XNKxf+rMRmOXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eM/f97wq5T/8DEcykPHxJTc8E8TgJMBAE+pA7T0dBHoq5iN4bZp+qXG2NcH2UkBxl4NZhcz7hq+7OOUI4nSUXV90cRalbjcvC61TOrkjKEOTpQv4LLodVdqQMN/042OGwJCaJQZXlgTqg82pttPGWa1ZU4AFSCiGuDr1eC942jk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M1nVFUkr; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M1nVFUkr" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-84867f07d63so2439084b3a.2 for ; Sun, 16 Aug 2026 03:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786874919; x=1787479719; 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=A3guaqxr7NyyvixOm12MKeegXbSzy/kPgiJ95xUExEc=; b=M1nVFUkrdeskYZcbeJBJnCgCyQ78ny7g/e6z0ZZ0QG4HMEmS0rKcEBdo6cLlEqQ7CP 9JYq7IXjHhWfeqffLGMmOdnwxAEfum3bnANmAe9ASxajIDU5J05QzCxc2y9rdNFYQ+7V 6Ck9Ezyaz2NABIRG1kNS+pHSUqqpQgR+d/DdvZ4t6lV/PyYSLawdiXqeSFCNgkkowD7h bDl4Q7n46XGLyWLpLc9npkYXYRkAMSg+Oq+QZl7XSnVmxVUbGeuUNoNtFiMeRHH8OJ1W Edznd0rGztolbX4CUX4aj+9THm4fZ//QtXAtGv1tly0+zF20FFvWw2f7LOGjK+TqTxQk WPjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786874919; x=1787479719; 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=A3guaqxr7NyyvixOm12MKeegXbSzy/kPgiJ95xUExEc=; b=Ry5s7SsmVWw5S5y7SsU5s48OYVdZ7wSgJmCTvjLnAlFrEu6C8JLe3cy9t1mLj9u8t7 2TiTn96CRaPpox8s7Q415n3tKYmfprma8pQ+Un4jlG6aMUiBuXvW4ysADKMpXYXGzBuM KOSR4YuPlMR05NaRA6k6mxT6dfRNCYKEWhJgrhBrDPK8oNrCnXNbcWpV5LrejYiNrJ9v kBK9NvjG+fiKp6AZpUtt0EZivgvMlAS5rAC5q3XyjzqNXLpj1lC0BB0rpIFUsXIc6NGo ust93nAyXZU5ZvJBP+QiB5mL6uskpa5RsqG/X7w4OHqc0p2s87fi3wmIh+2FwwQ3/577 jfsg== X-Forwarded-Encrypted: i=1; AHgh+RqAF3xKDrSo4hHhvHV4h6Xl7DyFoImzjGaJwFLu+/o5j6lbxwGBm46w9YZBYjPnwzf73ZxUfJ6xnivvuW8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+CHnr8rd7vtEuH00fn1D2+LrJv7qfvxLQx/IaIq4sa1tgLCzD SNH8as65/fVsEwmBpCYjIIaRaaweG//1aCTdFVmKD7Hkt/LBLj7n+BrZ X-Gm-Gg: AR+sD12lMflkT8WVU8EN3WCSHfAFtLcgEd1y+Ee5hsSdlOu3V4HxHJkF/zxPvD5FthR Q7whMd1ZnxlcBeA6rsDbESNxh7212JaPB1dy3pt5k9Gw/QHBMadwAqu/00RBFha2bTJsy7gY9P0 rBCXE/iOAKAdudQfWmVcKP7HvADyn1vm+ZESH3k9i4L2riPjBasHZxYYI49JhTGk4hhBmv8OB4a k6ivdxy79ORWwdTAjtOIjuqQ3CuBCyuT2WzSGnsY8R8lqvFFyqh2ElUFsAo7Hc1xLOWl4a9UxJS eZi852y7NsHVWIYxT+kj/Kttk6MXv1PZEC4aCsJch18rmZBOlCKpS9Y3tKJ9xXgNocBBrhvY4N4 ZG+Cx8zFa4FxuPs2ryOzkf9i0HJ2L5IhCR4cAilQfCA/MOxwyhneNvSGMC4t9eGsHNz5T2FSK3j svvFQ9XvZbg2D8s/I9J12FNazphUA89caxKGE= X-Received: by 2002:a05:6a00:1902:b0:848:7552:3d86 with SMTP id d2e1a72fcca58-84fde1fb61bmr16755397b3a.23.1786874918925; Sun, 16 Aug 2026 03:08:38 -0700 (PDT) Received: from qby-laptop ([2a13:edc0:18:16f::a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8517d01f15dsm1759601b3a.20.2026.08.16.03.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2026 03:08:38 -0700 (PDT) From: Mingyou Chen To: qby140326@gmail.com Cc: W_Armin@gmx.de, foxido@foxido.dev, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, nika@nikableh.moe, platform-driver-x86@vger.kernel.org, vlku.milos.fun@gmail.com, i@rsplwe.com, wolf109909@outlook.com, rahulbheda131313@gmail.com Subject: [PATCH v5 1/6] MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver Date: Sun, 16 Aug 2026 18:08:08 +0800 Message-ID: <20260816100813.300450-2-qby140326@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816100813.300450-1-qby140326@gmail.com> References: <20260816100813.300450-1-qby140326@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a new maintainer entry for the bitland-mifs-wmi platform driver. Signed-off-by: Mingyou Chen Reviewed-by: Ilya Gladyshev --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f37a81950e25..af86b1df1a94 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22774,6 +22774,13 @@ L: platform-driver-x86@vger.kernel.org S: Maintained F: drivers/platform/x86/redmi-wmi.c =20 +BITLAND LAPTOP DRIVER +M: Mingyou Chen +M: Gladyshev Ilya +L: platform-driver-x86@vger.kernel.org +S: Maintained +F: drivers/platform/x86/bitland-mifs-wmi.c + REDPINE WIRELESS DRIVER L: linux-wireless@vger.kernel.org S: Orphan --=20 2.55.0 From nobody Mon Sep 28 22:28:42 2026 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0C283DDB02 for ; Sun, 16 Aug 2026 10:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874925; cv=none; b=dMosPE3R7/BZisJYuXNr1RgJtzAfPpbAOj+n2tEWSquuFU7c/toD7ij2W5fZJjzAG3N7EbA7kCJVzrtBNVfTvWDaJluvd2Gt3+3Dv3ls4qnTgNKSaad5GXx4+PLLAC/L/HrcOiAp3mTRhGZnyt54ZHepycdm3t+EokuCIY00iCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874925; c=relaxed/simple; bh=qycZ0BRozYzT9bbWxMfxPy3rhm2G36ZCHEaEgjWL4BA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k3+ydLM0Yp78f7xJuXwkeUMiHczt3SKtuK60SNVv9nKJRZoDx3R8V7IoDWrF6GnY+tVcOZIw4xtGJM+cY5zwJ1A66s5g1NpXfb7sy/yero7eDylZ+/y2MGD6a22/gbMf0mBlgcVcijOJ3EaIIpj8jEc8c9YIVudfxbciHVZ40RU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d9l4YzxC; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d9l4YzxC" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-84f10e55beaso189435b3a.1 for ; Sun, 16 Aug 2026 03:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786874923; x=1787479723; 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=AyjTvRH2L6UPE0KXVLuz5HIPgBQCFlPffiuhEy0FlTw=; b=d9l4YzxCORBwobg/uxm4kcYprp3G3g4/CG4BYQosoqnF1vPV1wlvXuItklM35O9R/B vl10hiBfPqSo/PcKirYbXPavzdufX1XxJlaDpqDdeVLWq8DzUPHhKcR+yXv5X6n7QWNC G5nZvWD2QnwXlvD5yPXm+erEjLK4pnxv+0foK6Qh87EwBbWGTkbhQAckas6Uzm14ddCh oiRCfapl/hRETBe73q/t+AGs5OYbe/S2frv520awNXubCvZo/N2t109biBf8YmatRR+a kLhsJeMviMrs6MjLZF/Dje87lKNhaAUZ7CkUc4d19D2e3CgJwE/07nMVvDqL0CD4njil GR3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786874923; x=1787479723; 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=AyjTvRH2L6UPE0KXVLuz5HIPgBQCFlPffiuhEy0FlTw=; b=n8d1jHO47KxfQyOvtkH3FtlgRXWWemwZkF/cvIovSNaQO/ZuhGs+6fUk/cymr+9zVL m/OqL0ORgPdQ6bZEurIo9MjgRIIIn9V3yTGzZcVBoup7SgcoFkJTebCiXYtWoAP50G6A PtwwgiG1wMaHIr4SgKitunh41MI8i0OY/Ca1REksVj2kWpovZNsQ4UTVkZmRaboTOeOJ 494oTLhL/TepUBzHSc1ORTaPcJr5onsPoTB7BkTYchJ8BslDi9VgBfdMWzmEOKxdeZrA luEpCzGxeKAXX3KzvwdVqS3FuiRQ2nGeSrSTdNzST/wik/G/WqfcWTPZoM7muT4oJJHT 6+Eg== X-Forwarded-Encrypted: i=1; AHgh+RrrYkEOxy3KEZ9sbsQWT8yf1mn/za+xLBo7JEogAqnBsECbDLJsk4Y7ABM7EKCrLfHHpL12Vyg/KEVG4/A=@vger.kernel.org X-Gm-Message-State: AOJu0YxKAKqxQrYZUhyqXN94K0x1jLHzf9+6Fvv431KZGEWLUaZrXyJb Z8EjoabrGQL7Uy7KX32ZoZf4lUuY/AxFrhuHYuPJSwwLG0XXafDMU2IL X-Gm-Gg: AR+sD1211hl4umG41O8i/AcBD0k7Z3ewD3Qj97gg9YsKhTakOCcf++4N+Vh0NgGVxbs Xdd/BxDcX+mpo7QDM3xYxlyanXBNU4farNPDedd1oVki/xAWARrV6yjMuuejDbybBt3DXXd2nVS 1NkpMr8LscV7fW5+If4Io8dln72/gHIeknZS8fH5i5wI491WBQVeb0iQhALLjZ2sVmxW6z9PkQ6 YftPmgvo0E0HMYylF1FGdsrfC6ltIlrvuPextoqS7sh0IlY8F4DA2clEdibQmWo9v7wIYkM+KXy gt8PEpLvNgpkdjtqefnfXxKKMDh5so7izVLZEQ2eyNj+HWfRJZaFO2fF0V71BOXuMP49l/qnsE8 zGxfaVmOr7PuWdsW8K+wVyPCjMjdiierQOHKFrMmAQJ81tHhkWJahHZnr+Bs0k3dE8SWieX8VrR CKhUda/8yxqdDivijM7ibIqX/jbbjM8hTzMBA= X-Received: by 2002:a05:6a00:4655:b0:846:7507:4e07 with SMTP id d2e1a72fcca58-84fde7fe2e0mr17168788b3a.39.1786874922919; Sun, 16 Aug 2026 03:08:42 -0700 (PDT) Received: from qby-laptop ([2a13:edc0:18:16f::a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8517d01f15dsm1759601b3a.20.2026.08.16.03.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2026 03:08:42 -0700 (PDT) From: Mingyou Chen To: qby140326@gmail.com Cc: W_Armin@gmx.de, foxido@foxido.dev, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, nika@nikableh.moe, platform-driver-x86@vger.kernel.org, vlku.milos.fun@gmail.com, i@rsplwe.com, wolf109909@outlook.com, rahulbheda131313@gmail.com Subject: [PATCH v5 2/6] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver Date: Sun, 16 Aug 2026 18:08:09 +0800 Message-ID: <20260816100813.300450-3-qby140326@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816100813.300450-1-qby140326@gmail.com> References: <20260816100813.300450-1-qby140326@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The bitland-mifs-wmi and legacy redmi-wmi drivers both attempt to bind to the same WMI GUID (46C93E13-EE9B-4262-8488-563BCA757FEF). This overlap causes a device registration conflict, preventing one of the drivers from loading properly depending on the module initialization order. Merge the event handling logic from redmi-wmi into bitland-mifs-wmi. By handling both device layouts within a single driver, we eliminate the GUID ownership conflict. Tested-by: Nika Krasnova Signed-off-by: Mingyou Chen Tested-by: Ilya Gladyshev --- drivers/platform/x86/bitland-mifs-wmi.c | 139 ++++++++++++++++-------- 1 file changed, 96 insertions(+), 43 deletions(-) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index b0d06a80e89e..8b6476881de6 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -34,6 +34,11 @@ #include #include =20 +#define BI_HOTKEY_CODE(id, low, high) \ + (((u32)(high) << 24) | ((u32)(low) << 16) | ((u32)(id) << 8) | WMI_EVENT_= TYPE_HOTKEY) + +#define AI_KEY_VALUE_MASK BIT(8) + #define DRV_NAME "bitland-mifs-wmi" #define BITLAND_MIFS_GUID "B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B" #define BITLAND_EVENT_GUID "46C93E13-EE9B-4262-8488-563BCA757FEF" @@ -601,18 +606,59 @@ static const struct attribute *const laptop_attrs[] = =3D { ATTRIBUTE_GROUPS(laptop); =20 static const struct key_entry bitland_mifs_wmi_keymap[] =3D { - { KE_KEY, WMI_EVENT_OPEN_APP, { KEY_PROG1 } }, - { KE_KEY, WMI_EVENT_CALCULATOR_START, { KEY_CALC } }, - { KE_KEY, WMI_EVENT_BROWSER_START, { KEY_WWW } }, - { KE_IGNORE, WMI_EVENT_FN_J, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_F, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_0, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_1, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_2, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_3, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_4, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_5, { KEY_RESERVED } }, - { KE_END, 0 } + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_OPEN_APP, 1, 0), { KEY_PROG1 } }, + + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_CALCULATOR_START, 1, 0), { KEY_CALC } = }, + + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_BROWSER_START, 1, 0), { KEY_WWW } }, + + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_J, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_F, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_0, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_1, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_2, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_3, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_4, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 0, 0), {} }, + + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_2, 0, 0), { KEY_SELECTIVE_SCR= EENSHOT } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_3, 0, 0), { KEY_ALL_APPLICATI= ONS } }, + { KE_KEY, BI_HOTKEY_CODE(0x1b, 0, 0), { KEY_CONFIG } }, + { KE_KEY, BI_HOTKEY_CODE(0x1b, 1, 0), { KEY_CONFIG } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_1, 1, 0), { KEY_SWITCHVIDEOMO= DE } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0), { KEY_REFRESH_RAT= E_TOGGLE } }, + + /* AI button has code for each position */ + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 1, 0), { KEY_ASSISTANT } }, + + { KE_KEY, BI_HOTKEY_CODE(0x19, 1, 0), { KEY_ASSISTANT } }, + + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0x80), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 5, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0x0a, 0), {} }, + + /* Xiaomi G Command Center */ + { KE_KEY, BI_HOTKEY_CODE(0x0a, 1, 0), { KEY_VENDOR } }, + + /* OEM preset power mode */ + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 1, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 2, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 3, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 4, 0), {} }, + + /* Fn Lock state */ + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FNLOCK_STATE, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FNLOCK_STATE, 1, 0), {} }, + + /* Fn+`/1/2/3/4 */ + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_F, 1, 0), { KEY_F13 } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_0, 1, 0), { KEY_F14 } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_1, 1, 0), { KEY_F15 } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_2, 1, 0), { KEY_F16 } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_3, 1, 0), { KEY_F17 } }, + + { KE_END } }; =20 static void bitland_notifier_unregister(void *data) @@ -730,12 +776,35 @@ static int bitland_mifs_wmi_probe(struct wmi_device *= wdev, const void *context) &drv_data->notifier); } =20 +static void bitland_mifs_wmi_report_key(struct wmi_device *wdev, u32 paylo= ad) +{ + struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(&wdev->dev); + struct key_entry *entry; + bool autorelease =3D true; + int value =3D 1; + + entry =3D sparse_keymap_entry_from_scancode(data->input_dev, payload); + if (!entry) { + dev_dbg(&wdev->dev, "Unknown WMI hotkey with payload 0x%08x\n", payload); + return; + } + + /* AI key quirk */ + if (entry->keycode =3D=3D KEY_ASSISTANT) { + value =3D !(payload & AI_KEY_VALUE_MASK); + autorelease =3D false; + } + + guard(mutex)(&data->lock); + sparse_keymap_report_entry(data->input_dev, entry, value, autorelease); +} + 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; + u32 payload; u8 brightness; =20 /* Validate event type */ @@ -752,24 +821,13 @@ static void bitland_mifs_wmi_notify(struct wmi_device= *wdev, blocking_notifier_call_chain(&bitland_notifier_list, BITLAND_NOTIFY_KBD_BRIGHTNESS, &brightness); - break; + return; =20 case WMI_EVENT_PERFORMANCE_PLAN: blocking_notifier_call_chain(&bitland_notifier_list, BITLAND_NOTIFY_PLATFORM_PROFILE, NULL); - break; - - case WMI_EVENT_OPEN_APP: - case WMI_EVENT_CALCULATOR_START: - case WMI_EVENT_BROWSER_START: { - guard(mutex)(&data->lock); - if (!sparse_keymap_report_event(data->input_dev, - event->event_id, 1, true)) - dev_warn(&wdev->dev, "Unknown key pressed: 0x%02x\n", - event->event_id); - break; - } + return; =20 /* * The device has 3 fans (CPU, GPU, SYS), @@ -777,6 +835,14 @@ static void bitland_mifs_wmi_notify(struct wmi_device = *wdev, */ case WMI_EVENT_CPU_FAN_SPEED: case WMI_EVENT_GPU_FAN_SPEED: + /* Redmi refresh rate toggle quirk */ + if (event->event_id =3D=3D WMI_EVENT_CPU_FAN_SPEED && + event->value_low =3D=3D 0 && event->value_high =3D=3D 0) { + payload =3D BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0); + bitland_mifs_wmi_report_key(wdev, payload); + return; + } + if (event->event_id =3D=3D WMI_EVENT_CPU_FAN_SPEED) fan_data.channel =3D 0; else @@ -787,27 +853,14 @@ static void bitland_mifs_wmi_notify(struct wmi_device= *wdev, blocking_notifier_call_chain(&bitland_notifier_list, BITLAND_NOTIFY_HWMON, &fan_data); - break; - - case WMI_EVENT_AIRPLANE_MODE: - case WMI_EVENT_TOUCHPAD_STATE: - case WMI_EVENT_FNLOCK_STATE: - case WMI_EVENT_KBD_MODE: - case WMI_EVENT_CAPSLOCK_STATE: - case WMI_EVENT_NUMLOCK_STATE: - case WMI_EVENT_SCROLLLOCK_STATE: - case WMI_EVENT_REFRESH_RATE: - case WMI_EVENT_WIN_KEY_LOCK: - /* These events are informational or handled by firmware */ - dev_dbg(&wdev->dev, "State change event: id=3D%d value=3D%d\n", - event->event_id, event->value_low); - break; + return; =20 default: - dev_dbg(&wdev->dev, "Unknown event: id=3D0x%02x value=3D0x%02x\n", - event->event_id, event->value_low); break; } + + payload =3D get_unaligned_le32(buffer->data); + bitland_mifs_wmi_report_key(wdev, payload); } =20 static const struct wmi_device_id bitland_mifs_wmi_id_table[] =3D { --=20 2.55.0 From nobody Mon Sep 28 22:28:42 2026 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BE0230C16F for ; Sun, 16 Aug 2026 10:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874928; cv=none; b=cBH+TikXHtReSTV2igJ2iIWjEZT74DMcPYN0ZkyOfh4e51LhkOLqUHtyHGY4NDhd5LJnAToLez/lfX0Kjf99yaiA5SzYnpyMhhy2WA79SoQEdUvnkrAL7JLvt1Ca/TqKhifgX0NMb5mxjFOhsM+zD3peXyEuqmz56HPa7KoL304= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874928; c=relaxed/simple; bh=fCV+2yJC4cZrnJl1H1PmJvR+PHD59988Urbd1y2vbjM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H88UDKtw0aoI0nqhMfvEd3ICVgaQumGOhelFnSbBGQuDxD5EkqehDARZprTSAC/SSSWY7g3/33y85r7N/sOai8LL7T10o3CIafQMuMuw6u7+DO/8b9+L4aGHVzhvfICdCrRiSbTeigSKKxHGfIpN7ZmFasE2LdyH/fPALOtbVH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Lu0I311u; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lu0I311u" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-84862b0d5f8so1838286b3a.3 for ; Sun, 16 Aug 2026 03:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786874926; x=1787479726; 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=TFReB0FpblksjxyfEVt8Xa+UaQs+LIPFGRM0Eqvgr6U=; b=Lu0I311uxi4mzqh304sqCdK8l2FNSPasnHM54PrpnG304smdSliwYD6knYJZB22mmK N65x6/KwCVS/GweMfk6TChM2l9v3wHBqjQCeoiaJWgSzDNoTKSSITAoXwu2FYB0XrknL jsW/gFMtxJS0kHVmyNzqeWtFCpM4TC+5pyX2CRiZlUupLsLSOOITyHR3Q2sjU0ldLP0t dG1a1B0e396rbs5yI/+kk+2jV+a1Pwr4qRNw2mCP2UlARMR2o9NG2tc0MXEEANoPQo52 wJLyk6R9QJ83QbVWcjTD219+svfpy4i0Y8ekoZCP3ZuXjCZBNLdXJPbs1PrtSL3RB7Ls RlZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786874926; x=1787479726; 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=TFReB0FpblksjxyfEVt8Xa+UaQs+LIPFGRM0Eqvgr6U=; b=U1tNJ2l38wI+bP7nxp9rF4qVrIou5DbfWQxqAv/zAL7Jbvsg7Wo1/KE7GrCX/ChUlb /cT9zSugEAGHGrCeWhtEWMbG67/h35E9XGRTgU3zRKTUew7U0N9trw3RUMEcXxtQ/zbN dBL7DS+sbU0tPZJrfeofW6WHGT5/ze4pgvO2EL9w3KvX+juZdBsES9405PBKYXtUMB6E 15iPKIY5RCw0PZ5dJJXlINtAUL+LyPFXa1Gh/zoV+a4VNrSv68iu6NQ6pi64zFur73tI Gzvu0DiTVfD33Ya3oEtS6VErrYnzujbnPDdZ4zKcNKgq7wbD/LfmpzSYxH5/pGj6/Sde nb9Q== X-Forwarded-Encrypted: i=1; AHgh+RqTR7AZ01AMOYwgOlgvU8nxDf0lKmDkhFXl5L8QXGOqwvuCXbEVeWwK5VRgbTzXwh4R3S/mORqqoGibRbU=@vger.kernel.org X-Gm-Message-State: AOJu0YwIHZbrr1U53jeDvGtDwoPpaCosCXVWUrpeOQt0cr0mT3IlxJE6 +knmE5q3lJSWOhEqndCFSmKwj64oRFGk7qhDOpzbRA8biuvXt1i+BhCj X-Gm-Gg: AR+sD111xe3PAK3QfTyVV9Em1frUppPRH8E9fwe8Hlt03Mpk9LU0Udb8JlLMG7qRquT NuUiJCCOogiHQhayeSwMzlW29Szpt1o0Rd7nDy5mcyhR8R+syuLaNcyszmOuK9jzKrZ/BTkMQDS XtXi4f+kuRCYepe3N/oLeN3VJrCKS78U5VnL/6FjtCCtDqrRQAfI389N5FgwQFrZw2x+lZm+LFE u0yYz+DeRv/PerkXs/0u97oyYuY0O6BJasUbKBw+whY1H7PLQam4uXOUrrUTcrsuUVoQOo5pIFO oJXXyBXPUGzOqvplDLHlrI18P6BqmpfUU+3IK715wAZDPdSJTdb/+UH1kvaECwudYbtrrqOfh4F scRSDUeHnOxkDmliSGymLaopxmK+6sH3UX/la+jXMX7vKrREZZHjXXnoZTUVgfzfrHo/JvBa2zc XSEVFSze5khBygyVjL/dD/1hKH1Iz+2xWpTpIJdA3KLQdpxA== X-Received: by 2002:a05:6a00:4286:b0:84e:831:9a1a with SMTP id d2e1a72fcca58-84fde223da7mr17657069b3a.21.1786874926588; Sun, 16 Aug 2026 03:08:46 -0700 (PDT) Received: from qby-laptop ([2a13:edc0:18:16f::a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8517d01f15dsm1759601b3a.20.2026.08.16.03.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2026 03:08:46 -0700 (PDT) From: Mingyou Chen To: qby140326@gmail.com Cc: W_Armin@gmx.de, foxido@foxido.dev, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, nika@nikableh.moe, platform-driver-x86@vger.kernel.org, vlku.milos.fun@gmail.com, i@rsplwe.com, wolf109909@outlook.com, rahulbheda131313@gmail.com Subject: [PATCH v5 3/6] platform/x86: bitland-mifs-wmi: Add Redmi mic-mute key entries Date: Sun, 16 Aug 2026 18:08:10 +0800 Message-ID: <20260816100813.300450-4-qby140326@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816100813.300450-1-qby140326@gmail.com> References: <20260816100813.300450-1-qby140326@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add the missing Redmibook mic-mute hotkey definitions to the shared sparse keymap table: - 0x00002101 (Fn-lock disabled state) - 0x00012101 (Fn-lock enabled state) Reported-by: Nika Krasnova Link: https://lore.kernel.org/platform-driver-x86/20260531123345.237521-1-nika@ni= kableh.moe/ Signed-off-by: Mingyou Chen --- drivers/platform/x86/bitland-mifs-wmi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index 8b6476881de6..81dad2b65f4f 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -628,6 +628,10 @@ static const struct key_entry bitland_mifs_wmi_keymap[= ] =3D { { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_1, 1, 0), { KEY_SWITCHVIDEOMO= DE } }, { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0), { KEY_REFRESH_RAT= E_TOGGLE } }, =20 + /* Mic-mute key */ + { KE_KEY, BI_HOTKEY_CODE(0x21, 0, 0), { KEY_MICMUTE } }, + { KE_KEY, BI_HOTKEY_CODE(0x21, 1, 0), { KEY_MICMUTE } }, + /* AI button has code for each position */ { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 1, 0), { KEY_ASSISTANT } }, =20 --=20 2.55.0 From nobody Mon Sep 28 22:28:42 2026 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CB173DD875 for ; Sun, 16 Aug 2026 10:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874932; cv=none; b=pwmM1GJiuyNeoyQ4giMHwyHTbF6hTdqBYZr4bONAd164TmNsC6T5upVZgn3EQL6u1SyqzjNfoOB1DHI/bYZBQ2U70LY1qeulkfCcFMwZbwbI4N34yOnYZkMFK2lmt0W7yZ/thJXh1f2xLO/U5tLDGlimC5wZUvg7WX9Jy+4yLrI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874932; c=relaxed/simple; bh=qaNQ/iKdm+tr9gI6Dq66O60lBZHzk6jx64BBqORlpLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ih+hOE9dVo/lxN4CBKxG6MDQLspeIcw8WMJ51yeoWQhnfAqJ7kKKenYIIdW4376tWwsJkaDOC6H+hYhArJt4ZoFbE4Am5t1RCVrLEdl3IgfU5+god+lpNgzpxzV2dNPs7SCt3XBodGd+xS+Ji5qvh7yXO66g9XyfZvlUSqlmws0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XJ8PpFZp; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XJ8PpFZp" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-8518d5ddaabso521148b3a.2 for ; Sun, 16 Aug 2026 03:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786874930; x=1787479730; 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=7u0RLtYXUYQ7iwz3Gl2qvOsAZ+m2eRqkafH2q6kwGqA=; b=XJ8PpFZpifdnNMV6s/N49cXfIDhS+cGOIePRAipVfU2wBER+EHepLPPi4pgm2Q7kdM hljgarJnBJmirG+9EUKY7x4br8yfCwTZxKUwVLDYo1x+UoUQ78dCQYAN/QNobFEqyU2e PYFJ6Hcvv4kyfH0J20URqz0UKhG0Hj+Skoa8UVLUYHLeX86tx0AziNoK0VX1oMd+eVD4 GqtDBCf6BLY0IVpClEecBhULUgk74QFr3YHxMzlFZ+H5+rc7pnQUolQcy8q80BrLJusK AIurs/iFuTJ/qtF2Rk710Mm2dIZhTp2MQFRysvzz+47qRPpJHcVnnkP5IRvhe654vXgW wsQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786874930; x=1787479730; 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=7u0RLtYXUYQ7iwz3Gl2qvOsAZ+m2eRqkafH2q6kwGqA=; b=FnJJpL4E4EfUoZWSfRa1ym0ejcb5u6SqpaRfDfcLQ+eitMTM8z3EdGmjes7Pyw6PP3 qQ/9cOZka6gargwKytuoYULwyO2lRKA4JvQHdK6t5fU9aJMiq+6Sg24C5FPXdB6rvmJL tQOk6/eDgyVK0W+ZXMrv3loTWrcjlsOrgQZ0r7ajxZnxgvh1Ya5+1Nr+3Bgolb+uWfny rLfe+LLpZkCjaFqTbilF2JDoq71ehasa/mUfeeOQcEm3LozxL4PFzI815blCA8nYT25J Sk9JqsUE1a9wbiPW6RuX16gcjSPh5+b46VaIMhFnwz/x+/wsMAL+QSun4xr4F1A/YnmH VGJg== X-Forwarded-Encrypted: i=1; AHgh+RqqMrH9n7rc6152ykHx3uQbk64zXN88H/82OxTLfwg76HCDPlJLv34wJijtyrOJavuusuf/4X+8haLNDQ8=@vger.kernel.org X-Gm-Message-State: AOJu0YxmTljb0DtYbVV3q7SXGIxmE19qoaauUF4LFqByCIOpqPgCHaxf izCYNg60X6BbZVMHCLRZNZrmu2EqwcK3Ls+Jlvgtt0vEPUIpXgqs4mF4 X-Gm-Gg: AR+sD13E+KRGjUByaTSX9OTwdJpB5klM/G4z2DUmZRYz1yWbH9WuTgPWCQ9HwWGsq5Q uJGF9cP8t5YdD0s0i4KBuakPGmY3MnUaLHWxT90vUe54eUdd0XWEmnIaksNuaV+e3k56JH4be01 1QTlkQyZWK9mEhl0+8SCd9ysJw1YHlCzz/jRaVen0xudL76njri0cRPY6iShlRs5UY+fpy4xLVp Aqry0U2FcpBwhyJUHzcLUaq+6lANHYU6PvjY0V2xKyc/b7TSAgW5/PSHJfz0ePrRVHDsHzIZpuE n/bYzbVJ1RZfjQ0rK8RnTIKkBPhpDEVlnrKLrAsJkNSgavJ29niILvy6EezoTQs3g6VN8g9PHQB ZSq8+H2ASwz2qbn4uZZu9K6h9Nx9EW8b092X5TdZQLdA8xEeBGSywMeFa/OkpuleJFB4sqRuE2u EwrKLf9FahsMyL6mlZ9CveTzb5xGe/suuBx/a6e1ShEBvo8g== X-Received: by 2002:a05:6a00:414c:b0:845:e9e8:6458 with SMTP id d2e1a72fcca58-84fde38d9e8mr17570417b3a.20.1786874930513; Sun, 16 Aug 2026 03:08:50 -0700 (PDT) Received: from qby-laptop ([2a13:edc0:18:16f::a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8517d01f15dsm1759601b3a.20.2026.08.16.03.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2026 03:08:50 -0700 (PDT) From: Mingyou Chen To: qby140326@gmail.com Cc: W_Armin@gmx.de, foxido@foxido.dev, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, nika@nikableh.moe, platform-driver-x86@vger.kernel.org, vlku.milos.fun@gmail.com, i@rsplwe.com, wolf109909@outlook.com, rahulbheda131313@gmail.com Subject: [PATCH v5 4/6] platform/x86: redmi-wmi: Drop redmi-wmi driver Date: Sun, 16 Aug 2026 18:08:11 +0800 Message-ID: <20260816100813.300450-5-qby140326@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816100813.300450-1-qby140326@gmail.com> References: <20260816100813.300450-1-qby140326@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The redmi-wmi driver is no longer needed because its functionality has been superseded by the new generic bitland platform driver. All supported Redmi laptop models are now handled properly via the updated WMI interfaces in bitland-mifs-wmi. Remove the obsolete code, Kconfig entries, and Makefile references to clean up the platform directory. Signed-off-by: Mingyou Chen Reviewed-by: Ilya Gladyshev --- MAINTAINERS | 6 -- drivers/platform/x86/Kconfig | 12 --- drivers/platform/x86/Makefile | 1 - drivers/platform/x86/redmi-wmi.c | 154 ------------------------------- 4 files changed, 173 deletions(-) delete mode 100644 drivers/platform/x86/redmi-wmi.c diff --git a/MAINTAINERS b/MAINTAINERS index af86b1df1a94..b92bc4816fa6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22768,12 +22768,6 @@ S: Maintained T: git https://github.com/pkshih/rtw.git F: drivers/net/wireless/realtek/rtw89/ =20 -REDMIBOOK WMI DRIVERS -M: Gladyshev Ilya -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/redmi-wmi.c - BITLAND LAPTOP DRIVER M: Mingyou Chen M: Gladyshev Ilya diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index b54b5212b204..036fc76f62df 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -90,18 +90,6 @@ config XIAOMI_WMI To compile this driver as a module, choose M here: the module will be called xiaomi-wmi. =20 -config REDMI_WMI - tristate "Redmibook WMI key driver" - depends on ACPI_WMI - depends on INPUT - select INPUT_SPARSEKMAP - help - Say Y here if you want support for WMI-based hotkey events on - Xiaomi Redmibook devices. - - To compile this driver as a module, choose M here: the module will - be called redmi-wmi. - config GIGABYTE_WMI tristate "Gigabyte WMI temperature driver" depends on ACPI_WMI diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 872ac3842391..0da4876f766e 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -12,7 +12,6 @@ obj-$(CONFIG_HUAWEI_WMI) +=3D huawei-wmi.o obj-$(CONFIG_MXM_WMI) +=3D mxm-wmi.o obj-$(CONFIG_NVIDIA_WMI_EC_BACKLIGHT) +=3D nvidia-wmi-ec-backlight.o obj-$(CONFIG_XIAOMI_WMI) +=3D xiaomi-wmi.o -obj-$(CONFIG_REDMI_WMI) +=3D redmi-wmi.o obj-$(CONFIG_GIGABYTE_WMI) +=3D gigabyte-wmi.o obj-$(CONFIG_BITLAND_MIFS_WMI) +=3D bitland-mifs-wmi.o =20 diff --git a/drivers/platform/x86/redmi-wmi.c b/drivers/platform/x86/redmi-= wmi.c deleted file mode 100644 index 58898630eda6..000000000000 --- a/drivers/platform/x86/redmi-wmi.c +++ /dev/null @@ -1,154 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* WMI driver for Xiaomi Redmibooks */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define WMI_REDMIBOOK_KEYBOARD_EVENT_GUID "46C93E13-EE9B-4262-8488-563BCA7= 57FEF" - -#define AI_KEY_VALUE_MASK BIT(8) - -static const struct key_entry redmi_wmi_keymap[] =3D { - {KE_KEY, 0x00000201, {KEY_SELECTIVE_SCREENSHOT}}, - {KE_KEY, 0x00000301, {KEY_ALL_APPLICATIONS}}, - {KE_KEY, 0x00001b01, {KEY_CONFIG}}, - {KE_KEY, 0x00011b01, {KEY_CONFIG}}, - {KE_KEY, 0x00010101, {KEY_SWITCHVIDEOMODE}}, - {KE_KEY, 0x00001a01, {KEY_REFRESH_RATE_TOGGLE}}, - - /* AI button has code for each position */ - {KE_KEY, 0x00011801, {KEY_ASSISTANT}}, - {KE_KEY, 0x00011901, {KEY_ASSISTANT}}, - - /* Keyboard backlight */ - {KE_IGNORE, 0x00000501, {}}, - {KE_IGNORE, 0x00800501, {}}, - {KE_IGNORE, 0x00050501, {}}, - {KE_IGNORE, 0x000a0501, {}}, - - /* Xiaomi G Command Center */ - {KE_KEY, 0x00010a01, {KEY_VENDOR}}, - - /* OEM preset power mode */ - {KE_IGNORE, 0x00011601, {}}, - {KE_IGNORE, 0x00021601, {}}, - {KE_IGNORE, 0x00031601, {}}, - {KE_IGNORE, 0x00041601, {}}, - - /* Fn Lock state */ - {KE_IGNORE, 0x00000701, {}}, - {KE_IGNORE, 0x00010701, {}}, - - /* Fn+`/1/2/3/4 */ - {KE_KEY, 0x00011101, {KEY_F13}}, - {KE_KEY, 0x00011201, {KEY_F14}}, - {KE_KEY, 0x00011301, {KEY_F15}}, - {KE_KEY, 0x00011401, {KEY_F16}}, - {KE_KEY, 0x00011501, {KEY_F17}}, - - {KE_END} -}; - -struct redmi_wmi { - struct input_dev *input_dev; - /* Protects the key event sequence */ - struct mutex key_lock; -}; - -static int redmi_wmi_probe(struct wmi_device *wdev, const void *context) -{ - struct redmi_wmi *data; - int err; - - /* Init dev */ - data =3D devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; - - dev_set_drvdata(&wdev->dev, data); - - err =3D devm_mutex_init(&wdev->dev, &data->key_lock); - if (err) - return err; - - data->input_dev =3D devm_input_allocate_device(&wdev->dev); - if (!data->input_dev) - return -ENOMEM; - - data->input_dev->name =3D "Redmibook WMI keys"; - data->input_dev->phys =3D "wmi/input0"; - - err =3D sparse_keymap_setup(data->input_dev, redmi_wmi_keymap, NULL); - if (err) - return err; - - return input_register_device(data->input_dev); -} - -static void redmi_wmi_notify(struct wmi_device *wdev, union acpi_object *o= bj) -{ - struct key_entry *entry; - struct redmi_wmi *data =3D dev_get_drvdata(&wdev->dev); - bool autorelease =3D true; - u32 payload; - int value =3D 1; - - if (obj->type !=3D ACPI_TYPE_BUFFER) { - dev_err(&wdev->dev, "Bad response type %u\n", obj->type); - return; - } - - if (obj->buffer.length < 32) { - dev_err(&wdev->dev, "Invalid buffer length %u\n", obj->buffer.length); - return; - } - - payload =3D get_unaligned_le32(obj->buffer.pointer); - entry =3D sparse_keymap_entry_from_scancode(data->input_dev, payload); - - if (!entry) { - dev_dbg(&wdev->dev, "Unknown WMI event with payload %u", payload); - return; - } - - /* AI key quirk */ - if (entry->keycode =3D=3D KEY_ASSISTANT) { - value =3D !(payload & AI_KEY_VALUE_MASK); - autorelease =3D false; - } - - guard(mutex)(&data->key_lock); - sparse_keymap_report_entry(data->input_dev, entry, value, autorelease); -} - -static const struct wmi_device_id redmi_wmi_id_table[] =3D { - { WMI_REDMIBOOK_KEYBOARD_EVENT_GUID, NULL }, - { } -}; - -static struct wmi_driver redmi_wmi_driver =3D { - .driver =3D { - .name =3D "redmi-wmi", - .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, - }, - .id_table =3D redmi_wmi_id_table, - .min_event_size =3D 32, - .probe =3D redmi_wmi_probe, - .notify =3D redmi_wmi_notify, - .no_singleton =3D true, -}; -module_wmi_driver(redmi_wmi_driver); - -MODULE_DEVICE_TABLE(wmi, redmi_wmi_id_table); -MODULE_AUTHOR("Gladyshev Ilya "); -MODULE_DESCRIPTION("Redmibook WMI driver"); -MODULE_LICENSE("GPL"); --=20 2.55.0 From nobody Mon Sep 28 22:28:42 2026 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67DA23DDDC4 for ; Sun, 16 Aug 2026 10:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874937; cv=none; b=K/kNwTSJEQUu8MAPAbppG8anPCdEL92TUVtwF93iZ6dRyzcvGB1icpRkS+/05AQKZ/FXMBmCgpUGW84ZuJrMtTk4k+37IavzBNjefv6BqqNDp3cQ4myi2rRAJ/4ZViQ716cbGmo0nByP/gyXxgtYi3E9IWM5Itx9//ITa4bWg8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874937; c=relaxed/simple; bh=rz/N6YjVafxuJ7l7ui4YPxX1PJNihBUbWeyPN273N3g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WnaEQxAXAsgj9qn595lmC+memJ9Ae5BudHpDTZQSpPA55hN6/tVL/b4Rt7MPkh5vSDDpxo1wOheUoRIoYGyadMMIQzsfQFtKCeKudHif3jFzK1UlhyB7gW75/P4mTIVZIXlexPaMg6uYonq9Q2FXUbjjcuHhhkd+iJVpcNdlSxc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=g2TGP6HD; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g2TGP6HD" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-84e3007a2b7so2028636b3a.0 for ; Sun, 16 Aug 2026 03:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786874935; x=1787479735; 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=ZSkR9tIKiTyiThY12Ko2HUffdRvYZARmMC0w+0N9FPw=; b=g2TGP6HD4RTVWj34JXQkWwvACNLNMRJKbsERvBhod8cqXhRXzvyt53NRTqcnjP8dMy USJJRYYn4grzVLTCnbgX/fXg9m09pjuH6p40sjA4mfjRH/ge4+DGyWQ73gerpvBcUtMd G6/U6SsCsfSdanybehnpn7U8EHLlaiOrXpL41rEfvZ3KgVLB0WfmsTmi1eBuf5rVU5B2 zrRhQRBX347TRhlvT50CBvme2dKVnfTBLxyJpWR3M8blk9vGiVCFPgLzxhqvlQ6U6B/Z 3KEx+OfPEFwCBiqZda58oyYOxJgDmdCnFBrLLy+U+wuev26NJE5xibihsp8y/hUToo3a mSSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786874935; x=1787479735; 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=ZSkR9tIKiTyiThY12Ko2HUffdRvYZARmMC0w+0N9FPw=; b=JFlWELEb6m+IRNpq9gOhoTk3CyStR9C3Mq4dGDuwOyydWmUImInLpthv/1/soUUw4b st3l4VI4o7tHx1Dn855q1+Pi8TY5Prqo6PBfhaOudCG2wtH20Aw4Er2q1md2Dcw2lQMR Xs6/XYvrD2oEwtskpo+LOFdyNwCiVlMrJVxH/oQEjP+rP8u/YKZ/WT77ngG6mvlDRTa7 YCZcI4Y+SkAWQh36pZmt8CTPf88yavpCckN5VoOzO759dqlXD6Ze96F+WhHUw/DwkcUo 5zygj/pnZRX6/QFYdh+ATPgpmO8+k3TxfeoT1M0UYA+4zx7ZTlFXkOqU2STmUVZ2Okk4 GBYA== X-Forwarded-Encrypted: i=1; AHgh+RqjW8LUkowJxPQXJT1U+G4HLjVkQhWfBOppaZ39w/GuTyiBzFLsw+XOzPz5eMGnqua+eSrT70okWd14kH8=@vger.kernel.org X-Gm-Message-State: AOJu0YwSZRVw4aJJz3oRS+tV4/hlu/ZQ7+G0ja95jm6dd2gRZOWg/m6H YS8CYmCD+S6bsjdhQCpI4QhsydTUeYkd3xeilep1fsBaDiYBOs6GrRn4 X-Gm-Gg: AR+sD13fzasb+Nit1AihTuhmOPU/5Or27CBws5rmFZaKM8V1BwXM6e/v4/De0T9VpOS /TSbHrISPFihXXWx3jBtJS5ZwiBLpkZTHuBtLJ8Mp1Hyko3f/FRLoTa6oO43LTZQzWvaJRGKfoM BiO5KuYcCx/FaYHo4MqQh9dcex6tn50pX1WYvdKNv8tV40Qwi72hD2dherj0e1aVgeiCbBQjx6k gnJHRMyJpkv2K028NQ4kVOheZfSILb3bFQYQWqYkhaw/BYxtTfogLEE7i0w3iMI0Ans0jP9T5ZL wiMw5PeDYKREVPEQJ+Y+MoBcJ8vJKVnCwJasY+Vb/2+z2Giiwy7chefRfe0Vy6yfpW0IveJcZzz treBwN/IkrPxpmn096oxYyD9tOimCH7cU7uq6MBgrjU6Agt3Cu6HUyM0n2gPGKiwdjb6UUT7sNY fbp66MEuAaHUbJtpgIowwtmejvERSnvXS2pLk= X-Received: by 2002:a05:6a00:4293:b0:84f:3f5e:f072 with SMTP id d2e1a72fcca58-84fde15eb90mr18799030b3a.10.1786874934591; Sun, 16 Aug 2026 03:08:54 -0700 (PDT) Received: from qby-laptop ([2a13:edc0:18:16f::a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8517d01f15dsm1759601b3a.20.2026.08.16.03.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2026 03:08:54 -0700 (PDT) From: Mingyou Chen To: qby140326@gmail.com Cc: W_Armin@gmx.de, foxido@foxido.dev, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, nika@nikableh.moe, platform-driver-x86@vger.kernel.org, vlku.milos.fun@gmail.com, i@rsplwe.com, wolf109909@outlook.com, rahulbheda131313@gmail.com Subject: [PATCH v5 5/6] platform/x86: bitland-mifs-wmi: Add per-machine ops table Date: Sun, 16 Aug 2026 18:08:12 +0800 Message-ID: <20260816100813.300450-6-qby140326@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816100813.300450-1-qby140326@gmail.com> References: <20260816100813.300450-1-qby140326@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The MIFS WMI interface is shared by several Bitland ODM laptops which differ in the layout of the performance mode values of WMI_FN_SYSTEM_PER_MODE and in the capability checks. Introduce a machine ops table to support multiple machine families without sprinkling model checks over the driver: struct bitland_mifs_ops { const char *name; const struct bitland_profile_mode_map *mode_map; int (*check_performance_capability)( struct bitland_mifs_wmi_data *data); bool has_full_speed; }; The default ops instance keeps the current Bitland behavior, so this change is a pure refactor without any functional changes. Signed-off-by: Mingyou Chen --- drivers/platform/x86/bitland-mifs-wmi.c | 89 +++++++++++++++++++------ 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index 81dad2b65f4f..17792d8b7c29 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -78,6 +78,46 @@ enum bitland_mifs_power_profile { WMI_PP_FULL_SPEED =3D 3, }; =20 +struct bitland_mifs_wmi_data; + +/* + * Value layout of WMI_FN_SYSTEM_PER_MODE. + */ +struct bitland_profile_mode_map { + u8 balanced; + u8 performance; + u8 quiet; + u8 full_speed; +}; + +static const struct bitland_profile_mode_map bitland_mode_map =3D { + .balanced =3D WMI_PP_BALANCED, + .performance =3D WMI_PP_PERFORMANCE, + .quiet =3D WMI_PP_QUIET, + .full_speed =3D WMI_PP_FULL_SPEED, +}; + +static int bitland_pp_check_capability(struct bitland_mifs_wmi_data *data); + +/* + * Machine-specific operations. The MIFS WMI interface is shared by + * several Bitland ODM laptops which differ in the layout of the + * performance mode values and in the capability checks. + */ +struct bitland_mifs_ops { + const char *name; + const struct bitland_profile_mode_map *mode_map; + int (*check_performance_capability)(struct bitland_mifs_wmi_data *data); + bool has_full_speed; +}; + +static const struct bitland_mifs_ops bitland_ops =3D { + .name =3D "Bitland", + .mode_map =3D &bitland_mode_map, + .check_performance_capability =3D bitland_pp_check_capability, + .has_full_speed =3D true, +}; + enum bitland_mifs_event_id { WMI_EVENT_RESERVED_1 =3D 1, WMI_EVENT_RESERVED_2 =3D 2, @@ -163,6 +203,7 @@ struct bitland_mifs_wmi_data { struct input_dev *input_dev; struct device *hwmon_dev; struct device *pp_dev; + const struct bitland_mifs_ops *ops; enum platform_profile_option saved_profile; }; =20 @@ -193,6 +234,7 @@ static int laptop_profile_get(struct device *dev, enum platform_profile_option *profile) { struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); + const struct bitland_profile_mode_map *map =3D data->ops->mode_map; struct bitland_mifs_input input =3D { .reserved1 =3D 0, .operation =3D WMI_METHOD_GET, @@ -200,32 +242,29 @@ static int laptop_profile_get(struct device *dev, .function =3D WMI_FN_SYSTEM_PER_MODE, }; struct bitland_mifs_output result; + u8 mode; int ret; =20 ret =3D bitland_mifs_wmi_call(data, &input, &result); if (ret) return ret; =20 - switch (result.data[0]) { - case WMI_PP_BALANCED: + mode =3D result.data[0]; + if (mode =3D=3D map->quiet) + *profile =3D PLATFORM_PROFILE_LOW_POWER; + else if (mode =3D=3D map->balanced) *profile =3D PLATFORM_PROFILE_BALANCED; - break; - case WMI_PP_PERFORMANCE: + else if (mode =3D=3D map->performance) *profile =3D PLATFORM_PROFILE_BALANCED_PERFORMANCE; - break; - case WMI_PP_QUIET: - *profile =3D PLATFORM_PROFILE_LOW_POWER; - break; - case WMI_PP_FULL_SPEED: + else if (mode =3D=3D map->full_speed) *profile =3D PLATFORM_PROFILE_PERFORMANCE; - break; - default: + else return -EINVAL; - } + return 0; } =20 -static int bitland_check_performance_capability(struct bitland_mifs_wmi_da= ta *data) +static int bitland_pp_check_capability(struct bitland_mifs_wmi_data *data) { struct bitland_mifs_input input =3D { .operation =3D WMI_METHOD_GET, @@ -252,6 +291,7 @@ static int laptop_profile_set(struct device *dev, enum platform_profile_option profile) { struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); + const struct bitland_profile_mode_map *map =3D data->ops->mode_map; struct bitland_mifs_input input =3D { .reserved1 =3D 0, .operation =3D WMI_METHOD_SET, @@ -259,42 +299,46 @@ static int laptop_profile_set(struct device *dev, .function =3D WMI_FN_SYSTEM_PER_MODE, }; int ret; - u8 val; + u8 mode; =20 switch (profile) { case PLATFORM_PROFILE_LOW_POWER: - val =3D WMI_PP_QUIET; + mode =3D map->quiet; break; case PLATFORM_PROFILE_BALANCED: - val =3D WMI_PP_BALANCED; + mode =3D map->balanced; break; case PLATFORM_PROFILE_BALANCED_PERFORMANCE: - ret =3D bitland_check_performance_capability(data); + ret =3D data->ops->check_performance_capability(data); if (ret) return ret; - val =3D WMI_PP_PERFORMANCE; + mode =3D map->performance; break; case PLATFORM_PROFILE_PERFORMANCE: - ret =3D bitland_check_performance_capability(data); + ret =3D data->ops->check_performance_capability(data); if (ret) return ret; - val =3D WMI_PP_FULL_SPEED; + mode =3D map->full_speed; break; default: return -EOPNOTSUPP; } =20 - input.payload[0] =3D val; + input.payload[0] =3D mode; =20 return bitland_mifs_wmi_call(data, &input, NULL); } =20 static int platform_profile_probe(void *drvdata, unsigned long *choices) { + struct bitland_mifs_wmi_data *data =3D drvdata; + set_bit(PLATFORM_PROFILE_LOW_POWER, choices); set_bit(PLATFORM_PROFILE_BALANCED, choices); set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices); - set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + + if (data->ops->has_full_speed) + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); =20 return 0; } @@ -717,6 +761,7 @@ static int bitland_mifs_wmi_probe(struct wmi_device *wd= ev, const void *context) return -ENOMEM; =20 drv_data->wdev =3D wdev; + drv_data->ops =3D &bitland_ops; =20 ret =3D devm_mutex_init(&wdev->dev, &drv_data->lock); if (ret) --=20 2.55.0 From nobody Mon Sep 28 22:28:42 2026 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CDED3DDDD7 for ; Sun, 16 Aug 2026 10:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874942; cv=none; b=VvJ9f5UwLm4hFb+2jocAIanxJ/DEV1QT8Nrb2xtu1pKscLmzjbQ4xa5aUJaE6q0/qQcIrUFv0ydq82Bpq1jZGDlOUBzXRhCr/GHUaDGonmiI/mtxOpX/v/LUhGEA6VQmsZTKW4HFj2wDEKAJq3UHIw92FX7gUsxVdlDOAgXWH4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786874942; c=relaxed/simple; bh=F2HCgETZCdYVX3fpOhx6NMX7cC9leYQ7+t4P7UhcryI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PafUKh+cYd/8QZzKuxmtImaxJ2tVACADcRdJWtQ/4ZIzKeNmN72Nk3Pol4SXFR3LgZPkei+BaQ0mroRP7iGG7QMFNlOb83dcblyYrfxKs9turj4w1sff7sWggSV+5p2LowNMzStVX+fziGl/L2m6hfHOzlLanaG5QP36y7Wdf/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mCDhZkF7; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mCDhZkF7" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-8487214ad2bso3289567b3a.1 for ; Sun, 16 Aug 2026 03:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786874939; x=1787479739; 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=mKyU9O5jdgD1LXMQrQRb7YCN3v7cek/dievVUeA+tLk=; b=mCDhZkF7oikaXdn+mZpwpWfzWMZ63A5QioAjtOHMjkJrjp7c3UAXBPvJRGNtA5whNg 5vycQswbJMjlt6aYJq3WDYtyWyfWMGOtzAlSACfidHdZ7A9GCoMryXtiSX3bE7lmYQB3 biDzFjT3js4iRlqIMWI1ek105i3l2qBcUXuMqBdXDSDw9jrU5cPWv7TfDNnKClZC6ukd xVjFJVdHh5o3gGk8e7cFYd4VJ63Rz0uwwNqX0WCQ0xyMlApHC0Z6YvFy9HDr74h22jlg xu1XFnnraTtP9MPpf8Ly8gPHOtt2FaF/+TQVzVqtFmXVW8t0H17sWrgBKD0PLPMjBBeJ /Bag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786874939; x=1787479739; 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=mKyU9O5jdgD1LXMQrQRb7YCN3v7cek/dievVUeA+tLk=; b=hSCq9es1kR1QPj0zdVQcqjc09xgT0nXjYT2JeoMjiRawL6qtJyfEALLY+2Ga70vjhQ 0N8G3PAIHlBYC/loVNlQh9/swOBY15RTpkjqriKTgzktk8rRdX34AvDlZBm4MJV51Be9 auH2Z0p7pvuYL8RYYADHWSK6+FpVxS6qKQtSRisP+VC9fEDbN+4oPfW0ZQHg5Av0q/aa HPcqSdNH7fLOKzUUsfYGsEV2uulBD/pYx4SHI11tvg2R1KReJU+N2yM7YSMJpgW31nBs e2N2aZoAgTVoycmMgby0J4E5vbVoTkG9INvYWHBZ37u1P7C5gEegGD6hi+RdUxczXsp+ BSnQ== X-Forwarded-Encrypted: i=1; AHgh+RrtFtH/jHR1bdw/3VlPaYNCTKr7s0p8ERiQ8tJHm+smeEfdTIl9ksdTmQpGlebrwSesGDHE1fsx+kOej3s=@vger.kernel.org X-Gm-Message-State: AOJu0Yxf50rcFd4xLHhOYez8CgMpDQhas1QkrH2OfBcbzfAoFV+NAERb ElcAUFfcDcSdDbQNsZ2BWRSS4dyzOswwSe5GDnDrgUxM1I4wJ6/GTznc X-Gm-Gg: AR+sD135jV53qd4y7lXzW5sWiOn9oXMz8F0halJwCq192W6nI2rdaAlf49jF2csrzFd eec1nAv5/BEdWT6ooYZPlr65rqqoFAwOQV8rqMaErlAJLjdAuxOTEvbxgLKMS+uJiweAPNoSwMg j7bN9KH+vFl678Al/67rbplc02Rh9EBqauBRrTRAuhXwt/g0fdg/5SYtcysOWiXNs9/oM0DsnQ7 Liqb26JePNgepMKk01GEJ3/Bm7L2mc92KvA1OURjGa3N/DgW0fI2CRaKe57NRniHvvg7xtWgGOq lfmveCFB1+TdDiVUdt4lm3SY8F2el+0XAUNu78Z/BfO6DYDcIMOSImo+JDlzchmh43XAFCFwbrk s9di4pyWHLwen3YTiAEanZ36QarHd658G+nZSctquC7EgCKGdLDXuziQhYVqlivhxrtJGQjM/HB ljI3wc5bjG57sQb8IiA0LRY4O/gN8aFv6mCas= X-Received: by 2002:a05:6a00:3d4d:b0:847:76d8:8d72 with SMTP id d2e1a72fcca58-84fde20f5c6mr17626567b3a.23.1786874938767; Sun, 16 Aug 2026 03:08:58 -0700 (PDT) Received: from qby-laptop ([2a13:edc0:18:16f::a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8517d01f15dsm1759601b3a.20.2026.08.16.03.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2026 03:08:58 -0700 (PDT) From: Mingyou Chen To: qby140326@gmail.com Cc: W_Armin@gmx.de, foxido@foxido.dev, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, nika@nikableh.moe, platform-driver-x86@vger.kernel.org, vlku.milos.fun@gmail.com, i@rsplwe.com, wolf109909@outlook.com, rahulbheda131313@gmail.com Subject: [PATCH v5 6/6] platform/x86: bitland-mifs-wmi: Add Redmi laptop support Date: Sun, 16 Aug 2026 18:08:13 +0800 Message-ID: <20260816100813.300450-7-qby140326@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816100813.300450-1-qby140326@gmail.com> References: <20260816100813.300450-1-qby140326@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Redmi laptops (Redmi Book and Redmi G series) use the same MIFS WMI interface but encode the performance mode values of WMI_FN_SYSTEM_PER_MODE differently, as reverse engineered from the Windows GCommandCenter application: 0 =3D performance, 1 =3D balanced, 2 =3D quiet, 4 =3D full speed Add "Redmi Book" and "Redmi G" ops entries selected via DMI: - Redmi G (board TM2135/TM2137): the full-speed mode is available - Redmi Book/Xiaomi Book: no full-speed mode - The performance modes only require AC power (any source); the barrel-jack requirement is Bitland-specific The GCommandCenter application further showed that: - the CPU power sensor (WMI_FN_CPU_POWER) is only available on Redmi machines, gate the hwmon power channel on the ops table - the refresh-rate-toggle quirk in the CPU fan speed event is Redmi-specific, gate it on the ops table instead of applying it unconditionally Also add Redmi support for Fn lock and touchpad lock control (WMI_FN_FN_LOCK / WMI_FN_TP_LOCK sysfs attributes), keyboard type detection (hide the RGB kb_mode attribute on white-only backlit keyboards) and hotkeys (airplane mode -> KEY_RFKILL, ignore the lock-state and keyboard mode indicator events). The sysfs attribute group is now registered in probe (instead of via dev_groups) so that the is_visible callback can access the probe populated driver data. Signed-off-by: Mingyou Chen --- drivers/platform/x86/bitland-mifs-wmi.c | 336 ++++++++++++++++++++++-- 1 file changed, 318 insertions(+), 18 deletions(-) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index 17792d8b7c29..1eb9f92740e0 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -71,6 +72,11 @@ enum bitland_system_ac_mode { WMI_SYSTEM_AC_CIRCULARHOLE =3D 2, }; =20 +enum bitland_kbd_type { + WMI_KBD_TYPE_WHITE =3D 0, + WMI_KBD_TYPE_RGB =3D 1, +}; + enum bitland_mifs_power_profile { WMI_PP_BALANCED =3D 0, WMI_PP_PERFORMANCE =3D 1, @@ -97,7 +103,15 @@ static const struct bitland_profile_mode_map bitland_mo= de_map =3D { .full_speed =3D WMI_PP_FULL_SPEED, }; =20 +static const struct bitland_profile_mode_map redmi_mode_map =3D { + .balanced =3D 1, + .performance =3D 0, + .quiet =3D 2, + .full_speed =3D 4, +}; + static int bitland_pp_check_capability(struct bitland_mifs_wmi_data *data); +static int redmi_pp_check_capability(struct bitland_mifs_wmi_data *data); =20 /* * Machine-specific operations. The MIFS WMI interface is shared by @@ -109,6 +123,8 @@ struct bitland_mifs_ops { const struct bitland_profile_mode_map *mode_map; int (*check_performance_capability)(struct bitland_mifs_wmi_data *data); bool has_full_speed; + bool has_cpu_power; + bool quirk_refresh_rate_toggle; }; =20 static const struct bitland_mifs_ops bitland_ops =3D { @@ -118,6 +134,54 @@ static const struct bitland_mifs_ops bitland_ops =3D { .has_full_speed =3D true, }; =20 +static const struct bitland_mifs_ops redmi_book_ops =3D { + .name =3D "Redmi Book", + .mode_map =3D &redmi_mode_map, + .check_performance_capability =3D redmi_pp_check_capability, + .has_cpu_power =3D true, + .quirk_refresh_rate_toggle =3D true, +}; + +static const struct bitland_mifs_ops redmi_g_ops =3D { + .name =3D "Redmi G", + .mode_map =3D &redmi_mode_map, + .check_performance_capability =3D redmi_pp_check_capability, + .has_full_speed =3D true, + .has_cpu_power =3D true, + .quirk_refresh_rate_toggle =3D true, +}; + +static const struct dmi_system_id bitland_mifs_dmi_table[] =3D { + { + /* Redmi G */ + .matches =3D { + DMI_MATCH(DMI_BOARD_NAME, "TM2135"), + }, + .driver_data =3D (void *)&redmi_g_ops, + }, + { + .matches =3D { + DMI_MATCH(DMI_BOARD_NAME, "TM2137"), + }, + .driver_data =3D (void *)&redmi_g_ops, + }, + { + /* Redmi Book series */ + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Redmi"), + }, + .driver_data =3D (void *)&redmi_book_ops, + }, + { + /* Xiaomi Book series */ + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "TIMI"), + }, + .driver_data =3D (void *)&redmi_book_ops, + }, + {} +}; + enum bitland_mifs_event_id { WMI_EVENT_RESERVED_1 =3D 1, WMI_EVENT_RESERVED_2 =3D 2, @@ -203,6 +267,8 @@ struct bitland_mifs_wmi_data { struct input_dev *input_dev; struct device *hwmon_dev; struct device *pp_dev; + enum bitland_wmi_device_type dev_type; + u8 kbd_type; const struct bitland_mifs_ops *ops; enum platform_profile_option saved_profile; }; @@ -255,8 +321,10 @@ static int laptop_profile_get(struct device *dev, else if (mode =3D=3D map->balanced) *profile =3D PLATFORM_PROFILE_BALANCED; else if (mode =3D=3D map->performance) - *profile =3D PLATFORM_PROFILE_BALANCED_PERFORMANCE; - else if (mode =3D=3D map->full_speed) + *profile =3D data->ops->has_full_speed ? + PLATFORM_PROFILE_BALANCED_PERFORMANCE : + PLATFORM_PROFILE_PERFORMANCE; + else if (data->ops->has_full_speed && mode =3D=3D map->full_speed) *profile =3D PLATFORM_PROFILE_PERFORMANCE; else return -EINVAL; @@ -273,10 +341,11 @@ static int bitland_pp_check_capability(struct bitland= _mifs_wmi_data *data) struct bitland_mifs_output output; int ret; =20 - /* Full-speed/performance mode requires DC power (not USB-C) */ + /* The performance modes require AC power */ if (!power_supply_is_system_supplied()) return -EOPNOTSUPP; =20 + /* Additionally require the barrel-jack power supply (not USB-C) */ ret =3D bitland_mifs_wmi_call(data, &input, &output); if (ret) return ret; @@ -287,6 +356,15 @@ static int bitland_pp_check_capability(struct bitland_= mifs_wmi_data *data) return 0; } =20 +static int redmi_pp_check_capability(struct bitland_mifs_wmi_data *data) +{ + /* The performance modes require AC power (any source) */ + if (!power_supply_is_system_supplied()) + return -EOPNOTSUPP; + + return 0; +} + static int laptop_profile_set(struct device *dev, enum platform_profile_option profile) { @@ -309,6 +387,8 @@ static int laptop_profile_set(struct device *dev, mode =3D map->balanced; break; case PLATFORM_PROFILE_BALANCED_PERFORMANCE: + if (!data->ops->has_full_speed) + return -EOPNOTSUPP; ret =3D data->ops->check_performance_capability(data); if (ret) return ret; @@ -318,7 +398,7 @@ static int laptop_profile_set(struct device *dev, ret =3D data->ops->check_performance_capability(data); if (ret) return ret; - mode =3D map->full_speed; + mode =3D data->ops->has_full_speed ? map->full_speed : map->performance; break; default: return -EOPNOTSUPP; @@ -335,10 +415,10 @@ static int platform_profile_probe(void *drvdata, unsi= gned long *choices) =20 set_bit(PLATFORM_PROFILE_LOW_POWER, choices); set_bit(PLATFORM_PROFILE_BALANCED, choices); - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); =20 if (data->ops->has_full_speed) - set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices); =20 return 0; } @@ -418,6 +498,13 @@ static int laptop_hwmon_read(struct device *dev, enum = hwmon_sensor_types type, default: return -EINVAL; } + case hwmon_power: + /* WMI_FN_CPU_POWER returns the CPU power draw in watts */ + input.function =3D WMI_FN_CPU_POWER; + ret =3D bitland_mifs_wmi_call(data, &input, &res); + if (!ret) + *val =3D res.data[0] * MICROWATT_PER_WATT; + return ret; default: return -EINVAL; } @@ -444,6 +531,15 @@ static const struct hwmon_channel_info *laptop_hwmon_i= nfo[] =3D { NULL }; =20 +static const struct hwmon_channel_info *laptop_hwmon_info_power[] =3D { + HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT), + HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_LABEL, + HWMON_F_INPUT | HWMON_F_LABEL, + HWMON_F_INPUT | HWMON_F_LABEL), + HWMON_CHANNEL_INFO(power, HWMON_P_INPUT), + NULL +}; + static const struct hwmon_ops laptop_hwmon_ops =3D { .visible =3D 0444, .read =3D laptop_hwmon_read, @@ -455,6 +551,11 @@ static const struct hwmon_chip_info laptop_chip_info = =3D { .info =3D laptop_hwmon_info, }; =20 +static const struct hwmon_chip_info laptop_chip_info_power =3D { + .ops =3D &laptop_hwmon_ops, + .info =3D laptop_hwmon_info_power, +}; + static int laptop_kbd_led_set(struct led_classdev *led_cdev, enum led_brightness value) { @@ -498,6 +599,96 @@ static const char *const gpu_mode_strings[] =3D { "uma", }; =20 +static ssize_t fn_lock_show(struct device *dev, struct device_attribute *a= ttr, + char *buf) +{ + struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); + struct bitland_mifs_input input =3D { + .reserved1 =3D 0, + .operation =3D WMI_METHOD_GET, + .reserved2 =3D 0, + .function =3D WMI_FN_FN_LOCK, + }; + struct bitland_mifs_output res; + int ret; + + ret =3D bitland_mifs_wmi_call(data, &input, &res); + if (ret) + return ret; + + return sysfs_emit(buf, "%u\n", res.data[0]); +} + +static ssize_t fn_lock_store(struct device *dev, struct device_attribute *= attr, + const char *buf, size_t count) +{ + struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); + struct bitland_mifs_input input =3D { + .reserved1 =3D 0, + .operation =3D WMI_METHOD_SET, + .reserved2 =3D 0, + .function =3D WMI_FN_FN_LOCK, + }; + bool val; + int ret; + + if (kstrtobool(buf, &val)) + return -EINVAL; + + input.payload[0] =3D val; + + ret =3D bitland_mifs_wmi_call(data, &input, NULL); + if (ret) + return ret; + + return count; +} + +static ssize_t touchpad_lock_show(struct device *dev, struct device_attrib= ute *attr, + char *buf) +{ + struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); + struct bitland_mifs_input input =3D { + .reserved1 =3D 0, + .operation =3D WMI_METHOD_GET, + .reserved2 =3D 0, + .function =3D WMI_FN_TP_LOCK, + }; + struct bitland_mifs_output res; + int ret; + + ret =3D bitland_mifs_wmi_call(data, &input, &res); + if (ret) + return ret; + + return sysfs_emit(buf, "%u\n", res.data[0]); +} + +static ssize_t touchpad_lock_store(struct device *dev, struct device_attri= bute *attr, + const char *buf, size_t count) +{ + struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); + struct bitland_mifs_input input =3D { + .reserved1 =3D 0, + .operation =3D WMI_METHOD_SET, + .reserved2 =3D 0, + .function =3D WMI_FN_TP_LOCK, + }; + bool val; + int ret; + + if (kstrtobool(buf, &val)) + return -EINVAL; + + input.payload[0] =3D val; + + ret =3D bitland_mifs_wmi_call(data, &input, NULL); + if (ret) + return ret; + + return count; +} + /* GPU Mode: 0:Hybrid, 1:Discrete, 2:UMA */ static ssize_t gpu_mode_show(struct device *dev, struct device_attribute *= attr, char *buf) @@ -637,17 +828,46 @@ static ssize_t fan_boost_store(struct device *dev, return count; } =20 -static const DEVICE_ATTR_RW(gpu_mode); -static const DEVICE_ATTR_RW(kb_mode); -static const DEVICE_ATTR_WO(fan_boost); +static DEVICE_ATTR_RW(gpu_mode); +static DEVICE_ATTR_RW(kb_mode); +static DEVICE_ATTR_WO(fan_boost); +static DEVICE_ATTR_RW(fn_lock); +static DEVICE_ATTR_RW(touchpad_lock); =20 -static const struct attribute *const laptop_attrs[] =3D { +static struct attribute *laptop_attrs[] =3D { &dev_attr_gpu_mode.attr, &dev_attr_kb_mode.attr, &dev_attr_fan_boost.attr, + &dev_attr_fn_lock.attr, + &dev_attr_touchpad_lock.attr, NULL, }; -ATTRIBUTE_GROUPS(laptop); + +static umode_t laptop_attr_is_visible(struct kobject *kobj, + struct attribute *attr, int idx) +{ + struct device *dev =3D kobj_to_dev(kobj); + struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); + + /* The sysfs attributes are only supported on the control device */ + if (data->dev_type !=3D BITLAND_WMI_CONTROL) + return 0; + + /* + * White-only backlit keyboards (e.g. Redmi Book series) do not + * support the RGB backlight modes. + */ + if (attr =3D=3D &dev_attr_kb_mode.attr && + data->kbd_type =3D=3D WMI_KBD_TYPE_WHITE) + return 0; + + return attr->mode; +} + +static const struct attribute_group laptop_group =3D { + .attrs =3D laptop_attrs, + .is_visible =3D laptop_attr_is_visible, +}; =20 static const struct key_entry bitland_mifs_wmi_keymap[] =3D { { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_OPEN_APP, 1, 0), { KEY_PROG1 } }, @@ -699,6 +919,34 @@ static const struct key_entry bitland_mifs_wmi_keymap[= ] =3D { { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FNLOCK_STATE, 0, 0), {} }, { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FNLOCK_STATE, 1, 0), {} }, =20 + /* Airplane mode toggle (Redmi) */ + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_AIRPLANE_MODE, 0, 0), { KEY_RFKILL } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_AIRPLANE_MODE, 1, 0), { KEY_RFKILL } }, + + /* + * Touchpad state change (Redmi Fn+F7). The EC performs the actual + * toggle itself; userspace can control the state via the + * touchpad_lock sysfs attribute. + */ + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_TOUCHPAD_STATE, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_TOUCHPAD_STATE, 1, 0), {} }, + + /* Keyboard backlight mode change */ + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_MODE, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_MODE, 1, 0), {} }, + + /* Lock-state indicator events */ + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_CAPSLOCK_STATE, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_CAPSLOCK_STATE, 1, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_NUMLOCK_STATE, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_NUMLOCK_STATE, 1, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_SCROLLLOCK_STATE, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_SCROLLLOCK_STATE, 1, 0), {} }, + + /* Win key lock (Redmi gaming mode) */ + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_WIN_KEY_LOCK, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_WIN_KEY_LOCK, 1, 0), {} }, + /* Fn+`/1/2/3/4 */ { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_F, 1, 0), { KEY_F13 } }, { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_0, 1, 0), { KEY_F14 } }, @@ -744,6 +992,36 @@ static int bitland_notifier_callback(struct notifier_b= lock *nb, return NOTIFY_OK; } =20 +static int bitland_detect_kbd_type(struct bitland_mifs_wmi_data *data) +{ + struct bitland_mifs_input input =3D { + .reserved1 =3D 0, + .operation =3D WMI_METHOD_GET, + .reserved2 =3D 0, + .function =3D WMI_FN_KBD_TYPE, + }; + struct bitland_mifs_output res; + int ret; + + ret =3D bitland_mifs_wmi_call(data, &input, &res); + if (ret) + return ret; + + data->kbd_type =3D res.data[0]; + return 0; +} + +static void bitland_detect_ops(struct bitland_mifs_wmi_data *data) +{ + const struct dmi_system_id *id; + + id =3D dmi_first_match(bitland_mifs_dmi_table); + if (id) + data->ops =3D id->driver_data; + + dev_dbg(&data->wdev->dev, "Detected machine ops: %s\n", data->ops->name); +} + static int bitland_mifs_wmi_probe(struct wmi_device *wdev, const void *con= text) { struct bitland_mifs_wmi_data *drv_data; @@ -761,6 +1039,9 @@ static int bitland_mifs_wmi_probe(struct wmi_device *w= dev, const void *context) return -ENOMEM; =20 drv_data->wdev =3D wdev; + drv_data->dev_type =3D dev_type; + /* Default to RGB so the RGB attributes stay visible if detection fails */ + drv_data->kbd_type =3D WMI_KBD_TYPE_RGB; drv_data->ops =3D &bitland_ops; =20 ret =3D devm_mutex_init(&wdev->dev, &drv_data->lock); @@ -769,6 +1050,8 @@ static int bitland_mifs_wmi_probe(struct wmi_device *w= dev, const void *context) =20 dev_set_drvdata(&wdev->dev, drv_data); =20 + bitland_detect_ops(drv_data); + if (dev_type =3D=3D BITLAND_WMI_EVENT) { /* Register input device for hotkeys */ drv_data->input_dev =3D devm_input_allocate_device(&wdev->dev); @@ -794,12 +1077,28 @@ static int bitland_mifs_wmi_probe(struct wmi_device = *wdev, const void *context) if (IS_ERR(drv_data->pp_dev)) return PTR_ERR(drv_data->pp_dev); =20 + /* Detect the keyboard type */ + ret =3D bitland_detect_kbd_type(drv_data); + if (ret) + dev_dbg(&wdev->dev, "Failed to detect keyboard type, assuming RGB: %d\n"= , ret); + + ret =3D devm_device_add_group(&wdev->dev, &laptop_group); + if (ret) + return ret; + /* Register hwmon */ - drv_data->hwmon_dev =3D devm_hwmon_device_register_with_info(&wdev->dev, - "bitland_mifs", - drv_data, - &laptop_chip_info, - NULL); + if (drv_data->ops->has_cpu_power) + drv_data->hwmon_dev =3D devm_hwmon_device_register_with_info(&wdev->dev, + "bitland_mifs", + drv_data, + &laptop_chip_info_power, + NULL); + else + drv_data->hwmon_dev =3D devm_hwmon_device_register_with_info(&wdev->dev, + "bitland_mifs", + drv_data, + &laptop_chip_info, + NULL); if (IS_ERR(drv_data->hwmon_dev)) return PTR_ERR(drv_data->hwmon_dev); =20 @@ -851,6 +1150,7 @@ static void bitland_mifs_wmi_report_key(struct wmi_dev= ice *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; u32 payload; @@ -885,7 +1185,8 @@ static void bitland_mifs_wmi_notify(struct wmi_device = *wdev, case WMI_EVENT_CPU_FAN_SPEED: case WMI_EVENT_GPU_FAN_SPEED: /* Redmi refresh rate toggle quirk */ - if (event->event_id =3D=3D WMI_EVENT_CPU_FAN_SPEED && + if (data->ops->quirk_refresh_rate_toggle && + event->event_id =3D=3D WMI_EVENT_CPU_FAN_SPEED && event->value_low =3D=3D 0 && event->value_high =3D=3D 0) { payload =3D BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0); bitland_mifs_wmi_report_key(wdev, payload); @@ -923,7 +1224,6 @@ static struct wmi_driver bitland_mifs_wmi_driver =3D { .no_singleton =3D true, .driver =3D { .name =3D DRV_NAME, - .dev_groups =3D laptop_groups, .pm =3D pm_sleep_ptr(&bitland_mifs_wmi_pm_ops), }, .id_table =3D bitland_mifs_wmi_id_table, --=20 2.55.0 From nobody Mon Sep 28 22:28:42 2026 Received: from mail.kekto.ru (mail.kekto.ru [188.242.149.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA69B223DFF; Wed, 26 Aug 2026 13:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.242.149.39 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787750969; cv=none; b=FMHMbE5VZCxmICaLPq1Y0M9zvfbmywYg2/pfoJ2fSkAdIGj0FAagDrHuOzjIa+q1VcVP2KjUEIqlCcVOKKaxTJ4j7e07w9NiuMtO2XM1DwnZ+5HXAaPYbgOHMLM8Xox3iHOTUn9dmrhOSoUIFwEEKW9WR1Okw9RaqW4JgJOg7uA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787750969; c=relaxed/simple; bh=w57QnjDHpzExAFmVk48MeLjOazGYLxPrDSZVlF5qCUA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZMSc45WNEioe33EfShWaYl8zIsnq0uDNqoC9lsKXil12Nok04bF26B6teFeCjsCg9NbC77J/WTEOyU+xEAIG962RxQtsLE1ASEpIv34lNnSK0TN6MtPqRMvhQfao0wzva9uftowgxSgAkkD68+LLPKJALa6RYD3jFM2Cv8ah+f0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kekto.ru; spf=pass smtp.mailfrom=kekto.ru; dkim=pass (2048-bit key) header.d=kekto.ru header.i=@kekto.ru header.b=VgQhCLpy; arc=none smtp.client-ip=188.242.149.39 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kekto.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kekto.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kekto.ru header.i=@kekto.ru header.b="VgQhCLpy" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8AFF0254BC; Wed, 26 Aug 2026 16:29:24 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kekto.ru; s=dkim; t=1787750964; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=wRphR+98q9mATkUDyP5hjp+KBrOVIz8eprnDaAFhOo8=; b=VgQhCLpy6jNPGRj0mP9/JjSrNxhHY/yapvSbuegbfXXIx5/6R5CXVisLqZrgY8OHPDHr6H 35+jAZjns20yAEc4y3rBmIiL7VPg23LkFyNBIdxyxUDez2aCtOuPQnl28IjJ+ohuqneLxf AGb8gEf1hSqXEezXGZxGTQTUzVS26QwHAKcdLajgMHjjZmlGhIzjYehkGHBFkQyK0KaIwZ CR3mRP7haIb3hMdxw0CutbZ4vzzq8YVj7wMU9HW+4u9I7CXtQHrHwMK/UmSWdfXepX+N6m J58rhYvX6iNO/XS2341hy+UQBX+V01RAFKs94HL/IkczAubQvhEIlx3rN5lMKg== From: KentoNion To: platform-driver-x86@vger.kernel.org, Mingyou Chen Cc: Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Armin Wolf , Gladyshev Ilya , linux-kernel@vger.kernel.org, Nabil Danial , Nika Krasnova , linux-doc@vger.kernel.org, Jonathan Corbet , Shuah Khan Subject: [PATCH] platform/x86: bitland-mifs-wmi: add TM2424 ops and hotkeys Date: Wed, 26 Aug 2026 16:29:24 +0300 Message-ID: <20260826132924.179614-1-kento@kekto.ru> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816100813.300450-1-qby140326@gmail.com> References: <20260816100813.300450-1-qby140326@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Xiaomi Book Pro 14 2026 (DMI sys_vendor=3DXIAOMI, board_name=3DTM2424) uses five cmd 0x08 bytes that do not fit the four-field mode_map: Quiet=3D0x02, Turbo=3D0x03, Full-speed=3D0x04, Auto=3D0x09, Eco=3D0x0A Add a TM2424 entry to the per-machine ops table. SET maps the three platform_profile choices to Eco / Auto / Full-speed; GET aliases Quiet and Turbo. Full-speed falls back to Turbo when firmware NACKs. The reduced firmware does not implement hwmon, keyboard LED or the gpu_mode/kb_mode/fan_boost attributes. Map remaining TM2424 HID_EVENT20 keys (projection value 0, AI break 0x24, Mi button 0x25/0x26). Mic-mute 0x21 and settings 0x1B are already in the merged keymap. This supersedes the standalone TM2424 quirk <20260816215825.289356-1-kento@kekto.ru>. Tested on TM2424-77080: performance on AC holds ~50W package power. acpi_listen shows HID_EVENT20 as wmi PNP0C14:00 notify 0x20 for the mic, AI, projection, settings and Mi keys (see cover letter). Signed-off-by: KentoNion --- This is a follow-up to Mingyou's v5, not a competing rewrite. v5's four-field mode_map cannot express TM2424: five firmware bytes (Quiet/Turbo/Full-speed/Auto/Eco) collapse to three platform_profile choices, GET has aliases, and SET of performance must try Full-speed then Turbo when firmware NACKs. The new ops callbacks stay NULL on the Bitland/Redmi paths. DMI is XIAOMI + TM2424. Mingyou's Xiaomi Book match is TIMI, so this SKU would otherwise keep the Bitland 0..3 defaults and stay broken. Yuming's 2/5 names on this machine are inverted (0x03 is Turbo, 0x09 is Auto, 0x0A is Eco). Please do not take that SET mapping for TM2424. I did not include lid polling or EC fan tachs. On this BIOS the ACPI EC still starts and Lid Switch already binds; ECON is an unresolved External used only by _STA (not defined in DSDT or any SSDT). That is an ACPI firmware bug, not a WMI one. Decoded excerpts and dmesg are a reply on Yuming's 0/5, In-Reply-To Armin. I also left the v5 suspend hook alone. Ilpo already nacked the profile_valid pattern on Yuming 1/5. With this mapping GET no longer returns unmapped cmd 0x08 bytes on TM2424, so the existing hook should not abort sleep here. A global never-abort plus a status-word check still belongs in a separate patch; please take Ilpo's union + endianness nits there. This patch only looks at output.operation =3D=3D 0x80 on TM2424 SET (the accepted byte; same field Yuming packs as 0x8000) so Full-speed can fall back to Turbo. One regression to watch when v5 is rebased: e0d6312578e1 turned some redmi-wmi KE_IGNORE entries into KEY_KBDILLUMTOGGLE / KEY_PERFORMANCE / KEY_FN_ESC. v5 2/6 still KE_IGNOREs those; please carry Musaev's mappings into the merged keymap in v6. The LKP const-qualifier error on the old standalone quirk is obsolete once v5's non-const DEVICE_ATTR is the base. Tested on Xiaomi Book Pro 14 2026, SKU TM2424-77080, BIOS XMAPT4B0P0707. acpi_listen on that machine (HID_EVENT20 is notify 0x20 on PNP0C14:00). Volume and panel brightness are standard ACPI and do not go through this driver. The WMI-backed keys with this keymap: FN+F4 mic: wmi PNP0C14:00 00000020 00000000 button/micmute MICMUTE 00000080 00000000 K FN+F7 AI (make KEY_PROG1; break is KE_IGNORE): wmi PNP0C14:00 00000020 00000000 button/prog1 PROG1 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 FN+F8 projection: wmi PNP0C14:00 00000020 00000000 video/switchmode VMOD 00000080 00000000 K FN+F9 settings (KEY_CONFIG, evdev only): wmi PNP0C14:00 00000020 00000000 Mi button (make KEY_VENDOR; break is KE_IGNORE): wmi PNP0C14:00 00000020 00000000 button/vendor VNDR 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 Raw session (including power/mute/volume/brightness): button/power PBTN 00000080 00000000 button/power LNXPWRBN:00 00000080 00000001 button/mute MUTE 00000080 00000000 K button/volumeup VOLUP 00000080 00000000 K button/volumeup VOLUP 00000080 00000000 K button/volumedown VOLDN 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 button/micmute MICMUTE 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 button/micmute MICMUTE 00000080 00000000 K video/brightnessdown BRTDN 00000087 00000000 video/brightnessup BRTUP 00000086 00000000 wmi PNP0C14:00 00000020 00000000 button/prog1 PROG1 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 wmi PNP0C14:00 00000020 00000000 video/switchmode VMOD 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 wmi PNP0C14:00 00000020 00000000 wmi PNP0C14:00 00000020 00000000 wmi PNP0C14:00 00000020 00000000 button/vendor VNDR 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 diff --git a/Documentation/wmi/devices/bitland-mifs-wmi.rst b/Documentation= /wmi/devices/bitland-mifs-wmi.rst index 9e86ecc..a89f872 100644 --- a/Documentation/wmi/devices/bitland-mifs-wmi.rst +++ b/Documentation/wmi/devices/bitland-mifs-wmi.rst @@ -93,8 +93,13 @@ The following Command IDs are used in the third byte of = the buffer: +----------+-----------------------+--------------------------------------= ----+ | ID | Name | Values / Description = | +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D+ -| 8 | SystemPerMode | 0: Balance, 1: Performance, 2: Quiet,= | -| | | 3: Full-speed = | +| 8 | SystemPerMode | Bitland gaming: 0 Balance, 1 = | +| | | Performance, 2 Quiet, 3 Full-speed. = | +| | | Redmi: 0 Performance, 1 Balanced, 2 = | +| | | Quiet, 4 Full-speed. = | +| | | TM2424 (Xiaomi Book Pro 14): 0x02 = | +| | | Quiet, 0x03 Turbo, 0x04 Full-speed, = | +| | | 0x09 Auto, 0x0A Eco. = | +----------+-----------------------+--------------------------------------= ----+ | 9 | GPUMode | 0: Hybrid, 1: Discrete, 2: UMA = | +----------+-----------------------+--------------------------------------= ----+ @@ -188,11 +193,8 @@ Performance Modes ----------------- Changing the performance mode via Command ID 0x08 (SystemPerMode) affects = the power limits (PL1/PL2) and fan curves managed by the Embedded Controller (= EC). -Note that the "Full-speed" and "Performance" mode (1, 3) is typically only -available when the system is connected to a DC power source (not USB-C/PD). - -In the driver implementation, switch to performance/full-speed mode without -DC power connected will throw the EOPNOTSUPP error. +The value encoding and the AC-power requirement are machine-specific (see +Command ID 8 and the driver ops table). =20 Graphics Switching ------------------ diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index 6031b1c..b49a6fb 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -44,6 +44,9 @@ #define BITLAND_MIFS_GUID "B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B" #define BITLAND_EVENT_GUID "46C93E13-EE9B-4262-8488-563BCA757FEF" =20 +/* Firmware status in output.operation (wire OutData[1]): request accepted= . */ +#define MIFS_STATUS_OK 0x80 + enum bitland_mifs_operation { WMI_METHOD_GET =3D 250, WMI_METHOD_SET =3D 251, @@ -110,8 +113,21 @@ static const struct bitland_profile_mode_map redmi_mod= e_map =3D { .full_speed =3D 4, }; =20 +/* TM2424 SystemPerMode bytes (Eco/Auto/Full-speed; Quiet/Turbo are GET al= iases). */ +enum bitland_mifs_tm2424_perf_mode { + WMI_TM2424_QUIET =3D 0x02, + WMI_TM2424_TURBO =3D 0x03, + WMI_TM2424_FULL_SPEED =3D 0x04, + WMI_TM2424_AUTO =3D 0x09, + WMI_TM2424_ECO =3D 0x0A, +}; + static int bitland_pp_check_capability(struct bitland_mifs_wmi_data *data); static int redmi_pp_check_capability(struct bitland_mifs_wmi_data *data); +static int tm2424_profile_get(struct bitland_mifs_wmi_data *data, + enum platform_profile_option *profile); +static int tm2424_profile_set(struct bitland_mifs_wmi_data *data, + enum platform_profile_option profile); =20 /* * Machine-specific operations. The MIFS WMI interface is shared by @@ -122,9 +138,15 @@ struct bitland_mifs_ops { const char *name; const struct bitland_profile_mode_map *mode_map; int (*check_performance_capability)(struct bitland_mifs_wmi_data *data); + int (*profile_get)(struct bitland_mifs_wmi_data *data, + enum platform_profile_option *profile); + int (*profile_set)(struct bitland_mifs_wmi_data *data, + enum platform_profile_option profile); bool has_full_speed; bool has_cpu_power; bool quirk_refresh_rate_toggle; + /* hwmon, keyboard LED and gpu/kb/fan sysfs are unimplemented */ + bool reduced_fw; }; =20 static const struct bitland_mifs_ops bitland_ops =3D { @@ -151,7 +173,22 @@ static const struct bitland_mifs_ops redmi_g_ops =3D { .quirk_refresh_rate_toggle =3D true, }; =20 +static const struct bitland_mifs_ops tm2424_ops =3D { + .name =3D "Xiaomi Book Pro 14", + .profile_get =3D tm2424_profile_get, + .profile_set =3D tm2424_profile_set, + .reduced_fw =3D true, +}; + static const struct dmi_system_id bitland_mifs_dmi_table[] =3D { + { + /* Xiaomi Book Pro 14. Vendor is XIAOMI, not TIMI. */ + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "XIAOMI"), + DMI_MATCH(DMI_BOARD_NAME, "TM2424"), + }, + .driver_data =3D (void *)&tm2424_ops, + }, { /* Redmi G */ .matches =3D { @@ -296,11 +333,89 @@ static int bitland_mifs_wmi_call(struct bitland_mifs_= wmi_data *data, return 0; } =20 +static int tm2424_wmi_perf_set(struct bitland_mifs_wmi_data *data, u8 val) +{ + struct bitland_mifs_input input =3D { + .operation =3D WMI_METHOD_SET, + .function =3D WMI_FN_SYSTEM_PER_MODE, + }; + struct bitland_mifs_output output; + int ret; + + input.payload[0] =3D val; + + ret =3D bitland_mifs_wmi_call(data, &input, &output); + if (ret) + return ret; + + if (output.operation !=3D MIFS_STATUS_OK) { + dev_dbg(&data->wdev->dev, + "perf mode %#x rejected by firmware (status=3D%#x)\n", + val, output.operation); + return -EOPNOTSUPP; + } + + return 0; +} + +static int tm2424_profile_get(struct bitland_mifs_wmi_data *data, + enum platform_profile_option *profile) +{ + struct bitland_mifs_input input =3D { + .operation =3D WMI_METHOD_GET, + .function =3D WMI_FN_SYSTEM_PER_MODE, + }; + struct bitland_mifs_output output; + int ret; + + ret =3D bitland_mifs_wmi_call(data, &input, &output); + if (ret) + return ret; + + switch (output.data[0]) { + case WMI_TM2424_ECO: + case WMI_TM2424_QUIET: + *profile =3D PLATFORM_PROFILE_LOW_POWER; + break; + case WMI_TM2424_AUTO: + *profile =3D PLATFORM_PROFILE_BALANCED; + break; + case WMI_TM2424_FULL_SPEED: + case WMI_TM2424_TURBO: + *profile =3D PLATFORM_PROFILE_PERFORMANCE; + break; + default: + dev_dbg(&data->wdev->dev, + "unrecognized TM2424 perf mode %#x\n", output.data[0]); + return -EINVAL; + } + + return 0; +} + +static int tm2424_profile_set(struct bitland_mifs_wmi_data *data, + enum platform_profile_option profile) +{ + switch (profile) { + case PLATFORM_PROFILE_LOW_POWER: + return tm2424_wmi_perf_set(data, WMI_TM2424_ECO); + case PLATFORM_PROFILE_BALANCED: + return tm2424_wmi_perf_set(data, WMI_TM2424_AUTO); + case PLATFORM_PROFILE_PERFORMANCE: + /* Full-speed is rejected on battery; fall back to Turbo. */ + if (tm2424_wmi_perf_set(data, WMI_TM2424_FULL_SPEED) =3D=3D 0) + return 0; + return tm2424_wmi_perf_set(data, WMI_TM2424_TURBO); + default: + return -EOPNOTSUPP; + } +} + static int laptop_profile_get(struct device *dev, enum platform_profile_option *profile) { struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); - const struct bitland_profile_mode_map *map =3D data->ops->mode_map; + const struct bitland_profile_mode_map *map; struct bitland_mifs_input input =3D { .reserved1 =3D 0, .operation =3D WMI_METHOD_GET, @@ -311,6 +426,10 @@ static int laptop_profile_get(struct device *dev, u8 mode; int ret; =20 + if (data->ops->profile_get) + return data->ops->profile_get(data, profile); + + map =3D data->ops->mode_map; ret =3D bitland_mifs_wmi_call(data, &input, &result); if (ret) return ret; @@ -369,7 +488,7 @@ static int laptop_profile_set(struct device *dev, enum platform_profile_option profile) { struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); - const struct bitland_profile_mode_map *map =3D data->ops->mode_map; + const struct bitland_profile_mode_map *map; struct bitland_mifs_input input =3D { .reserved1 =3D 0, .operation =3D WMI_METHOD_SET, @@ -379,6 +498,11 @@ static int laptop_profile_set(struct device *dev, int ret; u8 mode; =20 + if (data->ops->profile_set) + return data->ops->profile_set(data, profile); + + map =3D data->ops->mode_map; + switch (profile) { case PLATFORM_PROFILE_LOW_POWER: mode =3D map->quiet; @@ -897,6 +1021,7 @@ static const struct key_entry bitland_mifs_wmi_keymap[= ] =3D { { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_3, 0, 0), { KEY_ALL_APPLICATI= ONS } }, { KE_KEY, BI_HOTKEY_CODE(0x1b, 0, 0), { KEY_CONFIG } }, { KE_KEY, BI_HOTKEY_CODE(0x1b, 1, 0), { KEY_CONFIG } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_1, 0, 0), { KEY_SWITCHVIDEOMO= DE } }, { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_1, 1, 0), { KEY_SWITCHVIDEOMO= DE } }, { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0), { KEY_REFRESH_RAT= E_TOGGLE } }, =20 @@ -908,6 +1033,12 @@ static const struct key_entry bitland_mifs_wmi_keymap= [] =3D { { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 1, 0), { KEY_ASSISTANT } }, =20 { KE_KEY, BI_HOTKEY_CODE(0x19, 1, 0), { KEY_ASSISTANT } }, + /* TM2424 AI break event (make is 0x23 / WMI_EVENT_OPEN_APP) */ + { KE_IGNORE, BI_HOTKEY_CODE(0x24, 1, 0), {} }, + + /* TM2424 Mi button: make/break pair */ + { KE_KEY, BI_HOTKEY_CODE(0x25, 1, 0), { KEY_VENDOR } }, + { KE_IGNORE, BI_HOTKEY_CODE(0x26, 1, 0), {} }, =20 { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0), {} }, { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0x80), {} }, @@ -1085,6 +1216,9 @@ static int bitland_mifs_wmi_probe(struct wmi_device *= wdev, const void *context) if (IS_ERR(drv_data->pp_dev)) return PTR_ERR(drv_data->pp_dev); =20 + if (drv_data->ops->reduced_fw) + return 0; + /* Detect the keyboard type */ ret =3D bitland_detect_kbd_type(drv_data); if (ret) @@ -1243,5 +1377,6 @@ static struct wmi_driver bitland_mifs_wmi_driver =3D { module_wmi_driver(bitland_mifs_wmi_driver); =20 MODULE_AUTHOR("Mingyou Chen "); +MODULE_AUTHOR("KentoNion "); MODULE_DESCRIPTION("Bitland MIFS (MiInterface) WMI driver"); MODULE_LICENSE("GPL"); --=20 2.55.0 From nobody Mon Sep 28 22:28:42 2026 Received: from mail.kekto.ru (mail.kekto.ru [188.242.149.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 258EF426687; Wed, 26 Aug 2026 13:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.242.149.39 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787751258; cv=none; b=E6WUBu5Ipu9KblSlafAuIBSeC+2l5IKZKo7Hz+SWSLdla/+EGfeAwLhNv6z9el0AG/kCC+1bnNURv20XIKc5pwkrLLURTxTwqF8GRFgCspalHH5hEttdP2e/ISvaquynNZ9/gB2fXOV4HzUui/UMHZ5x5NTxBWli0FMbI4PR1cc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787751258; c=relaxed/simple; bh=w57QnjDHpzExAFmVk48MeLjOazGYLxPrDSZVlF5qCUA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pNYwhxe1BBeWc8myX1Cg9YD5M+qAGvvIrXWR6LHg0SsMLUDlgQ+wDRjI6T43eqcRabd2iyNGNOINOn2aA9kKj/MCz6CEG4k6I8IoSotV0QxXOSwEsMbXh1nlqKOzZk0KhXFgCQwkSK1xXPm9ubeGsMzJTHaEL+K3FrfzUoDrKkA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kekto.ru; spf=pass smtp.mailfrom=kekto.ru; dkim=pass (2048-bit key) header.d=kekto.ru header.i=@kekto.ru header.b=Zu2a/rBK; arc=none smtp.client-ip=188.242.149.39 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kekto.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kekto.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kekto.ru header.i=@kekto.ru header.b="Zu2a/rBK" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 93D27254A2; Wed, 26 Aug 2026 16:26:38 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kekto.ru; s=dkim; t=1787750798; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=wRphR+98q9mATkUDyP5hjp+KBrOVIz8eprnDaAFhOo8=; b=Zu2a/rBKfIo2F/Ui4Louu0mzDv2qZFXjQGp0rc2VbrjLNlrcO3E56JxS+MIunF0g/1KqwP 3wmYlmOi3wRHAteHzhJFGgD/Rc3HIx9rpJrIxOt+3dLp1h5RYyamwflDa+Ebn4fT/ndcyA g15tYZz7rjL36DDc5iNETHn2XWcJcpbfcYqUIzpP7NMkhDn6vGhuJU+nzGpx5VdnY5D7Gd AyZpAtzCZfqAzckG40gKXF2LL5bhQ7n5CmuoPTs+NOR8dJuP2a3YiUygXpN4o/5yonoVyC WyQLIA6Kx6lJXyVeEjNLrkXewuOuLp7E66ApEjjW8SR95ED5D1M8VG2vpuyr/w== From: KentoNion To: platform-driver-x86@vger.kernel.org, Mingyou Chen Cc: Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Armin Wolf , Gladyshev Ilya , linux-kernel@vger.kernel.org, Yuming Sun , Nabil Danial , Nika Krasnova , linux-doc@vger.kernel.org, Jonathan Corbet , Shuah Khan Subject: [PATCH] platform/x86: bitland-mifs-wmi: add TM2424 ops and hotkeys Date: Wed, 26 Aug 2026 16:26:39 +0300 Message-ID: <20260826132639.177830-1-kento@kekto.ru> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816100813.300450-1-qby140326@gmail.com> References: <20260816100813.300450-1-qby140326@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Xiaomi Book Pro 14 2026 (DMI sys_vendor=3DXIAOMI, board_name=3DTM2424) uses five cmd 0x08 bytes that do not fit the four-field mode_map: Quiet=3D0x02, Turbo=3D0x03, Full-speed=3D0x04, Auto=3D0x09, Eco=3D0x0A Add a TM2424 entry to the per-machine ops table. SET maps the three platform_profile choices to Eco / Auto / Full-speed; GET aliases Quiet and Turbo. Full-speed falls back to Turbo when firmware NACKs. The reduced firmware does not implement hwmon, keyboard LED or the gpu_mode/kb_mode/fan_boost attributes. Map remaining TM2424 HID_EVENT20 keys (projection value 0, AI break 0x24, Mi button 0x25/0x26). Mic-mute 0x21 and settings 0x1B are already in the merged keymap. This supersedes the standalone TM2424 quirk <20260816215825.289356-1-kento@kekto.ru>. Tested on TM2424-77080: performance on AC holds ~50W package power. acpi_listen shows HID_EVENT20 as wmi PNP0C14:00 notify 0x20 for the mic, AI, projection, settings and Mi keys (see cover letter). Signed-off-by: KentoNion --- This is a follow-up to Mingyou's v5, not a competing rewrite. v5's four-field mode_map cannot express TM2424: five firmware bytes (Quiet/Turbo/Full-speed/Auto/Eco) collapse to three platform_profile choices, GET has aliases, and SET of performance must try Full-speed then Turbo when firmware NACKs. The new ops callbacks stay NULL on the Bitland/Redmi paths. DMI is XIAOMI + TM2424. Mingyou's Xiaomi Book match is TIMI, so this SKU would otherwise keep the Bitland 0..3 defaults and stay broken. Yuming's 2/5 names on this machine are inverted (0x03 is Turbo, 0x09 is Auto, 0x0A is Eco). Please do not take that SET mapping for TM2424. I did not include lid polling or EC fan tachs. On this BIOS the ACPI EC still starts and Lid Switch already binds; ECON is an unresolved External used only by _STA (not defined in DSDT or any SSDT). That is an ACPI firmware bug, not a WMI one. Decoded excerpts and dmesg are a reply on Yuming's 0/5, In-Reply-To Armin. I also left the v5 suspend hook alone. Ilpo already nacked the profile_valid pattern on Yuming 1/5. With this mapping GET no longer returns unmapped cmd 0x08 bytes on TM2424, so the existing hook should not abort sleep here. A global never-abort plus a status-word check still belongs in a separate patch; please take Ilpo's union + endianness nits there. This patch only looks at output.operation =3D=3D 0x80 on TM2424 SET (the accepted byte; same field Yuming packs as 0x8000) so Full-speed can fall back to Turbo. One regression to watch when v5 is rebased: e0d6312578e1 turned some redmi-wmi KE_IGNORE entries into KEY_KBDILLUMTOGGLE / KEY_PERFORMANCE / KEY_FN_ESC. v5 2/6 still KE_IGNOREs those; please carry Musaev's mappings into the merged keymap in v6. The LKP const-qualifier error on the old standalone quirk is obsolete once v5's non-const DEVICE_ATTR is the base. Tested on Xiaomi Book Pro 14 2026, SKU TM2424-77080, BIOS XMAPT4B0P0707. acpi_listen on that machine (HID_EVENT20 is notify 0x20 on PNP0C14:00). Volume and panel brightness are standard ACPI and do not go through this driver. The WMI-backed keys with this keymap: FN+F4 mic: wmi PNP0C14:00 00000020 00000000 button/micmute MICMUTE 00000080 00000000 K FN+F7 AI (make KEY_PROG1; break is KE_IGNORE): wmi PNP0C14:00 00000020 00000000 button/prog1 PROG1 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 FN+F8 projection: wmi PNP0C14:00 00000020 00000000 video/switchmode VMOD 00000080 00000000 K FN+F9 settings (KEY_CONFIG, evdev only): wmi PNP0C14:00 00000020 00000000 Mi button (make KEY_VENDOR; break is KE_IGNORE): wmi PNP0C14:00 00000020 00000000 button/vendor VNDR 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 Raw session (including power/mute/volume/brightness): button/power PBTN 00000080 00000000 button/power LNXPWRBN:00 00000080 00000001 button/mute MUTE 00000080 00000000 K button/volumeup VOLUP 00000080 00000000 K button/volumeup VOLUP 00000080 00000000 K button/volumedown VOLDN 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 button/micmute MICMUTE 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 button/micmute MICMUTE 00000080 00000000 K video/brightnessdown BRTDN 00000087 00000000 video/brightnessup BRTUP 00000086 00000000 wmi PNP0C14:00 00000020 00000000 button/prog1 PROG1 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 wmi PNP0C14:00 00000020 00000000 video/switchmode VMOD 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 wmi PNP0C14:00 00000020 00000000 wmi PNP0C14:00 00000020 00000000 wmi PNP0C14:00 00000020 00000000 button/vendor VNDR 00000080 00000000 K wmi PNP0C14:00 00000020 00000000 diff --git a/Documentation/wmi/devices/bitland-mifs-wmi.rst b/Documentation= /wmi/devices/bitland-mifs-wmi.rst index 9e86ecc..a89f872 100644 --- a/Documentation/wmi/devices/bitland-mifs-wmi.rst +++ b/Documentation/wmi/devices/bitland-mifs-wmi.rst @@ -93,8 +93,13 @@ The following Command IDs are used in the third byte of = the buffer: +----------+-----------------------+--------------------------------------= ----+ | ID | Name | Values / Description = | +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D+ -| 8 | SystemPerMode | 0: Balance, 1: Performance, 2: Quiet,= | -| | | 3: Full-speed = | +| 8 | SystemPerMode | Bitland gaming: 0 Balance, 1 = | +| | | Performance, 2 Quiet, 3 Full-speed. = | +| | | Redmi: 0 Performance, 1 Balanced, 2 = | +| | | Quiet, 4 Full-speed. = | +| | | TM2424 (Xiaomi Book Pro 14): 0x02 = | +| | | Quiet, 0x03 Turbo, 0x04 Full-speed, = | +| | | 0x09 Auto, 0x0A Eco. = | +----------+-----------------------+--------------------------------------= ----+ | 9 | GPUMode | 0: Hybrid, 1: Discrete, 2: UMA = | +----------+-----------------------+--------------------------------------= ----+ @@ -188,11 +193,8 @@ Performance Modes ----------------- Changing the performance mode via Command ID 0x08 (SystemPerMode) affects = the power limits (PL1/PL2) and fan curves managed by the Embedded Controller (= EC). -Note that the "Full-speed" and "Performance" mode (1, 3) is typically only -available when the system is connected to a DC power source (not USB-C/PD). - -In the driver implementation, switch to performance/full-speed mode without -DC power connected will throw the EOPNOTSUPP error. +The value encoding and the AC-power requirement are machine-specific (see +Command ID 8 and the driver ops table). =20 Graphics Switching ------------------ diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86= /bitland-mifs-wmi.c index 6031b1c..b49a6fb 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -44,6 +44,9 @@ #define BITLAND_MIFS_GUID "B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B" #define BITLAND_EVENT_GUID "46C93E13-EE9B-4262-8488-563BCA757FEF" =20 +/* Firmware status in output.operation (wire OutData[1]): request accepted= . */ +#define MIFS_STATUS_OK 0x80 + enum bitland_mifs_operation { WMI_METHOD_GET =3D 250, WMI_METHOD_SET =3D 251, @@ -110,8 +113,21 @@ static const struct bitland_profile_mode_map redmi_mod= e_map =3D { .full_speed =3D 4, }; =20 +/* TM2424 SystemPerMode bytes (Eco/Auto/Full-speed; Quiet/Turbo are GET al= iases). */ +enum bitland_mifs_tm2424_perf_mode { + WMI_TM2424_QUIET =3D 0x02, + WMI_TM2424_TURBO =3D 0x03, + WMI_TM2424_FULL_SPEED =3D 0x04, + WMI_TM2424_AUTO =3D 0x09, + WMI_TM2424_ECO =3D 0x0A, +}; + static int bitland_pp_check_capability(struct bitland_mifs_wmi_data *data); static int redmi_pp_check_capability(struct bitland_mifs_wmi_data *data); +static int tm2424_profile_get(struct bitland_mifs_wmi_data *data, + enum platform_profile_option *profile); +static int tm2424_profile_set(struct bitland_mifs_wmi_data *data, + enum platform_profile_option profile); =20 /* * Machine-specific operations. The MIFS WMI interface is shared by @@ -122,9 +138,15 @@ struct bitland_mifs_ops { const char *name; const struct bitland_profile_mode_map *mode_map; int (*check_performance_capability)(struct bitland_mifs_wmi_data *data); + int (*profile_get)(struct bitland_mifs_wmi_data *data, + enum platform_profile_option *profile); + int (*profile_set)(struct bitland_mifs_wmi_data *data, + enum platform_profile_option profile); bool has_full_speed; bool has_cpu_power; bool quirk_refresh_rate_toggle; + /* hwmon, keyboard LED and gpu/kb/fan sysfs are unimplemented */ + bool reduced_fw; }; =20 static const struct bitland_mifs_ops bitland_ops =3D { @@ -151,7 +173,22 @@ static const struct bitland_mifs_ops redmi_g_ops =3D { .quirk_refresh_rate_toggle =3D true, }; =20 +static const struct bitland_mifs_ops tm2424_ops =3D { + .name =3D "Xiaomi Book Pro 14", + .profile_get =3D tm2424_profile_get, + .profile_set =3D tm2424_profile_set, + .reduced_fw =3D true, +}; + static const struct dmi_system_id bitland_mifs_dmi_table[] =3D { + { + /* Xiaomi Book Pro 14. Vendor is XIAOMI, not TIMI. */ + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "XIAOMI"), + DMI_MATCH(DMI_BOARD_NAME, "TM2424"), + }, + .driver_data =3D (void *)&tm2424_ops, + }, { /* Redmi G */ .matches =3D { @@ -296,11 +333,89 @@ static int bitland_mifs_wmi_call(struct bitland_mifs_= wmi_data *data, return 0; } =20 +static int tm2424_wmi_perf_set(struct bitland_mifs_wmi_data *data, u8 val) +{ + struct bitland_mifs_input input =3D { + .operation =3D WMI_METHOD_SET, + .function =3D WMI_FN_SYSTEM_PER_MODE, + }; + struct bitland_mifs_output output; + int ret; + + input.payload[0] =3D val; + + ret =3D bitland_mifs_wmi_call(data, &input, &output); + if (ret) + return ret; + + if (output.operation !=3D MIFS_STATUS_OK) { + dev_dbg(&data->wdev->dev, + "perf mode %#x rejected by firmware (status=3D%#x)\n", + val, output.operation); + return -EOPNOTSUPP; + } + + return 0; +} + +static int tm2424_profile_get(struct bitland_mifs_wmi_data *data, + enum platform_profile_option *profile) +{ + struct bitland_mifs_input input =3D { + .operation =3D WMI_METHOD_GET, + .function =3D WMI_FN_SYSTEM_PER_MODE, + }; + struct bitland_mifs_output output; + int ret; + + ret =3D bitland_mifs_wmi_call(data, &input, &output); + if (ret) + return ret; + + switch (output.data[0]) { + case WMI_TM2424_ECO: + case WMI_TM2424_QUIET: + *profile =3D PLATFORM_PROFILE_LOW_POWER; + break; + case WMI_TM2424_AUTO: + *profile =3D PLATFORM_PROFILE_BALANCED; + break; + case WMI_TM2424_FULL_SPEED: + case WMI_TM2424_TURBO: + *profile =3D PLATFORM_PROFILE_PERFORMANCE; + break; + default: + dev_dbg(&data->wdev->dev, + "unrecognized TM2424 perf mode %#x\n", output.data[0]); + return -EINVAL; + } + + return 0; +} + +static int tm2424_profile_set(struct bitland_mifs_wmi_data *data, + enum platform_profile_option profile) +{ + switch (profile) { + case PLATFORM_PROFILE_LOW_POWER: + return tm2424_wmi_perf_set(data, WMI_TM2424_ECO); + case PLATFORM_PROFILE_BALANCED: + return tm2424_wmi_perf_set(data, WMI_TM2424_AUTO); + case PLATFORM_PROFILE_PERFORMANCE: + /* Full-speed is rejected on battery; fall back to Turbo. */ + if (tm2424_wmi_perf_set(data, WMI_TM2424_FULL_SPEED) =3D=3D 0) + return 0; + return tm2424_wmi_perf_set(data, WMI_TM2424_TURBO); + default: + return -EOPNOTSUPP; + } +} + static int laptop_profile_get(struct device *dev, enum platform_profile_option *profile) { struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); - const struct bitland_profile_mode_map *map =3D data->ops->mode_map; + const struct bitland_profile_mode_map *map; struct bitland_mifs_input input =3D { .reserved1 =3D 0, .operation =3D WMI_METHOD_GET, @@ -311,6 +426,10 @@ static int laptop_profile_get(struct device *dev, u8 mode; int ret; =20 + if (data->ops->profile_get) + return data->ops->profile_get(data, profile); + + map =3D data->ops->mode_map; ret =3D bitland_mifs_wmi_call(data, &input, &result); if (ret) return ret; @@ -369,7 +488,7 @@ static int laptop_profile_set(struct device *dev, enum platform_profile_option profile) { struct bitland_mifs_wmi_data *data =3D dev_get_drvdata(dev); - const struct bitland_profile_mode_map *map =3D data->ops->mode_map; + const struct bitland_profile_mode_map *map; struct bitland_mifs_input input =3D { .reserved1 =3D 0, .operation =3D WMI_METHOD_SET, @@ -379,6 +498,11 @@ static int laptop_profile_set(struct device *dev, int ret; u8 mode; =20 + if (data->ops->profile_set) + return data->ops->profile_set(data, profile); + + map =3D data->ops->mode_map; + switch (profile) { case PLATFORM_PROFILE_LOW_POWER: mode =3D map->quiet; @@ -897,6 +1021,7 @@ static const struct key_entry bitland_mifs_wmi_keymap[= ] =3D { { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_3, 0, 0), { KEY_ALL_APPLICATI= ONS } }, { KE_KEY, BI_HOTKEY_CODE(0x1b, 0, 0), { KEY_CONFIG } }, { KE_KEY, BI_HOTKEY_CODE(0x1b, 1, 0), { KEY_CONFIG } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_1, 0, 0), { KEY_SWITCHVIDEOMO= DE } }, { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_1, 1, 0), { KEY_SWITCHVIDEOMO= DE } }, { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0), { KEY_REFRESH_RAT= E_TOGGLE } }, =20 @@ -908,6 +1033,12 @@ static const struct key_entry bitland_mifs_wmi_keymap= [] =3D { { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 1, 0), { KEY_ASSISTANT } }, =20 { KE_KEY, BI_HOTKEY_CODE(0x19, 1, 0), { KEY_ASSISTANT } }, + /* TM2424 AI break event (make is 0x23 / WMI_EVENT_OPEN_APP) */ + { KE_IGNORE, BI_HOTKEY_CODE(0x24, 1, 0), {} }, + + /* TM2424 Mi button: make/break pair */ + { KE_KEY, BI_HOTKEY_CODE(0x25, 1, 0), { KEY_VENDOR } }, + { KE_IGNORE, BI_HOTKEY_CODE(0x26, 1, 0), {} }, =20 { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0), {} }, { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0x80), {} }, @@ -1085,6 +1216,9 @@ static int bitland_mifs_wmi_probe(struct wmi_device *= wdev, const void *context) if (IS_ERR(drv_data->pp_dev)) return PTR_ERR(drv_data->pp_dev); =20 + if (drv_data->ops->reduced_fw) + return 0; + /* Detect the keyboard type */ ret =3D bitland_detect_kbd_type(drv_data); if (ret) @@ -1243,5 +1377,6 @@ static struct wmi_driver bitland_mifs_wmi_driver =3D { module_wmi_driver(bitland_mifs_wmi_driver); =20 MODULE_AUTHOR("Mingyou Chen "); +MODULE_AUTHOR("KentoNion "); MODULE_DESCRIPTION("Bitland MIFS (MiInterface) WMI driver"); MODULE_LICENSE("GPL"); --=20 2.55.0