mainstone-wm97xx.c (7b8a0b90b6597fb6853383d28db2b1b0ebac0924) mainstone-wm97xx.c (e217b085a1ac1c4108fe632bdaa08ea5b0ecd145)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * mainstone-wm97xx.c -- Mainstone Continuous Touch screen driver for
4 * Wolfson WM97xx AC97 Codecs.
5 *
6 * Copyright 2004, 2007 Wolfson Microelectronics PLC.
7 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
8 * Parts Copyright : Ian Molton <spyro@f2s.com>

--- 14 unchanged lines hidden (view full) ---

23#include <linux/delay.h>
24#include <linux/gpio/consumer.h>
25#include <linux/irq.h>
26#include <linux/interrupt.h>
27#include <linux/io.h>
28#include <linux/soc/pxa/cpu.h>
29#include <linux/wm97xx.h>
30
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * mainstone-wm97xx.c -- Mainstone Continuous Touch screen driver for
4 * Wolfson WM97xx AC97 Codecs.
5 *
6 * Copyright 2004, 2007 Wolfson Microelectronics PLC.
7 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
8 * Parts Copyright : Ian Molton <spyro@f2s.com>

--- 14 unchanged lines hidden (view full) ---

23#include <linux/delay.h>
24#include <linux/gpio/consumer.h>
25#include <linux/irq.h>
26#include <linux/interrupt.h>
27#include <linux/io.h>
28#include <linux/soc/pxa/cpu.h>
29#include <linux/wm97xx.h>
30
31#include <mach/regs-ac97.h>
31#include <sound/pxa2xx-lib.h>
32
33#include <asm/mach-types.h>
34
35struct continuous {
36 u16 id; /* codec id */
37 u8 code; /* continuous code */
38 u8 reads; /* number of coord reads per read cycle */
39 u32 speed; /* number of coords per second */

--- 59 unchanged lines hidden (view full) ---

99/* flush AC97 slot 5 FIFO on pxa machines */
100static void wm97xx_acc_pen_up(struct wm97xx *wm)
101{
102 unsigned int count;
103
104 msleep(1);
105
106 if (cpu_is_pxa27x()) {
32
33#include <asm/mach-types.h>
34
35struct continuous {
36 u16 id; /* codec id */
37 u8 code; /* continuous code */
38 u8 reads; /* number of coord reads per read cycle */
39 u32 speed; /* number of coords per second */

--- 59 unchanged lines hidden (view full) ---

99/* flush AC97 slot 5 FIFO on pxa machines */
100static void wm97xx_acc_pen_up(struct wm97xx *wm)
101{
102 unsigned int count;
103
104 msleep(1);
105
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 } else if (cpu_is_pxa3xx()) {
110 for (count = 0; count < 16; count++)
109 } else if (cpu_is_pxa3xx()) {
110 for (count = 0; count < 16; count++)
111 MODR;
111 pxa2xx_ac97_read_modr();
112 }
113}
114
115static int wm97xx_acc_pen_down(struct wm97xx *wm)
116{
117 u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES;
118 int reads = 0;
119 static u16 last, tries;

--- 5 unchanged lines hidden (view full) ---

125 */
126 msleep(1);
127
128 if (tries > 5) {
129 tries = 0;
130 return RC_PENUP;
131 }
132
112 }
113}
114
115static int wm97xx_acc_pen_down(struct wm97xx *wm)
116{
117 u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES;
118 int reads = 0;
119 static u16 last, tries;

--- 5 unchanged lines hidden (view full) ---

125 */
126 msleep(1);
127
128 if (tries > 5) {
129 tries = 0;
130 return RC_PENUP;
131 }
132
133 x = MODR;
133 x = pxa2xx_ac97_read_modr();
134 if (x == last) {
135 tries++;
136 return RC_AGAIN;
137 }
138 last = x;
139 do {
140 if (reads)
134 if (x == last) {
135 tries++;
136 return RC_AGAIN;
137 }
138 last = x;
139 do {
140 if (reads)
141 x = MODR;
142 y = MODR;
141 x = pxa2xx_ac97_read_modr();
142 y = pxa2xx_ac97_read_modr();
143 if (pressure)
143 if (pressure)
144 p = MODR;
144 p = pxa2xx_ac97_read_modr();
145
146 dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n",
147 x, y, p);
148
149 /* are samples valid */
150 if ((x & WM97XX_ADCSEL_MASK) != WM97XX_ADCSEL_X ||
151 (y & WM97XX_ADCSEL_MASK) != WM97XX_ADCSEL_Y ||
152 (p & WM97XX_ADCSEL_MASK) != WM97XX_ADCSEL_PRES)

--- 143 unchanged lines hidden ---
145
146 dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n",
147 x, y, p);
148
149 /* are samples valid */
150 if ((x & WM97XX_ADCSEL_MASK) != WM97XX_ADCSEL_X ||
151 (y & WM97XX_ADCSEL_MASK) != WM97XX_ADCSEL_Y ||
152 (p & WM97XX_ADCSEL_MASK) != WM97XX_ADCSEL_PRES)

--- 143 unchanged lines hidden ---