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 not provided / owned by Maxim Integrated Products.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * This driver is based on max8998.h
26 #ifndef __LINUX_MFD_MAX8998_H
27 #define __LINUX_MFD_MAX8998_H
29 #include <linux/regulator/consumer.h>
31 /* MAX8997/8966 regulator IDs */
32 enum max8998_regulators {
64 MAX8997_CHARGER_CV, /* control MBCCV of MBCCTRL3 */
65 MAX8997_CHARGER, /* charger current, MBCCTRL4 */
66 MAX8997_CHARGER_TOPOFF, /* MBCCTRL5 */
74 MAX8997_PMICIRQ_PWRONR,
75 MAX8997_PMICIRQ_PWRONF,
76 MAX8997_PMICIRQ_PWRON1SEC,
77 MAX8997_PMICIRQ_JIGONR,
78 MAX8997_PMICIRQ_JIGONF,
79 MAX8997_PMICIRQ_LOWBAT2,
80 MAX8997_PMICIRQ_LOWBAT1,
85 MAX8997_PMICIRQ_DVS1OK,
86 MAX8997_PMICIRQ_DVS2OK,
87 MAX8997_PMICIRQ_DVS3OK,
88 MAX8997_PMICIRQ_DVS4OK,
90 MAX8997_PMICIRQ_CHGINS,
91 MAX8997_PMICIRQ_CHGRM,
92 MAX8997_PMICIRQ_DCINOVP,
93 MAX8997_PMICIRQ_TOPOFFR,
94 MAX8997_PMICIRQ_CHGRSTF,
95 MAX8997_PMICIRQ_MBCHGTMEXPD,
97 MAX8997_PMICIRQ_RTC60S,
98 MAX8997_PMICIRQ_RTCA1,
99 MAX8997_PMICIRQ_RTCA2,
100 MAX8997_PMICIRQ_SMPL_INT,
101 MAX8997_PMICIRQ_RTC1S,
102 MAX8997_PMICIRQ_WTSR,
104 MAX8997_MUICIRQ_ADCError,
105 MAX8997_MUICIRQ_ADCLow,
108 MAX8997_MUICIRQ_VBVolt,
109 MAX8997_MUICIRQ_DBChg,
110 MAX8997_MUICIRQ_DCDTmr,
111 MAX8997_MUICIRQ_ChgDetRun,
112 MAX8997_MUICIRQ_ChgTyp,
119 struct max8997_regulator_data {
121 struct regulator_init_data *initdata;
124 struct max8997_power_data {
125 int (*set_charger)(int);
126 int (*topoff_cb) (void);
127 unsigned batt_detect:1;
128 unsigned topoff_threshold:2;
129 unsigned fast_charge:3; /* charge current */
133 MAX8997_MUIC_DETACHED = 0,
134 MAX8997_MUIC_ATTACHED
148 typedef enum cable_type {
155 CABLE_TYPE_JIG_UART_OFF,
156 CABLE_TYPE_JIG_UART_OFF_VB, /* VBUS enabled */
157 CABLE_TYPE_JIG_UART_ON,
158 CABLE_TYPE_JIG_USB_OFF,
159 CABLE_TYPE_JIG_USB_ON,
166 /*muic device platform data */
167 struct max8997_muic_platform_data {
168 void (*usb_power)(u8 on);
169 void (*usb_cb)(u8 attached);
170 int (*charger_cb)(cable_type_t cable_type);
171 void (*deskdock_cb) (bool attached);
172 void (*cardock_cb) (bool attached);
173 void (*mhl_cb) (int attached);
174 void (*init_cb) (void);
175 int (*set_safeout) (int path);
176 bool (*is_mhl_attached) (void);
177 int (*cfg_uart_gpio) (void);
178 void (*jig_uart_cb) (int path);
179 int (*host_notify_cb) (int enable);
186 /* haptic device platform data */
187 struct max8997_haptic_platform_data {
190 void (*control_power)(struct device *, int);
193 struct max8997_platform_data {
200 struct max8997_regulator_data *regulators;
204 * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
205 * With buckx_gpiodvs enabled, the buckx cannot be controlled
206 * independently. To control buckx (of 1, 2, and 5) independently,
207 * disable buckx_gpiodvs and control with BUCKxDVS1 register.
209 * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
210 * on buckx will change the voltage of bucky at the same time.
213 bool ignore_gpiodvs_side_effect;
214 int buck125_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
215 int buck125_default_idx; /* Default value of SET1, 2, 3 */
216 unsigned int buck1_voltage[8]; /* buckx_voltage in uV */
218 unsigned int buck2_voltage[8];
220 unsigned int buck5_voltage[8];
224 struct max8997_muic_platform_data *muic_pdata;
226 /* ---- HAPTIC ---- */
227 struct max8997_haptic_platform_data *haptic_pdata;
230 bool delay; /* The MAX8997 RTC write delay is requred. */
232 /* ---- Charger control ---- */
234 /* 50 ~ 200mA by 10mA step */
237 * 0 ~ 50 in percent to current limit of regulaotr "CHARGER"
238 * if eoc_mA = 0. If eoc_mA > 0, this is ignored.
242 * ADC read function for the ADC connected to VICHG
243 * This is not required: ignored if NULL */
244 int (*vichg_adc_get_uV)(void *);
245 /* Charge Restart Level is Constant in MAX8997 (150mV) */
247 /* Charge Full Timeout */
248 int timeout; /* 0 (no timeout), 5, 6, 7 hours */
250 /* ---- Flash ---- */
254 * Note that MAX8997 has a fuel gauge that is identical to MAX17042.
255 * However, it has a seperated I2C bus. Thus we do not include
256 * the fuel gauge in this mfd.
260 #endif /* __LINUX_MFD_MAX8998_H */