X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH V3] platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops
@ 2023-07-20 15:29 Kristian Angelov
  2023-07-20 22:30 ` Luke Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Kristian Angelov @ 2023-07-20 15:29 UTC (permalink / raw)
  To: luke; +Cc: hdegoede, platform-driver-x86

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.

Closes: https://lore.kernel.org/platform-driver-x86/443078148.491022.1677576298133@nm83.abv.bg
Signed-off-by: Kristian Angelov <kristiana2000@abv.bg>
---
 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(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 1038dfdcdd32..8bef66a2f0ce 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -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)
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V3] platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops
  2023-07-20 15:29 [PATCH V3] platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops Kristian Angelov
@ 2023-07-20 22:30 ` Luke Jones
  2023-07-25 13:40   ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Luke Jones @ 2023-07-20 22:30 UTC (permalink / raw)
  To: Kristian Angelov; +Cc: hdegoede, platform-driver-x86

Looks good to me.

Reviewed-by: Luke D. Jones <luke@ljones.dev>

On Thu, Jul 20 2023 at 18:29:50 +03:00:00, Kristian Angelov 
<kristiana2000@abv.bg> wrote:
> 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.
> 
> Closes: 
> https://lore.kernel.org/platform-driver-x86/443078148.491022.1677576298133@nm83.abv.bg
> Signed-off-by: Kristian Angelov <kristiana2000@abv.bg>
> ---
>  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(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c 
> b/drivers/platform/x86/asus-wmi.c
> index 1038dfdcdd32..8bef66a2f0ce 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -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)
> --
> 2.40.0
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V3] platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops
  2023-07-20 22:30 ` Luke Jones
@ 2023-07-25 13:40   ` Hans de Goede
  0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2023-07-25 13:40 UTC (permalink / raw)
  To: Luke Jones, Kristian Angelov; +Cc: platform-driver-x86

Hi,

On 7/21/23 00:30, Luke Jones wrote:
> Looks good to me.
> 
> Reviewed-by: Luke D. Jones <luke@ljones.dev>
> 
> On Thu, Jul 20 2023 at 18:29:50 +03:00:00, Kristian Angelov <kristiana2000@abv.bg> wrote:
>> 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.
>>
>> Closes: https://lore.kernel.org/platform-driver-x86/443078148.491022.1677576298133@nm83.abv.bg
>> Signed-off-by: Kristian Angelov <kristiana2000@abv.bg>

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




>> ---
>>  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(-)
>>
>> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
>> index 1038dfdcdd32..8bef66a2f0ce 100644
>> --- a/drivers/platform/x86/asus-wmi.c
>> +++ b/drivers/platform/x86/asus-wmi.c
>> @@ -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)
>> -- 
>> 2.40.0
>>
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-25 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-20 15:29 [PATCH V3] platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops Kristian Angelov
2023-07-20 22:30 ` Luke Jones
2023-07-25 13:40   ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox