diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-25 12:38:14 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-25 12:38:14 -0700 |
commit | ce1d5b23a8d1e19866ab82bdec0dc41fde5273d8 (patch) | |
tree | 028c80655ee8853ebf607d435bc3d6ab223aef1f /drivers/input/touchscreen/ads7846.c | |
parent | ad5e1b0f5d913d2c8bddfba81049cc07228da1a6 (diff) | |
parent | 308f0a5898033691d050374a949bbfe173987a16 (diff) | |
download | talos-op-linux-ce1d5b23a8d1e19866ab82bdec0dc41fde5273d8.tar.gz talos-op-linux-ce1d5b23a8d1e19866ab82bdec0dc41fde5273d8.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (40 commits)
Input: wacom - add support for Cintiq 20WSX
Input: ucb1400_ts - IRQ probe fix
Input: at32psif - update MODULE_AUTHOR with new email
Input: mac_hid - add lockdep annotation to emumousebtn
Input: i8042 - fix incorrect usage of strncpy and strncat
Input: bf54x-keys - add infrastructure for keypad wakeups
Input: add MODULE_ALIAS() to hotpluggable platform modules
Input: drivers/char/keyboard.c - use time_after
Input: fix ordering in joystick Makefile
Input: wm97xx-core - support use as a wakeup source
Input: wm97xx-core - use IRQF_SAMPLE_RANDOM
Input: wm97xx-core - only schedule interrupt handler if not already scheduled
Input: add Zhen Hua driver
Input: aiptek - add support for Genius G-PEN 560 tablet
Input: wacom - implement suspend and autosuspend
Input: xpad - set proper buffer length for outgoing requests
Input: omap-keypad - fix build warning
Input: gpio_keys - irq handling cleanup
Input: add PS/2 serio driver for AVR32 devices
Input: put ledstate in the keyboard notifier
...
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 39573b91c8de..907a45fe9d40 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -80,6 +80,7 @@ struct ads7846 { #endif u16 model; + u16 vref_mv; u16 vref_delay_usecs; u16 x_plate_ohms; u16 pressure_max; @@ -177,9 +178,6 @@ struct ads7846 { * The range is GND..vREF. The ads7843 and ads7835 must use external vREF; * ads7846 lets that pin be unconnected, to use internal vREF. */ -static unsigned vREF_mV; -module_param(vREF_mV, uint, 0); -MODULE_PARM_DESC(vREF_mV, "external vREF voltage, in milliVolts"); struct ser_req { u8 ref_on; @@ -206,7 +204,6 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) struct ads7846 *ts = dev_get_drvdata(dev); struct ser_req *req = kzalloc(sizeof *req, GFP_KERNEL); int status; - int uninitialized_var(sample); int use_internal; if (!req) @@ -263,13 +260,13 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) if (status == 0) { /* on-wire is a must-ignore bit, a BE12 value, then padding */ - sample = be16_to_cpu(req->sample); - sample = sample >> 3; - sample &= 0x0fff; + status = be16_to_cpu(req->sample); + status = status >> 3; + status &= 0x0fff; } kfree(req); - return status ? status : sample; + return status; } #if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE) @@ -310,7 +307,7 @@ static inline unsigned vaux_adjust(struct ads7846 *ts, ssize_t v) unsigned retval = v; /* external resistors may scale vAUX into 0..vREF */ - retval *= vREF_mV; + retval *= ts->vref_mv; retval = retval >> 12; return retval; } @@ -368,14 +365,14 @@ static int ads784x_hwmon_register(struct spi_device *spi, struct ads7846 *ts) /* hwmon sensors need a reference voltage */ switch (ts->model) { case 7846: - if (!vREF_mV) { + if (!ts->vref_mv) { dev_dbg(&spi->dev, "assuming 2.5V internal vREF\n"); - vREF_mV = 2500; + ts->vref_mv = 2500; } break; case 7845: case 7843: - if (!vREF_mV) { + if (!ts->vref_mv) { dev_warn(&spi->dev, "external vREF for ADS%d not specified\n", ts->model); @@ -868,6 +865,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) ts->spi = spi; ts->input = input_dev; + ts->vref_mv = pdata->vref_mv; hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ts->timer.function = ads7846_timer; |