Skip to contentSkip to conversation

Enable ADC Filter on UCB1400

PATCH In review Marek Vasut 3 participants 5 messages Jul 30, 2009 – Aug 4, 2009

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

PATCH 1/1 Enable ADC Filter on UCB1400

Hi!

please consider applying the following patch. I tested it on Palm Tungsten|C (ADCSYNC connected, both disabled and enabled through module parameter) and a friend of mine tested it on Toradex Colibri (ADCSYNC not connected, disabled).

Thanks

Quoted 1 line

From 65cb92df1aba511fbc44d62fa25d5cf38a687952 Mon Sep 17 00:00:00 2001

From: Marek Vasut <[email protected]>
Date: Thu, 30 Jul 2009 19:03:10 +0200
Subject: [PATCH] Enable ADC Filter on UCB1400

This patch enables ADC filtering on UCB1400 codec by default. The benefit from this change is mostly on some Colibri boards where the ADCSYNC pin of the UCB1400 codec isn't connected causing the touchscreen to jitter very badly. This change has no visible effect on boards where the ADCSYNC pin is connected.

---
 drivers/input/touchscreen/ucb1400_ts.c |    6 ++++++
 include/linux/ucb1400.h                |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/input/touchscreen/ucb1400_ts.c
index b2828a3..df8e5f3 100644

