diff options
author | Michel JAOUEN <michel.jaouen@stericsson.com> | 2012-02-09 06:06:47 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-02-04 03:31:49 -0500 |
commit | 20bf428329400d3c71be3bdaaa265a485902f90b (patch) | |
tree | 5b912fe947285c93a176296ac7370f6f0647e811 /drivers/mfd/ab8500-gpadc.c | |
parent | ddba25f17dc7015f44fbcdf79ce72f69996f2be3 (diff) |
mfd ab8500-gpadc: Introduce new AB version detection
Add support for AB8505 and AB9540
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Maxime Coquelin <maxime.coquelin@stericsson.com>
Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com>
Diffstat (limited to 'drivers/mfd/ab8500-gpadc.c')
-rw-r--r-- | drivers/mfd/ab8500-gpadc.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index bc0daf3bc93a..61b176fc457b 100644 --- a/drivers/mfd/ab8500-gpadc.c +++ b/drivers/mfd/ab8500-gpadc.c | |||
@@ -102,10 +102,10 @@ struct adc_cal_data { | |||
102 | 102 | ||
103 | /** | 103 | /** |
104 | * struct ab8500_gpadc - AB8500 GPADC device information | 104 | * struct ab8500_gpadc - AB8500 GPADC device information |
105 | * @chip_id ABB chip id | ||
106 | * @dev: pointer to the struct device | 105 | * @dev: pointer to the struct device |
107 | * @node: a list of AB8500 GPADCs, hence prepared for | 106 | * @node: a list of AB8500 GPADCs, hence prepared for |
108 | reentrance | 107 | reentrance |
108 | * @parent: pointer to the struct ab8500 | ||
109 | * @ab8500_gpadc_complete: pointer to the struct completion, to indicate | 109 | * @ab8500_gpadc_complete: pointer to the struct completion, to indicate |
110 | * the completion of gpadc conversion | 110 | * the completion of gpadc conversion |
111 | * @ab8500_gpadc_lock: structure of type mutex | 111 | * @ab8500_gpadc_lock: structure of type mutex |
@@ -114,9 +114,9 @@ struct adc_cal_data { | |||
114 | * @cal_data array of ADC calibration data structs | 114 | * @cal_data array of ADC calibration data structs |
115 | */ | 115 | */ |
116 | struct ab8500_gpadc { | 116 | struct ab8500_gpadc { |
117 | u8 chip_id; | ||
118 | struct device *dev; | 117 | struct device *dev; |
119 | struct list_head node; | 118 | struct list_head node; |
119 | struct ab8500 *parent; | ||
120 | struct completion ab8500_gpadc_complete; | 120 | struct completion ab8500_gpadc_complete; |
121 | struct mutex ab8500_gpadc_lock; | 121 | struct mutex ab8500_gpadc_lock; |
122 | struct regulator *regu; | 122 | struct regulator *regu; |
@@ -332,7 +332,7 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel) | |||
332 | EN_BUF | EN_ICHAR); | 332 | EN_BUF | EN_ICHAR); |
333 | break; | 333 | break; |
334 | case BTEMP_BALL: | 334 | case BTEMP_BALL: |
335 | if (gpadc->chip_id >= AB8500_CUT3P0) { | 335 | if (!is_ab8500_2p0_or_earlier(gpadc->parent)) { |
336 | /* Turn on btemp pull-up on ABB 3.0 */ | 336 | /* Turn on btemp pull-up on ABB 3.0 */ |
337 | ret = abx500_mask_and_set_register_interruptible( | 337 | ret = abx500_mask_and_set_register_interruptible( |
338 | gpadc->dev, | 338 | gpadc->dev, |
@@ -591,6 +591,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
591 | } | 591 | } |
592 | 592 | ||
593 | gpadc->dev = &pdev->dev; | 593 | gpadc->dev = &pdev->dev; |
594 | gpadc->parent = dev_get_drvdata(pdev->dev.parent); | ||
594 | mutex_init(&gpadc->ab8500_gpadc_lock); | 595 | mutex_init(&gpadc->ab8500_gpadc_lock); |
595 | 596 | ||
596 | /* Initialize completion used to notify completion of conversion */ | 597 | /* Initialize completion used to notify completion of conversion */ |
@@ -607,14 +608,6 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
607 | goto fail; | 608 | goto fail; |
608 | } | 609 | } |
609 | 610 | ||
610 | /* Get Chip ID of the ABB ASIC */ | ||
611 | ret = abx500_get_chip_id(gpadc->dev); | ||
612 | if (ret < 0) { | ||
613 | dev_err(gpadc->dev, "failed to get chip ID\n"); | ||
614 | goto fail_irq; | ||
615 | } | ||
616 | gpadc->chip_id = (u8) ret; | ||
617 | |||
618 | /* VTVout LDO used to power up ab8500-GPADC */ | 611 | /* VTVout LDO used to power up ab8500-GPADC */ |
619 | gpadc->regu = regulator_get(&pdev->dev, "vddadc"); | 612 | gpadc->regu = regulator_get(&pdev->dev, "vddadc"); |
620 | if (IS_ERR(gpadc->regu)) { | 613 | if (IS_ERR(gpadc->regu)) { |