Commit 83e5aa77 authored by Linus Walleij's avatar Linus Walleij Committed by Sebastian Reichel

power: supply: ab8500: Standardize CC current

The current used in the constant current phase of the charging
exist in struct power_supply_battery_info as
constant_charge_current_max_ua.

Switch the custom property max_out_curr to this and
consequentally change everything that relates to this value
over to using microamperes rather than milliamperes so
we align internal representation of current with the
power core. Prefix every variable we change with *_ua
to indicate the unit everywhere but also to make sure
we do not miss any outlier.

Drop some duplicate unused defines in a header.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 1091ed7d
...@@ -160,13 +160,6 @@ ...@@ -160,13 +160,6 @@
#define BTEMP_HIGH_TH_57_1 0x02 #define BTEMP_HIGH_TH_57_1 0x02
#define BTEMP_HIGH_TH_62 0x03 #define BTEMP_HIGH_TH_62 0x03
/* current is mA */
#define USB_0P1A 100
#define USB_0P2A 200
#define USB_0P3A 300
#define USB_0P4A 400
#define USB_0P5A 500
#define LOW_BAT_3P1V 0x20 #define LOW_BAT_3P1V 0x20
#define LOW_BAT_2P3V 0x00 #define LOW_BAT_2P3V 0x00
#define LOW_BAT_RESET 0x01 #define LOW_BAT_RESET 0x01
...@@ -359,22 +352,21 @@ struct ab8500_fg_parameters { ...@@ -359,22 +352,21 @@ struct ab8500_fg_parameters {
/** /**
* struct ab8500_charger_maximization - struct used by the board config. * struct ab8500_charger_maximization - struct used by the board config.
* @use_maxi: Enable maximization for this battery type * @use_maxi: Enable maximization for this battery type
* @maxi_chg_curr: Maximum charger current allowed * @maxi_chg_curr_ua: Maximum charger current allowed in microampere
* @maxi_wait_cycles: cycles to wait before setting charger current * @maxi_wait_cycles: cycles to wait before setting charger current
* @charger_curr_step delta between two charger current settings (mA) * @charger_curr_step_ua: delta between two charger current settings (uA)
*/ */
struct ab8500_maxim_parameters { struct ab8500_maxim_parameters {
bool ena_maxi; bool ena_maxi;
int chg_curr; int chg_curr_ua;
int wait_cycles; int wait_cycles;
int charger_curr_step; int charger_curr_step_ua;
}; };
/** /**
* struct ab8500_battery_type - different batteries supported * struct ab8500_battery_type - different batteries supported
* @resis_high: battery upper resistance limit * @resis_high: battery upper resistance limit
* @resis_low: battery lower resistance limit * @resis_low: battery lower resistance limit
* @normal_cur_lvl: charger current in normal state in mA
* @normal_vol_lvl: charger voltage in normal state in mV * @normal_vol_lvl: charger voltage in normal state in mV
* @maint_a_cur_lvl: charger current in maintenance A state in mA * @maint_a_cur_lvl: charger current in maintenance A state in mA
* @maint_a_vol_lvl: charger voltage in maintenance A state in mV * @maint_a_vol_lvl: charger voltage in maintenance A state in mV
...@@ -394,7 +386,6 @@ struct ab8500_maxim_parameters { ...@@ -394,7 +386,6 @@ struct ab8500_maxim_parameters {
struct ab8500_battery_type { struct ab8500_battery_type {
int resis_high; int resis_high;
int resis_low; int resis_low;
int normal_cur_lvl;
int normal_vol_lvl; int normal_vol_lvl;
int maint_a_cur_lvl; int maint_a_cur_lvl;
int maint_a_vol_lvl; int maint_a_vol_lvl;
...@@ -431,15 +422,15 @@ struct ab8500_bm_capacity_levels { ...@@ -431,15 +422,15 @@ struct ab8500_bm_capacity_levels {
/** /**
* struct ab8500_bm_charger_parameters - Charger specific parameters * struct ab8500_bm_charger_parameters - Charger specific parameters
* @usb_volt_max: maximum allowed USB charger voltage in mV * @usb_volt_max: maximum allowed USB charger voltage in mV
* @usb_curr_max: maximum allowed USB charger current in mA * @usb_curr_max_ua: maximum allowed USB charger current in uA
* @ac_volt_max: maximum allowed AC charger voltage in mV * @ac_volt_max: maximum allowed AC charger voltage in mV
* @ac_curr_max: maximum allowed AC charger current in mA * @ac_curr_max_ua: maximum allowed AC charger current in uA
*/ */
struct ab8500_bm_charger_parameters { struct ab8500_bm_charger_parameters {
int usb_volt_max; int usb_volt_max;
int usb_curr_max; int usb_curr_max_ua;
int ac_volt_max; int ac_volt_max;
int ac_curr_max; int ac_curr_max_ua;
}; };
/** /**
......
...@@ -32,7 +32,7 @@ struct ux500_charger_ops { ...@@ -32,7 +32,7 @@ struct ux500_charger_ops {
* @psy power supply base class * @psy power supply base class
* @ops ux500 charger operations * @ops ux500 charger operations
* @max_out_volt maximum output charger voltage in mV * @max_out_volt maximum output charger voltage in mV
* @max_out_curr maximum output charger current in mA * @max_out_curr_ua maximum output charger current in uA
* @enabled indicates if this charger is used or not * @enabled indicates if this charger is used or not
* @external external charger unit (pm2xxx) * @external external charger unit (pm2xxx)
*/ */
...@@ -40,7 +40,7 @@ struct ux500_charger { ...@@ -40,7 +40,7 @@ struct ux500_charger {
struct power_supply *psy; struct power_supply *psy;
struct ux500_charger_ops ops; struct ux500_charger_ops ops;
int max_out_volt; int max_out_volt;
int max_out_curr; int max_out_curr_ua;
int wdt_refresh; int wdt_refresh;
bool enabled; bool enabled;
bool external; bool external;
......
...@@ -83,7 +83,6 @@ static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { ...@@ -83,7 +83,6 @@ static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = {
static struct ab8500_battery_type bat_type_thermistor_unknown = { static struct ab8500_battery_type bat_type_thermistor_unknown = {
.resis_high = 0, .resis_high = 0,
.resis_low = 0, .resis_low = 0,
.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,
...@@ -133,16 +132,16 @@ static const struct ab8500_fg_parameters fg = { ...@@ -133,16 +132,16 @@ static const struct ab8500_fg_parameters fg = {
static const struct ab8500_maxim_parameters ab8500_maxi_params = { static const struct ab8500_maxim_parameters ab8500_maxi_params = {
.ena_maxi = true, .ena_maxi = true,
.chg_curr = 910, .chg_curr_ua = 910000,
.wait_cycles = 10, .wait_cycles = 10,
.charger_curr_step = 100, .charger_curr_step_ua = 100000,
}; };
static const struct ab8500_bm_charger_parameters chg = { static const struct ab8500_bm_charger_parameters chg = {
.usb_volt_max = 5500, .usb_volt_max = 5500,
.usb_curr_max = 1500, .usb_curr_max_ua = 1500000,
.ac_volt_max = 7500, .ac_volt_max = 7500,
.ac_curr_max = 1500, .ac_curr_max_ua = 1500000,
}; };
/* This is referenced directly in the charger code */ /* This is referenced directly in the charger code */
...@@ -201,6 +200,9 @@ int ab8500_bm_of_probe(struct power_supply *psy, ...@@ -201,6 +200,9 @@ int ab8500_bm_of_probe(struct power_supply *psy,
bi->overvoltage_limit_uv = 4050000; bi->overvoltage_limit_uv = 4050000;
} }
if (bi->constant_charge_current_max_ua < 0)
bi->constant_charge_current_max_ua = 400000;
if (bi->charge_term_current_ua) if (bi->charge_term_current_ua)
/* Charging stops when we drop below this current */ /* Charging stops when we drop below this current */
bi->charge_term_current_ua = 200000; bi->charge_term_current_ua = 200000;
......
This diff is collapsed.
This diff is collapsed.
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