diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-12 13:01:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-12 13:01:30 -0400 |
commit | 580287628cdd99366b10c9050c4479b387283be8 (patch) | |
tree | 754d9fe5d15db31497e45d542e816895d20a7e92 /drivers/mfd | |
parent | e83ddb335468cdd9ea6e9767eb30b64d8ff176ce (diff) | |
parent | 120be663285f80e3501e36ccbb92e7143585fd93 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6: (22 commits)
regulator: Remove default DEBUG define from TPS6586x
regulator: tps6507x - add missing platform_set_drvdata in tps6507x_pmic_probe
regulator: tps6586x - add regulator_unregister() in tps6586x_regulator_remove()
mfd: max8998 - fix incorrect kfree(i2c) in i2c_driver probe callback handler
regulator: lp3971 - remove unnecessary ret value checking in lp3971_i2c_write()
regulator: max8660 - fix a memory leak in max8660_remove()
regulator: max1586 - fix a memory leak in max1586_pmic_remove()
regulator: Default GPIO controlled WM8994 regulators to disabled
regulator: lp3971 - remove unnecessary ret value checking in lp3971_i2c_write()
max8998: fix off-by-one value range checking
regulator: tps6586x: fix millivolt return values and SM2 table
regulator: tps6586x: add dependancy on MFD_TPS6585x
regulator: add TPS6586X regulator driver
regulator: MAX8998: set_voltage bugfix. ramp_up delay and min/max voltage
regulator: add support for regulators on the ab8500 MFD
ab8500-mfd: add regulator support to ab8500 mfd device
tps65023: Allow registering similar TPS65021
drivers: regulators: depend on MFD_MAX8998
drivers: regulator: add Maxim 8998 driver
ISL6271A voltage regulator support.
...
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/Kconfig | 10 | ||||
-rw-r--r-- | drivers/mfd/Makefile | 1 | ||||
-rw-r--r-- | drivers/mfd/ab8500-core.c | 4 | ||||
-rw-r--r-- | drivers/mfd/max8998.c | 158 |
4 files changed, 172 insertions, 1 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index d75909e7cf2f..db51ea1c6082 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -293,6 +293,16 @@ config MFD_MAX8925 | |||
293 | accessing the device, additional drivers must be enabled in order | 293 | accessing the device, additional drivers must be enabled in order |
294 | to use the functionality of the device. | 294 | to use the functionality of the device. |
295 | 295 | ||
296 | config MFD_MAX8998 | ||
297 | bool "Maxim Semiconductor MAX8998 PMIC Support" | ||
298 | depends on I2C=y | ||
299 | select MFD_CORE | ||
300 | help | ||
301 | Say yes here to support for Maxim Semiconductor MAX8998. This is | ||
302 | a Power Management IC. This driver provies common support for | ||
303 | accessing the device, additional drivers must be enabled in order | ||
304 | to use the functionality of the device. | ||
305 | |||
296 | config MFD_WM8400 | 306 | config MFD_WM8400 |
297 | tristate "Support Wolfson Microelectronics WM8400" | 307 | tristate "Support Wolfson Microelectronics WM8400" |
298 | select MFD_CORE | 308 | select MFD_CORE |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 1e48d7e3e884..feaeeaeeddb7 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -58,6 +58,7 @@ obj-$(CONFIG_UCB1400_CORE) += ucb1400_core.o | |||
58 | obj-$(CONFIG_PMIC_DA903X) += da903x.o | 58 | obj-$(CONFIG_PMIC_DA903X) += da903x.o |
59 | max8925-objs := max8925-core.o max8925-i2c.o | 59 | max8925-objs := max8925-core.o max8925-i2c.o |
60 | obj-$(CONFIG_MFD_MAX8925) += max8925.o | 60 | obj-$(CONFIG_MFD_MAX8925) += max8925.o |
61 | obj-$(CONFIG_MFD_MAX8998) += max8998.o | ||
61 | 62 | ||
62 | pcf50633-objs := pcf50633-core.o pcf50633-irq.o | 63 | pcf50633-objs := pcf50633-core.o pcf50633-irq.o |
63 | obj-$(CONFIG_MFD_PCF50633) += pcf50633.o | 64 | obj-$(CONFIG_MFD_PCF50633) += pcf50633.o |
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index f3d26fa9c34d..defa786dee34 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/mfd/core.h> | 17 | #include <linux/mfd/core.h> |
18 | #include <linux/mfd/ab8500.h> | 18 | #include <linux/mfd/ab8500.h> |
19 | #include <linux/regulator/ab8500.h> | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * Interrupt register offsets | 22 | * Interrupt register offsets |
@@ -352,6 +353,7 @@ static struct mfd_cell ab8500_devs[] = { | |||
352 | { .name = "ab8500-audio", }, | 353 | { .name = "ab8500-audio", }, |
353 | { .name = "ab8500-usb", }, | 354 | { .name = "ab8500-usb", }, |
354 | { .name = "ab8500-pwm", }, | 355 | { .name = "ab8500-pwm", }, |
356 | { .name = "ab8500-regulator", }, | ||
355 | }; | 357 | }; |
356 | 358 | ||
357 | int __devinit ab8500_init(struct ab8500 *ab8500) | 359 | int __devinit ab8500_init(struct ab8500 *ab8500) |
@@ -411,7 +413,7 @@ int __devinit ab8500_init(struct ab8500 *ab8500) | |||
411 | goto out_removeirq; | 413 | goto out_removeirq; |
412 | } | 414 | } |
413 | 415 | ||
414 | ret = mfd_add_devices(ab8500->dev, -1, ab8500_devs, | 416 | ret = mfd_add_devices(ab8500->dev, 0, ab8500_devs, |
415 | ARRAY_SIZE(ab8500_devs), NULL, | 417 | ARRAY_SIZE(ab8500_devs), NULL, |
416 | ab8500->irq_base); | 418 | ab8500->irq_base); |
417 | if (ret) | 419 | if (ret) |
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c new file mode 100644 index 000000000000..73e6f5c4efc9 --- /dev/null +++ b/drivers/mfd/max8998.c | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | * max8698.c - mfd core driver for the Maxim 8998 | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Samsung Electronics | ||
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 | #include <linux/module.h> | ||
24 | #include <linux/moduleparam.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/i2c.h> | ||
28 | #include <linux/mutex.h> | ||
29 | #include <linux/mfd/core.h> | ||
30 | #include <linux/mfd/max8998.h> | ||
31 | #include <linux/mfd/max8998-private.h> | ||
32 | |||
33 | static struct mfd_cell max8998_devs[] = { | ||
34 | { | ||
35 | .name = "max8998-pmic", | ||
36 | } | ||
37 | }; | ||
38 | |||
39 | static int max8998_i2c_device_read(struct max8998_dev *max8998, u8 reg, u8 *dest) | ||
40 | { | ||
41 | struct i2c_client *client = max8998->i2c_client; | ||
42 | int ret; | ||
43 | |||
44 | mutex_lock(&max8998->iolock); | ||
45 | ret = i2c_smbus_read_byte_data(client, reg); | ||
46 | mutex_unlock(&max8998->iolock); | ||
47 | if (ret < 0) | ||
48 | return ret; | ||
49 | |||
50 | ret &= 0xff; | ||
51 | *dest = ret; | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static int max8998_i2c_device_write(struct max8998_dev *max8998, u8 reg, u8 value) | ||
56 | { | ||
57 | struct i2c_client *client = max8998->i2c_client; | ||
58 | int ret; | ||
59 | |||
60 | mutex_lock(&max8998->iolock); | ||
61 | ret = i2c_smbus_write_byte_data(client, reg, value); | ||
62 | mutex_unlock(&max8998->iolock); | ||
63 | return ret; | ||
64 | } | ||
65 | |||
66 | static int max8998_i2c_device_update(struct max8998_dev *max8998, u8 reg, | ||
67 | u8 val, u8 mask) | ||
68 | { | ||
69 | struct i2c_client *client = max8998->i2c_client; | ||
70 | int ret; | ||
71 | |||
72 | mutex_lock(&max8998->iolock); | ||
73 | ret = i2c_smbus_read_byte_data(client, reg); | ||
74 | if (ret >= 0) { | ||
75 | u8 old_val = ret & 0xff; | ||
76 | u8 new_val = (val & mask) | (old_val & (~mask)); | ||
77 | ret = i2c_smbus_write_byte_data(client, reg, new_val); | ||
78 | if (ret >= 0) | ||
79 | ret = 0; | ||
80 | } | ||
81 | mutex_unlock(&max8998->iolock); | ||
82 | return ret; | ||
83 | } | ||
84 | |||
85 | static int max8998_i2c_probe(struct i2c_client *i2c, | ||
86 | const struct i2c_device_id *id) | ||
87 | { | ||
88 | struct max8998_dev *max8998; | ||
89 | int ret = 0; | ||
90 | |||
91 | max8998 = kzalloc(sizeof(struct max8998_dev), GFP_KERNEL); | ||
92 | if (max8998 == NULL) | ||
93 | return -ENOMEM; | ||
94 | |||
95 | i2c_set_clientdata(i2c, max8998); | ||
96 | max8998->dev = &i2c->dev; | ||
97 | max8998->i2c_client = i2c; | ||
98 | max8998->dev_read = max8998_i2c_device_read; | ||
99 | max8998->dev_write = max8998_i2c_device_write; | ||
100 | max8998->dev_update = max8998_i2c_device_update; | ||
101 | mutex_init(&max8998->iolock); | ||
102 | |||
103 | ret = mfd_add_devices(max8998->dev, -1, | ||
104 | max8998_devs, ARRAY_SIZE(max8998_devs), | ||
105 | NULL, 0); | ||
106 | if (ret < 0) | ||
107 | goto err; | ||
108 | |||
109 | return ret; | ||
110 | |||
111 | err: | ||
112 | mfd_remove_devices(max8998->dev); | ||
113 | kfree(max8998); | ||
114 | return ret; | ||
115 | } | ||
116 | |||
117 | static int max8998_i2c_remove(struct i2c_client *i2c) | ||
118 | { | ||
119 | struct max8998_dev *max8998 = i2c_get_clientdata(i2c); | ||
120 | |||
121 | mfd_remove_devices(max8998->dev); | ||
122 | kfree(max8998); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static const struct i2c_device_id max8998_i2c_id[] = { | ||
128 | { "max8998", 0 }, | ||
129 | { } | ||
130 | }; | ||
131 | MODULE_DEVICE_TABLE(i2c, max8998_i2c_id); | ||
132 | |||
133 | static struct i2c_driver max8998_i2c_driver = { | ||
134 | .driver = { | ||
135 | .name = "max8998", | ||
136 | .owner = THIS_MODULE, | ||
137 | }, | ||
138 | .probe = max8998_i2c_probe, | ||
139 | .remove = max8998_i2c_remove, | ||
140 | .id_table = max8998_i2c_id, | ||
141 | }; | ||
142 | |||
143 | static int __init max8998_i2c_init(void) | ||
144 | { | ||
145 | return i2c_add_driver(&max8998_i2c_driver); | ||
146 | } | ||
147 | /* init early so consumer devices can complete system boot */ | ||
148 | subsys_initcall(max8998_i2c_init); | ||
149 | |||
150 | static void __exit max8998_i2c_exit(void) | ||
151 | { | ||
152 | i2c_del_driver(&max8998_i2c_driver); | ||
153 | } | ||
154 | module_exit(max8998_i2c_exit); | ||
155 | |||
156 | MODULE_DESCRIPTION("MAXIM 8998 multi-function core driver"); | ||
157 | MODULE_AUTHOR("Kyungmin Park <kyungmin.park@samsung.com>"); | ||
158 | MODULE_LICENSE("GPL"); | ||