diff options
Diffstat (limited to 'include/linux/mfd/max8998-private.h')
-rw-r--r-- | include/linux/mfd/max8998-private.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h new file mode 100644 index 000000000000..6dc75b3e2d33 --- /dev/null +++ b/include/linux/mfd/max8998-private.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * max8698.h - Voltage regulator driver for the Maxim 8998 | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Samsung Electrnoics | ||
5 | * Kyungmin Park <kyungmin.park@samsung.com> | ||
6 | * Marek Szyprowski <m.szyprowski@samsung.com> | ||
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. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_MFD_MAX8998_PRIV_H | ||
24 | #define __LINUX_MFD_MAX8998_PRIV_H | ||
25 | |||
26 | /* MAX 8998 registers */ | ||
27 | enum { | ||
28 | MAX8998_REG_IRQ1, | ||
29 | MAX8998_REG_IRQ2, | ||
30 | MAX8998_REG_IRQ3, | ||
31 | MAX8998_REG_IRQ4, | ||
32 | MAX8998_REG_IRQM1, | ||
33 | MAX8998_REG_IRQM2, | ||
34 | MAX8998_REG_IRQM3, | ||
35 | MAX8998_REG_IRQM4, | ||
36 | MAX8998_REG_STATUS1, | ||
37 | MAX8998_REG_STATUS2, | ||
38 | MAX8998_REG_STATUSM1, | ||
39 | MAX8998_REG_STATUSM2, | ||
40 | MAX8998_REG_CHGR1, | ||
41 | MAX8998_REG_CHGR2, | ||
42 | MAX8998_REG_LDO_ACTIVE_DISCHARGE1, | ||
43 | MAX8998_REG_LDO_ACTIVE_DISCHARGE2, | ||
44 | MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, | ||
45 | MAX8998_REG_ONOFF1, | ||
46 | MAX8998_REG_ONOFF2, | ||
47 | MAX8998_REG_ONOFF3, | ||
48 | MAX8998_REG_ONOFF4, | ||
49 | MAX8998_REG_BUCK1_DVSARM1, | ||
50 | MAX8998_REG_BUCK1_DVSARM2, | ||
51 | MAX8998_REG_BUCK1_DVSARM3, | ||
52 | MAX8998_REG_BUCK1_DVSARM4, | ||
53 | MAX8998_REG_BUCK2_DVSINT1, | ||
54 | MAX8998_REG_BUCK2_DVSINT2, | ||
55 | MAX8998_REG_BUCK3, | ||
56 | MAX8998_REG_BUCK4, | ||
57 | MAX8998_REG_LDO2_LDO3, | ||
58 | MAX8998_REG_LDO4, | ||
59 | MAX8998_REG_LDO5, | ||
60 | MAX8998_REG_LDO6, | ||
61 | MAX8998_REG_LDO7, | ||
62 | MAX8998_REG_LDO8_LDO9, | ||
63 | MAX8998_REG_LDO10_LDO11, | ||
64 | MAX8998_REG_LDO12, | ||
65 | MAX8998_REG_LDO13, | ||
66 | MAX8998_REG_LDO14, | ||
67 | MAX8998_REG_LDO15, | ||
68 | MAX8998_REG_LDO16, | ||
69 | MAX8998_REG_LDO17, | ||
70 | MAX8998_REG_BKCHR, | ||
71 | MAX8998_REG_LBCNFG1, | ||
72 | MAX8998_REG_LBCNFG2, | ||
73 | }; | ||
74 | |||
75 | /** | ||
76 | * struct max8998_dev - max8998 master device for sub-drivers | ||
77 | * @dev: master device of the chip (can be used to access platform data) | ||
78 | * @i2c_client: i2c client private data | ||
79 | * @dev_read(): chip register read function | ||
80 | * @dev_write(): chip register write function | ||
81 | * @dev_update(): chip register update function | ||
82 | * @iolock: mutex for serializing io access | ||
83 | */ | ||
84 | |||
85 | struct max8998_dev { | ||
86 | struct device *dev; | ||
87 | struct i2c_client *i2c_client; | ||
88 | int (*dev_read)(struct max8998_dev *max8998, u8 reg, u8 *dest); | ||
89 | int (*dev_write)(struct max8998_dev *max8998, u8 reg, u8 val); | ||
90 | int (*dev_update)(struct max8998_dev *max8998, u8 reg, u8 val, u8 mask); | ||
91 | struct mutex iolock; | ||
92 | }; | ||
93 | |||
94 | static inline int max8998_read_reg(struct max8998_dev *max8998, u8 reg, | ||
95 | u8 *value) | ||
96 | { | ||
97 | return max8998->dev_read(max8998, reg, value); | ||
98 | } | ||
99 | |||
100 | static inline int max8998_write_reg(struct max8998_dev *max8998, u8 reg, | ||
101 | u8 value) | ||
102 | { | ||
103 | return max8998->dev_write(max8998, reg, value); | ||
104 | } | ||
105 | |||
106 | static inline int max8998_update_reg(struct max8998_dev *max8998, u8 reg, | ||
107 | u8 value, u8 mask) | ||
108 | { | ||
109 | return max8998->dev_update(max8998, reg, value, mask); | ||
110 | } | ||
111 | |||
112 | #endif /* __LINUX_MFD_MAX8998_PRIV_H */ | ||