Skip to contentSkip to conversation

ads7846: enable usage of internal vref for AD7873

PATCH In review Markus Niebel 2 participants 2 messages May 29, 2012 – May 30, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ads7846: enable usage of internal vref for AD7873

Touchscreen samples are taken in differential mode. Therefore an external reference is not needed.
When working with internal vref disabling vref after every touchscreen sample leads to settling effects in sampling and errors in position data.

This patch disables the internal vref only if keep_vref_on us is not set in platform_data.

Tested on i.MX35 with costum board

---
 drivers/input/touchscreen/ads7846.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
drivers/input/touchscreen/ads7846.c +4 -5
index f02028e..b271633 100644
@@ -1001,15 +1001,14 @@ static void __devinit ads7846_setup_spi_msg(struct ads7846 *ts,
 	struct ads7846_packet *packet = ts->packet;
 	int vref = pdata->keep_vref_on;
 
-	if (ts->model == 7873) {
+	if (ts->model == 7873)
 		/*
 		 * The AD7873 is almost identical to the ADS7846
-		 * keep VREF off during differential/ratiometric
-		 * conversion modes.
+		 * set VREF off during differential/ratiometric
+		 * conversion modes if keep_vref_on is not set.
+		 * TODO: does keep_vref_on collide with usage of external vref?
 		 */
 		ts->model = 7846;
-		vref = 0;
-	}
 
 	ts->msg_count = 1;
 	spi_message_init(m);
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 28 lines · Markus Niebel

Touchscreen samples are taken in differential mode. Therefore an external reference is not needed.
When working with internal vref disabling vref after every touchscreen sample leads to settling effects in sampling and errors in position data.

This patch disables the internal vref only if keep_vref_on us is not set in platform_data.

Tested on i.MX35 with costum board

---
  drivers/input/touchscreen/ads7846.c |    9 ++++-----
  1 files changed, 4 insertions(+), 5 deletions(-)
drivers/input/touchscreen/ads7846.c +1 -1
index f02028e..b271633 100644
@@ -1001,15 +1001,14 @@ static void __devinit ads7846_setup_spi_msg(struct ads7846 *ts,
         struct ads7846_packet *packet = ts->packet;
         int vref = pdata->keep_vref_on;
 
-       if (ts->model == 7873) {
+       if (ts->model == 7873)
                 /*

drivers/input/touchscreen/ads7846.c static void __devinit ads7846_setup_spi_msg(struct ads7846 *ts, · line 1012

Quoted 10 lines
drivers/input/touchscreen/ads7846.c +3 -4
                  * The AD7873 is almost identical to the ADS7846
-                * keep VREF off during differential/ratiometric
-                * conversion modes.
+                * set VREF off during differential/ratiometric
+                * conversion modes if keep_vref_on is not set.
+                * TODO: does keep_vref_on collide with usage of external vref?
                  */
                 ts->model = 7846;
-               vref = 0;
-       }

I would scrap this section from ads7846_setup_spi_msg() completely and force ts->model to 7846 in ads7846_probe() when 7873 is specified.

Quoted 6 lines
drivers/input/touchscreen/ads7846.c +0 -1
         ts->msg_count = 1;
         spi_message_init(m);
--

1.7.0.4

Signature · 8 lines
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif