From: Quentin Schulz <quentin.schulz@free-electrons.com> To: Icenowy Zheng <icenowy@aosc.io>, Chen-Yu Tsai <wens@csie.org>, Maxime Ripard <maxime.ripard@free-electrons.com>, Jonathan Cameron <jic23@kernel.org>, Lee Jones <lee.jones@linaro.org> Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now Date: Mon, 25 Sep 2017 09:20:02 +0200 [thread overview] Message-ID: <300803eb-4526-52c4-e74b-92625602a6da@free-electrons.com> (raw) In-Reply-To: <20170920151814.22461-3-icenowy@aosc.io> Hi Icenowy, On 20/09/2017 17:18, Icenowy Zheng wrote: > The ADC rate setup on AXP803 is more complex than AXP20x/22x. > Can you elaborate? I can see two rate settings in register 0x85. Bits 7-6 => TS/GPIO ADC speed setting (25, 50, 100, 200 Hz) ((ilog2(x) / 25) << 6, same as AXP20X). Bits 5-4 => Vol/Cur ADC speed setting (100, 200, 400, 800 Hz) ((ilog2(x) / 100) << 4, same as AXP22X except the bit shift). Just set both to 100 or 200 by default (common rate). If someone wants to add a more specific rate setting, he could do it in the future. Setting a default is safer as we don't know if anything before the kernel does anything to this register. Thanks, Quentin > As it's not a necessary setup, allow it to be skipped, to allow simpler > AXP803 support now. > > Signed-off-by: Icenowy Zheng <icenowy@aosc.io> > --- > drivers/iio/adc/axp20x_adc.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c > index 11e177180ea0..93dd6b80059e 100644 > --- a/drivers/iio/adc/axp20x_adc.c > +++ b/drivers/iio/adc/axp20x_adc.c > @@ -556,8 +556,10 @@ 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)); > + if (info->data->adc_rate) > + regmap_update_bits(info->regmap, AXP20X_ADC_RATE, > + AXP20X_ADC_RATE_MASK, > + info->data->adc_rate(100)); > > ret = iio_map_array_register(indio_dev, info->data->maps); > if (ret < 0) { > -- Quentin Schulz, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
WARNING: multiple messages have this Message-ID
From: quentin.schulz@free-electrons.com (Quentin Schulz) To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now Date: Mon, 25 Sep 2017 09:20:02 +0200 [thread overview] Message-ID: <300803eb-4526-52c4-e74b-92625602a6da@free-electrons.com> (raw) In-Reply-To: <20170920151814.22461-3-icenowy@aosc.io> Hi Icenowy, On 20/09/2017 17:18, Icenowy Zheng wrote: > The ADC rate setup on AXP803 is more complex than AXP20x/22x. > Can you elaborate? I can see two rate settings in register 0x85. Bits 7-6 => TS/GPIO ADC speed setting (25, 50, 100, 200 Hz) ((ilog2(x) / 25) << 6, same as AXP20X). Bits 5-4 => Vol/Cur ADC speed setting (100, 200, 400, 800 Hz) ((ilog2(x) / 100) << 4, same as AXP22X except the bit shift). Just set both to 100 or 200 by default (common rate). If someone wants to add a more specific rate setting, he could do it in the future. Setting a default is safer as we don't know if anything before the kernel does anything to this register. Thanks, Quentin > As it's not a necessary setup, allow it to be skipped, to allow simpler > AXP803 support now. > > Signed-off-by: Icenowy Zheng <icenowy@aosc.io> > --- > drivers/iio/adc/axp20x_adc.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c > index 11e177180ea0..93dd6b80059e 100644 > --- a/drivers/iio/adc/axp20x_adc.c > +++ b/drivers/iio/adc/axp20x_adc.c > @@ -556,8 +556,10 @@ 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)); > + if (info->data->adc_rate) > + regmap_update_bits(info->regmap, AXP20X_ADC_RATE, > + AXP20X_ADC_RATE_MASK, > + info->data->adc_rate(100)); > > ret = iio_map_array_register(indio_dev, info->data->maps); > if (ret < 0) { > -- Quentin Schulz, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
next prev parent reply other threads:[~2017-09-25 7:20 UTC|newest] Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-09-20 15:18 [RFC PATCH 0/7] AXP803 AC/Battery support Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` [RFC PATCH 1/7] dt-bindings: add compatibles for AXP803 Battery/USB power supplies Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-25 9:14 ` Quentin Schulz 2017-09-25 9:14 ` Quentin Schulz 2017-09-25 9:14 ` Quentin Schulz 2017-09-20 15:18 ` [RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-25 7:20 ` Quentin Schulz [this message] 2017-09-25 7:20 ` Quentin Schulz 2017-09-20 15:18 ` [RFC PATCH 3/7] iio: adc: axp20x-adc: add support for AXP803 Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-24 14:32 ` Jonathan Cameron 2017-09-24 14:32 ` Jonathan Cameron 2017-09-24 14:32 ` Jonathan Cameron 2017-09-25 8:48 ` Quentin Schulz 2017-09-25 8:48 ` Quentin Schulz 2017-09-25 8:48 ` Quentin Schulz 2017-09-20 15:18 ` [RFC PATCH 4/7] power: supply: axp20x-battery: support AXP803 Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-24 14:34 ` Jonathan Cameron 2017-09-24 14:34 ` Jonathan Cameron 2017-09-24 14:34 ` Jonathan Cameron 2017-09-25 8:58 ` Quentin Schulz 2017-09-25 8:58 ` Quentin Schulz 2017-09-25 8:58 ` Quentin Schulz 2017-09-20 15:18 ` [RFC PATCH 5/7] mfd: axp20x: add cells for AXP803 ADC/AC Power/Battery Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` [RFC PATCH 6/7] arm64: allwinner: a64: add power supply nodes in AXP803 DTSI Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-25 9:11 ` Quentin Schulz 2017-09-25 9:11 ` Quentin Schulz 2017-09-25 9:11 ` Quentin Schulz 2017-09-25 9:14 ` Icenowy Zheng 2017-09-25 9:14 ` Icenowy Zheng 2017-09-25 9:14 ` Icenowy Zheng 2017-09-25 9:19 ` [linux-sunxi] " Chen-Yu Tsai 2017-09-25 9:19 ` Chen-Yu Tsai 2017-09-25 9:19 ` Chen-Yu Tsai 2017-09-25 9:19 ` Chen-Yu Tsai 2017-09-25 9:24 ` Quentin Schulz 2017-09-25 9:24 ` Quentin Schulz 2017-09-25 9:24 ` Quentin Schulz 2017-09-20 15:18 ` [RFC PATCH 7/7] arm64: allwinner: a64: enable AC and Battery for Pine64 Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-20 15:18 ` Icenowy Zheng 2017-09-21 14:46 ` [RFC PATCH 0/7] AXP803 AC/Battery support Jonathan Cameron 2017-09-21 14:46 ` Jonathan Cameron 2017-09-21 14:46 ` Jonathan Cameron 2017-09-21 15:20 ` Icenowy Zheng 2017-09-21 15:20 ` Icenowy Zheng 2017-09-21 15:20 ` Icenowy Zheng 2017-09-24 14:36 ` Jonathan Cameron 2017-09-24 14:36 ` Jonathan Cameron 2017-09-25 9:22 ` Quentin Schulz 2017-09-25 9:22 ` Quentin Schulz 2017-09-25 9:22 ` 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=300803eb-4526-52c4-e74b-92625602a6da@free-electrons.com \ --to=quentin.schulz@free-electrons.com \ --cc=devicetree@vger.kernel.org \ --cc=icenowy@aosc.io \ --cc=jic23@kernel.org \ --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=maxime.ripard@free-electrons.com \ --cc=wens@csie.org \ --subject='Re: [RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now' \ /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
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.