aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2012-10-30 03:09:18 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-10-30 03:09:18 -0400
commit68fe0f0a6dcd2ac1ace5da3647a6d1cf0f4d2fea (patch)
tree69d855c2e46d42ef8f23680cf3a1e6ff38de9ef4 /drivers/input/touchscreen
parent88fd449e734a4264347e12b8ff74ccb33a9b9a35 (diff)
parent8f0d8163b50e01f398b14bcd4dc039ac5ab18d64 (diff)
Merge tag 'v3.7-rc3' into for-linus to sync up with recent USB changes
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/88pm860x-ts.c127
-rw-r--r--drivers/input/touchscreen/s3c2410_ts.c2
-rw-r--r--drivers/input/touchscreen/wm831x-ts.c2
3 files changed, 113 insertions, 18 deletions
diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c
index 05f30b73c3c..326218dbd6e 100644
--- a/drivers/input/touchscreen/88pm860x-ts.c
+++ b/drivers/input/touchscreen/88pm860x-ts.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/of.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
14#include <linux/i2c.h> 15#include <linux/i2c.h>
15#include <linux/input.h> 16#include <linux/input.h>
@@ -113,14 +114,69 @@ static void pm860x_touch_close(struct input_dev *dev)
113 pm860x_set_bits(touch->i2c, MEAS_EN3, data, 0); 114 pm860x_set_bits(touch->i2c, MEAS_EN3, data, 0);
114} 115}
115 116
117#ifdef CONFIG_OF
118static int __devinit pm860x_touch_dt_init(struct platform_device *pdev,
119 struct pm860x_chip *chip,
120 int *res_x)
121{
122 struct device_node *np = pdev->dev.parent->of_node;
123 struct i2c_client *i2c = (chip->id == CHIP_PM8607) ? chip->client \
124 : chip->companion;
125 int data, n, ret;
126 if (!np)
127 return -ENODEV;
128 np = of_find_node_by_name(np, "touch");
129 if (!np) {
130 dev_err(&pdev->dev, "Can't find touch node\n");
131 return -EINVAL;
132 }
133 /* set GPADC MISC1 register */
134 data = 0;
135 if (!of_property_read_u32(np, "marvell,88pm860x-gpadc-prebias", &n))
136 data |= (n << 1) & PM8607_GPADC_PREBIAS_MASK;
137 if (!of_property_read_u32(np, "marvell,88pm860x-gpadc-slot-cycle", &n))
138 data |= (n << 3) & PM8607_GPADC_SLOT_CYCLE_MASK;
139 if (!of_property_read_u32(np, "marvell,88pm860x-gpadc-off-scale", &n))
140 data |= (n << 5) & PM8607_GPADC_OFF_SCALE_MASK;
141 if (!of_property_read_u32(np, "marvell,88pm860x-gpadc-sw-cal", &n))
142 data |= (n << 7) & PM8607_GPADC_SW_CAL_MASK;
143 if (data) {
144 ret = pm860x_reg_write(i2c, PM8607_GPADC_MISC1, data);
145 if (ret < 0)
146 return -EINVAL;
147 }
148 /* set tsi prebias time */
149 if (!of_property_read_u32(np, "marvell,88pm860x-tsi-prebias", &data)) {
150 ret = pm860x_reg_write(i2c, PM8607_TSI_PREBIAS, data);
151 if (ret < 0)
152 return -EINVAL;
153 }
154 /* set prebias & prechg time of pen detect */
155 data = 0;
156 if (!of_property_read_u32(np, "marvell,88pm860x-pen-prebias", &n))
157 data |= n & PM8607_PD_PREBIAS_MASK;
158 if (!of_property_read_u32(np, "marvell,88pm860x-pen-prechg", &n))
159 data |= n & PM8607_PD_PRECHG_MASK;
160 if (data) {
161 ret = pm860x_reg_write(i2c, PM8607_PD_PREBIAS, data);
162 if (ret < 0)
163 return -EINVAL;
164 }
165 of_property_read_u32(np, "marvell,88pm860x-resistor-X", res_x);
166 return 0;
167}
168#else
169#define pm860x_touch_dt_init(x, y, z) (-1)
170#endif
171
116static int __devinit pm860x_touch_probe(struct platform_device *pdev) 172static int __devinit pm860x_touch_probe(struct platform_device *pdev)
117{ 173{
118 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 174 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
119 struct pm860x_platform_data *pm860x_pdata = \ 175 struct pm860x_touch_pdata *pdata = pdev->dev.platform_data;
120 pdev->dev.parent->platform_data;
121 struct pm860x_touch_pdata *pdata = NULL;
122 struct pm860x_touch *touch; 176 struct pm860x_touch *touch;
123 int irq, ret; 177 struct i2c_client *i2c = (chip->id == CHIP_PM8607) ? chip->client \
178 : chip->companion;
179 int irq, ret, res_x = 0, data = 0;
124 180
125 irq = platform_get_irq(pdev, 0); 181 irq = platform_get_irq(pdev, 0);
126 if (irq < 0) { 182 if (irq < 0) {
@@ -128,16 +184,55 @@ static int __devinit pm860x_touch_probe(struct platform_device *pdev)
128 return -EINVAL; 184 return -EINVAL;
129 } 185 }
130 186
131 if (!pm860x_pdata) { 187 if (pm860x_touch_dt_init(pdev, chip, &res_x)) {
132 dev_err(&pdev->dev, "platform data is missing\n"); 188 if (pdata) {
133 return -EINVAL; 189 /* set GPADC MISC1 register */
134 } 190 data = 0;
135 191 data |= (pdata->gpadc_prebias << 1)
136 pdata = pm860x_pdata->touch; 192 & PM8607_GPADC_PREBIAS_MASK;
137 if (!pdata) { 193 data |= (pdata->slot_cycle << 3)
138 dev_err(&pdev->dev, "touchscreen data is missing\n"); 194 & PM8607_GPADC_SLOT_CYCLE_MASK;
139 return -EINVAL; 195 data |= (pdata->off_scale << 5)
196 & PM8607_GPADC_OFF_SCALE_MASK;
197 data |= (pdata->sw_cal << 7)
198 & PM8607_GPADC_SW_CAL_MASK;
199 if (data) {
200 ret = pm860x_reg_write(i2c,
201 PM8607_GPADC_MISC1, data);
202 if (ret < 0)
203 return -EINVAL;
204 }
205 /* set tsi prebias time */
206 if (pdata->tsi_prebias) {
207 data = pdata->tsi_prebias;
208 ret = pm860x_reg_write(i2c,
209 PM8607_TSI_PREBIAS, data);
210 if (ret < 0)
211 return -EINVAL;
212 }
213 /* set prebias & prechg time of pen detect */
214 data = 0;
215 data |= pdata->pen_prebias
216 & PM8607_PD_PREBIAS_MASK;
217 data |= (pdata->pen_prechg << 5)
218 & PM8607_PD_PRECHG_MASK;
219 if (data) {
220 ret = pm860x_reg_write(i2c,
221 PM8607_PD_PREBIAS, data);
222 if (ret < 0)
223 return -EINVAL;
224 }
225 res_x = pdata->res_x;
226 } else {
227 dev_err(&pdev->dev, "failed to get platform data\n");
228 return -EINVAL;
229 }
140 } 230 }
231 /* enable GPADC */
232 ret = pm860x_set_bits(i2c, PM8607_GPADC_MISC1, PM8607_GPADC_EN,
233 PM8607_GPADC_EN);
234 if (ret)
235 return ret;
141 236
142 touch = kzalloc(sizeof(struct pm860x_touch), GFP_KERNEL); 237 touch = kzalloc(sizeof(struct pm860x_touch), GFP_KERNEL);
143 if (touch == NULL) 238 if (touch == NULL)
@@ -158,9 +253,9 @@ static int __devinit pm860x_touch_probe(struct platform_device *pdev)
158 touch->idev->open = pm860x_touch_open; 253 touch->idev->open = pm860x_touch_open;
159 touch->idev->close = pm860x_touch_close; 254 touch->idev->close = pm860x_touch_close;
160 touch->chip = chip; 255 touch->chip = chip;
161 touch->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion; 256 touch->i2c = i2c;
162 touch->irq = irq + chip->irq_base; 257 touch->irq = irq;
163 touch->res_x = pdata->res_x; 258 touch->res_x = res_x;
164 input_set_drvdata(touch->idev, touch); 259 input_set_drvdata(touch->idev, touch);
165 260
166 ret = request_threaded_irq(touch->irq, NULL, pm860x_touch_handler, 261 ret = request_threaded_irq(touch->irq, NULL, pm860x_touch_handler,
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index b3c66d4d02f..549fa29548f 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -37,7 +37,7 @@
37 37
38#include <plat/adc.h> 38#include <plat/adc.h>
39#include <plat/regs-adc.h> 39#include <plat/regs-adc.h>
40#include <plat/ts.h> 40#include <linux/platform_data/touchscreen-s3c2410.h>
41 41
42#define TSC_SLEEP (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0)) 42#define TSC_SLEEP (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
43 43
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c
index e83410721e3..52abb98a8ae 100644
--- a/drivers/input/touchscreen/wm831x-ts.c
+++ b/drivers/input/touchscreen/wm831x-ts.c
@@ -221,7 +221,7 @@ static void wm831x_ts_input_close(struct input_dev *idev)
221 synchronize_irq(wm831x_ts->pd_irq); 221 synchronize_irq(wm831x_ts->pd_irq);
222 222
223 /* Make sure the IRQ completion work is quiesced */ 223 /* Make sure the IRQ completion work is quiesced */
224 flush_work_sync(&wm831x_ts->pd_data_work); 224 flush_work(&wm831x_ts->pd_data_work);
225 225
226 /* If we ended up with the pen down then make sure we revert back 226 /* If we ended up with the pen down then make sure we revert back
227 * to pen detection state for the next time we start up. 227 * to pen detection state for the next time we start up.