* + adcxx-fix-for-single-channel-adcs.patch added to -mm tree
@ 2010-02-12 20:11 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2010-02-12 20:11 UTC (permalink / raw)
To: mm-commits; +Cc: jose.goncalves, avorontsov, marc.pignat
The patch titled
drivers/hwmon/adcxx.c: fix for single-channel ADCs
has been added to the -mm tree. Its filename is
adcxx-fix-for-single-channel-adcs.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: drivers/hwmon/adcxx.c: fix for single-channel ADCs
From: José Miguel Gonçalves <jose.goncalves@inov.pt>
While testing an ADC121S021 in an embedded board with a S3C2142 SoC (ARM
core), I have found that the 'adcxx' driver does not handle correctly
single channel ADCs from this chip family. For single channel chips you
must only issue one read transfer for correct measurement.
Signed-off-by: Jose Miguel Goncalves <jose.goncalves@inov.pt>
Cc: Marc Pignat <marc.pignat@hevs.ch>
Cc: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/hwmon/adcxx.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff -puN drivers/hwmon/adcxx.c~adcxx-fix-for-single-channel-adcs drivers/hwmon/adcxx.c
--- a/drivers/hwmon/adcxx.c~adcxx-fix-for-single-channel-adcs
+++ a/drivers/hwmon/adcxx.c
@@ -62,18 +62,23 @@ static ssize_t adcxx_read(struct device
struct spi_device *spi = to_spi_device(dev);
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct adcxx *adc = dev_get_drvdata(&spi->dev);
- u8 tx_buf[2] = { attr->index << 3 }; /* other bits are don't care */
+ u8 tx_buf[2];
u8 rx_buf[2];
int status;
- int value;
+ u32 value;
if (mutex_lock_interruptible(&adc->lock))
return -ERESTARTSYS;
- status = spi_write_then_read(spi, tx_buf, sizeof(tx_buf),
- rx_buf, sizeof(rx_buf));
+ if (adc->channels == 1) {
+ status = spi_read(spi, rx_buf, sizeof(rx_buf));
+ } else {
+ tx_buf[0] = attr->index << 3; /* other bits are don't care */
+ status = spi_write_then_read(spi, tx_buf, sizeof(tx_buf),
+ rx_buf, sizeof(rx_buf));
+ }
if (status < 0) {
- dev_warn(dev, "spi_write_then_read failed with status %d\n",
+ dev_warn(dev, "SPI synch. transfer failed with status %d\n",
status);
goto out;
}
_
Patches currently in -mm which might be from jose.goncalves@inov.pt are
adcxx-fix-for-single-channel-adcs.patch
--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-02-12 20:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-12 20:11 + adcxx-fix-for-single-channel-adcs.patch added to -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.