Skip to content

Commit

Permalink
Input: st1232 - fix NORMAL vs. IDLE state handling
Browse files Browse the repository at this point in the history
NORMAL (0x0) and IDLE (0x4) are really two different states.  Hence you
cannot check for both using a bitmask, as that checks for IDLE only,
breaking operation for devices that are in NORMAL state.

Fix the wait function to report either state as ready.

Fixes: 6524d8e ("Input: st1232 - add IDLE state as ready condition")
Signed-off-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Michael Tretter <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
geertu authored and dtor committed Feb 23, 2021
1 parent cbecf71 commit 1bff77f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/input/touchscreen/st1232.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ static int st1232_ts_wait_ready(struct st1232_ts_data *ts)

for (retries = 10; retries; retries--) {
error = st1232_ts_read_data(ts, REG_STATUS, 1);
if (!error && ts->read_buf[0] == (STATUS_NORMAL | STATUS_IDLE | ERROR_NONE))
return 0;
if (!error) {
switch (ts->read_buf[0]) {
case STATUS_NORMAL | ERROR_NONE:
case STATUS_IDLE | ERROR_NONE:
return 0;
}
}

usleep_range(1000, 2000);
}
Expand Down

0 comments on commit 1bff77f

Please sign in to comment.