aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-09-12 02:53:56 -0400
committerLee Jones <lee.jones@linaro.org>2014-09-24 10:25:47 -0400
commitb8f139f68f2099b7f8b4ef470a1e53210e3aa025 (patch)
tree416abf92550a7a84f074622a535eee2645b33b09 /include/linux/mfd
parent3682a8ee87f9107253e51733f42da10160ce41e3 (diff)
regulator/mfd: max14577: Export symbols for calculating charger current
This patch prepares for changing the max14577 charger driver to allow configuring battery-dependent settings from DTS. The patch moves from regulator driver to MFD core driver and exports: - function for calculating register value for charger's current; - table of limits for chargers (MAX14577, MAX77836). Previously they were used only by the max14577 regulator driver. In next patch the charger driver will use them as well. Exporting them will reduce unnecessary code duplication. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Mark Brown <broonie@linaro.org> Acked-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/max14577-private.h22
-rw-r--r--include/linux/mfd/max14577.h23
2 files changed, 34 insertions, 11 deletions
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index d6f321699b89..7d514839c764 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -281,17 +281,17 @@ enum max14577_charger_reg {
281#define CHGCTRL7_OTPCGHCVS_SHIFT 0 281#define CHGCTRL7_OTPCGHCVS_SHIFT 0
282#define CHGCTRL7_OTPCGHCVS_MASK (0x3 << CHGCTRL7_OTPCGHCVS_SHIFT) 282#define CHGCTRL7_OTPCGHCVS_MASK (0x3 << CHGCTRL7_OTPCGHCVS_SHIFT)
283 283
284/* MAX14577 regulator current limits (as in CHGCTRL4 register), uA */ 284/* MAX14577 charger current limits (as in CHGCTRL4 register), uA */
285#define MAX14577_REGULATOR_CURRENT_LIMIT_MIN 90000 285#define MAX14577_CHARGER_CURRENT_LIMIT_MIN 90000U
286#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START 200000 286#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_START 200000U
287#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP 50000 287#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_STEP 50000U
288#define MAX14577_REGULATOR_CURRENT_LIMIT_MAX 950000 288#define MAX14577_CHARGER_CURRENT_LIMIT_MAX 950000U
289 289
290/* MAX77836 regulator current limits (as in CHGCTRL4 register), uA */ 290/* MAX77836 charger current limits (as in CHGCTRL4 register), uA */
291#define MAX77836_REGULATOR_CURRENT_LIMIT_MIN 45000 291#define MAX77836_CHARGER_CURRENT_LIMIT_MIN 45000U
292#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START 100000 292#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_START 100000U
293#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP 25000 293#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_STEP 25000U
294#define MAX77836_REGULATOR_CURRENT_LIMIT_MAX 475000 294#define MAX77836_CHARGER_CURRENT_LIMIT_MAX 475000U
295 295
296/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */ 296/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
297#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000 297#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index c83fbed1c7b6..3c098d57b1d1 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -74,4 +74,27 @@ struct max14577_platform_data {
74 struct max14577_regulator_platform_data *regulators; 74 struct max14577_regulator_platform_data *regulators;
75}; 75};
76 76
77/*
78 * Valid limits of current for max14577 and max77836 chargers.
79 * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
80 * register for given chipset.
81 */
82struct maxim_charger_current {
83 /* Minimal current, set in CHGCTRL4/MBCICHWRCL, uA */
84 unsigned int min;
85 /*
86 * Minimal current when high setting is active,
87 * set in CHGCTRL4/MBCICHWRCH, uA
88 */
89 unsigned int high_start;
90 /* Value of one step in high setting, uA */
91 unsigned int high_step;
92 /* Maximum current of high setting, uA */
93 unsigned int max;
94};
95
96extern const struct maxim_charger_current maxim_charger_currents[];
97extern int maxim_charger_calc_reg_current(const struct maxim_charger_current *limits,
98 unsigned int min_ua, unsigned int max_ua, u8 *dst);
99
77#endif /* __MAX14577_H__ */ 100#endif /* __MAX14577_H__ */