aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Welling <mwelling@ieee.org>2015-11-02 20:51:49 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-11-03 17:54:01 -0500
commitef3b98c2c3fc6a73ec1e98a463c38329e66c6b95 (patch)
treefb7ad70f24fe1a1ac8efe277226e21766cdcc76d
parent6ac2438132ae1f8b12285f9d97a4c8d6aa6f89f0 (diff)
Input: tsc200x-core - rename functions and variables
The functions, variables, and defines of the new tsc200x-core.c are renamed to tsc200x instead of tsc2005 avoid possible confusion. Signed-off-by: Michael Welling <mwelling@ieee.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/touchscreen/tsc2005.c2
-rw-r--r--drivers/input/touchscreen/tsc200x-core.c200
-rw-r--r--drivers/input/touchscreen/tsc200x-core.h102
3 files changed, 152 insertions, 152 deletions
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index b853f826ce9b..1bbe64c89a10 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -26,7 +26,7 @@
26 26
27static int tsc2005_cmd(struct device *dev, u8 cmd) 27static int tsc2005_cmd(struct device *dev, u8 cmd)
28{ 28{
29 u8 tx = TSC2005_CMD | TSC2005_CMD_12BIT | cmd; 29 u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd;
30 struct spi_transfer xfer = { 30 struct spi_transfer xfer = {
31 .tx_buf = &tx, 31 .tx_buf = &tx,
32 .len = 1, 32 .len = 1,
diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c
index f2f3bc77a300..15240c1ee850 100644
--- a/drivers/input/touchscreen/tsc200x-core.c
+++ b/drivers/input/touchscreen/tsc200x-core.c
@@ -37,28 +37,28 @@
37 * The touchscreen interface operates as follows: 37 * The touchscreen interface operates as follows:
38 * 38 *
39 * 1) Pen is pressed against the touchscreen. 39 * 1) Pen is pressed against the touchscreen.
40 * 2) TSC2005 performs AD conversion. 40 * 2) TSC200X performs AD conversion.
41 * 3) After the conversion is done TSC2005 drives DAV line down. 41 * 3) After the conversion is done TSC200X drives DAV line down.
42 * 4) GPIO IRQ is received and tsc2005_irq_thread() is scheduled. 42 * 4) GPIO IRQ is received and tsc200x_irq_thread() is scheduled.
43 * 5) tsc2005_irq_thread() queues up a transfer to fetch the x, y, z1, z2 43 * 5) tsc200x_irq_thread() queues up a transfer to fetch the x, y, z1, z2
44 * values. 44 * values.
45 * 6) tsc2005_irq_thread() reports coordinates to input layer and sets up 45 * 6) tsc200x_irq_thread() reports coordinates to input layer and sets up
46 * tsc2005_penup_timer() to be called after TSC2005_PENUP_TIME_MS (40ms). 46 * tsc200x_penup_timer() to be called after TSC200X_PENUP_TIME_MS (40ms).
47 * 7) When the penup timer expires, there have not been touch or DAV interrupts 47 * 7) When the penup timer expires, there have not been touch or DAV interrupts
48 * during the last 40ms which means the pen has been lifted. 48 * during the last 40ms which means the pen has been lifted.
49 * 49 *
50 * ESD recovery via a hardware reset is done if the TSC2005 doesn't respond 50 * ESD recovery via a hardware reset is done if the TSC200X doesn't respond
51 * after a configurable period (in ms) of activity. If esd_timeout is 0, the 51 * after a configurable period (in ms) of activity. If esd_timeout is 0, the
52 * watchdog is disabled. 52 * watchdog is disabled.
53 */ 53 */
54 54
55static const struct regmap_range tsc2005_writable_ranges[] = { 55static const struct regmap_range tsc200x_writable_ranges[] = {
56 regmap_reg_range(TSC2005_REG_AUX_HIGH, TSC2005_REG_CFR2), 56 regmap_reg_range(TSC200X_REG_AUX_HIGH, TSC200X_REG_CFR2),
57}; 57};
58 58
59static const struct regmap_access_table tsc2005_writable_table = { 59static const struct regmap_access_table tsc200x_writable_table = {
60 .yes_ranges = tsc2005_writable_ranges, 60 .yes_ranges = tsc200x_writable_ranges,
61 .n_yes_ranges = ARRAY_SIZE(tsc2005_writable_ranges), 61 .n_yes_ranges = ARRAY_SIZE(tsc200x_writable_ranges),
62}; 62};
63 63
64const struct regmap_config tsc200x_regmap_config = { 64const struct regmap_config tsc200x_regmap_config = {
@@ -66,22 +66,22 @@ const struct regmap_config tsc200x_regmap_config = {
66 .val_bits = 16, 66 .val_bits = 16,
67 .reg_stride = 0x08, 67 .reg_stride = 0x08,
68 .max_register = 0x78, 68 .max_register = 0x78,
69 .read_flag_mask = TSC2005_REG_READ, 69 .read_flag_mask = TSC200X_REG_READ,
70 .write_flag_mask = TSC2005_REG_PND0, 70 .write_flag_mask = TSC200X_REG_PND0,
71 .wr_table = &tsc2005_writable_table, 71 .wr_table = &tsc200x_writable_table,
72 .use_single_rw = true, 72 .use_single_rw = true,
73}; 73};
74EXPORT_SYMBOL_GPL(tsc200x_regmap_config); 74EXPORT_SYMBOL_GPL(tsc200x_regmap_config);
75 75
76struct tsc2005_data { 76struct tsc200x_data {
77 u16 x; 77 u16 x;
78 u16 y; 78 u16 y;
79 u16 z1; 79 u16 z1;
80 u16 z2; 80 u16 z2;
81} __packed; 81} __packed;
82#define TSC2005_DATA_REGS 4 82#define TSC200X_DATA_REGS 4
83 83
84struct tsc2005 { 84struct tsc200x {
85 struct device *dev; 85 struct device *dev;
86 struct regmap *regmap; 86 struct regmap *regmap;
87 __u16 bustype; 87 __u16 bustype;
@@ -119,7 +119,7 @@ struct tsc2005 {
119 int irq; 119 int irq;
120}; 120};
121 121
122static void tsc2005_update_pen_state(struct tsc2005 *ts, 122static void tsc200x_update_pen_state(struct tsc200x *ts,
123 int x, int y, int pressure) 123 int x, int y, int pressure)
124{ 124{
125 if (pressure) { 125 if (pressure) {
@@ -142,17 +142,17 @@ static void tsc2005_update_pen_state(struct tsc2005 *ts,
142 pressure); 142 pressure);
143} 143}
144 144
145static irqreturn_t tsc2005_irq_thread(int irq, void *_ts) 145static irqreturn_t tsc200x_irq_thread(int irq, void *_ts)
146{ 146{
147 struct tsc2005 *ts = _ts; 147 struct tsc200x *ts = _ts;
148 unsigned long flags; 148 unsigned long flags;
149 unsigned int pressure; 149 unsigned int pressure;
150 struct tsc2005_data tsdata; 150 struct tsc200x_data tsdata;
151 int error; 151 int error;
152 152
153 /* read the coordinates */ 153 /* read the coordinates */
154 error = regmap_bulk_read(ts->regmap, TSC2005_REG_X, &tsdata, 154 error = regmap_bulk_read(ts->regmap, TSC200X_REG_X, &tsdata,
155 TSC2005_DATA_REGS); 155 TSC200X_DATA_REGS);
156 if (unlikely(error)) 156 if (unlikely(error))
157 goto out; 157 goto out;
158 158
@@ -193,9 +193,9 @@ static irqreturn_t tsc2005_irq_thread(int irq, void *_ts)
193 193
194 spin_lock_irqsave(&ts->lock, flags); 194 spin_lock_irqsave(&ts->lock, flags);
195 195
196 tsc2005_update_pen_state(ts, tsdata.x, tsdata.y, pressure); 196 tsc200x_update_pen_state(ts, tsdata.x, tsdata.y, pressure);
197 mod_timer(&ts->penup_timer, 197 mod_timer(&ts->penup_timer,
198 jiffies + msecs_to_jiffies(TSC2005_PENUP_TIME_MS)); 198 jiffies + msecs_to_jiffies(TSC200X_PENUP_TIME_MS));
199 199
200 spin_unlock_irqrestore(&ts->lock, flags); 200 spin_unlock_irqrestore(&ts->lock, flags);
201 201
@@ -204,30 +204,30 @@ out:
204 return IRQ_HANDLED; 204 return IRQ_HANDLED;
205} 205}
206 206
207static void tsc2005_penup_timer(unsigned long data) 207static void tsc200x_penup_timer(unsigned long data)
208{ 208{
209 struct tsc2005 *ts = (struct tsc2005 *)data; 209 struct tsc200x *ts = (struct tsc200x *)data;
210 unsigned long flags; 210 unsigned long flags;
211 211
212 spin_lock_irqsave(&ts->lock, flags); 212 spin_lock_irqsave(&ts->lock, flags);
213 tsc2005_update_pen_state(ts, 0, 0, 0); 213 tsc200x_update_pen_state(ts, 0, 0, 0);
214 spin_unlock_irqrestore(&ts->lock, flags); 214 spin_unlock_irqrestore(&ts->lock, flags);
215} 215}
216 216
217static void tsc2005_start_scan(struct tsc2005 *ts) 217static void tsc200x_start_scan(struct tsc200x *ts)
218{ 218{
219 regmap_write(ts->regmap, TSC2005_REG_CFR0, TSC2005_CFR0_INITVALUE); 219 regmap_write(ts->regmap, TSC200X_REG_CFR0, TSC200X_CFR0_INITVALUE);
220 regmap_write(ts->regmap, TSC2005_REG_CFR1, TSC2005_CFR1_INITVALUE); 220 regmap_write(ts->regmap, TSC200X_REG_CFR1, TSC200X_CFR1_INITVALUE);
221 regmap_write(ts->regmap, TSC2005_REG_CFR2, TSC2005_CFR2_INITVALUE); 221 regmap_write(ts->regmap, TSC200X_REG_CFR2, TSC200X_CFR2_INITVALUE);
222 ts->tsc200x_cmd(ts->dev, TSC2005_CMD_NORMAL); 222 ts->tsc200x_cmd(ts->dev, TSC200X_CMD_NORMAL);
223} 223}
224 224
225static void tsc2005_stop_scan(struct tsc2005 *ts) 225static void tsc200x_stop_scan(struct tsc200x *ts)
226{ 226{
227 ts->tsc200x_cmd(ts->dev, TSC2005_CMD_STOP); 227 ts->tsc200x_cmd(ts->dev, TSC200X_CMD_STOP);
228} 228}
229 229
230static void tsc2005_set_reset(struct tsc2005 *ts, bool enable) 230static void tsc200x_set_reset(struct tsc200x *ts, bool enable)
231{ 231{
232 if (ts->reset_gpio) 232 if (ts->reset_gpio)
233 gpiod_set_value_cansleep(ts->reset_gpio, enable); 233 gpiod_set_value_cansleep(ts->reset_gpio, enable);
@@ -236,9 +236,9 @@ static void tsc2005_set_reset(struct tsc2005 *ts, bool enable)
236} 236}
237 237
238/* must be called with ts->mutex held */ 238/* must be called with ts->mutex held */
239static void __tsc2005_disable(struct tsc2005 *ts) 239static void __tsc200x_disable(struct tsc200x *ts)
240{ 240{
241 tsc2005_stop_scan(ts); 241 tsc200x_stop_scan(ts);
242 242
243 disable_irq(ts->irq); 243 disable_irq(ts->irq);
244 del_timer_sync(&ts->penup_timer); 244 del_timer_sync(&ts->penup_timer);
@@ -249,9 +249,9 @@ static void __tsc2005_disable(struct tsc2005 *ts)
249} 249}
250 250
251/* must be called with ts->mutex held */ 251/* must be called with ts->mutex held */
252static void __tsc2005_enable(struct tsc2005 *ts) 252static void __tsc200x_enable(struct tsc200x *ts)
253{ 253{
254 tsc2005_start_scan(ts); 254 tsc200x_start_scan(ts);
255 255
256 if (ts->esd_timeout && (ts->set_reset || ts->reset_gpio)) { 256 if (ts->esd_timeout && (ts->set_reset || ts->reset_gpio)) {
257 ts->last_valid_interrupt = jiffies; 257 ts->last_valid_interrupt = jiffies;
@@ -261,11 +261,11 @@ static void __tsc2005_enable(struct tsc2005 *ts)
261 } 261 }
262} 262}
263 263
264static ssize_t tsc2005_selftest_show(struct device *dev, 264static ssize_t tsc200x_selftest_show(struct device *dev,
265 struct device_attribute *attr, 265 struct device_attribute *attr,
266 char *buf) 266 char *buf)
267{ 267{
268 struct tsc2005 *ts = dev_get_drvdata(dev); 268 struct tsc200x *ts = dev_get_drvdata(dev);
269 unsigned int temp_high; 269 unsigned int temp_high;
270 unsigned int temp_high_orig; 270 unsigned int temp_high_orig;
271 unsigned int temp_high_test; 271 unsigned int temp_high_test;
@@ -275,11 +275,11 @@ static ssize_t tsc2005_selftest_show(struct device *dev,
275 mutex_lock(&ts->mutex); 275 mutex_lock(&ts->mutex);
276 276
277 /* 277 /*
278 * Test TSC2005 communications via temp high register. 278 * Test TSC200X communications via temp high register.
279 */ 279 */
280 __tsc2005_disable(ts); 280 __tsc200x_disable(ts);
281 281
282 error = regmap_read(ts->regmap, TSC2005_REG_TEMP_HIGH, &temp_high_orig); 282 error = regmap_read(ts->regmap, TSC200X_REG_TEMP_HIGH, &temp_high_orig);
283 if (error) { 283 if (error) {
284 dev_warn(dev, "selftest failed: read error %d\n", error); 284 dev_warn(dev, "selftest failed: read error %d\n", error);
285 success = false; 285 success = false;
@@ -288,14 +288,14 @@ static ssize_t tsc2005_selftest_show(struct device *dev,
288 288
289 temp_high_test = (temp_high_orig - 1) & MAX_12BIT; 289 temp_high_test = (temp_high_orig - 1) & MAX_12BIT;
290 290
291 error = regmap_write(ts->regmap, TSC2005_REG_TEMP_HIGH, temp_high_test); 291 error = regmap_write(ts->regmap, TSC200X_REG_TEMP_HIGH, temp_high_test);
292 if (error) { 292 if (error) {
293 dev_warn(dev, "selftest failed: write error %d\n", error); 293 dev_warn(dev, "selftest failed: write error %d\n", error);
294 success = false; 294 success = false;
295 goto out; 295 goto out;
296 } 296 }
297 297
298 error = regmap_read(ts->regmap, TSC2005_REG_TEMP_HIGH, &temp_high); 298 error = regmap_read(ts->regmap, TSC200X_REG_TEMP_HIGH, &temp_high);
299 if (error) { 299 if (error) {
300 dev_warn(dev, "selftest failed: read error %d after write\n", 300 dev_warn(dev, "selftest failed: read error %d after write\n",
301 error); 301 error);
@@ -310,15 +310,15 @@ static ssize_t tsc2005_selftest_show(struct device *dev,
310 } 310 }
311 311
312 /* hardware reset */ 312 /* hardware reset */
313 tsc2005_set_reset(ts, false); 313 tsc200x_set_reset(ts, false);
314 usleep_range(100, 500); /* only 10us required */ 314 usleep_range(100, 500); /* only 10us required */
315 tsc2005_set_reset(ts, true); 315 tsc200x_set_reset(ts, true);
316 316
317 if (!success) 317 if (!success)
318 goto out; 318 goto out;
319 319
320 /* test that the reset really happened */ 320 /* test that the reset really happened */
321 error = regmap_read(ts->regmap, TSC2005_REG_TEMP_HIGH, &temp_high); 321 error = regmap_read(ts->regmap, TSC200X_REG_TEMP_HIGH, &temp_high);
322 if (error) { 322 if (error) {
323 dev_warn(dev, "selftest failed: read error %d after reset\n", 323 dev_warn(dev, "selftest failed: read error %d after reset\n",
324 error); 324 error);
@@ -333,24 +333,24 @@ static ssize_t tsc2005_selftest_show(struct device *dev,
333 } 333 }
334 334
335out: 335out:
336 __tsc2005_enable(ts); 336 __tsc200x_enable(ts);
337 mutex_unlock(&ts->mutex); 337 mutex_unlock(&ts->mutex);
338 338
339 return sprintf(buf, "%d\n", success); 339 return sprintf(buf, "%d\n", success);
340} 340}
341 341
342static DEVICE_ATTR(selftest, S_IRUGO, tsc2005_selftest_show, NULL); 342static DEVICE_ATTR(selftest, S_IRUGO, tsc200x_selftest_show, NULL);
343 343
344static struct attribute *tsc2005_attrs[] = { 344static struct attribute *tsc200x_attrs[] = {
345 &dev_attr_selftest.attr, 345 &dev_attr_selftest.attr,
346 NULL 346 NULL
347}; 347};
348 348
349static umode_t tsc2005_attr_is_visible(struct kobject *kobj, 349static umode_t tsc200x_attr_is_visible(struct kobject *kobj,
350 struct attribute *attr, int n) 350 struct attribute *attr, int n)
351{ 351{
352 struct device *dev = container_of(kobj, struct device, kobj); 352 struct device *dev = container_of(kobj, struct device, kobj);
353 struct tsc2005 *ts = dev_get_drvdata(dev); 353 struct tsc200x *ts = dev_get_drvdata(dev);
354 umode_t mode = attr->mode; 354 umode_t mode = attr->mode;
355 355
356 if (attr == &dev_attr_selftest.attr) { 356 if (attr == &dev_attr_selftest.attr) {
@@ -361,14 +361,14 @@ static umode_t tsc2005_attr_is_visible(struct kobject *kobj,
361 return mode; 361 return mode;
362} 362}
363 363
364static const struct attribute_group tsc2005_attr_group = { 364static const struct attribute_group tsc200x_attr_group = {
365 .is_visible = tsc2005_attr_is_visible, 365 .is_visible = tsc200x_attr_is_visible,
366 .attrs = tsc2005_attrs, 366 .attrs = tsc200x_attrs,
367}; 367};
368 368
369static void tsc2005_esd_work(struct work_struct *work) 369static void tsc200x_esd_work(struct work_struct *work)
370{ 370{
371 struct tsc2005 *ts = container_of(work, struct tsc2005, esd_work.work); 371 struct tsc200x *ts = container_of(work, struct tsc200x, esd_work.work);
372 int error; 372 int error;
373 unsigned int r; 373 unsigned int r;
374 374
@@ -386,9 +386,9 @@ static void tsc2005_esd_work(struct work_struct *work)
386 goto out; 386 goto out;
387 387
388 /* We should be able to read register without disabling interrupts. */ 388 /* We should be able to read register without disabling interrupts. */
389 error = regmap_read(ts->regmap, TSC2005_REG_CFR0, &r); 389 error = regmap_read(ts->regmap, TSC200X_REG_CFR0, &r);
390 if (!error && 390 if (!error &&
391 !((r ^ TSC2005_CFR0_INITVALUE) & TSC2005_CFR0_RW_MASK)) { 391 !((r ^ TSC200X_CFR0_INITVALUE) & TSC200X_CFR0_RW_MASK)) {
392 goto out; 392 goto out;
393 } 393 }
394 394
@@ -397,19 +397,19 @@ static void tsc2005_esd_work(struct work_struct *work)
397 * then we should reset the controller as if from power-up and start 397 * then we should reset the controller as if from power-up and start
398 * scanning again. 398 * scanning again.
399 */ 399 */
400 dev_info(ts->dev, "TSC2005 not responding - resetting\n"); 400 dev_info(ts->dev, "TSC200X not responding - resetting\n");
401 401
402 disable_irq(ts->irq); 402 disable_irq(ts->irq);
403 del_timer_sync(&ts->penup_timer); 403 del_timer_sync(&ts->penup_timer);
404 404
405 tsc2005_update_pen_state(ts, 0, 0, 0); 405 tsc200x_update_pen_state(ts, 0, 0, 0);
406 406
407 tsc2005_set_reset(ts, false); 407 tsc200x_set_reset(ts, false);
408 usleep_range(100, 500); /* only 10us required */ 408 usleep_range(100, 500); /* only 10us required */
409 tsc2005_set_reset(ts, true); 409 tsc200x_set_reset(ts, true);
410 410
411 enable_irq(ts->irq); 411 enable_irq(ts->irq);
412 tsc2005_start_scan(ts); 412 tsc200x_start_scan(ts);
413 413
414out: 414out:
415 mutex_unlock(&ts->mutex); 415 mutex_unlock(&ts->mutex);
@@ -420,14 +420,14 @@ reschedule:
420 msecs_to_jiffies(ts->esd_timeout))); 420 msecs_to_jiffies(ts->esd_timeout)));
421} 421}
422 422
423static int tsc2005_open(struct input_dev *input) 423static int tsc200x_open(struct input_dev *input)
424{ 424{
425 struct tsc2005 *ts = input_get_drvdata(input); 425 struct tsc200x *ts = input_get_drvdata(input);
426 426
427 mutex_lock(&ts->mutex); 427 mutex_lock(&ts->mutex);
428 428
429 if (!ts->suspended) 429 if (!ts->suspended)
430 __tsc2005_enable(ts); 430 __tsc200x_enable(ts);
431 431
432 ts->opened = true; 432 ts->opened = true;
433 433
@@ -436,14 +436,14 @@ static int tsc2005_open(struct input_dev *input)
436 return 0; 436 return 0;
437} 437}
438 438
439static void tsc2005_close(struct input_dev *input) 439static void tsc200x_close(struct input_dev *input)
440{ 440{
441 struct tsc2005 *ts = input_get_drvdata(input); 441 struct tsc200x *ts = input_get_drvdata(input);
442 442
443 mutex_lock(&ts->mutex); 443 mutex_lock(&ts->mutex);
444 444
445 if (!ts->suspended) 445 if (!ts->suspended)
446 __tsc2005_disable(ts); 446 __tsc200x_disable(ts);
447 447
448 ts->opened = false; 448 ts->opened = false;
449 449
@@ -457,15 +457,15 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
457 const struct tsc2005_platform_data *pdata = dev_get_platdata(dev); 457 const struct tsc2005_platform_data *pdata = dev_get_platdata(dev);
458 struct device_node *np = dev->of_node; 458 struct device_node *np = dev->of_node;
459 459
460 struct tsc2005 *ts; 460 struct tsc200x *ts;
461 struct input_dev *input_dev; 461 struct input_dev *input_dev;
462 unsigned int max_x = MAX_12BIT; 462 unsigned int max_x = MAX_12BIT;
463 unsigned int max_y = MAX_12BIT; 463 unsigned int max_y = MAX_12BIT;
464 unsigned int max_p = MAX_12BIT; 464 unsigned int max_p = MAX_12BIT;
465 unsigned int fudge_x = TSC2005_DEF_X_FUZZ; 465 unsigned int fudge_x = TSC200X_DEF_X_FUZZ;
466 unsigned int fudge_y = TSC2005_DEF_Y_FUZZ; 466 unsigned int fudge_y = TSC200X_DEF_Y_FUZZ;
467 unsigned int fudge_p = TSC2005_DEF_P_FUZZ; 467 unsigned int fudge_p = TSC200X_DEF_P_FUZZ;
468 unsigned int x_plate_ohm = TSC2005_DEF_RESISTOR; 468 unsigned int x_plate_ohm = TSC200X_DEF_RESISTOR;
469 unsigned int esd_timeout; 469 unsigned int esd_timeout;
470 int error; 470 int error;
471 471
@@ -497,7 +497,7 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
497 x_plate_ohm = pdata->ts_x_plate_ohm; 497 x_plate_ohm = pdata->ts_x_plate_ohm;
498 esd_timeout = pdata->esd_timeout_ms; 498 esd_timeout = pdata->esd_timeout_ms;
499 } else { 499 } else {
500 x_plate_ohm = TSC2005_DEF_RESISTOR; 500 x_plate_ohm = TSC200X_DEF_RESISTOR;
501 of_property_read_u32(np, "ti,x-plate-ohms", &x_plate_ohm); 501 of_property_read_u32(np, "ti,x-plate-ohms", &x_plate_ohm);
502 esd_timeout = 0; 502 esd_timeout = 0;
503 of_property_read_u32(np, "ti,esd-recovery-timeout-ms", 503 of_property_read_u32(np, "ti,esd-recovery-timeout-ms",
@@ -540,14 +540,14 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
540 mutex_init(&ts->mutex); 540 mutex_init(&ts->mutex);
541 541
542 spin_lock_init(&ts->lock); 542 spin_lock_init(&ts->lock);
543 setup_timer(&ts->penup_timer, tsc2005_penup_timer, (unsigned long)ts); 543 setup_timer(&ts->penup_timer, tsc200x_penup_timer, (unsigned long)ts);
544 544
545 INIT_DELAYED_WORK(&ts->esd_work, tsc2005_esd_work); 545 INIT_DELAYED_WORK(&ts->esd_work, tsc200x_esd_work);
546 546
547 snprintf(ts->phys, sizeof(ts->phys), 547 snprintf(ts->phys, sizeof(ts->phys),
548 "%s/input-ts", dev_name(dev)); 548 "%s/input-ts", dev_name(dev));
549 549
550 input_dev->name = "TSC2005 touchscreen"; 550 input_dev->name = "TSC200X touchscreen";
551 input_dev->phys = ts->phys; 551 input_dev->phys = ts->phys;
552 input_dev->id.bustype = bustype; 552 input_dev->id.bustype = bustype;
553 input_dev->dev.parent = dev; 553 input_dev->dev.parent = dev;
@@ -561,18 +561,18 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
561 if (np) 561 if (np)
562 touchscreen_parse_properties(input_dev, false); 562 touchscreen_parse_properties(input_dev, false);
563 563
564 input_dev->open = tsc2005_open; 564 input_dev->open = tsc200x_open;
565 input_dev->close = tsc2005_close; 565 input_dev->close = tsc200x_close;
566 566
567 input_set_drvdata(input_dev, ts); 567 input_set_drvdata(input_dev, ts);
568 568
569 /* Ensure the touchscreen is off */ 569 /* Ensure the touchscreen is off */
570 tsc2005_stop_scan(ts); 570 tsc200x_stop_scan(ts);
571 571
572 error = devm_request_threaded_irq(dev, irq, NULL, 572 error = devm_request_threaded_irq(dev, irq, NULL,
573 tsc2005_irq_thread, 573 tsc200x_irq_thread,
574 IRQF_TRIGGER_RISING | IRQF_ONESHOT, 574 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
575 "tsc2005", ts); 575 "tsc200x", ts);
576 if (error) { 576 if (error) {
577 dev_err(dev, "Failed to request irq, err: %d\n", error); 577 dev_err(dev, "Failed to request irq, err: %d\n", error);
578 return error; 578 return error;
@@ -586,7 +586,7 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
586 } 586 }
587 587
588 dev_set_drvdata(dev, ts); 588 dev_set_drvdata(dev, ts);
589 error = sysfs_create_group(&dev->kobj, &tsc2005_attr_group); 589 error = sysfs_create_group(&dev->kobj, &tsc200x_attr_group);
590 if (error) { 590 if (error) {
591 dev_err(dev, 591 dev_err(dev,
592 "Failed to create sysfs attributes, err: %d\n", error); 592 "Failed to create sysfs attributes, err: %d\n", error);
@@ -604,7 +604,7 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
604 return 0; 604 return 0;
605 605
606err_remove_sysfs: 606err_remove_sysfs:
607 sysfs_remove_group(&dev->kobj, &tsc2005_attr_group); 607 sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
608disable_regulator: 608disable_regulator:
609 if (ts->vio) 609 if (ts->vio)
610 regulator_disable(ts->vio); 610 regulator_disable(ts->vio);
@@ -614,9 +614,9 @@ EXPORT_SYMBOL_GPL(tsc200x_probe);
614 614
615int tsc200x_remove(struct device *dev) 615int tsc200x_remove(struct device *dev)
616{ 616{
617 struct tsc2005 *ts = dev_get_drvdata(dev); 617 struct tsc200x *ts = dev_get_drvdata(dev);
618 618
619 sysfs_remove_group(&dev->kobj, &tsc2005_attr_group); 619 sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
620 620
621 if (ts->vio) 621 if (ts->vio)
622 regulator_disable(ts->vio); 622 regulator_disable(ts->vio);
@@ -625,14 +625,14 @@ int tsc200x_remove(struct device *dev)
625} 625}
626EXPORT_SYMBOL_GPL(tsc200x_remove); 626EXPORT_SYMBOL_GPL(tsc200x_remove);
627 627
628static int __maybe_unused tsc2005_suspend(struct device *dev) 628static int __maybe_unused tsc200x_suspend(struct device *dev)
629{ 629{
630 struct tsc2005 *ts = dev_get_drvdata(dev); 630 struct tsc200x *ts = dev_get_drvdata(dev);
631 631
632 mutex_lock(&ts->mutex); 632 mutex_lock(&ts->mutex);
633 633
634 if (!ts->suspended && ts->opened) 634 if (!ts->suspended && ts->opened)
635 __tsc2005_disable(ts); 635 __tsc200x_disable(ts);
636 636
637 ts->suspended = true; 637 ts->suspended = true;
638 638
@@ -641,14 +641,14 @@ static int __maybe_unused tsc2005_suspend(struct device *dev)
641 return 0; 641 return 0;
642} 642}
643 643
644static int __maybe_unused tsc2005_resume(struct device *dev) 644static int __maybe_unused tsc200x_resume(struct device *dev)
645{ 645{
646 struct tsc2005 *ts = dev_get_drvdata(dev); 646 struct tsc200x *ts = dev_get_drvdata(dev);
647 647
648 mutex_lock(&ts->mutex); 648 mutex_lock(&ts->mutex);
649 649
650 if (ts->suspended && ts->opened) 650 if (ts->suspended && ts->opened)
651 __tsc2005_enable(ts); 651 __tsc200x_enable(ts);
652 652
653 ts->suspended = false; 653 ts->suspended = false;
654 654
@@ -657,9 +657,9 @@ static int __maybe_unused tsc2005_resume(struct device *dev)
657 return 0; 657 return 0;
658} 658}
659 659
660SIMPLE_DEV_PM_OPS(tsc200x_pm_ops, tsc2005_suspend, tsc2005_resume); 660SIMPLE_DEV_PM_OPS(tsc200x_pm_ops, tsc200x_suspend, tsc200x_resume);
661EXPORT_SYMBOL_GPL(tsc200x_pm_ops); 661EXPORT_SYMBOL_GPL(tsc200x_pm_ops);
662 662
663MODULE_AUTHOR("Lauri Leukkunen <lauri.leukkunen@nokia.com>"); 663MODULE_AUTHOR("Lauri Leukkunen <lauri.leukkunen@nokia.com>");
664MODULE_DESCRIPTION("TSC2005 Touchscreen Driver"); 664MODULE_DESCRIPTION("TSC200x Touchscreen Driver Core");
665MODULE_LICENSE("GPL"); 665MODULE_LICENSE("GPL");
diff --git a/drivers/input/touchscreen/tsc200x-core.h b/drivers/input/touchscreen/tsc200x-core.h
index 3169078298aa..7a482d102614 100644
--- a/drivers/input/touchscreen/tsc200x-core.h
+++ b/drivers/input/touchscreen/tsc200x-core.h
@@ -2,70 +2,70 @@
2#define _TSC200X_CORE_H 2#define _TSC200X_CORE_H
3 3
4/* control byte 1 */ 4/* control byte 1 */
5#define TSC2005_CMD 0x80 5#define TSC200X_CMD 0x80
6#define TSC2005_CMD_NORMAL 0x00 6#define TSC200X_CMD_NORMAL 0x00
7#define TSC2005_CMD_STOP 0x01 7#define TSC200X_CMD_STOP 0x01
8#define TSC2005_CMD_12BIT 0x04 8#define TSC200X_CMD_12BIT 0x04
9 9
10/* control byte 0 */ 10/* control byte 0 */
11#define TSC2005_REG_READ 0x01 /* R/W access */ 11#define TSC200X_REG_READ 0x01 /* R/W access */
12#define TSC2005_REG_PND0 0x02 /* Power Not Down Control */ 12#define TSC200X_REG_PND0 0x02 /* Power Not Down Control */
13#define TSC2005_REG_X (0x0 << 3) 13#define TSC200X_REG_X (0x0 << 3)
14#define TSC2005_REG_Y (0x1 << 3) 14#define TSC200X_REG_Y (0x1 << 3)
15#define TSC2005_REG_Z1 (0x2 << 3) 15#define TSC200X_REG_Z1 (0x2 << 3)
16#define TSC2005_REG_Z2 (0x3 << 3) 16#define TSC200X_REG_Z2 (0x3 << 3)
17#define TSC2005_REG_AUX (0x4 << 3) 17#define TSC200X_REG_AUX (0x4 << 3)
18#define TSC2005_REG_TEMP1 (0x5 << 3) 18#define TSC200X_REG_TEMP1 (0x5 << 3)
19#define TSC2005_REG_TEMP2 (0x6 << 3) 19#define TSC200X_REG_TEMP2 (0x6 << 3)
20#define TSC2005_REG_STATUS (0x7 << 3) 20#define TSC200X_REG_STATUS (0x7 << 3)
21#define TSC2005_REG_AUX_HIGH (0x8 << 3) 21#define TSC200X_REG_AUX_HIGH (0x8 << 3)
22#define TSC2005_REG_AUX_LOW (0x9 << 3) 22#define TSC200X_REG_AUX_LOW (0x9 << 3)
23#define TSC2005_REG_TEMP_HIGH (0xA << 3) 23#define TSC200X_REG_TEMP_HIGH (0xA << 3)
24#define TSC2005_REG_TEMP_LOW (0xB << 3) 24#define TSC200X_REG_TEMP_LOW (0xB << 3)
25#define TSC2005_REG_CFR0 (0xC << 3) 25#define TSC200X_REG_CFR0 (0xC << 3)
26#define TSC2005_REG_CFR1 (0xD << 3) 26#define TSC200X_REG_CFR1 (0xD << 3)
27#define TSC2005_REG_CFR2 (0xE << 3) 27#define TSC200X_REG_CFR2 (0xE << 3)
28#define TSC2005_REG_CONV_FUNC (0xF << 3) 28#define TSC200X_REG_CONV_FUNC (0xF << 3)
29 29
30/* configuration register 0 */ 30/* configuration register 0 */
31#define TSC2005_CFR0_PRECHARGE_276US 0x0040 31#define TSC200X_CFR0_PRECHARGE_276US 0x0040
32#define TSC2005_CFR0_STABTIME_1MS 0x0300 32#define TSC200X_CFR0_STABTIME_1MS 0x0300
33#define TSC2005_CFR0_CLOCK_1MHZ 0x1000 33#define TSC200X_CFR0_CLOCK_1MHZ 0x1000
34#define TSC2005_CFR0_RESOLUTION12 0x2000 34#define TSC200X_CFR0_RESOLUTION12 0x2000
35#define TSC2005_CFR0_PENMODE 0x8000 35#define TSC200X_CFR0_PENMODE 0x8000
36#define TSC2005_CFR0_INITVALUE (TSC2005_CFR0_STABTIME_1MS | \ 36#define TSC200X_CFR0_INITVALUE (TSC200X_CFR0_STABTIME_1MS | \
37 TSC2005_CFR0_CLOCK_1MHZ | \ 37 TSC200X_CFR0_CLOCK_1MHZ | \
38 TSC2005_CFR0_RESOLUTION12 | \ 38 TSC200X_CFR0_RESOLUTION12 | \
39 TSC2005_CFR0_PRECHARGE_276US | \ 39 TSC200X_CFR0_PRECHARGE_276US | \
40 TSC2005_CFR0_PENMODE) 40 TSC200X_CFR0_PENMODE)
41 41
42/* bits common to both read and write of configuration register 0 */ 42/* bits common to both read and write of configuration register 0 */
43#define TSC2005_CFR0_RW_MASK 0x3fff 43#define TSC200X_CFR0_RW_MASK 0x3fff
44 44
45/* configuration register 1 */ 45/* configuration register 1 */
46#define TSC2005_CFR1_BATCHDELAY_4MS 0x0003 46#define TSC200X_CFR1_BATCHDELAY_4MS 0x0003
47#define TSC2005_CFR1_INITVALUE TSC2005_CFR1_BATCHDELAY_4MS 47#define TSC200X_CFR1_INITVALUE TSC200X_CFR1_BATCHDELAY_4MS
48 48
49/* configuration register 2 */ 49/* configuration register 2 */
50#define TSC2005_CFR2_MAVE_Z 0x0004 50#define TSC200X_CFR2_MAVE_Z 0x0004
51#define TSC2005_CFR2_MAVE_Y 0x0008 51#define TSC200X_CFR2_MAVE_Y 0x0008
52#define TSC2005_CFR2_MAVE_X 0x0010 52#define TSC200X_CFR2_MAVE_X 0x0010
53#define TSC2005_CFR2_AVG_7 0x0800 53#define TSC200X_CFR2_AVG_7 0x0800
54#define TSC2005_CFR2_MEDIUM_15 0x3000 54#define TSC200X_CFR2_MEDIUM_15 0x3000
55#define TSC2005_CFR2_INITVALUE (TSC2005_CFR2_MAVE_X | \ 55#define TSC200X_CFR2_INITVALUE (TSC200X_CFR2_MAVE_X | \
56 TSC2005_CFR2_MAVE_Y | \ 56 TSC200X_CFR2_MAVE_Y | \
57 TSC2005_CFR2_MAVE_Z | \ 57 TSC200X_CFR2_MAVE_Z | \
58 TSC2005_CFR2_MEDIUM_15 | \ 58 TSC200X_CFR2_MEDIUM_15 | \
59 TSC2005_CFR2_AVG_7) 59 TSC200X_CFR2_AVG_7)
60 60
61#define MAX_12BIT 0xfff 61#define MAX_12BIT 0xfff
62#define TSC2005_DEF_X_FUZZ 4 62#define TSC200X_DEF_X_FUZZ 4
63#define TSC2005_DEF_Y_FUZZ 8 63#define TSC200X_DEF_Y_FUZZ 8
64#define TSC2005_DEF_P_FUZZ 2 64#define TSC200X_DEF_P_FUZZ 2
65#define TSC2005_DEF_RESISTOR 280 65#define TSC200X_DEF_RESISTOR 280
66 66
67#define TSC2005_SPI_MAX_SPEED_HZ 10000000 67#define TSC2005_SPI_MAX_SPEED_HZ 10000000
68#define TSC2005_PENUP_TIME_MS 40 68#define TSC200X_PENUP_TIME_MS 40
69 69
70extern const struct regmap_config tsc200x_regmap_config; 70extern const struct regmap_config tsc200x_regmap_config;
71extern const struct dev_pm_ops tsc200x_pm_ops; 71extern const struct dev_pm_ops tsc200x_pm_ops;