drivers/input/touchscreen/ucb1400_ts.c +6 -0
@@ -345,6 +345,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb)
 static int ucb1400_ts_probe(struct platform_device *dev)
 {
 	int error, x_res, y_res;
+	u16 fcsr;
 	struct ucb1400_ts *ucb = dev->dev.platform_data;
 
 	ucb->ts_idev = input_allocate_device();
@@ -382,6 +383,11 @@ static int ucb1400_ts_probe(struct platform_device *dev)
 	ucb->ts_idev->evbit[0]		= BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
 	ucb->ts_idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
 
+	/* Enable ADC filter to prevent horrible jitter on Colibri. This also
+	 * further reduces jitter on boards where ADCSYNC pin is connected. */
+	fcsr = ucb1400_reg_read(ucb->ac97, UCB_FCSR);
+	ucb1400_reg_write(ucb->ac97, UCB_FCSR, fcsr | UCB_FCSR_AVE);
+
 	ucb1400_adc_enable(ucb->ac97);
 	x_res = ucb1400_ts_read_xres(ucb);
 	y_res = ucb1400_ts_read_yres(ucb);
include/linux/ucb1400.h +4 -0
index 464fb34..e489ff6 100644
@@ -74,6 +74,10 @@
 
 #define UCB_ADC_DATA		0x68
 #define UCB_ADC_DAT_VALID	(1 << 15)
+
+#define UCB_FCSR		0x6c
+#define UCB_FCSR_AVE		(1 << 12)
+
 #define UCB_ADC_DAT_MASK	0x3ff
 
 #define UCB_ID			0x7e
Signature · 1 line
1.6.3.3
#1 lore raw

Dne Čt 30. července 2009 19:22:24 Marek Vasut napsal(a):

Quoted 8 lines

Hi!

please consider applying the following patch. I tested it on Palm Tungsten|C (ADCSYNC connected, both disabled and enabled through module parameter) and a friend of mine tested it on Toradex Colibri (ADCSYNC not connected, disabled).

Thanks

Hi!

any updates on this? Thanks

Quoted 48 lines

From 65cb92df1aba511fbc44d62fa25d5cf38a687952 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Thu, 30 Jul 2009 19:03:10 +0200
Subject: [PATCH] Enable ADC Filter on UCB1400

This patch enables ADC filtering on UCB1400 codec by default. The benefit from this change is mostly on some Colibri boards where the ADCSYNC pin of the UCB1400 codec isn't connected causing the touchscreen to jitter very badly. This change has no visible effect on boards where the ADCSYNC pin is connected.

---
 drivers/input/touchscreen/ucb1400_ts.c |    6 ++++++
 include/linux/ucb1400.h                |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ucb1400_ts.c +6 -0
index b2828a3..df8e5f3 100644
@@ -345,6 +345,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts
 *ucb) static int ucb1400_ts_probe(struct platform_device *dev)
 {
 	int error, x_res, y_res;
+	u16 fcsr;
 	struct ucb1400_ts *ucb = dev->dev.platform_data;
 
 	ucb->ts_idev = input_allocate_device();
@@ -382,6 +383,11 @@ static int ucb1400_ts_probe(struct platform_device
 *dev) ucb->ts_idev->evbit[0]		= BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
 	ucb->ts_idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
 
+	/* Enable ADC filter to prevent horrible jitter on Colibri. This also
+	 * further reduces jitter on boards where ADCSYNC pin is connected. */
+	fcsr = ucb1400_reg_read(ucb->ac97, UCB_FCSR);
+	ucb1400_reg_write(ucb->ac97, UCB_FCSR, fcsr | UCB_FCSR_AVE);
+
 	ucb1400_adc_enable(ucb->ac97);
 	x_res = ucb1400_ts_read_xres(ucb);
 	y_res = ucb1400_ts_read_yres(ucb);
include/linux/ucb1400.h +0 -0
index 464fb34..e489ff6 100644

include/linux/ucb1400.h line 83

Quoted 10 lines
include/linux/ucb1400.h +4 -0
@@ -74,6 +74,10 @@
 
 #define UCB_ADC_DATA		0x68
 #define UCB_ADC_DAT_VALID	(1 << 15)
+
+#define UCB_FCSR		0x6c
+#define UCB_FCSR_AVE		(1 << 12)
+
 #define UCB_ADC_DAT_MASK	0x3ff
 
 #define UCB_ID			0x7e

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Tested-by
#2 lore raw

Hi, this is very helpful to me.
I had jitter about+/- 5 pixels without this patch on Colibri PXA270 module and with jitter about +/- 1 pixel. thanks.

Quoted 70 lines · On Sunday 02 August 2009 12:02:36 Marek Vasut wrote:

Dne Čt 30. července 2009 19:22:24 Marek Vasut napsal(a):

Quoted 8 lines

Hi!

please consider applying the following patch. I tested it on Palm Tungsten|C (ADCSYNC connected, both disabled and enabled through module parameter) and a friend of mine tested it on Toradex Colibri (ADCSYNC not connected, disabled).

Thanks

Hi!

any updates on this? Thanks

Quoted 57 lines

From 65cb92df1aba511fbc44d62fa25d5cf38a687952 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Thu, 30 Jul 2009 19:03:10 +0200
Subject: [PATCH] Enable ADC Filter on UCB1400

This patch enables ADC filtering on UCB1400 codec by default. The benefit from this change is mostly on some Colibri boards where the ADCSYNC pin of the UCB1400 codec isn't connected causing the touchscreen to jitter very badly. This change has no visible effect on boards where the ADCSYNC pin is connected.

---
 drivers/input/touchscreen/ucb1400_ts.c |    6 ++++++
 include/linux/ucb1400.h                |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ucb1400_ts.c +6 -0
index b2828a3..df8e5f3 100644
@@ -345,6 +345,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts
 *ucb) static int ucb1400_ts_probe(struct platform_device *dev)
 {
 	int error, x_res, y_res;
+	u16 fcsr;
 	struct ucb1400_ts *ucb = dev->dev.platform_data;
 
 	ucb->ts_idev = input_allocate_device();
@@ -382,6 +383,11 @@ static int ucb1400_ts_probe(struct platform_device
 *dev) ucb->ts_idev->evbit[0]		= BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
 	ucb->ts_idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
 
+	/* Enable ADC filter to prevent horrible jitter on Colibri. This also
+	 * further reduces jitter on boards where ADCSYNC pin is connected. */
+	fcsr = ucb1400_reg_read(ucb->ac97, UCB_FCSR);
+	ucb1400_reg_write(ucb->ac97, UCB_FCSR, fcsr | UCB_FCSR_AVE);
+
 	ucb1400_adc_enable(ucb->ac97);
 	x_res = ucb1400_ts_read_xres(ucb);
 	y_res = ucb1400_ts_read_yres(ucb);
include/linux/ucb1400.h +4 -0
index 464fb34..e489ff6 100644
@@ -74,6 +74,10 @@
 
 #define UCB_ADC_DATA		0x68
 #define UCB_ADC_DAT_VALID	(1 << 15)
+
+#define UCB_FCSR		0x6c
+#define UCB_FCSR_AVE		(1 << 12)
+
 #define UCB_ADC_DAT_MASK	0x3ff
 
Quoted 3 lines

include/linux/ucb1400.h line 83

Quoted 1 line
include/linux/ucb1400.h +0 -0
 #define UCB_ID			0x7e

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#3 lore raw
In reply to Marek Vasut
Quoted 13 lines · Marek Vasut

Hi!

please consider applying the following patch. I tested it on Palm Tungsten|C (ADCSYNC connected, both disabled and enabled through module parameter) and a friend of mine tested it on Toradex Colibri (ADCSYNC not connected, disabled).

Thanks

From 65cb92df1aba511fbc44d62fa25d5cf38a687952 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Thu, 30 Jul 2009 19:03:10 +0200
Subject: [PATCH] Enable ADC Filter on UCB1400

Quoted 6 lines

This patch enables ADC filtering on UCB1400 codec by default. The benefit from this change is mostly on some Colibri boards where the ADCSYNC pin of the UCB1400 codec isn't connected causing the touchscreen to jitter very badly. This change has no visible effect on boards where the ADCSYNC pin is connected.

I wonder if it would not be safer to only enable filtering if platform requests it (via platform data)?

Signature · 1 line
Dmitry
#4 lore raw

Dne Po 3. srpna 2009 21:15:41 Dmitry Torokhov napsal(a):

Quoted 15 lines · Marek Vasut
Quoted 14 lines

Hi!

please consider applying the following patch. I tested it on Palm Tungsten|C (ADCSYNC connected, both disabled and enabled through module parameter) and a friend of mine tested it on Toradex Colibri (ADCSYNC not connected, disabled).

Thanks

From 65cb92df1aba511fbc44d62fa25d5cf38a687952 Mon Sep 17 00:00:00 2001
From: Marek Vasut <[email protected]>
Date: Thu, 30 Jul 2009 19:03:10 +0200
Subject: [PATCH] Enable ADC Filter on UCB1400

Quoted 8 lines
Quoted 5 lines

This patch enables ADC filtering on UCB1400 codec by default. The benefit from this change is mostly on some Colibri boards where the ADCSYNC pin of the UCB1400 codec isn't connected causing the touchscreen to jitter very badly. This change has no visible effect on boards where the ADCSYNC pin is connected.

I wonder if it would not be safer to only enable filtering if platform requests it (via platform data)?

Hi!

It'd be much safer, yes. But:
1) as I said, this has no side effects (yes, this sounds like a very strong argument, I know ;-) ).
2) Im still waiting for Eric Miao to make his way through the 'passing platform data to devices on the ac97 bus' thread in alsa-ML. This basically means, there's currently no way to pass platform data to ac97 devices. Of course, this driver (ucb1400) wont be the only one which will get special patching treatment once those AC97 patches are in.

btw. I hope Eric can make it before .32

Thanks!