* [PATCH] Input: ili210x - Set the device name according to the device model
@ 2021-09-01 19:22 Rogerio Pimentel
2021-09-01 19:46 ` Marek Vasut
0 siblings, 1 reply; 6+ messages in thread
From: Rogerio Pimentel @ 2021-09-01 19:22 UTC (permalink / raw)
To: dmitry.torokhov, rpimentel.silva, hansemro, marex, linux-input,
linux-kernel
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Input: ili210x - Set the device name according to the device model
2021-09-01 19:22 [PATCH] Input: ili210x - Set the device name according to the device model Rogerio Pimentel
@ 2021-09-01 19:46 ` Marek Vasut
2021-09-01 20:27 ` Rogerio Pimentel
0 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2021-09-01 19:46 UTC (permalink / raw)
To: Rogerio Pimentel, dmitry.torokhov, hansemro, linux-input, linux-kernel
On 9/1/21 9:22 PM, Rogerio Pimentel wrote:
[...]
> 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",
Which ilitek devices do you have available exactly ?
There is a firmware interface which does report the device type, but I
don't know whether it works on all the ilitek touchscreen devices. If it
does, then it could be used here to pull the type from the firmware and
then use this instead
snprintf(model_name, ILI_NAME_LEN, "Ilitek ILI%04x Touchscreen", type);
Try this command against the touch controller, it sends it command 0x61
and reads two bytes of the reply:
i2ctransfer -f -y 1 w1@0x41 0x61 r2
0x10 0x25 # <---- on ILI2510 it reports 0x25 0x10 in reverse
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Input: ili210x - Set the device name according to the device model
2021-09-01 19:46 ` Marek Vasut
@ 2021-09-01 20:27 ` Rogerio Pimentel
2021-09-01 20:48 ` Marek Vasut
0 siblings, 1 reply; 6+ messages in thread
From: Rogerio Pimentel @ 2021-09-01 20:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: dmitry.torokhov, hansemro, linux-input, linux-kernel
On Wed, Sep 1, 2021 at 4:46 PM Marek Vasut <marex@denx.de> wrote:
>
> On 9/1/21 9:22 PM, Rogerio Pimentel wrote:
>
> [...]
>
> > 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",
>
> Which ilitek devices do you have available exactly ?
>
> There is a firmware interface which does report the device type, but I
> don't know whether it works on all the ilitek touchscreen devices. If it
> does, then it could be used here to pull the type from the firmware and
> then use this instead
>
> snprintf(model_name, ILI_NAME_LEN, "Ilitek ILI%04x Touchscreen", type);
>
> Try this command against the touch controller, it sends it command 0x61
> and reads two bytes of the reply:
> i2ctransfer -f -y 1 w1@0x41 0x61 r2
> 0x10 0x25 # <---- on ILI2510 it reports 0x25 0x10 in reverse
Thanks for the comments and suggestions. I'll make the changes and send V2.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Input: ili210x - Set the device name according to the device model
2021-09-01 20:27 ` Rogerio Pimentel
@ 2021-09-01 20:48 ` Marek Vasut
2021-09-02 12:39 ` Rogerio Pimentel
0 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2021-09-01 20:48 UTC (permalink / raw)
To: Rogerio Pimentel; +Cc: dmitry.torokhov, hansemro, linux-input, linux-kernel
On 9/1/21 10:27 PM, Rogerio Pimentel wrote:
> On Wed, Sep 1, 2021 at 4:46 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 9/1/21 9:22 PM, Rogerio Pimentel wrote:
>>
>> [...]
>>
>>> 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",
>>
>> Which ilitek devices do you have available exactly ?
>>
>> There is a firmware interface which does report the device type, but I
>> don't know whether it works on all the ilitek touchscreen devices. If it
>> does, then it could be used here to pull the type from the firmware and
>> then use this instead
>>
>> snprintf(model_name, ILI_NAME_LEN, "Ilitek ILI%04x Touchscreen", type);
>>
>> Try this command against the touch controller, it sends it command 0x61
>> and reads two bytes of the reply:
>> i2ctransfer -f -y 1 w1@0x41 0x61 r2
>> 0x10 0x25 # <---- on ILI2510 it reports 0x25 0x10 in reverse
>
> Thanks for the comments and suggestions. I'll make the changes and send V2.
Can you tell which ILI2xxx touch controller you have exactly ?
Can you share the output of the 'i2ctransfer' (from i2c-tools) command
above ?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Input: ili210x - Set the device name according to the device model
2021-09-01 20:48 ` Marek Vasut
@ 2021-09-02 12:39 ` Rogerio Pimentel
2021-09-02 12:44 ` Marek Vasut
0 siblings, 1 reply; 6+ messages in thread
From: Rogerio Pimentel @ 2021-09-02 12:39 UTC (permalink / raw)
To: Marek Vasut; +Cc: dmitry.torokhov, hansemro, linux-input, linux-kernel
On Wed, Sep 1, 2021 at 5:48 PM Marek Vasut <marex@denx.de> wrote:
>
> On 9/1/21 10:27 PM, Rogerio Pimentel wrote:
> > On Wed, Sep 1, 2021 at 4:46 PM Marek Vasut <marex@denx.de> wrote:
> >>
> >> On 9/1/21 9:22 PM, Rogerio Pimentel wrote:
> >>
> >> [...]
> >>
> >>> 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",
> >>
> >> Which ilitek devices do you have available exactly ?
> >>
> >> There is a firmware interface which does report the device type, but I
> >> don't know whether it works on all the ilitek touchscreen devices. If it
> >> does, then it could be used here to pull the type from the firmware and
> >> then use this instead
> >>
> >> snprintf(model_name, ILI_NAME_LEN, "Ilitek ILI%04x Touchscreen", type);
> >>
> >> Try this command against the touch controller, it sends it command 0x61
> >> and reads two bytes of the reply:
> >> i2ctransfer -f -y 1 w1@0x41 0x61 r2
> >> 0x10 0x25 # <---- on ILI2510 it reports 0x25 0x10 in reverse
> >
> > Thanks for the comments and suggestions. I'll make the changes and send V2.
>
> Can you tell which ILI2xxx touch controller you have exactly ?
Now I have only the ILI2511. Will also have to support ILI2510 and ILI2118.
> Can you share the output of the 'i2ctransfer' (from i2c-tools) command
> above ?
# i2ctransfer -f -y 3 w1@0x41 0x61 r2
0x11 0x25
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Input: ili210x - Set the device name according to the device model
2021-09-02 12:39 ` Rogerio Pimentel
@ 2021-09-02 12:44 ` Marek Vasut
0 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2021-09-02 12:44 UTC (permalink / raw)
To: Rogerio Pimentel; +Cc: dmitry.torokhov, hansemro, linux-input, linux-kernel
On 9/2/21 2:39 PM, Rogerio Pimentel wrote:
> On Wed, Sep 1, 2021 at 5:48 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 9/1/21 10:27 PM, Rogerio Pimentel wrote:
>>> On Wed, Sep 1, 2021 at 4:46 PM Marek Vasut <marex@denx.de> wrote:
>>>>
>>>> On 9/1/21 9:22 PM, Rogerio Pimentel wrote:
>>>>
>>>> [...]
>>>>
>>>>> 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",
>>>>
>>>> Which ilitek devices do you have available exactly ?
>>>>
>>>> There is a firmware interface which does report the device type, but I
>>>> don't know whether it works on all the ilitek touchscreen devices. If it
>>>> does, then it could be used here to pull the type from the firmware and
>>>> then use this instead
>>>>
>>>> snprintf(model_name, ILI_NAME_LEN, "Ilitek ILI%04x Touchscreen", type);
>>>>
>>>> Try this command against the touch controller, it sends it command 0x61
>>>> and reads two bytes of the reply:
>>>> i2ctransfer -f -y 1 w1@0x41 0x61 r2
>>>> 0x10 0x25 # <---- on ILI2510 it reports 0x25 0x10 in reverse
>>>
>>> Thanks for the comments and suggestions. I'll make the changes and send V2.
>>
>> Can you tell which ILI2xxx touch controller you have exactly ?
>
> Now I have only the ILI2511. Will also have to support ILI2510 and ILI2118.
>
>> Can you share the output of the 'i2ctransfer' (from i2c-tools) command
>> above ?
>
> # i2ctransfer -f -y 3 w1@0x41 0x61 r2
> 0x11 0x25
Nice, so this works at least with the 251x series. Let's see how the
2118 behaves, I bet you will get 0x18 0x21 there too.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-09-02 12:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 19:22 [PATCH] Input: ili210x - Set the device name according to the device model Rogerio Pimentel
2021-09-01 19:46 ` 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
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).