platform/x86: asus-wmi: Add support for ROG X13 tablet mode
[ Upstream commit e397c3c460bf3849384f2f55516d1887617cfca9 ] Add quirk for ASUS ROG X13 Flow 2-in-1 to enable tablet mode with lid flip (all screen rotations). Signed-off-by: Luke D. Jones <luke@ljones.dev> Link: https://lore.kernel.org/r/20220813092753.6635-2-luke@ljones.dev Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Stable-dep-of: b52cbca22cbf ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d7c3daa5bd
commit
f560afea63
4 changed files with 54 additions and 0 deletions
|
@ -123,6 +123,11 @@ static struct quirk_entry quirk_asus_use_lid_flip_devid = {
|
||||||
.tablet_switch_mode = asus_wmi_lid_flip_devid,
|
.tablet_switch_mode = asus_wmi_lid_flip_devid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct quirk_entry quirk_asus_tablet_mode = {
|
||||||
|
.wmi_backlight_set_devstate = true,
|
||||||
|
.tablet_switch_mode = asus_wmi_lid_flip_rog_devid,
|
||||||
|
};
|
||||||
|
|
||||||
static int dmi_matched(const struct dmi_system_id *dmi)
|
static int dmi_matched(const struct dmi_system_id *dmi)
|
||||||
{
|
{
|
||||||
pr_info("Identified laptop model '%s'\n", dmi->ident);
|
pr_info("Identified laptop model '%s'\n", dmi->ident);
|
||||||
|
@ -471,6 +476,15 @@ static const struct dmi_system_id asus_quirks[] = {
|
||||||
},
|
},
|
||||||
.driver_data = &quirk_asus_use_lid_flip_devid,
|
.driver_data = &quirk_asus_use_lid_flip_devid,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.callback = dmi_matched,
|
||||||
|
.ident = "ASUS ROG FLOW X13",
|
||||||
|
.matches = {
|
||||||
|
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
|
||||||
|
DMI_MATCH(DMI_PRODUCT_NAME, "GV301Q"),
|
||||||
|
},
|
||||||
|
.driver_data = &quirk_asus_tablet_mode,
|
||||||
|
},
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -581,6 +595,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
|
||||||
{ KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
|
{ KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
|
||||||
{ KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */
|
{ KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */
|
||||||
{ KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */
|
{ KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */
|
||||||
|
{ KE_KEY, 0xBD, { KEY_PROG2 } }, /* Lid flip action on ROG xflow laptops */
|
||||||
{ KE_END, 0},
|
{ KE_END, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ MODULE_LICENSE("GPL");
|
||||||
#define NOTIFY_KBD_FBM 0x99
|
#define NOTIFY_KBD_FBM 0x99
|
||||||
#define NOTIFY_KBD_TTP 0xae
|
#define NOTIFY_KBD_TTP 0xae
|
||||||
#define NOTIFY_LID_FLIP 0xfa
|
#define NOTIFY_LID_FLIP 0xfa
|
||||||
|
#define NOTIFY_LID_FLIP_ROG 0xbd
|
||||||
|
|
||||||
#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)
|
#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)
|
||||||
|
|
||||||
|
@ -397,6 +398,19 @@ static int asus_wmi_input_init(struct asus_wmi *asus)
|
||||||
dev_err(dev, "Error checking for lid-flip: %d\n", result);
|
dev_err(dev, "Error checking for lid-flip: %d\n", result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case asus_wmi_lid_flip_rog_devid:
|
||||||
|
result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP_ROG);
|
||||||
|
if (result < 0)
|
||||||
|
asus->driver->quirks->tablet_switch_mode = asus_wmi_no_tablet_switch;
|
||||||
|
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) {
|
||||||
|
dev_err(dev, "This device has lid-flip-rog quirk but got ENODEV checking it. This is a bug.");
|
||||||
|
} else {
|
||||||
|
dev_err(dev, "Error checking for lid-flip: %d\n", result);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = input_register_device(asus->inputdev);
|
err = input_register_device(asus->inputdev);
|
||||||
|
@ -431,6 +445,17 @@ static void lid_flip_tablet_mode_get_state(struct asus_wmi *asus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void lid_flip_rog_tablet_mode_get_state(struct asus_wmi *asus)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP_ROG);
|
||||||
|
if (result >= 0) {
|
||||||
|
input_report_switch(asus->inputdev, SW_TABLET_MODE, result);
|
||||||
|
input_sync(asus->inputdev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* dGPU ********************************************************************/
|
/* dGPU ********************************************************************/
|
||||||
static int dgpu_disable_check_present(struct asus_wmi *asus)
|
static int dgpu_disable_check_present(struct asus_wmi *asus)
|
||||||
{
|
{
|
||||||
|
@ -2261,6 +2286,12 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (asus->driver->quirks->tablet_switch_mode == asus_wmi_lid_flip_rog_devid &&
|
||||||
|
code == NOTIFY_LID_FLIP_ROG) {
|
||||||
|
lid_flip_rog_tablet_mode_get_state(asus);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (asus->fan_boost_mode_available && code == NOTIFY_KBD_FBM) {
|
if (asus->fan_boost_mode_available && code == NOTIFY_KBD_FBM) {
|
||||||
fan_boost_mode_switch_next(asus);
|
fan_boost_mode_switch_next(asus);
|
||||||
return;
|
return;
|
||||||
|
@ -2868,6 +2899,9 @@ static int asus_hotk_resume(struct device *device)
|
||||||
case asus_wmi_lid_flip_devid:
|
case asus_wmi_lid_flip_devid:
|
||||||
lid_flip_tablet_mode_get_state(asus);
|
lid_flip_tablet_mode_get_state(asus);
|
||||||
break;
|
break;
|
||||||
|
case asus_wmi_lid_flip_rog_devid:
|
||||||
|
lid_flip_rog_tablet_mode_get_state(asus);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2916,6 +2950,9 @@ static int asus_hotk_restore(struct device *device)
|
||||||
case asus_wmi_lid_flip_devid:
|
case asus_wmi_lid_flip_devid:
|
||||||
lid_flip_tablet_mode_get_state(asus);
|
lid_flip_tablet_mode_get_state(asus);
|
||||||
break;
|
break;
|
||||||
|
case asus_wmi_lid_flip_rog_devid:
|
||||||
|
lid_flip_rog_tablet_mode_get_state(asus);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -29,6 +29,7 @@ enum asus_wmi_tablet_switch_mode {
|
||||||
asus_wmi_no_tablet_switch,
|
asus_wmi_no_tablet_switch,
|
||||||
asus_wmi_kbd_dock_devid,
|
asus_wmi_kbd_dock_devid,
|
||||||
asus_wmi_lid_flip_devid,
|
asus_wmi_lid_flip_devid,
|
||||||
|
asus_wmi_lid_flip_rog_devid,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct quirk_entry {
|
struct quirk_entry {
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
/* Misc */
|
/* Misc */
|
||||||
#define ASUS_WMI_DEVID_CAMERA 0x00060013
|
#define ASUS_WMI_DEVID_CAMERA 0x00060013
|
||||||
#define ASUS_WMI_DEVID_LID_FLIP 0x00060062
|
#define ASUS_WMI_DEVID_LID_FLIP 0x00060062
|
||||||
|
#define ASUS_WMI_DEVID_LID_FLIP_ROG 0x00060077
|
||||||
|
|
||||||
/* Storage */
|
/* Storage */
|
||||||
#define ASUS_WMI_DEVID_CARDREADER 0x00080013
|
#define ASUS_WMI_DEVID_CARDREADER 0x00080013
|
||||||
|
|
Loading…
Add table
Reference in a new issue