diff options
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 1c9069cd3bae..103ee6ad299e 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -95,7 +95,7 @@ struct ads7846 { | |||
95 | u16 dummy; /* for the pwrdown read */ | 95 | u16 dummy; /* for the pwrdown read */ |
96 | struct ts_event tc; | 96 | struct ts_event tc; |
97 | 97 | ||
98 | struct spi_transfer xfer[10]; | 98 | struct spi_transfer xfer[18]; |
99 | struct spi_message msg[5]; | 99 | struct spi_message msg[5]; |
100 | struct spi_message *last_msg; | 100 | struct spi_message *last_msg; |
101 | int msg_idx; | 101 | int msg_idx; |
@@ -936,6 +936,24 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
936 | x->len = 2; | 936 | x->len = 2; |
937 | spi_message_add_tail(x, m); | 937 | spi_message_add_tail(x, m); |
938 | 938 | ||
939 | /* the first sample after switching drivers can be low quality; | ||
940 | * optionally discard it, using a second one after the signals | ||
941 | * have had enough time to stabilize. | ||
942 | */ | ||
943 | if (pdata->settle_delay_usecs) { | ||
944 | x->delay_usecs = pdata->settle_delay_usecs; | ||
945 | |||
946 | x++; | ||
947 | x->tx_buf = &ts->read_y; | ||
948 | x->len = 1; | ||
949 | spi_message_add_tail(x, m); | ||
950 | |||
951 | x++; | ||
952 | x->rx_buf = &ts->tc.y; | ||
953 | x->len = 2; | ||
954 | spi_message_add_tail(x, m); | ||
955 | } | ||
956 | |||
939 | m->complete = ads7846_rx_val; | 957 | m->complete = ads7846_rx_val; |
940 | m->context = ts; | 958 | m->context = ts; |
941 | 959 | ||
@@ -954,6 +972,21 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
954 | x->len = 2; | 972 | x->len = 2; |
955 | spi_message_add_tail(x, m); | 973 | spi_message_add_tail(x, m); |
956 | 974 | ||
975 | /* ... maybe discard first sample ... */ | ||
976 | if (pdata->settle_delay_usecs) { | ||
977 | x->delay_usecs = pdata->settle_delay_usecs; | ||
978 | |||
979 | x++; | ||
980 | x->tx_buf = &ts->read_x; | ||
981 | x->len = 1; | ||
982 | spi_message_add_tail(x, m); | ||
983 | |||
984 | x++; | ||
985 | x->rx_buf = &ts->tc.x; | ||
986 | x->len = 2; | ||
987 | spi_message_add_tail(x, m); | ||
988 | } | ||
989 | |||
957 | m->complete = ads7846_rx_val; | 990 | m->complete = ads7846_rx_val; |
958 | m->context = ts; | 991 | m->context = ts; |
959 | 992 | ||
@@ -973,6 +1006,21 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
973 | x->len = 2; | 1006 | x->len = 2; |
974 | spi_message_add_tail(x, m); | 1007 | spi_message_add_tail(x, m); |
975 | 1008 | ||
1009 | /* ... maybe discard first sample ... */ | ||
1010 | if (pdata->settle_delay_usecs) { | ||
1011 | x->delay_usecs = pdata->settle_delay_usecs; | ||
1012 | |||
1013 | x++; | ||
1014 | x->tx_buf = &ts->read_z1; | ||
1015 | x->len = 1; | ||
1016 | spi_message_add_tail(x, m); | ||
1017 | |||
1018 | x++; | ||
1019 | x->rx_buf = &ts->tc.z1; | ||
1020 | x->len = 2; | ||
1021 | spi_message_add_tail(x, m); | ||
1022 | } | ||
1023 | |||
976 | m->complete = ads7846_rx_val; | 1024 | m->complete = ads7846_rx_val; |
977 | m->context = ts; | 1025 | m->context = ts; |
978 | 1026 | ||
@@ -990,6 +1038,21 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
990 | x->len = 2; | 1038 | x->len = 2; |
991 | spi_message_add_tail(x, m); | 1039 | spi_message_add_tail(x, m); |
992 | 1040 | ||
1041 | /* ... maybe discard first sample ... */ | ||
1042 | if (pdata->settle_delay_usecs) { | ||
1043 | x->delay_usecs = pdata->settle_delay_usecs; | ||
1044 | |||
1045 | x++; | ||
1046 | x->tx_buf = &ts->read_z2; | ||
1047 | x->len = 1; | ||
1048 | spi_message_add_tail(x, m); | ||
1049 | |||
1050 | x++; | ||
1051 | x->rx_buf = &ts->tc.z2; | ||
1052 | x->len = 2; | ||
1053 | spi_message_add_tail(x, m); | ||
1054 | } | ||
1055 | |||
993 | m->complete = ads7846_rx_val; | 1056 | m->complete = ads7846_rx_val; |
994 | m->context = ts; | 1057 | m->context = ts; |
995 | } | 1058 | } |