2 * max8997.h - Driver for the Maxim 8997/8966
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * This driver is based on max8998.h
23 * MAX8997 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices.
24 * Except Fuel Gauge, every device shares the same I2C bus and included in
25 * this mfd driver. Although the fuel gauge is included in the chip, it is
26 * excluded from the driver because a) it has a different I2C bus from
27 * others and b) it can be enabled simply by using MAX17042 driver.
30 #ifndef __LINUX_MFD_MAX8998_H
31 #define __LINUX_MFD_MAX8998_H
33 #include <linux/regulator/consumer.h>
35 /* MAX8997/8966 regulator IDs */
36 enum max8998_regulators
{
68 MAX8997_CHARGER_CV
, /* control MBCCV of MBCCTRL3 */
69 MAX8997_CHARGER
, /* charger current, MBCCTRL4 */
70 MAX8997_CHARGER_TOPOFF
, /* MBCCTRL5 */
75 struct max8997_regulator_data
{
77 struct regulator_init_data
*initdata
;
80 enum max8997_muic_usb_type
{
85 enum max8997_muic_charger_type
{
86 MAX8997_CHARGER_TYPE_NONE
= 0,
87 MAX8997_CHARGER_TYPE_USB
,
88 MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT
,
89 MAX8997_CHARGER_TYPE_DEDICATED_CHG
,
90 MAX8997_CHARGER_TYPE_500MA
,
91 MAX8997_CHARGER_TYPE_1A
,
92 MAX8997_CHARGER_TYPE_DEAD_BATTERY
= 7,
95 struct max8997_muic_reg_data
{
101 * struct max8997_muic_platform_data
102 * @init_data: array of max8997_muic_reg_data
103 * used for initializing registers of MAX8997 MUIC device
104 * @num_init_data: array size of init_data
106 struct max8997_muic_platform_data
{
107 struct max8997_muic_reg_data
*init_data
;
111 enum max8997_haptic_motor_type
{
116 enum max8997_haptic_pulse_mode
{
117 MAX8997_EXTERNAL_MODE
,
118 MAX8997_INTERNAL_MODE
,
121 enum max8997_haptic_pwm_divisor
{
122 MAX8997_PWM_DIVISOR_32
,
123 MAX8997_PWM_DIVISOR_64
,
124 MAX8997_PWM_DIVISOR_128
,
125 MAX8997_PWM_DIVISOR_256
,
129 * max8997_haptic_platform_data
130 * @pwm_channel_id: channel number of PWM device
131 * valid for MAX8997_EXTERNAL_MODE
132 * @pwm_period: period in nano second for PWM device
133 * valid for MAX8997_EXTERNAL_MODE
136 * MAX8997_EXTERNAL_MODE: external PWM device is used to control motor
137 * MAX8997_INTERNAL_MODE: internal pulse generator is used to control motor
138 * @pwm_divisor: divisor for external PWM device
139 * @internal_mode_pattern: internal mode pattern for internal mode
140 * [0 - 3]: valid pattern number
141 * @pattern_cycle: the number of cycles of the waveform
142 * for the internal mode pattern
143 * [0 - 15]: available cycles
144 * @pattern_signal_period: period of the waveform for the internal mode pattern
145 * [0 - 255]: available period
147 struct max8997_haptic_platform_data
{
148 unsigned int pwm_channel_id
;
149 unsigned int pwm_period
;
151 enum max8997_haptic_motor_type type
;
152 enum max8997_haptic_pulse_mode mode
;
153 enum max8997_haptic_pwm_divisor pwm_divisor
;
155 unsigned int internal_mode_pattern
;
156 unsigned int pattern_cycle
;
157 unsigned int pattern_signal_period
;
160 enum max8997_led_mode
{
164 MAX8997_FLASH_PIN_CONTROL_MODE
,
165 MAX8997_MOVIE_PIN_CONTROL_MODE
,
169 * struct max8997_led_platform_data
170 * The number of LED devices for MAX8997 is two
171 * @mode: LED mode for each LED device
172 * @brightness: initial brightness for each LED device
174 * [0 - 31]: MAX8997_FLASH_MODE and MAX8997_FLASH_PIN_CONTROL_MODE
175 * [0 - 15]: MAX8997_MOVIE_MODE and MAX8997_MOVIE_PIN_CONTROL_MODE
177 struct max8997_led_platform_data
{
178 enum max8997_led_mode mode
[2];
182 struct max8997_platform_data
{
188 struct max8997_regulator_data
*regulators
;
192 * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
193 * With buckx_gpiodvs enabled, the buckx cannot be controlled
194 * independently. To control buckx (of 1, 2, and 5) independently,
195 * disable buckx_gpiodvs and control with BUCKxDVS1 register.
197 * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
198 * on buckx will change the voltage of bucky at the same time.
201 bool ignore_gpiodvs_side_effect
;
202 int buck125_gpios
[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
203 int buck125_default_idx
; /* Default value of SET1, 2, 3 */
204 unsigned int buck1_voltage
[8]; /* buckx_voltage in uV */
206 unsigned int buck2_voltage
[8];
208 unsigned int buck5_voltage
[8];
211 /* ---- Charger control ---- */
212 /* eoc stands for 'end of charge' */
213 int eoc_mA
; /* 50 ~ 200mA by 10mA step */
214 /* charge Full Timeout */
215 int timeout
; /* 0 (no timeout), 5, 6, 7 hours */
218 struct max8997_muic_platform_data
*muic_pdata
;
220 /* ---- HAPTIC ---- */
221 struct max8997_haptic_platform_data
*haptic_pdata
;
223 /* RTC: Not implemented */
225 struct max8997_led_platform_data
*led_pdata
;
228 #endif /* __LINUX_MFD_MAX8998_H */