Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
max8997-private.h
Go to the documentation of this file.
1 /*
2  * max8997.h - Voltage regulator driver for the Maxim 8997
3  *
4  * Copyright (C) 2010 Samsung Electrnoics
5  * MyungJoo Ham <[email protected]>
6  *
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.
11  *
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.
16  *
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
20  */
21 
22 #ifndef __LINUX_MFD_MAX8997_PRIV_H
23 #define __LINUX_MFD_MAX8997_PRIV_H
24 
25 #include <linux/i2c.h>
26 #include <linux/export.h>
27 #include <linux/irqdomain.h>
28 
29 #define MAX8997_REG_INVALID (0xff)
30 
39 
44 
49 
53 
108 
116 
118 
122 
123  MAX8997_REG_FLASH1_CUR = 0x63, /* 0x63 ~ 0x6e for FLASH */
135 
148 
168 
173 
175 };
176 
189 
193 
195 };
196 
215 
217 };
218 
219 /* slave addr = 0x0c: using "2nd part" of rev4 datasheet */
226 
248 };
249 
255 
256  FUEL_GAUGE, /* Ignored (MAX17042 driver handles) */
257 
261 
262  GPIO_LOW, /* Not implemented */
263  GPIO_HI, /* Not implemented */
264 
265  FLASH_STATUS, /* Not implemented */
266 
268 };
269 
278 
286 
293 
300 
304 
310 
312 
314 };
315 
316 #define MAX8997_NUM_GPIO 12
317 struct max8997_dev {
318  struct device *dev;
319  struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
320  struct i2c_client *rtc; /* slave addr 0x0c */
321  struct i2c_client *haptic; /* slave addr 0x90 */
322  struct i2c_client *muic; /* slave addr 0x4a */
323  struct mutex iolock;
324 
325  int type;
326  struct platform_device *battery; /* battery control (not fuel gauge) */
327 
328  int irq;
329  int ono;
331  struct mutex irqlock;
334 
335  /* For hibernation */
338 
340 };
341 
345 };
346 
347 extern int max8997_irq_init(struct max8997_dev *max8997);
348 extern void max8997_irq_exit(struct max8997_dev *max8997);
349 extern int max8997_irq_resume(struct max8997_dev *max8997);
350 
351 extern int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
352 extern int max8997_bulk_read(struct i2c_client *i2c, u8 reg, int count,
353  u8 *buf);
354 extern int max8997_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
355 extern int max8997_bulk_write(struct i2c_client *i2c, u8 reg, int count,
356  u8 *buf);
357 extern int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
358 
359 #define MAX8997_GPIO_INT_BOTH (0x3 << 4)
360 #define MAX8997_GPIO_INT_RISE (0x2 << 4)
361 #define MAX8997_GPIO_INT_FALL (0x1 << 4)
362 
363 #define MAX8997_GPIO_INT_MASK (0x3 << 4)
364 #define MAX8997_GPIO_DATA_MASK (0x1 << 2)
365 #endif /* __LINUX_MFD_MAX8997_PRIV_H */