From 824e28985b9cccb8906500aa20b7c33a95e6608a Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 9 Dec 2013 13:23:53 +0100 Subject: mfd: stmpe: add ADC block resources In order to use the auxiliar ADC inputs of STMPE811 devices we need to add resources for the ADC block. Also move the ADC macros from the touchscreen driver to the general header file. We will need them for the ADC driver in future. Conflicts: drivers/mfd/stmpe.c --- include/linux/mfd/stmpe.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'include') diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index 48395a69a7e9..76195ccee98c 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h @@ -12,6 +12,17 @@ struct device; +#define SAMPLE_TIME(x) ((x & 0xf) << 4) +#define MOD_12B(x) ((x & 0x1) << 3) +#define REF_SEL(x) ((x & 0x1) << 1) +#define ADC_FREQ(x) (x & 0x3) +#define AVE_CTRL(x) ((x & 0x3) << 6) +#define DET_DELAY(x) ((x & 0x7) << 3) +#define SETTLING(x) (x & 0x7) +#define FRACTION_Z(x) (x & 0x7) +#define I_DRIVE(x) (x & 0x1) +#define OP_MODE(x) ((x & 0x7) << 1) + enum stmpe_block { STMPE_BLOCK_GPIO = 1 << 0, STMPE_BLOCK_KEYPAD = 1 << 1, @@ -188,6 +199,26 @@ struct stmpe_ts_platform_data { u8 i_drive; }; +/** + * struct stmpe_adc_platform_data - stmpe811 adc controller platform + * data + * @sample_time: ADC converstion time in number of clock. + * (0 -> 36 clocks, 1 -> 44 clocks, 2 -> 56 clocks, 3 -> 64 clocks, + * 4 -> 80 clocks, 5 -> 96 clocks, 6 -> 144 clocks), + * recommended is 4. + * @mod_12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC) + * @ref_sel: ADC reference source + * (0 -> internal reference, 1 -> external reference) + * @adc_freq: ADC Clock speed + * (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 MHz) + */ +struct stmpe_adc_platform_data { + u8 sample_time; + u8 mod_12b; + u8 ref_sel; + u8 adc_freq; +}; + /** * struct stmpe_platform_data - STMPE platform data * @id: device id to distinguish between multiple STMPEs on the same board @@ -217,6 +248,7 @@ struct stmpe_platform_data { struct stmpe_gpio_platform_data *gpio; struct stmpe_keypad_platform_data *keypad; struct stmpe_ts_platform_data *ts; + struct stmpe_adc_platform_data *adc; }; #define STMPE_NR_INTERNAL_IRQS 9 -- cgit v1.2.3