Input: edt-ft5x06 - show model name by sysfs
authorDario Binacchi <dario.binacchi@amarulasolutions.com>
Tue, 28 Jun 2022 17:57:15 +0000 (10:57 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 29 Jun 2022 05:00:01 +0000 (22:00 -0700)
The model name was printed only if debug mode was enabled. Now you can
always get it from sysfs.

Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Acked-by: Oliver Graute <oliver.graute@kococonnector.com>
Link: https://lore.kernel.org/r/20220621123937.1330389-5-dario.binacchi@amarulasolutions.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/edt-ft5x06.c

index 8c99819a50a4e7972c13b0b846eab32bda215a79..e04d558456fbc8e8df69650eb634221517bd4f40 100644 (file)
@@ -530,6 +530,17 @@ static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD,
 static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE,
                M12_REGISTER_REPORT_RATE, NO_REGISTER, 0, 255);
 
+static ssize_t model_show(struct device *dev, struct device_attribute *attr,
+                         char *buf)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
+
+       return sysfs_emit(buf, "%s\n", tsdata->name);
+}
+
+static DEVICE_ATTR_RO(model);
+
 static struct attribute *edt_ft5x06_attrs[] = {
        &edt_ft5x06_attr_gain.dattr.attr,
        &edt_ft5x06_attr_offset.dattr.attr,
@@ -537,6 +548,7 @@ static struct attribute *edt_ft5x06_attrs[] = {
        &edt_ft5x06_attr_offset_y.dattr.attr,
        &edt_ft5x06_attr_threshold.dattr.attr,
        &edt_ft5x06_attr_report_rate.dattr.attr,
+       &dev_attr_model.attr,
        NULL
 };