[PATCH 1/3] ARM: AT91: Add platform data for the ADCs

Maxime Ripard maxime.ripard at free-electrons.com
Fri Nov 4 11:22:02 EDT 2011


Hi Jonathan,

On 04/11/2011 11:34, Jonathan Cameron wrote:
> On 11/03/2011 10:11 AM, Maxime Ripard wrote:
>> +/* ADC */
>> +#define AT91_ADC_MAX_CHANNELS   16
>> +
>> +struct at91_adc_data {
>> +	/* ADC Clock as specified by the datasheet, in Hz. */
>> +	unsigned int adc_clock;
>> +	/*
>> +	 * Global number of channels available (to specify which channels are
>> +	 * indeed used on the board, see the channels_used array).
>> +	 */
>> +	u8 num_channels;
>> +	/* Channels in use on the board */
> put it in a unsigned long and use the bitmap functions.
>> +	u8 channels_used[AT91_ADC_MAX_CHANNELS];
>> +	/* Number of channels in use */
> just use bitmap_weight with the long above and
> length set to num_channels.
>> +	u8 num_channels_used;

I didn't know bitmap functions before you mentioned it, but if I read it
correctly, while I agree with your point, I will lose the ability to
define a combination of enabled and disabled channel in a board specific
manner.

In the third patch, I defined channels_used as an array of one. But
let's say that instead I want all channels except the second one. With
what's in the driver for now, I initialise it to {1, 0, 1, 1}. I don't
think it's possible to do so with bitmap functions, or am I missing
something ?

Or put the calls to bitmap_set in the board_init function ?

-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com



More information about the linux-arm-kernel mailing list