[PATCH v2 2/3] platform/x86: acer-wmi: split hwmon from platform profile quirk

Mohsen Tahmasebi <[email protected]>
Newsgroups org.kernel.vger.platform-driver-x86,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Some Acer laptops expose the same WMI sensor interface without necessarily
supporting platform profile functionality.

Currently, ACER_CAP_HWMON is enabled only through predator_v4 quirk,
but this quirk enables both ACER_CAP_PLATFORM_PROFILE and ACER_CAP_HWMON.

This commit splits hwmon support into its own quirk field, renames
predator_v4 to platform_profile, and updates existing predator_v4 quirks
to enable both capabilities.

Signed-off-by: Mohsen Tahmasebi <[email protected]>
---
 drivers/platform/x86/acer-wmi.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 00c3113c4cf8..1d1c0d3bcec3 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -403,7 +403,8 @@ struct quirk_entry {
 	bool turbo;
 	u8 cpu_fans;
 	u8 gpu_fans;
-	bool predator_v4;
+	bool hwmon;
+	bool platform_profile;
 	bool pwm;
 };
 
@@ -421,9 +422,11 @@ static void __init set_quirks(void)
 		interface->capability |= ACER_CAP_TURBO_OC | ACER_CAP_TURBO_LED
 					 | ACER_CAP_TURBO_FAN;
 
-	if (quirks->predator_v4)
-		interface->capability |= ACER_CAP_PLATFORM_PROFILE |
-					 ACER_CAP_HWMON;
+	if (quirks->hwmon)
+		interface->capability |= ACER_CAP_HWMON;
+
+	if (quirks->platform_profile)
+		interface->capability |= ACER_CAP_PLATFORM_PROFILE;
 
 	if (quirks->pwm)
 		interface->capability |= ACER_CAP_PWM;
@@ -456,7 +459,8 @@ static struct quirk_entry quirk_acer_travelmate_2490 = {
 };
 
 static struct quirk_entry quirk_acer_nitro_an515_58 = {
-	.predator_v4 = true,
+	.hwmon = true,
+	.platform_profile = true,
 	.pwm = true,
 };
 
@@ -470,7 +474,8 @@ static struct quirk_entry quirk_acer_predator_ph16_72 = {
 	.turbo = true,
 	.cpu_fans = 1,
 	.gpu_fans = 1,
-	.predator_v4 = true,
+	.hwmon = true,
+	.platform_profile = true,
 	.pwm = true,
 };
 
@@ -478,12 +483,14 @@ static struct quirk_entry quirk_acer_predator_pt14_51 = {
 	.turbo = true,
 	.cpu_fans = 1,
 	.gpu_fans = 1,
-	.predator_v4 = true,
+	.hwmon = true,
+	.platform_profile = true,
 	.pwm = true,
 };
 
 static struct quirk_entry quirk_acer_predator_v4 = {
-	.predator_v4 = true,
+	.hwmon = true,
+	.platform_profile = true,
 };
 
 /* This AMW0 laptop has no bluetooth */
@@ -2192,7 +2199,7 @@ static const struct platform_profile_ops acer_predator_v4_platform_profile_ops =
 
 static int acer_platform_profile_setup(struct platform_device *device)
 {
-	if (quirks->predator_v4) {
+	if (quirks->platform_profile) {
 		platform_profile_device = devm_platform_profile_register(
 			&device->dev, "acer-wmi", NULL, &acer_predator_v4_platform_profile_ops);
 		if (IS_ERR(platform_profile_device))
@@ -2209,7 +2216,7 @@ static int acer_thermal_profile_change(void)
 	 * This mode key will either cycle through each mode or toggle the
 	 * most performant profile.
 	 */
-	if (quirks->predator_v4) {
+	if (quirks->platform_profile) {
 		u8 current_tp;
 		int err, tp;
 
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.