diff options
-rw-r--r-- | drivers/input/touchscreen/melfas_mip4.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index fb5fb9140ca9..552a3773f79d 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c | |||
@@ -157,6 +157,7 @@ struct mip4_ts { | |||
157 | 157 | ||
158 | char phys[32]; | 158 | char phys[32]; |
159 | char product_name[16]; | 159 | char product_name[16]; |
160 | char ic_name[4]; | ||
160 | 161 | ||
161 | unsigned int max_x; | 162 | unsigned int max_x; |
162 | unsigned int max_y; | 163 | unsigned int max_y; |
@@ -263,6 +264,18 @@ static int mip4_query_device(struct mip4_ts *ts) | |||
263 | dev_dbg(&ts->client->dev, "product name: %.*s\n", | 264 | dev_dbg(&ts->client->dev, "product name: %.*s\n", |
264 | (int)sizeof(ts->product_name), ts->product_name); | 265 | (int)sizeof(ts->product_name), ts->product_name); |
265 | 266 | ||
267 | /* IC name */ | ||
268 | cmd[0] = MIP4_R0_INFO; | ||
269 | cmd[1] = MIP4_R1_INFO_IC_NAME; | ||
270 | error = mip4_i2c_xfer(ts, cmd, sizeof(cmd), | ||
271 | ts->ic_name, sizeof(ts->ic_name)); | ||
272 | if (error) | ||
273 | dev_warn(&ts->client->dev, | ||
274 | "Failed to retrieve IC name: %d\n", error); | ||
275 | else | ||
276 | dev_dbg(&ts->client->dev, "IC name: %.*s\n", | ||
277 | (int)sizeof(ts->ic_name), ts->ic_name); | ||
278 | |||
266 | /* Firmware version */ | 279 | /* Firmware version */ |
267 | error = mip4_get_fw_version(ts); | 280 | error = mip4_get_fw_version(ts); |
268 | if (error) | 281 | if (error) |
@@ -1326,7 +1339,7 @@ static ssize_t mip4_sysfs_read_hw_version(struct device *dev, | |||
1326 | * paired with current firmware in the chip. | 1339 | * paired with current firmware in the chip. |
1327 | */ | 1340 | */ |
1328 | count = snprintf(buf, PAGE_SIZE, "%.*s\n", | 1341 | count = snprintf(buf, PAGE_SIZE, "%.*s\n", |
1329 | (int)sizeof(ts->product_name), ts->product_name); | 1342 | (int)sizeof(ts->product_name), ts->product_name); |
1330 | 1343 | ||
1331 | mutex_unlock(&ts->input->mutex); | 1344 | mutex_unlock(&ts->input->mutex); |
1332 | 1345 | ||
@@ -1335,9 +1348,30 @@ static ssize_t mip4_sysfs_read_hw_version(struct device *dev, | |||
1335 | 1348 | ||
1336 | static DEVICE_ATTR(hw_version, S_IRUGO, mip4_sysfs_read_hw_version, NULL); | 1349 | static DEVICE_ATTR(hw_version, S_IRUGO, mip4_sysfs_read_hw_version, NULL); |
1337 | 1350 | ||
1351 | static ssize_t mip4_sysfs_read_ic_name(struct device *dev, | ||
1352 | struct device_attribute *attr, | ||
1353 | char *buf) | ||
1354 | { | ||
1355 | struct i2c_client *client = to_i2c_client(dev); | ||
1356 | struct mip4_ts *ts = i2c_get_clientdata(client); | ||
1357 | size_t count; | ||
1358 | |||
1359 | mutex_lock(&ts->input->mutex); | ||
1360 | |||
1361 | count = snprintf(buf, PAGE_SIZE, "%.*s\n", | ||
1362 | (int)sizeof(ts->ic_name), ts->ic_name); | ||
1363 | |||
1364 | mutex_unlock(&ts->input->mutex); | ||
1365 | |||
1366 | return count; | ||
1367 | } | ||
1368 | |||
1369 | static DEVICE_ATTR(ic_name, S_IRUGO, mip4_sysfs_read_ic_name, NULL); | ||
1370 | |||
1338 | static struct attribute *mip4_attrs[] = { | 1371 | static struct attribute *mip4_attrs[] = { |
1339 | &dev_attr_fw_version.attr, | 1372 | &dev_attr_fw_version.attr, |
1340 | &dev_attr_hw_version.attr, | 1373 | &dev_attr_hw_version.attr, |
1374 | &dev_attr_ic_name.attr, | ||
1341 | &dev_attr_update_fw.attr, | 1375 | &dev_attr_update_fw.attr, |
1342 | NULL, | 1376 | NULL, |
1343 | }; | 1377 | }; |
@@ -1538,6 +1572,6 @@ static struct i2c_driver mip4_driver = { | |||
1538 | module_i2c_driver(mip4_driver); | 1572 | module_i2c_driver(mip4_driver); |
1539 | 1573 | ||
1540 | MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen"); | 1574 | MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen"); |
1541 | MODULE_VERSION("2016.03.12"); | 1575 | MODULE_VERSION("2016.09.28"); |
1542 | MODULE_AUTHOR("Sangwon Jee <jeesw@melfas.com>"); | 1576 | MODULE_AUTHOR("Sangwon Jee <jeesw@melfas.com>"); |
1543 | MODULE_LICENSE("GPL"); | 1577 | MODULE_LICENSE("GPL"); |