From b0284de05e07d56ff7de154d0c9263788755f5eb Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Fri, 30 Nov 2012 10:09:42 +0000 Subject: ab8500_bm: Rename battery management platform data to something more logical The platform specific battery management configuration data structure is currently called 'bat' short for 'battery'; however, it contains information for all components of the battery management group, rather than information pertaining to the battery itself - there are other structures for that. So, in keeping with its structure namesake 'abx500_bm_data', we rename it to 'bm' here. Using similar logic, we're also renaming 'bmdevs_of_probe' to the more device specific 'ab8500_bm_of_probe'. Signed-off-by: Lee Jones --- include/linux/mfd/abx500.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/linux/mfd/abx500.h') diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 2138bd33021a..6ce749a0e9d4 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -279,9 +279,9 @@ enum { NTC_INTERNAL, }; -int bmdevs_of_probe(struct device *dev, - struct device_node *np, - struct abx500_bm_data **battery); +int ab8500_bm_of_probe(struct device *dev, + struct device_node *np, + struct abx500_bm_data **battery); int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, u8 value); -- cgit v1.2.3 From 23a04f9f40f2b32ee593b768483105b1c776814d Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 29 Nov 2012 15:08:41 +0000 Subject: ab8500_bm: Always send platform specific battery information via pdata Currently the AB8500 battery management subsystem receives platform specific information via two different means depending on how the platform is booted. If DT is not enabled, a reference to a *_bm_data data structure containing each platform specific attribute is passed though platform_data. However, if DT is enabled, then platform_data is empty and the reference is gained though a DT specific probe function. There are two issues here 1) the same reference is being collected each time and 2) the DT way doesn't allow any provisions to select different platform specific attributes, which kind of defeats the object. Cc: Samuel Ortiz Signed-off-by: Lee Jones --- include/linux/mfd/abx500.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux/mfd/abx500.h') diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 6ce749a0e9d4..4906b1842d2f 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -281,7 +281,7 @@ enum { int ab8500_bm_of_probe(struct device *dev, struct device_node *np, - struct abx500_bm_data **battery); + struct abx500_bm_data *bm); int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, u8 value); -- cgit v1.2.3 From ea4024017831d61874351defe8f8c58ae73f8009 Mon Sep 17 00:00:00 2001 From: Marcus Cooper Date: Fri, 11 Jan 2013 13:12:54 +0000 Subject: ab8500_bm: Recharge condition not optimal for battery Today the battery recharge is determined with a voltage threshold. This voltage threshold is only valid when the battery is relaxed. In charging algorithm the voltage read is the loaded battery voltage and no compensation is done to get the relaxed voltage. When maintenance charging is not selected, this makes the recharging condition to almost immediately activate when there is a discharge present on the battery. Depending on which vendor the battery comes from this behavior can wear out the battery much faster than normal. The fuelgauge driver is responsible to monitor the actual battery capacity and is able to estimate the remaining capacity. It is better to use the remaining capacity as a limit to determine when battery should be recharged. Signed-off-by: Lee Jones Signed-off-by: Marcus Cooper Reviewed-by: Hakan BERG Reviewed-by: Jonas ABERG Signed-off-by: Anton Vorontsov --- include/linux/mfd/abx500.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/linux/mfd/abx500.h') diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 4906b1842d2f..0e6e90badfca 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -131,7 +131,7 @@ struct abx500_maxim_parameters { * @nominal_voltage: Nominal voltage of the battery in mV * @termination_vol: max voltage upto which battery can be charged * @termination_curr battery charging termination current in mA - * @recharge_vol battery voltage limit that will trigger a new + * @recharge_cap battery capacity limit that will trigger a new * full charging cycle in the case where maintenan- * -ce charging has been disabled * @normal_cur_lvl: charger current in normal state in mA @@ -160,7 +160,7 @@ struct abx500_battery_type { int nominal_voltage; int termination_vol; int termination_curr; - int recharge_vol; + int recharge_cap; int normal_cur_lvl; int normal_vol_lvl; int maint_a_cur_lvl; @@ -224,6 +224,7 @@ struct abx500_bm_charger_parameters { * @bkup_bat_v voltage which we charge the backup battery with * @bkup_bat_i current which we charge the backup battery with * @no_maintenance indicates that maintenance charging is disabled + * @capacity_scaling indicates whether capacity scaling is to be used * @abx500_adc_therm placement of thermistor, batctrl or battemp adc * @chg_unknown_bat flag to enable charging of unknown batteries * @enable_overshoot flag to enable VBAT overshoot control @@ -254,6 +255,7 @@ struct abx500_bm_data { int bkup_bat_v; int bkup_bat_i; bool no_maintenance; + bool capacity_scaling; bool chg_unknown_bat; bool enable_overshoot; bool auto_trig; -- cgit v1.2.3 From 97034a1e042d4316a83a3f68d61edf6c42e3f265 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 17 Jan 2013 16:08:42 +0000 Subject: ab8500-bm: Remove individual [charger|btemp|fg|chargalg] pdata structures None of the aforementioned components have their own dedicated platform data structures anymore. Instead they have all been merged into one big Battery Management container. Let's remove them and place all the nice newly added attributes into the core container. Signed-off-by: Lee Jones --- include/linux/mfd/abx500.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux/mfd/abx500.h') diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 0e6e90badfca..1beaa056f195 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -254,6 +254,9 @@ struct abx500_bm_data { int usb_safety_tmr_h; int bkup_bat_v; int bkup_bat_i; + bool autopower_cfg; + bool ac_enabled; + bool usb_enabled; bool no_maintenance; bool capacity_scaling; bool chg_unknown_bat; -- cgit v1.2.3