All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/1] asus-wmi: add support variant of TUF RGB
@ 2024-03-10  5:57 Luke D. Jones
  2024-03-10  5:57 ` [PATCH v1 1/1] platform/x86: " Luke D. Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Luke D. Jones @ 2024-03-10  5:57 UTC (permalink / raw
  To: platform-driver-x86; +Cc: hdegoede, ilpo.jarvinen, linux-kernel, Luke D. Jones

Changelog:
-v1
  - add missing define for WMI method

Luke D. Jones (1):
  platform/x86: asus-wmi: add support variant of TUF RGB

 drivers/platform/x86/asus-wmi.c            | 12 +++++++++++-
 include/linux/platform_data/x86/asus-wmi.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

-- 
2.44.0


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

* [PATCH v1 1/1] platform/x86: asus-wmi: add support variant of TUF RGB
  2024-03-10  5:57 [PATCH v1 0/1] asus-wmi: add support variant of TUF RGB Luke D. Jones
@ 2024-03-10  5:57 ` Luke D. Jones
  2024-03-19 12:31   ` Ilpo Järvinen
  0 siblings, 1 reply; 4+ messages in thread
From: Luke D. Jones @ 2024-03-10  5:57 UTC (permalink / raw
  To: platform-driver-x86; +Cc: hdegoede, ilpo.jarvinen, linux-kernel, Luke D. Jones

Adds support for a second TUF RGB wmi call that some versions of the TUF
laptop come with. Also adjusts existing support to select whichever is
available.

Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
 drivers/platform/x86/asus-wmi.c            | 12 +++++++++++-
 include/linux/platform_data/x86/asus-wmi.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 2cf695289655..ca8c73c15fcc 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -280,6 +280,7 @@ struct asus_wmi {
 	bool nv_temp_tgt_available;
 
 	bool kbd_rgb_mode_available;
+	u32 kbd_rgb_dev;
 	bool kbd_rgb_state_available;
 
 	bool throttle_thermal_policy_available;
@@ -870,6 +871,7 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
 				 struct device_attribute *attr,
 				 const char *buf, size_t count)
 {
+	struct asus_wmi *asus = dev_get_drvdata(dev);
 	u32 cmd, mode, r, g, b, speed;
 	int err;
 
@@ -906,7 +908,7 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
 		speed = 0xeb;
 	}
 
-	err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, ASUS_WMI_DEVID_TUF_RGB_MODE,
+	err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, asus->kbd_rgb_dev,
 			cmd | (mode << 8) | (r << 16) | (g << 24), b | (speed << 8), NULL);
 	if (err)
 		return err;
@@ -4537,6 +4539,14 @@ static int asus_wmi_add(struct platform_device *pdev)
 		asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX_VIVO;
 	}
 
+	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE)) {
+		asus->kbd_rgb_mode_available = true;
+		asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE;
+	} else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE2)) {
+		asus->kbd_rgb_mode_available = true;
+		asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE2;
+	}
+
 	err = fan_boost_mode_check_present(asus);
 	if (err)
 		goto fail_fan_boost_mode;
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
index b48b024dd844..3e9a01467c67 100644
--- a/include/linux/platform_data/x86/asus-wmi.h
+++ b/include/linux/platform_data/x86/asus-wmi.h
@@ -132,6 +132,7 @@
 
 /* TUF laptop RGB modes/colours */
 #define ASUS_WMI_DEVID_TUF_RGB_MODE	0x00100056
+#define ASUS_WMI_DEVID_TUF_RGB_MODE2	0x0010005A
 
 /* TUF laptop RGB power/state */
 #define ASUS_WMI_DEVID_TUF_RGB_STATE	0x00100057
-- 
2.44.0


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

* Re: [PATCH v1 1/1] platform/x86: asus-wmi: add support variant of TUF RGB
  2024-03-10  5:57 ` [PATCH v1 1/1] platform/x86: " Luke D. Jones
