diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2021-03-07 21:40:37 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2021-03-07 21:56:50 -0800 |
commit | ad117c558e838f9fa93af265d8f9dd54e87e15b1 (patch) | |
tree | 0ed6d7f87659eb3d86dbca6f32ba4b3b2527a934 /drivers/input/touchscreen | |
parent | c929ac9eb85acf9217eb812369bbd4cf65a772e0 (diff) |
Input: exc3000 - add type sysfs attribute
Add a sysfs attribute to query the type of the touchscreen device.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://lore.kernel.org/r/20210125182527.1225245-5-l.stach@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/exc3000.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/exc3000.c b/drivers/input/touchscreen/exc3000.c index 66682a0c37d7..cbe0dd412912 100644 --- a/drivers/input/touchscreen/exc3000.c +++ b/drivers/input/touchscreen/exc3000.c @@ -301,9 +301,26 @@ static ssize_t model_show(struct device *dev, } static DEVICE_ATTR_RO(model); +static ssize_t type_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct exc3000_data *data = i2c_get_clientdata(client); + u8 response[EXC3000_LEN_FRAME]; + int ret; + + ret = exc3000_vendor_data_request(data, (u8[]){'F'}, 1, response, 1); + if (ret < 0) + return ret; + + return sprintf(buf, "%s\n", &response[1]); +} +static DEVICE_ATTR_RO(type); + static struct attribute *sysfs_attrs[] = { &dev_attr_fw_version.attr, &dev_attr_model.attr, + &dev_attr_type.attr, NULL }; |