Commit d329129e authored by Anton Vorontsov's avatar Anton Vorontsov

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: default avatarAnton Vorontsov <anton.vorontsov@linaro.org>
parent efd71c89
...@@ -147,7 +147,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di, ...@@ -147,7 +147,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
return (450000 * (v_batctrl)) / (1800 - v_batctrl); return (450000 * (v_batctrl)) / (1800 - v_batctrl);
} }
if (di->bat->adc_therm == ADC_THERM_BATCTRL) { if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL) {
/* /*
* If the battery has internal NTC, we use the current * If the battery has internal NTC, we use the current
* source to calculate the resistance, 7uA or 20uA * source to calculate the resistance, 7uA or 20uA
...@@ -209,7 +209,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, ...@@ -209,7 +209,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
return 0; return 0;
/* Only do this for batteries with internal NTC */ /* Only do this for batteries with internal NTC */
if (di->bat->adc_therm == ADC_THERM_BATCTRL && enable) { if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA)
curr = BAT_CTRL_7U_ENA; curr = BAT_CTRL_7U_ENA;
else else
...@@ -241,7 +241,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, ...@@ -241,7 +241,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
__func__); __func__);
goto disable_curr_source; goto disable_curr_source;
} }
} else if (di->bat->adc_therm == ADC_THERM_BATCTRL && !enable) { } else if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
dev_dbg(di->dev, "Disable BATCTRL curr source\n"); dev_dbg(di->dev, "Disable BATCTRL curr source\n");
/* Write 0 to the curr bits */ /* Write 0 to the curr bits */
...@@ -459,7 +459,7 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di) ...@@ -459,7 +459,7 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
id = di->bat->batt_id; id = di->bat->batt_id;
if (di->bat->adc_therm == ADC_THERM_BATCTRL && if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL &&
id != BATTERY_UNKNOWN) { id != BATTERY_UNKNOWN) {
rbat = ab8500_btemp_get_batctrl_res(di); rbat = ab8500_btemp_get_batctrl_res(di);
...@@ -528,7 +528,7 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) ...@@ -528,7 +528,7 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
dev_dbg(di->dev, "Battery detected on %s" dev_dbg(di->dev, "Battery detected on %s"
" low %d < res %d < high: %d" " low %d < res %d < high: %d"
" index: %d\n", " index: %d\n",
di->bat->adc_therm == ADC_THERM_BATCTRL ? di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL ?
"BATCTRL" : "BATTEMP", "BATCTRL" : "BATTEMP",
di->bat->bat_type[i].resis_low, res, di->bat->bat_type[i].resis_low, res,
di->bat->bat_type[i].resis_high, i); di->bat->bat_type[i].resis_high, i);
...@@ -548,7 +548,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) ...@@ -548,7 +548,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
* We only have to change current source if the * We only have to change current source if the
* detected type is Type 1, else we use the 7uA source * detected type is Type 1, else we use the 7uA source
*/ */
if (di->bat->adc_therm == ADC_THERM_BATCTRL && di->bat->batt_id == 1) { if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL &&
di->bat->batt_id == 1) {
dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n");
di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#define _AB8500_BM_H #define _AB8500_BM_H
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mfd/abx500.h>
/* /*
* System control 2 register offsets. * System control 2 register offsets.
...@@ -231,18 +232,6 @@ ...@@ -231,18 +232,6 @@
/* Battery type */ /* Battery type */
#define BATTERY_UNKNOWN 00 #define BATTERY_UNKNOWN 00
/*
* ADC for the battery thermistor.
* When using the ADC_THERM_BATCTRL the battery ID resistor is combined with
* a NTC resistor to both identify the battery and to measure its temperature.
* Different phone manufactures uses different techniques to both identify the
* battery and to read its temperature.
*/
enum adc_therm {
ADC_THERM_BATCTRL,
ADC_THERM_BATTEMP,
};
/** /**
* struct res_to_temp - defines one point in a temp to res curve. To * struct res_to_temp - defines one point in a temp to res curve. To
* be used in battery packs that combines the identification resistor with a * be used in battery packs that combines the identification resistor with a
...@@ -464,7 +453,7 @@ struct ab8500_bm_data { ...@@ -464,7 +453,7 @@ struct ab8500_bm_data {
bool no_maintenance; bool no_maintenance;
bool chg_unknown_bat; bool chg_unknown_bat;
bool enable_overshoot; bool enable_overshoot;
enum adc_therm adc_therm; enum abx500_adc_therm adc_therm;
int fg_res; int fg_res;
int n_btypes; int n_btypes;
int batt_id; int batt_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment