1 /* SPDX-License-Identifier: GPL-2.0+ */ << 2 /* 1 /* 3 * max14577.h - Driver for the Maxim 14577/778 2 * max14577.h - Driver for the Maxim 14577/77836 4 * 3 * 5 * Copyright (C) 2014 Samsung Electrnoics 4 * Copyright (C) 2014 Samsung Electrnoics 6 * Chanwoo Choi <cw00.choi@samsung.com> 5 * Chanwoo Choi <cw00.choi@samsung.com> 7 * Krzysztof Kozlowski <krzk@kernel.org> 6 * Krzysztof Kozlowski <krzk@kernel.org> >> 7 * >> 8 * This program is free software; you can redistribute it and/or modify >> 9 * it under the terms of the GNU General Public License as published by >> 10 * the Free Software Foundation; either version 2 of the License, or >> 11 * (at your option) any later version. >> 12 * >> 13 * This program is distributed in the hope that it will be useful, >> 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of >> 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> 16 * GNU General Public License for more details. 8 * 17 * 9 * This driver is based on max8997.h 18 * This driver is based on max8997.h 10 * 19 * 11 * MAX14577 has MUIC, Charger devices. 20 * MAX14577 has MUIC, Charger devices. 12 * The devices share the same I2C bus and inte 21 * The devices share the same I2C bus and interrupt line 13 * included in this mfd driver. 22 * included in this mfd driver. 14 * 23 * 15 * MAX77836 has additional PMIC and Fuel-Gauge 24 * MAX77836 has additional PMIC and Fuel-Gauge on different I2C slave 16 * addresses. 25 * addresses. 17 */ 26 */ 18 27 19 #ifndef __MAX14577_H__ 28 #ifndef __MAX14577_H__ 20 #define __MAX14577_H__ 29 #define __MAX14577_H__ 21 30 22 #include <linux/regulator/consumer.h> 31 #include <linux/regulator/consumer.h> 23 32 24 /* MAX14577 regulator IDs */ 33 /* MAX14577 regulator IDs */ 25 enum max14577_regulators { 34 enum max14577_regulators { 26 MAX14577_SAFEOUT = 0, 35 MAX14577_SAFEOUT = 0, 27 MAX14577_CHARGER, 36 MAX14577_CHARGER, 28 37 29 MAX14577_REGULATOR_NUM, 38 MAX14577_REGULATOR_NUM, 30 }; 39 }; 31 40 32 /* MAX77836 regulator IDs */ 41 /* MAX77836 regulator IDs */ 33 enum max77836_regulators { 42 enum max77836_regulators { 34 MAX77836_SAFEOUT = 0, 43 MAX77836_SAFEOUT = 0, 35 MAX77836_CHARGER, 44 MAX77836_CHARGER, 36 MAX77836_LDO1, 45 MAX77836_LDO1, 37 MAX77836_LDO2, 46 MAX77836_LDO2, 38 47 39 MAX77836_REGULATOR_NUM, 48 MAX77836_REGULATOR_NUM, 40 }; 49 }; 41 50 42 struct max14577_regulator_platform_data { 51 struct max14577_regulator_platform_data { 43 int id; 52 int id; 44 struct regulator_init_data *initdata; 53 struct regulator_init_data *initdata; 45 struct device_node *of_node; 54 struct device_node *of_node; 46 }; 55 }; 47 56 48 struct max14577_charger_platform_data { 57 struct max14577_charger_platform_data { 49 u32 constant_uvolt; 58 u32 constant_uvolt; 50 u32 fast_charge_uamp; 59 u32 fast_charge_uamp; 51 u32 eoc_uamp; 60 u32 eoc_uamp; 52 u32 ovp_uvolt; 61 u32 ovp_uvolt; 53 }; 62 }; 54 63 55 /* 64 /* 56 * MAX14577 MFD platform data 65 * MAX14577 MFD platform data 57 */ 66 */ 58 struct max14577_platform_data { 67 struct max14577_platform_data { 59 /* IRQ */ 68 /* IRQ */ 60 int irq_base; 69 int irq_base; 61 70 62 /* current control GPIOs */ 71 /* current control GPIOs */ 63 int gpio_pogo_vbatt_en; 72 int gpio_pogo_vbatt_en; 64 int gpio_pogo_vbus_en; 73 int gpio_pogo_vbus_en; 65 74 66 /* current control GPIO control functi 75 /* current control GPIO control function */ 67 int (*set_gpio_pogo_vbatt_en) (int gpi 76 int (*set_gpio_pogo_vbatt_en) (int gpio_val); 68 int (*set_gpio_pogo_vbus_en) (int gpio 77 int (*set_gpio_pogo_vbus_en) (int gpio_val); 69 78 70 int (*set_gpio_pogo_cb) (int new_dev); 79 int (*set_gpio_pogo_cb) (int new_dev); 71 80 72 struct max14577_regulator_platform_dat 81 struct max14577_regulator_platform_data *regulators; 73 }; 82 }; 74 83 75 /* 84 /* 76 * Valid limits of current for max14577 and ma 85 * Valid limits of current for max14577 and max77836 chargers. 77 * They must correspond to MBCICHWRCL and MBCI 86 * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4 78 * register for given chipset. 87 * register for given chipset. 79 */ 88 */ 80 struct maxim_charger_current { 89 struct maxim_charger_current { 81 /* Minimal current, set in CHGCTRL4/MB 90 /* Minimal current, set in CHGCTRL4/MBCICHWRCL, uA */ 82 unsigned int min; 91 unsigned int min; 83 /* 92 /* 84 * Minimal current when high setting i 93 * Minimal current when high setting is active, 85 * set in CHGCTRL4/MBCICHWRCH, uA 94 * set in CHGCTRL4/MBCICHWRCH, uA 86 */ 95 */ 87 unsigned int high_start; 96 unsigned int high_start; 88 /* Value of one step in high setting, 97 /* Value of one step in high setting, uA */ 89 unsigned int high_step; 98 unsigned int high_step; 90 /* Maximum current of high setting, uA 99 /* Maximum current of high setting, uA */ 91 unsigned int max; 100 unsigned int max; 92 }; 101 }; 93 102 94 extern const struct maxim_charger_current maxi 103 extern const struct maxim_charger_current maxim_charger_currents[]; 95 extern int maxim_charger_calc_reg_current(cons 104 extern int maxim_charger_calc_reg_current(const struct maxim_charger_current *limits, 96 unsigned int min_ua, unsigned 105 unsigned int min_ua, unsigned int max_ua, u8 *dst); 97 106 98 #endif /* __MAX14577_H__ */ 107 #endif /* __MAX14577_H__ */ 99 108
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.