Commit e30110e9 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Lee Jones

charger: max14577: Configure battery-dependent settings from DTS and sysfs

Remove hard-coded values for:
 - Fast Charge current,
 - End Of Charge current,
 - Fast Charge timer,
 - Overvoltage Protection Threshold,
 - Battery Constant Voltage,
and use DTS or sysfs to configure them. This allows using the max14577 charger
driver with different batteries.

Now the charger driver requires valid configuration data from DTS. In
case of wrong configuration data it fails during probe.

The fast charge timer is configured through sysfs entry.
Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent b8f139f6
......@@ -327,6 +327,7 @@ config CHARGER_MANAGER
config CHARGER_MAX14577
tristate "Maxim MAX14577/77836 battery charger driver"
depends on MFD_MAX14577
select SYSFS
help
Say Y to enable support for the battery charger control sysfs and
platform data of MAX14577/77836 MUICs.
......
This diff is collapsed.
......@@ -293,6 +293,25 @@ enum max14577_charger_reg {
#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_STEP 25000U
#define MAX77836_CHARGER_CURRENT_LIMIT_MAX 475000U
/*
* MAX14577 charger End-Of-Charge current limits
* (as in CHGCTRL5 register), uA
*/
#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN 50000U
#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP 10000U
#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX 200000U
/*
* MAX14577/MAX77836 Battery Constant Voltage
* (as in CHGCTRL3 register), uV
*/
#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MIN 4000000U
#define MAXIM_CHARGER_CONSTANT_VOLTAGE_STEP 20000U
#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MAX 4350000U
/* Default value for fast charge timer, in hours */
#define MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT 5
/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
......
......@@ -54,6 +54,13 @@ struct max14577_regulator_platform_data {
struct device_node *of_node;
};
struct max14577_charger_platform_data {
u32 constant_uvolt;
u32 fast_charge_uamp;
u32 eoc_uamp;
u32 ovp_uvolt;
};
/*
* MAX14577 MFD platform data
*/
......
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