Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: st1232 - expose firmware version via sysfs

Allow user space programs to read the firmware version and revision of
the touch controller from the sysfs.

Suggested-by: Khalid Talash <ktalash@topcon.com>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Link: https://patch.msgid.link/20260123-input-st1232-firmware-version-v1-2-32df7eefdafe@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Michael Tretter and committed by
Dmitry Torokhov
ffcdb685 004703ba

+29
+29
drivers/input/touchscreen/st1232.c
··· 69 69 u32 fw_revision; 70 70 }; 71 71 72 + static ssize_t fw_version_show(struct device *dev, 73 + struct device_attribute *attr, char *buf) 74 + { 75 + struct i2c_client *client = to_i2c_client(dev); 76 + struct st1232_ts_data *st1232_ts = i2c_get_clientdata(client); 77 + 78 + return sysfs_emit(buf, "%u\n", st1232_ts->fw_version); 79 + } 80 + 81 + static ssize_t fw_revision_show(struct device *dev, 82 + struct device_attribute *attr, char *buf) 83 + { 84 + struct i2c_client *client = to_i2c_client(dev); 85 + struct st1232_ts_data *st1232_ts = i2c_get_clientdata(client); 86 + 87 + return sysfs_emit(buf, "%08x\n", st1232_ts->fw_revision); 88 + } 89 + 90 + static DEVICE_ATTR_RO(fw_version); 91 + static DEVICE_ATTR_RO(fw_revision); 92 + 93 + static struct attribute *st1232_attrs[] = { 94 + &dev_attr_fw_version.attr, 95 + &dev_attr_fw_revision.attr, 96 + NULL, 97 + }; 98 + ATTRIBUTE_GROUPS(st1232); 99 + 72 100 static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg, 73 101 unsigned int n) 74 102 { ··· 472 444 .driver = { 473 445 .name = ST1232_TS_NAME, 474 446 .of_match_table = st1232_ts_dt_ids, 447 + .dev_groups = st1232_groups, 475 448 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 476 449 .pm = pm_sleep_ptr(&st1232_ts_pm_ops), 477 450 },