linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rogerio Pimentel <rpimentel.silva@gmail.com>
To: dmitry.torokhov@gmail.com, rpimentel.silva@gmail.com,
	hansemro@outlook.com, marex@denx.de, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Input: ili210x - Set the device name according to the device model
Date: Wed,  1 Sep 2021 16:22:29 -0300	[thread overview]
Message-ID: <20210901192229.29864-1-rpimentel.silva@gmail.com> (raw)

Adding the device model into the device name is useful when
applications need to set different parameters according to the
touchscreen being used, e.g. X11 calibration points.

Signed-off-by: Rogerio Pimentel <rpimentel.silva@gmail.com>
---
 drivers/input/touchscreen/ili210x.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 30576a5f2f04..ca7af4a6f588 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -19,6 +19,8 @@
 #define ILI251X_DATA_SIZE1	31
 #define ILI251X_DATA_SIZE2	20
 
+#define ILI_NAME_LEN		27
+
 /* Touchscreen commands */
 #define REG_TOUCHDATA		0x10
 #define REG_PANEL_INFO		0x20
@@ -394,6 +396,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 	struct input_dev *input;
 	int error;
 	unsigned int max_xy;
+	char *model_name;
 
 	dev_dbg(dev, "Probing for ILI210X I2C Touschreen driver");
 
@@ -440,7 +443,11 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, priv);
 
 	/* Setup input device */
-	input->name = "ILI210x Touchscreen";
+	input->name = "Ilitek         Touchscreen";
+	model_name = (char *)input->name;
+	snprintf(model_name, ILI_NAME_LEN, "Ilitek %s Touchscreen",
+	id->name);
+	input->name = model_name;
 	input->id.bustype = BUS_I2C;
 
 	/* Multi touch */
@@ -487,10 +494,10 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 }
 
 static const struct i2c_device_id ili210x_i2c_id[] = {
-	{ "ili210x", (long)&ili210x_chip },
-	{ "ili2117", (long)&ili211x_chip },
-	{ "ili2120", (long)&ili212x_chip },
-	{ "ili251x", (long)&ili251x_chip },
+	{ .name = "ili210x", (long)&ili210x_chip },
+	{ .name = "ili2117", (long)&ili211x_chip },
+	{ .name = "ili2120", (long)&ili212x_chip },
+	{ .name = "ili251x", (long)&ili251x_chip },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, ili210x_i2c_id);
-- 
2.17.1


             reply	other threads:[~2021-09-01 19:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 19:22 Rogerio Pimentel [this message]
2021-09-01 19:46 ` [PATCH] Input: ili210x - Set the device name according to the device model Marek Vasut
2021-09-01 20:27   ` Rogerio Pimentel
2021-09-01 20:48     ` Marek Vasut
2021-09-02 12:39       ` Rogerio Pimentel
2021-09-02 12:44         ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210901192229.29864-1-rpimentel.silva@gmail.com \
    --to=rpimentel.silva@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hansemro@outlook.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).