1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * max8997.h - Driver for the Maxim 8997/8966
5 * Copyright (C) 2009-2010 Samsung Electrnoics
6 * MyungJoo Ham <myungjoo.ham@samsung.com>
8 * This driver is based on max8998.h
10 * MAX8997 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices.
11 * Except Fuel Gauge, every device shares the same I2C bus and included in
12 * this mfd driver. Although the fuel gauge is included in the chip, it is
13 * excluded from the driver because a) it has a different I2C bus from
14 * others and b) it can be enabled simply by using MAX17042 driver.
17 #ifndef __LINUX_MFD_MAX8997_H
18 #define __LINUX_MFD_MAX8997_H
20 #include <linux/regulator/consumer.h>
22 /* MAX8997/8966 regulator IDs */
23 enum max8997_regulators {
55 MAX8997_CHARGER_CV, /* control MBCCV of MBCCTRL3 */
56 MAX8997_CHARGER, /* charger current, MBCCTRL4 */
57 MAX8997_CHARGER_TOPOFF, /* MBCCTRL5 */
62 struct max8997_regulator_data {
64 struct regulator_init_data *initdata;
65 struct device_node *reg_node;
68 struct max8997_muic_reg_data {
74 * struct max8997_muic_platform_data
75 * @init_data: array of max8997_muic_reg_data
76 * used for initializing registers of MAX8997 MUIC device
77 * @num_init_data: array size of init_data
79 struct max8997_muic_platform_data {
80 struct max8997_muic_reg_data *init_data;
83 /* Check cable state after certain delay */
84 int detcable_delay_ms;
87 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
88 * h/w path of COMP2/COMN1 on CONTROL1 register.
94 enum max8997_haptic_motor_type {
99 enum max8997_haptic_pulse_mode {
100 MAX8997_EXTERNAL_MODE,
101 MAX8997_INTERNAL_MODE,
104 enum max8997_haptic_pwm_divisor {
105 MAX8997_PWM_DIVISOR_32,
106 MAX8997_PWM_DIVISOR_64,
107 MAX8997_PWM_DIVISOR_128,
108 MAX8997_PWM_DIVISOR_256,
112 * max8997_haptic_platform_data
113 * @pwm_period: period in nano second for PWM device
114 * valid for MAX8997_EXTERNAL_MODE
117 * MAX8997_EXTERNAL_MODE: external PWM device is used to control motor
118 * MAX8997_INTERNAL_MODE: internal pulse generator is used to control motor
119 * @pwm_divisor: divisor for external PWM device
120 * @internal_mode_pattern: internal mode pattern for internal mode
121 * [0 - 3]: valid pattern number
122 * @pattern_cycle: the number of cycles of the waveform
123 * for the internal mode pattern
124 * [0 - 15]: available cycles
125 * @pattern_signal_period: period of the waveform for the internal mode pattern
126 * [0 - 255]: available period
128 struct max8997_haptic_platform_data {
129 unsigned int pwm_period;
131 enum max8997_haptic_motor_type type;
132 enum max8997_haptic_pulse_mode mode;
133 enum max8997_haptic_pwm_divisor pwm_divisor;
135 unsigned int internal_mode_pattern;
136 unsigned int pattern_cycle;
137 unsigned int pattern_signal_period;
140 enum max8997_led_mode {
144 MAX8997_FLASH_PIN_CONTROL_MODE,
145 MAX8997_MOVIE_PIN_CONTROL_MODE,
149 * struct max8997_led_platform_data
150 * The number of LED devices for MAX8997 is two
151 * @mode: LED mode for each LED device
152 * @brightness: initial brightness for each LED device
154 * [0 - 31]: MAX8997_FLASH_MODE and MAX8997_FLASH_PIN_CONTROL_MODE
155 * [0 - 15]: MAX8997_MOVIE_MODE and MAX8997_MOVIE_PIN_CONTROL_MODE
157 struct max8997_led_platform_data {
158 enum max8997_led_mode mode[2];
162 struct max8997_platform_data {
167 struct max8997_regulator_data *regulators;
171 * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
172 * With buckx_gpiodvs enabled, the buckx cannot be controlled
173 * independently. To control buckx (of 1, 2, and 5) independently,
174 * disable buckx_gpiodvs and control with BUCKxDVS1 register.
176 * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
177 * on buckx will change the voltage of bucky at the same time.
180 bool ignore_gpiodvs_side_effect;
181 int buck125_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
182 int buck125_default_idx; /* Default value of SET1, 2, 3 */
183 unsigned int buck1_voltage[8]; /* buckx_voltage in uV */
185 unsigned int buck2_voltage[8];
187 unsigned int buck5_voltage[8];
190 /* ---- Charger control ---- */
191 /* eoc stands for 'end of charge' */
192 int eoc_mA; /* 50 ~ 200mA by 10mA step */
193 /* charge Full Timeout */
194 int timeout; /* 0 (no timeout), 5, 6, 7 hours */
197 struct max8997_muic_platform_data *muic_pdata;
199 /* ---- HAPTIC ---- */
200 struct max8997_haptic_platform_data *haptic_pdata;
202 /* RTC: Not implemented */
204 struct max8997_led_platform_data *led_pdata;
207 #endif /* __LINUX_MFD_MAX8997_H */