aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Vorontsov <anton.vorontsov@linaro.org>2012-03-13 20:27:20 -0400
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-03-26 12:41:09 -0400
commitd329129e9e10e3089550fd9bd692f67687503136 (patch)
tree5bb28bac5bdaa5b42a518ed6a246697cf5a983c6
parentefd71c89a411d72f1e20d91e34f0779e0e0019b4 (diff)
ab8500_btemp: Get rid of 'enum adc_therm'
This is the same as abx500_adc_therm, but when the former is used, the following warning flood pops up: drivers/power/ab8500_btemp.c: In function 'ab8500_btemp_batctrl_volt_to_res': ab8500_btemp.c:150:25: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare] ab8500_btemp.c: In function 'ab8500_btemp_curr_source_enable': ab8500_btemp.c:212:25: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare] ab8500_btemp.c:244:32: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare] ab8500_btemp.c: In function 'ab8500_btemp_measure_temp': ab8500_btemp.c:462:25: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare] ab8500_btemp.c: In function 'ab8500_btemp_id': ab8500_btemp.c:528:121: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare] ab8500_btemp.c:551:25: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare] This patch fixes the issue by switching the driver to use more namespace-friendly enum. Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
-rw-r--r--drivers/power/ab8500_btemp.c13
-rw-r--r--include/linux/mfd/abx500/ab8500-bm.h15
2 files changed, 9 insertions, 19 deletions
diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c
index 443bc7db30a0..d8bb99394ac0 100644
--- a/drivers/power/ab8500_btemp.c
+++ b/drivers/power/ab8500_btemp.c
@@ -147,7 +147,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
147 return (450000 * (v_batctrl)) / (1800 - v_batctrl); 147 return (450000 * (v_batctrl)) / (1800 - v_batctrl);
148 } 148 }
149 149
150 if (di->bat->adc_therm == ADC_THERM_BATCTRL) { 150 if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL) {
151 /* 151 /*
152 * If the battery has internal NTC, we use the current 152 * If the battery has internal NTC, we use the current
153 * source to calculate the resistance, 7uA or 20uA 153 * source to calculate the resistance, 7uA or 20uA
@@ -209,7 +209,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
209 return 0; 209 return 0;
210 210
211 /* Only do this for batteries with internal NTC */ 211 /* Only do this for batteries with internal NTC */
212 if (di->bat->adc_therm == ADC_THERM_BATCTRL && enable) { 212 if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
213 if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) 213 if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA)
214 curr = BAT_CTRL_7U_ENA; 214 curr = BAT_CTRL_7U_ENA;
215 else 215 else
@@ -241,7 +241,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
241 __func__); 241 __func__);
242 goto disable_curr_source; 242 goto disable_curr_source;
243 } 243 }
244 } else if (di->bat->adc_therm == ADC_THERM_BATCTRL && !enable) { 244 } else if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
245 dev_dbg(di->dev, "Disable BATCTRL curr source\n"); 245 dev_dbg(di->dev, "Disable BATCTRL curr source\n");
246 246
247 /* Write 0 to the curr bits */ 247 /* Write 0 to the curr bits */
@@ -459,7 +459,7 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
459 459
460 id = di->bat->batt_id; 460 id = di->bat->batt_id;
461 461
462 if (di->bat->adc_therm == ADC_THERM_BATCTRL && 462 if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL &&
463 id != BATTERY_UNKNOWN) { 463 id != BATTERY_UNKNOWN) {
464 464
465 rbat = ab8500_btemp_get_batctrl_res(di); 465 rbat = ab8500_btemp_get_batctrl_res(di);
@@ -528,7 +528,7 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
528 dev_dbg(di->dev, "Battery detected on %s" 528 dev_dbg(di->dev, "Battery detected on %s"
529 " low %d < res %d < high: %d" 529 " low %d < res %d < high: %d"
530 " index: %d\n", 530 " index: %d\n",
531 di->bat->adc_therm == ADC_THERM_BATCTRL ? 531 di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL ?
532 "BATCTRL" : "BATTEMP", 532 "BATCTRL" : "BATTEMP",
533 di->bat->bat_type[i].resis_low, res, 533 di->bat->bat_type[i].resis_low, res,
534 di->bat->bat_type[i].resis_high, i); 534 di->bat->bat_type[i].resis_high, i);
@@ -548,7 +548,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
548 * We only have to change current source if the 548 * We only have to change current source if the
549 * detected type is Type 1, else we use the 7uA source 549 * detected type is Type 1, else we use the 7uA source
550 */ 550 */
551 if (di->bat->adc_therm == ADC_THERM_BATCTRL && di->bat->batt_id == 1) { 551 if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL &&
552 di->bat->batt_id == 1) {
552 dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); 553 dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n");
553 di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; 554 di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA;
554 } 555 }
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
index 4b7342c54b41..f61b7b981ce2 100644
--- a/include/linux/mfd/abx500/ab8500-bm.h
+++ b/include/linux/mfd/abx500/ab8500-bm.h
@@ -9,6 +9,7 @@
9#define _AB8500_BM_H 9#define _AB8500_BM_H
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/mfd/abx500.h>
12 13
13/* 14/*
14 * System control 2 register offsets. 15 * System control 2 register offsets.
@@ -231,18 +232,6 @@
231/* Battery type */ 232/* Battery type */
232#define BATTERY_UNKNOWN 00 233#define BATTERY_UNKNOWN 00
233 234
234/*
235 * ADC for the battery thermistor.
236 * When using the ADC_THERM_BATCTRL the battery ID resistor is combined with
237 * a NTC resistor to both identify the battery and to measure its temperature.
238 * Different phone manufactures uses different techniques to both identify the
239 * battery and to read its temperature.
240 */
241enum adc_therm {
242 ADC_THERM_BATCTRL,
243 ADC_THERM_BATTEMP,
244};
245
246/** 235/**
247 * struct res_to_temp - defines one point in a temp to res curve. To 236 * struct res_to_temp - defines one point in a temp to res curve. To
248 * be used in battery packs that combines the identification resistor with a 237 * be used in battery packs that combines the identification resistor with a
@@ -464,7 +453,7 @@ struct ab8500_bm_data {
464 bool no_maintenance; 453 bool no_maintenance;
465 bool chg_unknown_bat; 454 bool chg_unknown_bat;
466 bool enable_overshoot; 455 bool enable_overshoot;
467 enum adc_therm adc_therm; 456 enum abx500_adc_therm adc_therm;
468 int fg_res; 457 int fg_res;
469 int n_btypes; 458 int n_btypes;
470 int batt_id; 459 int batt_id;