All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@free-electrons.com>
To: Jonathan Cameron <jic23@kernel.org>,
	knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
	robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org,
	sre@kernel.org, linux@armlinux.org.uk,
	maxime.ripard@free-electrons.com, lee.jones@linaro.org
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	thomas.petazzoni@free-electrons.com, icenowy@aosc.xyz,
	bonbons@linux-vserver.org
Subject: Re: [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs
Date: Tue, 21 Feb 2017 19:03:22 +0100	[thread overview]
Message-ID: <cd4eac68-0155-d032-6d49-91e3ebdee72e@free-electrons.com> (raw)
In-Reply-To: <b76264cc-9c6c-169c-d490-91852c052890@kernel.org>

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.

Thanks,
Quentin

-- 
Quentin Schulz, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Quentin Schulz <quentin.schulz@free-electrons.com>
To: Jonathan Cameron <jic23@kernel.org>,
	knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
	robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org,
	sre@kernel.org, linux@armlinux.org.uk,
	maxime.ripard@free-electrons.com, lee.jones@linaro.org
Cc: thomas.petazzoni@free-electrons.com, devicetree@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, bonbons@linux-vserver.org,
	icenowy@aosc.xyz, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs
Date: Tue, 21 Feb 2017 19:03:22 +0100	[thread overview]
Message-ID: <cd4eac68-0155-d032-6d49-91e3ebdee72e@free-electrons.com> (raw)
In-Reply-To: <b76264cc-9c6c-169c-d490-91852c052890@kernel.org>

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.

Thanks,
Quentin

-- 
Quentin Schulz, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: quentin.schulz@free-electrons.com (Quentin Schulz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs
Date: Tue, 21 Feb 2017 19:03:22 +0100	[thread overview]
Message-ID: <cd4eac68-0155-d032-6d49-91e3ebdee72e@free-electrons.com> (raw)
In-Reply-To: <b76264cc-9c6c-169c-d490-91852c052890@kernel.org>

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.

Thanks,
Quentin

-- 
Quentin Schulz, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-02-21 18:03 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14  9:40 [PATCH v3 00/18] add support for AXP20X and AXP22X power supply drivers Quentin Schulz
2017-02-14  9:40 ` Quentin Schulz
2017-02-14  9:40 ` Quentin Schulz
2017-02-14  9:40 ` [PATCH v3 01/18] dt-bindings: power: battery: add constant-charge-current property Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-15  0:46   ` Liam Breck
2017-02-15  0:46     ` Liam Breck
2017-02-15  0:46     ` Liam Breck
2017-02-15  8:53     ` Quentin Schulz
2017-02-15  8:53       ` Quentin Schulz
2017-02-15 20:18       ` Liam Breck
2017-02-15 20:18         ` Liam Breck
2017-02-15 20:18         ` Liam Breck
2017-02-21  4:55       ` Chen-Yu Tsai
2017-02-21  4:55         ` Chen-Yu Tsai
2017-02-21  4:55         ` Chen-Yu Tsai
2017-03-14 13:44         ` Quentin Schulz
2017-03-14 13:44           ` Quentin Schulz
2017-03-14 13:44           ` Quentin Schulz
2017-02-22 21:25   ` Rob Herring
2017-02-22 21:25     ` Rob Herring
2017-02-22 21:25     ` Rob Herring
2017-02-14  9:40 ` [PATCH v3 02/18] power: supply: power_supply_core: add constant-current-charge optional property Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-14  9:40 ` [PATCH v3 03/18] mfd: axp20x: correct name of temperature data ADC registers Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-14  9:40 ` [PATCH v3 04/18] iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-19 12:40   ` Jonathan Cameron
2017-02-19 12:40     ` Jonathan Cameron
2017-02-19 12:40     ` Jonathan Cameron
2017-02-21 18:03     ` Quentin Schulz [this message]
2017-02-21 18:03       ` Quentin Schulz
2017-02-21 18:03       ` Quentin Schulz
2017-02-25 16:53       ` Jonathan Cameron
2017-02-25 16:53         ` Jonathan Cameron
2017-02-25 16:53         ` Jonathan Cameron
2017-02-21  4:32   ` Chen-Yu Tsai
2017-02-21  4:32     ` Chen-Yu Tsai
2017-02-21  4:32     ` Chen-Yu Tsai
2017-02-14  9:40 ` [PATCH v3 05/18] mfd: axp20x: add ADC cells for AXP20X and AXP22X PMICs Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-14  9:40   ` Quentin Schulz
2017-02-15  9:37   ` Lee Jones
2017-02-15  9:37     ` Lee Jones
2017-02-15  9:37     ` Lee Jones
2017-02-21  4:51     ` Chen-Yu Tsai
2017-02-21  4:51       ` Chen-Yu Tsai
2017-02-14  9:41 ` [PATCH v3 06/18] mfd: axp20x: add AC power supply cells for " Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41 ` [PATCH v3 07/18] ARM: dtsi: axp209: add AC power supply subnode Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41 ` [PATCH v3 08/18] ARM: dtsi: axp22x: " Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41 ` [PATCH v3 09/18] ARM: dts: sun8i: sina33: enable ACIN " Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41 ` [PATCH v3 10/18] ARM: sun5i: chip: " Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41 ` [PATCH v3 11/18] dt-bindings: power: supply: add AXP20X/AXP22X battery DT binding Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-21  4:45   ` Chen-Yu Tsai
2017-02-21  4:45     ` Chen-Yu Tsai
2017-02-21  4:45     ` Chen-Yu Tsai
2017-02-21 18:05     ` Quentin Schulz
2017-02-21 18:05       ` Quentin Schulz
2017-02-21 18:05       ` Quentin Schulz
2017-02-14  9:41 ` [PATCH v3 12/18] mfd: axp20x: add CHRG_CTRL1/2/3 to writeable regs for AXP20X/AXP22X Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41 ` [PATCH v3 13/18] power: supply: add battery driver for AXP20X and AXP22X PMICs Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-21  4:44   ` Chen-Yu Tsai
2017-02-21  4:44     ` Chen-Yu Tsai
2017-02-21  4:44     ` Chen-Yu Tsai
2017-02-21 18:19     ` Quentin Schulz
2017-02-21 18:19       ` Quentin Schulz
2017-02-21 18:19       ` Quentin Schulz
2017-02-22  6:22       ` Chen-Yu Tsai
2017-02-22  6:22         ` Chen-Yu Tsai
2017-02-22  6:22         ` Chen-Yu Tsai
2017-02-14  9:41 ` [PATCH v3 14/18] mfd: axp20x: add MFD cells for AXP20X and AXP22X battery driver Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-21  4:46   ` Chen-Yu Tsai
2017-02-21  4:46     ` Chen-Yu Tsai
2017-02-21  4:46     ` Chen-Yu Tsai
2017-02-14  9:41 ` [PATCH v3 15/18] ARM: dtsi: axp209: add battery power supply subnode Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-21  4:47   ` Chen-Yu Tsai
2017-02-21  4:47     ` Chen-Yu Tsai
2017-02-21  4:47     ` Chen-Yu Tsai
2017-02-14  9:41 ` [PATCH v3 16/18] ARM: dtsi: axp22x: " Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-21  4:47   ` Chen-Yu Tsai
2017-02-21  4:47     ` Chen-Yu Tsai
2017-02-21  4:47     ` Chen-Yu Tsai
2017-02-14  9:41 ` [PATCH v3 17/18] ARM: dts: sun8i: sina33: enable " Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-21  4:50   ` Chen-Yu Tsai
2017-02-21  4:50     ` Chen-Yu Tsai
2017-02-21  4:50     ` Chen-Yu Tsai
2017-02-21 18:20     ` Quentin Schulz
2017-02-21 18:20       ` Quentin Schulz
2017-02-21 18:20       ` Quentin Schulz
2017-02-14  9:41 ` [PATCH v3 18/18] ARM: sun5i: chip: " Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-14  9:41   ` Quentin Schulz
2017-02-21  4:50   ` Chen-Yu Tsai
2017-02-21  4:50     ` Chen-Yu Tsai
2017-02-15  9:36 ` [PATCH v3 00/18] add support for AXP20X and AXP22X power supply drivers Lee Jones
2017-02-15  9:36   ` Lee Jones
2017-02-15  9:36   ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd4eac68-0155-d032-6d49-91e3ebdee72e@free-electrons.com \
    --to=quentin.schulz@free-electrons.com \
    --cc=bonbons@linux-vserver.org \
    --cc=devicetree@vger.kernel.org \
    --cc=icenowy@aosc.xyz \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.