diff options
| author | Lee Jones <lee.jones@linaro.org> | 2013-02-11 05:38:00 -0500 |
|---|---|---|
| committer | Lee Jones <lee.jones@linaro.org> | 2013-03-06 23:28:21 -0500 |
| commit | e4bffe8d8ad9856143b6e941a17870aee37413d7 (patch) | |
| tree | 591f0b3e5c7c08c14ef1483b810cd2eaa4ccdee4 /include/linux | |
| parent | 75932094601b404fc9ef28f7b6c0aa83dd619af0 (diff) | |
mfd: ab8500-gpadc: Add support for the AB8540
This patch enables the GPADC to work on AB8540 based platforms.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mfd/abx500/ab8500-gpadc.h | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/include/linux/mfd/abx500/ab8500-gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h index 7694e7ab1880..4131437ace4b 100644 --- a/include/linux/mfd/abx500/ab8500-gpadc.h +++ b/include/linux/mfd/abx500/ab8500-gpadc.h | |||
| @@ -12,19 +12,32 @@ | |||
| 12 | 12 | ||
| 13 | /* 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 ) */ | 14 | * and ADCHwSel[4:0] in GPADCCtrl3 ) */ |
| 15 | #define BAT_CTRL 0x01 | 15 | #define BAT_CTRL 0x01 |
| 16 | #define BTEMP_BALL 0x02 | 16 | #define BTEMP_BALL 0x02 |
| 17 | #define MAIN_CHARGER_V 0x03 | 17 | #define MAIN_CHARGER_V 0x03 |
| 18 | #define ACC_DETECT1 0x04 | 18 | #define ACC_DETECT1 0x04 |
| 19 | #define ACC_DETECT2 0x05 | 19 | #define ACC_DETECT2 0x05 |
| 20 | #define ADC_AUX1 0x06 | 20 | #define ADC_AUX1 0x06 |
| 21 | #define ADC_AUX2 0x07 | 21 | #define ADC_AUX2 0x07 |
| 22 | #define MAIN_BAT_V 0x08 | 22 | #define MAIN_BAT_V 0x08 |
| 23 | #define VBUS_V 0x09 | 23 | #define VBUS_V 0x09 |
| 24 | #define MAIN_CHARGER_C 0x0A | 24 | #define MAIN_CHARGER_C 0x0A |
| 25 | #define USB_CHARGER_C 0x0B | 25 | #define USB_CHARGER_C 0x0B |
| 26 | #define BK_BAT_V 0x0C | 26 | #define BK_BAT_V 0x0C |
| 27 | #define DIE_TEMP 0x0D | 27 | #define DIE_TEMP 0x0D |
| 28 | #define USB_ID 0x0E | ||
| 29 | #define XTAL_TEMP 0x12 | ||
| 30 | #define VBAT_TRUE_MEAS 0x13 | ||
| 31 | #define BAT_CTRL_AND_IBAT 0x1C | ||
| 32 | #define VBAT_MEAS_AND_IBAT 0x1D | ||
| 33 | #define VBAT_TRUE_MEAS_AND_IBAT 0x1E | ||
| 34 | #define BAT_TEMP_AND_IBAT 0x1F | ||
| 35 | |||
| 36 | /* Virtual channel used only for ibat convertion to ampere | ||
| 37 | * Battery current conversion (ibat) cannot be requested as a single conversion | ||
| 38 | * but it is always in combination with other input requests | ||
| 39 | */ | ||
| 40 | #define IBAT_VIRTUAL_CHANNEL 0xFF | ||
| 28 | 41 | ||
| 29 | #define SAMPLE_1 1 | 42 | #define SAMPLE_1 1 |
| 30 | #define SAMPLE_4 4 | 43 | #define SAMPLE_4 4 |
| @@ -37,7 +50,6 @@ | |||
| 37 | #define ADC_SW 0 | 50 | #define ADC_SW 0 |
| 38 | #define ADC_HW 1 | 51 | #define ADC_HW 1 |
| 39 | 52 | ||
| 40 | |||
| 41 | struct ab8500_gpadc; | 53 | struct ab8500_gpadc; |
| 42 | 54 | ||
| 43 | struct ab8500_gpadc *ab8500_gpadc_get(char *name); | 55 | struct ab8500_gpadc *ab8500_gpadc_get(char *name); |
| @@ -51,6 +63,9 @@ static inline int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel) | |||
| 51 | 63 | ||
| 52 | int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel, | 64 | int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel, |
| 53 | u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); | 65 | u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); |
| 66 | int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel, | ||
| 67 | u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type, | ||
| 68 | int *ibat); | ||
| 54 | int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, | 69 | int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, |
| 55 | u8 channel, int ad_value); | 70 | u8 channel, int ad_value); |
| 56 | 71 | ||
