diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2010-06-16 03:04:16 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-08-11 06:38:00 -0400 |
commit | 156f252857dfd81f03d77d09e33b5f7d2b113e2b (patch) | |
tree | 1614c00b1996ae5a805d9d27661026796d1403fa /include/linux/mfd | |
parent | 51bd6943cd760a55f655830b3f7dca8a06b54c73 (diff) |
drivers: regulator: add Maxim 8998 driver
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This patch adds voltage regulator driver for Maxim 8998 chip. This chip
is used on Samsung Aquila and GONI boards and provides following
functionalities:
- 4 BUCK voltage converters, 17 LDO power regulators and 5 other power
controllers
- battery charger
This patch adds basic driver for voltage regulators and MAX 8998 MFD core.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r-- | include/linux/mfd/max8998-private.h | 112 | ||||
-rw-r--r-- | include/linux/mfd/max8998.h | 78 |
2 files changed, 190 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 */ | ||
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h new file mode 100644 index 000000000000..1d3601a2d853 --- /dev/null +++ b/include/linux/mfd/max8998.h | |||
@@ -0,0 +1,78 @@ | |||
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_H | ||
24 | #define __LINUX_MFD_MAX8998_H | ||
25 | |||
26 | #include <linux/regulator/machine.h> | ||
27 | |||
28 | /* MAX 8998 regulator ids */ | ||
29 | enum { | ||
30 | MAX8998_LDO2 = 2, | ||
31 | MAX8998_LDO3, | ||
32 | MAX8998_LDO4, | ||
33 | MAX8998_LDO5, | ||
34 | MAX8998_LDO6, | ||
35 | MAX8998_LDO7, | ||
36 | MAX8998_LDO8, | ||
37 | MAX8998_LDO9, | ||
38 | MAX8998_LDO10, | ||
39 | MAX8998_LDO11, | ||
40 | MAX8998_LDO12, | ||
41 | MAX8998_LDO13, | ||
42 | MAX8998_LDO14, | ||
43 | MAX8998_LDO15, | ||
44 | MAX8998_LDO16, | ||
45 | MAX8998_LDO17, | ||
46 | MAX8998_BUCK1, | ||
47 | MAX8998_BUCK2, | ||
48 | MAX8998_BUCK3, | ||
49 | MAX8998_BUCK4, | ||
50 | MAX8998_EN32KHZ_AP, | ||
51 | MAX8998_EN32KHZ_CP, | ||
52 | MAX8998_ENVICHG, | ||
53 | MAX8998_ESAFEOUT1, | ||
54 | MAX8998_ESAFEOUT2, | ||
55 | }; | ||
56 | |||
57 | /** | ||
58 | * max8998_regulator_data - regulator data | ||
59 | * @id: regulator id | ||
60 | * @initdata: regulator init data (contraints, supplies, ...) | ||
61 | */ | ||
62 | struct max8998_regulator_data { | ||
63 | int id; | ||
64 | struct regulator_init_data *initdata; | ||
65 | }; | ||
66 | |||
67 | /** | ||
68 | * struct max8998_board - packages regulator init data | ||
69 | * @num_regulators: number of regultors used | ||
70 | * @regulators: array of defined regulators | ||
71 | */ | ||
72 | |||
73 | struct max8998_platform_data { | ||
74 | int num_regulators; | ||
75 | struct max8998_regulator_data *regulators; | ||
76 | }; | ||
77 | |||
78 | #endif /* __LINUX_MFD_MAX8998_H */ | ||