aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-10-25 05:03:48 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-10-25 05:03:48 -0400
commit8df5a1ba67b1a4b1560472359c30a5b1e3ebcc78 (patch)
tree1563cc6270c76867a8dfe60c7c3d1e57064fed79
parent46a99d03f97e54d346a35bb8f0fa79ba73687ad0 (diff)
parent6bfd1e63de34a278d67db32e3644340838308252 (diff)
Merge tag 'mfd-lee-3.13-1' of git://git.linaro.org/people/ljones/mfd
mfd-lee-3.13-1 MFD patches due for v3.13.
-rw-r--r--Documentation/devicetree/bindings/mfd/as3722.txt194
-rw-r--r--drivers/mfd/88pm860x-core.c2
-rw-r--r--drivers/mfd/Kconfig22
-rw-r--r--drivers/mfd/Makefile2
-rw-r--r--drivers/mfd/aat2870-core.c2
-rw-r--r--drivers/mfd/arizona-core.c6
-rw-r--r--drivers/mfd/arizona-i2c.c1
-rw-r--r--drivers/mfd/arizona-spi.c1
-rw-r--r--drivers/mfd/as3711.c1
-rw-r--r--drivers/mfd/as3722.c449
-rw-r--r--drivers/mfd/da9052-i2c.c12
-rw-r--r--drivers/mfd/ezx-pcap.c8
-rw-r--r--drivers/mfd/lpc_ich.c2
-rw-r--r--drivers/mfd/lpc_sch.c3
-rw-r--r--drivers/mfd/max77686.c1
-rw-r--r--drivers/mfd/max77693.c19
-rw-r--r--drivers/mfd/max8907.c1
-rw-r--r--drivers/mfd/max8925-i2c.c2
-rw-r--r--drivers/mfd/max8997.c1
-rw-r--r--drivers/mfd/mc13xxx-core.c5
-rw-r--r--drivers/mfd/mc13xxx-i2c.c1
-rw-r--r--drivers/mfd/mc13xxx-spi.c5
-rw-r--r--drivers/mfd/omap-usb-host.c18
-rw-r--r--drivers/mfd/omap-usb-tll.c6
-rw-r--r--drivers/mfd/palmas.c30
-rw-r--r--drivers/mfd/rts5249.c48
-rw-r--r--drivers/mfd/rtsx_pcr.c5
-rw-r--r--drivers/mfd/sec-core.c1
-rw-r--r--drivers/mfd/sm501.c4
-rw-r--r--drivers/mfd/stw481x.c250
-rw-r--r--drivers/mfd/tc3589x.c37
-rw-r--r--drivers/mfd/ti-ssp.c1
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c24
-rw-r--r--drivers/mfd/timberdale.c6
-rw-r--r--drivers/mfd/tps6507x.c1
-rw-r--r--drivers/mfd/tps65217.c2
-rw-r--r--drivers/mfd/tps6586x.c19
-rw-r--r--drivers/mfd/tps65910.c1
-rw-r--r--drivers/mfd/twl6040.c10
-rw-r--r--drivers/mfd/ucb1x00-core.c1
-rw-r--r--drivers/mfd/wm5102-tables.c1
-rw-r--r--drivers/mfd/wm5110-tables.c39
-rw-r--r--drivers/mfd/wm8994-core.c78
-rw-r--r--include/dt-bindings/mfd/as3722.h52
-rw-r--r--include/linux/mfd/arizona/registers.h2
-rw-r--r--include/linux/mfd/as3722.h423
-rw-r--r--include/linux/mfd/da9052/da9052.h20
-rw-r--r--include/linux/mfd/max77693-private.h1
-rw-r--r--include/linux/mfd/max77693.h2
-rw-r--r--include/linux/mfd/mc13xxx.h7
-rw-r--r--include/linux/mfd/rtsx_pci.h53
-rw-r--r--include/linux/mfd/stw481x.h56
-rw-r--r--include/linux/mfd/syscon.h25
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h20
-rw-r--r--include/linux/mfd/wm8994/core.h47
-rw-r--r--sound/soc/codecs/mc13783.c4
56 files changed, 1826 insertions, 208 deletions
diff --git a/Documentation/devicetree/bindings/mfd/as3722.txt b/Documentation/devicetree/bindings/mfd/as3722.txt
new file mode 100644
index 000000000000..fc2191ecfd6b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/as3722.txt
@@ -0,0 +1,194 @@
1* ams AS3722 Power management IC.
2
3Required properties:
4-------------------
5- compatible: Must be "ams,as3722".
6- reg: I2C device address.
7- interrupt-controller: AS3722 has internal interrupt controller which takes the
8 interrupt request from internal sub-blocks like RTC, regulators, GPIOs as well
9 as external input.
10- #interrupt-cells: Should be set to 2 for IRQ number and flags.
11 The first cell is the IRQ number. IRQ numbers for different interrupt source
12 of AS3722 are defined at dt-bindings/mfd/as3722.h
13 The second cell is the flags, encoded as the trigger masks from binding document
14 interrupts.txt, using dt-bindings/irq.
15
16Optional submodule and their properties:
17=======================================
18
19Pinmux and GPIO:
20===============
21Device has 8 GPIO pins which can be configured as GPIO as well as the special IO
22functions.
23
24Please refer to pinctrl-bindings.txt in this directory for details of the
25common pinctrl bindings used by client devices, including the meaning of the
26phrase "pin configuration node".
27
28Following are properties which is needed if GPIO and pinmux functionality
29is required:
30 Required properties:
31 -------------------
32 - gpio-controller: Marks the device node as a GPIO controller.
33 - #gpio-cells: Number of GPIO cells. Refer to binding document
34 gpio/gpio.txt
35
36 Optional properties:
37 --------------------
38 Following properties are require if pin control setting is required
39 at boot.
40 - pinctrl-names: A pinctrl state named "default" be defined, using the
41 bindings in pinctrl/pinctrl-binding.txt.
42 - pinctrl[0...n]: Properties to contain the phandle that refer to
43 different nodes of pin control settings. These nodes represents
44 the pin control setting of state 0 to state n. Each of these
45 nodes contains different subnodes to represents some desired
46 configuration for a list of pins. This configuration can
47 include the mux function to select on those pin(s), and
48 various pin configuration parameters, such as pull-up,
49 open drain.
50
51 Each subnode have following properties:
52 Required properties:
53 - pins: List of pins. Valid values of pins properties are:
54 gpio0, gpio1, gpio2, gpio3, gpio4, gpio5,
55 gpio6, gpio7
56
57 Optional properties:
58 function, bias-disable, bias-pull-up, bias-pull-down,
59 bias-high-impedance, drive-open-drain.
60
61 Valid values for function properties are:
62 gpio, interrupt-out, gpio-in-interrupt,
63 vsup-vbat-low-undebounce-out,
64 vsup-vbat-low-debounce-out,
65 voltage-in-standby, oc-pg-sd0, oc-pg-sd6,
66 powergood-out, pwm-in, pwm-out, clk32k-out,
67 watchdog-in, soft-reset-in
68
69Regulators:
70===========
71Device has multiple DCDC and LDOs. The node "regulators" is require if regulator
72functionality is needed.
73
74Following are properties of regulator subnode.
75
76 Optional properties:
77 -------------------
78 The input supply of regulators are the optional properties on the
79 regulator node. The input supply of these regulators are provided
80 through following properties:
81 vsup-sd2-supply: Input supply for SD2.
82 vsup-sd3-supply: Input supply for SD3.
83 vsup-sd4-supply: Input supply for SD4.
84 vsup-sd5-supply: Input supply for SD5.
85 vin-ldo0-supply: Input supply for LDO0.
86 vin-ldo1-6-supply: Input supply for LDO1 and LDO6.
87 vin-ldo2-5-7-supply: Input supply for LDO2, LDO5 and LDO7.
88 vin-ldo3-4-supply: Input supply for LDO3 and LDO4.
89 vin-ldo9-10-supply: Input supply for LDO9 and LDO10.
90 vin-ldo11-supply: Input supply for LDO11.
91
92 Optional sub nodes for regulators:
93 ---------------------------------
94 The subnodes name is the name of regulator and it must be one of:
95 sd[0-6], ldo[0-7], ldo[9-11]
96
97 Each sub-node should contain the constraints and initialization
98 information for that regulator. See regulator.txt for a description
99 of standard properties for these sub-nodes.
100 Additional optional custom properties are listed below.
101 ams,ext-control: External control of the rail. The option of
102 this properties will tell which external input is
103 controlling this rail. Valid values are 0, 1, 2 ad 3.
104 0: There is no external control of this rail.
105 1: Rail is controlled by ENABLE1 input pin.
106 2: Rail is controlled by ENABLE2 input pin.
107 3: Rail is controlled by ENABLE3 input pin.
108 Missing this property on DT will be assume as no
109 external control. The external control pin macros
110 are defined @dt-bindings/mfd/as3722.h
111
112 ams,enable-tracking: Enable tracking with SD1, only supported
113 by LDO3.
114
115Example:
116--------
117#include <dt-bindings/mfd/as3722.h>
118...
119ams3722 {
120 compatible = "ams,as3722";
121 reg = <0x48>;
122
123 interrupt-parent = <&intc>;
124 interrupt-controller;
125 #interrupt-cells = <2>;
126
127 gpio-controller;
128 #gpio-cells = <2>;
129
130 pinctrl-names = "default";
131 pinctrl-0 = <&as3722_default>;
132
133 as3722_default: pinmux {
134 gpio0 {
135 pins = "gpio0";
136 function = "gpio";
137 bias-pull-down;
138 };
139
140 gpio1_2_4_7 {
141 pins = "gpio1", "gpio2", "gpio4", "gpio7";
142 function = "gpio";
143 bias-pull-up;
144 };
145
146 gpio5 {
147 pins = "gpio5";
148 function = "clk32k_out";
149 };
150 }
151
152 regulators {
153 vsup-sd2-supply = <...>;
154 ...
155
156 sd0 {
157 regulator-name = "vdd_cpu";
158 regulator-min-microvolt = <700000>;
159 regulator-max-microvolt = <1400000>;
160 regulator-always-on;
161 ams,ext-control = <2>;
162 };
163
164 sd1 {
165 regulator-name = "vdd_core";
166 regulator-min-microvolt = <700000>;
167 regulator-max-microvolt = <1400000>;
168 regulator-always-on;
169 ams,ext-control = <1>;
170 };
171
172 sd2 {
173 regulator-name = "vddio_ddr";
174 regulator-min-microvolt = <1350000>;
175 regulator-max-microvolt = <1350000>;
176 regulator-always-on;
177 };
178
179 sd4 {
180 regulator-name = "avdd-hdmi-pex";
181 regulator-min-microvolt = <1050000>;
182 regulator-max-microvolt = <1050000>;
183 regulator-always-on;
184 };
185
186 sd5 {
187 regulator-name = "vdd-1v8";
188 regulator-min-microvolt = <1800000>;
189 regulator-max-microvolt = <1800000>;
190 regulator-always-on;
191 };
192 ....
193 };
194};
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
30config 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
30config PMIC_ADP5520 42config 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
1166config 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
1154endmenu 1176endmenu
1155endif 1177endif
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
162obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o vexpress-sysreg.o 162obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o vexpress-sysreg.o
163obj-$(CONFIG_MFD_RETU) += retu-mfd.o 163obj-$(CONFIG_MFD_RETU) += retu-mfd.o
164obj-$(CONFIG_MFD_AS3711) += as3711.o 164obj-$(CONFIG_MFD_AS3711) += as3711.o
165obj-$(CONFIG_MFD_AS3722) += as3722.o
166obj-$(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 5ac3aa48473b..ba808b744238 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 {
@@ -607,11 +607,11 @@ int arizona_dev_init(struct arizona *arizona)
607 dev_set_drvdata(arizona->dev, arizona); 607 dev_set_drvdata(arizona->dev, arizona);
608 mutex_init(&arizona->clk_lock); 608 mutex_init(&arizona->clk_lock);
609 609
610 arizona_of_get_core_pdata(arizona);
611
612 if (dev_get_platdata(arizona->dev)) 610 if (dev_get_platdata(arizona->dev))
613 memcpy(&arizona->pdata, dev_get_platdata(arizona->dev), 611 memcpy(&arizona->pdata, dev_get_platdata(arizona->dev),
614 sizeof(arizona->pdata)); 612 sizeof(arizona->pdata));
613 else
614 arizona_of_get_core_pdata(arizona);
615 615
616 regcache_cache_only(arizona->regmap, true); 616 regcache_cache_only(arizona->regmap, true);
617 617
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..cd8ee593cfa8
--- /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
39static 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
48static 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
57static 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
79static 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
209static 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
218static 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
245static 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
262static 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
279static 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
284static 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
302static 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
307static 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
312static 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
317const 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
327static 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
353static 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
407scrub:
408 regmap_del_irq_chip(as3722->chip_irq, as3722->irq_data);
409 return ret;
410}
411
412static 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
421static const struct of_device_id as3722_of_match[] = {
422 { .compatible = "ams,as3722", },
423 {},
424};
425MODULE_DEVICE_TABLE(of, as3722_of_match);
426
427static const struct i2c_device_id as3722_i2c_id[] = {
428 { "as3722", 0 },
429 {},
430};
431MODULE_DEVICE_TABLE(i2c, as3722_i2c_id);
432
433static 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
444module_i2c_driver(as3722_i2c_driver);
445
446MODULE_DESCRIPTION("I2C support for AS3722 PMICs");
447MODULE_AUTHOR("Florian Lobmaier <florian.lobmaier@ams.com>");
448MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
449MODULE_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
89static 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 */
93static 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,
394static int ezx_pcap_remove(struct spi_device *spi) 394static 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
510remove_subdevs: 506remove_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);
514free_irqchip: 508free_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..316af07ede3f 100644
--- a/drivers/mfd/lpc_ich.c
+++ b/drivers/mfd/lpc_ich.c
@@ -969,7 +969,6 @@ static int lpc_ich_probe(struct pci_dev *dev,
969 if (!cell_added) { 969 if (!cell_added) {
970 dev_warn(&dev->dev, "No MFD cells added\n"); 970 dev_warn(&dev->dev, "No MFD cells added\n");
971 lpc_ich_restore_config_space(dev); 971 lpc_ich_restore_config_space(dev);
972 pci_set_drvdata(dev, NULL);
973 return -ENODEV; 972 return -ENODEV;
974 } 973 }
975 974
@@ -980,7 +979,6 @@ static void lpc_ich_remove(struct pci_dev *dev)
980{ 979{
981 mfd_remove_devices(&dev->dev); 980 mfd_remove_devices(&dev->dev);
982 lpc_ich_restore_config_space(dev); 981 lpc_ich_restore_config_space(dev);
983 pci_set_drvdata(dev, NULL);
984} 982}
985 983
986static struct pci_driver lpc_ich_driver = { 984static 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
64static struct mfd_cell sch_gpio_cell = { 65static 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
70static struct mfd_cell wdt_sch_cell = { 72static 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
76static DEFINE_PCI_DEVICE_TABLE(lpc_sch_ids) = { 79static 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.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 &reg_data); 137 &reg_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
186err_mfd: 177err_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
230static struct of_device_id max77693_dt_match[] = {
231 { .compatible = "maxim,max77693" },
232 {},
233};
234#endif
235
238static struct i2c_driver max77693_i2c_driver = { 236static 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-core.c b/drivers/mfd/mc13xxx-core.c
index 2a9b100c4825..dbbf8ee3f592 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -158,8 +158,6 @@ int mc13xxx_reg_read(struct mc13xxx *mc13xxx, unsigned int offset, u32 *val)
158{ 158{
159 int ret; 159 int ret;
160 160
161 BUG_ON(!mutex_is_locked(&mc13xxx->lock));
162
163 if (offset > MC13XXX_NUMREGS) 161 if (offset > MC13XXX_NUMREGS)
164 return -EINVAL; 162 return -EINVAL;
165 163
@@ -172,8 +170,6 @@ EXPORT_SYMBOL(mc13xxx_reg_read);
172 170
173int mc13xxx_reg_write(struct mc13xxx *mc13xxx, unsigned int offset, u32 val) 171int mc13xxx_reg_write(struct mc13xxx *mc13xxx, unsigned int offset, u32 val)
174{ 172{
175 BUG_ON(!mutex_is_locked(&mc13xxx->lock));
176
177 dev_vdbg(mc13xxx->dev, "[0x%02x] <- 0x%06x\n", offset, val); 173 dev_vdbg(mc13xxx->dev, "[0x%02x] <- 0x%06x\n", offset, val);
178 174
179 if (offset > MC13XXX_NUMREGS || val > 0xffffff) 175 if (offset > MC13XXX_NUMREGS || val > 0xffffff)
@@ -186,7 +182,6 @@ EXPORT_SYMBOL(mc13xxx_reg_write);
186int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset, 182int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset,
187 u32 mask, u32 val) 183 u32 mask, u32 val)
188{ 184{
189 BUG_ON(!mutex_is_locked(&mc13xxx->lock));
190 BUG_ON(val & ~mask); 185 BUG_ON(val & ~mask);
191 dev_vdbg(mc13xxx->dev, "[0x%02x] <- 0x%06x (mask: 0x%06x)\n", 186 dev_vdbg(mc13xxx->dev, "[0x%02x] <- 0x%06x (mask: 0x%06x)\n",
192 offset, val, mask); 187 offset, val, mask);
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/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 77189daadf1e..5f14ef6693c2 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -94,10 +94,15 @@ static int mc13xxx_spi_write(void *context, const void *data, size_t count)
94{ 94{
95 struct device *dev = context; 95 struct device *dev = context;
96 struct spi_device *spi = to_spi_device(dev); 96 struct spi_device *spi = to_spi_device(dev);
97 const char *reg = data;
97 98
98 if (count != 4) 99 if (count != 4)
99 return -ENOTSUPP; 100 return -ENOTSUPP;
100 101
102 /* include errata fix for spi audio problems */
103 if (*reg == MC13783_AUDIO_CODEC || *reg == MC13783_AUDIO_DAC)
104 spi_write(spi, data, count);
105
101 return spi_write(spi, data, count); 106 return spi_write(spi, data, count);
102} 107}
103 108
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};
371MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
371 372
372static int palmas_i2c_probe(struct i2c_client *i2c, 373static 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
470no_irq: 471no_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
560err_irq: 560err_irq:
561 regmap_del_irq_chip(palmas->irq, palmas->irq_data); 561 regmap_del_irq_chip(palmas->irq, palmas->irq_data);
562err: 562err_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
566static int palmas_i2c_remove(struct i2c_client *i2c) 570static 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/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
142static int rts5249_turn_on_led(struct rtsx_pcr *pcr) 186static 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);
1210unmap: 1210unmap:
1211 iounmap(pcr->remap_addr); 1211 iounmap(pcr->remap_addr);
1212free_host:
1213 dev_set_drvdata(&pcidev->dev, NULL);
1214free_handle: 1212free_handle:
1215 kfree(handle); 1213 kfree(handle);
1216free_pcr: 1214free_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
1235static DEVICE_ATTR(dbg_regs, 0666, sm501_dbg_regs, NULL); 1235static 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 */
45static 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
72static 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 */
162static struct mfd_cell stw481x_cells[] = {
163 {
164 .of_compatible = "st,stw481x-vmmc",
165 .name = "stw481x-vmmc-regulator",
166 .id = -1,
167 },
168};
169
170const struct regmap_config stw481x_regmap_config = {
171 .reg_bits = 8,
172 .val_bits = 8,
173};
174
175static 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
213static 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 */
224static const struct i2c_device_id stw481x_id[] = {
225 { "stw481x", 0 },
226 { },
227};
228
229static const struct of_device_id stw481x_match[] = {
230 { .compatible = "st,stw4810", },
231 { .compatible = "st,stw4811", },
232 { },
233};
234MODULE_DEVICE_TABLE(of, stw481x_match);
235
236static 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
246module_i2c_driver(stw481x_driver);
247
248MODULE_AUTHOR("Linus Walleij");
249MODULE_DESCRIPTION("STw481x PMIC driver");
250MODULE_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 */
22enum 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)
432static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume); 459static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume);
433 460
434static const struct i2c_device_id tc3589x_id[] = { 461static 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};
438MODULE_DEVICE_TABLE(i2c, tc3589x_id); 471MODULE_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
57void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val) 57void 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}
65EXPORT_SYMBOL_GPL(am335x_tsc_se_set); 67EXPORT_SYMBOL_GPL(am335x_tsc_se_set);
66 68
67void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val) 69void 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}
75EXPORT_SYMBOL_GPL(am335x_tsc_se_clr); 79EXPORT_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);
829err_ioremap: 829err_ioremap:
830 release_mem_region(priv->ctl_mapbase, CHIPCTLSIZE); 830 release_mem_region(priv->ctl_mapbase, CHIPCTLSIZE);
831err_request:
832 pci_set_drvdata(dev, NULL);
833err_start: 831err_start:
834 pci_disable_device(dev); 832 pci_disable_device(dev);
835err_enable: 833err_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
267static 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
264static struct irq_chip tps6586x_irq_chip = { 276static 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
272static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq, 285static 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 78ffe6e53eb8..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
30static struct resource rtc_resources[] = { 31static struct resource rtc_resources[] = {
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 9d948af420db..0779d5ab9ab1 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -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,14 +659,10 @@ 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
666mfd_err:
667 devm_free_irq(&client->dev, twl6040->irq_th, twl6040);
668thirq_err:
669 devm_free_irq(&client->dev, twl6040->irq_ready, twl6040);
670readyirq_err: 666readyirq_err:
671 regmap_del_irq_chip(twl6040->irq, twl6040->irq_data); 667 regmap_del_irq_chip(twl6040->irq, twl6040->irq_data);
672gpio_err: 668gpio_err:
@@ -681,8 +677,6 @@ static int twl6040_remove(struct i2c_client *client)
681 if (twl6040->power_count) 677 if (twl6040->power_count)
682 twl6040_power(twl6040, 0); 678 twl6040_power(twl6040, 0);
683 679
684 devm_free_irq(&client->dev, twl6040->irq_ready, twl6040);
685 devm_free_irq(&client->dev, twl6040->irq_th, twl6040);
686 regmap_del_irq_chip(twl6040->irq, twl6040->irq_data); 680 regmap_del_irq_chip(twl6040->irq, twl6040->irq_data);
687 681
688 mfd_remove_devices(&client->dev); 682 mfd_remove_devices(&client->dev);
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..c5c116a7b5ff 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -592,7 +592,7 @@ static const struct reg_default wm5110_reg_default[] = {
592 { 0x0000043E, 0x0080 }, /* R1086 - DAC Volume Limit 6R */ 592 { 0x0000043E, 0x0080 }, /* R1086 - DAC Volume Limit 6R */
593 { 0x0000043F, 0x0800 }, /* R1087 - Noise Gate Select 6R */ 593 { 0x0000043F, 0x0800 }, /* R1087 - Noise Gate Select 6R */
594 { 0x00000450, 0x0000 }, /* R1104 - DAC AEC Control 1 */ 594 { 0x00000450, 0x0000 }, /* R1104 - DAC AEC Control 1 */
595 { 0x00000458, 0x0001 }, /* R1112 - Noise Gate Control */ 595 { 0x00000458, 0x0000 }, /* R1112 - Noise Gate Control */
596 { 0x00000480, 0x0040 }, /* R1152 - Class W ANC Threshold 1 */ 596 { 0x00000480, 0x0040 }, /* R1152 - Class W ANC Threshold 1 */
597 { 0x00000481, 0x0040 }, /* R1153 - Class W ANC Threshold 2 */ 597 { 0x00000481, 0x0040 }, /* R1153 - Class W ANC Threshold 2 */
598 { 0x00000490, 0x0069 }, /* R1168 - PDM SPK1 CTRL 1 */ 598 { 0x00000490, 0x0069 }, /* R1168 - PDM SPK1 CTRL 1 */
@@ -1204,7 +1204,6 @@ static const struct reg_default wm5110_reg_default[] = {
1204 { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */ 1204 { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */
1205 { 0x00000D1C, 0xFFFF }, /* R3356 - IRQ2 Status 5 Mask */ 1205 { 0x00000D1C, 0xFFFF }, /* R3356 - IRQ2 Status 5 Mask */
1206 { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */ 1206 { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */
1207 { 0x00000D50, 0x0000 }, /* R3408 - AOD wkup and trig */
1208 { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */ 1207 { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */
1209 { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */ 1208 { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */
1210 { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */ 1209 { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */
@@ -2291,21 +2290,37 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
2291 case ARIZONA_DSP1_STATUS_1: 2290 case ARIZONA_DSP1_STATUS_1:
2292 case ARIZONA_DSP1_STATUS_2: 2291 case ARIZONA_DSP1_STATUS_2:
2293 case ARIZONA_DSP1_STATUS_3: 2292 case ARIZONA_DSP1_STATUS_3:
2293 case ARIZONA_DSP1_SCRATCH_0:
2294 case ARIZONA_DSP1_SCRATCH_1:
2295 case ARIZONA_DSP1_SCRATCH_2:
2296 case ARIZONA_DSP1_SCRATCH_3:
2294 case ARIZONA_DSP2_CONTROL_1: 2297 case ARIZONA_DSP2_CONTROL_1:
2295 case ARIZONA_DSP2_CLOCKING_1: 2298 case ARIZONA_DSP2_CLOCKING_1:
2296 case ARIZONA_DSP2_STATUS_1: 2299 case ARIZONA_DSP2_STATUS_1:
2297 case ARIZONA_DSP2_STATUS_2: 2300 case ARIZONA_DSP2_STATUS_2:
2298 case ARIZONA_DSP2_STATUS_3: 2301 case ARIZONA_DSP2_STATUS_3:
2302 case ARIZONA_DSP2_SCRATCH_0:
2303 case ARIZONA_DSP2_SCRATCH_1:
2304 case ARIZONA_DSP2_SCRATCH_2:
2305 case ARIZONA_DSP2_SCRATCH_3:
2299 case ARIZONA_DSP3_CONTROL_1: 2306 case ARIZONA_DSP3_CONTROL_1:
2300 case ARIZONA_DSP3_CLOCKING_1: 2307 case ARIZONA_DSP3_CLOCKING_1:
2301 case ARIZONA_DSP3_STATUS_1: 2308 case ARIZONA_DSP3_STATUS_1:
2302 case ARIZONA_DSP3_STATUS_2: 2309 case ARIZONA_DSP3_STATUS_2:
2303 case ARIZONA_DSP3_STATUS_3: 2310 case ARIZONA_DSP3_STATUS_3:
2311 case ARIZONA_DSP3_SCRATCH_0:
2312 case ARIZONA_DSP3_SCRATCH_1:
2313 case ARIZONA_DSP3_SCRATCH_2:
2314 case ARIZONA_DSP3_SCRATCH_3:
2304 case ARIZONA_DSP4_CONTROL_1: 2315 case ARIZONA_DSP4_CONTROL_1:
2305 case ARIZONA_DSP4_CLOCKING_1: 2316 case ARIZONA_DSP4_CLOCKING_1:
2306 case ARIZONA_DSP4_STATUS_1: 2317 case ARIZONA_DSP4_STATUS_1:
2307 case ARIZONA_DSP4_STATUS_2: 2318 case ARIZONA_DSP4_STATUS_2:
2308 case ARIZONA_DSP4_STATUS_3: 2319 case ARIZONA_DSP4_STATUS_3:
2320 case ARIZONA_DSP4_SCRATCH_0:
2321 case ARIZONA_DSP4_SCRATCH_1:
2322 case ARIZONA_DSP4_SCRATCH_2:
2323 case ARIZONA_DSP4_SCRATCH_3:
2309 return true; 2324 return true;
2310 default: 2325 default:
2311 return false; 2326 return false;
@@ -2347,25 +2362,41 @@ static bool wm5110_volatile_register(struct device *dev, unsigned int reg)
2347 case ARIZONA_INTERRUPT_RAW_STATUS_7: 2362 case ARIZONA_INTERRUPT_RAW_STATUS_7:
2348 case ARIZONA_INTERRUPT_RAW_STATUS_8: 2363 case ARIZONA_INTERRUPT_RAW_STATUS_8:
2349 case ARIZONA_IRQ_PIN_STATUS: 2364 case ARIZONA_IRQ_PIN_STATUS:
2365 case ARIZONA_AOD_WKUP_AND_TRIG:
2350 case ARIZONA_AOD_IRQ1: 2366 case ARIZONA_AOD_IRQ1:
2351 case ARIZONA_AOD_IRQ2: 2367 case ARIZONA_AOD_IRQ2:
2368 case ARIZONA_AOD_IRQ_RAW_STATUS:
2352 case ARIZONA_FX_CTRL2: 2369 case ARIZONA_FX_CTRL2:
2353 case ARIZONA_ASRC_STATUS: 2370 case ARIZONA_ASRC_STATUS:
2354 case ARIZONA_DSP_STATUS: 2371 case ARIZONA_DSP_STATUS:
2355 case ARIZONA_DSP1_CONTROL_1:
2356 case ARIZONA_DSP1_CLOCKING_1:
2357 case ARIZONA_DSP1_STATUS_1: 2372 case ARIZONA_DSP1_STATUS_1:
2358 case ARIZONA_DSP1_STATUS_2: 2373 case ARIZONA_DSP1_STATUS_2:
2359 case ARIZONA_DSP1_STATUS_3: 2374 case ARIZONA_DSP1_STATUS_3:
2375 case ARIZONA_DSP1_SCRATCH_0:
2376 case ARIZONA_DSP1_SCRATCH_1:
2377 case ARIZONA_DSP1_SCRATCH_2:
2378 case ARIZONA_DSP1_SCRATCH_3:
2360 case ARIZONA_DSP2_STATUS_1: 2379 case ARIZONA_DSP2_STATUS_1:
2361 case ARIZONA_DSP2_STATUS_2: 2380 case ARIZONA_DSP2_STATUS_2:
2362 case ARIZONA_DSP2_STATUS_3: 2381 case ARIZONA_DSP2_STATUS_3:
2382 case ARIZONA_DSP2_SCRATCH_0:
2383 case ARIZONA_DSP2_SCRATCH_1:
2384 case ARIZONA_DSP2_SCRATCH_2:
2385 case ARIZONA_DSP2_SCRATCH_3:
2363 case ARIZONA_DSP3_STATUS_1: 2386 case ARIZONA_DSP3_STATUS_1:
2364 case ARIZONA_DSP3_STATUS_2: 2387 case ARIZONA_DSP3_STATUS_2:
2365 case ARIZONA_DSP3_STATUS_3: 2388 case ARIZONA_DSP3_STATUS_3:
2389 case ARIZONA_DSP3_SCRATCH_0:
2390 case ARIZONA_DSP3_SCRATCH_1:
2391 case ARIZONA_DSP3_SCRATCH_2:
2392 case ARIZONA_DSP3_SCRATCH_3:
2366 case ARIZONA_DSP4_STATUS_1: 2393 case ARIZONA_DSP4_STATUS_1:
2367 case ARIZONA_DSP4_STATUS_2: 2394 case ARIZONA_DSP4_STATUS_2:
2368 case ARIZONA_DSP4_STATUS_3: 2395 case ARIZONA_DSP4_STATUS_3:
2396 case ARIZONA_DSP4_SCRATCH_0:
2397 case ARIZONA_DSP4_SCRATCH_1:
2398 case ARIZONA_DSP4_SCRATCH_2:
2399 case ARIZONA_DSP4_SCRATCH_3:
2369 return true; 2400 return true;
2370 default: 2401 default:
2371 return false; 2402 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 */
42int 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}
54EXPORT_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 */
64int 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 */
77int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
78 unsigned short val)
79{
80 return regmap_write(wm8994->regmap, reg, val);
81}
82EXPORT_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 */
92int 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}
97EXPORT_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 */
107int 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}
112EXPORT_SYMBOL_GPL(wm8994_set_bits);
113
114static struct mfd_cell wm8994_regulator_devs[] = { 36static struct mfd_cell wm8994_regulator_devs[] = {
115 { 37 {
116 .name = "wm8994-ldo", 38 .name = "wm8994-ldo",
diff --git a/include/dt-bindings/mfd/as3722.h b/include/dt-bindings/mfd/as3722.h
new file mode 100644
index 000000000000..0e692562d77b
--- /dev/null
+++ b/include/dt-bindings/mfd/as3722.h
@@ -0,0 +1,52 @@
1/*
2 * This header provides macros for ams AS3722 device bindings.
3 *
4 * Copyright (c) 2013, NVIDIA Corporation.
5 *
6 * Author: Laxman Dewangan <ldewangan@nvidia.com>
7 *
8 */
9
10#ifndef __DT_BINDINGS_AS3722_H__
11#define __DT_BINDINGS_AS3722_H__
12
13/* External control pins */
14#define AS3722_EXT_CONTROL_PIN_ENABLE1 1
15#define AS3722_EXT_CONTROL_PIN_ENABLE2 2
16#define AS3722_EXT_CONTROL_PIN_ENABLE2 3
17
18/* Interrupt numbers for AS3722 */
19#define AS3722_IRQ_LID 0
20#define AS3722_IRQ_ACOK 1
21#define AS3722_IRQ_ENABLE1 2
22#define AS3722_IRQ_OCCUR_ALARM_SD0 3
23#define AS3722_IRQ_ONKEY_LONG_PRESS 4
24#define AS3722_IRQ_ONKEY 5
25#define AS3722_IRQ_OVTMP 6
26#define AS3722_IRQ_LOWBAT 7
27#define AS3722_IRQ_SD0_LV 8
28#define AS3722_IRQ_SD1_LV 9
29#define AS3722_IRQ_SD2_LV 10
30#define AS3722_IRQ_PWM1_OV_PROT 11
31#define AS3722_IRQ_PWM2_OV_PROT 12
32#define AS3722_IRQ_ENABLE2 13
33#define AS3722_IRQ_SD6_LV 14
34#define AS3722_IRQ_RTC_REP 15
35#define AS3722_IRQ_RTC_ALARM 16
36#define AS3722_IRQ_GPIO1 17
37#define AS3722_IRQ_GPIO2 18
38#define AS3722_IRQ_GPIO3 19
39#define AS3722_IRQ_GPIO4 20
40#define AS3722_IRQ_GPIO5 21
41#define AS3722_IRQ_WATCHDOG 22
42#define AS3722_IRQ_ENABLE3 23
43#define AS3722_IRQ_TEMP_SD0_SHUTDOWN 24
44#define AS3722_IRQ_TEMP_SD1_SHUTDOWN 25
45#define AS3722_IRQ_TEMP_SD2_SHUTDOWN 26
46#define AS3722_IRQ_TEMP_SD0_ALARM 27
47#define AS3722_IRQ_TEMP_SD1_ALARM 28
48#define AS3722_IRQ_TEMP_SD6_ALARM 29
49#define AS3722_IRQ_OCCUR_ALARM_SD6 30
50#define AS3722_IRQ_ADC 31
51
52#endif /* __DT_BINDINGS_AS3722_H__ */
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 4706d3d46e56..cb49417f8ba9 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -1908,7 +1908,7 @@
1908#define ARIZONA_FLL2_SYNC_GAIN_MASK 0x003c /* FLL2_SYNC_GAIN */ 1908#define ARIZONA_FLL2_SYNC_GAIN_MASK 0x003c /* FLL2_SYNC_GAIN */
1909#define ARIZONA_FLL2_SYNC_GAIN_SHIFT 2 /* FLL2_SYNC_GAIN */ 1909#define ARIZONA_FLL2_SYNC_GAIN_SHIFT 2 /* FLL2_SYNC_GAIN */
1910#define ARIZONA_FLL2_SYNC_GAIN_WIDTH 4 /* FLL2_SYNC_GAIN */ 1910#define ARIZONA_FLL2_SYNC_GAIN_WIDTH 4 /* FLL2_SYNC_GAIN */
1911#define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */ 1911#define ARIZONA_FLL2_SYNC_BW 0x0001 /* FLL2_SYNC_BW */
1912#define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */ 1912#define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */
1913#define ARIZONA_FLL2_SYNC_BW_SHIFT 0 /* FLL2_SYNC_BW */ 1913#define ARIZONA_FLL2_SYNC_BW_SHIFT 0 /* FLL2_SYNC_BW */
1914#define ARIZONA_FLL2_SYNC_BW_WIDTH 1 /* FLL2_SYNC_BW */ 1914#define ARIZONA_FLL2_SYNC_BW_WIDTH 1 /* FLL2_SYNC_BW */
diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h
new file mode 100644
index 000000000000..16bf8a0dcd97
--- /dev/null
+++ b/include/linux/mfd/as3722.h
@@ -0,0 +1,423 @@
1/*
2 * as3722 definitions
3 *
4 * Copyright (C) 2013 ams
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
26#ifndef __LINUX_MFD_AS3722_H__
27#define __LINUX_MFD_AS3722_H__
28
29#include <linux/regmap.h>
30
31/* AS3722 registers */
32#define AS3722_SD0_VOLTAGE_REG 0x00
33#define AS3722_SD1_VOLTAGE_REG 0x01
34#define AS3722_SD2_VOLTAGE_REG 0x02
35#define AS3722_SD3_VOLTAGE_REG 0x03
36#define AS3722_SD4_VOLTAGE_REG 0x04
37#define AS3722_SD5_VOLTAGE_REG 0x05
38#define AS3722_SD6_VOLTAGE_REG 0x06
39#define AS3722_GPIO0_CONTROL_REG 0x08
40#define AS3722_GPIO1_CONTROL_REG 0x09
41#define AS3722_GPIO2_CONTROL_REG 0x0A
42#define AS3722_GPIO3_CONTROL_REG 0x0B
43#define AS3722_GPIO4_CONTROL_REG 0x0C
44#define AS3722_GPIO5_CONTROL_REG 0x0D
45#define AS3722_GPIO6_CONTROL_REG 0x0E
46#define AS3722_GPIO7_CONTROL_REG 0x0F
47#define AS3722_LDO0_VOLTAGE_REG 0x10
48#define AS3722_LDO1_VOLTAGE_REG 0x11
49#define AS3722_LDO2_VOLTAGE_REG 0x12
50#define AS3722_LDO3_VOLTAGE_REG 0x13
51#define AS3722_LDO4_VOLTAGE_REG 0x14
52#define AS3722_LDO5_VOLTAGE_REG 0x15
53#define AS3722_LDO6_VOLTAGE_REG 0x16
54#define AS3722_LDO7_VOLTAGE_REG 0x17
55#define AS3722_LDO9_VOLTAGE_REG 0x19
56#define AS3722_LDO10_VOLTAGE_REG 0x1A
57#define AS3722_LDO11_VOLTAGE_REG 0x1B
58#define AS3722_GPIO_DEB1_REG 0x1E
59#define AS3722_GPIO_DEB2_REG 0x1F
60#define AS3722_GPIO_SIGNAL_OUT_REG 0x20
61#define AS3722_GPIO_SIGNAL_IN_REG 0x21
62#define AS3722_REG_SEQU_MOD1_REG 0x22
63#define AS3722_REG_SEQU_MOD2_REG 0x23
64#define AS3722_REG_SEQU_MOD3_REG 0x24
65#define AS3722_SD_PHSW_CTRL_REG 0x27
66#define AS3722_SD_PHSW_STATUS 0x28
67#define AS3722_SD0_CONTROL_REG 0x29
68#define AS3722_SD1_CONTROL_REG 0x2A
69#define AS3722_SDmph_CONTROL_REG 0x2B
70#define AS3722_SD23_CONTROL_REG 0x2C
71#define AS3722_SD4_CONTROL_REG 0x2D
72#define AS3722_SD5_CONTROL_REG 0x2E
73#define AS3722_SD6_CONTROL_REG 0x2F
74#define AS3722_SD_DVM_REG 0x30
75#define AS3722_RESET_REASON_REG 0x31
76#define AS3722_BATTERY_VOLTAGE_MONITOR_REG 0x32
77#define AS3722_STARTUP_CONTROL_REG 0x33
78#define AS3722_RESET_TIMER_REG 0x34
79#define AS3722_REFERENCE_CONTROL_REG 0x35
80#define AS3722_RESET_CONTROL_REG 0x36
81#define AS3722_OVER_TEMP_CONTROL_REG 0x37
82#define AS3722_WATCHDOG_CONTROL_REG 0x38
83#define AS3722_REG_STANDBY_MOD1_REG 0x39
84#define AS3722_REG_STANDBY_MOD2_REG 0x3A
85#define AS3722_REG_STANDBY_MOD3_REG 0x3B
86#define AS3722_ENABLE_CTRL1_REG 0x3C
87#define AS3722_ENABLE_CTRL2_REG 0x3D
88#define AS3722_ENABLE_CTRL3_REG 0x3E
89#define AS3722_ENABLE_CTRL4_REG 0x3F
90#define AS3722_ENABLE_CTRL5_REG 0x40
91#define AS3722_PWM_CONTROL_L_REG 0x41
92#define AS3722_PWM_CONTROL_H_REG 0x42
93#define AS3722_WATCHDOG_TIMER_REG 0x46
94#define AS3722_WATCHDOG_SOFTWARE_SIGNAL_REG 0x48
95#define AS3722_IOVOLTAGE_REG 0x49
96#define AS3722_BATTERY_VOLTAGE_MONITOR2_REG 0x4A
97#define AS3722_SD_CONTROL_REG 0x4D
98#define AS3722_LDOCONTROL0_REG 0x4E
99#define AS3722_LDOCONTROL1_REG 0x4F
100#define AS3722_SD0_PROTECT_REG 0x50
101#define AS3722_SD6_PROTECT_REG 0x51
102#define AS3722_PWM_VCONTROL1_REG 0x52
103#define AS3722_PWM_VCONTROL2_REG 0x53
104#define AS3722_PWM_VCONTROL3_REG 0x54
105#define AS3722_PWM_VCONTROL4_REG 0x55
106#define AS3722_BB_CHARGER_REG 0x57
107#define AS3722_CTRL_SEQU1_REG 0x58
108#define AS3722_CTRL_SEQU2_REG 0x59
109#define AS3722_OVCURRENT_REG 0x5A
110#define AS3722_OVCURRENT_DEB_REG 0x5B
111#define AS3722_SDLV_DEB_REG 0x5C
112#define AS3722_OC_PG_CTRL_REG 0x5D
113#define AS3722_OC_PG_CTRL2_REG 0x5E
114#define AS3722_CTRL_STATUS 0x5F
115#define AS3722_RTC_CONTROL_REG 0x60
116#define AS3722_RTC_SECOND_REG 0x61
117#define AS3722_RTC_MINUTE_REG 0x62
118#define AS3722_RTC_HOUR_REG 0x63
119#define AS3722_RTC_DAY_REG 0x64
120#define AS3722_RTC_MONTH_REG 0x65
121#define AS3722_RTC_YEAR_REG 0x66
122#define AS3722_RTC_ALARM_SECOND_REG 0x67
123#define AS3722_RTC_ALARM_MINUTE_REG 0x68
124#define AS3722_RTC_ALARM_HOUR_REG 0x69
125#define AS3722_RTC_ALARM_DAY_REG 0x6A
126#define AS3722_RTC_ALARM_MONTH_REG 0x6B
127#define AS3722_RTC_ALARM_YEAR_REG 0x6C
128#define AS3722_SRAM_REG 0x6D
129#define AS3722_RTC_ACCESS_REG 0x6F
130#define AS3722_RTC_STATUS_REG 0x73
131#define AS3722_INTERRUPT_MASK1_REG 0x74
132#define AS3722_INTERRUPT_MASK2_REG 0x75
133#define AS3722_INTERRUPT_MASK3_REG 0x76
134#define AS3722_INTERRUPT_MASK4_REG 0x77
135#define AS3722_INTERRUPT_STATUS1_REG 0x78
136#define AS3722_INTERRUPT_STATUS2_REG 0x79
137#define AS3722_INTERRUPT_STATUS3_REG 0x7A
138#define AS3722_INTERRUPT_STATUS4_REG 0x7B
139#define AS3722_TEMP_STATUS_REG 0x7D
140#define AS3722_ADC0_CONTROL_REG 0x80
141#define AS3722_ADC1_CONTROL_REG 0x81
142#define AS3722_ADC0_MSB_RESULT_REG 0x82
143#define AS3722_ADC0_LSB_RESULT_REG 0x83
144#define AS3722_ADC1_MSB_RESULT_REG 0x84
145#define AS3722_ADC1_LSB_RESULT_REG 0x85
146#define AS3722_ADC1_THRESHOLD_HI_MSB_REG 0x86
147#define AS3722_ADC1_THRESHOLD_HI_LSB_REG 0x87
148#define AS3722_ADC1_THRESHOLD_LO_MSB_REG 0x88
149#define AS3722_ADC1_THRESHOLD_LO_LSB_REG 0x89
150#define AS3722_ADC_CONFIGURATION_REG 0x8A
151#define AS3722_ASIC_ID1_REG 0x90
152#define AS3722_ASIC_ID2_REG 0x91
153#define AS3722_LOCK_REG 0x9E
154#define AS3722_MAX_REGISTER 0xF4
155
156#define AS3722_SD0_EXT_ENABLE_MASK 0x03
157#define AS3722_SD1_EXT_ENABLE_MASK 0x0C
158#define AS3722_SD2_EXT_ENABLE_MASK 0x30
159#define AS3722_SD3_EXT_ENABLE_MASK 0xC0
160#define AS3722_SD4_EXT_ENABLE_MASK 0x03
161#define AS3722_SD5_EXT_ENABLE_MASK 0x0C
162#define AS3722_SD6_EXT_ENABLE_MASK 0x30
163#define AS3722_LDO0_EXT_ENABLE_MASK 0x03
164#define AS3722_LDO1_EXT_ENABLE_MASK 0x0C
165#define AS3722_LDO2_EXT_ENABLE_MASK 0x30
166#define AS3722_LDO3_EXT_ENABLE_MASK 0xC0
167#define AS3722_LDO4_EXT_ENABLE_MASK 0x03
168#define AS3722_LDO5_EXT_ENABLE_MASK 0x0C
169#define AS3722_LDO6_EXT_ENABLE_MASK 0x30
170#define AS3722_LDO7_EXT_ENABLE_MASK 0xC0
171#define AS3722_LDO9_EXT_ENABLE_MASK 0x0C
172#define AS3722_LDO10_EXT_ENABLE_MASK 0x30
173#define AS3722_LDO11_EXT_ENABLE_MASK 0xC0
174
175#define AS3722_OVCURRENT_SD0_ALARM_MASK 0x07
176#define AS3722_OVCURRENT_SD0_ALARM_SHIFT 0x01
177#define AS3722_OVCURRENT_SD0_TRIP_MASK 0x18
178#define AS3722_OVCURRENT_SD0_TRIP_SHIFT 0x03
179#define AS3722_OVCURRENT_SD1_TRIP_MASK 0x60
180#define AS3722_OVCURRENT_SD1_TRIP_SHIFT 0x05
181
182#define AS3722_OVCURRENT_SD6_ALARM_MASK 0x07
183#define AS3722_OVCURRENT_SD6_ALARM_SHIFT 0x01
184#define AS3722_OVCURRENT_SD6_TRIP_MASK 0x18
185#define AS3722_OVCURRENT_SD6_TRIP_SHIFT 0x03
186
187/* AS3722 register bits and bit masks */
188#define AS3722_LDO_ILIMIT_MASK BIT(7)
189#define AS3722_LDO_ILIMIT_BIT BIT(7)
190#define AS3722_LDO0_VSEL_MASK 0x1F
191#define AS3722_LDO0_VSEL_MIN 0x01
192#define AS3722_LDO0_VSEL_MAX 0x12
193#define AS3722_LDO0_NUM_VOLT 0x12
194#define AS3722_LDO3_VSEL_MASK 0x3F
195#define AS3722_LDO3_VSEL_MIN 0x01
196#define AS3722_LDO3_VSEL_MAX 0x2D
197#define AS3722_LDO3_NUM_VOLT 0x2D
198#define AS3722_LDO_VSEL_MASK 0x7F
199#define AS3722_LDO_VSEL_MIN 0x01
200#define AS3722_LDO_VSEL_MAX 0x7F
201#define AS3722_LDO_VSEL_DNU_MIN 0x25
202#define AS3722_LDO_VSEL_DNU_MAX 0x3F
203#define AS3722_LDO_NUM_VOLT 0x80
204
205#define AS3722_LDO0_CTRL BIT(0)
206#define AS3722_LDO1_CTRL BIT(1)
207#define AS3722_LDO2_CTRL BIT(2)
208#define AS3722_LDO3_CTRL BIT(3)
209#define AS3722_LDO4_CTRL BIT(4)
210#define AS3722_LDO5_CTRL BIT(5)
211#define AS3722_LDO6_CTRL BIT(6)
212#define AS3722_LDO7_CTRL BIT(7)
213#define AS3722_LDO9_CTRL BIT(1)
214#define AS3722_LDO10_CTRL BIT(2)
215#define AS3722_LDO11_CTRL BIT(3)
216
217#define AS3722_LDO3_MODE_MASK (3 << 6)
218#define AS3722_LDO3_MODE_VAL(n) (((n) & 0x3) << 6)
219#define AS3722_LDO3_MODE_PMOS AS3722_LDO3_MODE_VAL(0)
220#define AS3722_LDO3_MODE_PMOS_TRACKING AS3722_LDO3_MODE_VAL(1)
221#define AS3722_LDO3_MODE_NMOS AS3722_LDO3_MODE_VAL(2)
222#define AS3722_LDO3_MODE_SWITCH AS3722_LDO3_MODE_VAL(3)
223
224#define AS3722_SD_VSEL_MASK 0x7F
225#define AS3722_SD0_VSEL_MIN 0x01
226#define AS3722_SD0_VSEL_MAX 0x5A
227#define AS3722_SD2_VSEL_MIN 0x01
228#define AS3722_SD2_VSEL_MAX 0x7F
229
230#define AS3722_SDn_CTRL(n) BIT(n)
231
232#define AS3722_SD0_MODE_FAST BIT(4)
233#define AS3722_SD1_MODE_FAST BIT(4)
234#define AS3722_SD2_MODE_FAST BIT(2)
235#define AS3722_SD3_MODE_FAST BIT(6)
236#define AS3722_SD4_MODE_FAST BIT(2)
237#define AS3722_SD5_MODE_FAST BIT(2)
238#define AS3722_SD6_MODE_FAST BIT(4)
239
240#define AS3722_POWER_OFF BIT(1)
241
242#define AS3722_INTERRUPT_MASK1_LID BIT(0)
243#define AS3722_INTERRUPT_MASK1_ACOK BIT(1)
244#define AS3722_INTERRUPT_MASK1_ENABLE1 BIT(2)
245#define AS3722_INTERRUPT_MASK1_OCURR_ALARM_SD0 BIT(3)
246#define AS3722_INTERRUPT_MASK1_ONKEY_LONG BIT(4)
247#define AS3722_INTERRUPT_MASK1_ONKEY BIT(5)
248#define AS3722_INTERRUPT_MASK1_OVTMP BIT(6)
249#define AS3722_INTERRUPT_MASK1_LOWBAT BIT(7)
250
251#define AS3722_INTERRUPT_MASK2_SD0_LV BIT(0)
252#define AS3722_INTERRUPT_MASK2_SD1_LV BIT(1)
253#define AS3722_INTERRUPT_MASK2_SD2345_LV BIT(2)
254#define AS3722_INTERRUPT_MASK2_PWM1_OV_PROT BIT(3)
255#define AS3722_INTERRUPT_MASK2_PWM2_OV_PROT BIT(4)
256#define AS3722_INTERRUPT_MASK2_ENABLE2 BIT(5)
257#define AS3722_INTERRUPT_MASK2_SD6_LV BIT(6)
258#define AS3722_INTERRUPT_MASK2_RTC_REP BIT(7)
259
260#define AS3722_INTERRUPT_MASK3_RTC_ALARM BIT(0)
261#define AS3722_INTERRUPT_MASK3_GPIO1 BIT(1)
262#define AS3722_INTERRUPT_MASK3_GPIO2 BIT(2)
263#define AS3722_INTERRUPT_MASK3_GPIO3 BIT(3)
264#define AS3722_INTERRUPT_MASK3_GPIO4 BIT(4)
265#define AS3722_INTERRUPT_MASK3_GPIO5 BIT(5)
266#define AS3722_INTERRUPT_MASK3_WATCHDOG BIT(6)
267#define AS3722_INTERRUPT_MASK3_ENABLE3 BIT(7)
268
269#define AS3722_INTERRUPT_MASK4_TEMP_SD0_SHUTDOWN BIT(0)
270#define AS3722_INTERRUPT_MASK4_TEMP_SD1_SHUTDOWN BIT(1)
271#define AS3722_INTERRUPT_MASK4_TEMP_SD6_SHUTDOWN BIT(2)
272#define AS3722_INTERRUPT_MASK4_TEMP_SD0_ALARM BIT(3)
273#define AS3722_INTERRUPT_MASK4_TEMP_SD1_ALARM BIT(4)
274#define AS3722_INTERRUPT_MASK4_TEMP_SD6_ALARM BIT(5)
275#define AS3722_INTERRUPT_MASK4_OCCUR_ALARM_SD6 BIT(6)
276#define AS3722_INTERRUPT_MASK4_ADC BIT(7)
277
278#define AS3722_ADC1_INTERVAL_TIME BIT(0)
279#define AS3722_ADC1_INT_MODE_ON BIT(1)
280#define AS3722_ADC_BUF_ON BIT(2)
281#define AS3722_ADC1_LOW_VOLTAGE_RANGE BIT(5)
282#define AS3722_ADC1_INTEVAL_SCAN BIT(6)
283#define AS3722_ADC1_INT_MASK BIT(7)
284
285#define AS3722_ADC_MSB_VAL_MASK 0x7F
286#define AS3722_ADC_LSB_VAL_MASK 0x07
287
288#define AS3722_ADC0_CONV_START BIT(7)
289#define AS3722_ADC0_CONV_NOTREADY BIT(7)
290#define AS3722_ADC0_SOURCE_SELECT_MASK 0x1F
291
292#define AS3722_ADC1_CONV_START BIT(7)
293#define AS3722_ADC1_CONV_NOTREADY BIT(7)
294#define AS3722_ADC1_SOURCE_SELECT_MASK 0x1F
295
296/* GPIO modes */
297#define AS3722_GPIO_MODE_MASK 0x07
298#define AS3722_GPIO_MODE_INPUT 0x00
299#define AS3722_GPIO_MODE_OUTPUT_VDDH 0x01
300#define AS3722_GPIO_MODE_IO_OPEN_DRAIN 0x02
301#define AS3722_GPIO_MODE_ADC_IN 0x03
302#define AS3722_GPIO_MODE_INPUT_PULL_UP 0x04
303#define AS3722_GPIO_MODE_INPUT_PULL_DOWN 0x05
304#define AS3722_GPIO_MODE_IO_OPEN_DRAIN_PULL_UP 0x06
305#define AS3722_GPIO_MODE_OUTPUT_VDDL 0x07
306#define AS3722_GPIO_MODE_VAL(n) ((n) & AS3722_GPIO_MODE_MASK)
307
308#define AS3722_GPIO_INV BIT(7)
309#define AS3722_GPIO_IOSF_MASK 0x78
310#define AS3722_GPIO_IOSF_VAL(n) (((n) & 0xF) << 3)
311#define AS3722_GPIO_IOSF_NORMAL AS3722_GPIO_IOSF_VAL(0)
312#define AS3722_GPIO_IOSF_INTERRUPT_OUT AS3722_GPIO_IOSF_VAL(1)
313#define AS3722_GPIO_IOSF_VSUP_LOW_OUT AS3722_GPIO_IOSF_VAL(2)
314#define AS3722_GPIO_IOSF_GPIO_INTERRUPT_IN AS3722_GPIO_IOSF_VAL(3)
315#define AS3722_GPIO_IOSF_ISINK_PWM_IN AS3722_GPIO_IOSF_VAL(4)
316#define AS3722_GPIO_IOSF_VOLTAGE_STBY AS3722_GPIO_IOSF_VAL(5)
317#define AS3722_GPIO_IOSF_PWR_GOOD_OUT AS3722_GPIO_IOSF_VAL(7)
318#define AS3722_GPIO_IOSF_Q32K_OUT AS3722_GPIO_IOSF_VAL(8)
319#define AS3722_GPIO_IOSF_WATCHDOG_IN AS3722_GPIO_IOSF_VAL(9)
320#define AS3722_GPIO_IOSF_SOFT_RESET_IN AS3722_GPIO_IOSF_VAL(11)
321#define AS3722_GPIO_IOSF_PWM_OUT AS3722_GPIO_IOSF_VAL(12)
322#define AS3722_GPIO_IOSF_VSUP_LOW_DEB_OUT AS3722_GPIO_IOSF_VAL(13)
323#define AS3722_GPIO_IOSF_SD6_LOW_VOLT_LOW AS3722_GPIO_IOSF_VAL(14)
324
325#define AS3722_GPIOn_SIGNAL(n) BIT(n)
326#define AS3722_GPIOn_CONTROL_REG(n) (AS3722_GPIO0_CONTROL_REG + n)
327#define AS3722_I2C_PULL_UP BIT(4)
328#define AS3722_INT_PULL_UP BIT(5)
329
330#define AS3722_RTC_REP_WAKEUP_EN BIT(0)
331#define AS3722_RTC_ALARM_WAKEUP_EN BIT(1)
332#define AS3722_RTC_ON BIT(2)
333#define AS3722_RTC_IRQMODE BIT(3)
334#define AS3722_RTC_CLK32K_OUT_EN BIT(5)
335
336#define AS3722_WATCHDOG_TIMER_MAX 0x7F
337#define AS3722_WATCHDOG_ON BIT(0)
338#define AS3722_WATCHDOG_SW_SIG BIT(0)
339
340#define AS3722_EXT_CONTROL_ENABLE1 0x1
341#define AS3722_EXT_CONTROL_ENABLE2 0x2
342#define AS3722_EXT_CONTROL_ENABLE3 0x3
343
344/* Interrupt IDs */
345enum as3722_irq {
346 AS3722_IRQ_LID,
347 AS3722_IRQ_ACOK,
348 AS3722_IRQ_ENABLE1,
349 AS3722_IRQ_OCCUR_ALARM_SD0,
350 AS3722_IRQ_ONKEY_LONG_PRESS,
351 AS3722_IRQ_ONKEY,
352 AS3722_IRQ_OVTMP,
353 AS3722_IRQ_LOWBAT,
354 AS3722_IRQ_SD0_LV,
355 AS3722_IRQ_SD1_LV,
356 AS3722_IRQ_SD2_LV,
357 AS3722_IRQ_PWM1_OV_PROT,
358 AS3722_IRQ_PWM2_OV_PROT,
359 AS3722_IRQ_ENABLE2,
360 AS3722_IRQ_SD6_LV,
361 AS3722_IRQ_RTC_REP,
362 AS3722_IRQ_RTC_ALARM,
363 AS3722_IRQ_GPIO1,
364 AS3722_IRQ_GPIO2,
365 AS3722_IRQ_GPIO3,
366 AS3722_IRQ_GPIO4,
367 AS3722_IRQ_GPIO5,
368 AS3722_IRQ_WATCHDOG,
369 AS3722_IRQ_ENABLE3,
370 AS3722_IRQ_TEMP_SD0_SHUTDOWN,
371 AS3722_IRQ_TEMP_SD1_SHUTDOWN,
372 AS3722_IRQ_TEMP_SD2_SHUTDOWN,
373 AS3722_IRQ_TEMP_SD0_ALARM,
374 AS3722_IRQ_TEMP_SD1_ALARM,
375 AS3722_IRQ_TEMP_SD6_ALARM,
376 AS3722_IRQ_OCCUR_ALARM_SD6,
377 AS3722_IRQ_ADC,
378 AS3722_IRQ_MAX,
379};
380
381struct as3722 {
382 struct device *dev;
383 struct regmap *regmap;
384 int chip_irq;
385 unsigned long irq_flags;
386 bool en_intern_int_pullup;
387 bool en_intern_i2c_pullup;
388 struct regmap_irq_chip_data *irq_data;
389};
390
391static inline int as3722_read(struct as3722 *as3722, u32 reg, u32 *dest)
392{
393 return regmap_read(as3722->regmap, reg, dest);
394}
395
396static inline int as3722_write(struct as3722 *as3722, u32 reg, u32 value)
397{
398 return regmap_write(as3722->regmap, reg, value);
399}
400
401static inline int as3722_block_read(struct as3722 *as3722, u32 reg,
402 int count, u8 *buf)
403{
404 return regmap_bulk_read(as3722->regmap, reg, buf, count);
405}
406
407static inline int as3722_block_write(struct as3722 *as3722, u32 reg,
408 int count, u8 *data)
409{
410 return regmap_bulk_write(as3722->regmap, reg, data, count);
411}
412
413static inline int as3722_update_bits(struct as3722 *as3722, u32 reg,
414 u32 mask, u8 val)
415{
416 return regmap_update_bits(as3722->regmap, reg, mask, val);
417}
418
419static inline int as3722_irq_get_virq(struct as3722 *as3722, int irq)
420{
421 return regmap_irq_get_virq(as3722->irq_data, irq);
422}
423#endif /* __LINUX_MFD_AS3722_H__ */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 786d02eb79d2..21e21b81cc75 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -148,10 +148,15 @@ static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
148 unsigned reg_cnt, unsigned char *val) 148 unsigned reg_cnt, unsigned char *val)
149{ 149{
150 int ret; 150 int ret;
151 unsigned int tmp;
152 int i;
151 153
152 ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); 154 for (i = 0; i < reg_cnt; i++) {
153 if (ret < 0) 155 ret = regmap_read(da9052->regmap, reg + i, &tmp);
154 return ret; 156 val[i] = (unsigned char)tmp;
157 if (ret < 0)
158 return ret;
159 }
155 160
156 if (da9052->fix_io) { 161 if (da9052->fix_io) {
157 ret = da9052->fix_io(da9052, reg); 162 ret = da9052->fix_io(da9052, reg);
@@ -166,10 +171,13 @@ static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
166 unsigned reg_cnt, unsigned char *val) 171 unsigned reg_cnt, unsigned char *val)
167{ 172{
168 int ret; 173 int ret;
174 int i;
169 175
170 ret = regmap_raw_write(da9052->regmap, reg, val, reg_cnt); 176 for (i = 0; i < reg_cnt; i++) {
171 if (ret < 0) 177 ret = regmap_write(da9052->regmap, reg + i, val[i]);
172 return ret; 178 if (ret < 0)
179 return ret;
180 }
173 181
174 if (da9052->fix_io) { 182 if (da9052->fix_io) {
175 ret = da9052->fix_io(da9052, reg); 183 ret = da9052->fix_io(da9052, reg);
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 244fb0d51589..3e050b933dd0 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -323,7 +323,6 @@ struct max77693_dev {
323 323
324 int irq; 324 int irq;
325 int irq_gpio; 325 int irq_gpio;
326 bool wakeup;
327 struct mutex irqlock; 326 struct mutex irqlock;
328 int irq_masks_cur[MAX77693_IRQ_GROUP_NR]; 327 int irq_masks_cur[MAX77693_IRQ_GROUP_NR];
329 int irq_masks_cache[MAX77693_IRQ_GROUP_NR]; 328 int irq_masks_cache[MAX77693_IRQ_GROUP_NR];
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 676f0f388992..3f3dc45f93ee 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -64,8 +64,6 @@ struct max77693_muic_platform_data {
64}; 64};
65 65
66struct max77693_platform_data { 66struct max77693_platform_data {
67 int wakeup;
68
69 /* regulator data */ 67 /* regulator data */
70 struct max77693_regulator_data *regulators; 68 struct max77693_regulator_data *regulators;
71 int num_regulators; 69 int num_regulators;
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 41ed59276c00..67c17b5a6f44 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -41,6 +41,13 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
41 unsigned int mode, unsigned int channel, 41 unsigned int mode, unsigned int channel,
42 u8 ato, bool atox, unsigned int *sample); 42 u8 ato, bool atox, unsigned int *sample);
43 43
44#define MC13783_AUDIO_RX0 36
45#define MC13783_AUDIO_RX1 37
46#define MC13783_AUDIO_TX 38
47#define MC13783_SSI_NETWORK 39
48#define MC13783_AUDIO_CODEC 40
49#define MC13783_AUDIO_DAC 41
50
44#define MC13XXX_IRQ_ADCDONE 0 51#define MC13XXX_IRQ_ADCDONE 0
45#define MC13XXX_IRQ_ADCBISDONE 1 52#define MC13XXX_IRQ_ADCBISDONE 1
46#define MC13XXX_IRQ_TS 2 53#define MC13XXX_IRQ_TS 2
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index d1382dfbeff0..0ce772105508 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -756,6 +756,59 @@
756#define PCR_SETTING_REG2 0x814 756#define PCR_SETTING_REG2 0x814
757#define PCR_SETTING_REG3 0x747 757#define PCR_SETTING_REG3 0x747
758 758
759/* Phy bits */
760#define PHY_PCR_FORCE_CODE 0xB000
761#define PHY_PCR_OOBS_CALI_50 0x0800
762#define PHY_PCR_OOBS_VCM_08 0x0200
763#define PHY_PCR_OOBS_SEN_90 0x0040
764#define PHY_PCR_RSSI_EN 0x0002
765
766#define PHY_RCR1_ADP_TIME 0x0100
767#define PHY_RCR1_VCO_COARSE 0x001F
768
769#define PHY_RCR2_EMPHASE_EN 0x8000
770#define PHY_RCR2_NADJR 0x4000
771#define PHY_RCR2_CDR_CP_10 0x0400
772#define PHY_RCR2_CDR_SR_2 0x0100
773#define PHY_RCR2_FREQSEL_12 0x0040
774#define PHY_RCR2_CPADJEN 0x0020
775#define PHY_RCR2_CDR_SC_8 0x0008
776#define PHY_RCR2_CALIB_LATE 0x0002
777
778#define PHY_RDR_RXDSEL_1_9 0x4000
779
780#define PHY_TUNE_TUNEREF_1_0 0x4000
781#define PHY_TUNE_VBGSEL_1252 0x0C00
782#define PHY_TUNE_SDBUS_33 0x0200
783#define PHY_TUNE_TUNED18 0x01C0
784#define PHY_TUNE_TUNED12 0X0020
785
786#define PHY_BPCR_IBRXSEL 0x0400
787#define PHY_BPCR_IBTXSEL 0x0100
788#define PHY_BPCR_IB_FILTER 0x0080
789#define PHY_BPCR_CMIRROR_EN 0x0040
790
791#define PHY_REG_REV_RESV 0xE000
792#define PHY_REG_REV_RXIDLE_LATCHED 0x1000
793#define PHY_REG_REV_P1_EN 0x0800
794#define PHY_REG_REV_RXIDLE_EN 0x0400
795#define PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 0x0040
796#define PHY_REG_REV_STOP_CLKRD 0x0020
797#define PHY_REG_REV_RX_PWST 0x0008
798#define PHY_REG_REV_STOP_CLKWR 0x0004
799
800#define PHY_FLD3_TIMER_4 0x7800
801#define PHY_FLD3_TIMER_6 0x00E0
802#define PHY_FLD3_RXDELINK 0x0004
803
804#define PHY_FLD4_FLDEN_SEL 0x4000
805#define PHY_FLD4_REQ_REF 0x2000
806#define PHY_FLD4_RXAMP_OFF 0x1000
807#define PHY_FLD4_REQ_ADDA 0x0800
808#define PHY_FLD4_BER_COUNT 0x00E0
809#define PHY_FLD4_BER_TIMER 0x000A
810#define PHY_FLD4_BER_CHK_EN 0x0001
811
759#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 812#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
760 813
761struct rtsx_pcr; 814struct rtsx_pcr;
diff --git a/include/linux/mfd/stw481x.h b/include/linux/mfd/stw481x.h
new file mode 100644
index 000000000000..eda121556e5d
--- /dev/null
+++ b/include/linux/mfd/stw481x.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson SA
3 * Written on behalf of Linaro for ST-Ericsson
4 *
5 * Author: Linus Walleij <linus.walleij@linaro.org>
6 *
7 * License terms: GNU General Public License (GPL) version 2
8 */
9#ifndef MFD_STW481X_H
10#define MFD_STW481X_H
11
12#include <linux/i2c.h>
13#include <linux/regulator/machine.h>
14#include <linux/regmap.h>
15#include <linux/bitops.h>
16
17/* These registers are accessed from more than one driver */
18#define STW_CONF1 0x11U
19#define STW_CONF1_PDN_VMMC 0x01U
20#define STW_CONF1_VMMC_MASK 0x0eU
21#define STW_CONF1_VMMC_1_8V 0x02U
22#define STW_CONF1_VMMC_2_85V 0x04U
23#define STW_CONF1_VMMC_3V 0x06U
24#define STW_CONF1_VMMC_1_85V 0x08U
25#define STW_CONF1_VMMC_2_6V 0x0aU
26#define STW_CONF1_VMMC_2_7V 0x0cU
27#define STW_CONF1_VMMC_3_3V 0x0eU
28#define STW_CONF1_MMC_LS_STATUS 0x10U
29#define STW_PCTL_REG_LO 0x1eU
30#define STW_PCTL_REG_HI 0x1fU
31#define STW_CONF1_V_MONITORING 0x20U
32#define STW_CONF1_IT_WARN 0x40U
33#define STW_CONF1_PDN_VAUX 0x80U
34#define STW_CONF2 0x20U
35#define STW_CONF2_MASK_TWARN 0x01U
36#define STW_CONF2_VMMC_EXT 0x02U
37#define STW_CONF2_MASK_IT_WAKE_UP 0x04U
38#define STW_CONF2_GPO1 0x08U
39#define STW_CONF2_GPO2 0x10U
40#define STW_VCORE_SLEEP 0x21U
41
42/**
43 * struct stw481x - state holder for the Stw481x drivers
44 * @mutex: mutex to serialize I2C accesses
45 * @i2c_client: corresponding I2C client
46 * @regulator: regulator device for regulator children
47 * @map: regmap handle to access device registers
48 */
49struct stw481x {
50 struct mutex lock;
51 struct i2c_client *client;
52 struct regulator_dev *vmmc_regulator;
53 struct regmap *map;
54};
55
56#endif
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
index b473577f36db..8789fa3c7fd9 100644
--- a/include/linux/mfd/syscon.h
+++ b/include/linux/mfd/syscon.h
@@ -17,10 +17,35 @@
17 17
18struct device_node; 18struct device_node;
19 19
20#ifdef CONFIG_MFD_SYSCON
20extern struct regmap *syscon_node_to_regmap(struct device_node *np); 21extern struct regmap *syscon_node_to_regmap(struct device_node *np);
21extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); 22extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
22extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s); 23extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s);
23extern struct regmap *syscon_regmap_lookup_by_phandle( 24extern struct regmap *syscon_regmap_lookup_by_phandle(
24 struct device_node *np, 25 struct device_node *np,
25 const char *property); 26 const char *property);
27#else
28static inline struct regmap *syscon_node_to_regmap(struct device_node *np)
29{
30 return ERR_PTR(-ENOSYS);
31}
32
33static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
34{
35 return ERR_PTR(-ENOSYS);
36}
37
38static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s)
39{
40 return ERR_PTR(-ENOSYS);
41}
42
43static inline struct regmap *syscon_regmap_lookup_by_phandle(
44 struct device_node *np,
45 const char *property)
46{
47 return ERR_PTR(-ENOSYS);
48}
49#endif
50
26#endif /* __LINUX_MFD_SYSCON_H__ */ 51#endif /* __LINUX_MFD_SYSCON_H__ */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 25f2c611ab01..7b68a061cd60 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -125,13 +125,18 @@
125#define TOTAL_CHANNELS 8 125#define TOTAL_CHANNELS 8
126 126
127/* 127/*
128* ADC runs at 3MHz, and it takes 128 * time in us for processing a single channel, calculated as follows:
129* 15 cycles to latch one data output. 129 *
130* Hence the idle time for ADC to 130 * num cycles = open delay + (sample delay + conv time) * averaging
131* process one sample data would be 131 *
132* around 5 micro seconds. 132 * num cycles: 152 + (1 + 13) * 16 = 376
133*/ 133 *
134#define IDLE_TIMEOUT 5 /* microsec */ 134 * clock frequency: 26MHz / 8 = 3.25MHz
135 * clock period: 1 / 3.25MHz = 308ns
136 *
137 * processing time: 376 * 308ns = 116us
138 */
139#define IDLE_TIMEOUT 116 /* microsec */
135 140
136#define TSCADC_CELLS 2 141#define TSCADC_CELLS 2
137 142
@@ -146,6 +151,7 @@ struct ti_tscadc_dev {
146 struct mfd_cell cells[TSCADC_CELLS]; 151 struct mfd_cell cells[TSCADC_CELLS];
147 u32 reg_se_cache; 152 u32 reg_se_cache;
148 spinlock_t reg_lock; 153 spinlock_t reg_lock;
154 unsigned int clk_div;
149 155
150 /* tsc device */ 156 /* tsc device */
151 struct titsc *tsc; 157 struct titsc *tsc;
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 40854ac0ba3d..eefafa62d304 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -56,8 +56,6 @@ struct irq_domain;
56#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN) 56#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
57 57
58struct wm8994 { 58struct wm8994 {
59 struct mutex irq_lock;
60
61 struct wm8994_pdata pdata; 59 struct wm8994_pdata pdata;
62 60
63 enum wm8994_type type; 61 enum wm8994_type type;
@@ -85,16 +83,43 @@ struct wm8994 {
85}; 83};
86 84
87/* Device I/O API */ 85/* Device I/O API */
88int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
89int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
90 unsigned short val);
91int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
92 unsigned short mask, unsigned short val);
93int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
94 int count, u16 *buf);
95int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
96 int count, const u16 *buf);
97 86
87static inline int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg)
88{
89 unsigned int val;
90 int ret;
91
92 ret = regmap_read(wm8994->regmap, reg, &val);
93
94 if (ret < 0)
95 return ret;
96 else
97 return val;
98}
99
100static inline int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
101 unsigned short val)
102{
103 return regmap_write(wm8994->regmap, reg, val);
104}
105
106static inline int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
107 int count, u16 *buf)
108{
109 return regmap_bulk_read(wm8994->regmap, reg, buf, count);
110}
111
112static inline int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
113 int count, const u16 *buf)
114{
115 return regmap_raw_write(wm8994->regmap, reg, buf, count * sizeof(u16));
116}
117
118static inline int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
119 unsigned short mask, unsigned short val)
120{
121 return regmap_update_bits(wm8994->regmap, reg, mask, val);
122}
98 123
99/* Helper to save on boilerplate */ 124/* Helper to save on boilerplate */
100static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq, 125static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index ea141e1d6f28..4d3c8fd8c5db 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -125,10 +125,6 @@ static int mc13783_write(struct snd_soc_codec *codec,
125 125
126 ret = mc13xxx_reg_write(priv->mc13xxx, reg, value); 126 ret = mc13xxx_reg_write(priv->mc13xxx, reg, value);
127 127
128 /* include errata fix for spi audio problems */
129 if (reg == MC13783_AUDIO_CODEC || reg == MC13783_AUDIO_DAC)
130 ret = mc13xxx_reg_write(priv->mc13xxx, reg, value);
131
132 mc13xxx_unlock(priv->mc13xxx); 128 mc13xxx_unlock(priv->mc13xxx);
133 129
134 return ret; 130 return ret;