diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-15 19:37:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-15 19:37:40 -0500 |
commit | db0b2d01163cc3050eb52a979541e0d16553be48 (patch) | |
tree | 2a4370fc568e444c98913100b2a520035cc99930 /drivers/mfd | |
parent | 16cd9d1c0f149ee0c8073de037e7c57886234aa0 (diff) | |
parent | 90b128ed1557c2f523995a379a53e5105891ecf8 (diff) |
Merge tag 'mfd-3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next
Pull MFD updates from Samuel Ortiz:
"For the 3.13 merge window we have a couple of new drivers for the AMS
AS3722 PMIC and for STMicroelectronics STw481x PMIC.
Although this is a smaller update than usual, we also have:
- Device tree support for the max77693 driver
- linux/of.h inclusion for all DT compatible MFD drivers, to avoid
build breakage in the future
- Support for Intel Wildcat Point-LP PCH through the lpc_ich driver
- A small arizona update for new wm5110 DSP registers and a few fixes
- A small palmas update as well, including an of_device table
addition and a few minor fixes
- Two small mfd-core changes, one including a memory leak fix for
when mfd_add_device() fails
- Our usual round of minor cleanups and janitorial fixes"
* tag 'mfd-3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next: (63 commits)
Documentation: mfd: Update s2mps11.txt
mfd: pm8921: Potential NULL dereference in pm8921_remove()
mfd: Fix memory leak in mfd_add_devices()
mfd: Stop setting refcounting pointers in original mfd_cell arrays
mfd: wm5110: Enable micd clamp functionality
mfd: lpc_ich: Add Device IDs for Intel Wildcat Point-LP PCH
mfd: max77693: Fix up bug of wrong interrupt number
mfd: as3722: Don't export the regmap config
mfd: twl6040: Remove obsolete cleanup for i2c clientdata
mfd: tps65910: Remove warning during dt node parsing
mfd: lpc_sch: Ignore resource conflicts when adding mfd cells
mfd: ti_am335x_tscadc: Avoid possible deadlock of reg_lock
mfd: syscon: Return -ENOSYS if CONFIG_MFD_SYSCON is not enabled
mfd: Add support for ams AS3722 PMIC
mfd: max77693: Include linux/of.h header
mfd: tc3589x: Detect the precise version
mfd: omap-usb: prepare/unprepare clock while enable/disable
mfd: max77686: Include linux/of.h header
mfd: max8907: Include linux/of.h header
mfd: max8997: Include linux/of.h header
...
Diffstat (limited to 'drivers/mfd')
43 files changed, 994 insertions, 198 deletions
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 7ebe9ef1eba6..c9b1f6422941 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c | |||
@@ -1247,7 +1247,7 @@ static struct i2c_driver pm860x_driver = { | |||
1247 | .name = "88PM860x", | 1247 | .name = "88PM860x", |
1248 | .owner = THIS_MODULE, | 1248 | .owner = THIS_MODULE, |
1249 | .pm = &pm860x_pm_ops, | 1249 | .pm = &pm860x_pm_ops, |
1250 | .of_match_table = of_match_ptr(pm860x_dt_ids), | 1250 | .of_match_table = pm860x_dt_ids, |
1251 | }, | 1251 | }, |
1252 | .probe = pm860x_probe, | 1252 | .probe = pm860x_probe, |
1253 | .remove = pm860x_remove, | 1253 | .remove = pm860x_remove, |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 914c3d142f78..b7c74a73d371 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -27,6 +27,18 @@ config MFD_AS3711 | |||
27 | help | 27 | help |
28 | Support for the AS3711 PMIC from AMS | 28 | Support for the AS3711 PMIC from AMS |
29 | 29 | ||
30 | config MFD_AS3722 | ||
31 | bool "ams AS3722 Power Management IC" | ||
32 | select MFD_CORE | ||
33 | select REGMAP_I2C | ||
34 | select REGMAP_IRQ | ||
35 | depends on I2C && OF | ||
36 | help | ||
37 | The ams AS3722 is a compact system PMU suitable for mobile phones, | ||
38 | tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down | ||
39 | controllers, 11 LDOs, RTC, automatic battery, temperature and | ||
40 | over current monitoring, GPIOs, ADC and a watchdog. | ||
41 | |||
30 | config PMIC_ADP5520 | 42 | config PMIC_ADP5520 |
31 | bool "Analog Devices ADP5520/01 MFD PMIC Core Support" | 43 | bool "Analog Devices ADP5520/01 MFD PMIC Core Support" |
32 | depends on I2C=y | 44 | depends on I2C=y |
@@ -1151,6 +1163,16 @@ config MFD_WM8994 | |||
1151 | core support for the WM8994, in order to use the actual | 1163 | core support for the WM8994, in order to use the actual |
1152 | functionaltiy of the device other drivers must be enabled. | 1164 | functionaltiy of the device other drivers must be enabled. |
1153 | 1165 | ||
1166 | config MFD_STW481X | ||
1167 | bool "Support for ST Microelectronics STw481x" | ||
1168 | depends on I2C && ARCH_NOMADIK | ||
1169 | select REGMAP_I2C | ||
1170 | select MFD_CORE | ||
1171 | help | ||
1172 | Select this option to enable the STw481x chip driver used | ||
1173 | in various ST Microelectronics and ST-Ericsson embedded | ||
1174 | Nomadik series. | ||
1175 | |||
1154 | endmenu | 1176 | endmenu |
1155 | endif | 1177 | endif |
1156 | 1178 | ||
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 15b905c6553c..8a28dc90fe78 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -162,3 +162,5 @@ obj-$(CONFIG_MFD_LM3533) += lm3533-core.o lm3533-ctrlbank.o | |||
162 | obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o vexpress-sysreg.o | 162 | obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o vexpress-sysreg.o |
163 | obj-$(CONFIG_MFD_RETU) += retu-mfd.o | 163 | obj-$(CONFIG_MFD_RETU) += retu-mfd.o |
164 | obj-$(CONFIG_MFD_AS3711) += as3711.o | 164 | obj-$(CONFIG_MFD_AS3711) += as3711.o |
165 | obj-$(CONFIG_MFD_AS3722) += as3722.o | ||
166 | obj-$(CONFIG_MFD_STW481X) += stw481x.o | ||
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index 6f68472e0ca6..14d9542a4eed 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c | |||
@@ -293,7 +293,7 @@ static ssize_t aat2870_reg_write_file(struct file *file, | |||
293 | unsigned long addr, val; | 293 | unsigned long addr, val; |
294 | int ret; | 294 | int ret; |
295 | 295 | ||
296 | buf_size = min(count, (sizeof(buf)-1)); | 296 | buf_size = min(count, (size_t)(sizeof(buf)-1)); |
297 | if (copy_from_user(buf, user_buf, buf_size)) { | 297 | if (copy_from_user(buf, user_buf, buf_size)) { |
298 | dev_err(aat2870->dev, "Failed to copy from user\n"); | 298 | dev_err(aat2870->dev, "Failed to copy from user\n"); |
299 | return -EFAULT; | 299 | return -EFAULT; |
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 022b1863d36c..75e180ceecf3 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c | |||
@@ -540,7 +540,7 @@ static int arizona_of_get_core_pdata(struct arizona *arizona) | |||
540 | for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) { | 540 | for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) { |
541 | if (arizona->pdata.gpio_defaults[i] > 0xffff) | 541 | if (arizona->pdata.gpio_defaults[i] > 0xffff) |
542 | arizona->pdata.gpio_defaults[i] = 0; | 542 | arizona->pdata.gpio_defaults[i] = 0; |
543 | if (arizona->pdata.gpio_defaults[i] == 0) | 543 | else if (arizona->pdata.gpio_defaults[i] == 0) |
544 | arizona->pdata.gpio_defaults[i] = 0x10000; | 544 | arizona->pdata.gpio_defaults[i] = 0x10000; |
545 | } | 545 | } |
546 | } else { | 546 | } else { |
@@ -633,11 +633,11 @@ int arizona_dev_init(struct arizona *arizona) | |||
633 | dev_set_drvdata(arizona->dev, arizona); | 633 | dev_set_drvdata(arizona->dev, arizona); |
634 | mutex_init(&arizona->clk_lock); | 634 | mutex_init(&arizona->clk_lock); |
635 | 635 | ||
636 | arizona_of_get_core_pdata(arizona); | ||
637 | |||
638 | if (dev_get_platdata(arizona->dev)) | 636 | if (dev_get_platdata(arizona->dev)) |
639 | memcpy(&arizona->pdata, dev_get_platdata(arizona->dev), | 637 | memcpy(&arizona->pdata, dev_get_platdata(arizona->dev), |
640 | sizeof(arizona->pdata)); | 638 | sizeof(arizona->pdata)); |
639 | else | ||
640 | arizona_of_get_core_pdata(arizona); | ||
641 | 641 | ||
642 | regcache_cache_only(arizona->regmap, true); | 642 | regcache_cache_only(arizona->regmap, true); |
643 | 643 | ||
diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c index 51dbabf7c021..beccb790c9ba 100644 --- a/drivers/mfd/arizona-i2c.c +++ b/drivers/mfd/arizona-i2c.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/regmap.h> | 17 | #include <linux/regmap.h> |
18 | #include <linux/regulator/consumer.h> | 18 | #include <linux/regulator/consumer.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/of.h> | ||
20 | 21 | ||
21 | #include <linux/mfd/arizona/core.h> | 22 | #include <linux/mfd/arizona/core.h> |
22 | 23 | ||
diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c index 47be7b35b5c5..1ca554b18bef 100644 --- a/drivers/mfd/arizona-spi.c +++ b/drivers/mfd/arizona-spi.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/regulator/consumer.h> | 17 | #include <linux/regulator/consumer.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/spi/spi.h> | 19 | #include <linux/spi/spi.h> |
20 | #include <linux/of.h> | ||
20 | 21 | ||
21 | #include <linux/mfd/arizona/core.h> | 22 | #include <linux/mfd/arizona/core.h> |
22 | 23 | ||
diff --git a/drivers/mfd/as3711.c b/drivers/mfd/as3711.c index abd3ab7c0908..ec684fcedb42 100644 --- a/drivers/mfd/as3711.c +++ b/drivers/mfd/as3711.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/mfd/as3711.h> | 17 | #include <linux/mfd/as3711.h> |
18 | #include <linux/mfd/core.h> | 18 | #include <linux/mfd/core.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/of.h> | ||
20 | #include <linux/regmap.h> | 21 | #include <linux/regmap.h> |
21 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
22 | 23 | ||
diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c new file mode 100644 index 000000000000..f161f2e00df7 --- /dev/null +++ b/drivers/mfd/as3722.c | |||
@@ -0,0 +1,449 @@ | |||
1 | /* | ||
2 | * Core driver for ams AS3722 PMICs | ||
3 | * | ||
4 | * Copyright (C) 2013 AMS AG | ||
5 | * Copyright (c) 2013, NVIDIA Corporation. All rights reserved. | ||
6 | * | ||
7 | * Author: Florian Lobmaier <florian.lobmaier@ams.com> | ||
8 | * Author: Laxman Dewangan <ldewangan@nvidia.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #include <linux/err.h> | ||
26 | #include <linux/i2c.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/irq.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/mfd/core.h> | ||
32 | #include <linux/mfd/as3722.h> | ||
33 | #include <linux/of.h> | ||
34 | #include <linux/regmap.h> | ||
35 | #include <linux/slab.h> | ||
36 | |||
37 | #define AS3722_DEVICE_ID 0x0C | ||
38 | |||
39 | static const struct resource as3722_rtc_resource[] = { | ||
40 | { | ||
41 | .name = "as3722-rtc-alarm", | ||
42 | .start = AS3722_IRQ_RTC_ALARM, | ||
43 | .end = AS3722_IRQ_RTC_ALARM, | ||
44 | .flags = IORESOURCE_IRQ, | ||
45 | }, | ||
46 | }; | ||
47 | |||
48 | static const struct resource as3722_adc_resource[] = { | ||
49 | { | ||
50 | .name = "as3722-adc", | ||
51 | .start = AS3722_IRQ_ADC, | ||
52 | .end = AS3722_IRQ_ADC, | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | static struct mfd_cell as3722_devs[] = { | ||
58 | { | ||
59 | .name = "as3722-pinctrl", | ||
60 | }, | ||
61 | { | ||
62 | .name = "as3722-regulator", | ||
63 | }, | ||
64 | { | ||
65 | .name = "as3722-rtc", | ||
66 | .num_resources = ARRAY_SIZE(as3722_rtc_resource), | ||
67 | .resources = as3722_rtc_resource, | ||
68 | }, | ||
69 | { | ||
70 | .name = "as3722-adc", | ||
71 | .num_resources = ARRAY_SIZE(as3722_adc_resource), | ||
72 | .resources = as3722_adc_resource, | ||
73 | }, | ||
74 | { | ||
75 | .name = "as3722-power-off", | ||
76 | }, | ||
77 | }; | ||
78 | |||
79 | static const struct regmap_irq as3722_irqs[] = { | ||
80 | /* INT1 IRQs */ | ||
81 | [AS3722_IRQ_LID] = { | ||
82 | .mask = AS3722_INTERRUPT_MASK1_LID, | ||
83 | }, | ||
84 | [AS3722_IRQ_ACOK] = { | ||
85 | .mask = AS3722_INTERRUPT_MASK1_ACOK, | ||
86 | }, | ||
87 | [AS3722_IRQ_ENABLE1] = { | ||
88 | .mask = AS3722_INTERRUPT_MASK1_ENABLE1, | ||
89 | }, | ||
90 | [AS3722_IRQ_OCCUR_ALARM_SD0] = { | ||
91 | .mask = AS3722_INTERRUPT_MASK1_OCURR_ALARM_SD0, | ||
92 | }, | ||
93 | [AS3722_IRQ_ONKEY_LONG_PRESS] = { | ||
94 | .mask = AS3722_INTERRUPT_MASK1_ONKEY_LONG, | ||
95 | }, | ||
96 | [AS3722_IRQ_ONKEY] = { | ||
97 | .mask = AS3722_INTERRUPT_MASK1_ONKEY, | ||
98 | }, | ||
99 | [AS3722_IRQ_OVTMP] = { | ||
100 | .mask = AS3722_INTERRUPT_MASK1_OVTMP, | ||
101 | }, | ||
102 | [AS3722_IRQ_LOWBAT] = { | ||
103 | .mask = AS3722_INTERRUPT_MASK1_LOWBAT, | ||
104 | }, | ||
105 | |||
106 | /* INT2 IRQs */ | ||
107 | [AS3722_IRQ_SD0_LV] = { | ||
108 | .mask = AS3722_INTERRUPT_MASK2_SD0_LV, | ||
109 | .reg_offset = 1, | ||
110 | }, | ||
111 | [AS3722_IRQ_SD1_LV] = { | ||
112 | .mask = AS3722_INTERRUPT_MASK2_SD1_LV, | ||
113 | .reg_offset = 1, | ||
114 | }, | ||
115 | [AS3722_IRQ_SD2_LV] = { | ||
116 | .mask = AS3722_INTERRUPT_MASK2_SD2345_LV, | ||
117 | .reg_offset = 1, | ||
118 | }, | ||
119 | [AS3722_IRQ_PWM1_OV_PROT] = { | ||
120 | .mask = AS3722_INTERRUPT_MASK2_PWM1_OV_PROT, | ||
121 | .reg_offset = 1, | ||
122 | }, | ||
123 | [AS3722_IRQ_PWM2_OV_PROT] = { | ||
124 | .mask = AS3722_INTERRUPT_MASK2_PWM2_OV_PROT, | ||
125 | .reg_offset = 1, | ||
126 | }, | ||
127 | [AS3722_IRQ_ENABLE2] = { | ||
128 | .mask = AS3722_INTERRUPT_MASK2_ENABLE2, | ||
129 | .reg_offset = 1, | ||
130 | }, | ||
131 | [AS3722_IRQ_SD6_LV] = { | ||
132 | .mask = AS3722_INTERRUPT_MASK2_SD6_LV, | ||
133 | .reg_offset = 1, | ||
134 | }, | ||
135 | [AS3722_IRQ_RTC_REP] = { | ||
136 | .mask = AS3722_INTERRUPT_MASK2_RTC_REP, | ||
137 | .reg_offset = 1, | ||
138 | }, | ||
139 | |||
140 | /* INT3 IRQs */ | ||
141 | [AS3722_IRQ_RTC_ALARM] = { | ||
142 | .mask = AS3722_INTERRUPT_MASK3_RTC_ALARM, | ||
143 | .reg_offset = 2, | ||
144 | }, | ||
145 | [AS3722_IRQ_GPIO1] = { | ||
146 | .mask = AS3722_INTERRUPT_MASK3_GPIO1, | ||
147 | .reg_offset = 2, | ||
148 | }, | ||
149 | [AS3722_IRQ_GPIO2] = { | ||
150 | .mask = AS3722_INTERRUPT_MASK3_GPIO2, | ||
151 | .reg_offset = 2, | ||
152 | }, | ||
153 | [AS3722_IRQ_GPIO3] = { | ||
154 | .mask = AS3722_INTERRUPT_MASK3_GPIO3, | ||
155 | .reg_offset = 2, | ||
156 | }, | ||
157 | [AS3722_IRQ_GPIO4] = { | ||
158 | .mask = AS3722_INTERRUPT_MASK3_GPIO4, | ||
159 | .reg_offset = 2, | ||
160 | }, | ||
161 | [AS3722_IRQ_GPIO5] = { | ||
162 | .mask = AS3722_INTERRUPT_MASK3_GPIO5, | ||
163 | .reg_offset = 2, | ||
164 | }, | ||
165 | [AS3722_IRQ_WATCHDOG] = { | ||
166 | .mask = AS3722_INTERRUPT_MASK3_WATCHDOG, | ||
167 | .reg_offset = 2, | ||
168 | }, | ||
169 | [AS3722_IRQ_ENABLE3] = { | ||
170 | .mask = AS3722_INTERRUPT_MASK3_ENABLE3, | ||
171 | .reg_offset = 2, | ||
172 | }, | ||
173 | |||
174 | /* INT4 IRQs */ | ||
175 | [AS3722_IRQ_TEMP_SD0_SHUTDOWN] = { | ||
176 | .mask = AS3722_INTERRUPT_MASK4_TEMP_SD0_SHUTDOWN, | ||
177 | .reg_offset = 3, | ||
178 | }, | ||
179 | [AS3722_IRQ_TEMP_SD1_SHUTDOWN] = { | ||
180 | .mask = AS3722_INTERRUPT_MASK4_TEMP_SD1_SHUTDOWN, | ||
181 | .reg_offset = 3, | ||
182 | }, | ||
183 | [AS3722_IRQ_TEMP_SD2_SHUTDOWN] = { | ||
184 | .mask = AS3722_INTERRUPT_MASK4_TEMP_SD6_SHUTDOWN, | ||
185 | .reg_offset = 3, | ||
186 | }, | ||
187 | [AS3722_IRQ_TEMP_SD0_ALARM] = { | ||
188 | .mask = AS3722_INTERRUPT_MASK4_TEMP_SD0_ALARM, | ||
189 | .reg_offset = 3, | ||
190 | }, | ||
191 | [AS3722_IRQ_TEMP_SD1_ALARM] = { | ||
192 | .mask = AS3722_INTERRUPT_MASK4_TEMP_SD1_ALARM, | ||
193 | .reg_offset = 3, | ||
194 | }, | ||
195 | [AS3722_IRQ_TEMP_SD6_ALARM] = { | ||
196 | .mask = AS3722_INTERRUPT_MASK4_TEMP_SD6_ALARM, | ||
197 | .reg_offset = 3, | ||
198 | }, | ||
199 | [AS3722_IRQ_OCCUR_ALARM_SD6] = { | ||
200 | .mask = AS3722_INTERRUPT_MASK4_OCCUR_ALARM_SD6, | ||
201 | .reg_offset = 3, | ||
202 | }, | ||
203 | [AS3722_IRQ_ADC] = { | ||
204 | .mask = AS3722_INTERRUPT_MASK4_ADC, | ||
205 | .reg_offset = 3, | ||
206 | }, | ||
207 | }; | ||
208 | |||
209 | static const struct regmap_irq_chip as3722_irq_chip = { | ||
210 | .name = "as3722", | ||
211 | .irqs = as3722_irqs, | ||
212 | .num_irqs = ARRAY_SIZE(as3722_irqs), | ||
213 | .num_regs = 4, | ||
214 | .status_base = AS3722_INTERRUPT_STATUS1_REG, | ||
215 | .mask_base = AS3722_INTERRUPT_MASK1_REG, | ||
216 | }; | ||
217 | |||
218 | static int as3722_check_device_id(struct as3722 *as3722) | ||
219 | { | ||
220 | u32 val; | ||
221 | int ret; | ||
222 | |||
223 | /* Check that this is actually a AS3722 */ | ||
224 | ret = as3722_read(as3722, AS3722_ASIC_ID1_REG, &val); | ||
225 | if (ret < 0) { | ||
226 | dev_err(as3722->dev, "ASIC_ID1 read failed: %d\n", ret); | ||
227 | return ret; | ||
228 | } | ||
229 | |||
230 | if (val != AS3722_DEVICE_ID) { | ||
231 | dev_err(as3722->dev, "Device is not AS3722, ID is 0x%x\n", val); | ||
232 | return -ENODEV; | ||
233 | } | ||
234 | |||
235 | ret = as3722_read(as3722, AS3722_ASIC_ID2_REG, &val); | ||
236 | if (ret < 0) { | ||
237 | dev_err(as3722->dev, "ASIC_ID2 read failed: %d\n", ret); | ||
238 | return ret; | ||
239 | } | ||
240 | |||
241 | dev_info(as3722->dev, "AS3722 with revision 0x%x found\n", val); | ||
242 | return 0; | ||
243 | } | ||
244 | |||
245 | static int as3722_configure_pullups(struct as3722 *as3722) | ||
246 | { | ||
247 | int ret; | ||
248 | u32 val = 0; | ||
249 | |||
250 | if (as3722->en_intern_int_pullup) | ||
251 | val |= AS3722_INT_PULL_UP; | ||
252 | if (as3722->en_intern_i2c_pullup) | ||
253 | val |= AS3722_I2C_PULL_UP; | ||
254 | |||
255 | ret = as3722_update_bits(as3722, AS3722_IOVOLTAGE_REG, | ||
256 | AS3722_INT_PULL_UP | AS3722_I2C_PULL_UP, val); | ||
257 | if (ret < 0) | ||
258 | dev_err(as3722->dev, "IOVOLTAGE_REG update failed: %d\n", ret); | ||
259 | return ret; | ||
260 | } | ||
261 | |||
262 | static const struct regmap_range as3722_readable_ranges[] = { | ||
263 | regmap_reg_range(AS3722_SD0_VOLTAGE_REG, AS3722_SD6_VOLTAGE_REG), | ||
264 | regmap_reg_range(AS3722_GPIO0_CONTROL_REG, AS3722_LDO7_VOLTAGE_REG), | ||
265 | regmap_reg_range(AS3722_LDO9_VOLTAGE_REG, AS3722_REG_SEQU_MOD3_REG), | ||
266 | regmap_reg_range(AS3722_SD_PHSW_CTRL_REG, AS3722_PWM_CONTROL_H_REG), | ||
267 | regmap_reg_range(AS3722_WATCHDOG_TIMER_REG, AS3722_WATCHDOG_TIMER_REG), | ||
268 | regmap_reg_range(AS3722_WATCHDOG_SOFTWARE_SIGNAL_REG, | ||
269 | AS3722_BATTERY_VOLTAGE_MONITOR2_REG), | ||
270 | regmap_reg_range(AS3722_SD_CONTROL_REG, AS3722_PWM_VCONTROL4_REG), | ||
271 | regmap_reg_range(AS3722_BB_CHARGER_REG, AS3722_SRAM_REG), | ||
272 | regmap_reg_range(AS3722_RTC_ACCESS_REG, AS3722_RTC_ACCESS_REG), | ||
273 | regmap_reg_range(AS3722_RTC_STATUS_REG, AS3722_TEMP_STATUS_REG), | ||
274 | regmap_reg_range(AS3722_ADC0_CONTROL_REG, AS3722_ADC_CONFIGURATION_REG), | ||
275 | regmap_reg_range(AS3722_ASIC_ID1_REG, AS3722_ASIC_ID2_REG), | ||
276 | regmap_reg_range(AS3722_LOCK_REG, AS3722_LOCK_REG), | ||
277 | }; | ||
278 | |||
279 | static const struct regmap_access_table as3722_readable_table = { | ||
280 | .yes_ranges = as3722_readable_ranges, | ||
281 | .n_yes_ranges = ARRAY_SIZE(as3722_readable_ranges), | ||
282 | }; | ||
283 | |||
284 | static const struct regmap_range as3722_writable_ranges[] = { | ||
285 | regmap_reg_range(AS3722_SD0_VOLTAGE_REG, AS3722_SD6_VOLTAGE_REG), | ||
286 | regmap_reg_range(AS3722_GPIO0_CONTROL_REG, AS3722_LDO7_VOLTAGE_REG), | ||
287 | regmap_reg_range(AS3722_LDO9_VOLTAGE_REG, AS3722_GPIO_SIGNAL_OUT_REG), | ||
288 | regmap_reg_range(AS3722_REG_SEQU_MOD1_REG, AS3722_REG_SEQU_MOD3_REG), | ||
289 | regmap_reg_range(AS3722_SD_PHSW_CTRL_REG, AS3722_PWM_CONTROL_H_REG), | ||
290 | regmap_reg_range(AS3722_WATCHDOG_TIMER_REG, AS3722_WATCHDOG_TIMER_REG), | ||
291 | regmap_reg_range(AS3722_WATCHDOG_SOFTWARE_SIGNAL_REG, | ||
292 | AS3722_BATTERY_VOLTAGE_MONITOR2_REG), | ||
293 | regmap_reg_range(AS3722_SD_CONTROL_REG, AS3722_PWM_VCONTROL4_REG), | ||
294 | regmap_reg_range(AS3722_BB_CHARGER_REG, AS3722_SRAM_REG), | ||
295 | regmap_reg_range(AS3722_INTERRUPT_MASK1_REG, AS3722_TEMP_STATUS_REG), | ||
296 | regmap_reg_range(AS3722_ADC0_CONTROL_REG, AS3722_ADC1_CONTROL_REG), | ||
297 | regmap_reg_range(AS3722_ADC1_THRESHOLD_HI_MSB_REG, | ||
298 | AS3722_ADC_CONFIGURATION_REG), | ||
299 | regmap_reg_range(AS3722_LOCK_REG, AS3722_LOCK_REG), | ||
300 | }; | ||
301 | |||
302 | static const struct regmap_access_table as3722_writable_table = { | ||
303 | .yes_ranges = as3722_writable_ranges, | ||
304 | .n_yes_ranges = ARRAY_SIZE(as3722_writable_ranges), | ||
305 | }; | ||
306 | |||
307 | static const struct regmap_range as3722_cacheable_ranges[] = { | ||
308 | regmap_reg_range(AS3722_SD0_VOLTAGE_REG, AS3722_LDO11_VOLTAGE_REG), | ||
309 | regmap_reg_range(AS3722_SD_CONTROL_REG, AS3722_LDOCONTROL1_REG), | ||
310 | }; | ||
311 | |||
312 | static const struct regmap_access_table as3722_volatile_table = { | ||
313 | .no_ranges = as3722_cacheable_ranges, | ||
314 | .n_no_ranges = ARRAY_SIZE(as3722_cacheable_ranges), | ||
315 | }; | ||
316 | |||
317 | static const struct regmap_config as3722_regmap_config = { | ||
318 | .reg_bits = 8, | ||
319 | .val_bits = 8, | ||
320 | .max_register = AS3722_MAX_REGISTER, | ||
321 | .cache_type = REGCACHE_RBTREE, | ||
322 | .rd_table = &as3722_readable_table, | ||
323 | .wr_table = &as3722_writable_table, | ||
324 | .volatile_table = &as3722_volatile_table, | ||
325 | }; | ||
326 | |||
327 | static int as3722_i2c_of_probe(struct i2c_client *i2c, | ||
328 | struct as3722 *as3722) | ||
329 | { | ||
330 | struct device_node *np = i2c->dev.of_node; | ||
331 | struct irq_data *irq_data; | ||
332 | |||
333 | if (!np) { | ||
334 | dev_err(&i2c->dev, "Device Tree not found\n"); | ||
335 | return -EINVAL; | ||
336 | } | ||
337 | |||
338 | irq_data = irq_get_irq_data(i2c->irq); | ||
339 | if (!irq_data) { | ||
340 | dev_err(&i2c->dev, "Invalid IRQ: %d\n", i2c->irq); | ||
341 | return -EINVAL; | ||
342 | } | ||
343 | |||
344 | as3722->en_intern_int_pullup = of_property_read_bool(np, | ||
345 | "ams,enable-internal-int-pullup"); | ||
346 | as3722->en_intern_i2c_pullup = of_property_read_bool(np, | ||
347 | "ams,enable-internal-i2c-pullup"); | ||
348 | as3722->irq_flags = irqd_get_trigger_type(irq_data); | ||
349 | dev_dbg(&i2c->dev, "IRQ flags are 0x%08lx\n", as3722->irq_flags); | ||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | static int as3722_i2c_probe(struct i2c_client *i2c, | ||
354 | const struct i2c_device_id *id) | ||
355 | { | ||
356 | struct as3722 *as3722; | ||
357 | unsigned long irq_flags; | ||
358 | int ret; | ||
359 | |||
360 | as3722 = devm_kzalloc(&i2c->dev, sizeof(struct as3722), GFP_KERNEL); | ||
361 | if (!as3722) | ||
362 | return -ENOMEM; | ||
363 | |||
364 | as3722->dev = &i2c->dev; | ||
365 | as3722->chip_irq = i2c->irq; | ||
366 | i2c_set_clientdata(i2c, as3722); | ||
367 | |||
368 | ret = as3722_i2c_of_probe(i2c, as3722); | ||
369 | if (ret < 0) | ||
370 | return ret; | ||
371 | |||
372 | as3722->regmap = devm_regmap_init_i2c(i2c, &as3722_regmap_config); | ||
373 | if (IS_ERR(as3722->regmap)) { | ||
374 | ret = PTR_ERR(as3722->regmap); | ||
375 | dev_err(&i2c->dev, "regmap init failed: %d\n", ret); | ||
376 | return ret; | ||
377 | } | ||
378 | |||
379 | ret = as3722_check_device_id(as3722); | ||
380 | if (ret < 0) | ||
381 | return ret; | ||
382 | |||
383 | irq_flags = as3722->irq_flags | IRQF_ONESHOT; | ||
384 | ret = regmap_add_irq_chip(as3722->regmap, as3722->chip_irq, | ||
385 | irq_flags, -1, &as3722_irq_chip, | ||
386 | &as3722->irq_data); | ||
387 | if (ret < 0) { | ||
388 | dev_err(as3722->dev, "Failed to add regmap irq: %d\n", ret); | ||
389 | return ret; | ||
390 | } | ||
391 | |||
392 | ret = as3722_configure_pullups(as3722); | ||
393 | if (ret < 0) | ||
394 | goto scrub; | ||
395 | |||
396 | ret = mfd_add_devices(&i2c->dev, -1, as3722_devs, | ||
397 | ARRAY_SIZE(as3722_devs), NULL, 0, | ||
398 | regmap_irq_get_domain(as3722->irq_data)); | ||
399 | if (ret) { | ||
400 | dev_err(as3722->dev, "Failed to add MFD devices: %d\n", ret); | ||
401 | goto scrub; | ||
402 | } | ||
403 | |||
404 | dev_dbg(as3722->dev, "AS3722 core driver initialized successfully\n"); | ||
405 | return 0; | ||
406 | |||
407 | scrub: | ||
408 | regmap_del_irq_chip(as3722->chip_irq, as3722->irq_data); | ||
409 | return ret; | ||
410 | } | ||
411 | |||
412 | static int as3722_i2c_remove(struct i2c_client *i2c) | ||
413 | { | ||
414 | struct as3722 *as3722 = i2c_get_clientdata(i2c); | ||
415 | |||
416 | mfd_remove_devices(as3722->dev); | ||
417 | regmap_del_irq_chip(as3722->chip_irq, as3722->irq_data); | ||
418 | return 0; | ||
419 | } | ||
420 | |||
421 | static const struct of_device_id as3722_of_match[] = { | ||
422 | { .compatible = "ams,as3722", }, | ||
423 | {}, | ||
424 | }; | ||
425 | MODULE_DEVICE_TABLE(of, as3722_of_match); | ||
426 | |||
427 | static const struct i2c_device_id as3722_i2c_id[] = { | ||
428 | { "as3722", 0 }, | ||
429 | {}, | ||
430 | }; | ||
431 | MODULE_DEVICE_TABLE(i2c, as3722_i2c_id); | ||
432 | |||
433 | static struct i2c_driver as3722_i2c_driver = { | ||
434 | .driver = { | ||
435 | .name = "as3722", | ||
436 | .owner = THIS_MODULE, | ||
437 | .of_match_table = as3722_of_match, | ||
438 | }, | ||
439 | .probe = as3722_i2c_probe, | ||
440 | .remove = as3722_i2c_remove, | ||
441 | .id_table = as3722_i2c_id, | ||
442 | }; | ||
443 | |||
444 | module_i2c_driver(as3722_i2c_driver); | ||
445 | |||
446 | MODULE_DESCRIPTION("I2C support for AS3722 PMICs"); | ||
447 | MODULE_AUTHOR("Florian Lobmaier <florian.lobmaier@ams.com>"); | ||
448 | MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>"); | ||
449 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c index 6a9fec40d018..c319c4ef5d49 100644 --- a/drivers/mfd/da9052-i2c.c +++ b/drivers/mfd/da9052-i2c.c | |||
@@ -86,7 +86,11 @@ static int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg) | |||
86 | return 0; | 86 | return 0; |
87 | } | 87 | } |
88 | 88 | ||
89 | static int da9052_i2c_enable_multiwrite(struct da9052 *da9052) | 89 | /* |
90 | * According to errata item 24, multiwrite mode should be avoided | ||
91 | * in order to prevent register data corruption after power-down. | ||
92 | */ | ||
93 | static int da9052_i2c_disable_multiwrite(struct da9052 *da9052) | ||
90 | { | 94 | { |
91 | int reg_val, ret; | 95 | int reg_val, ret; |
92 | 96 | ||
@@ -94,8 +98,8 @@ static int da9052_i2c_enable_multiwrite(struct da9052 *da9052) | |||
94 | if (ret < 0) | 98 | if (ret < 0) |
95 | return ret; | 99 | return ret; |
96 | 100 | ||
97 | if (reg_val & DA9052_CONTROL_B_WRITEMODE) { | 101 | if (!(reg_val & DA9052_CONTROL_B_WRITEMODE)) { |
98 | reg_val &= ~DA9052_CONTROL_B_WRITEMODE; | 102 | reg_val |= DA9052_CONTROL_B_WRITEMODE; |
99 | ret = regmap_write(da9052->regmap, DA9052_CONTROL_B_REG, | 103 | ret = regmap_write(da9052->regmap, DA9052_CONTROL_B_REG, |
100 | reg_val); | 104 | reg_val); |
101 | if (ret < 0) | 105 | if (ret < 0) |
@@ -154,7 +158,7 @@ static int da9052_i2c_probe(struct i2c_client *client, | |||
154 | return ret; | 158 | return ret; |
155 | } | 159 | } |
156 | 160 | ||
157 | ret = da9052_i2c_enable_multiwrite(da9052); | 161 | ret = da9052_i2c_disable_multiwrite(da9052); |
158 | if (ret < 0) | 162 | if (ret < 0) |
159 | return ret; | 163 | return ret; |
160 | 164 | ||
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c index 7245b0c5b794..2ed774e7d342 100644 --- a/drivers/mfd/ezx-pcap.c +++ b/drivers/mfd/ezx-pcap.c | |||
@@ -394,16 +394,12 @@ static int pcap_add_subdev(struct pcap_chip *pcap, | |||
394 | static int ezx_pcap_remove(struct spi_device *spi) | 394 | static int ezx_pcap_remove(struct spi_device *spi) |
395 | { | 395 | { |
396 | struct pcap_chip *pcap = spi_get_drvdata(spi); | 396 | struct pcap_chip *pcap = spi_get_drvdata(spi); |
397 | struct pcap_platform_data *pdata = dev_get_platdata(&spi->dev); | 397 | int i; |
398 | int i, adc_irq; | ||
399 | 398 | ||
400 | /* remove all registered subdevs */ | 399 | /* remove all registered subdevs */ |
401 | device_for_each_child(&spi->dev, NULL, pcap_remove_subdev); | 400 | device_for_each_child(&spi->dev, NULL, pcap_remove_subdev); |
402 | 401 | ||
403 | /* cleanup ADC */ | 402 | /* cleanup ADC */ |
404 | adc_irq = pcap_to_irq(pcap, (pdata->config & PCAP_SECOND_PORT) ? | ||
405 | PCAP_IRQ_ADCDONE2 : PCAP_IRQ_ADCDONE); | ||
406 | devm_free_irq(&spi->dev, adc_irq, pcap); | ||
407 | mutex_lock(&pcap->adc_mutex); | 403 | mutex_lock(&pcap->adc_mutex); |
408 | for (i = 0; i < PCAP_ADC_MAXQ; i++) | 404 | for (i = 0; i < PCAP_ADC_MAXQ; i++) |
409 | kfree(pcap->adc_queue[i]); | 405 | kfree(pcap->adc_queue[i]); |
@@ -509,8 +505,6 @@ static int ezx_pcap_probe(struct spi_device *spi) | |||
509 | 505 | ||
510 | remove_subdevs: | 506 | remove_subdevs: |
511 | device_for_each_child(&spi->dev, NULL, pcap_remove_subdev); | 507 | device_for_each_child(&spi->dev, NULL, pcap_remove_subdev); |
512 | /* free_adc: */ | ||
513 | devm_free_irq(&spi->dev, adc_irq, pcap); | ||
514 | free_irqchip: | 508 | free_irqchip: |
515 | for (i = pcap->irq_base; i < (pcap->irq_base + PCAP_NIRQS); i++) | 509 | for (i = pcap->irq_base; i < (pcap->irq_base + PCAP_NIRQS); i++) |
516 | irq_set_chip_and_handler(i, NULL, NULL); | 510 | irq_set_chip_and_handler(i, NULL, NULL); |
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index 9483bc8472a5..da1c6566d93d 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c | |||
@@ -53,6 +53,7 @@ | |||
53 | * document number TBD : Wellsburg | 53 | * document number TBD : Wellsburg |
54 | * document number TBD : Avoton SoC | 54 | * document number TBD : Avoton SoC |
55 | * document number TBD : Coleto Creek | 55 | * document number TBD : Coleto Creek |
56 | * document number TBD : Wildcat Point-LP | ||
56 | */ | 57 | */ |
57 | 58 | ||
58 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 59 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
@@ -211,6 +212,7 @@ enum lpc_chipsets { | |||
211 | LPC_WBG, /* Wellsburg */ | 212 | LPC_WBG, /* Wellsburg */ |
212 | LPC_AVN, /* Avoton SoC */ | 213 | LPC_AVN, /* Avoton SoC */ |
213 | LPC_COLETO, /* Coleto Creek */ | 214 | LPC_COLETO, /* Coleto Creek */ |
215 | LPC_WPT_LP, /* Wildcat Point-LP */ | ||
214 | }; | 216 | }; |
215 | 217 | ||
216 | static struct lpc_ich_info lpc_chipset_info[] = { | 218 | static struct lpc_ich_info lpc_chipset_info[] = { |
@@ -503,6 +505,10 @@ static struct lpc_ich_info lpc_chipset_info[] = { | |||
503 | .name = "Coleto Creek", | 505 | .name = "Coleto Creek", |
504 | .iTCO_version = 2, | 506 | .iTCO_version = 2, |
505 | }, | 507 | }, |
508 | [LPC_WPT_LP] = { | ||
509 | .name = "Lynx Point_LP", | ||
510 | .iTCO_version = 2, | ||
511 | }, | ||
506 | }; | 512 | }; |
507 | 513 | ||
508 | /* | 514 | /* |
@@ -721,6 +727,13 @@ static DEFINE_PCI_DEVICE_TABLE(lpc_ich_ids) = { | |||
721 | { PCI_VDEVICE(INTEL, 0x1f3a), LPC_AVN}, | 727 | { PCI_VDEVICE(INTEL, 0x1f3a), LPC_AVN}, |
722 | { PCI_VDEVICE(INTEL, 0x1f3b), LPC_AVN}, | 728 | { PCI_VDEVICE(INTEL, 0x1f3b), LPC_AVN}, |
723 | { PCI_VDEVICE(INTEL, 0x2390), LPC_COLETO}, | 729 | { PCI_VDEVICE(INTEL, 0x2390), LPC_COLETO}, |
730 | { PCI_VDEVICE(INTEL, 0x9cc1), LPC_WPT_LP}, | ||
731 | { PCI_VDEVICE(INTEL, 0x9cc2), LPC_WPT_LP}, | ||
732 | { PCI_VDEVICE(INTEL, 0x9cc3), LPC_WPT_LP}, | ||
733 | { PCI_VDEVICE(INTEL, 0x9cc5), LPC_WPT_LP}, | ||
734 | { PCI_VDEVICE(INTEL, 0x9cc6), LPC_WPT_LP}, | ||
735 | { PCI_VDEVICE(INTEL, 0x9cc7), LPC_WPT_LP}, | ||
736 | { PCI_VDEVICE(INTEL, 0x9cc9), LPC_WPT_LP}, | ||
724 | { 0, }, /* End of list */ | 737 | { 0, }, /* End of list */ |
725 | }; | 738 | }; |
726 | MODULE_DEVICE_TABLE(pci, lpc_ich_ids); | 739 | MODULE_DEVICE_TABLE(pci, lpc_ich_ids); |
@@ -969,7 +982,6 @@ static int lpc_ich_probe(struct pci_dev *dev, | |||
969 | if (!cell_added) { | 982 | if (!cell_added) { |
970 | dev_warn(&dev->dev, "No MFD cells added\n"); | 983 | dev_warn(&dev->dev, "No MFD cells added\n"); |
971 | lpc_ich_restore_config_space(dev); | 984 | lpc_ich_restore_config_space(dev); |
972 | pci_set_drvdata(dev, NULL); | ||
973 | return -ENODEV; | 985 | return -ENODEV; |
974 | } | 986 | } |
975 | 987 | ||
@@ -980,7 +992,6 @@ static void lpc_ich_remove(struct pci_dev *dev) | |||
980 | { | 992 | { |
981 | mfd_remove_devices(&dev->dev); | 993 | mfd_remove_devices(&dev->dev); |
982 | lpc_ich_restore_config_space(dev); | 994 | lpc_ich_restore_config_space(dev); |
983 | pci_set_drvdata(dev, NULL); | ||
984 | } | 995 | } |
985 | 996 | ||
986 | static struct pci_driver lpc_ich_driver = { | 997 | static struct pci_driver lpc_ich_driver = { |
diff --git a/drivers/mfd/lpc_sch.c b/drivers/mfd/lpc_sch.c index 8cc6aac27cb2..fbfbf0b7f97a 100644 --- a/drivers/mfd/lpc_sch.c +++ b/drivers/mfd/lpc_sch.c | |||
@@ -59,18 +59,21 @@ static struct mfd_cell isch_smbus_cell = { | |||
59 | .name = "isch_smbus", | 59 | .name = "isch_smbus", |
60 | .num_resources = 1, | 60 | .num_resources = 1, |
61 | .resources = &smbus_sch_resource, | 61 | .resources = &smbus_sch_resource, |
62 | .ignore_resource_conflicts = true, | ||
62 | }; | 63 | }; |
63 | 64 | ||
64 | static struct mfd_cell sch_gpio_cell = { | 65 | static struct mfd_cell sch_gpio_cell = { |
65 | .name = "sch_gpio", | 66 | .name = "sch_gpio", |
66 | .num_resources = 1, | 67 | .num_resources = 1, |
67 | .resources = &gpio_sch_resource, | 68 | .resources = &gpio_sch_resource, |
69 | .ignore_resource_conflicts = true, | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | static struct mfd_cell wdt_sch_cell = { | 72 | static struct mfd_cell wdt_sch_cell = { |
71 | .name = "ie6xx_wdt", | 73 | .name = "ie6xx_wdt", |
72 | .num_resources = 1, | 74 | .num_resources = 1, |
73 | .resources = &wdt_sch_resource, | 75 | .resources = &wdt_sch_resource, |
76 | .ignore_resource_conflicts = true, | ||
74 | }; | 77 | }; |
75 | 78 | ||
76 | static DEFINE_PCI_DEVICE_TABLE(lpc_sch_ids) = { | 79 | static DEFINE_PCI_DEVICE_TABLE(lpc_sch_ids) = { |
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 522be67b2e68..34520cbe8afb 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/mfd/max77686.h> | 31 | #include <linux/mfd/max77686.h> |
32 | #include <linux/mfd/max77686-private.h> | 32 | #include <linux/mfd/max77686-private.h> |
33 | #include <linux/err.h> | 33 | #include <linux/err.h> |
34 | #include <linux/of.h> | ||
34 | 35 | ||
35 | #define I2C_ADDR_RTC (0x0C >> 1) | 36 | #define I2C_ADDR_RTC (0x0C >> 1) |
36 | 37 | ||
diff --git a/drivers/mfd/max77693-irq.c b/drivers/mfd/max77693-irq.c index 1029d018c739..66b58fe77094 100644 --- a/drivers/mfd/max77693-irq.c +++ b/drivers/mfd/max77693-irq.c | |||
@@ -128,7 +128,8 @@ static void max77693_irq_sync_unlock(struct irq_data *data) | |||
128 | static const inline struct max77693_irq_data * | 128 | static const inline struct max77693_irq_data * |
129 | irq_to_max77693_irq(struct max77693_dev *max77693, int irq) | 129 | irq_to_max77693_irq(struct max77693_dev *max77693, int irq) |
130 | { | 130 | { |
131 | return &max77693_irqs[irq]; | 131 | struct irq_data *data = irq_get_irq_data(irq); |
132 | return &max77693_irqs[data->hwirq]; | ||
132 | } | 133 | } |
133 | 134 | ||
134 | static void max77693_irq_mask(struct irq_data *data) | 135 | static void max77693_irq_mask(struct irq_data *data) |
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index c04723efc707..9f92463f4f7e 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/err.h> | 29 | #include <linux/err.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/of.h> | ||
31 | #include <linux/pm_runtime.h> | 32 | #include <linux/pm_runtime.h> |
32 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
33 | #include <linux/mfd/core.h> | 34 | #include <linux/mfd/core.h> |
@@ -110,15 +111,9 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
110 | const struct i2c_device_id *id) | 111 | const struct i2c_device_id *id) |
111 | { | 112 | { |
112 | struct max77693_dev *max77693; | 113 | struct max77693_dev *max77693; |
113 | struct max77693_platform_data *pdata = dev_get_platdata(&i2c->dev); | ||
114 | u8 reg_data; | 114 | u8 reg_data; |
115 | int ret = 0; | 115 | int ret = 0; |
116 | 116 | ||
117 | if (!pdata) { | ||
118 | dev_err(&i2c->dev, "No platform data found.\n"); | ||
119 | return -EINVAL; | ||
120 | } | ||
121 | |||
122 | max77693 = devm_kzalloc(&i2c->dev, | 117 | max77693 = devm_kzalloc(&i2c->dev, |
123 | sizeof(struct max77693_dev), GFP_KERNEL); | 118 | sizeof(struct max77693_dev), GFP_KERNEL); |
124 | if (max77693 == NULL) | 119 | if (max77693 == NULL) |
@@ -138,8 +133,6 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
138 | return ret; | 133 | return ret; |
139 | } | 134 | } |
140 | 135 | ||
141 | max77693->wakeup = pdata->wakeup; | ||
142 | |||
143 | ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, | 136 | ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, |
144 | ®_data); | 137 | ®_data); |
145 | if (ret < 0) { | 138 | if (ret < 0) { |
@@ -179,8 +172,6 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
179 | if (ret < 0) | 172 | if (ret < 0) |
180 | goto err_mfd; | 173 | goto err_mfd; |
181 | 174 | ||
182 | device_init_wakeup(max77693->dev, pdata->wakeup); | ||
183 | |||
184 | return ret; | 175 | return ret; |
185 | 176 | ||
186 | err_mfd: | 177 | err_mfd: |
@@ -235,11 +226,19 @@ static const struct dev_pm_ops max77693_pm = { | |||
235 | .resume = max77693_resume, | 226 | .resume = max77693_resume, |
236 | }; | 227 | }; |
237 | 228 | ||
229 | #ifdef CONFIG_OF | ||
230 | static struct of_device_id max77693_dt_match[] = { | ||
231 | { .compatible = "maxim,max77693" }, | ||
232 | {}, | ||
233 | }; | ||
234 | #endif | ||
235 | |||
238 | static struct i2c_driver max77693_i2c_driver = { | 236 | static struct i2c_driver max77693_i2c_driver = { |
239 | .driver = { | 237 | .driver = { |
240 | .name = "max77693", | 238 | .name = "max77693", |
241 | .owner = THIS_MODULE, | 239 | .owner = THIS_MODULE, |
242 | .pm = &max77693_pm, | 240 | .pm = &max77693_pm, |
241 | .of_match_table = of_match_ptr(max77693_dt_match), | ||
243 | }, | 242 | }, |
244 | .probe = max77693_i2c_probe, | 243 | .probe = max77693_i2c_probe, |
245 | .remove = max77693_i2c_remove, | 244 | .remove = max77693_i2c_remove, |
diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c index e9b1c93a3ade..3bbfedc07f41 100644 --- a/drivers/mfd/max8907.c +++ b/drivers/mfd/max8907.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/mfd/core.h> | 17 | #include <linux/mfd/core.h> |
18 | #include <linux/mfd/max8907.h> | 18 | #include <linux/mfd/max8907.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/of.h> | ||
20 | #include <linux/of_device.h> | 21 | #include <linux/of_device.h> |
21 | #include <linux/regmap.h> | 22 | #include <linux/regmap.h> |
22 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c index de7fb80a6052..176aa26fc787 100644 --- a/drivers/mfd/max8925-i2c.c +++ b/drivers/mfd/max8925-i2c.c | |||
@@ -238,7 +238,7 @@ static struct i2c_driver max8925_driver = { | |||
238 | .name = "max8925", | 238 | .name = "max8925", |
239 | .owner = THIS_MODULE, | 239 | .owner = THIS_MODULE, |
240 | .pm = &max8925_pm_ops, | 240 | .pm = &max8925_pm_ops, |
241 | .of_match_table = of_match_ptr(max8925_dt_ids), | 241 | .of_match_table = max8925_dt_ids, |
242 | }, | 242 | }, |
243 | .probe = max8925_probe, | 243 | .probe = max8925_probe, |
244 | .remove = max8925_remove, | 244 | .remove = max8925_remove, |
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index cee098c0dae3..791aea3e96ce 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/of.h> | ||
27 | #include <linux/of_irq.h> | 28 | #include <linux/of_irq.h> |
28 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
29 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c index f745e27ee874..898bd335cd8e 100644 --- a/drivers/mfd/mc13xxx-i2c.c +++ b/drivers/mfd/mc13xxx-i2c.c | |||
@@ -78,7 +78,6 @@ static int mc13xxx_i2c_probe(struct i2c_client *client, | |||
78 | ret = PTR_ERR(mc13xxx->regmap); | 78 | ret = PTR_ERR(mc13xxx->regmap); |
79 | dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", | 79 | dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", |
80 | ret); | 80 | ret); |
81 | dev_set_drvdata(&client->dev, NULL); | ||
82 | return ret; | 81 | return ret; |
83 | } | 82 | } |
84 | 83 | ||
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index adc8ea36e7c4..267649244737 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
@@ -64,7 +64,8 @@ int mfd_cell_disable(struct platform_device *pdev) | |||
64 | EXPORT_SYMBOL(mfd_cell_disable); | 64 | EXPORT_SYMBOL(mfd_cell_disable); |
65 | 65 | ||
66 | static int mfd_platform_add_cell(struct platform_device *pdev, | 66 | static int mfd_platform_add_cell(struct platform_device *pdev, |
67 | const struct mfd_cell *cell) | 67 | const struct mfd_cell *cell, |
68 | atomic_t *usage_count) | ||
68 | { | 69 | { |
69 | if (!cell) | 70 | if (!cell) |
70 | return 0; | 71 | return 0; |
@@ -73,11 +74,12 @@ static int mfd_platform_add_cell(struct platform_device *pdev, | |||
73 | if (!pdev->mfd_cell) | 74 | if (!pdev->mfd_cell) |
74 | return -ENOMEM; | 75 | return -ENOMEM; |
75 | 76 | ||
77 | pdev->mfd_cell->usage_count = usage_count; | ||
76 | return 0; | 78 | return 0; |
77 | } | 79 | } |
78 | 80 | ||
79 | static int mfd_add_device(struct device *parent, int id, | 81 | static int mfd_add_device(struct device *parent, int id, |
80 | const struct mfd_cell *cell, | 82 | const struct mfd_cell *cell, atomic_t *usage_count, |
81 | struct resource *mem_base, | 83 | struct resource *mem_base, |
82 | int irq_base, struct irq_domain *domain) | 84 | int irq_base, struct irq_domain *domain) |
83 | { | 85 | { |
@@ -123,7 +125,7 @@ static int mfd_add_device(struct device *parent, int id, | |||
123 | goto fail_alias; | 125 | goto fail_alias; |
124 | } | 126 | } |
125 | 127 | ||
126 | ret = mfd_platform_add_cell(pdev, cell); | 128 | ret = mfd_platform_add_cell(pdev, cell, usage_count); |
127 | if (ret) | 129 | if (ret) |
128 | goto fail_alias; | 130 | goto fail_alias; |
129 | 131 | ||
@@ -192,12 +194,12 @@ fail_alloc: | |||
192 | } | 194 | } |
193 | 195 | ||
194 | int mfd_add_devices(struct device *parent, int id, | 196 | int mfd_add_devices(struct device *parent, int id, |
195 | struct mfd_cell *cells, int n_devs, | 197 | const struct mfd_cell *cells, int n_devs, |
196 | struct resource *mem_base, | 198 | struct resource *mem_base, |
197 | int irq_base, struct irq_domain *domain) | 199 | int irq_base, struct irq_domain *domain) |
198 | { | 200 | { |
199 | int i; | 201 | int i; |
200 | int ret = 0; | 202 | int ret; |
201 | atomic_t *cnts; | 203 | atomic_t *cnts; |
202 | 204 | ||
203 | /* initialize reference counting for all cells */ | 205 | /* initialize reference counting for all cells */ |
@@ -207,16 +209,19 @@ int mfd_add_devices(struct device *parent, int id, | |||
207 | 209 | ||
208 | for (i = 0; i < n_devs; i++) { | 210 | for (i = 0; i < n_devs; i++) { |
209 | atomic_set(&cnts[i], 0); | 211 | atomic_set(&cnts[i], 0); |
210 | cells[i].usage_count = &cnts[i]; | 212 | ret = mfd_add_device(parent, id, cells + i, cnts + i, mem_base, |
211 | ret = mfd_add_device(parent, id, cells + i, mem_base, | ||
212 | irq_base, domain); | 213 | irq_base, domain); |
213 | if (ret) | 214 | if (ret) |
214 | break; | 215 | goto fail; |
215 | } | 216 | } |
216 | 217 | ||
217 | if (ret) | 218 | return 0; |
218 | mfd_remove_devices(parent); | ||
219 | 219 | ||
220 | fail: | ||
221 | if (i) | ||
222 | mfd_remove_devices(parent); | ||
223 | else | ||
224 | kfree(cnts); | ||
220 | return ret; | 225 | return ret; |
221 | } | 226 | } |
222 | EXPORT_SYMBOL(mfd_add_devices); | 227 | EXPORT_SYMBOL(mfd_add_devices); |
@@ -271,8 +276,8 @@ int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones) | |||
271 | for (i = 0; i < n_clones; i++) { | 276 | for (i = 0; i < n_clones; i++) { |
272 | cell_entry.name = clones[i]; | 277 | cell_entry.name = clones[i]; |
273 | /* don't give up if a single call fails; just report error */ | 278 | /* don't give up if a single call fails; just report error */ |
274 | if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, NULL, 0, | 279 | if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, |
275 | NULL)) | 280 | cell_entry.usage_count, NULL, 0, NULL)) |
276 | dev_err(dev, "failed to create platform device '%s'\n", | 281 | dev_err(dev, "failed to create platform device '%s'\n", |
277 | clones[i]); | 282 | clones[i]); |
278 | } | 283 | } |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 29ee54d68512..142650fdc058 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -328,13 +328,13 @@ static int usbhs_runtime_resume(struct device *dev) | |||
328 | omap_tll_enable(pdata); | 328 | omap_tll_enable(pdata); |
329 | 329 | ||
330 | if (!IS_ERR(omap->ehci_logic_fck)) | 330 | if (!IS_ERR(omap->ehci_logic_fck)) |
331 | clk_enable(omap->ehci_logic_fck); | 331 | clk_prepare_enable(omap->ehci_logic_fck); |
332 | 332 | ||
333 | for (i = 0; i < omap->nports; i++) { | 333 | for (i = 0; i < omap->nports; i++) { |
334 | switch (pdata->port_mode[i]) { | 334 | switch (pdata->port_mode[i]) { |
335 | case OMAP_EHCI_PORT_MODE_HSIC: | 335 | case OMAP_EHCI_PORT_MODE_HSIC: |
336 | if (!IS_ERR(omap->hsic60m_clk[i])) { | 336 | if (!IS_ERR(omap->hsic60m_clk[i])) { |
337 | r = clk_enable(omap->hsic60m_clk[i]); | 337 | r = clk_prepare_enable(omap->hsic60m_clk[i]); |
338 | if (r) { | 338 | if (r) { |
339 | dev_err(dev, | 339 | dev_err(dev, |
340 | "Can't enable port %d hsic60m clk:%d\n", | 340 | "Can't enable port %d hsic60m clk:%d\n", |
@@ -343,7 +343,7 @@ static int usbhs_runtime_resume(struct device *dev) | |||
343 | } | 343 | } |
344 | 344 | ||
345 | if (!IS_ERR(omap->hsic480m_clk[i])) { | 345 | if (!IS_ERR(omap->hsic480m_clk[i])) { |
346 | r = clk_enable(omap->hsic480m_clk[i]); | 346 | r = clk_prepare_enable(omap->hsic480m_clk[i]); |
347 | if (r) { | 347 | if (r) { |
348 | dev_err(dev, | 348 | dev_err(dev, |
349 | "Can't enable port %d hsic480m clk:%d\n", | 349 | "Can't enable port %d hsic480m clk:%d\n", |
@@ -354,7 +354,7 @@ static int usbhs_runtime_resume(struct device *dev) | |||
354 | 354 | ||
355 | case OMAP_EHCI_PORT_MODE_TLL: | 355 | case OMAP_EHCI_PORT_MODE_TLL: |
356 | if (!IS_ERR(omap->utmi_clk[i])) { | 356 | if (!IS_ERR(omap->utmi_clk[i])) { |
357 | r = clk_enable(omap->utmi_clk[i]); | 357 | r = clk_prepare_enable(omap->utmi_clk[i]); |
358 | if (r) { | 358 | if (r) { |
359 | dev_err(dev, | 359 | dev_err(dev, |
360 | "Can't enable port %d clk : %d\n", | 360 | "Can't enable port %d clk : %d\n", |
@@ -382,15 +382,15 @@ static int usbhs_runtime_suspend(struct device *dev) | |||
382 | switch (pdata->port_mode[i]) { | 382 | switch (pdata->port_mode[i]) { |
383 | case OMAP_EHCI_PORT_MODE_HSIC: | 383 | case OMAP_EHCI_PORT_MODE_HSIC: |
384 | if (!IS_ERR(omap->hsic60m_clk[i])) | 384 | if (!IS_ERR(omap->hsic60m_clk[i])) |
385 | clk_disable(omap->hsic60m_clk[i]); | 385 | clk_disable_unprepare(omap->hsic60m_clk[i]); |
386 | 386 | ||
387 | if (!IS_ERR(omap->hsic480m_clk[i])) | 387 | if (!IS_ERR(omap->hsic480m_clk[i])) |
388 | clk_disable(omap->hsic480m_clk[i]); | 388 | clk_disable_unprepare(omap->hsic480m_clk[i]); |
389 | /* Fall through as utmi_clks were used in HSIC mode */ | 389 | /* Fall through as utmi_clks were used in HSIC mode */ |
390 | 390 | ||
391 | case OMAP_EHCI_PORT_MODE_TLL: | 391 | case OMAP_EHCI_PORT_MODE_TLL: |
392 | if (!IS_ERR(omap->utmi_clk[i])) | 392 | if (!IS_ERR(omap->utmi_clk[i])) |
393 | clk_disable(omap->utmi_clk[i]); | 393 | clk_disable_unprepare(omap->utmi_clk[i]); |
394 | break; | 394 | break; |
395 | default: | 395 | default: |
396 | break; | 396 | break; |
@@ -398,7 +398,7 @@ static int usbhs_runtime_suspend(struct device *dev) | |||
398 | } | 398 | } |
399 | 399 | ||
400 | if (!IS_ERR(omap->ehci_logic_fck)) | 400 | if (!IS_ERR(omap->ehci_logic_fck)) |
401 | clk_disable(omap->ehci_logic_fck); | 401 | clk_disable_unprepare(omap->ehci_logic_fck); |
402 | 402 | ||
403 | omap_tll_disable(pdata); | 403 | omap_tll_disable(pdata); |
404 | 404 | ||
@@ -893,7 +893,7 @@ static struct platform_driver usbhs_omap_driver = { | |||
893 | .name = (char *)usbhs_driver_name, | 893 | .name = (char *)usbhs_driver_name, |
894 | .owner = THIS_MODULE, | 894 | .owner = THIS_MODULE, |
895 | .pm = &usbhsomap_dev_pm_ops, | 895 | .pm = &usbhsomap_dev_pm_ops, |
896 | .of_match_table = of_match_ptr(usbhs_omap_dt_ids), | 896 | .of_match_table = usbhs_omap_dt_ids, |
897 | }, | 897 | }, |
898 | .remove = usbhs_omap_remove, | 898 | .remove = usbhs_omap_remove, |
899 | }; | 899 | }; |
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c index e59ac4cbac96..0d946ae14453 100644 --- a/drivers/mfd/omap-usb-tll.c +++ b/drivers/mfd/omap-usb-tll.c | |||
@@ -320,7 +320,7 @@ static struct platform_driver usbtll_omap_driver = { | |||
320 | .driver = { | 320 | .driver = { |
321 | .name = (char *)usbtll_driver_name, | 321 | .name = (char *)usbtll_driver_name, |
322 | .owner = THIS_MODULE, | 322 | .owner = THIS_MODULE, |
323 | .of_match_table = of_match_ptr(usbtll_omap_dt_ids), | 323 | .of_match_table = usbtll_omap_dt_ids, |
324 | }, | 324 | }, |
325 | .probe = usbtll_omap_probe, | 325 | .probe = usbtll_omap_probe, |
326 | .remove = usbtll_omap_remove, | 326 | .remove = usbtll_omap_remove, |
@@ -429,7 +429,7 @@ int omap_tll_enable(struct usbhs_omap_platform_data *pdata) | |||
429 | if (IS_ERR(tll->ch_clk[i])) | 429 | if (IS_ERR(tll->ch_clk[i])) |
430 | continue; | 430 | continue; |
431 | 431 | ||
432 | r = clk_enable(tll->ch_clk[i]); | 432 | r = clk_prepare_enable(tll->ch_clk[i]); |
433 | if (r) { | 433 | if (r) { |
434 | dev_err(tll_dev, | 434 | dev_err(tll_dev, |
435 | "Error enabling ch %d clock: %d\n", i, r); | 435 | "Error enabling ch %d clock: %d\n", i, r); |
@@ -460,7 +460,7 @@ int omap_tll_disable(struct usbhs_omap_platform_data *pdata) | |||
460 | for (i = 0; i < tll->nch; i++) { | 460 | for (i = 0; i < tll->nch; i++) { |
461 | if (omap_usb_mode_needs_tll(pdata->port_mode[i])) { | 461 | if (omap_usb_mode_needs_tll(pdata->port_mode[i])) { |
462 | if (!IS_ERR(tll->ch_clk[i])) | 462 | if (!IS_ERR(tll->ch_clk[i])) |
463 | clk_disable(tll->ch_clk[i]); | 463 | clk_disable_unprepare(tll->ch_clk[i]); |
464 | } | 464 | } |
465 | } | 465 | } |
466 | 466 | ||
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 135afabe4ae2..d280d789e55a 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c | |||
@@ -368,6 +368,7 @@ static const struct of_device_id of_palmas_match_tbl[] = { | |||
368 | }, | 368 | }, |
369 | { }, | 369 | { }, |
370 | }; | 370 | }; |
371 | MODULE_DEVICE_TABLE(of, of_palmas_match_tbl); | ||
371 | 372 | ||
372 | static int palmas_i2c_probe(struct i2c_client *i2c, | 373 | static int palmas_i2c_probe(struct i2c_client *i2c, |
373 | const struct i2c_device_id *id) | 374 | const struct i2c_device_id *id) |
@@ -402,7 +403,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
402 | palmas->dev = &i2c->dev; | 403 | palmas->dev = &i2c->dev; |
403 | palmas->irq = i2c->irq; | 404 | palmas->irq = i2c->irq; |
404 | 405 | ||
405 | match = of_match_device(of_match_ptr(of_palmas_match_tbl), &i2c->dev); | 406 | match = of_match_device(of_palmas_match_tbl, &i2c->dev); |
406 | 407 | ||
407 | if (!match) | 408 | if (!match) |
408 | return -ENODATA; | 409 | return -ENODATA; |
@@ -421,7 +422,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
421 | dev_err(palmas->dev, | 422 | dev_err(palmas->dev, |
422 | "can't attach client %d\n", i); | 423 | "can't attach client %d\n", i); |
423 | ret = -ENOMEM; | 424 | ret = -ENOMEM; |
424 | goto err; | 425 | goto err_i2c; |
425 | } | 426 | } |
426 | palmas->i2c_clients[i]->dev.of_node = of_node_get(node); | 427 | palmas->i2c_clients[i]->dev.of_node = of_node_get(node); |
427 | } | 428 | } |
@@ -432,7 +433,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
432 | dev_err(palmas->dev, | 433 | dev_err(palmas->dev, |
433 | "Failed to allocate regmap %d, err: %d\n", | 434 | "Failed to allocate regmap %d, err: %d\n", |
434 | i, ret); | 435 | i, ret); |
435 | goto err; | 436 | goto err_i2c; |
436 | } | 437 | } |
437 | } | 438 | } |
438 | 439 | ||
@@ -451,7 +452,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
451 | reg); | 452 | reg); |
452 | if (ret < 0) { | 453 | if (ret < 0) { |
453 | dev_err(palmas->dev, "POLARITY_CTRL updat failed: %d\n", ret); | 454 | dev_err(palmas->dev, "POLARITY_CTRL updat failed: %d\n", ret); |
454 | goto err; | 455 | goto err_i2c; |
455 | } | 456 | } |
456 | 457 | ||
457 | /* Change IRQ into clear on read mode for efficiency */ | 458 | /* Change IRQ into clear on read mode for efficiency */ |
@@ -465,7 +466,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
465 | IRQF_ONESHOT | pdata->irq_flags, 0, &palmas_irq_chip, | 466 | IRQF_ONESHOT | pdata->irq_flags, 0, &palmas_irq_chip, |
466 | &palmas->irq_data); | 467 | &palmas->irq_data); |
467 | if (ret < 0) | 468 | if (ret < 0) |
468 | goto err; | 469 | goto err_i2c; |
469 | 470 | ||
470 | no_irq: | 471 | no_irq: |
471 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE); | 472 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE); |
@@ -551,7 +552,6 @@ no_irq: | |||
551 | } else if (pdata->pm_off && !pm_power_off) { | 552 | } else if (pdata->pm_off && !pm_power_off) { |
552 | palmas_dev = palmas; | 553 | palmas_dev = palmas; |
553 | pm_power_off = palmas_power_off; | 554 | pm_power_off = palmas_power_off; |
554 | return ret; | ||
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
@@ -559,17 +559,31 @@ no_irq: | |||
559 | 559 | ||
560 | err_irq: | 560 | err_irq: |
561 | regmap_del_irq_chip(palmas->irq, palmas->irq_data); | 561 | regmap_del_irq_chip(palmas->irq, palmas->irq_data); |
562 | err: | 562 | err_i2c: |
563 | for (i = 1; i < PALMAS_NUM_CLIENTS; i++) { | ||
564 | if (palmas->i2c_clients[i]) | ||
565 | i2c_unregister_device(palmas->i2c_clients[i]); | ||
566 | } | ||
563 | return ret; | 567 | return ret; |
564 | } | 568 | } |
565 | 569 | ||
566 | static int palmas_i2c_remove(struct i2c_client *i2c) | 570 | static int palmas_i2c_remove(struct i2c_client *i2c) |
567 | { | 571 | { |
568 | struct palmas *palmas = i2c_get_clientdata(i2c); | 572 | struct palmas *palmas = i2c_get_clientdata(i2c); |
573 | int i; | ||
569 | 574 | ||
570 | mfd_remove_devices(palmas->dev); | ||
571 | regmap_del_irq_chip(palmas->irq, palmas->irq_data); | 575 | regmap_del_irq_chip(palmas->irq, palmas->irq_data); |
572 | 576 | ||
577 | for (i = 1; i < PALMAS_NUM_CLIENTS; i++) { | ||
578 | if (palmas->i2c_clients[i]) | ||
579 | i2c_unregister_device(palmas->i2c_clients[i]); | ||
580 | } | ||
581 | |||
582 | if (palmas == palmas_dev) { | ||
583 | pm_power_off = NULL; | ||
584 | palmas_dev = NULL; | ||
585 | } | ||
586 | |||
573 | return 0; | 587 | return 0; |
574 | } | 588 | } |
575 | 589 | ||
diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c index a6841f77aa5e..484fe66e6c88 100644 --- a/drivers/mfd/pm8921-core.c +++ b/drivers/mfd/pm8921-core.c | |||
@@ -171,11 +171,12 @@ static int pm8921_remove(struct platform_device *pdev) | |||
171 | drvdata = platform_get_drvdata(pdev); | 171 | drvdata = platform_get_drvdata(pdev); |
172 | if (drvdata) | 172 | if (drvdata) |
173 | pmic = drvdata->pm_chip_data; | 173 | pmic = drvdata->pm_chip_data; |
174 | if (pmic) | 174 | if (pmic) { |
175 | mfd_remove_devices(pmic->dev); | 175 | mfd_remove_devices(pmic->dev); |
176 | if (pmic->irq_chip) { | 176 | if (pmic->irq_chip) { |
177 | pm8xxx_irq_exit(pmic->irq_chip); | 177 | pm8xxx_irq_exit(pmic->irq_chip); |
178 | pmic->irq_chip = NULL; | 178 | pmic->irq_chip = NULL; |
179 | } | ||
179 | } | 180 | } |
180 | 181 | ||
181 | return 0; | 182 | return 0; |
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c index 3b835f593e35..573de7bfcced 100644 --- a/drivers/mfd/rts5249.c +++ b/drivers/mfd/rts5249.c | |||
@@ -130,13 +130,57 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr) | |||
130 | { | 130 | { |
131 | int err; | 131 | int err; |
132 | 132 | ||
133 | err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, 0xFE46); | 133 | err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, |
134 | PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED | | ||
135 | PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN | | ||
136 | PHY_REG_REV_RX_PWST | PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 | | ||
137 | PHY_REG_REV_STOP_CLKRD | PHY_REG_REV_STOP_CLKWR); | ||
134 | if (err < 0) | 138 | if (err < 0) |
135 | return err; | 139 | return err; |
136 | 140 | ||
137 | msleep(1); | 141 | msleep(1); |
138 | 142 | ||
139 | return rtsx_pci_write_phy_register(pcr, PHY_BPCR, 0x05C0); | 143 | err = rtsx_pci_write_phy_register(pcr, PHY_BPCR, |
144 | PHY_BPCR_IBRXSEL | PHY_BPCR_IBTXSEL | | ||
145 | PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN); | ||
146 | if (err < 0) | ||
147 | return err; | ||
148 | err = rtsx_pci_write_phy_register(pcr, PHY_PCR, | ||
149 | PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 | | ||
150 | PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 | | ||
151 | PHY_PCR_RSSI_EN); | ||
152 | if (err < 0) | ||
153 | return err; | ||
154 | err = rtsx_pci_write_phy_register(pcr, PHY_RCR2, | ||
155 | PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR | | ||
156 | PHY_RCR2_CDR_CP_10 | PHY_RCR2_CDR_SR_2 | | ||
157 | PHY_RCR2_FREQSEL_12 | PHY_RCR2_CPADJEN | | ||
158 | PHY_RCR2_CDR_SC_8 | PHY_RCR2_CALIB_LATE); | ||
159 | if (err < 0) | ||
160 | return err; | ||
161 | err = rtsx_pci_write_phy_register(pcr, PHY_FLD4, | ||
162 | PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF | | ||
163 | PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA | | ||
164 | PHY_FLD4_BER_COUNT | PHY_FLD4_BER_TIMER | | ||
165 | PHY_FLD4_BER_CHK_EN); | ||
166 | if (err < 0) | ||
167 | return err; | ||
168 | err = rtsx_pci_write_phy_register(pcr, PHY_RDR, PHY_RDR_RXDSEL_1_9); | ||
169 | if (err < 0) | ||
170 | return err; | ||
171 | err = rtsx_pci_write_phy_register(pcr, PHY_RCR1, | ||
172 | PHY_RCR1_ADP_TIME | PHY_RCR1_VCO_COARSE); | ||
173 | if (err < 0) | ||
174 | return err; | ||
175 | err = rtsx_pci_write_phy_register(pcr, PHY_FLD3, | ||
176 | PHY_FLD3_TIMER_4 | PHY_FLD3_TIMER_6 | | ||
177 | PHY_FLD3_RXDELINK); | ||
178 | if (err < 0) | ||
179 | return err; | ||
180 | return rtsx_pci_write_phy_register(pcr, PHY_TUNE, | ||
181 | PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 | | ||
182 | PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 | | ||
183 | PHY_TUNE_TUNED12); | ||
140 | } | 184 | } |
141 | 185 | ||
142 | static int rts5249_turn_on_led(struct rtsx_pcr *pcr) | 186 | static int rts5249_turn_on_led(struct rtsx_pcr *pcr) |
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index e6ae7720f9e1..11e20afbdcac 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -1149,7 +1149,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, | |||
1149 | pcr->remap_addr = ioremap_nocache(base, len); | 1149 | pcr->remap_addr = ioremap_nocache(base, len); |
1150 | if (!pcr->remap_addr) { | 1150 | if (!pcr->remap_addr) { |
1151 | ret = -ENOMEM; | 1151 | ret = -ENOMEM; |
1152 | goto free_host; | 1152 | goto free_handle; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | pcr->rtsx_resv_buf = dma_alloc_coherent(&(pcidev->dev), | 1155 | pcr->rtsx_resv_buf = dma_alloc_coherent(&(pcidev->dev), |
@@ -1209,8 +1209,6 @@ disable_msi: | |||
1209 | pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr); | 1209 | pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr); |
1210 | unmap: | 1210 | unmap: |
1211 | iounmap(pcr->remap_addr); | 1211 | iounmap(pcr->remap_addr); |
1212 | free_host: | ||
1213 | dev_set_drvdata(&pcidev->dev, NULL); | ||
1214 | free_handle: | 1212 | free_handle: |
1215 | kfree(handle); | 1213 | kfree(handle); |
1216 | free_pcr: | 1214 | free_pcr: |
@@ -1242,7 +1240,6 @@ static void rtsx_pci_remove(struct pci_dev *pcidev) | |||
1242 | pci_disable_msi(pcr->pci); | 1240 | pci_disable_msi(pcr->pci); |
1243 | iounmap(pcr->remap_addr); | 1241 | iounmap(pcr->remap_addr); |
1244 | 1242 | ||
1245 | dev_set_drvdata(&pcidev->dev, NULL); | ||
1246 | pci_release_regions(pcidev); | 1243 | pci_release_regions(pcidev); |
1247 | pci_disable_device(pcidev); | 1244 | pci_disable_device(pcidev); |
1248 | 1245 | ||
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index f530e4b73f19..34c18fb8c089 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/of.h> | ||
20 | #include <linux/of_irq.h> | 21 | #include <linux/of_irq.h> |
21 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
22 | #include <linux/pm_runtime.h> | 23 | #include <linux/pm_runtime.h> |
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 33f040c558d0..c2c8c91c6c7b 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c | |||
@@ -1232,7 +1232,7 @@ static ssize_t sm501_dbg_regs(struct device *dev, | |||
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | 1234 | ||
1235 | static DEVICE_ATTR(dbg_regs, 0666, sm501_dbg_regs, NULL); | 1235 | static DEVICE_ATTR(dbg_regs, 0444, sm501_dbg_regs, NULL); |
1236 | 1236 | ||
1237 | /* sm501_init_reg | 1237 | /* sm501_init_reg |
1238 | * | 1238 | * |
@@ -1660,7 +1660,6 @@ static int sm501_pci_probe(struct pci_dev *dev, | |||
1660 | err3: | 1660 | err3: |
1661 | pci_disable_device(dev); | 1661 | pci_disable_device(dev); |
1662 | err2: | 1662 | err2: |
1663 | pci_set_drvdata(dev, NULL); | ||
1664 | kfree(sm); | 1663 | kfree(sm); |
1665 | err1: | 1664 | err1: |
1666 | return err; | 1665 | return err; |
@@ -1695,7 +1694,6 @@ static void sm501_pci_remove(struct pci_dev *dev) | |||
1695 | release_resource(sm->regs_claim); | 1694 | release_resource(sm->regs_claim); |
1696 | kfree(sm->regs_claim); | 1695 | kfree(sm->regs_claim); |
1697 | 1696 | ||
1698 | pci_set_drvdata(dev, NULL); | ||
1699 | pci_disable_device(dev); | 1697 | pci_disable_device(dev); |
1700 | } | 1698 | } |
1701 | 1699 | ||
diff --git a/drivers/mfd/stw481x.c b/drivers/mfd/stw481x.c new file mode 100644 index 000000000000..1243d5c6a448 --- /dev/null +++ b/drivers/mfd/stw481x.c | |||
@@ -0,0 +1,250 @@ | |||
1 | /* | ||
2 | * Core driver for STw4810/STw4811 | ||
3 | * | ||
4 | * Copyright (C) 2013 ST-Ericsson SA | ||
5 | * Written on behalf of Linaro for ST-Ericsson | ||
6 | * | ||
7 | * Author: Linus Walleij <linus.walleij@linaro.org> | ||
8 | * | ||
9 | * License terms: GNU General Public License (GPL) version 2 | ||
10 | */ | ||
11 | |||
12 | #include <linux/err.h> | ||
13 | #include <linux/i2c.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/mfd/core.h> | ||
16 | #include <linux/mfd/stw481x.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/regmap.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | /* | ||
23 | * This driver can only access the non-USB portions of STw4811, the register | ||
24 | * range 0x00-0x10 dealing with USB is bound to the two special I2C pins used | ||
25 | * for USB control. | ||
26 | */ | ||
27 | |||
28 | /* Registers inside the power control address space */ | ||
29 | #define STW_PC_VCORE_SEL 0x05U | ||
30 | #define STW_PC_VAUX_SEL 0x06U | ||
31 | #define STW_PC_VPLL_SEL 0x07U | ||
32 | |||
33 | /** | ||
34 | * stw481x_get_pctl_reg() - get a power control register | ||
35 | * @stw481x: handle to the stw481x chip | ||
36 | * @reg: power control register to fetch | ||
37 | * | ||
38 | * The power control registers is a set of one-time-programmable registers | ||
39 | * in its own register space, accessed by writing addess bits to these | ||
40 | * two registers: bits 7,6,5 of PCTL_REG_LO corresponds to the 3 LSBs of | ||
41 | * the address and bits 8,9 of PCTL_REG_HI corresponds to the 2 MSBs of | ||
42 | * the address, forming an address space of 5 bits, i.e. 32 registers | ||
43 | * 0x00 ... 0x1f can be obtained. | ||
44 | */ | ||
45 | static int stw481x_get_pctl_reg(struct stw481x *stw481x, u8 reg) | ||
46 | { | ||
47 | u8 msb = (reg >> 3) & 0x03; | ||
48 | u8 lsb = (reg << 5) & 0xe0; | ||
49 | unsigned int val; | ||
50 | u8 vrfy; | ||
51 | int ret; | ||
52 | |||
53 | ret = regmap_write(stw481x->map, STW_PCTL_REG_HI, msb); | ||
54 | if (ret) | ||
55 | return ret; | ||
56 | ret = regmap_write(stw481x->map, STW_PCTL_REG_LO, lsb); | ||
57 | if (ret) | ||
58 | return ret; | ||
59 | ret = regmap_read(stw481x->map, STW_PCTL_REG_HI, &val); | ||
60 | if (ret) | ||
61 | return ret; | ||
62 | vrfy = (val & 0x03) << 3; | ||
63 | ret = regmap_read(stw481x->map, STW_PCTL_REG_LO, &val); | ||
64 | if (ret) | ||
65 | return ret; | ||
66 | vrfy |= ((val >> 5) & 0x07); | ||
67 | if (vrfy != reg) | ||
68 | return -EIO; | ||
69 | return (val >> 1) & 0x0f; | ||
70 | } | ||
71 | |||
72 | static int stw481x_startup(struct stw481x *stw481x) | ||
73 | { | ||
74 | /* Voltages multiplied by 100 */ | ||
75 | u8 vcore_val[] = { 100, 105, 110, 115, 120, 122, 124, 126, 128, | ||
76 | 130, 132, 134, 136, 138, 140, 145 }; | ||
77 | u8 vpll_val[] = { 105, 120, 130, 180 }; | ||
78 | u8 vaux_val[] = { 15, 18, 25, 28 }; | ||
79 | u8 vcore; | ||
80 | u8 vcore_slp; | ||
81 | u8 vpll; | ||
82 | u8 vaux; | ||
83 | bool vaux_en; | ||
84 | bool it_warn; | ||
85 | int ret; | ||
86 | unsigned int val; | ||
87 | |||
88 | ret = regmap_read(stw481x->map, STW_CONF1, &val); | ||
89 | if (ret) | ||
90 | return ret; | ||
91 | vaux_en = !!(val & STW_CONF1_PDN_VAUX); | ||
92 | it_warn = !!(val & STW_CONF1_IT_WARN); | ||
93 | |||
94 | dev_info(&stw481x->client->dev, "voltages %s\n", | ||
95 | (val & STW_CONF1_V_MONITORING) ? "OK" : "LOW"); | ||
96 | dev_info(&stw481x->client->dev, "MMC level shifter %s\n", | ||
97 | (val & STW_CONF1_MMC_LS_STATUS) ? "high impedance" : "ON"); | ||
98 | dev_info(&stw481x->client->dev, "VMMC: %s\n", | ||
99 | (val & STW_CONF1_PDN_VMMC) ? "ON" : "disabled"); | ||
100 | |||
101 | dev_info(&stw481x->client->dev, "STw481x power control registers:\n"); | ||
102 | |||
103 | ret = stw481x_get_pctl_reg(stw481x, STW_PC_VCORE_SEL); | ||
104 | if (ret < 0) | ||
105 | return ret; | ||
106 | vcore = ret & 0x0f; | ||
107 | |||
108 | ret = stw481x_get_pctl_reg(stw481x, STW_PC_VAUX_SEL); | ||
109 | if (ret < 0) | ||
110 | return ret; | ||
111 | vaux = (ret >> 2) & 3; | ||
112 | vpll = (ret >> 4) & 1; /* Save bit 4 */ | ||
113 | |||
114 | ret = stw481x_get_pctl_reg(stw481x, STW_PC_VPLL_SEL); | ||
115 | if (ret < 0) | ||
116 | return ret; | ||
117 | vpll |= (ret >> 1) & 2; | ||
118 | |||
119 | dev_info(&stw481x->client->dev, "VCORE: %u.%uV %s\n", | ||
120 | vcore_val[vcore] / 100, vcore_val[vcore] % 100, | ||
121 | (ret & 4) ? "ON" : "OFF"); | ||
122 | |||
123 | dev_info(&stw481x->client->dev, "VPLL: %u.%uV %s\n", | ||
124 | vpll_val[vpll] / 100, vpll_val[vpll] % 100, | ||
125 | (ret & 0x10) ? "ON" : "OFF"); | ||
126 | |||
127 | dev_info(&stw481x->client->dev, "VAUX: %u.%uV %s\n", | ||
128 | vaux_val[vaux] / 10, vaux_val[vaux] % 10, | ||
129 | vaux_en ? "ON" : "OFF"); | ||
130 | |||
131 | ret = regmap_read(stw481x->map, STW_CONF2, &val); | ||
132 | if (ret) | ||
133 | return ret; | ||
134 | |||
135 | dev_info(&stw481x->client->dev, "TWARN: %s threshold, %s\n", | ||
136 | it_warn ? "below" : "above", | ||
137 | (val & STW_CONF2_MASK_TWARN) ? | ||
138 | "enabled" : "mask through VDDOK"); | ||
139 | dev_info(&stw481x->client->dev, "VMMC: %s\n", | ||
140 | (val & STW_CONF2_VMMC_EXT) ? "internal" : "external"); | ||
141 | dev_info(&stw481x->client->dev, "IT WAKE UP: %s\n", | ||
142 | (val & STW_CONF2_MASK_IT_WAKE_UP) ? "enabled" : "masked"); | ||
143 | dev_info(&stw481x->client->dev, "GPO1: %s\n", | ||
144 | (val & STW_CONF2_GPO1) ? "low" : "high impedance"); | ||
145 | dev_info(&stw481x->client->dev, "GPO2: %s\n", | ||
146 | (val & STW_CONF2_GPO2) ? "low" : "high impedance"); | ||
147 | |||
148 | ret = regmap_read(stw481x->map, STW_VCORE_SLEEP, &val); | ||
149 | if (ret) | ||
150 | return ret; | ||
151 | vcore_slp = val & 0x0f; | ||
152 | dev_info(&stw481x->client->dev, "VCORE SLEEP: %u.%uV\n", | ||
153 | vcore_val[vcore_slp] / 100, vcore_val[vcore_slp] % 100); | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * MFD cells - we have one cell which is selected operation | ||
160 | * mode, and we always have a GPIO cell. | ||
161 | */ | ||
162 | static struct mfd_cell stw481x_cells[] = { | ||
163 | { | ||
164 | .of_compatible = "st,stw481x-vmmc", | ||
165 | .name = "stw481x-vmmc-regulator", | ||
166 | .id = -1, | ||
167 | }, | ||
168 | }; | ||
169 | |||
170 | const struct regmap_config stw481x_regmap_config = { | ||
171 | .reg_bits = 8, | ||
172 | .val_bits = 8, | ||
173 | }; | ||
174 | |||
175 | static int stw481x_probe(struct i2c_client *client, | ||
176 | const struct i2c_device_id *id) | ||
177 | { | ||
178 | struct stw481x *stw481x; | ||
179 | int ret; | ||
180 | int i; | ||
181 | |||
182 | stw481x = devm_kzalloc(&client->dev, sizeof(*stw481x), GFP_KERNEL); | ||
183 | if (!stw481x) | ||
184 | return -ENOMEM; | ||
185 | |||
186 | i2c_set_clientdata(client, stw481x); | ||
187 | stw481x->client = client; | ||
188 | stw481x->map = devm_regmap_init_i2c(client, &stw481x_regmap_config); | ||
189 | |||
190 | ret = stw481x_startup(stw481x); | ||
191 | if (ret) { | ||
192 | dev_err(&client->dev, "chip initialization failed\n"); | ||
193 | return ret; | ||
194 | } | ||
195 | |||
196 | /* Set up and register the platform devices. */ | ||
197 | for (i = 0; i < ARRAY_SIZE(stw481x_cells); i++) { | ||
198 | /* One state holder for all drivers, this is simple */ | ||
199 | stw481x_cells[i].platform_data = stw481x; | ||
200 | stw481x_cells[i].pdata_size = sizeof(*stw481x); | ||
201 | } | ||
202 | |||
203 | ret = mfd_add_devices(&client->dev, 0, stw481x_cells, | ||
204 | ARRAY_SIZE(stw481x_cells), NULL, 0, NULL); | ||
205 | if (ret) | ||
206 | return ret; | ||
207 | |||
208 | dev_info(&client->dev, "initialized STw481x device\n"); | ||
209 | |||
210 | return ret; | ||
211 | } | ||
212 | |||
213 | static int stw481x_remove(struct i2c_client *client) | ||
214 | { | ||
215 | mfd_remove_devices(&client->dev); | ||
216 | return 0; | ||
217 | } | ||
218 | |||
219 | /* | ||
220 | * This ID table is completely unused, as this is a pure | ||
221 | * device-tree probed driver, but it has to be here due to | ||
222 | * the structure of the I2C core. | ||
223 | */ | ||
224 | static const struct i2c_device_id stw481x_id[] = { | ||
225 | { "stw481x", 0 }, | ||
226 | { }, | ||
227 | }; | ||
228 | |||
229 | static const struct of_device_id stw481x_match[] = { | ||
230 | { .compatible = "st,stw4810", }, | ||
231 | { .compatible = "st,stw4811", }, | ||
232 | { }, | ||
233 | }; | ||
234 | MODULE_DEVICE_TABLE(of, stw481x_match); | ||
235 | |||
236 | static struct i2c_driver stw481x_driver = { | ||
237 | .driver = { | ||
238 | .name = "stw481x", | ||
239 | .of_match_table = stw481x_match, | ||
240 | }, | ||
241 | .probe = stw481x_probe, | ||
242 | .remove = stw481x_remove, | ||
243 | .id_table = stw481x_id, | ||
244 | }; | ||
245 | |||
246 | module_i2c_driver(stw481x_driver); | ||
247 | |||
248 | MODULE_AUTHOR("Linus Walleij"); | ||
249 | MODULE_DESCRIPTION("STw481x PMIC driver"); | ||
250 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index 70f4909fee13..87ea51dc6234 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c | |||
@@ -16,6 +16,19 @@ | |||
16 | #include <linux/mfd/core.h> | 16 | #include <linux/mfd/core.h> |
17 | #include <linux/mfd/tc3589x.h> | 17 | #include <linux/mfd/tc3589x.h> |
18 | 18 | ||
19 | /** | ||
20 | * enum tc3589x_version - indicates the TC3589x version | ||
21 | */ | ||
22 | enum tc3589x_version { | ||
23 | TC3589X_TC35890, | ||
24 | TC3589X_TC35892, | ||
25 | TC3589X_TC35893, | ||
26 | TC3589X_TC35894, | ||
27 | TC3589X_TC35895, | ||
28 | TC3589X_TC35896, | ||
29 | TC3589X_UNKNOWN, | ||
30 | }; | ||
31 | |||
19 | #define TC3589x_CLKMODE_MODCTL_SLEEP 0x0 | 32 | #define TC3589x_CLKMODE_MODCTL_SLEEP 0x0 |
20 | #define TC3589x_CLKMODE_MODCTL_OPERATION (1 << 0) | 33 | #define TC3589x_CLKMODE_MODCTL_OPERATION (1 << 0) |
21 | 34 | ||
@@ -361,7 +374,21 @@ static int tc3589x_probe(struct i2c_client *i2c, | |||
361 | tc3589x->i2c = i2c; | 374 | tc3589x->i2c = i2c; |
362 | tc3589x->pdata = pdata; | 375 | tc3589x->pdata = pdata; |
363 | tc3589x->irq_base = pdata->irq_base; | 376 | tc3589x->irq_base = pdata->irq_base; |
364 | tc3589x->num_gpio = id->driver_data; | 377 | |
378 | switch (id->driver_data) { | ||
379 | case TC3589X_TC35893: | ||
380 | case TC3589X_TC35895: | ||
381 | case TC3589X_TC35896: | ||
382 | tc3589x->num_gpio = 20; | ||
383 | break; | ||
384 | case TC3589X_TC35890: | ||
385 | case TC3589X_TC35892: | ||
386 | case TC3589X_TC35894: | ||
387 | case TC3589X_UNKNOWN: | ||
388 | default: | ||
389 | tc3589x->num_gpio = 24; | ||
390 | break; | ||
391 | } | ||
365 | 392 | ||
366 | i2c_set_clientdata(i2c, tc3589x); | 393 | i2c_set_clientdata(i2c, tc3589x); |
367 | 394 | ||
@@ -432,7 +459,13 @@ static int tc3589x_resume(struct device *dev) | |||
432 | static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume); | 459 | static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume); |
433 | 460 | ||
434 | static const struct i2c_device_id tc3589x_id[] = { | 461 | static const struct i2c_device_id tc3589x_id[] = { |
435 | { "tc3589x", 24 }, | 462 | { "tc35890", TC3589X_TC35890 }, |
463 | { "tc35892", TC3589X_TC35892 }, | ||
464 | { "tc35893", TC3589X_TC35893 }, | ||
465 | { "tc35894", TC3589X_TC35894 }, | ||
466 | { "tc35895", TC3589X_TC35895 }, | ||
467 | { "tc35896", TC3589X_TC35896 }, | ||
468 | { "tc3589x", TC3589X_UNKNOWN }, | ||
436 | { } | 469 | { } |
437 | }; | 470 | }; |
438 | MODULE_DEVICE_TABLE(i2c, tc3589x_id); | 471 | MODULE_DEVICE_TABLE(i2c, tc3589x_id); |
diff --git a/drivers/mfd/ti-ssp.c b/drivers/mfd/ti-ssp.c index 1c2b994e1f6c..71e3e0c5bf73 100644 --- a/drivers/mfd/ti-ssp.c +++ b/drivers/mfd/ti-ssp.c | |||
@@ -445,7 +445,6 @@ static int ti_ssp_remove(struct platform_device *pdev) | |||
445 | iounmap(ssp->regs); | 445 | iounmap(ssp->regs); |
446 | release_mem_region(ssp->res->start, resource_size(ssp->res)); | 446 | release_mem_region(ssp->res->start, resource_size(ssp->res)); |
447 | kfree(ssp); | 447 | kfree(ssp); |
448 | dev_set_drvdata(dev, NULL); | ||
449 | return 0; | 448 | return 0; |
450 | } | 449 | } |
451 | 450 | ||
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c index baaf5a8123bb..88718abfb9ba 100644 --- a/drivers/mfd/ti_am335x_tscadc.c +++ b/drivers/mfd/ti_am335x_tscadc.c | |||
@@ -56,21 +56,25 @@ EXPORT_SYMBOL_GPL(am335x_tsc_se_update); | |||
56 | 56 | ||
57 | void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val) | 57 | void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val) |
58 | { | 58 | { |
59 | spin_lock(&tsadc->reg_lock); | 59 | unsigned long flags; |
60 | |||
61 | spin_lock_irqsave(&tsadc->reg_lock, flags); | ||
60 | tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE); | 62 | tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE); |
61 | tsadc->reg_se_cache |= val; | 63 | tsadc->reg_se_cache |= val; |
62 | am335x_tsc_se_update(tsadc); | 64 | am335x_tsc_se_update(tsadc); |
63 | spin_unlock(&tsadc->reg_lock); | 65 | spin_unlock_irqrestore(&tsadc->reg_lock, flags); |
64 | } | 66 | } |
65 | EXPORT_SYMBOL_GPL(am335x_tsc_se_set); | 67 | EXPORT_SYMBOL_GPL(am335x_tsc_se_set); |
66 | 68 | ||
67 | void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val) | 69 | void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val) |
68 | { | 70 | { |
69 | spin_lock(&tsadc->reg_lock); | 71 | unsigned long flags; |
72 | |||
73 | spin_lock_irqsave(&tsadc->reg_lock, flags); | ||
70 | tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE); | 74 | tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE); |
71 | tsadc->reg_se_cache &= ~val; | 75 | tsadc->reg_se_cache &= ~val; |
72 | am335x_tsc_se_update(tsadc); | 76 | am335x_tsc_se_update(tsadc); |
73 | spin_unlock(&tsadc->reg_lock); | 77 | spin_unlock_irqrestore(&tsadc->reg_lock, flags); |
74 | } | 78 | } |
75 | EXPORT_SYMBOL_GPL(am335x_tsc_se_clr); | 79 | EXPORT_SYMBOL_GPL(am335x_tsc_se_clr); |
76 | 80 | ||
@@ -95,7 +99,7 @@ static int ti_tscadc_probe(struct platform_device *pdev) | |||
95 | const __be32 *cur; | 99 | const __be32 *cur; |
96 | u32 val; | 100 | u32 val; |
97 | int err, ctrl; | 101 | int err, ctrl; |
98 | int clk_value, clock_rate; | 102 | int clock_rate; |
99 | int tsc_wires = 0, adc_channels = 0, total_channels; | 103 | int tsc_wires = 0, adc_channels = 0, total_channels; |
100 | int readouts = 0; | 104 | int readouts = 0; |
101 | 105 | ||
@@ -196,11 +200,11 @@ static int ti_tscadc_probe(struct platform_device *pdev) | |||
196 | } | 200 | } |
197 | clock_rate = clk_get_rate(clk); | 201 | clock_rate = clk_get_rate(clk); |
198 | clk_put(clk); | 202 | clk_put(clk); |
199 | clk_value = clock_rate / ADC_CLK; | 203 | tscadc->clk_div = clock_rate / ADC_CLK; |
200 | 204 | ||
201 | /* TSCADC_CLKDIV needs to be configured to the value minus 1 */ | 205 | /* TSCADC_CLKDIV needs to be configured to the value minus 1 */ |
202 | clk_value = clk_value - 1; | 206 | tscadc->clk_div--; |
203 | tscadc_writel(tscadc, REG_CLKDIV, clk_value); | 207 | tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div); |
204 | 208 | ||
205 | /* Set the control register bits */ | 209 | /* Set the control register bits */ |
206 | ctrl = CNTRLREG_STEPCONFIGWRT | | 210 | ctrl = CNTRLREG_STEPCONFIGWRT | |
@@ -303,6 +307,8 @@ static int tscadc_resume(struct device *dev) | |||
303 | tscadc_writel(tscadc_dev, REG_CTRL, | 307 | tscadc_writel(tscadc_dev, REG_CTRL, |
304 | (restore | CNTRLREG_TSCSSENB)); | 308 | (restore | CNTRLREG_TSCSSENB)); |
305 | 309 | ||
310 | tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div); | ||
311 | |||
306 | return 0; | 312 | return 0; |
307 | } | 313 | } |
308 | 314 | ||
@@ -326,7 +332,7 @@ static struct platform_driver ti_tscadc_driver = { | |||
326 | .name = "ti_am3359-tscadc", | 332 | .name = "ti_am3359-tscadc", |
327 | .owner = THIS_MODULE, | 333 | .owner = THIS_MODULE, |
328 | .pm = TSCADC_PM_OPS, | 334 | .pm = TSCADC_PM_OPS, |
329 | .of_match_table = of_match_ptr(ti_tscadc_dt_ids), | 335 | .of_match_table = ti_tscadc_dt_ids, |
330 | }, | 336 | }, |
331 | .probe = ti_tscadc_probe, | 337 | .probe = ti_tscadc_probe, |
332 | .remove = ti_tscadc_remove, | 338 | .remove = ti_tscadc_remove, |
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c index a6755ec7bd6a..dbb34f94e5e3 100644 --- a/drivers/mfd/timberdale.c +++ b/drivers/mfd/timberdale.c | |||
@@ -678,7 +678,7 @@ static int timb_probe(struct pci_dev *dev, | |||
678 | priv->ctl_mapbase = mapbase + CHIPCTLOFFSET; | 678 | priv->ctl_mapbase = mapbase + CHIPCTLOFFSET; |
679 | if (!request_mem_region(priv->ctl_mapbase, CHIPCTLSIZE, "timb-ctl")) { | 679 | if (!request_mem_region(priv->ctl_mapbase, CHIPCTLSIZE, "timb-ctl")) { |
680 | dev_err(&dev->dev, "Failed to request ctl mem\n"); | 680 | dev_err(&dev->dev, "Failed to request ctl mem\n"); |
681 | goto err_request; | 681 | goto err_start; |
682 | } | 682 | } |
683 | 683 | ||
684 | priv->ctl_membase = ioremap(priv->ctl_mapbase, CHIPCTLSIZE); | 684 | priv->ctl_membase = ioremap(priv->ctl_mapbase, CHIPCTLSIZE); |
@@ -828,13 +828,10 @@ err_config: | |||
828 | iounmap(priv->ctl_membase); | 828 | iounmap(priv->ctl_membase); |
829 | err_ioremap: | 829 | err_ioremap: |
830 | release_mem_region(priv->ctl_mapbase, CHIPCTLSIZE); | 830 | release_mem_region(priv->ctl_mapbase, CHIPCTLSIZE); |
831 | err_request: | ||
832 | pci_set_drvdata(dev, NULL); | ||
833 | err_start: | 831 | err_start: |
834 | pci_disable_device(dev); | 832 | pci_disable_device(dev); |
835 | err_enable: | 833 | err_enable: |
836 | kfree(priv); | 834 | kfree(priv); |
837 | pci_set_drvdata(dev, NULL); | ||
838 | return -ENODEV; | 835 | return -ENODEV; |
839 | } | 836 | } |
840 | 837 | ||
@@ -851,7 +848,6 @@ static void timb_remove(struct pci_dev *dev) | |||
851 | 848 | ||
852 | pci_disable_msix(dev); | 849 | pci_disable_msix(dev); |
853 | pci_disable_device(dev); | 850 | pci_disable_device(dev); |
854 | pci_set_drvdata(dev, NULL); | ||
855 | kfree(priv); | 851 | kfree(priv); |
856 | } | 852 | } |
857 | 853 | ||
diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c index 5ad4b772b097..a081b925d10b 100644 --- a/drivers/mfd/tps6507x.c +++ b/drivers/mfd/tps6507x.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/of.h> | ||
22 | #include <linux/of_device.h> | 23 | #include <linux/of_device.h> |
23 | #include <linux/mfd/core.h> | 24 | #include <linux/mfd/core.h> |
24 | #include <linux/mfd/tps6507x.h> | 25 | #include <linux/mfd/tps6507x.h> |
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index b8f48647661e..b7be0b295575 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c | |||
@@ -245,7 +245,7 @@ static struct i2c_driver tps65217_driver = { | |||
245 | .driver = { | 245 | .driver = { |
246 | .name = "tps65217", | 246 | .name = "tps65217", |
247 | .owner = THIS_MODULE, | 247 | .owner = THIS_MODULE, |
248 | .of_match_table = of_match_ptr(tps65217_of_match), | 248 | .of_match_table = tps65217_of_match, |
249 | }, | 249 | }, |
250 | .id_table = tps65217_id_table, | 250 | .id_table = tps65217_id_table, |
251 | .probe = tps65217_probe, | 251 | .probe = tps65217_probe, |
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index f54fe4d4f77b..ee61fd7c198d 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/regmap.h> | 28 | #include <linux/regmap.h> |
29 | #include <linux/of.h> | ||
29 | 30 | ||
30 | #include <linux/mfd/core.h> | 31 | #include <linux/mfd/core.h> |
31 | #include <linux/mfd/tps6586x.h> | 32 | #include <linux/mfd/tps6586x.h> |
@@ -124,6 +125,7 @@ struct tps6586x { | |||
124 | struct i2c_client *client; | 125 | struct i2c_client *client; |
125 | struct regmap *regmap; | 126 | struct regmap *regmap; |
126 | 127 | ||
128 | int irq; | ||
127 | struct irq_chip irq_chip; | 129 | struct irq_chip irq_chip; |
128 | struct mutex irq_lock; | 130 | struct mutex irq_lock; |
129 | int irq_base; | 131 | int irq_base; |
@@ -261,12 +263,23 @@ static void tps6586x_irq_sync_unlock(struct irq_data *data) | |||
261 | mutex_unlock(&tps6586x->irq_lock); | 263 | mutex_unlock(&tps6586x->irq_lock); |
262 | } | 264 | } |
263 | 265 | ||
266 | #ifdef CONFIG_PM_SLEEP | ||
267 | static int tps6586x_irq_set_wake(struct irq_data *irq_data, unsigned int on) | ||
268 | { | ||
269 | struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); | ||
270 | return irq_set_irq_wake(tps6586x->irq, on); | ||
271 | } | ||
272 | #else | ||
273 | #define tps6586x_irq_set_wake NULL | ||
274 | #endif | ||
275 | |||
264 | static struct irq_chip tps6586x_irq_chip = { | 276 | static struct irq_chip tps6586x_irq_chip = { |
265 | .name = "tps6586x", | 277 | .name = "tps6586x", |
266 | .irq_bus_lock = tps6586x_irq_lock, | 278 | .irq_bus_lock = tps6586x_irq_lock, |
267 | .irq_bus_sync_unlock = tps6586x_irq_sync_unlock, | 279 | .irq_bus_sync_unlock = tps6586x_irq_sync_unlock, |
268 | .irq_disable = tps6586x_irq_disable, | 280 | .irq_disable = tps6586x_irq_disable, |
269 | .irq_enable = tps6586x_irq_enable, | 281 | .irq_enable = tps6586x_irq_enable, |
282 | .irq_set_wake = tps6586x_irq_set_wake, | ||
270 | }; | 283 | }; |
271 | 284 | ||
272 | static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq, | 285 | static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq, |
@@ -331,6 +344,8 @@ static int tps6586x_irq_init(struct tps6586x *tps6586x, int irq, | |||
331 | int new_irq_base; | 344 | int new_irq_base; |
332 | int irq_num = ARRAY_SIZE(tps6586x_irqs); | 345 | int irq_num = ARRAY_SIZE(tps6586x_irqs); |
333 | 346 | ||
347 | tps6586x->irq = irq; | ||
348 | |||
334 | mutex_init(&tps6586x->irq_lock); | 349 | mutex_init(&tps6586x->irq_lock); |
335 | for (i = 0; i < 5; i++) { | 350 | for (i = 0; i < 5; i++) { |
336 | tps6586x->mask_reg[i] = 0xff; | 351 | tps6586x->mask_reg[i] = 0xff; |
@@ -360,10 +375,8 @@ static int tps6586x_irq_init(struct tps6586x *tps6586x, int irq, | |||
360 | ret = request_threaded_irq(irq, NULL, tps6586x_irq, IRQF_ONESHOT, | 375 | ret = request_threaded_irq(irq, NULL, tps6586x_irq, IRQF_ONESHOT, |
361 | "tps6586x", tps6586x); | 376 | "tps6586x", tps6586x); |
362 | 377 | ||
363 | if (!ret) { | 378 | if (!ret) |
364 | device_init_wakeup(tps6586x->dev, 1); | 379 | device_init_wakeup(tps6586x->dev, 1); |
365 | enable_irq_wake(irq); | ||
366 | } | ||
367 | 380 | ||
368 | return ret; | 381 | return ret; |
369 | } | 382 | } |
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index d79277204835..c0f608e3ca9e 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/mfd/core.h> | 25 | #include <linux/mfd/core.h> |
26 | #include <linux/regmap.h> | 26 | #include <linux/regmap.h> |
27 | #include <linux/mfd/tps65910.h> | 27 | #include <linux/mfd/tps65910.h> |
28 | #include <linux/of.h> | ||
28 | #include <linux/of_device.h> | 29 | #include <linux/of_device.h> |
29 | 30 | ||
30 | static struct resource rtc_resources[] = { | 31 | static struct resource rtc_resources[] = { |
@@ -410,14 +411,10 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, | |||
410 | ret = of_property_read_u32(np, "ti,vmbch-threshold", &prop); | 411 | ret = of_property_read_u32(np, "ti,vmbch-threshold", &prop); |
411 | if (!ret) | 412 | if (!ret) |
412 | board_info->vmbch_threshold = prop; | 413 | board_info->vmbch_threshold = prop; |
413 | else if (*chip_id == TPS65911) | ||
414 | dev_warn(&client->dev, "VMBCH-Threshold not specified"); | ||
415 | 414 | ||
416 | ret = of_property_read_u32(np, "ti,vmbch2-threshold", &prop); | 415 | ret = of_property_read_u32(np, "ti,vmbch2-threshold", &prop); |
417 | if (!ret) | 416 | if (!ret) |
418 | board_info->vmbch2_threshold = prop; | 417 | board_info->vmbch2_threshold = prop; |
419 | else if (*chip_id == TPS65911) | ||
420 | dev_warn(&client->dev, "VMBCH2-Threshold not specified"); | ||
421 | 418 | ||
422 | prop = of_property_read_bool(np, "ti,en-ck32k-xtal"); | 419 | prop = of_property_read_bool(np, "ti,en-ck32k-xtal"); |
423 | board_info->en_ck32k_xtal = prop; | 420 | board_info->en_ck32k_xtal = prop; |
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c index daf66942071c..0779d5ab9ab1 100644 --- a/drivers/mfd/twl6040.c +++ b/drivers/mfd/twl6040.c | |||
@@ -565,13 +565,13 @@ static int twl6040_probe(struct i2c_client *client, | |||
565 | twl6040->supplies); | 565 | twl6040->supplies); |
566 | if (ret != 0) { | 566 | if (ret != 0) { |
567 | dev_err(&client->dev, "Failed to get supplies: %d\n", ret); | 567 | dev_err(&client->dev, "Failed to get supplies: %d\n", ret); |
568 | goto regulator_get_err; | 568 | return ret; |
569 | } | 569 | } |
570 | 570 | ||
571 | ret = regulator_bulk_enable(TWL6040_NUM_SUPPLIES, twl6040->supplies); | 571 | ret = regulator_bulk_enable(TWL6040_NUM_SUPPLIES, twl6040->supplies); |
572 | if (ret != 0) { | 572 | if (ret != 0) { |
573 | dev_err(&client->dev, "Failed to enable supplies: %d\n", ret); | 573 | dev_err(&client->dev, "Failed to enable supplies: %d\n", ret); |
574 | goto regulator_get_err; | 574 | return ret; |
575 | } | 575 | } |
576 | 576 | ||
577 | twl6040->dev = &client->dev; | 577 | twl6040->dev = &client->dev; |
@@ -619,7 +619,7 @@ static int twl6040_probe(struct i2c_client *client, | |||
619 | "twl6040_irq_th", twl6040); | 619 | "twl6040_irq_th", twl6040); |
620 | if (ret) { | 620 | if (ret) { |
621 | dev_err(twl6040->dev, "Thermal IRQ request failed: %d\n", ret); | 621 | dev_err(twl6040->dev, "Thermal IRQ request failed: %d\n", ret); |
622 | goto thirq_err; | 622 | goto readyirq_err; |
623 | } | 623 | } |
624 | 624 | ||
625 | /* dual-access registers controlled by I2C only */ | 625 | /* dual-access registers controlled by I2C only */ |
@@ -659,21 +659,14 @@ static int twl6040_probe(struct i2c_client *client, | |||
659 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, | 659 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, |
660 | NULL, 0, NULL); | 660 | NULL, 0, NULL); |
661 | if (ret) | 661 | if (ret) |
662 | goto mfd_err; | 662 | goto readyirq_err; |
663 | 663 | ||
664 | return 0; | 664 | return 0; |
665 | 665 | ||
666 | mfd_err: | ||
667 | devm_free_irq(&client->dev, twl6040->irq_th, twl6040); | ||
668 | thirq_err: | ||
669 | devm_free_irq(&client->dev, twl6040->irq_ready, twl6040); | ||
670 | readyirq_err: | 666 | readyirq_err: |
671 | regmap_del_irq_chip(twl6040->irq, twl6040->irq_data); | 667 | regmap_del_irq_chip(twl6040->irq, twl6040->irq_data); |
672 | gpio_err: | 668 | gpio_err: |
673 | regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies); | 669 | regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies); |
674 | regulator_get_err: | ||
675 | i2c_set_clientdata(client, NULL); | ||
676 | |||
677 | return ret; | 670 | return ret; |
678 | } | 671 | } |
679 | 672 | ||
@@ -684,12 +677,9 @@ static int twl6040_remove(struct i2c_client *client) | |||
684 | if (twl6040->power_count) | 677 | if (twl6040->power_count) |
685 | twl6040_power(twl6040, 0); | 678 | twl6040_power(twl6040, 0); |
686 | 679 | ||
687 | devm_free_irq(&client->dev, twl6040->irq_ready, twl6040); | ||
688 | devm_free_irq(&client->dev, twl6040->irq_th, twl6040); | ||
689 | regmap_del_irq_chip(twl6040->irq, twl6040->irq_data); | 680 | regmap_del_irq_chip(twl6040->irq, twl6040->irq_data); |
690 | 681 | ||
691 | mfd_remove_devices(&client->dev); | 682 | mfd_remove_devices(&client->dev); |
692 | i2c_set_clientdata(client, NULL); | ||
693 | 683 | ||
694 | regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies); | 684 | regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies); |
695 | 685 | ||
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index d5966e6b5a7d..0313f839e8fa 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -553,6 +553,7 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
553 | if (ucb->irq_base < 0) { | 553 | if (ucb->irq_base < 0) { |
554 | dev_err(&ucb->dev, "unable to allocate 16 irqs: %d\n", | 554 | dev_err(&ucb->dev, "unable to allocate 16 irqs: %d\n", |
555 | ucb->irq_base); | 555 | ucb->irq_base); |
556 | ret = ucb->irq_base; | ||
556 | goto err_irq_alloc; | 557 | goto err_irq_alloc; |
557 | } | 558 | } |
558 | 559 | ||
diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c index 802dd3cb18cf..1e9a4b2102f9 100644 --- a/drivers/mfd/wm5102-tables.c +++ b/drivers/mfd/wm5102-tables.c | |||
@@ -903,7 +903,6 @@ static const struct reg_default wm5102_reg_default[] = { | |||
903 | { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */ | 903 | { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */ |
904 | { 0x00000D1C, 0xFFFF }, /* R3356 - IRQ2 Status 5 Mask */ | 904 | { 0x00000D1C, 0xFFFF }, /* R3356 - IRQ2 Status 5 Mask */ |
905 | { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */ | 905 | { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */ |
906 | { 0x00000D50, 0x0000 }, /* R3408 - AOD wkup and trig */ | ||
907 | { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */ | 906 | { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */ |
908 | { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */ | 907 | { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */ |
909 | { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */ | 908 | { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */ |
diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c index 3113e39b318e..bf8b3b5ad1fe 100644 --- a/drivers/mfd/wm5110-tables.c +++ b/drivers/mfd/wm5110-tables.c | |||
@@ -243,6 +243,12 @@ int wm5110_patch(struct arizona *arizona) | |||
243 | EXPORT_SYMBOL_GPL(wm5110_patch); | 243 | EXPORT_SYMBOL_GPL(wm5110_patch); |
244 | 244 | ||
245 | static const struct regmap_irq wm5110_aod_irqs[ARIZONA_NUM_IRQ] = { | 245 | static const struct regmap_irq wm5110_aod_irqs[ARIZONA_NUM_IRQ] = { |
246 | [ARIZONA_IRQ_MICD_CLAMP_FALL] = { | ||
247 | .mask = ARIZONA_MICD_CLAMP_FALL_EINT1 | ||
248 | }, | ||
249 | [ARIZONA_IRQ_MICD_CLAMP_RISE] = { | ||
250 | .mask = ARIZONA_MICD_CLAMP_RISE_EINT1 | ||
251 | }, | ||
246 | [ARIZONA_IRQ_GP5_FALL] = { .mask = ARIZONA_GP5_FALL_EINT1 }, | 252 | [ARIZONA_IRQ_GP5_FALL] = { .mask = ARIZONA_GP5_FALL_EINT1 }, |
247 | [ARIZONA_IRQ_GP5_RISE] = { .mask = ARIZONA_GP5_RISE_EINT1 }, | 253 | [ARIZONA_IRQ_GP5_RISE] = { .mask = ARIZONA_GP5_RISE_EINT1 }, |
248 | [ARIZONA_IRQ_JD_FALL] = { .mask = ARIZONA_JD1_FALL_EINT1 }, | 254 | [ARIZONA_IRQ_JD_FALL] = { .mask = ARIZONA_JD1_FALL_EINT1 }, |
@@ -505,6 +511,7 @@ static const struct reg_default wm5110_reg_default[] = { | |||
505 | { 0x00000293, 0x0000 }, /* R659 - Accessory Detect Mode 1 */ | 511 | { 0x00000293, 0x0000 }, /* R659 - Accessory Detect Mode 1 */ |
506 | { 0x0000029B, 0x0020 }, /* R667 - Headphone Detect 1 */ | 512 | { 0x0000029B, 0x0020 }, /* R667 - Headphone Detect 1 */ |
507 | { 0x0000029C, 0x0000 }, /* R668 - Headphone Detect 2 */ | 513 | { 0x0000029C, 0x0000 }, /* R668 - Headphone Detect 2 */ |
514 | { 0x000002A2, 0x0000 }, /* R674 - Micd clamp control */ | ||
508 | { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */ | 515 | { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */ |
509 | { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */ | 516 | { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */ |
510 | { 0x000002A5, 0x0000 }, /* R677 - Mic Detect 3 */ | 517 | { 0x000002A5, 0x0000 }, /* R677 - Mic Detect 3 */ |
@@ -592,7 +599,7 @@ static const struct reg_default wm5110_reg_default[] = { | |||
592 | { 0x0000043E, 0x0080 }, /* R1086 - DAC Volume Limit 6R */ | 599 | { 0x0000043E, 0x0080 }, /* R1086 - DAC Volume Limit 6R */ |
593 | { 0x0000043F, 0x0800 }, /* R1087 - Noise Gate Select 6R */ | 600 | { 0x0000043F, 0x0800 }, /* R1087 - Noise Gate Select 6R */ |
594 | { 0x00000450, 0x0000 }, /* R1104 - DAC AEC Control 1 */ | 601 | { 0x00000450, 0x0000 }, /* R1104 - DAC AEC Control 1 */ |
595 | { 0x00000458, 0x0001 }, /* R1112 - Noise Gate Control */ | 602 | { 0x00000458, 0x0000 }, /* R1112 - Noise Gate Control */ |
596 | { 0x00000480, 0x0040 }, /* R1152 - Class W ANC Threshold 1 */ | 603 | { 0x00000480, 0x0040 }, /* R1152 - Class W ANC Threshold 1 */ |
597 | { 0x00000481, 0x0040 }, /* R1153 - Class W ANC Threshold 2 */ | 604 | { 0x00000481, 0x0040 }, /* R1153 - Class W ANC Threshold 2 */ |
598 | { 0x00000490, 0x0069 }, /* R1168 - PDM SPK1 CTRL 1 */ | 605 | { 0x00000490, 0x0069 }, /* R1168 - PDM SPK1 CTRL 1 */ |
@@ -1204,7 +1211,6 @@ static const struct reg_default wm5110_reg_default[] = { | |||
1204 | { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */ | 1211 | { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */ |
1205 | { 0x00000D1C, 0xFFFF }, /* R3356 - IRQ2 Status 5 Mask */ | 1212 | { 0x00000D1C, 0xFFFF }, /* R3356 - IRQ2 Status 5 Mask */ |
1206 | { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */ | 1213 | { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */ |
1207 | { 0x00000D50, 0x0000 }, /* R3408 - AOD wkup and trig */ | ||
1208 | { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */ | 1214 | { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */ |
1209 | { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */ | 1215 | { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */ |
1210 | { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */ | 1216 | { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */ |
@@ -1440,6 +1446,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg) | |||
1440 | case ARIZONA_ACCESSORY_DETECT_MODE_1: | 1446 | case ARIZONA_ACCESSORY_DETECT_MODE_1: |
1441 | case ARIZONA_HEADPHONE_DETECT_1: | 1447 | case ARIZONA_HEADPHONE_DETECT_1: |
1442 | case ARIZONA_HEADPHONE_DETECT_2: | 1448 | case ARIZONA_HEADPHONE_DETECT_2: |
1449 | case ARIZONA_MICD_CLAMP_CONTROL: | ||
1443 | case ARIZONA_MIC_DETECT_1: | 1450 | case ARIZONA_MIC_DETECT_1: |
1444 | case ARIZONA_MIC_DETECT_2: | 1451 | case ARIZONA_MIC_DETECT_2: |
1445 | case ARIZONA_MIC_DETECT_3: | 1452 | case ARIZONA_MIC_DETECT_3: |
@@ -2291,21 +2298,37 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg) | |||
2291 | case ARIZONA_DSP1_STATUS_1: | 2298 | case ARIZONA_DSP1_STATUS_1: |
2292 | case ARIZONA_DSP1_STATUS_2: | 2299 | case ARIZONA_DSP1_STATUS_2: |
2293 | case ARIZONA_DSP1_STATUS_3: | 2300 | case ARIZONA_DSP1_STATUS_3: |
2301 | case ARIZONA_DSP1_SCRATCH_0: | ||
2302 | case ARIZONA_DSP1_SCRATCH_1: | ||
2303 | case ARIZONA_DSP1_SCRATCH_2: | ||
2304 | case ARIZONA_DSP1_SCRATCH_3: | ||
2294 | case ARIZONA_DSP2_CONTROL_1: | 2305 | case ARIZONA_DSP2_CONTROL_1: |
2295 | case ARIZONA_DSP2_CLOCKING_1: | 2306 | case ARIZONA_DSP2_CLOCKING_1: |
2296 | case ARIZONA_DSP2_STATUS_1: | 2307 | case ARIZONA_DSP2_STATUS_1: |
2297 | case ARIZONA_DSP2_STATUS_2: | 2308 | case ARIZONA_DSP2_STATUS_2: |
2298 | case ARIZONA_DSP2_STATUS_3: | 2309 | case ARIZONA_DSP2_STATUS_3: |
2310 | case ARIZONA_DSP2_SCRATCH_0: | ||
2311 | case ARIZONA_DSP2_SCRATCH_1: | ||
2312 | case ARIZONA_DSP2_SCRATCH_2: | ||
2313 | case ARIZONA_DSP2_SCRATCH_3: | ||
2299 | case ARIZONA_DSP3_CONTROL_1: | 2314 | case ARIZONA_DSP3_CONTROL_1: |
2300 | case ARIZONA_DSP3_CLOCKING_1: | 2315 | case ARIZONA_DSP3_CLOCKING_1: |
2301 | case ARIZONA_DSP3_STATUS_1: | 2316 | case ARIZONA_DSP3_STATUS_1: |
2302 | case ARIZONA_DSP3_STATUS_2: | 2317 | case ARIZONA_DSP3_STATUS_2: |
2303 | case ARIZONA_DSP3_STATUS_3: | 2318 | case ARIZONA_DSP3_STATUS_3: |
2319 | case ARIZONA_DSP3_SCRATCH_0: | ||
2320 | case ARIZONA_DSP3_SCRATCH_1: | ||
2321 | case ARIZONA_DSP3_SCRATCH_2: | ||
2322 | case ARIZONA_DSP3_SCRATCH_3: | ||
2304 | case ARIZONA_DSP4_CONTROL_1: | 2323 | case ARIZONA_DSP4_CONTROL_1: |
2305 | case ARIZONA_DSP4_CLOCKING_1: | 2324 | case ARIZONA_DSP4_CLOCKING_1: |
2306 | case ARIZONA_DSP4_STATUS_1: | 2325 | case ARIZONA_DSP4_STATUS_1: |
2307 | case ARIZONA_DSP4_STATUS_2: | 2326 | case ARIZONA_DSP4_STATUS_2: |
2308 | case ARIZONA_DSP4_STATUS_3: | 2327 | case ARIZONA_DSP4_STATUS_3: |
2328 | case ARIZONA_DSP4_SCRATCH_0: | ||
2329 | case ARIZONA_DSP4_SCRATCH_1: | ||
2330 | case ARIZONA_DSP4_SCRATCH_2: | ||
2331 | case ARIZONA_DSP4_SCRATCH_3: | ||
2309 | return true; | 2332 | return true; |
2310 | default: | 2333 | default: |
2311 | return false; | 2334 | return false; |
@@ -2347,25 +2370,41 @@ static bool wm5110_volatile_register(struct device *dev, unsigned int reg) | |||
2347 | case ARIZONA_INTERRUPT_RAW_STATUS_7: | 2370 | case ARIZONA_INTERRUPT_RAW_STATUS_7: |
2348 | case ARIZONA_INTERRUPT_RAW_STATUS_8: | 2371 | case ARIZONA_INTERRUPT_RAW_STATUS_8: |
2349 | case ARIZONA_IRQ_PIN_STATUS: | 2372 | case ARIZONA_IRQ_PIN_STATUS: |
2373 | case ARIZONA_AOD_WKUP_AND_TRIG: | ||
2350 | case ARIZONA_AOD_IRQ1: | 2374 | case ARIZONA_AOD_IRQ1: |
2351 | case ARIZONA_AOD_IRQ2: | 2375 | case ARIZONA_AOD_IRQ2: |
2376 | case ARIZONA_AOD_IRQ_RAW_STATUS: | ||
2352 | case ARIZONA_FX_CTRL2: | 2377 | case ARIZONA_FX_CTRL2: |
2353 | case ARIZONA_ASRC_STATUS: | 2378 | case ARIZONA_ASRC_STATUS: |
2354 | case ARIZONA_DSP_STATUS: | 2379 | case ARIZONA_DSP_STATUS: |
2355 | case ARIZONA_DSP1_CONTROL_1: | ||
2356 | case ARIZONA_DSP1_CLOCKING_1: | ||
2357 | case ARIZONA_DSP1_STATUS_1: | 2380 | case ARIZONA_DSP1_STATUS_1: |
2358 | case ARIZONA_DSP1_STATUS_2: | 2381 | case ARIZONA_DSP1_STATUS_2: |
2359 | case ARIZONA_DSP1_STATUS_3: | 2382 | case ARIZONA_DSP1_STATUS_3: |
2383 | case ARIZONA_DSP1_SCRATCH_0: | ||
2384 | case ARIZONA_DSP1_SCRATCH_1: | ||
2385 | case ARIZONA_DSP1_SCRATCH_2: | ||
2386 | case ARIZONA_DSP1_SCRATCH_3: | ||
2360 | case ARIZONA_DSP2_STATUS_1: | 2387 | case ARIZONA_DSP2_STATUS_1: |
2361 | case ARIZONA_DSP2_STATUS_2: | 2388 | case ARIZONA_DSP2_STATUS_2: |
2362 | case ARIZONA_DSP2_STATUS_3: | 2389 | case ARIZONA_DSP2_STATUS_3: |
2390 | case ARIZONA_DSP2_SCRATCH_0: | ||
2391 | case ARIZONA_DSP2_SCRATCH_1: | ||
2392 | case ARIZONA_DSP2_SCRATCH_2: | ||
2393 | case ARIZONA_DSP2_SCRATCH_3: | ||
2363 | case ARIZONA_DSP3_STATUS_1: | 2394 | case ARIZONA_DSP3_STATUS_1: |
2364 | case ARIZONA_DSP3_STATUS_2: | 2395 | case ARIZONA_DSP3_STATUS_2: |
2365 | case ARIZONA_DSP3_STATUS_3: | 2396 | case ARIZONA_DSP3_STATUS_3: |
2397 | case ARIZONA_DSP3_SCRATCH_0: | ||
2398 | case ARIZONA_DSP3_SCRATCH_1: | ||
2399 | case ARIZONA_DSP3_SCRATCH_2: | ||
2400 | case ARIZONA_DSP3_SCRATCH_3: | ||
2366 | case ARIZONA_DSP4_STATUS_1: | 2401 | case ARIZONA_DSP4_STATUS_1: |
2367 | case ARIZONA_DSP4_STATUS_2: | 2402 | case ARIZONA_DSP4_STATUS_2: |
2368 | case ARIZONA_DSP4_STATUS_3: | 2403 | case ARIZONA_DSP4_STATUS_3: |
2404 | case ARIZONA_DSP4_SCRATCH_0: | ||
2405 | case ARIZONA_DSP4_SCRATCH_1: | ||
2406 | case ARIZONA_DSP4_SCRATCH_2: | ||
2407 | case ARIZONA_DSP4_SCRATCH_3: | ||
2369 | return true; | 2408 | return true; |
2370 | default: | 2409 | default: |
2371 | return false; | 2410 | return false; |
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index e1c283e6d4e5..030827511667 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -33,84 +33,6 @@ | |||
33 | 33 | ||
34 | #include "wm8994.h" | 34 | #include "wm8994.h" |
35 | 35 | ||
36 | /** | ||
37 | * wm8994_reg_read: Read a single WM8994 register. | ||
38 | * | ||
39 | * @wm8994: Device to read from. | ||
40 | * @reg: Register to read. | ||
41 | */ | ||
42 | int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg) | ||
43 | { | ||
44 | unsigned int val; | ||
45 | int ret; | ||
46 | |||
47 | ret = regmap_read(wm8994->regmap, reg, &val); | ||
48 | |||
49 | if (ret < 0) | ||
50 | return ret; | ||
51 | else | ||
52 | return val; | ||
53 | } | ||
54 | EXPORT_SYMBOL_GPL(wm8994_reg_read); | ||
55 | |||
56 | /** | ||
57 | * wm8994_bulk_read: Read multiple WM8994 registers | ||
58 | * | ||
59 | * @wm8994: Device to read from | ||
60 | * @reg: First register | ||
61 | * @count: Number of registers | ||
62 | * @buf: Buffer to fill. The data will be returned big endian. | ||
63 | */ | ||
64 | int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, | ||
65 | int count, u16 *buf) | ||
66 | { | ||
67 | return regmap_bulk_read(wm8994->regmap, reg, buf, count); | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * wm8994_reg_write: Write a single WM8994 register. | ||
72 | * | ||
73 | * @wm8994: Device to write to. | ||
74 | * @reg: Register to write to. | ||
75 | * @val: Value to write. | ||
76 | */ | ||
77 | int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg, | ||
78 | unsigned short val) | ||
79 | { | ||
80 | return regmap_write(wm8994->regmap, reg, val); | ||
81 | } | ||
82 | EXPORT_SYMBOL_GPL(wm8994_reg_write); | ||
83 | |||
84 | /** | ||
85 | * wm8994_bulk_write: Write multiple WM8994 registers | ||
86 | * | ||
87 | * @wm8994: Device to write to | ||
88 | * @reg: First register | ||
89 | * @count: Number of registers | ||
90 | * @buf: Buffer to write from. Data must be big-endian formatted. | ||
91 | */ | ||
92 | int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg, | ||
93 | int count, const u16 *buf) | ||
94 | { | ||
95 | return regmap_raw_write(wm8994->regmap, reg, buf, count * sizeof(u16)); | ||
96 | } | ||
97 | EXPORT_SYMBOL_GPL(wm8994_bulk_write); | ||
98 | |||
99 | /** | ||
100 | * wm8994_set_bits: Set the value of a bitfield in a WM8994 register | ||
101 | * | ||
102 | * @wm8994: Device to write to. | ||
103 | * @reg: Register to write to. | ||
104 | * @mask: Mask of bits to set. | ||
105 | * @val: Value to set (unshifted) | ||
106 | */ | ||
107 | int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg, | ||
108 | unsigned short mask, unsigned short val) | ||
109 | { | ||
110 | return regmap_update_bits(wm8994->regmap, reg, mask, val); | ||
111 | } | ||
112 | EXPORT_SYMBOL_GPL(wm8994_set_bits); | ||
113 | |||
114 | static struct mfd_cell wm8994_regulator_devs[] = { | 36 | static struct mfd_cell wm8994_regulator_devs[] = { |
115 | { | 37 | { |
116 | .name = "wm8994-ldo", | 38 | .name = "wm8994-ldo", |