blob: e15745b4f3a5314f7bb7630398abeeff4cb0ad51 [file] [log] [blame]
Maxime Ripardaaeb6df2012-05-11 15:35:32 +02001/*
2 * Copyright (C) 2011 Free Electrons
3 *
4 * Licensed under the GPLv2 or later.
5 */
6
7#ifndef _AT91_ADC_H_
8#define _AT91_ADC_H_
9
10/**
11 * struct at91_adc_reg_desc - Various informations relative to registers
12 * @channel_base: Base offset for the channel data registers
13 * @drdy_mask: Mask of the DRDY field in the relevant registers
14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register
17 */
18struct at91_adc_reg_desc {
19 u8 channel_base;
20 u32 drdy_mask;
21 u8 status_register;
22 u8 trigger_register;
23};
24
25/**
26 * struct at91_adc_trigger - description of triggers
27 * @name: name of the trigger advertised to the user
28 * @value: value to set in the ADC's trigger setup register
29 to enable the trigger
30 * @is_external: Does the trigger rely on an external pin?
31 */
32struct at91_adc_trigger {
33 const char *name;
34 u8 value;
35 bool is_external;
36};
37
38/**
39 * struct at91_adc_data - platform data for ADC driver
40 * @channels_used: channels in use on the board as a bitmask
41 * @num_channels: global number of channels available on the board
42 * @registers: Registers definition on the board
43 * @startup_time: startup time of the ADC in microseconds
44 * @trigger_list: Triggers available in the ADC
45 * @trigger_number: Number of triggers available in the ADC
46 * @use_external_triggers: does the board has external triggers availables
47 * @vref: Reference voltage for the ADC in millivolts
48 */
49struct at91_adc_data {
50 unsigned long channels_used;
51 u8 num_channels;
52 struct at91_adc_reg_desc *registers;
53 u8 startup_time;
54 struct at91_adc_trigger *trigger_list;
55 u8 trigger_number;
56 bool use_external_triggers;
57 u16 vref;
58};
59
60extern void __init at91_add_device_adc(struct at91_adc_data *data);
61#endif