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

Input: melfas_mip4 - add hw_version sysfs attribute

Add hw_version sysfs attribute for retrieving hardware information
from firmware.

Signed-off-by: Sangwon Jee <jeesw@melfas.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Sangwon Jee and committed by
Dmitry Torokhov
9aa40426 4d2508a5

+27 -1
+27 -1
drivers/input/touchscreen/melfas_mip4.c
··· 1310 1310 1311 1311 static DEVICE_ATTR(fw_version, S_IRUGO, mip4_sysfs_read_fw_version, NULL); 1312 1312 1313 + static ssize_t mip4_sysfs_read_hw_version(struct device *dev, 1314 + struct device_attribute *attr, 1315 + char *buf) 1316 + { 1317 + struct i2c_client *client = to_i2c_client(dev); 1318 + struct mip4_ts *ts = i2c_get_clientdata(client); 1319 + size_t count; 1320 + 1321 + /* Take lock to prevent racing with firmware update */ 1322 + mutex_lock(&ts->input->mutex); 1323 + 1324 + /* 1325 + * product_name shows the name or version of the hardware 1326 + * paired with current firmware in the chip. 1327 + */ 1328 + count = snprintf(buf, PAGE_SIZE, "%.*s\n", 1329 + (int)sizeof(ts->product_name), ts->product_name); 1330 + 1331 + mutex_unlock(&ts->input->mutex); 1332 + 1333 + return count; 1334 + } 1335 + 1336 + static DEVICE_ATTR(hw_version, S_IRUGO, mip4_sysfs_read_hw_version, NULL); 1337 + 1313 1338 static struct attribute *mip4_attrs[] = { 1314 1339 &dev_attr_fw_version.attr, 1340 + &dev_attr_hw_version.attr, 1315 1341 &dev_attr_update_fw.attr, 1316 1342 NULL, 1317 1343 }; ··· 1538 1512 module_i2c_driver(mip4_driver); 1539 1513 1540 1514 MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen"); 1541 - MODULE_VERSION("2016.03.03"); 1515 + MODULE_VERSION("2016.03.12"); 1542 1516 MODULE_AUTHOR("Sangwon Jee <jeesw@melfas.com>"); 1543 1517 MODULE_LICENSE("GPL");