platform/x86: asus-wmi: add support variant of TUF RGB
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. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Luke D. Jones <luke@ljones.dev> Link: https://lore.kernel.org/r/20240404001652.86207-4-luke@ljones.dev Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
eb3bac9054
commit
ae834a549e
@ -281,7 +281,7 @@ struct asus_wmi {
|
||||
bool nv_dyn_boost_available;
|
||||
bool nv_temp_tgt_available;
|
||||
|
||||
bool kbd_rgb_mode_available;
|
||||
u32 kbd_rgb_dev;
|
||||
bool kbd_rgb_state_available;
|
||||
|
||||
bool throttle_thermal_policy_available;
|
||||
@ -881,6 +881,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;
|
||||
|
||||
@ -917,7 +918,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;
|
||||
@ -1560,7 +1561,7 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
|
||||
{
|
||||
int rv = 0, num_rgb_groups = 0, led_val;
|
||||
|
||||
if (asus->kbd_rgb_mode_available)
|
||||
if (asus->kbd_rgb_dev)
|
||||
kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_mode_group;
|
||||
if (asus->kbd_rgb_state_available)
|
||||
kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_state_group;
|
||||
@ -4505,7 +4506,6 @@ static int asus_wmi_add(struct platform_device *pdev)
|
||||
asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU);
|
||||
asus->egpu_connect_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU_CONNECTED);
|
||||
asus->dgpu_disable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU);
|
||||
asus->kbd_rgb_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE);
|
||||
asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE);
|
||||
asus->ppt_pl2_sppt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_PL2_SPPT);
|
||||
asus->ppt_pl1_spl_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_PL1_SPL);
|
||||
@ -4528,6 +4528,11 @@ static int asus_wmi_add(struct platform_device *pdev)
|
||||
else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX_VIVO))
|
||||
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_dev = ASUS_WMI_DEVID_TUF_RGB_MODE;
|
||||
else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE2))
|
||||
asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE2;
|
||||
|
||||
err = fan_boost_mode_check_present(asus);
|
||||
if (err)
|
||||
goto fail_fan_boost_mode;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user