himax_v2_mmi: Add productinfo & buildid sys node

Adding sys node productinfo and
buildid in himax driver.
Node gives chip name and FW version information.

Test ID:https://dalek.mot.com/browse/KERNEL-390991
cat /sys/devices/platform/soc/4a88000.spi/spi_master/spi0/spi0.0/buildid
cat /sys/devices/platform/soc/4a88000.spi/spi_master/spi0/spi0.0/productinfo

NO_PROP_NEEDED

Change-Id: Idc9a005d10050aa7dc3668a9de4826f053901a67
Signed-off-by: shourieg <shourieg@motorola.com>
Reviewed-on: https://gerrit.mot.com/1631276
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Marcos Sassahara <msassaha@motorola.com>
Reviewed-by: Yeqing Wang <wangyq13@motorola.com>
Reviewed-by: Hujun Liao <liaohj@motorola.com>
Submit-Approved: Jira Key
Reviewed-by: Jun Weng <wengjun1@motorola.com>
This commit is contained in:
shourieg 2020-06-19 19:46:32 +05:30
commit a705267292

View file

@ -3306,6 +3306,34 @@ static void himax_fb_register(struct work_struct *work)
E("Unable to register fb_notifier: %d\n", ret);
}
#endif
static ssize_t himax_productinfo_show(
struct device *dev, struct device_attribute *attr, char *buf)
{
struct himax_ts_data *ts = dev_get_drvdata(dev);
if (!ts) {
pr_err("cannot get himax_ts_data pointer\n");
return (ssize_t)0;
}
return scnprintf(buf, PAGE_SIZE, "%s\n", ts->chip_name);
}
static ssize_t buildid_show(
struct device *dev, struct device_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, "0x%2.2X\n",ic_data->vendor_fw_ver);
}
static DEVICE_ATTR(buildid, S_IRUGO, buildid_show, NULL);
static DEVICE_ATTR(productinfo, S_IRUGO, himax_productinfo_show, NULL);
static struct attribute *himax_attributes[] = {
&dev_attr_buildid.attr,
&dev_attr_productinfo.attr,
NULL
};
static struct attribute_group himax_attribute_group = {
.attrs = himax_attributes
};
#include <linux/major.h>
#include <linux/kdev_t.h>
@ -3408,6 +3436,24 @@ device_destroy:
return -ENODEV;
}
int himax_create_sysfs(struct himax_ts_data *ts_data)
{
int ret = 0;
ret = sysfs_create_group(&ts_data->dev->kobj, &himax_attribute_group);
if (ret) {
E("[EX]: sysfs_create_group() failed!!");
sysfs_remove_group(&ts_data->dev->kobj, &himax_attribute_group);
return -ENOMEM;
}
return ret;
}
int himax_remove_sysfs(struct himax_ts_data *ts_data)
{
sysfs_remove_group(&ts_data->dev->kobj, &himax_attribute_group);
return 0;
}
#if defined(HX_USB_DETECT_GLOBAL)
static int charger_notifier_callback(struct notifier_block *nb,
unsigned long val, void *v) {
@ -3734,6 +3780,10 @@ FW_force_upgrade:
E(" %s: himax_common proc_init failed!\n", __func__);
goto err_creat_proc_file_failed;
}
err = himax_create_sysfs(ts);
if (err) {
E(" %s: create sysfs node fail!\n", __func__);
}
himax_sysfs_touchscreen(ts, true);
#if defined(HX_USB_DETECT_CALLBACK)
@ -3846,6 +3896,7 @@ void himax_chip_common_deinit(void)
himax_ts_unregister_interrupt();
himax_remove_sysfs(ts);
himax_sysfs_touchscreen(ts, false);
#ifdef CONFIG_TOUCHSCREEN_HIMAX_INSPECT