Skip to contentSkip to conversation

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

PATCH Superseded Barnabás Pőcze 1 participant 1 message Jan 13, 2021 x86 platform drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 15/24 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.

drivers/platform/x86/ideapad-laptop.c +9 -5
index 640a00cc3944..057426729536 100644
@@ -40,10 +40,11 @@ static const char *const ideapad_wmi_fnesc_events[] = {
 #endif
 
 enum {
-	CFG_CAP_BT_BIT   = 16,
-	CFG_CAP_3G_BIT   = 17,
-	CFG_CAP_WIFI_BIT = 18,
-	CFG_CAP_CAM_BIT  = 19,
+	CFG_CAP_BT_BIT       = 16,
+	CFG_CAP_3G_BIT       = 17,
+	CFG_CAP_WIFI_BIT     = 18,
+	CFG_CAP_CAM_BIT      = 19,
+	CFG_CAP_TOUCHPAD_BIT = 30,
 };
 
 enum {
@@ -319,6 +320,8 @@ static int debugfs_cfg_show(struct seq_file *s, void *data)
 			seq_printf(s, "Wireless ");
 		if (test_bit(CFG_CAP_CAM_BIT, &priv->cfg))
 			seq_printf(s, "Camera ");
+		if (test_bit(CFG_CAP_TOUCHPAD_BIT, &priv->cfg))
+			seq_printf(s, "Touchpad ");
 		seq_printf(s, "\nGraphic: ");
 		switch ((priv->cfg)&0x700) {
 		case 0x100:
@@ -559,7 +562,8 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
 	else if (attr == &dev_attr_fan_mode.attr)
 		supported = priv->features.fan_mode;
 	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);
 	else if (attr == &dev_attr_conservation_mode.attr)
 		supported = priv->features.conservation_mode;
 	else if (attr == &dev_attr_fn_lock.attr)
Signature · 1 line
2.30.0