Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1735823 > unrolled thread
| Started by | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| First post | 2017-09-20 17:20 +0200 |
| Last post | 2017-09-25 09:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now Icenowy Zheng <icenowy@aosc.io> - 2017-09-20 17:20 +0200
Re: [RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-25 09:30 +0200
| From | Icenowy Zheng <icenowy@aosc.io> |
|---|---|
| Date | 2017-09-20 17:20 +0200 |
| Subject | [RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now |
| Message-ID | <urOX8-4Mq-11@gated-at.bofh.it> |
The ADC rate setup on AXP803 is more complex than AXP20x/22x.
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) {
--
2.13.5
[toc] | [next] | [standalone]
| From | Quentin Schulz <quentin.schulz@free-electrons.com> |
|---|---|
| Date | 2017-09-25 09:30 +0200 |
| Subject | Re: [RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now |
| Message-ID | <utw01-3bl-5@gated-at.bofh.it> |
| In reply to | #1735823 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web