diff options
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 46d1fec2cfd8..7f384a694d80 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -233,6 +233,21 @@ SHOW(temp1) | |||
233 | SHOW(vaux) | 233 | SHOW(vaux) |
234 | SHOW(vbatt) | 234 | SHOW(vbatt) |
235 | 235 | ||
236 | static int is_pen_down(struct device *dev) | ||
237 | { | ||
238 | struct ads7846 *ts = dev_get_drvdata(dev); | ||
239 | |||
240 | return ts->pendown; | ||
241 | } | ||
242 | |||
243 | static ssize_t ads7846_pen_down_show(struct device *dev, | ||
244 | struct device_attribute *attr, char *buf) | ||
245 | { | ||
246 | return sprintf(buf, "%u\n", is_pen_down(dev)); | ||
247 | } | ||
248 | |||
249 | static DEVICE_ATTR(pen_down, S_IRUGO, ads7846_pen_down_show, NULL); | ||
250 | |||
236 | /*--------------------------------------------------------------------------*/ | 251 | /*--------------------------------------------------------------------------*/ |
237 | 252 | ||
238 | /* | 253 | /* |
@@ -559,6 +574,8 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
559 | device_create_file(&spi->dev, &dev_attr_vbatt); | 574 | device_create_file(&spi->dev, &dev_attr_vbatt); |
560 | device_create_file(&spi->dev, &dev_attr_vaux); | 575 | device_create_file(&spi->dev, &dev_attr_vaux); |
561 | 576 | ||
577 | device_create_file(&spi->dev, &dev_attr_pen_down); | ||
578 | |||
562 | err = input_register_device(input_dev); | 579 | err = input_register_device(input_dev); |
563 | if (err) | 580 | if (err) |
564 | goto err_free_irq; | 581 | goto err_free_irq; |
@@ -582,6 +599,8 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
582 | if (ts->irq_disabled) | 599 | if (ts->irq_disabled) |
583 | enable_irq(ts->spi->irq); | 600 | enable_irq(ts->spi->irq); |
584 | 601 | ||
602 | device_remove_file(&spi->dev, &dev_attr_pen_down); | ||
603 | |||
585 | if (ts->model == 7846) { | 604 | if (ts->model == 7846) { |
586 | device_remove_file(&spi->dev, &dev_attr_temp0); | 605 | device_remove_file(&spi->dev, &dev_attr_temp0); |
587 | device_remove_file(&spi->dev, &dev_attr_temp1); | 606 | device_remove_file(&spi->dev, &dev_attr_temp1); |