Skip to contentSkip to conversation

ads7846 vref support (ads7843)

PATCH RESEND In review David Brownell 3 participants 9 messages Apr 11, 2008 – Apr 15, 2008

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

PATCH RESEND 1/1 ads7846 vref support (ads7843)

From: David Brownell <[email protected]>

This updates the ads7846 driver to handle external vREF (required on boards using ads7843 chips) without module parameters.

Switch keep_vref_on flag to "bool"; signed bitfields are bogus.

---
Updated since the version sent 5-January (evidently bounced from list archives) ... to remove the warning fix that was merged (from someone else) on 10-March.

MAINTAINERS says "linux-input@vger" but the only archives I could find seems to say "@atrey.karlin.mff.cuni.cz"...

 drivers/input/touchscreen/ads7846.c |   13 ++++++-------
 include/linux/spi/ads7846.h         |    3 ++-
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/input/touchscreen/ads7846.c +6 -7
@@ -87,6 +87,7 @@ struct ads7846 {
 #endif
 
 	u16			model;
+	u16			vref_mv;
 	u16			vref_delay_usecs;
 	u16			x_plate_ohms;
 	u16			pressure_max;
@@ -184,9 +185,6 @@ struct ads7846 {
  * The range is GND..vREF. The ads7843 and ads7835 must use external vREF;
  * ads7846 lets that pin be unconnected, to use internal vREF.
  */
-static unsigned vREF_mV;
-module_param(vREF_mV, uint, 0);
-MODULE_PARM_DESC(vREF_mV, "external vREF voltage, in milliVolts");
 
 struct ser_req {
 	u8			ref_on;
@@ -317,7 +315,7 @@ static inline unsigned vaux_adjust(struc
 	unsigned retval = v;
 
 	/* external resistors may scale vAUX into 0..vREF */
-	retval *= vREF_mV;
+	retval *= ts->vref_mv;
 	retval = retval >> 12;
 	return retval;
 }
@@ -375,14 +373,14 @@ static int ads784x_hwmon_register(struct
 	/* hwmon sensors need a reference voltage */
 	switch (ts->model) {
 	case 7846:
-		if (!vREF_mV) {
+		if (!ts->vref_mv) {
 			dev_dbg(&spi->dev, "assuming 2.5V internal vREF\n");
-			vREF_mV = 2500;
+			ts->vref_mv = 2500;
 		}
 		break;
 	case 7845:
 	case 7843:
-		if (!vREF_mV) {
+		if (!ts->vref_mv) {
 			dev_warn(&spi->dev,
 				"external vREF for ADS%d not specified\n",
 				ts->model);
@@ -875,6 +873,7 @@ static int __devinit ads7846_probe(struc
 
 	ts->spi = spi;
 	ts->input = input_dev;
+	ts->vref_mv = pdata->vref_mv;
 
 	hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	ts->timer.function = ads7846_timer;
include/linux/spi/ads7846.h +2 -1
@@ -14,7 +14,8 @@ enum ads7846_filter {
 struct ads7846_platform_data {
 	u16	model;			/* 7843, 7845, 7846. */
 	u16	vref_delay_usecs;	/* 0 for external vref; etc */
-	int	keep_vref_on:1;		/* set to keep vref on for differential
+	u16	vref_mv;		/* external vref value, milliVolts */
+	bool	keep_vref_on;		/* set to keep vref on for differential
 					 * measurements as well */
 
 	/* Settling time of the analog signals; a function of Vcc and the
#1 lore raw
Quoted 6 lines · David Brownell

Updated since the version sent 5-January (evidently bounced from list archives) ... to remove the warning fix that was merged (from someone else) on 10-March.

MAINTAINERS says "linux-input@vger" but the only archives I could find seems to say "@atrey.karlin.mff.cuni.cz"...

I eventually found an @vger archive, but it seems to have no postings since February (unlike the @atrey one). Those two lost patches certainly made it to that archive:

http://www.mail-archive.com/[email protected]/msg00086.html
http://www.mail-archive.com/[email protected]/msg00103.html

It seems maybe the MAINTAINERS entry may be incorrect ...

maintainer
#2 lore raw
Quoted 5 lines · David Brownell
Quoted 4 lines · David Brownell

Updated since the version sent 5-January (evidently bounced from list archives) ... to remove the warning fix that was merged (from someone else) on 10-March.

Could you please check the following commit in my tree and make sure it is the right one:

http://git.kernel.org/?p=linux/kernel/git/dtor/input.git;a=commit;h=7c6d0ee14cb7a4cfad4864dc196256da5749bc0c

Quoted 11 lines
Quoted 2 lines

MAINTAINERS says "linux-input@vger" but the only archives I could find seems to say "@atrey.karlin.mff.cuni.cz"...

I eventually found an @vger archive, but it seems to have no postings since February (unlike the @atrey one). Those two lost patches certainly made it to that archive:

http://www.mail-archive.com/[email protected]/msg00086.html
http://www.mail-archive.com/[email protected]/msg00103.html

It seems maybe the MAINTAINERS entry may be incorrect ...

@vger is the correct only, we are migrating from @atrey due to heavy spam issues.

Signature · 1 line
Dmitry
#3 lore raw
Quoted 11 lines · Dmitry Torokhov
Quoted 5 lines · David Brownell
Quoted 4 lines · David Brownell

Updated since the version sent 5-January (evidently bounced from list archives) ... to remove the warning fix that was merged (from someone else) on 10-March.

Could you please check the following commit in my tree and make sure it is the right one:

http://git.kernel.org/?p=linux/kernel/git/dtor/input.git;a=commit;h=7c6d0ee14cb7a4cfad4864dc196256da5749bc0c

Looks OK to me -- thanks!

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

MAINTAINERS says "linux-input@vger" but the only archives I could find seems to say "@atrey.karlin.mff.cuni.cz"...

I eventually found an @vger archive, but it seems to have no postings since February (unlike the @atrey one). Those two lost patches certainly made it to that archive:

Quoted 7 lines
Quoted 4 lines

http://www.mail-archive.com/[email protected]/msg00086.html
http://www.mail-archive.com/[email protected]/msg00103.html

It seems maybe the MAINTAINERS entry may be incorrect ...

@vger is the correct only, we are migrating from @atrey due to heavy spam issues.

Are there better archives for that list? Like, ones which include March and April? I tried marc.info first, and it had nothing...

- Dave

maintainer
#4 lore raw
Quoted 9 lines · David Brownell
Quoted 3 lines · Dmitry Torokhov

@vger is the correct only, we are migrating from @atrey due to heavy spam issues.

Are there better archives for that list? Like, ones which include March and April? I tried marc.info first, and it had nothing...

Hmm, not sure. Anssi, do you know if anyone carries decent argive for linux-input@vger?

Signature · 1 line
Dmitry
#5 lore raw
Quoted 11 lines · Dmitry Torokhov
Quoted 7 lines · David Brownell
Quoted 2 lines · Dmitry Torokhov

@vger is the correct only, we are migrating from @atrey due to heavy spam issues.

Are there better archives for that list? Like, ones which include March and April? I tried marc.info first, and it had nothing...

Hmm, not sure. Anssi, do you know if anyone carries decent argive for linux-input@vger?

Yes, gmane carries it:
http://dir.gmane.org/gmane.linux.kernel.input

They seem to still report the old list address when clicking the "Address" link, though, even though messages from @vger do get archived.

Signature · 1 line
Anssi Hannula
#6 lore raw
Quoted 10 lines · Anssi Hannula
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · David Brownell
Quoted 2 lines · Dmitry Torokhov

@vger is the correct only, we are migrating from @atrey due to heavy spam issues.

Are there better archives for that list? Like, ones which include March and April? I tried marc.info first, and it had nothing...

Quoted 8 lines
Quoted 2 lines

Hmm, not sure. Anssi, do you know if anyone carries decent argive for linux-input@vger?

Yes, gmane carries it:
http://dir.gmane.org/gmane.linux.kernel.input

They seem to still report the old list address when clicking the "Address" link, though, even though messages from @vger do get archived.

That points to the @atrey list at mail-archive.com. There's a separate archive at mail-archive.com pointing to the @vger list (which doesn't go past end-of-February, as I've previously reported).

Posts that I sent to the @vger list in December and January showed up in the @vger archive, not the @atrey one ... and ones I've sent to the @vger list *only* in recent months do not seem to appear anywhere. (Which is why I posted to the @atrey list recently. That seems to have been effective at getting the patches noticed, unlike using the @vger list...)

Things seem to be pretty screwey ...

#7 lore raw
Quoted 23 lines · David Brownell
Quoted 9 lines · Anssi Hannula
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines · David Brownell
Quoted 2 lines · Dmitry Torokhov

@vger is the correct only, we are migrating from @atrey due to heavy spam issues.

Are there better archives for that list? Like, ones which include March and April? I tried marc.info first, and it had nothing...

Quoted 7 lines
Quoted 2 lines

Hmm, not sure. Anssi, do you know if anyone carries decent argive for linux-input@vger?

Yes, gmane carries it:
http://dir.gmane.org/gmane.linux.kernel.input

They seem to still report the old list address when clicking the "Address" link, though, even though messages from @vger do get archived.

That points to the @atrey list at mail-archive.com. There's a separate archive at mail-archive.com pointing to the @vger list (which doesn't go past end-of-February, as I've previously reported).

Quoted 4 lines

Posts that I sent to the @vger list in December and January showed up in the @vger archive, not the @atrey one ... and ones I've sent to the @vger list *only* in recent months do not seem to appear anywhere.

??

On the gmane link I posted above, click e.g. the "using frames and threads" link. There you can see all the messages of March and April as well.

Dunno what is going on with mail-archive.com.

Quoted 3 lines

(Which is why I posted to the
@atrey list recently. That seems to have been effective at getting the patches noticed, unlike using the @vger list...)

Most likely just resending in @vger would've had the same effect.

Quoted 2 lines

Things seem to be pretty screwey ...

Signature · 1 line
Anssi Hannula
#8 lore raw
Quoted 3 lines · Anssi Hannula

On the gmane link I posted above, click e.g. the "using frames and threads" link. There you can see all the messages of March and April as well.

Sorry, my bad. I went straight to the text at the bottom desribing the list and where it's archive was to be found, ignoring the text up top ...

Quoted 1 line

Dunno what is going on with mail-archive.com.