diff options
| author | Lee Jones <lee.jones@linaro.org> | 2013-02-26 05:06:55 -0500 |
|---|---|---|
| committer | Lee Jones <lee.jones@linaro.org> | 2013-03-06 23:27:14 -0500 |
| commit | 734823462590335cbf5c6a1fa5cae84a881dcb43 (patch) | |
| tree | 3085b4de4198728b1da9e32a4be8d5b1fdd4e0ba /include/linux/mfd | |
| parent | d89cc5aad109d20d10d228ba52d86e0adca62461 (diff) | |
mfd: ab8500-gpadc: Add gpadc hw conversion
Add the support of gpacd hw conversion and make the number of
sample configurable.
Signed-off-by: M'boumba Cedric Madianga <cedric.madianga@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com>
Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux/mfd')
| -rw-r--r-- | include/linux/mfd/abx500/ab8500-gpadc.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/include/linux/mfd/abx500/ab8500-gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h index 252966769d93..7694e7ab1880 100644 --- a/include/linux/mfd/abx500/ab8500-gpadc.h +++ b/include/linux/mfd/abx500/ab8500-gpadc.h | |||
| @@ -4,12 +4,14 @@ | |||
| 4 | * | 4 | * |
| 5 | * Author: Arun R Murthy <arun.murthy@stericsson.com> | 5 | * Author: Arun R Murthy <arun.murthy@stericsson.com> |
| 6 | * Author: Daniel Willerud <daniel.willerud@stericsson.com> | 6 | * Author: Daniel Willerud <daniel.willerud@stericsson.com> |
| 7 | * Author: M'boumba Cedric Madianga <cedric.madianga@stericsson.com> | ||
| 7 | */ | 8 | */ |
| 8 | 9 | ||
| 9 | #ifndef _AB8500_GPADC_H | 10 | #ifndef _AB8500_GPADC_H |
| 10 | #define _AB8500_GPADC_H | 11 | #define _AB8500_GPADC_H |
| 11 | 12 | ||
| 12 | /* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */ | 13 | /* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2 |
| 14 | * and ADCHwSel[4:0] in GPADCCtrl3 ) */ | ||
| 13 | #define BAT_CTRL 0x01 | 15 | #define BAT_CTRL 0x01 |
| 14 | #define BTEMP_BALL 0x02 | 16 | #define BTEMP_BALL 0x02 |
| 15 | #define MAIN_CHARGER_V 0x03 | 17 | #define MAIN_CHARGER_V 0x03 |
| @@ -24,12 +26,32 @@ | |||
| 24 | #define BK_BAT_V 0x0C | 26 | #define BK_BAT_V 0x0C |
| 25 | #define DIE_TEMP 0x0D | 27 | #define DIE_TEMP 0x0D |
| 26 | 28 | ||
| 29 | #define SAMPLE_1 1 | ||
| 30 | #define SAMPLE_4 4 | ||
| 31 | #define SAMPLE_8 8 | ||
| 32 | #define SAMPLE_16 16 | ||
| 33 | #define RISING_EDGE 0 | ||
| 34 | #define FALLING_EDGE 1 | ||
| 35 | |||
| 36 | /* Arbitrary ADC conversion type constants */ | ||
| 37 | #define ADC_SW 0 | ||
| 38 | #define ADC_HW 1 | ||
| 39 | |||
| 40 | |||
| 27 | struct ab8500_gpadc; | 41 | struct ab8500_gpadc; |
| 28 | 42 | ||
| 29 | struct ab8500_gpadc *ab8500_gpadc_get(char *name); | 43 | struct ab8500_gpadc *ab8500_gpadc_get(char *name); |
| 30 | int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel); | 44 | int ab8500_gpadc_sw_hw_convert(struct ab8500_gpadc *gpadc, u8 channel, |
| 31 | int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel); | 45 | u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); |
| 46 | static inline int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel) | ||
| 47 | { | ||
| 48 | return ab8500_gpadc_sw_hw_convert(gpadc, channel, | ||
| 49 | SAMPLE_16, 0, 0, ADC_SW); | ||
| 50 | } | ||
| 51 | |||
| 52 | int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel, | ||
| 53 | u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); | ||
| 32 | int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, | 54 | int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, |
| 33 | u8 channel, int ad_value); | 55 | u8 channel, int ad_value); |
| 34 | 56 | ||
| 35 | #endif /* _AB8500_GPADC_H */ | 57 | #endif /* _AB8500_GPADC_H */ |
