On Mon, Jan 02, 2017 at 05:37:03PM +0100, Quentin Schulz wrote:
> +     switch (axp20x_id) {
> +     case AXP209_ID:
> +             indio_dev->info = &axp20x_adc_iio_info;
> +             indio_dev->num_channels = ARRAY_SIZE(axp20x_adc_channels);
> +             indio_dev->channels = axp20x_adc_channels;
> +
> +             /* Enable the ADCs on IP */
> +             regmap_write(info->regmap, AXP20X_ADC_EN1, AXP20X_ADC_EN1_MASK);
> +
> +             /* Enable GPIO0/1 and internal temperature ADCs */
> +             regmap_update_bits(info->regmap, AXP20X_ADC_EN2,
> +                                AXP20X_ADC_EN2_MASK, AXP20X_ADC_EN2_MASK);
> +
> +             /* Configure ADCs rate */
> +             regmap_update_bits(info->regmap, AXP20X_ADC_RATE,
> +                                AXP20X_ADC_RATE_MASK, AXP20X_ADC_RATE_50HZ);
> +             break;
> +
> +     case AXP221_ID:
> +             indio_dev->info = &axp22x_adc_iio_info;
> +             indio_dev->num_channels = ARRAY_SIZE(axp22x_adc_channels);
> +             indio_dev->channels = axp22x_adc_channels;
> +
> +             /* Enable the ADCs on IP */
> +             regmap_write(info->regmap, AXP20X_ADC_EN1, AXP22X_ADC_EN1_MASK);
> +
> +             /* Configure ADCs rate */
> +             regmap_update_bits(info->regmap, AXP20X_ADC_RATE,
> +                                AXP20X_ADC_RATE_MASK, AXP22X_ADC_RATE_200HZ);
> +             break;
> +
> +     default:
> +             return -EINVAL;
> +     }

I'm not a big fan of those IDs. It always ends up with a ever
increasing list of cases without any consolidation.

In this case, the only thing you need is a list of pointers and values
that can definitely be stored in a structure.

Maxime

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

Attachment: signature.asc
Description: PGP signature

Reply via email to