* [PATCH RFC] mfd: twl4030-madc: Enable ADC channels 3-6
@ 2011-12-08 23:13 Steve Sakoman
2011-12-09 6:38 ` Kyle Manna
0 siblings, 1 reply; 2+ messages in thread
From: Steve Sakoman @ 2011-12-08 23:13 UTC (permalink / raw)
To: lm-sensors, linux-omap; +Cc: Keerthy, Kyle Manna
Currently the driver does not explicitly set the TWL4030_USB_SEL_MADC_MCPC
bit to enable madc input channels 3 through 6. This results in readings near
zero for these channels since the inputs are grounded if this bit is not set.
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index 834f824..56a8e9b 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -725,6 +725,23 @@ static int __devinit twl4030_madc_probe(struct
platform_device *pdev)
if (ret < 0)
goto err_current_generator;
+ /* Enable ADCIN3 through 6 */
+ ret = twl_i2c_read_u8(TWL4030_MODULE_USB,
+ ®val, TWL4030_USB_CARKIT_ANA_CTRL);
+ if (ret) {
+ dev_err(&pdev->dev, "unable to read reg CARKIT_ANA_CTRL 0x%X\n",
+ TWL4030_USB_CARKIT_ANA_CTRL);
+ goto err_i2c;
+ }
+ regval |= TWL4030_USB_SEL_MADC_MCPC;
+ ret = twl_i2c_write_u8(TWL4030_MODULE_USB,
+ regval, TWL4030_USB_CARKIT_ANA_CTRL);
+ if (ret) {
+ dev_err(&pdev->dev, "unable to write reg CARKIT_ANA_CTRL 0x%X\n",
+ TWL4030_USB_CARKIT_ANA_CTRL);
+ goto err_i2c;
+ }
+
ret = twl_i2c_read_u8(TWL4030_MODULE_MAIN_CHARGE,
®val, TWL4030_BCI_BCICTL1);
if (ret) {
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index 530e11b..f017495 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -120,6 +120,9 @@ enum sample_type {
#define CURR_PSR_R1 44
#define CURR_PSR_R2 88
+#define TWL4030_USB_CARKIT_ANA_CTRL 0xBB
+#define TWL4030_USB_SEL_MADC_MCPC (1<<3)
+
#define TWL4030_BCI_BCICTL1 0x23
#define TWL4030_BCI_CGAIN 0x020
#define TWL4030_BCI_MESBAT (1 << 1)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RFC] mfd: twl4030-madc: Enable ADC channels 3-6
2011-12-08 23:13 [PATCH RFC] mfd: twl4030-madc: Enable ADC channels 3-6 Steve Sakoman
@ 2011-12-09 6:38 ` Kyle Manna
0 siblings, 0 replies; 2+ messages in thread
From: Kyle Manna @ 2011-12-09 6:38 UTC (permalink / raw)
To: Steve Sakoman; +Cc: lm-sensors, linux-omap, Keerthy
On 12/08/2011 05:13 PM, Steve Sakoman wrote:
> Currently the driver does not explicitly set the TWL4030_USB_SEL_MADC_MCPC
> bit to enable madc input channels 3 through 6. This results in readings near
> zero for these channels since the inputs are grounded if this bit is not set.
I've run into this same problem and have fixed it the same way, looks
good to me.
Reviewed-by: Kyle Manna <kyle@kylemanna.com>
- Kyle
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-09 6:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08 23:13 [PATCH RFC] mfd: twl4030-madc: Enable ADC channels 3-6 Steve Sakoman
2011-12-09 6:38 ` Kyle Manna
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).