diff options
author | Imre Deak <imre.deak@nokia.com> | 2006-04-11 23:41:49 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-04-11 23:41:49 -0400 |
commit | 53a0ef89e95c725f3faab98573770aeb7429c1a3 (patch) | |
tree | 66d9258d53621f86ac686f768d17885404edced6 /drivers/input | |
parent | 438f2a7401ec5d8f85923a7c3e6da444f097a3a1 (diff) |
Input: ads7846 - power down ADC a bit later
Submit a seperate request for powering down the ADC in ads7846,
doing it after the last read request. Otherwise some of the read
values are incorrect.
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 7f384a694d80..54d433477860 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -72,10 +72,11 @@ struct ads7846 { | |||
72 | u16 vref_delay_usecs; | 72 | u16 vref_delay_usecs; |
73 | u16 x_plate_ohms; | 73 | u16 x_plate_ohms; |
74 | 74 | ||
75 | u8 read_x, read_y, read_z1, read_z2; | 75 | u8 read_x, read_y, read_z1, read_z2, pwrdown; |
76 | u16 dummy; /* for the pwrdown read */ | ||
76 | struct ts_event tc; | 77 | struct ts_event tc; |
77 | 78 | ||
78 | struct spi_transfer xfer[8]; | 79 | struct spi_transfer xfer[10]; |
79 | struct spi_message msg; | 80 | struct spi_message msg; |
80 | 81 | ||
81 | spinlock_t lock; | 82 | spinlock_t lock; |
@@ -125,7 +126,9 @@ struct ads7846 { | |||
125 | #define READ_Y (READ_12BIT_DFR(y) | ADS_PD10_ADC_ON) | 126 | #define READ_Y (READ_12BIT_DFR(y) | ADS_PD10_ADC_ON) |
126 | #define READ_Z1 (READ_12BIT_DFR(z1) | ADS_PD10_ADC_ON) | 127 | #define READ_Z1 (READ_12BIT_DFR(z1) | ADS_PD10_ADC_ON) |
127 | #define READ_Z2 (READ_12BIT_DFR(z2) | ADS_PD10_ADC_ON) | 128 | #define READ_Z2 (READ_12BIT_DFR(z2) | ADS_PD10_ADC_ON) |
128 | #define READ_X (READ_12BIT_DFR(x) | ADS_PD10_PDOWN) /* LAST */ | 129 | |
130 | #define READ_X (READ_12BIT_DFR(x) | ADS_PD10_ADC_ON) | ||
131 | #define PWRDOWN (READ_12BIT_DFR(y) | ADS_PD10_PDOWN) /* LAST */ | ||
129 | 132 | ||
130 | /* single-ended samples need to first power up reference voltage; | 133 | /* single-ended samples need to first power up reference voltage; |
131 | * we leave both ADC and VREF powered | 134 | * we leave both ADC and VREF powered |
@@ -541,6 +544,18 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
541 | x++; | 544 | x++; |
542 | x->rx_buf = &ts->tc.x; | 545 | x->rx_buf = &ts->tc.x; |
543 | x->len = 2; | 546 | x->len = 2; |
547 | spi_message_add_tail(x, &ts->msg); | ||
548 | |||
549 | /* power down */ | ||
550 | x++; | ||
551 | ts->pwrdown = PWRDOWN; | ||
552 | x->tx_buf = &ts->pwrdown; | ||
553 | x->len = 1; | ||
554 | spi_message_add_tail(x, &ts->msg); | ||
555 | |||
556 | x++; | ||
557 | x->rx_buf = &ts->dummy; | ||
558 | x->len = 2; | ||
544 | CS_CHANGE(*x); | 559 | CS_CHANGE(*x); |
545 | spi_message_add_tail(x, &ts->msg); | 560 | spi_message_add_tail(x, &ts->msg); |
546 | 561 | ||