platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360
PATCH v2 1/1 platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360
The UX360CA has a WMI device id 0x00060062, which reports whether the lid is flipped in tablet mode (1) or in normal laptop mode (0).
This commit adds a quirk (quirk_asus_use_lid_flip_devid) for devices on which this WMI device should be used to figure out the SW_TABLET_MODE state, as opposed to the quirk_asus_use_kbd_dock_devid.
It is assumed other UX360* models have the same WMI device. As such, the quirk is applied to devices with DMI_MATCH(DMI_PRODUCT_NAME, "UX360"). More devices with this feature need to be tested and added accordingly.
The reason for using a whitelist via the quirk mechanism is that the new WMI device (0x00060062) is also present on some models which do not have a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS collection) and therefore its presence cannot be relied on.
This patch is a followup to "platform/x86: asus-wmi: Fix SW_TABLET_MODE always reporting 1 on many different models" by Hans de Goede.
---
v1 -> v2:
- inherit wmi_backlight_set_devstate from default quirk
--- drivers/platform/x86/asus-nb-wmi.c | 15 +++++++++++++++ drivers/platform/x86/asus-wmi.c | 22 ++++++++++++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + include/linux/platform_data/x86/asus-wmi.h | 1 + 4 files changed, 39 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +15 -0
@@ -119,6 +119,11 @@ static struct quirk_entry quirk_asus_use_kbd_dock_devid = { .use_kbd_dock_devid = true, }; +static struct quirk_entry quirk_asus_use_lid_flip_devid = { + .wmi_backlight_set_devstate = true, + .use_lid_flip_devid = true, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);
@@ -520,6 +525,16 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_use_kbd_dock_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS ZenBook Flip UX360", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + /* Match UX360* */ + DMI_MATCH(DMI_PRODUCT_NAME, "UX360"), + }, + .driver_data = &quirk_asus_use_lid_flip_devid, + }, {}, };
drivers/platform/x86/asus-wmi.c +22 -0
@@ -63,6 +63,7 @@ MODULE_LICENSE("GPL");#define NOTIFY_KBD_BRTTOGGLE 0xc7#define NOTIFY_KBD_FBM 0x99#define NOTIFY_KBD_TTP 0xae +#define NOTIFY_LID_FLIP 0xfa#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)
@@ -375,6 +376,18 @@ static int asus_wmi_input_init(struct asus_wmi *asus) } } +if (asus->driver->quirks->use_lid_flip_devid) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_set_capability (asus->inputdev,EV_SW ,SW_TABLET_MODE ); +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); + }else if (result == -ENODEV ) { +pr_err ("This device has lid_flip quirk but got ENODEV checking it. This is a bug." ); + }else { +pr_err ("Error checking for lid-flip: %d\n" , result); + } + } + err =input_register_device (asus->inputdev);if (err) goto err_free_dev;
@@ -2127,6 +2140,15 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)return ; } +if (asus->driver->quirks->use_lid_flip_devid && code ==NOTIFY_LID_FLIP ) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); +input_sync (asus->inputdev); + } +return ; + } +if (asus->fan_boost_mode_available && code ==NOTIFY_KBD_FBM ) {fan_boost_mode_switch_next (asus);return ;
drivers/platform/x86/asus-wmi.h +1 -0
@@ -34,6 +34,7 @@ struct quirk_entry {bool wmi_backlight_set_devstate;bool wmi_force_als_set;bool use_kbd_dock_devid; +bool use_lid_flip_devid;int wapf;/* * For machines with AMD graphic chips, it will send out WMI event
include/linux/platform_data/x86/asus-wmi.h +1 -0
@@ -62,6 +62,7 @@/* Misc */ #define ASUS_WMI_DEVID_CAMERA 0x00060013 +#define ASUS_WMI_DEVID_LID_FLIP 0x00060062/* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013
Signature · 1 line
2.28.0
Hi,
Quoted 19 lines · Samuel Čavoj
The UX360CA has a WMI device id
0x00060062, which reports whether the lid is flipped in tablet mode (1) or in normal laptop mode (0).This commit adds a quirk (
quirk_asus_use_lid_flip_devid) for devices on which this WMI device should be used to figure out theSW_TABLET_MODEstate, as opposed to thequirk_asus_use_kbd_dock_devid.It is assumed other UX360* models have the same WMI device. As such, the quirk is applied to devices with
DMI_MATCH(DMI_PRODUCT_NAME, "UX360"). More devices with this feature need to be tested and added accordingly.The reason for using a whitelist via the quirk mechanism is that the new WMI device (
0x00060062) is also present on some models which do not have a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS collection) and therefore its presence cannot be relied on.This patch is a followup to "platform/x86: asus-wmi: Fix
SW_TABLET_MODEalways reporting 1 on many different models" by Hans de Goede.
Quoted 6 lines
Signed-off-by Samuel Čavoj <[email protected]>Cc Hans de Goede <[email protected]>---
v1 -> v2:
- inheritwmi_backlight_set_devstatefrom default quirk
v2 looks good to me:
Regards,
Hans
Quoted 113 lines
--- drivers/platform/x86/asus-nb-wmi.c | 15 +++++++++++++++ drivers/platform/x86/asus-wmi.c | 22 ++++++++++++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + include/linux/platform_data/x86/asus-wmi.h | 1 + 4 files changed, 39 insertions(+)drivers/platform/x86/asus-nb-wmi.c +15
-0@@ -119,6 +119,11 @@ static struct quirk_entry quirk_asus_use_kbd_dock_devid = { .use_kbd_dock_devid = true, }; +static struct quirk_entry quirk_asus_use_lid_flip_devid = { + .wmi_backlight_set_devstate = true, + .use_lid_flip_devid = true, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);@@ -520,6 +525,16 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_use_kbd_dock_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS ZenBook Flip UX360", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + /* Match UX360* */ + DMI_MATCH(DMI_PRODUCT_NAME, "UX360"), + }, + .driver_data = &quirk_asus_use_lid_flip_devid, + }, {}, };drivers/platform/x86/asus-wmi.c +22
-0@@ -63,6 +63,7 @@ MODULE_LICENSE("GPL");#define NOTIFY_KBD_BRTTOGGLE 0xc7#define NOTIFY_KBD_FBM 0x99#define NOTIFY_KBD_TTP 0xae +#define NOTIFY_LID_FLIP 0xfa#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)@@ -375,6 +376,18 @@ static int asus_wmi_input_init(struct asus_wmi *asus) } } +if (asus->driver->quirks->use_lid_flip_devid) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_set_capability (asus->inputdev,EV_SW ,SW_TABLET_MODE ); +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); + }else if (result == -ENODEV ) { +pr_err ("This device has lid_flip quirk but got ENODEV checking it. This is a bug." ); + }else { +pr_err ("Error checking for lid-flip: %d\n" , result); + } + } + err =input_register_device (asus->inputdev);if (err) goto err_free_dev;@@ -2127,6 +2140,15 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)return ; } +if (asus->driver->quirks->use_lid_flip_devid && code ==NOTIFY_LID_FLIP ) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); +input_sync (asus->inputdev); + } +return ; + } +if (asus->fan_boost_mode_available && code ==NOTIFY_KBD_FBM ) {fan_boost_mode_switch_next (asus);return ;drivers/platform/x86/asus-wmi.h +1
-0@@ -34,6 +34,7 @@ struct quirk_entry {bool wmi_backlight_set_devstate;bool wmi_force_als_set;bool use_kbd_dock_devid; +bool use_lid_flip_devid;int wapf;/* * For machines with AMD graphic chips, it will send out WMI event include/linux/platform_data/x86/asus-wmi.h +1
-0@@ -62,6 +62,7 @@/* Misc */ #define ASUS_WMI_DEVID_CAMERA 0x00060013 +#define ASUS_WMI_DEVID_LID_FLIP 0x00060062/* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013
Hello everyone.
Quoted 19 lines · Samuel Čavoj
The UX360CA has a WMI device id
0x00060062, which reports whether the lid is flipped in tablet mode (1) or in normal laptop mode (0).This commit adds a quirk (
quirk_asus_use_lid_flip_devid) for devices on which this WMI device should be used to figure out theSW_TABLET_MODEstate, as opposed to thequirk_asus_use_kbd_dock_devid.It is assumed other UX360* models have the same WMI device. As such, the quirk is applied to devices with
DMI_MATCH(DMI_PRODUCT_NAME, "UX360"). More devices with this feature need to be tested and added accordingly.The reason for using a whitelist via the quirk mechanism is that the new WMI device (
0x00060062) is also present on some models which do not have a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS collection) and therefore its presence cannot be relied on.This patch is a followup to "platform/x86: asus-wmi: Fix
SW_TABLET_MODEalways reporting 1 on many different models" by Hans de Goede.
Quoted 6 lines
Signed-off-by Samuel Čavoj <[email protected]>Cc Hans de Goede <[email protected]>---
v1 -> v2:
- inheritwmi_backlight_set_devstatefrom default quirk
I have realised that one shortcoming still remains: If the laptop is suspended while in tablet mode, flipped to normal mode during sleep and then awoken, no event is generated by the firmware. The SW_TABLET_MODE switch then stays enabled, with inputs not working until the user tries flipping it once again.
I suppose a simple check on resume would suffice. However, I am not sure if this is worth implementing as an update to this patch (i would like it to make the 5.10 merge window after all) or as a separate patch, if at all.
Opinions?
Thanks,
Sam
Quoted 115 lines
--- drivers/platform/x86/asus-nb-wmi.c | 15 +++++++++++++++ drivers/platform/x86/asus-wmi.c | 22 ++++++++++++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + include/linux/platform_data/x86/asus-wmi.h | 1 + 4 files changed, 39 insertions(+)drivers/platform/x86/asus-nb-wmi.c +15
-0@@ -119,6 +119,11 @@ static struct quirk_entry quirk_asus_use_kbd_dock_devid = { .use_kbd_dock_devid = true, }; +static struct quirk_entry quirk_asus_use_lid_flip_devid = { + .wmi_backlight_set_devstate = true, + .use_lid_flip_devid = true, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);@@ -520,6 +525,16 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_use_kbd_dock_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS ZenBook Flip UX360", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + /* Match UX360* */ + DMI_MATCH(DMI_PRODUCT_NAME, "UX360"), + }, + .driver_data = &quirk_asus_use_lid_flip_devid, + }, {}, };drivers/platform/x86/asus-wmi.c +22
-0@@ -63,6 +63,7 @@ MODULE_LICENSE("GPL");#define NOTIFY_KBD_BRTTOGGLE 0xc7#define NOTIFY_KBD_FBM 0x99#define NOTIFY_KBD_TTP 0xae +#define NOTIFY_LID_FLIP 0xfa#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)@@ -375,6 +376,18 @@ static int asus_wmi_input_init(struct asus_wmi *asus) } } +if (asus->driver->quirks->use_lid_flip_devid) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_set_capability (asus->inputdev,EV_SW ,SW_TABLET_MODE ); +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); + }else if (result == -ENODEV ) { +pr_err ("This device has lid_flip quirk but got ENODEV checking it. This is a bug." ); + }else { +pr_err ("Error checking for lid-flip: %d\n" , result); + } + } + err =input_register_device (asus->inputdev);if (err) goto err_free_dev;@@ -2127,6 +2140,15 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)return ; } +if (asus->driver->quirks->use_lid_flip_devid && code ==NOTIFY_LID_FLIP ) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); +input_sync (asus->inputdev); + } +return ; + } +if (asus->fan_boost_mode_available && code ==NOTIFY_KBD_FBM ) {fan_boost_mode_switch_next (asus);return ;drivers/platform/x86/asus-wmi.h +1
-0@@ -34,6 +34,7 @@ struct quirk_entry {bool wmi_backlight_set_devstate;bool wmi_force_als_set;bool use_kbd_dock_devid; +bool use_lid_flip_devid;int wapf;/* * For machines with AMD graphic chips, it will send out WMI event include/linux/platform_data/x86/asus-wmi.h +1
-0@@ -62,6 +62,7 @@/* Misc */ #define ASUS_WMI_DEVID_CAMERA 0x00060013 +#define ASUS_WMI_DEVID_LID_FLIP 0x00060062/* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013Signature · 1 line
2.28.0
Hi,
Quoted 35 lines · Samuel Čavoj
Hello everyone.
Quoted 19 lines · Samuel Čavoj
The UX360CA has a WMI device id
0x00060062, which reports whether the lid is flipped in tablet mode (1) or in normal laptop mode (0).This commit adds a quirk (
quirk_asus_use_lid_flip_devid) for devices on which this WMI device should be used to figure out theSW_TABLET_MODEstate, as opposed to thequirk_asus_use_kbd_dock_devid.It is assumed other UX360* models have the same WMI device. As such, the quirk is applied to devices with
DMI_MATCH(DMI_PRODUCT_NAME, "UX360"). More devices with this feature need to be tested and added accordingly.The reason for using a whitelist via the quirk mechanism is that the new WMI device (
0x00060062) is also present on some models which do not have a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS collection) and therefore its presence cannot be relied on.This patch is a followup to "platform/x86: asus-wmi: Fix
SW_TABLET_MODEalways reporting 1 on many different models" by Hans de Goede.Quoted 6 lines
Signed-off-by Samuel Čavoj <[email protected]>Cc Hans de Goede <[email protected]>---
v1 -> v2:
- inheritwmi_backlight_set_devstatefrom default quirkI have realised that one shortcoming still remains: If the laptop is suspended while in tablet mode, flipped to normal mode during sleep and then awoken, no event is generated by the firmware. The
SW_TABLET_MODEswitch then stays enabled, with inputs not working until the user tries flipping it once again.
Quoted 4 lines
I suppose a simple check on resume would suffice. However, I am not sure if this is worth implementing as an update to this patch (i would like it to make the 5.10 merge window after all) or as a separate patch, if at all.
First, in case you did not know I've taken over PDx86 maintainership from Andy starting this merge-window.
I'm afraid that it is too late for 5.10 anyways as the merge window for that is already open and I already sent out the pull-req. I'm sorry that your patch did not make it, but even though I knew the handover from Andy to me was coming I still ended up having not a whole lot of time to deal with the merge window, so some patches did not make it.
Quoted 1 line
Opinions?
Since this is not going to make 5.10 anyways it would be nice if you can post a new version which fixes the issue which you have found, so that we can get this supported (without the issue) in 5.11. As you point out yourself the correct thing to do here obviously is to re-check the state on resume.
Regards,
Hans
Quoted 115 lines
Quoted 114 lines
--- drivers/platform/x86/asus-nb-wmi.c | 15 +++++++++++++++ drivers/platform/x86/asus-wmi.c | 22 ++++++++++++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + include/linux/platform_data/x86/asus-wmi.h | 1 + 4 files changed, 39 insertions(+)drivers/platform/x86/asus-nb-wmi.c +15
-0@@ -119,6 +119,11 @@ static struct quirk_entry quirk_asus_use_kbd_dock_devid = { .use_kbd_dock_devid = true, }; +static struct quirk_entry quirk_asus_use_lid_flip_devid = { + .wmi_backlight_set_devstate = true, + .use_lid_flip_devid = true, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);@@ -520,6 +525,16 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_use_kbd_dock_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS ZenBook Flip UX360", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + /* Match UX360* */ + DMI_MATCH(DMI_PRODUCT_NAME, "UX360"), + }, + .driver_data = &quirk_asus_use_lid_flip_devid, + }, {}, };drivers/platform/x86/asus-wmi.c +22
-0@@ -63,6 +63,7 @@ MODULE_LICENSE("GPL");#define NOTIFY_KBD_BRTTOGGLE 0xc7#define NOTIFY_KBD_FBM 0x99#define NOTIFY_KBD_TTP 0xae +#define NOTIFY_LID_FLIP 0xfa#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)@@ -375,6 +376,18 @@ static int asus_wmi_input_init(struct asus_wmi *asus) } } +if (asus->driver->quirks->use_lid_flip_devid) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_set_capability (asus->inputdev,EV_SW ,SW_TABLET_MODE ); +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); + }else if (result == -ENODEV ) { +pr_err ("This device has lid_flip quirk but got ENODEV checking it. This is a bug." ); + }else { +pr_err ("Error checking for lid-flip: %d\n" , result); + } + } + err =input_register_device (asus->inputdev);if (err) goto err_free_dev;@@ -2127,6 +2140,15 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)return ; } +if (asus->driver->quirks->use_lid_flip_devid && code ==NOTIFY_LID_FLIP ) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); +input_sync (asus->inputdev); + } +return ; + } +if (asus->fan_boost_mode_available && code ==NOTIFY_KBD_FBM ) {fan_boost_mode_switch_next (asus);return ;drivers/platform/x86/asus-wmi.h +1
-0@@ -34,6 +34,7 @@ struct quirk_entry {bool wmi_backlight_set_devstate;bool wmi_force_als_set;bool use_kbd_dock_devid; +bool use_lid_flip_devid;int wapf;/* * For machines with AMD graphic chips, it will send out WMI event include/linux/platform_data/x86/asus-wmi.h +1
-0@@ -62,6 +62,7 @@/* Misc */ #define ASUS_WMI_DEVID_CAMERA 0x00060013 +#define ASUS_WMI_DEVID_LID_FLIP 0x00060062/* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013Signature · 1 line
2.28.0
Hi,
Quoted 38 lines · Hans de Goede
Hi,
Quoted 35 lines · Samuel Čavoj
Hello everyone.
Quoted 19 lines · Samuel Čavoj
The UX360CA has a WMI device id
0x00060062, which reports whether the lid is flipped in tablet mode (1) or in normal laptop mode (0).This commit adds a quirk (
quirk_asus_use_lid_flip_devid) for devices on which this WMI device should be used to figure out theSW_TABLET_MODEstate, as opposed to thequirk_asus_use_kbd_dock_devid.It is assumed other UX360* models have the same WMI device. As such, the quirk is applied to devices with
DMI_MATCH(DMI_PRODUCT_NAME, "UX360"). More devices with this feature need to be tested and added accordingly.The reason for using a whitelist via the quirk mechanism is that the new WMI device (
0x00060062) is also present on some models which do not have a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS collection) and therefore its presence cannot be relied on.This patch is a followup to "platform/x86: asus-wmi: Fix
SW_TABLET_MODEalways reporting 1 on many different models" by Hans de Goede.Quoted 6 lines
Signed-off-by Samuel Čavoj <[email protected]>Cc Hans de Goede <[email protected]>---
v1 -> v2:
- inheritwmi_backlight_set_devstatefrom default quirkI have realised that one shortcoming still remains: If the laptop is suspended while in tablet mode, flipped to normal mode during sleep and then awoken, no event is generated by the firmware. The
SW_TABLET_MODEswitch then stays enabled, with inputs not working until the user tries flipping it once again.
Quoted 7 lines
Quoted 4 lines
I suppose a simple check on resume would suffice. However, I am not sure if this is worth implementing as an update to this patch (i would like it to make the 5.10 merge window after all) or as a separate patch, if at all.
First, in case you did not know I've taken over PDx86 maintainership from Andy starting this merge-window.
Oh, I didn't catch that. I'm not really in the loop about things like this. And I somehow missed the [GIT PULL] when I went searching the lists for what the status is.
Quoted 3 lines
I'm afraid that it is too late for 5.10 anyways as the merge window for that is already open and I already sent out the pull-req. I'm sorry that your patch did not make it, but even though I knew the handover
That's alright, it's not that important to me, I don't really use the tablet mode at all. I'm glad your patch made it to 5.9 and -stable, as that's what fixed the issue in this case.
Quoted 10 lines
from Andy to me was coming I still ended up having not a whole lot of time to deal with the merge window, so some patches did not make it.
Quoted 1 line
Opinions?
Since this is not going to make 5.10 anyways it would be nice if you can post a new version which fixes the issue which you have found, so that we can get this supported (without the issue) in 5.11. As you point out yourself the correct thing to do here obviously is to re-check the state on resume.
Yeah, I will see what I can do.
Regards,
Sam
Quoted 122 lines
Regards,
Hans
Quoted 115 lines
Quoted 114 lines
--- drivers/platform/x86/asus-nb-wmi.c | 15 +++++++++++++++ drivers/platform/x86/asus-wmi.c | 22 ++++++++++++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + include/linux/platform_data/x86/asus-wmi.h | 1 + 4 files changed, 39 insertions(+)drivers/platform/x86/asus-nb-wmi.c +15
-0@@ -119,6 +119,11 @@ static struct quirk_entry quirk_asus_use_kbd_dock_devid = { .use_kbd_dock_devid = true, }; +static struct quirk_entry quirk_asus_use_lid_flip_devid = { + .wmi_backlight_set_devstate = true, + .use_lid_flip_devid = true, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);@@ -520,6 +525,16 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_use_kbd_dock_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS ZenBook Flip UX360", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + /* Match UX360* */ + DMI_MATCH(DMI_PRODUCT_NAME, "UX360"), + }, + .driver_data = &quirk_asus_use_lid_flip_devid, + }, {}, };drivers/platform/x86/asus-wmi.c +22
-0@@ -63,6 +63,7 @@ MODULE_LICENSE("GPL");#define NOTIFY_KBD_BRTTOGGLE 0xc7#define NOTIFY_KBD_FBM 0x99#define NOTIFY_KBD_TTP 0xae +#define NOTIFY_LID_FLIP 0xfa#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)@@ -375,6 +376,18 @@ static int asus_wmi_input_init(struct asus_wmi *asus) } } +if (asus->driver->quirks->use_lid_flip_devid) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_set_capability (asus->inputdev,EV_SW ,SW_TABLET_MODE ); +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); + }else if (result == -ENODEV ) { +pr_err ("This device has lid_flip quirk but got ENODEV checking it. This is a bug." ); + }else { +pr_err ("Error checking for lid-flip: %d\n" , result); + } + } + err =input_register_device (asus->inputdev);if (err) goto err_free_dev;@@ -2127,6 +2140,15 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)return ; } +if (asus->driver->quirks->use_lid_flip_devid && code ==NOTIFY_LID_FLIP ) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result >=0 ) { +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); +input_sync (asus->inputdev); + } +return ; + } +if (asus->fan_boost_mode_available && code ==NOTIFY_KBD_FBM ) {fan_boost_mode_switch_next (asus);return ;drivers/platform/x86/asus-wmi.h +1
-0@@ -34,6 +34,7 @@ struct quirk_entry {bool wmi_backlight_set_devstate;bool wmi_force_als_set;bool use_kbd_dock_devid; +bool use_lid_flip_devid;int wapf;/* * For machines with AMD graphic chips, it will send out WMI event include/linux/platform_data/x86/asus-wmi.h +1
-0@@ -62,6 +62,7 @@/* Misc */ #define ASUS_WMI_DEVID_CAMERA 0x00060013 +#define ASUS_WMI_DEVID_LID_FLIP 0x00060062/* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013Signature · 1 line
2.28.0