lp8788-charger: Use consumer device name on setting IIO channels
authorKim, Milo <Milo.Kim@ti.com>
Thu, 18 Oct 2012 06:11:33 +0000 (06:11 +0000)
committerAnton Vorontsov <anton.vorontsov@linaro.org>
Sun, 18 Nov 2012 04:40:59 +0000 (20:40 -0800)
To get the ADC value for the battery voltage and temperature, LP8788 ADC
driver is used. LP8788 charger driver is the consumer of LP8788 ADC
driver. Thus, specific ADC driver name is required on getting the channel
using iio_channel_get().

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
drivers/power/lp8788-charger.c

index e852d12cd077afa027b5d50be4b5b85ad8b84c0a..614e6aafc5130685331a9d34031eb35c8d9813fd 100644 (file)
@@ -592,7 +592,8 @@ static void lp8788_irq_unregister(struct platform_device *pdev,
        }
 }
 
-static void lp8788_setup_adc_channel(struct lp8788_charger *pchg)
+static void lp8788_setup_adc_channel(const char *consumer_name,
+                               struct lp8788_charger *pchg)
 {
        struct lp8788_charger_platform_data *pdata = pchg->pdata;
        struct device *dev = pchg->lp->dev;
@@ -616,7 +617,7 @@ static void lp8788_setup_adc_channel(struct lp8788_charger *pchg)
        case LPADC_VBATT_5P5:
        case LPADC_VBATT_6P0:
        case LPADC_VBATT_5P0:
-               chan = iio_channel_get(NULL, chan_name[id]);
+               chan = iio_channel_get(consumer_name, chan_name[id]);
                pchg->chan[LP8788_VBATT] = IS_ERR(chan) ? NULL : chan;
                break;
        default:
@@ -631,7 +632,7 @@ static void lp8788_setup_adc_channel(struct lp8788_charger *pchg)
        case LPADC_ADC2:
        case LPADC_ADC3:
        case LPADC_ADC4:
-               chan = iio_channel_get(NULL, chan_name[id]);
+               chan = iio_channel_get(consumer_name, chan_name[id]);
                pchg->chan[LP8788_BATT_TEMP] = IS_ERR(chan) ? NULL : chan;
                break;
        default:
@@ -747,7 +748,7 @@ static __devinit int lp8788_charger_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       lp8788_setup_adc_channel(pchg);
+       lp8788_setup_adc_channel(pdev->name, pchg);
 
        ret = lp8788_psy_register(pdev, pchg);
        if (ret)