linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luke Jones <luke@ljones.dev>
To: Hans de Goede <hdegoede@redhat.com>
Cc: pobrn@protonmail.com, mgross@linux.intel.com,
	corentin.chary@gmail.com, platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	acpi4asus-user@lists.sourceforge.net
Subject: Re: [PATCH 3/4] asus-wmi: Add egpu enable method
Date: Sat, 24 Jul 2021 23:15:50 +1200	[thread overview]
Message-ID: <EYXQWQ.O2RLFGQXKOHO2@ljones.dev> (raw)
In-Reply-To: <adb670de-e69a-6944-3d37-d2c0ef36d378@redhat.com>

Oh I see, thanks. I was trying to do the "-v3" on send-email part.

On Sat, Jul 17 2021 at 17:57:54 +0200, Hans de Goede 
<hdegoede@redhat.com> wrote:
> Hi Luke,
> 
> On 7/17/21 10:19 AM, Luke Jones wrote:
>>  Damn. I thought `-v2` on `git send-email` would bump patch version 
>> too. What is the correct way to do that for a full patch sequence?
> 
> You need to split the sending of patches into 2 steps, which 
> generally is a good
> idea anyways, since that will also allow you to easily add a 
> cover-letter to the
> series:
> 
> Lets say you are ready to send v3 and you have the 3 patches as the 
> last 3
> commits in your git tree's current HEAD, then you would do:
> 
> git format-patch --cover-letter -v3 HEAD~3
> $EDITOR v3-0000*.patch
> # Edit the cover letter, say something like:
> # Hi All here is v3 of my ... series, which does foobar
> # new in v3 is ...
> # And don't forget to set the Subject
> git send-email v3-00*.patch
> 
> And you're done. I hope this helps.
> 
> Regards,
> 
> Hans
> 
> 
> 
> 
> 
>> 
>>  On Sat, Jul 17 2021 at 20:15:30 +1200, Luke Jones <luke@ljones.dev> 
>> wrote:
>>>  Apologies, I forgot that the patches contain sequence. There is 
>>> actually no 4th patch (the patch itself was already upstreamed).
>>> 
>>>  Sincere regards,
>>>  Luke.
>>> 
>>>  On Sat, Jul 17 2021 at 20:13:23 +1200, Luke D. Jones 
>>> <luke@ljones.dev> wrote:
>>>>  The X13 Flow laptops can utilise an external GPU. This requires
>>>>  toggling an ACPI method which will first disable the internal
>>>>  dGPU, and then enable the eGPU.
>>>> 
>>>>  Signed-off-by: Luke D. Jones <luke@ljones.dev>
>>>>  ---
>>>>   drivers/platform/x86/asus-wmi.c            | 91 
>>>> \x7f++++++++++++++++++++++
>>>>   include/linux/platform_data/x86/asus-wmi.h |  3 +
>>>>   2 files changed, 94 insertions(+)
>>>> 
>>>>  diff --git a/drivers/platform/x86/asus-wmi.c 
>>>> \x7fb/drivers/platform/x86/asus-wmi.c
>>>>  index 02762a60d27a..ee5d8656641e 100644
>>>>  --- a/drivers/platform/x86/asus-wmi.c
>>>>  +++ b/drivers/platform/x86/asus-wmi.c
>>>>  @@ -210,6 +210,9 @@ struct asus_wmi {
>>>>       u8 fan_boost_mode_mask;
>>>>       u8 fan_boost_mode;
>>>> 
>>>>  +    bool egpu_enable_available; // 0 = enable
>>>>  +    bool egpu_enable;
>>>>  +
>>>>       bool dgpu_disable_available;
>>>>       bool dgpu_disable;
>>>> 
>>>>  @@ -430,6 +433,86 @@ static void 
>>>> \x7flid_flip_tablet_mode_get_state(struct asus_wmi *asus)
>>>>       }
>>>>   }
>>>> 
>>>>  +/* eGPU 
>>>> \x7f********************************************************************/
>>>>  +static int egpu_enable_check_present(struct asus_wmi *asus)
>>>>  +{
>>>>  +    u32 result;
>>>>  +    int err;
>>>>  +
>>>>  +    asus->egpu_enable_available = false;
>>>>  +
>>>>  +    err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_EGPU, 
>>>> &result);
>>>>  +    if (err) {
>>>>  +        if (err == -ENODEV)
>>>>  +            return 0;
>>>>  +        return err;
>>>>  +    }
>>>>  +
>>>>  +    if (result & ASUS_WMI_DSTS_PRESENCE_BIT) {
>>>>  +        asus->egpu_enable_available = true;
>>>>  +        asus->egpu_enable = result & ASUS_WMI_DSTS_STATUS_BIT;
>>>>  +    }
>>>>  +
>>>>  +    return 0;
>>>>  +}
>>>>  +
>>>>  +static int egpu_enable_write(struct asus_wmi *asus)
>>>>  +{
>>>>  +    int err;
>>>>  +    u8 value;
>>>>  +    u32 retval;
>>>>  +
>>>>  +    value = asus->egpu_enable;
>>>>  +
>>>>  +    err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, value, 
>>>> &retval);
>>>>  +
>>>>  +    if (err) {
>>>>  +        pr_warn("Failed to set egpu disable: %d\n", err);
>>>>  +        return err;
>>>>  +    }
>>>>  +
>>>>  +    if (retval > 1 || retval < 0) {
>>>>  +        pr_warn("Failed to set egpu disable (retval): 0x%x\n", 
>>>> retval);
>>>>  +        return -EIO;
>>>>  +    }
>>>>  +
>>>>  +    sysfs_notify(&asus->platform_device->dev.kobj, NULL, 
>>>> "egpu_enable");
>>>>  +
>>>>  +    return 0;
>>>>  +}
>>>>  +
>>>>  +static ssize_t egpu_enable_show(struct device *dev,
>>>>  +                   struct device_attribute *attr, char *buf)
>>>>  +{
>>>>  +    struct asus_wmi *asus = dev_get_drvdata(dev);
>>>>  +    bool mode = asus->egpu_enable;
>>>>  +
>>>>  +    return sysfs_emit(buf, "%d\n", mode);
>>>>  +}
>>>>  +
>>>>  +static ssize_t egpu_enable_store(struct device *dev,
>>>>  +                    struct device_attribute *attr,
>>>>  +                    const char *buf, size_t count)
>>>>  +{
>>>>  +    int result;
>>>>  +    bool disable;
>>>>  +    struct asus_wmi *asus = dev_get_drvdata(dev);
>>>>  +
>>>>  +    result = kstrtobool(buf, &disable);
>>>>  +    if (result == -EINVAL)
>>>>  +        return result;
>>>>  +
>>>>  +    asus->egpu_enable = disable;
>>>>  +
>>>>  +    result = egpu_enable_write(asus);
>>>>  +    if (result != 0)
>>>>  +        return result;
>>>>  +
>>>>  +    return count;
>>>>  +}
>>>>  +
>>>>  +static DEVICE_ATTR_RW(egpu_enable);
>>>>  +
>>>>   /* dGPU 
>>>> \x7f********************************************************************/
>>>>   static int dgpu_disable_check_present(struct asus_wmi *asus)
>>>>   {
>>>>  @@ -2502,6 +2585,7 @@ static struct attribute 
>>>> *platform_attributes[] \x7f= {
>>>>       &dev_attr_camera.attr,
>>>>       &dev_attr_cardr.attr,
>>>>       &dev_attr_touchpad.attr,
>>>>  +    &dev_attr_egpu_enable.attr,
>>>>       &dev_attr_dgpu_disable.attr,
>>>>       &dev_attr_lid_resume.attr,
>>>>       &dev_attr_als_enable.attr,
>>>>  @@ -2529,6 +2613,8 @@ static umode_t asus_sysfs_is_visible(struct 
>>>> \x7fkobject *kobj,
>>>>           devid = ASUS_WMI_DEVID_LID_RESUME;
>>>>       else if (attr == &dev_attr_als_enable.attr)
>>>>           devid = ASUS_WMI_DEVID_ALS_ENABLE;
>>>>  +    else if (attr == &dev_attr_egpu_enable.attr)
>>>>  +        ok = asus->egpu_enable_available;
>>>>       else if (attr == &dev_attr_dgpu_disable.attr)
>>>>           ok = asus->dgpu_disable_available;
>>>>       else if (attr == &dev_attr_fan_boost_mode.attr)
>>>>  @@ -2792,6 +2878,10 @@ static int asus_wmi_add(struct 
>>>> platform_device \x7f*pdev)
>>>>       if (err)
>>>>           goto fail_platform;
>>>> 
>>>>  +    err = egpu_enable_check_present(asus);
>>>>  +    if (err)
>>>>  +        goto fail_egpu_enable;
>>>>  +
>>>>       err = dgpu_disable_check_present(asus);
>>>>       if (err)
>>>>           goto fail_dgpu_disable;
>>>>  @@ -2896,6 +2986,7 @@ static int asus_wmi_add(struct 
>>>> platform_device \x7f*pdev)
>>>>   fail_sysfs:
>>>>   fail_throttle_thermal_policy:
>>>>   fail_fan_boost_mode:
>>>>  +fail_egpu_enable:
>>>>   fail_dgpu_disable:
>>>>   fail_platform:
>>>>   fail_panel_od:
>>>>  diff --git a/include/linux/platform_data/x86/asus-wmi.h 
>>>> \x7fb/include/linux/platform_data/x86/asus-wmi.h
>>>>  index a528f9d0e4b7..17dc5cb6f3f2 100644
>>>>  --- a/include/linux/platform_data/x86/asus-wmi.h
>>>>  +++ b/include/linux/platform_data/x86/asus-wmi.h
>>>>  @@ -90,6 +90,9 @@
>>>>   /* Keyboard dock */
>>>>   #define ASUS_WMI_DEVID_KBD_DOCK        0x00120063
>>>> 
>>>>  +/* dgpu on/off */
>>>>  +#define ASUS_WMI_DEVID_EGPU        0x00090019
>>>>  +
>>>>   /* dgpu on/off */
>>>>   #define ASUS_WMI_DEVID_DGPU        0x00090020
>>>> 
>>>>  --
>>>>  2.31.1
>>>> 
>>> 
>> 
>> 
> 



  reply	other threads:[~2021-07-24 11:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-17  8:13 [PATCH 1/4] asus-wmi: Add panel overdrive functionality Luke D. Jones
2021-07-17  8:13 ` [PATCH 2/4] asus-wmi: Add dgpu disable method Luke D. Jones
2021-07-17 16:05   ` Hans de Goede
2021-07-24 11:37     ` Luke Jones
2021-08-02 10:55       ` Hans de Goede
2021-07-17  8:13 ` [PATCH 3/4] asus-wmi: Add egpu enable method Luke D. Jones
2021-07-17  8:15   ` Luke Jones
2021-07-17  8:19     ` Luke Jones
2021-07-17 15:57       ` Hans de Goede
2021-07-24 11:15         ` Luke Jones [this message]
2021-07-17 16:05   ` Hans de Goede
2021-07-17 16:00 ` [PATCH 1/4] asus-wmi: Add panel overdrive functionality Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EYXQWQ.O2RLFGQXKOHO2@ljones.dev \
    --to=luke@ljones.dev \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=corentin.chary@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).