提交 20bf4283 编写于 作者: M Michel JAOUEN 提交者: Lee Jones

mfd ab8500-gpadc: Introduce new AB version detection

Add support for AB8505 and AB9540
Signed-off-by: NLee Jones <lee.jones@linaro.org>
Signed-off-by: NMaxime Coquelin <maxime.coquelin@stericsson.com>
Signed-off-by: NBengt Jonsson <bengt.g.jonsson@stericsson.com>
Reviewed-by: NRabin VINCENT <rabin.vincent@stericsson.com>
上级 ddba25f1
...@@ -102,10 +102,10 @@ struct adc_cal_data { ...@@ -102,10 +102,10 @@ struct adc_cal_data {
/** /**
* struct ab8500_gpadc - AB8500 GPADC device information * struct ab8500_gpadc - AB8500 GPADC device information
* @chip_id ABB chip id
* @dev: pointer to the struct device * @dev: pointer to the struct device
* @node: a list of AB8500 GPADCs, hence prepared for * @node: a list of AB8500 GPADCs, hence prepared for
reentrance reentrance
* @parent: pointer to the struct ab8500
* @ab8500_gpadc_complete: pointer to the struct completion, to indicate * @ab8500_gpadc_complete: pointer to the struct completion, to indicate
* the completion of gpadc conversion * the completion of gpadc conversion
* @ab8500_gpadc_lock: structure of type mutex * @ab8500_gpadc_lock: structure of type mutex
...@@ -114,9 +114,9 @@ struct adc_cal_data { ...@@ -114,9 +114,9 @@ struct adc_cal_data {
* @cal_data array of ADC calibration data structs * @cal_data array of ADC calibration data structs
*/ */
struct ab8500_gpadc { struct ab8500_gpadc {
u8 chip_id;
struct device *dev; struct device *dev;
struct list_head node; struct list_head node;
struct ab8500 *parent;
struct completion ab8500_gpadc_complete; struct completion ab8500_gpadc_complete;
struct mutex ab8500_gpadc_lock; struct mutex ab8500_gpadc_lock;
struct regulator *regu; struct regulator *regu;
...@@ -332,7 +332,7 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel) ...@@ -332,7 +332,7 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel)
EN_BUF | EN_ICHAR); EN_BUF | EN_ICHAR);
break; break;
case BTEMP_BALL: case BTEMP_BALL:
if (gpadc->chip_id >= AB8500_CUT3P0) { if (!is_ab8500_2p0_or_earlier(gpadc->parent)) {
/* Turn on btemp pull-up on ABB 3.0 */ /* Turn on btemp pull-up on ABB 3.0 */
ret = abx500_mask_and_set_register_interruptible( ret = abx500_mask_and_set_register_interruptible(
gpadc->dev, gpadc->dev,
...@@ -591,6 +591,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) ...@@ -591,6 +591,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
} }
gpadc->dev = &pdev->dev; gpadc->dev = &pdev->dev;
gpadc->parent = dev_get_drvdata(pdev->dev.parent);
mutex_init(&gpadc->ab8500_gpadc_lock); mutex_init(&gpadc->ab8500_gpadc_lock);
/* Initialize completion used to notify completion of conversion */ /* Initialize completion used to notify completion of conversion */
...@@ -607,14 +608,6 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) ...@@ -607,14 +608,6 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
goto fail; goto fail;
} }
/* Get Chip ID of the ABB ASIC */
ret = abx500_get_chip_id(gpadc->dev);
if (ret < 0) {
dev_err(gpadc->dev, "failed to get chip ID\n");
goto fail_irq;
}
gpadc->chip_id = (u8) ret;
/* VTVout LDO used to power up ab8500-GPADC */ /* VTVout LDO used to power up ab8500-GPADC */
gpadc->regu = regulator_get(&pdev->dev, "vddadc"); gpadc->regu = regulator_get(&pdev->dev, "vddadc");
if (IS_ERR(gpadc->regu)) { if (IS_ERR(gpadc->regu)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册