INPUT: ads7846 - fix wrong transfer init for ads7845
Subsystems (2)
PATCH 1/1 INPUT: ads7846 - fix wrong transfer init for ads7845
For ads7845 transfer packets are wrong initialized for activated settle_delay_usec. Buffers of spi_transfers have to point to the ads7845 buffers also for the transfers used for implementing the settling delay. Otherwise the filter will see invalid / uninitialized data and the input gets the first raw samples.
This patch fixes the wrong buffer init.
Signed-off-by Markus Niebel <[email protected]>
--- drivers/input/touchscreen/ads7846.c | 50 ++++++++++++++++++++++------------ 1 files changed, 32 insertions(+), 18 deletions(-)
drivers/input/touchscreen/ads7846.c +32 -18
@@ -1043,16 +1043,23 @@ static void __devinit ads7846_setup_spi_msg(struct ads7846 *ts,*/ if (pdata->settle_delay_usecs) { x->delay_usecs = pdata->settle_delay_usecs; +if (ts->model ==7845 ) { + x++; + x->tx_buf = &packet->read_y_cmd[0 ]; + x->rx_buf = &packet->tc.y_buf[0 ]; + x->len =3 ; +spi_message_add_tail (x, m); + }else { + x++; + x->tx_buf = &packet->read_y; + x->len =1 ; +spi_message_add_tail (x, m); - x++; - x->tx_buf = &packet->read_y; - x->len =1 ; -spi_message_add_tail (x, m); - - x++; - x->rx_buf = &packet->tc.y; - x->len =2 ; -spi_message_add_tail (x, m); + x++; + x->rx_buf = &packet->tc.y; + x->len =2 ; +spi_message_add_tail (x, m); + } } ts->msg_count++;
@@ -1086,16 +1093,23 @@ static void __devinit ads7846_setup_spi_msg(struct ads7846 *ts,/* ... maybe discard first sample ... */ if (pdata->settle_delay_usecs) { x->delay_usecs = pdata->settle_delay_usecs; +if (ts->model ==7845 ) { + x++; + x->tx_buf = &packet->read_x_cmd[0 ]; + x->rx_buf = &packet->tc.x_buf[0 ]; + x->len =3 ; +spi_message_add_tail (x, m); + }else { + x++; + x->tx_buf = &packet->read_x; + x->len =1 ; +spi_message_add_tail (x, m); - x++; - x->tx_buf = &packet->read_x; - x->len =1 ; -spi_message_add_tail (x, m); - - x++; - x->rx_buf = &packet->tc.x; - x->len =2 ; -spi_message_add_tail (x, m); + x++; + x->rx_buf = &packet->tc.x; + x->len =2 ; +spi_message_add_tail (x, m); + } }/* turn y+ off, x- on; we'll use formula #2 */