From: Jonathan Cameron <jic23@kernel.org>
To: Chen-Yu Tsai <wens@csie.org>
Cc: Quentin Schulz <quentin.schulz@free-electrons.com>,
Sebastian Reichel <sre@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Russell King <linux@armlinux.org.uk>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
Lee Jones <lee.jones@linaro.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
"open list:THERMAL" <linux-pm@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-iio@vger.kernel.org, Icenowy Zheng <icenowy@aosc.io>,
linux-sunxi <linux-sunxi@googlegroups.com>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Subject: Re: [linux-sunxi] [PATCH 1/8] iio: adc: axp20x_adc: put ADC rate setting in a per-variant function
Date: Sun, 10 Dec 2017 16:37:41 +0000 [thread overview]
Message-ID: <20171210163741.3a8ed5aa@archlinux> (raw)
In-Reply-To: <CAGb2v64er1xMXCFDfNKqGjGN-TysQyjK+vfHdx0t+kaCchQfCg@mail.gmail.com>
On Tue, 5 Dec 2017 11:35:49 +0800
Chen-Yu Tsai <wens@csie.org> wrote:
> On Mon, Dec 4, 2017 at 10:12 PM, Quentin Schulz
> <quentin.schulz@free-electrons.com> wrote:
> > To prepare for a new comer that set a different register with different
> > values, move rate setting in a function that is specific to each AXP
> > variant.
> >
> > Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> > ---
> > drivers/iio/adc/axp20x_adc.c | 17 ++++++++++-------
> > 1 file changed, 10 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c
> > index a30a972..7274f4f 100644
> > --- a/drivers/iio/adc/axp20x_adc.c
> > +++ b/drivers/iio/adc/axp20x_adc.c
> > @@ -470,14 +470,18 @@ static const struct iio_info axp22x_adc_iio_info = {
> > .read_raw = axp22x_read_raw,
> > };
> >
> > -static int axp20x_adc_rate(int rate)
> > +static int axp20x_adc_rate(struct axp20x_adc_iio *info, int rate)
> > {
> > - return AXP20X_ADC_RATE_HZ(rate);
> > + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE,
> > + AXP20X_ADC_RATE_MASK,
> > + AXP20X_ADC_RATE_HZ(rate));
> > }
> >
> > -static int axp22x_adc_rate(int rate)
> > +static int axp22x_adc_rate(struct axp20x_adc_iio *info, int rate)
> > {
> > - return AXP22X_ADC_RATE_HZ(rate);
> > + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE,
> > + AXP20X_ADC_RATE_MASK,
> > + AXP22X_ADC_RATE_HZ(rate));
> > }
> >
> > struct axp_data {
> > @@ -485,7 +489,7 @@ struct axp_data {
> > int num_channels;
> > struct iio_chan_spec const *channels;
> > unsigned long adc_en1_mask;
> > - int (*adc_rate)(int rate);
> > + int (*adc_rate)(struct axp20x_adc_iio *info, int rate);
>
> Could you also change the name of the callback, to say, adc_set_rate?
> This would make it much clearer what the callback does. Previously
> it was just a conversion helper.
>
Agreed.
With that change you can add my
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Thanks,
Jonathan
> ChenYu
>
> > bool adc_en2;
> > struct iio_map *maps;
> > };
> > @@ -554,8 +558,7 @@ static int axp20x_probe(struct platform_device *pdev)
> > AXP20X_ADC_EN2_MASK, AXP20X_ADC_EN2_MASK);
> >
> > /* Configure ADCs rate */
> > - regmap_update_bits(info->regmap, AXP20X_ADC_RATE, AXP20X_ADC_RATE_MASK,
> > - info->data->adc_rate(100));
> > + info->data->adc_rate(info, 100);
> >
> > ret = iio_map_array_register(indio_dev, info->data->maps);
> > if (ret < 0) {
> > --
> > git-series 0.9.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Cc: Quentin Schulz
<quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Hartmut Knaack <knaack.h-Mmb7MZpHnFY@public.gmane.org>,
Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
Peter Meerwald-Stadler
<pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>,
"open list:THERMAL"
<linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-arm-kernel
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>,
linux-sunxi <linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>,
Thomas Petazzoni
<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Subject: Re: [linux-sunxi] [PATCH 1/8] iio: adc: axp20x_adc: put ADC rate setting in a per-variant function
Date: Sun, 10 Dec 2017 16:37:41 +0000 [thread overview]
Message-ID: <20171210163741.3a8ed5aa@archlinux> (raw)
In-Reply-To: <CAGb2v64er1xMXCFDfNKqGjGN-TysQyjK+vfHdx0t+kaCchQfCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Tue, 5 Dec 2017 11:35:49 +0800
Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> On Mon, Dec 4, 2017 at 10:12 PM, Quentin Schulz
> <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> > To prepare for a new comer that set a different register with different
> > values, move rate setting in a function that is specific to each AXP
> > variant.
> >
> > Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> > ---
> > drivers/iio/adc/axp20x_adc.c | 17 ++++++++++-------
> > 1 file changed, 10 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c
> > index a30a972..7274f4f 100644
> > --- a/drivers/iio/adc/axp20x_adc.c
> > +++ b/drivers/iio/adc/axp20x_adc.c
> > @@ -470,14 +470,18 @@ static const struct iio_info axp22x_adc_iio_info = {
> > .read_raw = axp22x_read_raw,
> > };
> >
> > -static int axp20x_adc_rate(int rate)
> > +static int axp20x_adc_rate(struct axp20x_adc_iio *info, int rate)
> > {
> > - return AXP20X_ADC_RATE_HZ(rate);
> > + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE,
> > + AXP20X_ADC_RATE_MASK,
> > + AXP20X_ADC_RATE_HZ(rate));
> > }
> >
> > -static int axp22x_adc_rate(int rate)
> > +static int axp22x_adc_rate(struct axp20x_adc_iio *info, int rate)
> > {
> > - return AXP22X_ADC_RATE_HZ(rate);
> > + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE,
> > + AXP20X_ADC_RATE_MASK,
> > + AXP22X_ADC_RATE_HZ(rate));
> > }
> >
> > struct axp_data {
> > @@ -485,7 +489,7 @@ struct axp_data {
> > int num_channels;
> > struct iio_chan_spec const *channels;
> > unsigned long adc_en1_mask;
> > - int (*adc_rate)(int rate);
> > + int (*adc_rate)(struct axp20x_adc_iio *info, int rate);
>
> Could you also change the name of the callback, to say, adc_set_rate?
> This would make it much clearer what the callback does. Previously
> it was just a conversion helper.
>
Agreed.
With that change you can add my
Acked-by: Jonathan Cameron <Jonathan.Cameron-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Thanks,
Jonathan
> ChenYu
>
> > bool adc_en2;
> > struct iio_map *maps;
> > };
> > @@ -554,8 +558,7 @@ static int axp20x_probe(struct platform_device *pdev)
> > AXP20X_ADC_EN2_MASK, AXP20X_ADC_EN2_MASK);
> >
> > /* Configure ADCs rate */
> > - regmap_update_bits(info->regmap, AXP20X_ADC_RATE, AXP20X_ADC_RATE_MASK,
> > - info->data->adc_rate(100));
> > + info->data->adc_rate(info, 100);
> >
> > ret = iio_map_array_register(indio_dev, info->data->maps);
> > if (ret < 0) {
> > --
> > git-series 0.9.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > For more options, visit https://groups.google.com/d/optout.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [linux-sunxi] [PATCH 1/8] iio: adc: axp20x_adc: put ADC rate setting in a per-variant function
Date: Sun, 10 Dec 2017 16:37:41 +0000 [thread overview]
Message-ID: <20171210163741.3a8ed5aa@archlinux> (raw)
In-Reply-To: <CAGb2v64er1xMXCFDfNKqGjGN-TysQyjK+vfHdx0t+kaCchQfCg@mail.gmail.com>
On Tue, 5 Dec 2017 11:35:49 +0800
Chen-Yu Tsai <wens@csie.org> wrote:
> On Mon, Dec 4, 2017 at 10:12 PM, Quentin Schulz
> <quentin.schulz@free-electrons.com> wrote:
> > To prepare for a new comer that set a different register with different
> > values, move rate setting in a function that is specific to each AXP
> > variant.
> >
> > Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> > ---
> > drivers/iio/adc/axp20x_adc.c | 17 ++++++++++-------
> > 1 file changed, 10 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c
> > index a30a972..7274f4f 100644
> > --- a/drivers/iio/adc/axp20x_adc.c
> > +++ b/drivers/iio/adc/axp20x_adc.c
> > @@ -470,14 +470,18 @@ static const struct iio_info axp22x_adc_iio_info = {
> > .read_raw = axp22x_read_raw,
> > };
> >
> > -static int axp20x_adc_rate(int rate)
> > +static int axp20x_adc_rate(struct axp20x_adc_iio *info, int rate)
> > {
> > - return AXP20X_ADC_RATE_HZ(rate);
> > + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE,
> > + AXP20X_ADC_RATE_MASK,
> > + AXP20X_ADC_RATE_HZ(rate));
> > }
> >
> > -static int axp22x_adc_rate(int rate)
> > +static int axp22x_adc_rate(struct axp20x_adc_iio *info, int rate)
> > {
> > - return AXP22X_ADC_RATE_HZ(rate);
> > + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE,
> > + AXP20X_ADC_RATE_MASK,
> > + AXP22X_ADC_RATE_HZ(rate));
> > }
> >
> > struct axp_data {
> > @@ -485,7 +489,7 @@ struct axp_data {
> > int num_channels;
> > struct iio_chan_spec const *channels;
> > unsigned long adc_en1_mask;
> > - int (*adc_rate)(int rate);
> > + int (*adc_rate)(struct axp20x_adc_iio *info, int rate);
>
> Could you also change the name of the callback, to say, adc_set_rate?
> This would make it much clearer what the callback does. Previously
> it was just a conversion helper.
>
Agreed.
With that change you can add my
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Thanks,
Jonathan
> ChenYu
>
> > bool adc_en2;
> > struct iio_map *maps;
> > };
> > @@ -554,8 +558,7 @@ static int axp20x_probe(struct platform_device *pdev)
> > AXP20X_ADC_EN2_MASK, AXP20X_ADC_EN2_MASK);
> >
> > /* Configure ADCs rate */
> > - regmap_update_bits(info->regmap, AXP20X_ADC_RATE, AXP20X_ADC_RATE_MASK,
> > - info->data->adc_rate(100));
> > + info->data->adc_rate(info, 100);
> >
> > ret = iio_map_array_register(indio_dev, info->data->maps);
> > if (ret < 0) {
> > --
> > git-series 0.9.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-12-10 16:37 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 14:12 [PATCH 0/8] add support for AXP813 ADC and battery power supply Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` [PATCH 1/8] iio: adc: axp20x_adc: put ADC rate setting in a per-variant function Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-05 3:35 ` [linux-sunxi] " Chen-Yu Tsai
2017-12-05 3:35 ` Chen-Yu Tsai
2017-12-10 16:37 ` Jonathan Cameron [this message]
2017-12-10 16:37 ` Jonathan Cameron
2017-12-10 16:37 ` Jonathan Cameron
2017-12-04 14:12 ` [PATCH 2/8] iio: adc: axp20x_adc: add support for AXP813 ADC Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-10 16:36 ` Jonathan Cameron
2017-12-10 16:36 ` Jonathan Cameron
2017-12-10 16:36 ` Jonathan Cameron
2017-12-11 8:18 ` Quentin Schulz
2017-12-11 8:18 ` Quentin Schulz
2017-12-11 8:18 ` Quentin Schulz
2017-12-12 15:12 ` Jonathan Cameron
2017-12-12 15:12 ` Jonathan Cameron
2017-12-12 15:12 ` Jonathan Cameron
2017-12-04 14:12 ` [PATCH 3/8] mfd: axp20x: probe axp20x_adc driver for AXP813 Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-05 8:08 ` Maxime Ripard
2017-12-05 8:08 ` Maxime Ripard
2017-12-05 8:08 ` Maxime Ripard
2017-12-07 8:51 ` Quentin Schulz
2017-12-07 8:51 ` Quentin Schulz
2017-12-07 8:51 ` Quentin Schulz
2017-12-07 8:54 ` Chen-Yu Tsai
2017-12-07 8:54 ` Chen-Yu Tsai
2017-12-07 8:54 ` Chen-Yu Tsai
2017-12-07 9:03 ` Quentin Schulz
2017-12-07 9:03 ` Quentin Schulz
2017-12-07 9:03 ` Quentin Schulz
2017-12-07 9:14 ` Chen-Yu Tsai
2017-12-07 9:14 ` Chen-Yu Tsai
2017-12-07 9:14 ` Chen-Yu Tsai
2017-12-10 16:40 ` Jonathan Cameron
2017-12-10 16:40 ` Jonathan Cameron
2017-12-04 14:12 ` [PATCH 4/8] dt-bindings: power: supply: axp20x: add AXP813 battery DT binding Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-06 21:16 ` Rob Herring
2017-12-06 21:16 ` Rob Herring
2017-12-06 21:16 ` Rob Herring
2017-12-10 16:44 ` Jonathan Cameron
2017-12-10 16:44 ` Jonathan Cameron
2017-12-10 16:44 ` Jonathan Cameron
2017-12-04 14:12 ` [PATCH 5/8] power: supply: axp20x_battery: add support for AXP813 Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-10 16:49 ` Jonathan Cameron
2017-12-10 16:49 ` Jonathan Cameron
2017-12-10 16:49 ` Jonathan Cameron
2017-12-11 8:35 ` Quentin Schulz
2017-12-11 8:35 ` Quentin Schulz
2017-12-11 8:35 ` Quentin Schulz
2017-12-12 19:55 ` Jonathan Cameron
2017-12-12 19:55 ` Jonathan Cameron
2017-12-12 19:55 ` Jonathan Cameron
2017-12-04 14:12 ` [PATCH 6/8] mfd: axp20x: add battery power supply cell " Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-05 8:24 ` Lee Jones
2017-12-05 8:24 ` Lee Jones
2017-12-05 8:24 ` Lee Jones
2017-12-04 14:12 ` [PATCH 7/8] ARM: dtsi: axp81x: add battery power supply subnode Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` [PATCH 8/8] ARM: dtsi: sun8i: a711: enable " Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
2017-12-04 14:12 ` Quentin Schulz
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=20171210163741.3a8ed5aa@archlinux \
--to=jic23@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=icenowy@aosc.io \
--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-sunxi@googlegroups.com \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@free-electrons.com \
--cc=pmeerw@pmeerw.net \
--cc=quentin.schulz@free-electrons.com \
--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.