diff options
author | Oleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com> | 2012-03-02 16:43:13 +0200 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 13:00:33 +0200 |
commit | 9e5adea6434d79fb329df1feed585f9718dc4b68 (patch) | |
tree | a82e1a39710e12e6d0ae40d45ede39c1a5de8888 /drivers | |
parent | e19611621635522ff71c55adb401c090d5f8262f (diff) | |
download | kernel_samsung_tuna-9e5adea6434d79fb329df1feed585f9718dc4b68.zip kernel_samsung_tuna-9e5adea6434d79fb329df1feed585f9718dc4b68.tar.gz kernel_samsung_tuna-9e5adea6434d79fb329df1feed585f9718dc4b68.tar.bz2 |
MFD: TWL6030: Perform additional check for the twl6032 gpadc conversion
In case we want to use software gpadc conversion with sample type
TWL6030_GPADC_IRQ_ONESHOT, maximum one adc channel can be converted
at a time due to the hardware restrictions of the twl6032.
Change-Id: Iacc4a56eea7a06528513cbc93b2c40feef290ea7
Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/twl6030-gpadc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/mfd/twl6030-gpadc.c b/drivers/mfd/twl6030-gpadc.c index de204f8..772634b 100644 --- a/drivers/mfd/twl6030-gpadc.c +++ b/drivers/mfd/twl6030-gpadc.c @@ -751,6 +751,26 @@ static int _twl6032_gpadc_conversion(struct twl6030_gpadc_request *req, twl6030_gpadc_write(the_gpadc, method->sel, ch_lsb); } + /* + * For the TWL6032 Asynchronous Conversion + * maximum channels count is 1 + */ + if ((req->method == TWL6030_GPADC_SW2) && + (req->type == TWL6030_GPADC_IRQ_ONESHOT)) { + if (channelcnt > 1) { + ret = -EINVAL; + goto out; + } + + for (i = 0; i < TWL6032_GPADC_MAX_CHANNELS; i++) { + if (!(req->channels & BIT(i))) + continue; + + /* select the ADC channel to be read */ + twl6030_gpadc_write(the_gpadc, method->sel, i); + } + } + if (req->type == TWL6030_GPADC_IRQ_ONESHOT) { twl6030_gpadc_set_irq(the_gpadc, req); twl6030_gpadc_start_conversion(the_gpadc, req->method); |