Skip to contentSkip to conversation

platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops

PATCH In review Kristian Angelov 3 participants 3 messages Jul 20, 2023 – Jul 25, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops

This patch fixes setting the cmd values to 0xb3 and 0xb4. This is necessary on some TUF laptops in order to set the RGB mode.

---
V1 -> V2. Make setting 0xb3 and 0xb4 the default logic V2 -> V3. Defualt to -EINVAL to match the rest of asus-wmi.

 drivers/platform/x86/asus-wmi.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +12 -2
index 1038dfdcdd32..8bef66a2f0ce 100644
@@ -738,13 +738,23 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
 				 struct device_attribute *attr,
 				 const char *buf, size_t count)
 {
-	u32 cmd, mode, r, g,  b,  speed;
+	u32 cmd, mode, r, g, b, speed;
 	int err;
 
 	if (sscanf(buf, "%d %d %d %d %d %d", &cmd, &mode, &r, &g, &b, &speed) != 6)
 		return -EINVAL;
 
-	cmd = !!cmd;
+	/* B3 is set and B4 is save to BIOS */
+	switch (cmd) {
+	case 0:
+		cmd = 0xb3;
+		break;
+	case 1:
+		cmd = 0xb4;
+		break;
+	default:
+		return -EINVAL;
+	}
 
 	/* These are the known usable modes across all TUF/ROG */
 	if (mode >= 12 || mode == 9)
Signature · 1 line
2.40.0
maintainer Reviewed-by on v3 1/1
#1 lore raw

Looks good to me.

Quoted 47 lines · Kristian Angelov

This patch fixes setting the cmd values to 0xb3 and 0xb4. This is necessary on some TUF laptops in order to set the RGB mode.

---
V1 -> V2. Make setting 0xb3 and 0xb4 the default logic V2 -> V3. Defualt to -EINVAL to match the rest of asus-wmi.

 drivers/platform/x86/asus-wmi.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +12 -2
index 1038dfdcdd32..8bef66a2f0ce 100644
@@ -738,13 +738,23 @@ static ssize_t kbd_rgb_mode_store(struct device 
 *dev,
 				 struct device_attribute *attr,
 				 const char *buf, size_t count)
 {
-	u32 cmd, mode, r, g,  b,  speed;
+	u32 cmd, mode, r, g, b, speed;
 	int err;
 
 	if (sscanf(buf, "%d %d %d %d %d %d", &cmd, &mode, &r, &g, &b, 
 &speed) != 6)
 		return -EINVAL;
 
-	cmd = !!cmd;
+	/* B3 is set and B4 is save to BIOS */
+	switch (cmd) {
+	case 0:
+		cmd = 0xb3;
+		break;
+	case 1:
+		cmd = 0xb4;
+		break;
+	default:
+		return -EINVAL;
+	}
 
drivers/platform/x86/asus-wmi.c +0 -1
 	/* These are the known usable modes across all TUF/ROG */
 	if (mode >= 12 || mode == 9)
--

2.40.0

#2 lore raw

Hi,

Quoted 10 lines · Luke Jones

Looks good to me.

Quoted 5 lines · Kristian Angelov

This patch fixes setting the cmd values to 0xb3 and 0xb4. This is necessary on some TUF laptops in order to set the RGB mode.

Thank you for your patch, I've applied this patch to my fixes branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes

Note it will show up in my fixes branch once I've pushed my local branch there, which might take a while.

I will include this patch in my next fixes pull-req to Linus for the current kernel development cycle.

Regards,

Hans

Quoted 42 lines
Quoted 40 lines

---
 V1 -> V2. Make setting 0xb3 and 0xb4 the default logic V2 -> V3. Defualt to -EINVAL to match the rest of asus-wmi.

 drivers/platform/x86/asus-wmi.c | 14 ++++++++++++--

 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +12 -2
index 1038dfdcdd32..8bef66a2f0ce 100644
@@ -738,13 +738,23 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
                   struct device_attribute *attr,
                   const char *buf, size_t count)
  {
-    u32 cmd, mode, r, g,  b,  speed;
+    u32 cmd, mode, r, g, b, speed;
      int err;
 
      if (sscanf(buf, "%d %d %d %d %d %d", &cmd, &mode, &r, &g, &b, &speed) != 6)
          return -EINVAL;
 
-    cmd = !!cmd;
+    /* B3 is set and B4 is save to BIOS */
+    switch (cmd) {
+    case 0:
+        cmd = 0xb3;
+        break;
+    case 1:
+        cmd = 0xb4;
+        break;
+    default:
+        return -EINVAL;
+    }
 
      /* These are the known usable modes across all TUF/ROG */
      if (mode >= 12 || mode == 9)
Signature · 1 line
2.40.0