diff options
author | Imre Deak <imre.deak@nokia.com> | 2006-04-11 23:41:32 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-04-11 23:41:32 -0400 |
commit | 438f2a7401ec5d8f85923a7c3e6da444f097a3a1 (patch) | |
tree | 831ee631c1fa3809ece325d8ec6892ef94babd84 | |
parent | e2aa507a837cbaa376faa3d9f8448ff569d34ccf (diff) | |
download | op-kernel-dev-438f2a7401ec5d8f85923a7c3e6da444f097a3a1.zip op-kernel-dev-438f2a7401ec5d8f85923a7c3e6da444f097a3a1.tar.gz |
Input: ads7846 - add pen_down sysfs attribute
It's handy for userspace diagnostics to see the pen down status, to
see whether the touchscreen is "stuck" (shortcircuited).
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-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 46d1fec..7f384a6 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -233,6 +233,21 @@ SHOW(temp1) SHOW(vaux) SHOW(vbatt) +static int is_pen_down(struct device *dev) +{ + struct ads7846 *ts = dev_get_drvdata(dev); + + return ts->pendown; +} + +static ssize_t ads7846_pen_down_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%u\n", is_pen_down(dev)); +} + +static DEVICE_ATTR(pen_down, S_IRUGO, ads7846_pen_down_show, NULL); + /*--------------------------------------------------------------------------*/ /* @@ -559,6 +574,8 @@ static int __devinit ads7846_probe(struct spi_device *spi) device_create_file(&spi->dev, &dev_attr_vbatt); device_create_file(&spi->dev, &dev_attr_vaux); + device_create_file(&spi->dev, &dev_attr_pen_down); + err = input_register_device(input_dev); if (err) goto err_free_irq; @@ -582,6 +599,8 @@ static int __devexit ads7846_remove(struct spi_device *spi) if (ts->irq_disabled) enable_irq(ts->spi->irq); + device_remove_file(&spi->dev, &dev_attr_pen_down); + if (ts->model == 7846) { device_remove_file(&spi->dev, &dev_attr_temp0); device_remove_file(&spi->dev, &dev_attr_temp1); |