aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>2012-02-29 14:16:56 +0200
committerZiyann <jaraidaniel@gmail.com>2014-10-01 13:00:32 +0200
commitaa58770ee045377ab3aac0cc60ca1ff98c762eec (patch)
treeaa91d1acf06bb7652f490e0b1938e344fef80bc9
parentb03c139ab4cbff8bdafa52283a6b17628405e190 (diff)
downloadkernel_samsung_tuna-aa58770ee045377ab3aac0cc60ca1ff98c762eec.tar.gz
kernel_samsung_tuna-aa58770ee045377ab3aac0cc60ca1ff98c762eec.tar.bz2
kernel_samsung_tuna-aa58770ee045377ab3aac0cc60ca1ff98c762eec.zip
MFD: TWL6030_GPADC: Add a new command to the ioctl
This patch adds a possibility to read corrected and converted ADC ch (command TWL6030_GPADC_IOCX_ADC_READ) to the ioctl. Change-Id: Ia896bf9224a876083815aa5a0d172e08b77141cb Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>
-rw-r--r--drivers/mfd/twl6030-gpadc.c7
-rw-r--r--include/linux/i2c/twl6030-gpadc.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mfd/twl6030-gpadc.c b/drivers/mfd/twl6030-gpadc.c
index 7a0c7e19f95..621270bafc8 100644
--- a/drivers/mfd/twl6030-gpadc.c
+++ b/drivers/mfd/twl6030-gpadc.c
@@ -959,6 +959,7 @@ static long twl6030_gpadc_ioctl(struct file *filp, unsigned int cmd,
}
switch (cmd) {
+ case TWL6030_GPADC_IOCX_ADC_READ:
case TWL6030_GPADC_IOCX_ADC_RAW_READ: {
struct twl6030_gpadc_request req;
if (the_gpadc->features & TWL6032_SUBCLASS) {
@@ -980,7 +981,11 @@ static long twl6030_gpadc_ioctl(struct file *filp, unsigned int cmd,
val = twl6030_gpadc_conversion(&req);
if (likely(val > 0)) {
par.status = 0;
- par.result = (u16)req.buf[par.channel].raw_code;
+ if (cmd == TWL6030_GPADC_IOCX_ADC_READ)
+ par.result = (u16)req.rbuf[par.channel];
+ else
+ par.result = (u16)req.buf[par.channel].raw_code;
+
} else if (val == 0) {
par.status = -ENODATA;
} else {
diff --git a/include/linux/i2c/twl6030-gpadc.h b/include/linux/i2c/twl6030-gpadc.h
index 5b9c1a79b53..c1144c8d147 100644
--- a/include/linux/i2c/twl6030-gpadc.h
+++ b/include/linux/i2c/twl6030-gpadc.h
@@ -134,6 +134,7 @@ enum sample_type {
#define TWL6030_GPADC_IOC_MAGIC '`'
#define TWL6030_GPADC_IOCX_ADC_RAW_READ _IO(TWL6030_GPADC_IOC_MAGIC, 0)
+#define TWL6030_GPADC_IOCX_ADC_READ _IO(TWL6030_GPADC_IOC_MAGIC+1, 0)
struct twl6030_gpadc_user_parms {
int channel;