@ 2024-03-19 12:31   ` Ilpo Järvinen
  2024-03-20  1:08     ` Luke Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Ilpo Järvinen @ 2024-03-19 12:31 UTC (permalink / raw
  To: Luke D. Jones; +Cc: platform-driver-x86, Hans de Goede, LKML

On Sun, 10 Mar 2024, Luke D. Jones wrote:

> Adds support for a second TUF RGB wmi call that some versions of the TUF
> laptop come with. Also adjusts existing support to select whichever is
> available.
> 
> Signed-off-by: Luke D. Jones <luke@ljones.dev>
> ---
>  drivers/platform/x86/asus-wmi.c            | 12 +++++++++++-
>  include/linux/platform_data/x86/asus-wmi.h |  1 +
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 2cf695289655..ca8c73c15fcc 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -280,6 +280,7 @@ struct asus_wmi {
>  	bool nv_temp_tgt_available;
>  
>  	bool kbd_rgb_mode_available;
> +	u32 kbd_rgb_dev;
>  	bool kbd_rgb_state_available;
>  
>  	bool throttle_thermal_policy_available;
> @@ -870,6 +871,7 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
>  				 struct device_attribute *attr,
>  				 const char *buf, size_t count)
>  {
> +	struct asus_wmi *asus = dev_get_drvdata(dev);
>  	u32 cmd, mode, r, g, b, speed;
>  	int err;
>  
> @@ -906,7 +908,7 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
>  		speed = 0xeb;
>  	}
>  
> -	err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, ASUS_WMI_DEVID_TUF_RGB_MODE,
> +	err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, asus->kbd_rgb_dev,
>  			cmd | (mode << 8) | (r << 16) | (g << 24), b | (speed << 8), NULL);
>  	if (err)
>  		return err;
> @@ -4537,6 +4539,14 @@ static int asus_wmi_add(struct platform_device *pdev)
>  		asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX_VIVO;
>  	}
>  
> +	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE)) {
> +		asus->kbd_rgb_mode_available = true;
> +		asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE;
> +	} else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE2)) {
> +		asus->kbd_rgb_mode_available = true;
> +		asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE2;
> +	}

Hi,

Why are you leaving this line there (unlike in the GPU MUX patch where 
you replaced it with the similar if()s as above):

	asus->kbd_rgb_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE);

?

-- 
 i.


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

* Re: [PATCH v1 1/1] platform/x86: asus-wmi: add support variant of TUF RGB
  2024-03-19 12:31   ` Ilpo Järvinen
@ 2024-03-20  1:08     ` Luke Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Luke Jones @ 2024-03-20  1:08 UTC (permalink / raw
  To: Ilpo Järvinen; +Cc: platform-driver-x86, Hans de Goede, LKML

On Wed, 20 Mar 2024, at 1:31 AM, Ilpo Järvinen wrote:
> On Sun, 10 Mar 2024, Luke D. Jones wrote:
> 
> > Adds support for a second TUF RGB wmi call that some versions of the TUF
> > laptop come with. Also adjusts existing support to select whichever is
> > available.
> > 
> > Signed-off-by: Luke D. Jones <luke@ljones.dev>
> > ---
> >  drivers/platform/x86/asus-wmi.c            | 12 +++++++++++-
> >  include/linux/platform_data/x86/asus-wmi.h |  1 +
> >  2 files changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> > index 2cf695289655..ca8c73c15fcc 100644
> > --- a/drivers/platform/x86/asus-wmi.c
> > +++ b/drivers/platform/x86/asus-wmi.c
> > @@ -280,6 +280,7 @@ struct asus_wmi {
> >  bool nv_temp_tgt_available;
> >  
> >  bool kbd_rgb_mode_available;
> > + u32 kbd_rgb_dev;
> >  bool kbd_rgb_state_available;
> >  
> >  bool throttle_thermal_policy_available;
> > @@ -870,6 +871,7 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
> >  struct device_attribute *attr,
> >  const char *buf, size_t count)
> >  {
> > + struct asus_wmi *asus = dev_get_drvdata(dev);
> >  u32 cmd, mode, r, g, b, speed;
> >  int err;
> >  
> > @@ -906,7 +908,7 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
> >  speed = 0xeb;
> >  }
> >  
> > - err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, ASUS_WMI_DEVID_TUF_RGB_MODE,
> > + err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, asus->kbd_rgb_dev,
> >  cmd | (mode << 8) | (r << 16) | (g << 24), b | (speed << 8), NULL);
> >  if (err)
> >  return err;
> > @@ -4537,6 +4539,14 @@ static int asus_wmi_add(struct platform_device *pdev)
> >  asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX_VIVO;
> >  }
> >  
> > + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE)) {
> > + asus->kbd_rgb_mode_available = true;
> > + asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE;
> > + } else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE2)) {
> > + asus->kbd_rgb_mode_available = true;
> > + asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE2;
> > + }
> 
> Hi,
> 
> Why are you leaving this line there (unlike in the GPU MUX patch where 
> you replaced it with the similar if()s as above):
> 
> asus->kbd_rgb_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE);

Missed it I guess. Thanks for catching, I'll submit next version.

> 
> ?
> 
> -- 
> i.
> 
> 

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

end of thread, other threads:[~2024-03-20  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-10  5:57 [PATCH v1 0/1] asus-wmi: add support variant of TUF RGB Luke D. Jones
2024-03-10  5:57 ` [PATCH v1 1/1] platform/x86: " Luke D. Jones
2024-03-19 12:31   ` Ilpo Järvinen
2024-03-20  1:08     ` Luke Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.