Commit b3ed1b7f authored by Barnabás Pőcze's avatar Barnabás Pőcze Committed by Hans de Goede

platform/x86: ideapad-laptop: check for touchpad support in _CFG

Bit 30 of _CFG is set if the device has a touchpad, check that
in is_visible() for the touchpad attribute. Show 'touchpad', if
supported, in the list of capabilities in the 'cfg' debugfs file.
Signed-off-by: default avatarBarnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210203215403.290792-21-pobrn@protonmail.comSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 392cbf0a
...@@ -41,10 +41,11 @@ static const char *const ideapad_wmi_fnesc_events[] = { ...@@ -41,10 +41,11 @@ static const char *const ideapad_wmi_fnesc_events[] = {
#endif #endif
enum { enum {
CFG_CAP_BT_BIT = 16, CFG_CAP_BT_BIT = 16,
CFG_CAP_3G_BIT = 17, CFG_CAP_3G_BIT = 17,
CFG_CAP_WIFI_BIT = 18, CFG_CAP_WIFI_BIT = 18,
CFG_CAP_CAM_BIT = 19, CFG_CAP_CAM_BIT = 19,
CFG_CAP_TOUCHPAD_BIT = 30,
}; };
enum { enum {
...@@ -337,6 +338,8 @@ static int debugfs_cfg_show(struct seq_file *s, void *data) ...@@ -337,6 +338,8 @@ static int debugfs_cfg_show(struct seq_file *s, void *data)
seq_printf(s, "Wireless "); seq_printf(s, "Wireless ");
if (test_bit(CFG_CAP_CAM_BIT, &priv->cfg)) if (test_bit(CFG_CAP_CAM_BIT, &priv->cfg))
seq_printf(s, "Camera "); seq_printf(s, "Camera ");
if (test_bit(CFG_CAP_TOUCHPAD_BIT, &priv->cfg))
seq_printf(s, "Touchpad ");
seq_printf(s, "\nGraphic: "); seq_printf(s, "\nGraphic: ");
switch ((priv->cfg)&0x700) { switch ((priv->cfg)&0x700) {
case 0x100: case 0x100:
...@@ -579,7 +582,8 @@ static umode_t ideapad_is_visible(struct kobject *kobj, ...@@ -579,7 +582,8 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
else if (attr == &dev_attr_fn_lock.attr) else if (attr == &dev_attr_fn_lock.attr)
supported = priv->features.fn_lock; supported = priv->features.fn_lock;
else if (attr == &dev_attr_touchpad.attr) else if (attr == &dev_attr_touchpad.attr)
supported = priv->features.touchpad_ctrl_via_ec; supported = priv->features.touchpad_ctrl_via_ec &&
test_bit(CFG_CAP_TOUCHPAD_BIT, &priv->cfg);
return supported ? attr->mode : 0; return supported ? attr->mode : 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment