Re: [PATCH 2/2] Input: ili210x - add ILI2117 support

From: Dmitry Torokhov
Date: Mon Nov 11 2019 - 13:17:03 EST


On Tue, Nov 05, 2019 at 10:29:53AM -0500, Sven Van Asbroeck wrote:
> On Mon, Nov 4, 2019 at 6:36 PM Dmitry Torokhov
> <dmitry.torokhov@xxxxxxxxx> wrote:
> >
> > OK, I refreshed the branch with fixes and a couple of new patches. It is
> > on top of 5.3 now. If this works for you guys I will be merging it for
> > 5.5.
> >
>
> According to the ili2117a/2118a datasheet I have, there are still a
> few loose ends.
> Some of these might be too inconsequential to worry about.
> Dmitry, tell me which ones you think are important, if any,
> and I will spin a patch if you like. Or you can do it, just let me know.
>
> > { "ili210x", (long)&ili210x_chip },
> > { "ili2117", (long)&ili211x_chip },
> > { "ili251x", (long)&ili251x_chip },
> >
> > { .compatible = "ilitek,ili210x", .data = &ili210x_chip },
> > { .compatible = "ilitek,ili2117", .data = &ili211x_chip },
> > { .compatible = "ilitek,ili251x", .data = &ili251x_chip },
>
> My datasheet says ILI2117A/ILI2118A, so maybe the compatible string should
> really be "ilitek,ili211x", just like the other variants ?

We have not landed the DT for 2117, so we can either rename it as
"ilitek,ili211x" or have 2 separate compatibles.

Rob, do you have preference?

>
> In addition, should we add ili2117/ili2118 in comments somewhere, so others
> can find this driver with a simple grep?
>
> > error = devm_device_add_group(dev, &ili210x_attr_group);
> > if (error) {
> > dev_err(dev, "Unable to create sysfs attributes, err: %d\n",
> > error);
> > return error;
> > }
>
> The ili2117/ili2118 does not have a calibrate register, so this sysfs group
> is unsupported and perhaps may even be harmful if touched (?).
>
> Perhaps add a flag to struct ili2xxx_chip ?


I guess we need is_visible() implementation for the attributes here and
yes, a flag to the chip structure.

>
> > input_set_abs_params(input, ABS_MT_POSITION_X, 0, 0xffff, 0, 0);
> > input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 0xffff, 0, 0);
>
> The max position on ili2117/8 is 0xfff. The OS I'm using (Android) likes to know
> the correct min and max. So it can map touch coords to pixel coords.

What about the others? I doubt any of them actually support 64K
resolution and I expect everyone simply used device tree to specify
correct size.

Marek, you worked with other versions of this controller, what is your
experience?

>
> Perhaps add this to struct ili2xxx_chip ?
>
> > /* Get firmware version */
> > error = chip->read_reg(client, REG_FIRMWARE_VERSION,
> > &firmware, sizeof(firmware));
>
> On ili2117/ili2118, the firmware version register is different (0x03), and
> the layout is different too:
>
> byte name
> 0 vendor id
> 1 reserved
> 2 firmware version upper
> 3 firmware version lower
> 4 reserved
> 5 reserved
> 6 reserved
> 7 reserved
>
> But, does it even make sense to retrieve the firmware version? All it's used
> for is a dev_dbg log print, which under normal circumstances is a noop:
>
> > dev_dbg(dev,
> > "ILI210x initialized (IRQ: %d), firmware version %d.%d.%d",
> > client->irq, firmware.id, firmware.major, firmware.minor);

I'd be OK with simply dropping this.

Thanks.

--
Dmitry