]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Input: ucb1400_ts - enable ADC Filter
authorMarek Vasut <marek.vasut@gmail.com>
Fri, 21 Aug 2009 05:05:53 +0000 (22:05 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 21 Aug 2009 07:53:12 +0000 (00:53 -0700)
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.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Tested-by: Palo Revak <palo@bielyvlk.sk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/touchscreen/ucb1400_ts.c
include/linux/ucb1400.h

index 6954f55001080d29b337a37c9398b6c8f867ec1a..3b345f9cf0c712cdd67516b9d129d6dd1aa310bf 100644 (file)
@@ -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,14 @@ 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);
index ed889f4168f301a877c4e7384e207cb6fae2bb4d..ae779bb8cc0f7fb3d710be1916f1006e43f95c60 100644 (file)
 
 #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