linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
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

  reply	other threads:[~2017-12-10 16:37 UTC|newest]

Thread overview: 26+ 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 ` [PATCH 1/8] iio: adc: axp20x_adc: put ADC rate setting in a per-variant function Quentin Schulz
2017-12-05  3:35   ` [linux-sunxi] " Chen-Yu Tsai
2017-12-10 16:37     ` Jonathan Cameron [this message]
2017-12-04 14:12 ` [PATCH 2/8] iio: adc: axp20x_adc: add support for AXP813 ADC Quentin Schulz
2017-12-10 16:36   ` Jonathan Cameron
2017-12-11  8:18     ` Quentin Schulz
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-05  8:08   ` Maxime Ripard
2017-12-07  8:51     ` Quentin Schulz
2017-12-07  8:54       ` Chen-Yu Tsai
2017-12-07  9:03         ` Quentin Schulz
2017-12-07  9:14           ` Chen-Yu Tsai
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-06 21:16   ` Rob Herring
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-10 16:49   ` Jonathan Cameron
2017-12-11  8:35     ` Quentin Schulz
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-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 ` [PATCH 8/8] ARM: dtsi: sun8i: a711: enable " 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=linux-arm-kernel@lists.infradead.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 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).