* [PATCH v2 0/1] asus-wmi: add support for Vivobook GPU MUX @ 2024-03-10 5:53 Luke D. Jones 2024-03-10 5:53 ` [PATCH v2 1/1] platform/x86: " Luke D. Jones 0 siblings, 1 reply; 6+ messages in thread From: Luke D. Jones @ 2024-03-10 5:53 UTC (permalink / raw) To: platform-driver-x86; +Cc: hdegoede, ilpo.jarvinen, linux-kernel, Luke D. Jones Note to self to not try catching up on things while sick. Changelog: -v1 - Add missing define for new WMI method -v2 - Actually add the right one Luke D. Jones (1): platform/x86: asus-wmi: add support for Vivobook GPU MUX drivers/platform/x86/asus-wmi.c | 18 +++++++++++++----- include/linux/platform_data/x86/asus-wmi.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) -- 2.44.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/1] platform/x86: asus-wmi: add support for Vivobook GPU MUX 2024-03-10 5:53 [PATCH v2 0/1] asus-wmi: add support for Vivobook GPU MUX Luke D. Jones @ 2024-03-10 5:53 ` Luke D. Jones 2024-03-19 12:26 ` Ilpo Järvinen 0 siblings, 1 reply; 6+ messages in thread From: Luke D. Jones @ 2024-03-10 5:53 UTC (permalink / raw) To: platform-driver-x86; +Cc: hdegoede, ilpo.jarvinen, linux-kernel, Luke D. Jones Adjust existing MUX support to select whichever MUX support is available so that ASUS Vivobook MUX can also be used if detected. Signed-off-by: Luke D. Jones <luke@ljones.dev> --- drivers/platform/x86/asus-wmi.c | 18 +++++++++++++----- include/linux/platform_data/x86/asus-wmi.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 94cc589607b3..2cf695289655 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -268,6 +268,7 @@ struct asus_wmi { bool egpu_connect_available; bool dgpu_disable_available; bool gpu_mux_mode_available; + u32 gpu_mux_dev; /* Tunables provided by ASUS for gaming laptops */ bool ppt_pl2_sppt_available; @@ -682,7 +683,7 @@ static ssize_t dgpu_disable_store(struct device *dev, return -EINVAL; if (asus->gpu_mux_mode_available) { - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); if (result < 0) /* An error here may signal greater failure of GPU handling */ return result; @@ -748,7 +749,7 @@ static ssize_t egpu_enable_store(struct device *dev, } if (asus->gpu_mux_mode_available) { - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); if (result < 0) { /* An error here may signal greater failure of GPU handling */ pr_warn("Failed to get gpu mux status: %d\n", result); @@ -801,7 +802,7 @@ static ssize_t gpu_mux_mode_show(struct device *dev, struct asus_wmi *asus = dev_get_drvdata(dev); int result; - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); if (result < 0) return result; @@ -847,7 +848,7 @@ static ssize_t gpu_mux_mode_store(struct device *dev, } } - err = asus_wmi_set_devstate(ASUS_WMI_DEVID_GPU_MUX, optimus, &result); + err = asus_wmi_set_devstate(asus->gpu_mux_dev, optimus, &result); if (err) { dev_err(dev, "Failed to set GPU MUX mode: %d\n", err); return err; @@ -4507,7 +4508,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->gpu_mux_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX); 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); @@ -4529,6 +4529,14 @@ static int asus_wmi_add(struct platform_device *pdev) asus->mini_led_dev_id = ASUS_WMI_DEVID_MINI_LED_MODE2; } + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX)) { + asus->gpu_mux_mode_available = true; + asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX; + } else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX_VIVO)) { + asus->gpu_mux_mode_available = true; + asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX_VIVO; + } + 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 9cadce10ad9a..b48b024dd844 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h @@ -128,6 +128,7 @@ /* gpu mux switch, 0 = dGPU, 1 = Optimus */ #define ASUS_WMI_DEVID_GPU_MUX 0x00090016 +#define ASUS_WMI_DEVID_GPU_MUX_VIVO 0x00090026 /* TUF laptop RGB modes/colours */ #define ASUS_WMI_DEVID_TUF_RGB_MODE 0x00100056 -- 2.44.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] platform/x86: asus-wmi: add support for Vivobook GPU MUX 2024-03-10 5:53 ` [PATCH v2 1/1] platform/x86: " Luke D. Jones @ 2024-03-19 12:26 ` Ilpo Järvinen 2024-03-20 1:04 ` Luke Jones 0 siblings, 1 reply; 6+ messages in thread From: Ilpo Järvinen @ 2024-03-19 12:26 UTC (permalink / raw) To: Luke D. Jones; +Cc: platform-driver-x86, Hans de Goede, LKML [-- Attachment #1: Type: text/plain, Size: 4629 bytes --] On Sun, 10 Mar 2024, Luke D. Jones wrote: > Adjust existing MUX support to select whichever MUX support is available > so that ASUS Vivobook MUX can also be used if detected. This description is a bit on the short side. It wouldn't have hurt to first state that Vivobooks come with a GPU MUX WMI that has a different WMI device ID. I can infer that after reading the diff but the description should not require reading the patch. The code change itself looks fine, Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> -- i. > > Signed-off-by: Luke D. Jones <luke@ljones.dev> > --- > drivers/platform/x86/asus-wmi.c | 18 +++++++++++++----- > include/linux/platform_data/x86/asus-wmi.h | 1 + > 2 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c > index 94cc589607b3..2cf695289655 100644 > --- a/drivers/platform/x86/asus-wmi.c > +++ b/drivers/platform/x86/asus-wmi.c > @@ -268,6 +268,7 @@ struct asus_wmi { > bool egpu_connect_available; > bool dgpu_disable_available; > bool gpu_mux_mode_available; > + u32 gpu_mux_dev; > > /* Tunables provided by ASUS for gaming laptops */ > bool ppt_pl2_sppt_available; > @@ -682,7 +683,7 @@ static ssize_t dgpu_disable_store(struct device *dev, > return -EINVAL; > > if (asus->gpu_mux_mode_available) { > - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); > + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); > if (result < 0) > /* An error here may signal greater failure of GPU handling */ > return result; > @@ -748,7 +749,7 @@ static ssize_t egpu_enable_store(struct device *dev, > } > > if (asus->gpu_mux_mode_available) { > - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); > + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); > if (result < 0) { > /* An error here may signal greater failure of GPU handling */ > pr_warn("Failed to get gpu mux status: %d\n", result); > @@ -801,7 +802,7 @@ static ssize_t gpu_mux_mode_show(struct device *dev, > struct asus_wmi *asus = dev_get_drvdata(dev); > int result; > > - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); > + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); > if (result < 0) > return result; > > @@ -847,7 +848,7 @@ static ssize_t gpu_mux_mode_store(struct device *dev, > } > } > > - err = asus_wmi_set_devstate(ASUS_WMI_DEVID_GPU_MUX, optimus, &result); > + err = asus_wmi_set_devstate(asus->gpu_mux_dev, optimus, &result); > if (err) { > dev_err(dev, "Failed to set GPU MUX mode: %d\n", err); > return err; > @@ -4507,7 +4508,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->gpu_mux_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX); > 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); > @@ -4529,6 +4529,14 @@ static int asus_wmi_add(struct platform_device *pdev) > asus->mini_led_dev_id = ASUS_WMI_DEVID_MINI_LED_MODE2; > } > > + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX)) { > + asus->gpu_mux_mode_available = true; > + asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX; > + } else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX_VIVO)) { > + asus->gpu_mux_mode_available = true; > + asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX_VIVO; > + } > + > 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 9cadce10ad9a..b48b024dd844 100644 > --- a/include/linux/platform_data/x86/asus-wmi.h > +++ b/include/linux/platform_data/x86/asus-wmi.h > @@ -128,6 +128,7 @@ > > /* gpu mux switch, 0 = dGPU, 1 = Optimus */ > #define ASUS_WMI_DEVID_GPU_MUX 0x00090016 > +#define ASUS_WMI_DEVID_GPU_MUX_VIVO 0x00090026 > > /* TUF laptop RGB modes/colours */ > #define ASUS_WMI_DEVID_TUF_RGB_MODE 0x00100056 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] platform/x86: asus-wmi: add support for Vivobook GPU MUX 2024-03-19 12:26 ` Ilpo Järvinen @ 2024-03-20 1:04 ` Luke Jones 2024-03-20 12:02 ` Ilpo Järvinen 0 siblings, 1 reply; 6+ messages in thread From: Luke Jones @ 2024-03-20 1:04 UTC (permalink / raw) To: Ilpo Järvinen; +Cc: platform-driver-x86, Hans de Goede, LKML On Wed, 20 Mar 2024, at 1:26 AM, Ilpo Järvinen wrote: > On Sun, 10 Mar 2024, Luke D. Jones wrote: > > > Adjust existing MUX support to select whichever MUX support is available > > so that ASUS Vivobook MUX can also be used if detected. > > This description is a bit on the short side. It wouldn't have hurt to > first state that Vivobooks come with a GPU MUX WMI that has a different > WMI device ID. I can infer that after reading the diff but the description > should not require reading the patch. Would you prefer I changed the commit message? > > The code change itself looks fine, > > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > > -- > i. > > > > > Signed-off-by: Luke D. Jones <luke@ljones.dev> > > --- > > drivers/platform/x86/asus-wmi.c | 18 +++++++++++++----- > > include/linux/platform_data/x86/asus-wmi.h | 1 + > > 2 files changed, 14 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c > > index 94cc589607b3..2cf695289655 100644 > > --- a/drivers/platform/x86/asus-wmi.c > > +++ b/drivers/platform/x86/asus-wmi.c > > @@ -268,6 +268,7 @@ struct asus_wmi { > > bool egpu_connect_available; > > bool dgpu_disable_available; > > bool gpu_mux_mode_available; > > + u32 gpu_mux_dev; > > > > /* Tunables provided by ASUS for gaming laptops */ > > bool ppt_pl2_sppt_available; > > @@ -682,7 +683,7 @@ static ssize_t dgpu_disable_store(struct device *dev, > > return -EINVAL; > > > > if (asus->gpu_mux_mode_available) { > > - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); > > + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); > > if (result < 0) > > /* An error here may signal greater failure of GPU handling */ > > return result; > > @@ -748,7 +749,7 @@ static ssize_t egpu_enable_store(struct device *dev, > > } > > > > if (asus->gpu_mux_mode_available) { > > - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); > > + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); > > if (result < 0) { > > /* An error here may signal greater failure of GPU handling */ > > pr_warn("Failed to get gpu mux status: %d\n", result); > > @@ -801,7 +802,7 @@ static ssize_t gpu_mux_mode_show(struct device *dev, > > struct asus_wmi *asus = dev_get_drvdata(dev); > > int result; > > > > - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); > > + result = asus_wmi_get_devstate_simple(asus, asus->gpu_mux_dev); > > if (result < 0) > > return result; > > > > @@ -847,7 +848,7 @@ static ssize_t gpu_mux_mode_store(struct device *dev, > > } > > } > > > > - err = asus_wmi_set_devstate(ASUS_WMI_DEVID_GPU_MUX, optimus, &result); > > + err = asus_wmi_set_devstate(asus->gpu_mux_dev, optimus, &result); > > if (err) { > > dev_err(dev, "Failed to set GPU MUX mode: %d\n", err); > > return err; > > @@ -4507,7 +4508,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->gpu_mux_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX); > > 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); > > @@ -4529,6 +4529,14 @@ static int asus_wmi_add(struct platform_device *pdev) > > asus->mini_led_dev_id = ASUS_WMI_DEVID_MINI_LED_MODE2; > > } > > > > + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX)) { > > + asus->gpu_mux_mode_available = true; > > + asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX; > > + } else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX_VIVO)) { > > + asus->gpu_mux_mode_available = true; > > + asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX_VIVO; > > + } > > + > > 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 9cadce10ad9a..b48b024dd844 100644 > > --- a/include/linux/platform_data/x86/asus-wmi.h > > +++ b/include/linux/platform_data/x86/asus-wmi.h > > @@ -128,6 +128,7 @@ > > > > /* gpu mux switch, 0 = dGPU, 1 = Optimus */ > > #define ASUS_WMI_DEVID_GPU_MUX 0x00090016 > > +#define ASUS_WMI_DEVID_GPU_MUX_VIVO 0x00090026 > > > > /* TUF laptop RGB modes/colours */ > > #define ASUS_WMI_DEVID_TUF_RGB_MODE 0x00100056 > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] platform/x86: asus-wmi: add support for Vivobook GPU MUX 2024-03-20 1:04 ` Luke Jones @ 2024-03-20 12:02 ` Ilpo Järvinen 2024-03-20 20:07 ` Luke Jones 0 siblings, 1 reply; 6+ messages in thread From: Ilpo Järvinen @ 2024-03-20 12:02 UTC (permalink / raw) To: Luke Jones; +Cc: platform-driver-x86, Hans de Goede, LKML [-- Attachment #1: Type: text/plain, Size: 1215 bytes --] On Wed, 20 Mar 2024, Luke Jones wrote: > On Wed, 20 Mar 2024, at 1:26 AM, Ilpo Järvinen wrote: > > On Sun, 10 Mar 2024, Luke D. Jones wrote: > > > > > Adjust existing MUX support to select whichever MUX support is available > > > so that ASUS Vivobook MUX can also be used if detected. > > > > This description is a bit on the short side. It wouldn't have hurt to > > first state that Vivobooks come with a GPU MUX WMI that has a different > > WMI device ID. I can infer that after reading the diff but the description > > should not require reading the patch. > > Would you prefer I changed the commit message? I kind of tried to give some leeway for you and not sound like I'm enforcing you to do it but yes, I do prefer good commit messages myself (I know that after reading this patch the reasons will be pretty obvious to anyone so it's not a grave problem). So half it was said future patches in mind, half you can do it if you want also for this patch. But since you'll need to resend this anyway because of the independent/series issue I mentioned in my reply to one of the other patches, just cover this minor thing as well, it's one sentence after all. -- i. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] platform/x86: asus-wmi: add support for Vivobook GPU MUX 2024-03-20 12:02 ` Ilpo Järvinen @ 2024-03-20 20:07 ` Luke Jones 0 siblings, 0 replies; 6+ messages in thread From: Luke Jones @ 2024-03-20 20:07 UTC (permalink / raw) To: Ilpo Järvinen; +Cc: platform-driver-x86, Hans de Goede, LKML On Thu, 21 Mar 2024, at 1:02 AM, Ilpo Järvinen wrote: > On Wed, 20 Mar 2024, Luke Jones wrote: > > > On Wed, 20 Mar 2024, at 1:26 AM, Ilpo Järvinen wrote: > > > On Sun, 10 Mar 2024, Luke D. Jones wrote: > > > > > > > Adjust existing MUX support to select whichever MUX support is available > > > > so that ASUS Vivobook MUX can also be used if detected. > > > > > > This description is a bit on the short side. It wouldn't have hurt to > > > first state that Vivobooks come with a GPU MUX WMI that has a different > > > WMI device ID. I can infer that after reading the diff but the description > > > should not require reading the patch. > > > > Would you prefer I changed the commit message? > > I kind of tried to give some leeway for you and not sound like I'm > enforcing you to do it but yes, Hey it's not a problem at all. Part of the review and all feedback is valuable :) ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-20 20:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-10 5:53 [PATCH v2 0/1] asus-wmi: add support for Vivobook GPU MUX Luke D. Jones 2024-03-10 5:53 ` [PATCH v2 1/1] platform/x86: " Luke D. Jones 2024-03-19 12:26 ` Ilpo Järvinen 2024-03-20 1:04 ` Luke Jones 2024-03-20 12:02 ` Ilpo Järvinen 2024-03-20 20:07 ` Luke Jones
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox