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

Input: touchscreen: use wrapper for pxa2xx ac97 registers

To avoid a dependency on the pxa platform header files with
hardcoded registers, change the driver to call a wrapper
in the pxa2xx-ac97-lib that encapsulates all the other
ac97 stuff.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: linux-input@vger.kernel.org
Cc: alsa-devel@alsa-project.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+32 -14
+2
drivers/input/touchscreen/Kconfig
··· 902 902 config TOUCHSCREEN_WM97XX_MAINSTONE 903 903 tristate "WM97xx Mainstone/Palm accelerated touch" 904 904 depends on TOUCHSCREEN_WM97XX && ARCH_PXA 905 + depends on SND_PXA2XX_LIB_AC97 905 906 help 906 907 Say Y here for support for streaming mode with WM97xx touchscreens 907 908 on Mainstone, Palm Tungsten T5, TX and LifeDrive systems. ··· 915 914 config TOUCHSCREEN_WM97XX_ZYLONITE 916 915 tristate "Zylonite accelerated touch" 917 916 depends on TOUCHSCREEN_WM97XX && MACH_ZYLONITE 917 + depends on SND_PXA2XX_LIB_AC97 918 918 select TOUCHSCREEN_WM9713 919 919 help 920 920 Say Y here for support for streaming mode with the touchscreen
+8 -8
drivers/input/touchscreen/mainstone-wm97xx.c
··· 28 28 #include <linux/soc/pxa/cpu.h> 29 29 #include <linux/wm97xx.h> 30 30 31 - #include <mach/regs-ac97.h> 31 + #include <sound/pxa2xx-lib.h> 32 32 33 33 #include <asm/mach-types.h> 34 34 ··· 104 104 msleep(1); 105 105 106 106 if (cpu_is_pxa27x()) { 107 - while (MISR & (1 << 2)) 108 - MODR; 107 + while (pxa2xx_ac97_read_misr() & (1 << 2)) 108 + pxa2xx_ac97_read_modr(); 109 109 } else if (cpu_is_pxa3xx()) { 110 110 for (count = 0; count < 16; count++) 111 - MODR; 111 + pxa2xx_ac97_read_modr(); 112 112 } 113 113 } 114 114 ··· 130 130 return RC_PENUP; 131 131 } 132 132 133 - x = MODR; 133 + x = pxa2xx_ac97_read_modr(); 134 134 if (x == last) { 135 135 tries++; 136 136 return RC_AGAIN; ··· 138 138 last = x; 139 139 do { 140 140 if (reads) 141 - x = MODR; 142 - y = MODR; 141 + x = pxa2xx_ac97_read_modr(); 142 + y = pxa2xx_ac97_read_modr(); 143 143 if (pressure) 144 - p = MODR; 144 + p = pxa2xx_ac97_read_modr(); 145 145 146 146 dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n", 147 147 x, y, p);
+6 -6
drivers/input/touchscreen/zylonite-wm97xx.c
··· 24 24 #include <linux/soc/pxa/cpu.h> 25 25 #include <linux/wm97xx.h> 26 26 27 - #include <mach/regs-ac97.h> 27 + #include <sound/pxa2xx-lib.h> 28 28 29 29 struct continuous { 30 30 u16 id; /* codec id */ ··· 79 79 msleep(1); 80 80 81 81 for (i = 0; i < 16; i++) 82 - MODR; 82 + pxa2xx_ac97_read_modr(); 83 83 } 84 84 85 85 static int wm97xx_acc_pen_down(struct wm97xx *wm) ··· 100 100 return RC_PENUP; 101 101 } 102 102 103 - x = MODR; 103 + x = pxa2xx_ac97_read_modr(); 104 104 if (x == last) { 105 105 tries++; 106 106 return RC_AGAIN; ··· 108 108 last = x; 109 109 do { 110 110 if (reads) 111 - x = MODR; 112 - y = MODR; 111 + x = pxa2xx_ac97_read_modr(); 112 + y = pxa2xx_ac97_read_modr(); 113 113 if (pressure) 114 - p = MODR; 114 + p = pxa2xx_ac97_read_modr(); 115 115 116 116 dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n", 117 117 x, y, p);
+4
include/sound/pxa2xx-lib.h
··· 52 52 extern int pxa2xx_ac97_hw_probe(struct platform_device *dev); 53 53 extern void pxa2xx_ac97_hw_remove(struct platform_device *dev); 54 54 55 + /* modem registers, used by touchscreen driver */ 56 + u32 pxa2xx_ac97_read_modr(void); 57 + u32 pxa2xx_ac97_read_misr(void); 58 + 55 59 #endif
+12
sound/arm/pxa2xx-ac97-lib.c
··· 428 428 } 429 429 EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_remove); 430 430 431 + u32 pxa2xx_ac97_read_modr(void) 432 + { 433 + return MODR; 434 + } 435 + EXPORT_SYMBOL_GPL(pxa2xx_ac97_read_modr); 436 + 437 + u32 pxa2xx_ac97_read_misr(void) 438 + { 439 + return MISR; 440 + } 441 + EXPORT_SYMBOL_GPL(pxa2xx_ac97_read_misr); 442 + 431 443 MODULE_AUTHOR("Nicolas Pitre"); 432 444 MODULE_DESCRIPTION("Intel/Marvell PXA sound library"); 433 445 MODULE_LICENSE("GPL");