# RE: \[PATCH\] Input: ads7846 - correct the value get from SPI

- From: Chen Bough \<hidden\>
- Date: 2015-07-21 03:05:30 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2015/07/8926506
- Thread: https://ratatoskr.run/linux-input/2015/05/8926145/t.md

```text
Hi


> -----Original Message-----
> From: Chen Haibo-B51421
> Sent: Wednesday, June 10, 2015 4:54 PM
> To: Chen Haibo-B51421; dmitry.torokhov@gmail.com
> Cc: <redacted>; <redacted>; linux-
> input@vger.kernel.org
> Subject: RE: [PATCH] Input: ads7846 - correct the value get from SPI
> 
> Ping...
> 
> 
> > -----Original Message-----
> > From: Haibo Chen [mailto:<redacted>]
> > Sent: Friday, May 22, 2015 3:02 PM
> > To: dmitry.torokhov@gmail.com
> > Cc: <redacted>; <redacted>; linux-
> > input@vger.kernel.org; Chen Haibo-B51421
> > Subject: [PATCH] Input: ads7846 - correct the value get from SPI
> >
> > According to the touch controller SPEC, SPI return a 16 bit value,
> > only
> > 12 bits are valid, they are bit[14-3].
> >
> > The value of MISO and MOSI can be configed when SPI in idle mode.
> > Currently this touch driver consider the SPI bus set the MOSI and MISO
> > in low level when SPI bus in idle mode. So the bit[15] of the value
> > get from SPI bus is always 0. But when SPI bus congfig the MOSI and
> > MISO in high level when SPI in idle mode, the bit[15] of the value get
> > from SPI is always 1, if not mask this bit[15], we may get the wrong
> value.
> >
> > This patch mask the invalid bit, and make sure to return the correct
> > value nomatter how SPI bus configed.
> >
> > Signed-off-by: Haibo Chen <redacted>
> > ---
> >  drivers/input/touchscreen/ads7846.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/input/touchscreen/ads7846.c
> > b/drivers/input/touchscreen/ads7846.c
> > index e4eb8a6..91b335f 100644
> > --- a/drivers/input/touchscreen/ads7846.c
> > +++ b/drivers/input/touchscreen/ads7846.c
> > @@ -678,7 +678,7 @@ static int ads7846_get_value(struct ads7846 *ts,
> > struct spi_message *m)
> >  		 * adjust:  on-wire is a must-ignore bit, a BE12 value, then
> >  		 * padding; built from two 8 bit values written msb-first.
> >  		 */
> > -		return be16_to_cpup((__be16 *)t->rx_buf) >> 3;
> > +		return (be16_to_cpup((__be16 *)t->rx_buf) & 0x7ff8) >> 3;
> >  	}
> >  }
> >
> > --
> > 1.9.1

Will this patch be merged? Since more than 5 weeks passed, I did not see any comments about this patch. 
```
