Re: [PATCH 2/6] nokia_rx51: Correct tstc() implementation

2023-07-10 Thread Simon Glass
Hi Pali,

On Mon, 10 Jul 2023 at 08:01, Pali Rohár  wrote:
>
> On Saturday 17 June 2023 11:49:49 Simon Glass wrote:
> > This returns false even when there are keys in the buffer.
>
> This is not truth. After scanning HW buffer it returns the correct
> information if some key is in SW buffer, even when function did not read
> anything from HW buffer.
>
> So, NAK.

Why is is reading new chars when it still has some in the buffer?

Do you see i2c errors?

Regards,
Simon

>
> > Fix it.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >  board/nokia/rx51/rx51.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
> > index 238b9637badd..138f5a811eb6 100644
> > --- a/board/nokia/rx51/rx51.c
> > +++ b/board/nokia/rx51/rx51.c
> > @@ -668,6 +668,9 @@ static int rx51_kp_tstc(struct udevice *dev)
> >   u8 intr;
> >   u8 mods;
> >
> > + if ((KEYBUF_SIZE + keybuf_tail - keybuf_head) % KEYBUF_SIZE)
> > + return 1;
> > +
> >   /* localy lock twl4030 i2c bus */
> >   if (test_and_set_bit(0, _i2c_lock))
> >   return 0;
> > --
> > 2.41.0.162.gfafddb0af9-goog
> >


Re: [PATCH 2/6] nokia_rx51: Correct tstc() implementation

2023-07-10 Thread Pali Rohár
On Saturday 17 June 2023 11:49:49 Simon Glass wrote:
> This returns false even when there are keys in the buffer.

This is not truth. After scanning HW buffer it returns the correct
information if some key is in SW buffer, even when function did not read
anything from HW buffer.

So, NAK.

> Fix it.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  board/nokia/rx51/rx51.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
> index 238b9637badd..138f5a811eb6 100644
> --- a/board/nokia/rx51/rx51.c
> +++ b/board/nokia/rx51/rx51.c
> @@ -668,6 +668,9 @@ static int rx51_kp_tstc(struct udevice *dev)
>   u8 intr;
>   u8 mods;
>  
> + if ((KEYBUF_SIZE + keybuf_tail - keybuf_head) % KEYBUF_SIZE)
> + return 1;
> +
>   /* localy lock twl4030 i2c bus */
>   if (test_and_set_bit(0, _i2c_lock))
>   return 0;
> -- 
> 2.41.0.162.gfafddb0af9-goog
>