Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1588166
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs |
| Date | 2017-02-25 18:00 +0100 |
| Message-ID | <teNRn-2g6-5@gated-at.bofh.it> (permalink) |
| References | <taHUe-8vw-43@gated-at.bofh.it> <taLOa-2zE-15@gated-at.bofh.it> <tcz6a-7qN-5@gated-at.bofh.it> <tdn2V-6bo-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 21/02/17 18:03, Quentin Schulz wrote:
> Hi Jonathan,
>
> On 19/02/2017 13:40, Jonathan Cameron wrote:
>> On 14/02/17 09:40, Quentin Schulz wrote:
>>> The X-Powers AXP20X and AXP22X PMICs have multiple ADCs. They expose the
>>> battery voltage, battery charge and discharge currents, AC-in and VBUS
>>> voltages and currents, 2 GPIOs muxable in ADC mode and PMIC temperature.
>>>
>>> This adds support for most of AXP20X and AXP22X ADCs.
>>>
>>> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
>>> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> Hi Quentin,
>>
>> A few bits and bobs inline. The bigest one is that I don't think
>> you need to carry your struct axp_data pointer around in the iio_priv
>> structure as it only seems to be used in probe.
>>
>> Anyhow, tidy these little bits up (quite a few are optional in the
>> sense that they are a matter or personal taste and I don't feel
>> strongly about them) and you can add
>>
>> Reviewed-by: Jonathan Cameron <jic23@kernel.org>
>>
>> A nice driver.
>>
>> Jonathan
> [...]
>>> +static int axp20x_probe(struct platform_device *pdev)
>>> +{
>>> + struct axp20x_adc_iio *info;
>>> + struct iio_dev *indio_dev;
>>> + struct axp20x_dev *axp20x_dev;
>>> + int ret;
>>> +
>>> + axp20x_dev = dev_get_drvdata(pdev->dev.parent);
>>> +
>>> + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info));
>>> + if (!indio_dev)
>>> + return -ENOMEM;
>>> +
>>> + info = iio_priv(indio_dev);
>>> + platform_set_drvdata(pdev, indio_dev);
>>> +
>>> + info->regmap = axp20x_dev->regmap;
>>> + indio_dev->dev.parent = &pdev->dev;
>>> + indio_dev->dev.of_node = pdev->dev.of_node;
>>> + indio_dev->modes = INDIO_DIRECT_MODE;
>>> +
>>> + info->data = (struct axp_data *)platform_get_device_id(pdev)->driver_data;
>> I think this is only actually used in probe, so could be handled more
>> neatly with a local variable rather than sticking it in info.
>>
> [...]
>>> +static int axp20x_remove(struct platform_device *pdev)
>>> +{
>>> + struct axp20x_adc_iio *info;
>>> + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>>> +
>>> + info = iio_priv(indio_dev);
>> Reorder the two lines above this one and then you could just do this
>> inline. (really trivial so feel free to not bother ;)
>>> +
>>> + iio_device_unregister(indio_dev);
>>> + iio_map_array_unregister(indio_dev);
>>> +
>>> + regmap_write(info->regmap, AXP20X_ADC_EN1, 0);
>>> +
>>> + if (info->data->adc_en2)
>
> data is used here to know if I should disable misc ADCs (if supported by
> the PMIC). So kinda need it only for that purpose, maybe I can use a
> slightly simpler structure to only store regmap and this adc_en2 boolean.
>
> Ack for everything else.
cool. Not sure how my searching missed that!
Up to you on whether you simplify that structure or not, I'm happy either way.
>
> Thanks,
> Quentin
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-02-14 15:00 +0100
Re: [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs Jonathan Cameron <jic23@kernel.org> - 2017-02-19 13:50 +0100
Re: [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-02-21 19:10 +0100
Re: [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs Jonathan Cameron <jic23@kernel.org> - 2017-02-25 18:00 +0100
Re: [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs Chen-Yu Tsai <wens@csie.org> - 2017-02-21 05:40 +0100
csiph-web