Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

input: touchscreen: mainstone: sync with zylonite driver

The two drivers are almost identical and can work on a variety
of hardware in principle. The mainstone driver supports additional
hardware, and the zylonite driver has a few cleanup patches.

Sync the two by adding the zylonite changes into the mainstone
one, and checking for the zylonite board to order to keep the
default behavior (interrupt enabled) there.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+31 -28
+31 -28
drivers/input/touchscreen/mainstone-wm97xx.c
··· 24 24 #include <linux/gpio/consumer.h> 25 25 #include <linux/irq.h> 26 26 #include <linux/interrupt.h> 27 - #include <linux/wm97xx.h> 28 27 #include <linux/io.h> 29 - #include <linux/gpio.h> 28 + #include <linux/soc/pxa/cpu.h> 29 + #include <linux/wm97xx.h> 30 30 31 31 #include <mach/regs-ac97.h> 32 32 ··· 42 42 #define WM_READS(sp) ((sp / HZ) + 1) 43 43 44 44 static const struct continuous cinfo[] = { 45 - {WM9705_ID2, 0, WM_READS(94), 94}, 46 - {WM9705_ID2, 1, WM_READS(188), 188}, 47 - {WM9705_ID2, 2, WM_READS(375), 375}, 48 - {WM9705_ID2, 3, WM_READS(750), 750}, 49 - {WM9712_ID2, 0, WM_READS(94), 94}, 50 - {WM9712_ID2, 1, WM_READS(188), 188}, 51 - {WM9712_ID2, 2, WM_READS(375), 375}, 52 - {WM9712_ID2, 3, WM_READS(750), 750}, 53 - {WM9713_ID2, 0, WM_READS(94), 94}, 54 - {WM9713_ID2, 1, WM_READS(120), 120}, 55 - {WM9713_ID2, 2, WM_READS(154), 154}, 56 - {WM9713_ID2, 3, WM_READS(188), 188}, 45 + { WM9705_ID2, 0, WM_READS(94), 94 }, 46 + { WM9705_ID2, 1, WM_READS(188), 188 }, 47 + { WM9705_ID2, 2, WM_READS(375), 375 }, 48 + { WM9705_ID2, 3, WM_READS(750), 750 }, 49 + { WM9712_ID2, 0, WM_READS(94), 94 }, 50 + { WM9712_ID2, 1, WM_READS(188), 188 }, 51 + { WM9712_ID2, 2, WM_READS(375), 375 }, 52 + { WM9712_ID2, 3, WM_READS(750), 750 }, 53 + { WM9713_ID2, 0, WM_READS(94), 94 }, 54 + { WM9713_ID2, 1, WM_READS(120), 120 }, 55 + { WM9713_ID2, 2, WM_READS(154), 154 }, 56 + { WM9713_ID2, 3, WM_READS(188), 188 }, 57 57 }; 58 58 59 59 /* continuous speed index */ 60 60 static int sp_idx; 61 - static u16 last, tries; 62 61 static struct gpio_desc *gpiod_irq; 63 62 64 63 /* ··· 101 102 { 102 103 unsigned int count; 103 104 104 - schedule_timeout_uninterruptible(1); 105 + msleep(1); 105 106 106 107 if (cpu_is_pxa27x()) { 107 108 while (MISR & (1 << 2)) ··· 116 117 { 117 118 u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES; 118 119 int reads = 0; 120 + static u16 last, tries; 119 121 120 122 /* When the AC97 queue has been drained we need to allow time 121 123 * to buffer up samples otherwise we end up spinning polling 122 124 * for samples. The controller can't have a suitably low 123 125 * threshold set to use the notifications it gives. 124 126 */ 125 - schedule_timeout_uninterruptible(1); 127 + msleep(1); 126 128 127 129 if (tries > 5) { 128 130 tries = 0; ··· 193 193 /* There is some obscure mutant of WM9712 interbred with WM9713 194 194 * used on Palm HW */ 195 195 wm->variant = WM97xx_WM1613; 196 + } else if (machine_is_zylonite()) { 197 + pen_int = 1; 196 198 } 197 199 198 200 if (pen_int) { ··· 255 253 } 256 254 257 255 static struct wm97xx_mach_ops mainstone_mach_ops = { 258 - .acc_enabled = 1, 259 - .acc_pen_up = wm97xx_acc_pen_up, 260 - .acc_pen_down = wm97xx_acc_pen_down, 261 - .acc_startup = wm97xx_acc_startup, 262 - .acc_shutdown = wm97xx_acc_shutdown, 263 - .irq_enable = wm97xx_irq_enable, 264 - .irq_gpio = WM97XX_GPIO_2, 256 + .acc_enabled = 1, 257 + .acc_pen_up = wm97xx_acc_pen_up, 258 + .acc_pen_down = wm97xx_acc_pen_down, 259 + .acc_startup = wm97xx_acc_startup, 260 + .acc_shutdown = wm97xx_acc_shutdown, 261 + .irq_enable = wm97xx_irq_enable, 262 + .irq_gpio = WM97XX_GPIO_2, 265 263 }; 266 264 267 265 static int mainstone_wm97xx_probe(struct platform_device *pdev) ··· 276 274 struct wm97xx *wm = platform_get_drvdata(pdev); 277 275 278 276 wm97xx_unregister_mach_ops(wm); 277 + 279 278 return 0; 280 279 } 281 280 282 281 static struct platform_driver mainstone_wm97xx_driver = { 283 - .probe = mainstone_wm97xx_probe, 284 - .remove = mainstone_wm97xx_remove, 285 - .driver = { 286 - .name = "wm97xx-touch", 282 + .probe = mainstone_wm97xx_probe, 283 + .remove = mainstone_wm97xx_remove, 284 + .driver = { 285 + .name = "wm97xx-touch", 287 286 }, 288 287 }; 289 288 module_platform_driver(mainstone_wm97xx_driver);