[PATCH v3 20/29] platform/x86: ideapad-laptop: check for touchpad support in _CFG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: Barnabás Pőcze <pobrn@xxxxxxxxxxxxxx>
Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 549e220ae05b..abb283cee47c 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -42,10 +42,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 {
@@ -338,6 +339,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:
@@ -582,7 +585,8 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
 	else if (attr == &dev_attr_fn_lock.attr)
 		supported = priv->features.fn_lock;
 	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;
 }
-- 
2.30.0






[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux