提交 480343dc 编写于 作者: D Dario Binacchi 提交者: Dmitry Torokhov

Input: edt-ft5x06 - show firmware version by sysfs

The firmware version was printed only if debug mode was enabled. Now you
can always get it from sysfs.
Co-developed-by: NMichael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: NMichael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: NDario Binacchi <dario.binacchi@amarulasolutions.com>
Acked-by: NOliver Graute <oliver.graute@kococonnector.com>
Link: https://lore.kernel.org/r/20220621123937.1330389-6-dario.binacchi@amarulasolutions.comSigned-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 60790a58
...@@ -130,6 +130,7 @@ struct edt_ft5x06_ts_data { ...@@ -130,6 +130,7 @@ struct edt_ft5x06_ts_data {
int max_support_points; int max_support_points;
char name[EDT_NAME_LEN]; char name[EDT_NAME_LEN];
char fw_version[EDT_NAME_LEN];
struct edt_reg_addr reg_addr; struct edt_reg_addr reg_addr;
enum edt_ver version; enum edt_ver version;
...@@ -541,6 +542,17 @@ static ssize_t model_show(struct device *dev, struct device_attribute *attr, ...@@ -541,6 +542,17 @@ static ssize_t model_show(struct device *dev, struct device_attribute *attr,
static DEVICE_ATTR_RO(model); static DEVICE_ATTR_RO(model);
static ssize_t fw_version_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->fw_version);
}
static DEVICE_ATTR_RO(fw_version);
static struct attribute *edt_ft5x06_attrs[] = { static struct attribute *edt_ft5x06_attrs[] = {
&edt_ft5x06_attr_gain.dattr.attr, &edt_ft5x06_attr_gain.dattr.attr,
&edt_ft5x06_attr_offset.dattr.attr, &edt_ft5x06_attr_offset.dattr.attr,
...@@ -549,6 +561,7 @@ static struct attribute *edt_ft5x06_attrs[] = { ...@@ -549,6 +561,7 @@ static struct attribute *edt_ft5x06_attrs[] = {
&edt_ft5x06_attr_threshold.dattr.attr, &edt_ft5x06_attr_threshold.dattr.attr,
&edt_ft5x06_attr_report_rate.dattr.attr, &edt_ft5x06_attr_report_rate.dattr.attr,
&dev_attr_model.attr, &dev_attr_model.attr,
&dev_attr_fw_version.attr,
NULL NULL
}; };
...@@ -835,13 +848,13 @@ static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata) ...@@ -835,13 +848,13 @@ static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata)
#endif /* CONFIG_DEBUGFS */ #endif /* CONFIG_DEBUGFS */
static int edt_ft5x06_ts_identify(struct i2c_client *client, static int edt_ft5x06_ts_identify(struct i2c_client *client,
struct edt_ft5x06_ts_data *tsdata, struct edt_ft5x06_ts_data *tsdata)
char *fw_version)
{ {
u8 rdbuf[EDT_NAME_LEN]; u8 rdbuf[EDT_NAME_LEN];
char *p; char *p;
int error; int error;
char *model_name = tsdata->name; char *model_name = tsdata->name;
char *fw_version = tsdata->fw_version;
/* see what we find if we assume it is a M06 * /* see what we find if we assume it is a M06 *
* if we get less than EDT_NAME_LEN, we don't want * if we get less than EDT_NAME_LEN, we don't want
...@@ -1098,7 +1111,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, ...@@ -1098,7 +1111,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
unsigned long irq_flags; unsigned long irq_flags;
int error; int error;
u32 report_rate; u32 report_rate;
char fw_version[EDT_NAME_LEN];
dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n");
...@@ -1211,7 +1223,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, ...@@ -1211,7 +1223,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
tsdata->input = input; tsdata->input = input;
tsdata->factory_mode = false; tsdata->factory_mode = false;
error = edt_ft5x06_ts_identify(client, tsdata, fw_version); error = edt_ft5x06_ts_identify(client, tsdata);
if (error) { if (error) {
dev_err(&client->dev, "touchscreen probe failed\n"); dev_err(&client->dev, "touchscreen probe failed\n");
return error; return error;
...@@ -1250,7 +1262,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, ...@@ -1250,7 +1262,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
dev_dbg(&client->dev, dev_dbg(&client->dev,
"Model \"%s\", Rev. \"%s\", %dx%d sensors\n", "Model \"%s\", Rev. \"%s\", %dx%d sensors\n",
tsdata->name, fw_version, tsdata->num_x, tsdata->num_y); tsdata->name, tsdata->fw_version, tsdata->num_x, tsdata->num_y);
input->name = tsdata->name; input->name = tsdata->name;
input->id.bustype = BUS_I2C; input->id.bustype = BUS_I2C;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册