aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Willerud <daniel.willerud@stericsson.com>2011-02-16 09:42:28 +0100
committerHenrik Öhman <henrik.ohman@stericsson.com>2011-03-10 15:44:02 +0100
commit89843b5fe704a8892192ff8a41544c7ebeefa638 (patch)
tree80c9fc00c4fe9741990c8fe697384ae73595bedb /include
parent2e784adcf79fb6495a0357cba5a2eeee95098b8b (diff)
MFD: ab8500-gpadc: New ab8500_gpadc API
Added ab8500_gpadc_get() API, moved gpadc and calibration structs and channel enums. Clients utilizing the new API. ST-Ericsson ID: ER281133 ST-Ericsson FOSS-OUT ID: Trivial Signed-off-by: Daniel Willerud <daniel.willerud@stericsson.com> Change-Id: Ief442b47ed3315d62a8b887d49bf03f9b6502e3b Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/16125 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mfd/ab8500.h3
-rw-r--r--include/linux/mfd/ab8500/ab8500-gpadc.h48
2 files changed, 7 insertions, 44 deletions
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
index 7d1e8eb69e4..963181cbb92 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/ab8500.h
@@ -139,7 +139,6 @@
#define AB8500_NUM_IRQ_REGS 14
/* Forward declaration */
-struct ab8500_gpadc;
struct ab8500_charger;
/**
@@ -155,7 +154,6 @@ struct ab8500_charger;
* @tx_buf: tx buf for SPI
* @mask: cache of IRQ regs for bus lock
* @oldmask: cache of previous IRQ regs for bus lock
- * @gpadc: pointer to the ab8500 gpadc device information.
* @charger: pointer to the charger driver device information.
*/
struct ab8500 {
@@ -175,7 +173,6 @@ struct ab8500 {
u8 mask[AB8500_NUM_IRQ_REGS];
u8 oldmask[AB8500_NUM_IRQ_REGS];
- struct ab8500_gpadc *gpadc;
struct ab8500_charger *charger;
};
diff --git a/include/linux/mfd/ab8500/ab8500-gpadc.h b/include/linux/mfd/ab8500/ab8500-gpadc.h
index 1f56e8bdf74..cfec103d14d 100644
--- a/include/linux/mfd/ab8500/ab8500-gpadc.h
+++ b/include/linux/mfd/ab8500/ab8500-gpadc.h
@@ -3,6 +3,7 @@
* Licensed under GPLv2.
*
* Author: Arun R Murthy <arun.murthy@stericsson.com>
+ * Author: Daniel Willerud <daniel.willerud@stericsson.com>
*/
#ifndef _AB8500_GPADC_H
@@ -10,57 +11,22 @@
/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */
#define BAT_CTRL 0x01
+#define BTEMP_BALL 0x02
+#define MAIN_CHARGER_V 0x03
#define ACC_DETECT1 0x04
#define ACC_DETECT2 0x05
#define ADC_AUX1 0x06
#define ADC_AUX2 0x07
#define MAIN_BAT_V 0x08
-#define BK_BAT_V 0x0C
#define VBUS_V 0x09
-#define MAIN_CHARGER_V 0x03
#define MAIN_CHARGER_C 0x0A
#define USB_CHARGER_C 0x0B
+#define BK_BAT_V 0x0C
#define DIE_TEMP 0x0D
-#define BTEMP_BALL 0x02
-
-enum cal_channels {
- ADC_INPUT_VMAIN = 0,
- ADC_INPUT_BTEMP,
- ADC_INPUT_VBAT,
- NBR_CAL_INPUTS,
-};
-/**
- * struct adc_cal_data - Table for storing gain and offset for the calibrated
- * ADC channels
- * @gain: Gain of the ADC channel
- * @offset: Offset of the ADC channel
- */
-struct adc_cal_data {
- u64 gain;
- u64 offset;
-};
-
-/**
- * struct ab8500_gpadc - ab8500 GPADC device information
- * @dev: pointer to the struct device
- * @parent: pointer to the parent device structure ab8500
- * @ab8500_gpadc_complete: pointer to the struct completion, to indicate
- * the completion of gpadc conversion
- * @ab8500_gpadc_lock: structure of type mutex
- * @regu: pointer to the struct regulator
- * @irq: interrupt number that is used by gpadc
- */
-struct ab8500_gpadc {
- struct device *dev;
- struct ab8500 *parent;
- struct completion ab8500_gpadc_complete;
- struct mutex ab8500_gpadc_lock;
- struct regulator *regu;
- int irq;
- struct adc_cal_data cal_data[NBR_CAL_INPUTS];
-};
+struct ab8500_gpadc;
-int ab8500_gpadc_convert(struct ab8500_gpadc *di, u8 input);
+struct ab8500_gpadc *ab8500_gpadc_get(void);
+int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 input);
#endif /* _AB8500_GPADC_H */