diff options
author | Andy Ross <andy.ross@windriver.com> | 2010-09-01 02:00:41 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-09-01 22:43:30 -0400 |
commit | a9cfa2537c503229eed029dcb9916ffd74695f56 (patch) | |
tree | 650e43818e6ee14fe911832c9dd6d028fe71b68f /drivers | |
parent | 409d568dc5f0dd179b5343630b65fdf082c14069 (diff) |
Staging: mrst-touchscreen - simplify en/disable of interrupts for NEC
Use 8 bit update commands instead of a 16 bit unaligned read/write
pair which fails after the first few calls; the voodoo in the original
doesn't seem to be required with this mechanism.
Tested-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andy Ross <andy.ross@windriver.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/mrst-touchscreen/intel-mid-touch.c | 60 |
1 files changed, 5 insertions, 55 deletions
diff --git a/drivers/staging/mrst-touchscreen/intel-mid-touch.c b/drivers/staging/mrst-touchscreen/intel-mid-touch.c index 2b9a7864ee71..c0307b22d86f 100644 --- a/drivers/staging/mrst-touchscreen/intel-mid-touch.c +++ b/drivers/staging/mrst-touchscreen/intel-mid-touch.c | |||
@@ -113,17 +113,7 @@ struct mrstouch_dev { | |||
113 | 113 | ||
114 | static int mrstouch_nec_adc_read_prepare(struct mrstouch_dev *tsdev) | 114 | static int mrstouch_nec_adc_read_prepare(struct mrstouch_dev *tsdev) |
115 | { | 115 | { |
116 | u16 reg; | 116 | return intel_scu_ipc_update_register(PMIC_REG_MADCINT, 0, 0x20); |
117 | int err; | ||
118 | |||
119 | err = intel_scu_ipc_ioread16(PMIC_REG_MADCINT, ®); | ||
120 | if (err) | ||
121 | return err; | ||
122 | |||
123 | reg &= 0xDFFF; /* Disable pendet */ | ||
124 | |||
125 | /* Set MADCINT and update ADCCNTL1 (next reg byte) */ | ||
126 | return intel_scu_ipc_iowrite16(PMIC_REG_MADCINT, reg); | ||
127 | } | 117 | } |
128 | 118 | ||
129 | /* | 119 | /* |
@@ -131,53 +121,13 @@ static int mrstouch_nec_adc_read_prepare(struct mrstouch_dev *tsdev) | |||
131 | */ | 121 | */ |
132 | static int mrstouch_nec_adc_read_finish(struct mrstouch_dev *tsdev) | 122 | static int mrstouch_nec_adc_read_finish(struct mrstouch_dev *tsdev) |
133 | { | 123 | { |
134 | u16 reg; | ||
135 | u8 r; | ||
136 | u8 pendet_enabled; | ||
137 | int retry = 0; | ||
138 | int err; | 124 | int err; |
139 | 125 | ||
140 | err = intel_scu_ipc_ioread16(PMIC_REG_MADCINT, ®); | 126 | err = intel_scu_ipc_update_register(PMIC_REG_MADCINT, 0x20, 0x20); |
141 | if (err) | 127 | if (!err) |
142 | return err; | 128 | err = intel_scu_ipc_update_register(PMIC_REG_ADCCNTL1, 0, 0x05); |
143 | |||
144 | reg &= ~0x0005; | ||
145 | reg |= 0x2000; /* Enable pendet */ | ||
146 | |||
147 | /* Set MADCINT and update ADCCNTL1 (next reg byte) */ | ||
148 | err = intel_scu_ipc_iowrite16(PMIC_REG_MADCINT, reg); | ||
149 | if (err) | ||
150 | return err; | ||
151 | |||
152 | /* | ||
153 | * Sometimes even after the register write succeeds | ||
154 | * the PMIC register value is not updated. Retry few iterations | ||
155 | * to enable pendet. | ||
156 | */ | ||
157 | do { | ||
158 | err = intel_scu_ipc_ioread8(PMIC_REG_ADCCNTL1, &r); | ||
159 | if (err) | ||
160 | return err; | ||
161 | |||
162 | pendet_enabled = (r >> 5) & 0x01; | ||
163 | 129 | ||
164 | if (!pendet_enabled) { | 130 | return err; |
165 | if (++retry >= 10) { | ||
166 | dev_err(tsdev->dev, | ||
167 | "Touch screen disabled.\n"); | ||
168 | return -EIO; | ||
169 | } | ||
170 | |||
171 | msleep(10); | ||
172 | |||
173 | err = intel_scu_ipc_iowrite8(PMIC_REG_ADCCNTL1, | ||
174 | reg >> 8); | ||
175 | if (err) | ||
176 | return err; | ||
177 | } | ||
178 | } while (!pendet_enabled); | ||
179 | |||
180 | return 0; | ||
181 | } | 131 | } |
182 | 132 | ||
183 | /* | 133 | /* |