提交 43dc4470 编写于 作者: L Lee Jones

ab8500_btemp: Fix crazy tabbing implementation

Simple patch to rectify incorrect tabbing. Also adds some
coding style clean-ups to make it easier to read.
Signed-off-by: NLee Jones <lee.jones@linaro.org>
上级 f6271b4f
...@@ -182,206 +182,206 @@ static struct batres_vs_temp temp_to_batres_tbl_9100[] = { ...@@ -182,206 +182,206 @@ static struct batres_vs_temp temp_to_batres_tbl_9100[] = {
}; };
static struct abx500_battery_type bat_type_thermistor[] = { static struct abx500_battery_type bat_type_thermistor[] = {
[BATTERY_UNKNOWN] = { [BATTERY_UNKNOWN] = {
/* First element always represent the UNKNOWN battery */ /* First element always represent the UNKNOWN battery */
.name = POWER_SUPPLY_TECHNOLOGY_UNKNOWN, .name = POWER_SUPPLY_TECHNOLOGY_UNKNOWN,
.resis_high = 0, .resis_high = 0,
.resis_low = 0, .resis_low = 0,
.battery_resistance = 300, .battery_resistance = 300,
.charge_full_design = 612, .charge_full_design = 612,
.nominal_voltage = 3700, .nominal_voltage = 3700,
.termination_vol = 4050, .termination_vol = 4050,
.termination_curr = 200, .termination_curr = 200,
.recharge_vol = 3990, .recharge_vol = 3990,
.normal_cur_lvl = 400, .normal_cur_lvl = 400,
.normal_vol_lvl = 4100, .normal_vol_lvl = 4100,
.maint_a_cur_lvl = 400, .maint_a_cur_lvl = 400,
.maint_a_vol_lvl = 4050, .maint_a_vol_lvl = 4050,
.maint_a_chg_timer_h = 60, .maint_a_chg_timer_h = 60,
.maint_b_cur_lvl = 400, .maint_b_cur_lvl = 400,
.maint_b_vol_lvl = 4000, .maint_b_vol_lvl = 4000,
.maint_b_chg_timer_h = 200, .maint_b_chg_timer_h = 200,
.low_high_cur_lvl = 300, .low_high_cur_lvl = 300,
.low_high_vol_lvl = 4000, .low_high_vol_lvl = 4000,
.n_temp_tbl_elements = ARRAY_SIZE(temp_tbl), .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl),
.r_to_t_tbl = temp_tbl, .r_to_t_tbl = temp_tbl,
.n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl), .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl),
.v_to_cap_tbl = cap_tbl, .v_to_cap_tbl = cap_tbl,
.n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor),
.batres_tbl = temp_to_batres_tbl_thermistor, .batres_tbl = temp_to_batres_tbl_thermistor,
}, },
{ {
.name = POWER_SUPPLY_TECHNOLOGY_LIPO, .name = POWER_SUPPLY_TECHNOLOGY_LIPO,
.resis_high = 53407, .resis_high = 53407,
.resis_low = 12500, .resis_low = 12500,
.battery_resistance = 300, .battery_resistance = 300,
.charge_full_design = 900, .charge_full_design = 900,
.nominal_voltage = 3600, .nominal_voltage = 3600,
.termination_vol = 4150, .termination_vol = 4150,
.termination_curr = 80, .termination_curr = 80,
.recharge_vol = 4130, .recharge_vol = 4130,
.normal_cur_lvl = 700, .normal_cur_lvl = 700,
.normal_vol_lvl = 4200, .normal_vol_lvl = 4200,
.maint_a_cur_lvl = 600, .maint_a_cur_lvl = 600,
.maint_a_vol_lvl = 4150, .maint_a_vol_lvl = 4150,
.maint_a_chg_timer_h = 60, .maint_a_chg_timer_h = 60,
.maint_b_cur_lvl = 600, .maint_b_cur_lvl = 600,
.maint_b_vol_lvl = 4100, .maint_b_vol_lvl = 4100,
.maint_b_chg_timer_h = 200, .maint_b_chg_timer_h = 200,
.low_high_cur_lvl = 300, .low_high_cur_lvl = 300,
.low_high_vol_lvl = 4000, .low_high_vol_lvl = 4000,
.n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_A_thermistor), .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_A_thermistor),
.r_to_t_tbl = temp_tbl_A_thermistor, .r_to_t_tbl = temp_tbl_A_thermistor,
.n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_A_thermistor), .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_A_thermistor),
.v_to_cap_tbl = cap_tbl_A_thermistor, .v_to_cap_tbl = cap_tbl_A_thermistor,
.n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor),
.batres_tbl = temp_to_batres_tbl_thermistor, .batres_tbl = temp_to_batres_tbl_thermistor,
}, },
{ {
.name = POWER_SUPPLY_TECHNOLOGY_LIPO, .name = POWER_SUPPLY_TECHNOLOGY_LIPO,
.resis_high = 200000, .resis_high = 200000,
.resis_low = 82869, .resis_low = 82869,
.battery_resistance = 300, .battery_resistance = 300,
.charge_full_design = 900, .charge_full_design = 900,
.nominal_voltage = 3600, .nominal_voltage = 3600,
.termination_vol = 4150, .termination_vol = 4150,
.termination_curr = 80, .termination_curr = 80,
.recharge_vol = 4130, .recharge_vol = 4130,
.normal_cur_lvl = 700, .normal_cur_lvl = 700,
.normal_vol_lvl = 4200, .normal_vol_lvl = 4200,
.maint_a_cur_lvl = 600, .maint_a_cur_lvl = 600,
.maint_a_vol_lvl = 4150, .maint_a_vol_lvl = 4150,
.maint_a_chg_timer_h = 60, .maint_a_chg_timer_h = 60,
.maint_b_cur_lvl = 600, .maint_b_cur_lvl = 600,
.maint_b_vol_lvl = 4100, .maint_b_vol_lvl = 4100,
.maint_b_chg_timer_h = 200, .maint_b_chg_timer_h = 200,
.low_high_cur_lvl = 300, .low_high_cur_lvl = 300,
.low_high_vol_lvl = 4000, .low_high_vol_lvl = 4000,
.n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_B_thermistor), .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl_B_thermistor),
.r_to_t_tbl = temp_tbl_B_thermistor, .r_to_t_tbl = temp_tbl_B_thermistor,
.n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_B_thermistor), .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl_B_thermistor),
.v_to_cap_tbl = cap_tbl_B_thermistor, .v_to_cap_tbl = cap_tbl_B_thermistor,
.n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor),
.batres_tbl = temp_to_batres_tbl_thermistor, .batres_tbl = temp_to_batres_tbl_thermistor,
}, },
}; };
static struct abx500_battery_type bat_type_ext_thermistor[] = { static struct abx500_battery_type bat_type_ext_thermistor[] = {
[BATTERY_UNKNOWN] = { [BATTERY_UNKNOWN] = {
/* First element always represent the UNKNOWN battery */ /* First element always represent the UNKNOWN battery */
.name = POWER_SUPPLY_TECHNOLOGY_UNKNOWN, .name = POWER_SUPPLY_TECHNOLOGY_UNKNOWN,
.resis_high = 0, .resis_high = 0,
.resis_low = 0, .resis_low = 0,
.battery_resistance = 300, .battery_resistance = 300,
.charge_full_design = 612, .charge_full_design = 612,
.nominal_voltage = 3700, .nominal_voltage = 3700,
.termination_vol = 4050, .termination_vol = 4050,
.termination_curr = 200, .termination_curr = 200,
.recharge_vol = 3990, .recharge_vol = 3990,
.normal_cur_lvl = 400, .normal_cur_lvl = 400,
.normal_vol_lvl = 4100, .normal_vol_lvl = 4100,
.maint_a_cur_lvl = 400, .maint_a_cur_lvl = 400,
.maint_a_vol_lvl = 4050, .maint_a_vol_lvl = 4050,
.maint_a_chg_timer_h = 60, .maint_a_chg_timer_h = 60,
.maint_b_cur_lvl = 400, .maint_b_cur_lvl = 400,
.maint_b_vol_lvl = 4000, .maint_b_vol_lvl = 4000,
.maint_b_chg_timer_h = 200, .maint_b_chg_timer_h = 200,
.low_high_cur_lvl = 300, .low_high_cur_lvl = 300,
.low_high_vol_lvl = 4000, .low_high_vol_lvl = 4000,
.n_temp_tbl_elements = ARRAY_SIZE(temp_tbl), .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl),
.r_to_t_tbl = temp_tbl, .r_to_t_tbl = temp_tbl,
.n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl), .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl),
.v_to_cap_tbl = cap_tbl, .v_to_cap_tbl = cap_tbl,
.n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor),
.batres_tbl = temp_to_batres_tbl_thermistor, .batres_tbl = temp_to_batres_tbl_thermistor,
}, },
/* /*
* These are the batteries that doesn't have an internal NTC resistor to measure * These are the batteries that doesn't have an internal NTC resistor to measure
* its temperature. The temperature in this case is measure with a NTC placed * its temperature. The temperature in this case is measure with a NTC placed
* near the battery but on the PCB. * near the battery but on the PCB.
*/ */
{ {
.name = POWER_SUPPLY_TECHNOLOGY_LIPO, .name = POWER_SUPPLY_TECHNOLOGY_LIPO,
.resis_high = 76000, .resis_high = 76000,
.resis_low = 53000, .resis_low = 53000,
.battery_resistance = 300, .battery_resistance = 300,
.charge_full_design = 900, .charge_full_design = 900,
.nominal_voltage = 3700, .nominal_voltage = 3700,
.termination_vol = 4150, .termination_vol = 4150,
.termination_curr = 100, .termination_curr = 100,
.recharge_vol = 4130, .recharge_vol = 4130,
.normal_cur_lvl = 700, .normal_cur_lvl = 700,
.normal_vol_lvl = 4200, .normal_vol_lvl = 4200,
.maint_a_cur_lvl = 600, .maint_a_cur_lvl = 600,
.maint_a_vol_lvl = 4150, .maint_a_vol_lvl = 4150,
.maint_a_chg_timer_h = 60, .maint_a_chg_timer_h = 60,
.maint_b_cur_lvl = 600, .maint_b_cur_lvl = 600,
.maint_b_vol_lvl = 4100, .maint_b_vol_lvl = 4100,
.maint_b_chg_timer_h = 200, .maint_b_chg_timer_h = 200,
.low_high_cur_lvl = 300, .low_high_cur_lvl = 300,
.low_high_vol_lvl = 4000, .low_high_vol_lvl = 4000,
.n_temp_tbl_elements = ARRAY_SIZE(temp_tbl), .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl),
.r_to_t_tbl = temp_tbl, .r_to_t_tbl = temp_tbl,
.n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl), .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl),
.v_to_cap_tbl = cap_tbl, .v_to_cap_tbl = cap_tbl,
.n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor),
.batres_tbl = temp_to_batres_tbl_thermistor, .batres_tbl = temp_to_batres_tbl_thermistor,
}, },
{ {
.name = POWER_SUPPLY_TECHNOLOGY_LION, .name = POWER_SUPPLY_TECHNOLOGY_LION,
.resis_high = 30000, .resis_high = 30000,
.resis_low = 10000, .resis_low = 10000,
.battery_resistance = 300, .battery_resistance = 300,
.charge_full_design = 950, .charge_full_design = 950,
.nominal_voltage = 3700, .nominal_voltage = 3700,
.termination_vol = 4150, .termination_vol = 4150,
.termination_curr = 100, .termination_curr = 100,
.recharge_vol = 4130, .recharge_vol = 4130,
.normal_cur_lvl = 700, .normal_cur_lvl = 700,
.normal_vol_lvl = 4200, .normal_vol_lvl = 4200,
.maint_a_cur_lvl = 600, .maint_a_cur_lvl = 600,
.maint_a_vol_lvl = 4150, .maint_a_vol_lvl = 4150,
.maint_a_chg_timer_h = 60, .maint_a_chg_timer_h = 60,
.maint_b_cur_lvl = 600, .maint_b_cur_lvl = 600,
.maint_b_vol_lvl = 4100, .maint_b_vol_lvl = 4100,
.maint_b_chg_timer_h = 200, .maint_b_chg_timer_h = 200,
.low_high_cur_lvl = 300, .low_high_cur_lvl = 300,
.low_high_vol_lvl = 4000, .low_high_vol_lvl = 4000,
.n_temp_tbl_elements = ARRAY_SIZE(temp_tbl), .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl),
.r_to_t_tbl = temp_tbl, .r_to_t_tbl = temp_tbl,
.n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl), .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl),
.v_to_cap_tbl = cap_tbl, .v_to_cap_tbl = cap_tbl,
.n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor),
.batres_tbl = temp_to_batres_tbl_thermistor, .batres_tbl = temp_to_batres_tbl_thermistor,
}, },
{ {
.name = POWER_SUPPLY_TECHNOLOGY_LION, .name = POWER_SUPPLY_TECHNOLOGY_LION,
.resis_high = 95000, .resis_high = 95000,
.resis_low = 76001, .resis_low = 76001,
.battery_resistance = 300, .battery_resistance = 300,
.charge_full_design = 950, .charge_full_design = 950,
.nominal_voltage = 3700, .nominal_voltage = 3700,
.termination_vol = 4150, .termination_vol = 4150,
.termination_curr = 100, .termination_curr = 100,
.recharge_vol = 4130, .recharge_vol = 4130,
.normal_cur_lvl = 700, .normal_cur_lvl = 700,
.normal_vol_lvl = 4200, .normal_vol_lvl = 4200,
.maint_a_cur_lvl = 600, .maint_a_cur_lvl = 600,
.maint_a_vol_lvl = 4150, .maint_a_vol_lvl = 4150,
.maint_a_chg_timer_h = 60, .maint_a_chg_timer_h = 60,
.maint_b_cur_lvl = 600, .maint_b_cur_lvl = 600,
.maint_b_vol_lvl = 4100, .maint_b_vol_lvl = 4100,
.maint_b_chg_timer_h = 200, .maint_b_chg_timer_h = 200,
.low_high_cur_lvl = 300, .low_high_cur_lvl = 300,
.low_high_vol_lvl = 4000, .low_high_vol_lvl = 4000,
.n_temp_tbl_elements = ARRAY_SIZE(temp_tbl), .n_temp_tbl_elements = ARRAY_SIZE(temp_tbl),
.r_to_t_tbl = temp_tbl, .r_to_t_tbl = temp_tbl,
.n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl), .n_v_cap_tbl_elements = ARRAY_SIZE(cap_tbl),
.v_to_cap_tbl = cap_tbl, .v_to_cap_tbl = cap_tbl,
.n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor), .n_batres_tbl_elements = ARRAY_SIZE(temp_to_batres_tbl_thermistor),
.batres_tbl = temp_to_batres_tbl_thermistor, .batres_tbl = temp_to_batres_tbl_thermistor,
}, },
}; };
static const struct abx500_bm_capacity_levels cap_levels = { static const struct abx500_bm_capacity_levels cap_levels = {
...@@ -424,42 +424,41 @@ static const struct abx500_bm_charger_parameters chg = { ...@@ -424,42 +424,41 @@ static const struct abx500_bm_charger_parameters chg = {
}; };
struct abx500_bm_data ab8500_bm_data = { struct abx500_bm_data ab8500_bm_data = {
.temp_under = 3, .temp_under = 3,
.temp_low = 8, .temp_low = 8,
.temp_high = 43, .temp_high = 43,
.temp_over = 48, .temp_over = 48,
.main_safety_tmr_h = 4, .main_safety_tmr_h = 4,
.temp_interval_chg = 20, .temp_interval_chg = 20,
.temp_interval_nochg = 120, .temp_interval_nochg = 120,
.usb_safety_tmr_h = 4, .usb_safety_tmr_h = 4,
.bkup_bat_v = BUP_VCH_SEL_2P6V, .bkup_bat_v = BUP_VCH_SEL_2P6V,
.bkup_bat_i = BUP_ICH_SEL_150UA, .bkup_bat_i = BUP_ICH_SEL_150UA,
.no_maintenance = false, .no_maintenance = false,
.adc_therm = ABx500_ADC_THERM_BATCTRL, .adc_therm = ABx500_ADC_THERM_BATCTRL,
.chg_unknown_bat = false, .chg_unknown_bat = false,
.enable_overshoot = false, .enable_overshoot = false,
.fg_res = 100, .fg_res = 100,
.cap_levels = &cap_levels, .cap_levels = &cap_levels,
.bat_type = bat_type_thermistor, .bat_type = bat_type_thermistor,
.n_btypes = 3, .n_btypes = 3,
.batt_id = 0, .batt_id = 0,
.interval_charging = 5, .interval_charging = 5,
.interval_not_charging = 120, .interval_not_charging = 120,
.temp_hysteresis = 3, .temp_hysteresis = 3,
.gnd_lift_resistance = 34, .gnd_lift_resistance = 34,
.maxi = &maxi_params, .maxi = &maxi_params,
.chg_params = &chg, .chg_params = &chg,
.fg_params = &fg, .fg_params = &fg,
}; };
int __devinit int __devinit bmdevs_of_probe(struct device *dev,
bmdevs_of_probe(struct device *dev, struct device_node *np,
struct device_node *np, struct abx500_bm_data **battery)
struct abx500_bm_data **battery)
{ {
struct abx500_battery_type *btype; struct abx500_battery_type *btype;
struct device_node *np_bat_supply; struct device_node *np_bat_supply;
struct abx500_bm_data *bat; struct abx500_bm_data *bat;
const char *btech; const char *btech;
int i, thermistor; int i, thermistor;
...@@ -471,8 +470,8 @@ bmdevs_of_probe(struct device *dev, ...@@ -471,8 +470,8 @@ bmdevs_of_probe(struct device *dev,
dev_err(dev, "missing property battery\n"); dev_err(dev, "missing property battery\n");
return -EINVAL; return -EINVAL;
} }
if (of_property_read_bool(np_bat_supply,
"thermistor-on-batctrl")) if (of_property_read_bool(np_bat_supply, "thermistor-on-batctrl"))
thermistor = NTC_INTERNAL; thermistor = NTC_INTERNAL;
else else
thermistor = NTC_EXTERNAL; thermistor = NTC_EXTERNAL;
...@@ -483,8 +482,8 @@ bmdevs_of_probe(struct device *dev, ...@@ -483,8 +482,8 @@ bmdevs_of_probe(struct device *dev,
bat->bat_type = bat_type_ext_thermistor; bat->bat_type = bat_type_ext_thermistor;
bat->adc_therm = ABx500_ADC_THERM_BATTEMP; bat->adc_therm = ABx500_ADC_THERM_BATTEMP;
} }
btech = of_get_property(np_bat_supply,
"stericsson,battery-type", NULL); btech = of_get_property(np_bat_supply, "stericsson,battery-type", NULL);
if (!btech) { if (!btech) {
dev_warn(dev, "missing property battery-name/type\n"); dev_warn(dev, "missing property battery-name/type\n");
return -EINVAL; return -EINVAL;
...@@ -498,6 +497,7 @@ bmdevs_of_probe(struct device *dev, ...@@ -498,6 +497,7 @@ bmdevs_of_probe(struct device *dev,
bat->bat_type[BATTERY_UNKNOWN].normal_cur_lvl = 520; bat->bat_type[BATTERY_UNKNOWN].normal_cur_lvl = 520;
bat->bat_type[BATTERY_UNKNOWN].normal_vol_lvl = 4200; bat->bat_type[BATTERY_UNKNOWN].normal_vol_lvl = 4200;
} }
/* select the battery resolution table */ /* select the battery resolution table */
for (i = 0; i < bat->n_btypes; ++i) { for (i = 0; i < bat->n_btypes; ++i) {
btype = (bat->bat_type + i); btype = (bat->bat_type + i);
...@@ -513,5 +513,6 @@ bmdevs_of_probe(struct device *dev, ...@@ -513,5 +513,6 @@ bmdevs_of_probe(struct device *dev,
} }
} }
of_node_put(np_bat_supply); of_node_put(np_bat_supply);
return 0; return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册