diff options
| -rw-r--r-- | drivers/input/touchscreen/tsc2005.c | 52 |
1 files changed, 4 insertions, 48 deletions
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 3e1c9c297f33..87420616efa4 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c | |||
| @@ -138,7 +138,6 @@ struct tsc2005 { | |||
| 138 | 138 | ||
| 139 | unsigned int x_plate_ohm; | 139 | unsigned int x_plate_ohm; |
| 140 | 140 | ||
| 141 | bool disabled; | ||
| 142 | bool opened; | 141 | bool opened; |
| 143 | bool suspended; | 142 | bool suspended; |
| 144 | 143 | ||
| @@ -365,48 +364,6 @@ static void __tsc2005_enable(struct tsc2005 *ts) | |||
| 365 | 364 | ||
| 366 | } | 365 | } |
| 367 | 366 | ||
| 368 | static ssize_t tsc2005_disable_show(struct device *dev, | ||
| 369 | struct device_attribute *attr, char *buf) | ||
| 370 | { | ||
| 371 | struct spi_device *spi = to_spi_device(dev); | ||
| 372 | struct tsc2005 *ts = spi_get_drvdata(spi); | ||
| 373 | |||
| 374 | return sprintf(buf, "%u\n", ts->disabled); | ||
| 375 | } | ||
| 376 | |||
| 377 | static ssize_t tsc2005_disable_store(struct device *dev, | ||
| 378 | struct device_attribute *attr, | ||
| 379 | const char *buf, size_t count) | ||
| 380 | { | ||
| 381 | struct spi_device *spi = to_spi_device(dev); | ||
| 382 | struct tsc2005 *ts = spi_get_drvdata(spi); | ||
| 383 | unsigned long val; | ||
| 384 | int error; | ||
| 385 | |||
| 386 | error = strict_strtoul(buf, 10, &val); | ||
| 387 | if (error) | ||
| 388 | return error; | ||
| 389 | |||
| 390 | mutex_lock(&ts->mutex); | ||
| 391 | |||
| 392 | if (!ts->suspended && ts->opened) { | ||
| 393 | if (val) { | ||
| 394 | if (!ts->disabled) | ||
| 395 | __tsc2005_disable(ts); | ||
| 396 | } else { | ||
| 397 | if (ts->disabled) | ||
| 398 | __tsc2005_enable(ts); | ||
| 399 | } | ||
| 400 | } | ||
| 401 | |||
| 402 | ts->disabled = !!val; | ||
| 403 | |||
| 404 | mutex_unlock(&ts->mutex); | ||
| 405 | |||
| 406 | return count; | ||
| 407 | } | ||
| 408 | static DEVICE_ATTR(disable, 0664, tsc2005_disable_show, tsc2005_disable_store); | ||
| 409 | |||
| 410 | static ssize_t tsc2005_selftest_show(struct device *dev, | 367 | static ssize_t tsc2005_selftest_show(struct device *dev, |
| 411 | struct device_attribute *attr, | 368 | struct device_attribute *attr, |
| 412 | char *buf) | 369 | char *buf) |
| @@ -489,7 +446,6 @@ out: | |||
| 489 | static DEVICE_ATTR(selftest, S_IRUGO, tsc2005_selftest_show, NULL); | 446 | static DEVICE_ATTR(selftest, S_IRUGO, tsc2005_selftest_show, NULL); |
| 490 | 447 | ||
| 491 | static struct attribute *tsc2005_attrs[] = { | 448 | static struct attribute *tsc2005_attrs[] = { |
| 492 | &dev_attr_disable.attr, | ||
| 493 | &dev_attr_selftest.attr, | 449 | &dev_attr_selftest.attr, |
| 494 | NULL | 450 | NULL |
| 495 | }; | 451 | }; |
| @@ -567,7 +523,7 @@ static int tsc2005_open(struct input_dev *input) | |||
| 567 | 523 | ||
| 568 | mutex_lock(&ts->mutex); | 524 | mutex_lock(&ts->mutex); |
| 569 | 525 | ||
| 570 | if (!ts->suspended && !ts->disabled) | 526 | if (!ts->suspended) |
| 571 | __tsc2005_enable(ts); | 527 | __tsc2005_enable(ts); |
| 572 | 528 | ||
| 573 | ts->opened = true; | 529 | ts->opened = true; |
| @@ -583,7 +539,7 @@ static void tsc2005_close(struct input_dev *input) | |||
| 583 | 539 | ||
| 584 | mutex_lock(&ts->mutex); | 540 | mutex_lock(&ts->mutex); |
| 585 | 541 | ||
| 586 | if (!ts->suspended && !ts->disabled) | 542 | if (!ts->suspended) |
| 587 | __tsc2005_disable(ts); | 543 | __tsc2005_disable(ts); |
| 588 | 544 | ||
| 589 | ts->opened = false; | 545 | ts->opened = false; |
| @@ -743,7 +699,7 @@ static int tsc2005_suspend(struct device *dev) | |||
| 743 | 699 | ||
| 744 | mutex_lock(&ts->mutex); | 700 | mutex_lock(&ts->mutex); |
| 745 | 701 | ||
| 746 | if (!ts->suspended && !ts->disabled && ts->opened) | 702 | if (!ts->suspended && ts->opened) |
| 747 | __tsc2005_disable(ts); | 703 | __tsc2005_disable(ts); |
| 748 | 704 | ||
| 749 | ts->suspended = true; | 705 | ts->suspended = true; |
| @@ -760,7 +716,7 @@ static int tsc2005_resume(struct device *dev) | |||
| 760 | 716 | ||
| 761 | mutex_lock(&ts->mutex); | 717 | mutex_lock(&ts->mutex); |
| 762 | 718 | ||
| 763 | if (ts->suspended && !ts->disabled && ts->opened) | 719 | if (ts->suspended && ts->opened) |
| 764 | __tsc2005_enable(ts); | 720 | __tsc2005_enable(ts); |
| 765 | 721 | ||
| 766 | ts->suspended = false; | 722 | ts->suspended = false; |
