1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * max14577.h - Driver for the Maxim 14577/77836
5 * Copyright (C) 2014 Samsung Electrnoics
9 * This driver is based on max8997.h
11 * MAX14577 has MUIC, Charger devices.
12 * The devices share the same I2C bus and interrupt line
13 * included in this mfd driver.
15 * MAX77836 has additional PMIC and Fuel-Gauge on different I2C slave
19 #ifndef __MAX14577_H__
20 #define __MAX14577_H__
22 #include <linux/regulator/consumer.h>
24 /* MAX14577 regulator IDs */
25 enum max14577_regulators {
29 MAX14577_REGULATOR_NUM,
32 /* MAX77836 regulator IDs */
33 enum max77836_regulators {
39 MAX77836_REGULATOR_NUM,
42 struct max14577_regulator_platform_data {
44 struct regulator_init_data *initdata;
45 struct device_node *of_node;
48 struct max14577_charger_platform_data {
56 * MAX14577 MFD platform data
58 struct max14577_platform_data {
62 /* current control GPIOs */
63 int gpio_pogo_vbatt_en;
64 int gpio_pogo_vbus_en;
66 /* current control GPIO control function */
67 int (*set_gpio_pogo_vbatt_en) (int gpio_val);
68 int (*set_gpio_pogo_vbus_en) (int gpio_val);
70 int (*set_gpio_pogo_cb) (int new_dev);
72 struct max14577_regulator_platform_data *regulators;
76 * Valid limits of current for max14577 and max77836 chargers.
77 * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
78 * register for given chipset.
80 struct maxim_charger_current {
81 /* Minimal current, set in CHGCTRL4/MBCICHWRCL, uA */
84 * Minimal current when high setting is active,
85 * set in CHGCTRL4/MBCICHWRCH, uA
87 unsigned int high_start;
88 /* Value of one step in high setting, uA */
89 unsigned int high_step;
90 /* Maximum current of high setting, uA */
94 extern const struct maxim_charger_current maxim_charger_currents[];
95 extern int maxim_charger_calc_reg_current(const struct maxim_charger_current *limits,
96 unsigned int min_ua, unsigned int max_ua, u8 *dst);
98 #endif /* __MAX14577_H__ */