mbox series

[0/3] Input: st1232 - fixes for resolution reading

Message ID 20201229162601.2154566-1-geert+renesas@glider.be
Headers show
Series Input: st1232 - fixes for resolution reading | expand

Message

Geert Uytterhoeven Dec. 29, 2020, 4:25 p.m. UTC
Hi Dmitry, Andrej,

The recent commit 3a54a215410b1650 ("Input: st1232 - add support
resolution reading") broke probing of the st1232 touchscreen on
r8a7740/armadillo:

    st1232-ts 1-0055: Failed to read resolution: -6

Upon investigation, this turned out to be a little bit more complicated
than expected, hence I wrote not one but three fixes.

Thanks for your comments!

Geert Uytterhoeven (3):
  Input: st1232 - fix off-by-one error in resolution handling
  Input: st1232 - do not read more bytes than needed
  Input: st1232 - wait until device is ready before reading resolution

 drivers/input/touchscreen/st1232.c | 48 ++++++++++++++++++++++++++----
 1 file changed, 42 insertions(+), 6 deletions(-)

Comments

Dmitry Torokhov Jan. 4, 2021, 1:44 a.m. UTC | #1
On Tue, Dec 29, 2020 at 05:25:59PM +0100, Geert Uytterhoeven wrote:
> Before, the maximum coordinates were fixed to (799, 479) or (319, 479),

> depending on touchscreen controller type.  The driver was changed to

> read the actual values from the touchscreen controller, but did not take

> into account the returned values are not the maximum coordinates, but

> the touchscreen resolution (e.g. 800 and 480).

> 

> Fix this by subtracting 1.

> 

> Fixes: 3a54a215410b1650 ("Input: st1232 - add support resolution reading")

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>


Applied, thank you.

-- 
Dmitry
Dmitry Torokhov Jan. 4, 2021, 1:45 a.m. UTC | #2
On Tue, Dec 29, 2020 at 05:26:01PM +0100, Geert Uytterhoeven wrote:
> According to the st1232 datasheet, the host has to wait for the device

> to change into Normal state before accessing registers other than the

> Status Register.

> 

> If the reset GPIO is wired, the device is powered on during driver

> probe, just before reading the resolution.  However, the latter may

> happen before the device is ready, leading to a probe failure:

> 

>     st1232-ts 1-0055: Failed to read resolution: -6

> 

> Fix this by waiting until the device is ready, by trying to read the

> Status Register until it indicates so, or until timeout.

> 

> On Armadillo 800 EVA, typically the first read fails with an I2C

> transfer error, while the second read indicates the device is ready.

> 

> Fixes: 3a54a215410b1650 ("Input: st1232 - add support resolution reading")

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>


Applied, thank you.

-- 
Dmitry