aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-03-03 21:16:48 -0500
committerDavid S. Miller <davem@davemloft.net>2015-03-03 21:16:48 -0500
commit71a83a6db6138b9d41d8a0b6b91cb59f6dc4742c (patch)
treef74b6e4e48257ec6ce40b95645ecb8533b9cc1f8 /drivers/mfd
parentb97526f3ff95f92b107f0fb52cbb8627e395429b (diff)
parenta6c5170d1edea97c538c81e377e56c7b5c5b7e63 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/rocker/rocker.c The rocker commit was two overlapping changes, one to rename the ->vport member to ->pport, and another making the bitmask expression use '1ULL' instead of plain '1'. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/88pm860x-core.c2
-rw-r--r--drivers/mfd/Kconfig39
-rw-r--r--drivers/mfd/Makefile4
-rw-r--r--drivers/mfd/da9063-core.c2
-rw-r--r--drivers/mfd/da9063-i2c.c9
-rw-r--r--drivers/mfd/da9150-core.c413
-rw-r--r--drivers/mfd/davinci_voicecodec.c2
-rw-r--r--drivers/mfd/db8500-prcmu.c9
-rw-r--r--drivers/mfd/dln2.c71
-rw-r--r--drivers/mfd/hi6421-pmic-core.c2
-rw-r--r--drivers/mfd/intel_soc_pmic_core.c3
-rw-r--r--drivers/mfd/intel_soc_pmic_core.h2
-rw-r--r--drivers/mfd/intel_soc_pmic_crc.c2
-rw-r--r--drivers/mfd/lm3533-core.c2
-rw-r--r--drivers/mfd/lpc_sch.c1
-rw-r--r--drivers/mfd/max77686.c29
-rw-r--r--drivers/mfd/mc13xxx-i2c.c2
-rw-r--r--drivers/mfd/mc13xxx-spi.c2
-rw-r--r--drivers/mfd/omap-usb-host.c10
-rw-r--r--drivers/mfd/pcf50633-core.c2
-rw-r--r--drivers/mfd/qcom_rpm.c581
-rw-r--r--drivers/mfd/retu-mfd.c2
-rw-r--r--drivers/mfd/rt5033.c142
-rw-r--r--drivers/mfd/rtsx_usb.c18
-rw-r--r--drivers/mfd/smsc-ece1099.c2
-rw-r--r--drivers/mfd/sun6i-prcm.c14
-rw-r--r--drivers/mfd/tps65217.c2
-rw-r--r--drivers/mfd/tps65218.c2
-rw-r--r--drivers/mfd/twl-core.c8
-rw-r--r--drivers/mfd/twl6040.c4
-rw-r--r--drivers/mfd/wm8994-core.c6
31 files changed, 1311 insertions, 78 deletions
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index 3a2604580164..d2a85cde68da 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -1111,7 +1111,7 @@ static int verify_addr(struct i2c_client *i2c)
1111 return 0; 1111 return 0;
1112} 1112}
1113 1113
1114static struct regmap_config pm860x_regmap_config = { 1114static const struct regmap_config pm860x_regmap_config = {
1115 .reg_bits = 8, 1115 .reg_bits = 8,
1116 .val_bits = 8, 1116 .val_bits = 8,
1117}; 1117};
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 2e6b7311fabc..38356e39adba 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -195,6 +195,18 @@ config MFD_DA9063
195 Additional drivers must be enabled in order to use the functionality 195 Additional drivers must be enabled in order to use the functionality
196 of the device. 196 of the device.
197 197
198config MFD_DA9150
199 tristate "Dialog Semiconductor DA9150 Charger Fuel-Gauge chip"
200 depends on I2C=y
201 select MFD_CORE
202 select REGMAP_I2C
203 select REGMAP_IRQ
204 help
205 This adds support for the DA9150 integrated charger and fuel-gauge
206 chip. This driver provides common support for accessing the device.
207 Additional drivers must be enabled in order to use the specific
208 features of the device.
209
198config MFD_DLN2 210config MFD_DLN2
199 tristate "Diolan DLN2 support" 211 tristate "Diolan DLN2 support"
200 select MFD_CORE 212 select MFD_CORE
@@ -417,6 +429,7 @@ config MFD_MAX14577
417config MFD_MAX77686 429config MFD_MAX77686
418 bool "Maxim Semiconductor MAX77686/802 PMIC Support" 430 bool "Maxim Semiconductor MAX77686/802 PMIC Support"
419 depends on I2C=y 431 depends on I2C=y
432 depends on OF
420 select MFD_CORE 433 select MFD_CORE
421 select REGMAP_I2C 434 select REGMAP_I2C
422 select REGMAP_IRQ 435 select REGMAP_IRQ
@@ -589,6 +602,20 @@ config MFD_PM8921_CORE
589 Say M here if you want to include support for PM8921 chip as a module. 602 Say M here if you want to include support for PM8921 chip as a module.
590 This will build a module called "pm8921-core". 603 This will build a module called "pm8921-core".
591 604
605config MFD_QCOM_RPM
606 tristate "Qualcomm Resource Power Manager (RPM)"
607 depends on ARCH_QCOM && OF
608 help
609 If you say yes to this option, support will be included for the
610 Resource Power Manager system found in the Qualcomm 8660, 8960 and
611 8064 based devices.
612
613 This is required to access many regulators, clocks and bus
614 frequencies controlled by the RPM on these devices.
615
616 Say M here if you want to include support for the Qualcomm RPM as a
617 module. This will build a module called "qcom_rpm".
618
592config MFD_SPMI_PMIC 619config MFD_SPMI_PMIC
593 tristate "Qualcomm SPMI PMICs" 620 tristate "Qualcomm SPMI PMICs"
594 depends on ARCH_QCOM || COMPILE_TEST 621 depends on ARCH_QCOM || COMPILE_TEST
@@ -623,6 +650,18 @@ config MFD_RTSX_PCI
623 types of memory cards, such as Memory Stick, Memory Stick Pro, 650 types of memory cards, such as Memory Stick, Memory Stick Pro,
624 Secure Digital and MultiMediaCard. 651 Secure Digital and MultiMediaCard.
625 652
653config MFD_RT5033
654 tristate "Richtek RT5033 Power Management IC"
655 depends on I2C=y
656 select MFD_CORE
657 select REGMAP_I2C
658 help
659 This driver provides for the Richtek RT5033 Power Management IC,
660 which includes the I2C driver and the Core APIs. This driver provides
661 common support for accessing the device. The device supports multiple
662 sub-devices like charger, fuel gauge, flash LED, current source,
663 LDO and Buck.
664
626config MFD_RTSX_USB 665config MFD_RTSX_USB
627 tristate "Realtek USB card reader" 666 tristate "Realtek USB card reader"
628 depends on USB 667 depends on USB
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 53467e211381..19f3d744e3bd 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -113,7 +113,7 @@ obj-$(CONFIG_MFD_DA9055) += da9055.o
113 113
114da9063-objs := da9063-core.o da9063-irq.o da9063-i2c.o 114da9063-objs := da9063-core.o da9063-irq.o da9063-i2c.o
115obj-$(CONFIG_MFD_DA9063) += da9063.o 115obj-$(CONFIG_MFD_DA9063) += da9063.o
116 116obj-$(CONFIG_MFD_DA9150) += da9150-core.o
117obj-$(CONFIG_MFD_MAX14577) += max14577.o 117obj-$(CONFIG_MFD_MAX14577) += max14577.o
118obj-$(CONFIG_MFD_MAX77686) += max77686.o 118obj-$(CONFIG_MFD_MAX77686) += max77686.o
119obj-$(CONFIG_MFD_MAX77693) += max77693.o 119obj-$(CONFIG_MFD_MAX77693) += max77693.o
@@ -153,6 +153,7 @@ obj-$(CONFIG_MFD_SI476X_CORE) += si476x-core.o
153obj-$(CONFIG_MFD_CS5535) += cs5535-mfd.o 153obj-$(CONFIG_MFD_CS5535) += cs5535-mfd.o
154obj-$(CONFIG_MFD_OMAP_USB_HOST) += omap-usb-host.o omap-usb-tll.o 154obj-$(CONFIG_MFD_OMAP_USB_HOST) += omap-usb-host.o omap-usb-tll.o
155obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o ssbi.o 155obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o ssbi.o
156obj-$(CONFIG_MFD_QCOM_RPM) += qcom_rpm.o
156obj-$(CONFIG_MFD_SPMI_PMIC) += qcom-spmi-pmic.o 157obj-$(CONFIG_MFD_SPMI_PMIC) += qcom-spmi-pmic.o
157obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o 158obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o
158obj-$(CONFIG_MFD_TPS65090) += tps65090.o 159obj-$(CONFIG_MFD_TPS65090) += tps65090.o
@@ -176,6 +177,7 @@ obj-$(CONFIG_MFD_IPAQ_MICRO) += ipaq-micro.o
176obj-$(CONFIG_MFD_MENF21BMC) += menf21bmc.o 177obj-$(CONFIG_MFD_MENF21BMC) += menf21bmc.o
177obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o 178obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o
178obj-$(CONFIG_MFD_DLN2) += dln2.o 179obj-$(CONFIG_MFD_DLN2) += dln2.o
180obj-$(CONFIG_MFD_RT5033) += rt5033.o
179 181
180intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o 182intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
181obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o 183obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index f38bc98a3c57..facd3610ac77 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -86,6 +86,7 @@ static const struct mfd_cell da9063_devs[] = {
86 }, 86 },
87 { 87 {
88 .name = DA9063_DRVNAME_WATCHDOG, 88 .name = DA9063_DRVNAME_WATCHDOG,
89 .of_compatible = "dlg,da9063-watchdog",
89 }, 90 },
90 { 91 {
91 .name = DA9063_DRVNAME_HWMON, 92 .name = DA9063_DRVNAME_HWMON,
@@ -101,6 +102,7 @@ static const struct mfd_cell da9063_devs[] = {
101 .name = DA9063_DRVNAME_RTC, 102 .name = DA9063_DRVNAME_RTC,
102 .num_resources = ARRAY_SIZE(da9063_rtc_resources), 103 .num_resources = ARRAY_SIZE(da9063_rtc_resources),
103 .resources = da9063_rtc_resources, 104 .resources = da9063_rtc_resources,
105 .of_compatible = "dlg,da9063-rtc",
104 }, 106 },
105 { 107 {
106 .name = DA9063_DRVNAME_VIBRATION, 108 .name = DA9063_DRVNAME_VIBRATION,
diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
index 21fd8d9a217b..6f3a7c0001f9 100644
--- a/drivers/mfd/da9063-i2c.c
+++ b/drivers/mfd/da9063-i2c.c
@@ -25,6 +25,9 @@
25#include <linux/mfd/da9063/pdata.h> 25#include <linux/mfd/da9063/pdata.h>
26#include <linux/mfd/da9063/registers.h> 26#include <linux/mfd/da9063/registers.h>
27 27
28#include <linux/of.h>
29#include <linux/regulator/of_regulator.h>
30
28static const struct regmap_range da9063_ad_readable_ranges[] = { 31static const struct regmap_range da9063_ad_readable_ranges[] = {
29 { 32 {
30 .range_min = DA9063_REG_PAGE_CON, 33 .range_min = DA9063_REG_PAGE_CON,
@@ -203,6 +206,11 @@ static struct regmap_config da9063_regmap_config = {
203 .cache_type = REGCACHE_RBTREE, 206 .cache_type = REGCACHE_RBTREE,
204}; 207};
205 208
209static const struct of_device_id da9063_dt_ids[] = {
210 { .compatible = "dlg,da9063", },
211 { }
212};
213MODULE_DEVICE_TABLE(of, da9063_dt_ids);
206static int da9063_i2c_probe(struct i2c_client *i2c, 214static int da9063_i2c_probe(struct i2c_client *i2c,
207 const struct i2c_device_id *id) 215 const struct i2c_device_id *id)
208{ 216{
@@ -257,6 +265,7 @@ static struct i2c_driver da9063_i2c_driver = {
257 .driver = { 265 .driver = {
258 .name = "da9063", 266 .name = "da9063",
259 .owner = THIS_MODULE, 267 .owner = THIS_MODULE,
268 .of_match_table = of_match_ptr(da9063_dt_ids),
260 }, 269 },
261 .probe = da9063_i2c_probe, 270 .probe = da9063_i2c_probe,
262 .remove = da9063_i2c_remove, 271 .remove = da9063_i2c_remove,
diff --git a/drivers/mfd/da9150-core.c b/drivers/mfd/da9150-core.c
new file mode 100644
index 000000000000..4d757b97ef9a
--- /dev/null
+++ b/drivers/mfd/da9150-core.c
@@ -0,0 +1,413 @@
1/*
2 * DA9150 Core MFD Driver
3 *
4 * Copyright (c) 2014 Dialog Semiconductor
5 *
6 * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/platform_device.h>
17#include <linux/i2c.h>
18#include <linux/regmap.h>
19#include <linux/slab.h>
20#include <linux/irq.h>
21#include <linux/interrupt.h>
22#include <linux/mfd/core.h>
23#include <linux/mfd/da9150/core.h>
24#include <linux/mfd/da9150/registers.h>
25
26static bool da9150_volatile_reg(struct device *dev, unsigned int reg)
27{
28 switch (reg) {
29 case DA9150_PAGE_CON:
30 case DA9150_STATUS_A:
31 case DA9150_STATUS_B:
32 case DA9150_STATUS_C:
33 case DA9150_STATUS_D:
34 case DA9150_STATUS_E:
35 case DA9150_STATUS_F:
36 case DA9150_STATUS_G:
37 case DA9150_STATUS_H:
38 case DA9150_STATUS_I:
39 case DA9150_STATUS_J:
40 case DA9150_STATUS_K:
41 case DA9150_STATUS_L:
42 case DA9150_STATUS_N:
43 case DA9150_FAULT_LOG_A:
44 case DA9150_FAULT_LOG_B:
45 case DA9150_EVENT_E:
46 case DA9150_EVENT_F:
47 case DA9150_EVENT_G:
48 case DA9150_EVENT_H:
49 case DA9150_CONTROL_B:
50 case DA9150_CONTROL_C:
51 case DA9150_GPADC_MAN:
52 case DA9150_GPADC_RES_A:
53 case DA9150_GPADC_RES_B:
54 case DA9150_ADETVB_CFG_C:
55 case DA9150_ADETD_STAT:
56 case DA9150_ADET_CMPSTAT:
57 case DA9150_ADET_CTRL_A:
58 case DA9150_PPR_TCTR_B:
59 case DA9150_COREBTLD_STAT_A:
60 case DA9150_CORE_DATA_A:
61 case DA9150_CORE_DATA_B:
62 case DA9150_CORE_DATA_C:
63 case DA9150_CORE_DATA_D:
64 case DA9150_CORE2WIRE_STAT_A:
65 case DA9150_FW_CTRL_C:
66 case DA9150_FG_CTRL_B:
67 case DA9150_FW_CTRL_B:
68 case DA9150_GPADC_CMAN:
69 case DA9150_GPADC_CRES_A:
70 case DA9150_GPADC_CRES_B:
71 case DA9150_CC_ICHG_RES_A:
72 case DA9150_CC_ICHG_RES_B:
73 case DA9150_CC_IAVG_RES_A:
74 case DA9150_CC_IAVG_RES_B:
75 case DA9150_TAUX_CTRL_A:
76 case DA9150_TAUX_VALUE_H:
77 case DA9150_TAUX_VALUE_L:
78 case DA9150_TBAT_RES_A:
79 case DA9150_TBAT_RES_B:
80 return true;
81 default:
82 return false;
83 }
84}
85
86static const struct regmap_range_cfg da9150_range_cfg[] = {
87 {
88 .range_min = DA9150_PAGE_CON,
89 .range_max = DA9150_TBAT_RES_B,
90 .selector_reg = DA9150_PAGE_CON,
91 .selector_mask = DA9150_I2C_PAGE_MASK,
92 .selector_shift = DA9150_I2C_PAGE_SHIFT,
93 .window_start = 0,
94 .window_len = 256,
95 },
96};
97
98static struct regmap_config da9150_regmap_config = {
99 .reg_bits = 8,
100 .val_bits = 8,
101 .ranges = da9150_range_cfg,
102 .num_ranges = ARRAY_SIZE(da9150_range_cfg),
103 .max_register = DA9150_TBAT_RES_B,
104
105 .cache_type = REGCACHE_RBTREE,
106
107 .volatile_reg = da9150_volatile_reg,
108};
109
110u8 da9150_reg_read(struct da9150 *da9150, u16 reg)
111{
112 int val, ret;
113
114 ret = regmap_read(da9150->regmap, reg, &val);
115 if (ret)
116 dev_err(da9150->dev, "Failed to read from reg 0x%x: %d\n",
117 reg, ret);
118
119 return (u8) val;
120}
121EXPORT_SYMBOL_GPL(da9150_reg_read);
122
123void da9150_reg_write(struct da9150 *da9150, u16 reg, u8 val)
124{
125 int ret;
126
127 ret = regmap_write(da9150->regmap, reg, val);
128 if (ret)
129 dev_err(da9150->dev, "Failed to write to reg 0x%x: %d\n",
130 reg, ret);
131}
132EXPORT_SYMBOL_GPL(da9150_reg_write);
133
134void da9150_set_bits(struct da9150 *da9150, u16 reg, u8 mask, u8 val)
135{
136 int ret;
137
138 ret = regmap_update_bits(da9150->regmap, reg, mask, val);
139 if (ret)
140 dev_err(da9150->dev, "Failed to set bits in reg 0x%x: %d\n",
141 reg, ret);
142}
143EXPORT_SYMBOL_GPL(da9150_set_bits);
144
145void da9150_bulk_read(struct da9150 *da9150, u16 reg, int count, u8 *buf)
146{
147 int ret;
148
149 ret = regmap_bulk_read(da9150->regmap, reg, buf, count);
150 if (ret)
151 dev_err(da9150->dev, "Failed to bulk read from reg 0x%x: %d\n",
152 reg, ret);
153}
154EXPORT_SYMBOL_GPL(da9150_bulk_read);
155
156void da9150_bulk_write(struct da9150 *da9150, u16 reg, int count, const u8 *buf)
157{
158 int ret;
159
160 ret = regmap_raw_write(da9150->regmap, reg, buf, count);
161 if (ret)
162 dev_err(da9150->dev, "Failed to bulk write to reg 0x%x %d\n",
163 reg, ret);
164}
165EXPORT_SYMBOL_GPL(da9150_bulk_write);
166
167static struct regmap_irq da9150_irqs[] = {
168 [DA9150_IRQ_VBUS] = {
169 .reg_offset = 0,
170 .mask = DA9150_E_VBUS_MASK,
171 },
172 [DA9150_IRQ_CHG] = {
173 .reg_offset = 0,
174 .mask = DA9150_E_CHG_MASK,
175 },
176 [DA9150_IRQ_TCLASS] = {
177 .reg_offset = 0,
178 .mask = DA9150_E_TCLASS_MASK,
179 },
180 [DA9150_IRQ_TJUNC] = {
181 .reg_offset = 0,
182 .mask = DA9150_E_TJUNC_MASK,
183 },
184 [DA9150_IRQ_VFAULT] = {
185 .reg_offset = 0,
186 .mask = DA9150_E_VFAULT_MASK,
187 },
188 [DA9150_IRQ_CONF] = {
189 .reg_offset = 1,
190 .mask = DA9150_E_CONF_MASK,
191 },
192 [DA9150_IRQ_DAT] = {
193 .reg_offset = 1,
194 .mask = DA9150_E_DAT_MASK,
195 },
196 [DA9150_IRQ_DTYPE] = {
197 .reg_offset = 1,
198 .mask = DA9150_E_DTYPE_MASK,
199 },
200 [DA9150_IRQ_ID] = {
201 .reg_offset = 1,
202 .mask = DA9150_E_ID_MASK,
203 },
204 [DA9150_IRQ_ADP] = {
205 .reg_offset = 1,
206 .mask = DA9150_E_ADP_MASK,
207 },
208 [DA9150_IRQ_SESS_END] = {
209 .reg_offset = 1,
210 .mask = DA9150_E_SESS_END_MASK,
211 },
212 [DA9150_IRQ_SESS_VLD] = {
213 .reg_offset = 1,
214 .mask = DA9150_E_SESS_VLD_MASK,
215 },
216 [DA9150_IRQ_FG] = {
217 .reg_offset = 2,
218 .mask = DA9150_E_FG_MASK,
219 },
220 [DA9150_IRQ_GP] = {
221 .reg_offset = 2,
222 .mask = DA9150_E_GP_MASK,
223 },
224 [DA9150_IRQ_TBAT] = {
225 .reg_offset = 2,
226 .mask = DA9150_E_TBAT_MASK,
227 },
228 [DA9150_IRQ_GPIOA] = {
229 .reg_offset = 2,
230 .mask = DA9150_E_GPIOA_MASK,
231 },
232 [DA9150_IRQ_GPIOB] = {
233 .reg_offset = 2,
234 .mask = DA9150_E_GPIOB_MASK,
235 },
236 [DA9150_IRQ_GPIOC] = {
237 .reg_offset = 2,
238 .mask = DA9150_E_GPIOC_MASK,
239 },
240 [DA9150_IRQ_GPIOD] = {
241 .reg_offset = 2,
242 .mask = DA9150_E_GPIOD_MASK,
243 },
244 [DA9150_IRQ_GPADC] = {
245 .reg_offset = 2,
246 .mask = DA9150_E_GPADC_MASK,
247 },
248 [DA9150_IRQ_WKUP] = {
249 .reg_offset = 3,
250 .mask = DA9150_E_WKUP_MASK,
251 },
252};
253
254static struct regmap_irq_chip da9150_regmap_irq_chip = {
255 .name = "da9150_irq",
256 .status_base = DA9150_EVENT_E,
257 .mask_base = DA9150_IRQ_MASK_E,
258 .ack_base = DA9150_EVENT_E,
259 .num_regs = DA9150_NUM_IRQ_REGS,
260 .irqs = da9150_irqs,
261 .num_irqs = ARRAY_SIZE(da9150_irqs),
262};
263
264static struct resource da9150_gpadc_resources[] = {
265 {
266 .name = "GPADC",
267 .start = DA9150_IRQ_GPADC,
268 .end = DA9150_IRQ_GPADC,
269 .flags = IORESOURCE_IRQ,
270 },
271};
272
273static struct resource da9150_charger_resources[] = {
274 {
275 .name = "CHG_STATUS",
276 .start = DA9150_IRQ_CHG,
277 .end = DA9150_IRQ_CHG,
278 .flags = IORESOURCE_IRQ,
279 },
280 {
281 .name = "CHG_TJUNC",
282 .start = DA9150_IRQ_TJUNC,
283 .end = DA9150_IRQ_TJUNC,
284 .flags = IORESOURCE_IRQ,
285 },
286 {
287 .name = "CHG_VFAULT",
288 .start = DA9150_IRQ_VFAULT,
289 .end = DA9150_IRQ_VFAULT,
290 .flags = IORESOURCE_IRQ,
291 },
292 {
293 .name = "CHG_VBUS",
294 .start = DA9150_IRQ_VBUS,
295 .end = DA9150_IRQ_VBUS,
296 .flags = IORESOURCE_IRQ,
297 },
298};
299
300static struct mfd_cell da9150_devs[] = {
301 {
302 .name = "da9150-gpadc",
303 .of_compatible = "dlg,da9150-gpadc",
304 .resources = da9150_gpadc_resources,
305 .num_resources = ARRAY_SIZE(da9150_gpadc_resources),
306 },
307 {
308 .name = "da9150-charger",
309 .of_compatible = "dlg,da9150-charger",
310 .resources = da9150_charger_resources,
311 .num_resources = ARRAY_SIZE(da9150_charger_resources),
312 },
313};
314
315static int da9150_probe(struct i2c_client *client,
316 const struct i2c_device_id *id)
317{
318 struct da9150 *da9150;
319 struct da9150_pdata *pdata = dev_get_platdata(&client->dev);
320 int ret;
321
322 da9150 = devm_kzalloc(&client->dev, sizeof(*da9150), GFP_KERNEL);
323 if (!da9150)
324 return -ENOMEM;
325
326 da9150->dev = &client->dev;
327 da9150->irq = client->irq;
328 i2c_set_clientdata(client, da9150);
329
330 da9150->regmap = devm_regmap_init_i2c(client, &da9150_regmap_config);
331 if (IS_ERR(da9150->regmap)) {
332 ret = PTR_ERR(da9150->regmap);
333 dev_err(da9150->dev, "Failed to allocate register map: %d\n",
334 ret);
335 return ret;
336 }
337
338 da9150->irq_base = pdata ? pdata->irq_base : -1;
339
340 ret = regmap_add_irq_chip(da9150->regmap, da9150->irq,
341 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
342 da9150->irq_base, &da9150_regmap_irq_chip,
343 &da9150->regmap_irq_data);
344 if (ret)
345 return ret;
346
347 da9150->irq_base = regmap_irq_chip_get_base(da9150->regmap_irq_data);
348 enable_irq_wake(da9150->irq);
349
350 ret = mfd_add_devices(da9150->dev, -1, da9150_devs,
351 ARRAY_SIZE(da9150_devs), NULL,
352 da9150->irq_base, NULL);
353 if (ret) {
354 dev_err(da9150->dev, "Failed to add child devices: %d\n", ret);
355 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data);
356 return ret;
357 }
358
359 return 0;
360}
361
362static int da9150_remove(struct i2c_client *client)
363{
364 struct da9150 *da9150 = i2c_get_clientdata(client);
365
366 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data);
367 mfd_remove_devices(da9150->dev);
368
369 return 0;
370}
371
372static void da9150_shutdown(struct i2c_client *client)
373{
374 struct da9150 *da9150 = i2c_get_clientdata(client);
375
376 /* Make sure we have a wakup source for the device */
377 da9150_set_bits(da9150, DA9150_CONFIG_D,
378 DA9150_WKUP_PM_EN_MASK,
379 DA9150_WKUP_PM_EN_MASK);
380
381 /* Set device to DISABLED mode */
382 da9150_set_bits(da9150, DA9150_CONTROL_C,
383 DA9150_DISABLE_MASK, DA9150_DISABLE_MASK);
384}
385
386static const struct i2c_device_id da9150_i2c_id[] = {
387 { "da9150", },
388 { }
389};
390MODULE_DEVICE_TABLE(i2c, da9150_i2c_id);
391
392static const struct of_device_id da9150_of_match[] = {
393 { .compatible = "dlg,da9150", },
394 { }
395};
396MODULE_DEVICE_TABLE(of, da9150_of_match);
397
398static struct i2c_driver da9150_driver = {
399 .driver = {
400 .name = "da9150",
401 .of_match_table = of_match_ptr(da9150_of_match),
402 },
403 .probe = da9150_probe,
404 .remove = da9150_remove,
405 .shutdown = da9150_shutdown,
406 .id_table = da9150_i2c_id,
407};
408
409module_i2c_driver(da9150_driver);
410
411MODULE_DESCRIPTION("MFD Core Driver for DA9150");
412MODULE_AUTHOR("Adam Thomson <Adam.Thomson.Opensource@diasemi.com>");
413MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/davinci_voicecodec.c b/drivers/mfd/davinci_voicecodec.c
index c835e85539b2..9bbc642a7b9d 100644
--- a/drivers/mfd/davinci_voicecodec.c
+++ b/drivers/mfd/davinci_voicecodec.c
@@ -33,7 +33,7 @@
33 33
34#include <linux/mfd/davinci_voicecodec.h> 34#include <linux/mfd/davinci_voicecodec.h>
35 35
36static struct regmap_config davinci_vc_regmap = { 36static const struct regmap_config davinci_vc_regmap = {
37 .reg_bits = 32, 37 .reg_bits = 32,
38 .val_bits = 32, 38 .val_bits = 32,
39}; 39};
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 16162bf43656..cc1a404328c2 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -675,15 +675,6 @@ bool prcmu_has_arm_maxopp(void)
675} 675}
676 676
677/** 677/**
678 * prcmu_get_boot_status - PRCMU boot status checking
679 * Returns: the current PRCMU boot status
680 */
681int prcmu_get_boot_status(void)
682{
683 return readb(tcdm_base + PRCM_BOOT_STATUS);
684}
685
686/**
687 * prcmu_set_rc_a2p - This function is used to run few power state sequences 678 * prcmu_set_rc_a2p - This function is used to run few power state sequences
688 * @val: Value to be set, i.e. transition requested 679 * @val: Value to be set, i.e. transition requested
689 * Returns: 0 on success, -EINVAL on invalid argument 680 * Returns: 0 on success, -EINVAL on invalid argument
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index 6d49685d4ee4..1be9bd1c046d 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -587,12 +587,19 @@ static void dln2_free_rx_urbs(struct dln2_dev *dln2)
587 int i; 587 int i;
588 588
589 for (i = 0; i < DLN2_MAX_URBS; i++) { 589 for (i = 0; i < DLN2_MAX_URBS; i++) {
590 usb_kill_urb(dln2->rx_urb[i]);
591 usb_free_urb(dln2->rx_urb[i]); 590 usb_free_urb(dln2->rx_urb[i]);
592 kfree(dln2->rx_buf[i]); 591 kfree(dln2->rx_buf[i]);
593 } 592 }
594} 593}
595 594
595static void dln2_stop_rx_urbs(struct dln2_dev *dln2)
596{
597 int i;
598
599 for (i = 0; i < DLN2_MAX_URBS; i++)
600 usb_kill_urb(dln2->rx_urb[i]);
601}
602
596static void dln2_free(struct dln2_dev *dln2) 603static void dln2_free(struct dln2_dev *dln2)
597{ 604{
598 dln2_free_rx_urbs(dln2); 605 dln2_free_rx_urbs(dln2);
@@ -604,9 +611,7 @@ static int dln2_setup_rx_urbs(struct dln2_dev *dln2,
604 struct usb_host_interface *hostif) 611 struct usb_host_interface *hostif)
605{ 612{
606 int i; 613 int i;
607 int ret;
608 const int rx_max_size = DLN2_RX_BUF_SIZE; 614 const int rx_max_size = DLN2_RX_BUF_SIZE;
609 struct device *dev = &dln2->interface->dev;
610 615
611 for (i = 0; i < DLN2_MAX_URBS; i++) { 616 for (i = 0; i < DLN2_MAX_URBS; i++) {
612 dln2->rx_buf[i] = kmalloc(rx_max_size, GFP_KERNEL); 617 dln2->rx_buf[i] = kmalloc(rx_max_size, GFP_KERNEL);
@@ -620,8 +625,19 @@ static int dln2_setup_rx_urbs(struct dln2_dev *dln2,
620 usb_fill_bulk_urb(dln2->rx_urb[i], dln2->usb_dev, 625 usb_fill_bulk_urb(dln2->rx_urb[i], dln2->usb_dev,
621 usb_rcvbulkpipe(dln2->usb_dev, dln2->ep_in), 626 usb_rcvbulkpipe(dln2->usb_dev, dln2->ep_in),
622 dln2->rx_buf[i], rx_max_size, dln2_rx, dln2); 627 dln2->rx_buf[i], rx_max_size, dln2_rx, dln2);
628 }
623 629
624 ret = usb_submit_urb(dln2->rx_urb[i], GFP_KERNEL); 630 return 0;
631}
632
633static int dln2_start_rx_urbs(struct dln2_dev *dln2, gfp_t gfp)
634{
635 struct device *dev = &dln2->interface->dev;
636 int ret;
637 int i;
638
639 for (i = 0; i < DLN2_MAX_URBS; i++) {
640 ret = usb_submit_urb(dln2->rx_urb[i], gfp);
625 if (ret < 0) { 641 if (ret < 0) {
626 dev_err(dev, "failed to submit RX URB: %d\n", ret); 642 dev_err(dev, "failed to submit RX URB: %d\n", ret);
627 return ret; 643 return ret;
@@ -665,9 +681,8 @@ static const struct mfd_cell dln2_devs[] = {
665 }, 681 },
666}; 682};
667 683
668static void dln2_disconnect(struct usb_interface *interface) 684static void dln2_stop(struct dln2_dev *dln2)
669{ 685{
670 struct dln2_dev *dln2 = usb_get_intfdata(interface);
671 int i, j; 686 int i, j;
672 687
673 /* don't allow starting new transfers */ 688 /* don't allow starting new transfers */
@@ -696,6 +711,15 @@ static void dln2_disconnect(struct usb_interface *interface)
696 /* wait for transfers to end */ 711 /* wait for transfers to end */
697 wait_event(dln2->disconnect_wq, !dln2->active_transfers); 712 wait_event(dln2->disconnect_wq, !dln2->active_transfers);
698 713
714 dln2_stop_rx_urbs(dln2);
715}
716
717static void dln2_disconnect(struct usb_interface *interface)
718{
719 struct dln2_dev *dln2 = usb_get_intfdata(interface);
720
721 dln2_stop(dln2);
722
699 mfd_remove_devices(&interface->dev); 723 mfd_remove_devices(&interface->dev);
700 724
701 dln2_free(dln2); 725 dln2_free(dln2);
@@ -738,28 +762,53 @@ static int dln2_probe(struct usb_interface *interface,
738 762
739 ret = dln2_setup_rx_urbs(dln2, hostif); 763 ret = dln2_setup_rx_urbs(dln2, hostif);
740 if (ret) 764 if (ret)
741 goto out_cleanup; 765 goto out_free;
766
767 ret = dln2_start_rx_urbs(dln2, GFP_KERNEL);
768 if (ret)
769 goto out_stop_rx;
742 770
743 ret = dln2_hw_init(dln2); 771 ret = dln2_hw_init(dln2);
744 if (ret < 0) { 772 if (ret < 0) {
745 dev_err(dev, "failed to initialize hardware\n"); 773 dev_err(dev, "failed to initialize hardware\n");
746 goto out_cleanup; 774 goto out_stop_rx;
747 } 775 }
748 776
749 ret = mfd_add_hotplug_devices(dev, dln2_devs, ARRAY_SIZE(dln2_devs)); 777 ret = mfd_add_hotplug_devices(dev, dln2_devs, ARRAY_SIZE(dln2_devs));
750 if (ret != 0) { 778 if (ret != 0) {
751 dev_err(dev, "failed to add mfd devices to core\n"); 779 dev_err(dev, "failed to add mfd devices to core\n");
752 goto out_cleanup; 780 goto out_stop_rx;
753 } 781 }
754 782
755 return 0; 783 return 0;
756 784
757out_cleanup: 785out_stop_rx:
786 dln2_stop_rx_urbs(dln2);
787
788out_free:
758 dln2_free(dln2); 789 dln2_free(dln2);
759 790
760 return ret; 791 return ret;
761} 792}
762 793
794static int dln2_suspend(struct usb_interface *iface, pm_message_t message)
795{
796 struct dln2_dev *dln2 = usb_get_intfdata(iface);
797
798 dln2_stop(dln2);
799
800 return 0;
801}
802
803static int dln2_resume(struct usb_interface *iface)
804{
805 struct dln2_dev *dln2 = usb_get_intfdata(iface);
806
807 dln2->disconnect = false;
808
809 return dln2_start_rx_urbs(dln2, GFP_NOIO);
810}
811
763static const struct usb_device_id dln2_table[] = { 812static const struct usb_device_id dln2_table[] = {
764 { USB_DEVICE(0xa257, 0x2013) }, 813 { USB_DEVICE(0xa257, 0x2013) },
765 { } 814 { }
@@ -772,6 +821,8 @@ static struct usb_driver dln2_driver = {
772 .probe = dln2_probe, 821 .probe = dln2_probe,
773 .disconnect = dln2_disconnect, 822 .disconnect = dln2_disconnect,
774 .id_table = dln2_table, 823 .id_table = dln2_table,
824 .suspend = dln2_suspend,
825 .resume = dln2_resume,
775}; 826};
776 827
777module_usb_driver(dln2_driver); 828module_usb_driver(dln2_driver);
diff --git a/drivers/mfd/hi6421-pmic-core.c b/drivers/mfd/hi6421-pmic-core.c
index 321a2656fd00..7210ae28bf81 100644
--- a/drivers/mfd/hi6421-pmic-core.c
+++ b/drivers/mfd/hi6421-pmic-core.c
@@ -35,7 +35,7 @@ static const struct mfd_cell hi6421_devs[] = {
35 { .name = "hi6421-regulator", }, 35 { .name = "hi6421-regulator", },
36}; 36};
37 37
38static struct regmap_config hi6421_regmap_config = { 38static const struct regmap_config hi6421_regmap_config = {
39 .reg_bits = 32, 39 .reg_bits = 32,
40 .reg_stride = 4, 40 .reg_stride = 4,
41 .val_bits = 8, 41 .val_bits = 8,
diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index df7b0642a5b4..80cef048b904 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -64,6 +64,9 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
64 config = (struct intel_soc_pmic_config *)id->driver_data; 64 config = (struct intel_soc_pmic_config *)id->driver_data;
65 65
66 pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); 66 pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
67 if (!pmic)
68 return -ENOMEM;
69
67 dev_set_drvdata(dev, pmic); 70 dev_set_drvdata(dev, pmic);
68 71
69 pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config); 72 pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
diff --git a/drivers/mfd/intel_soc_pmic_core.h b/drivers/mfd/intel_soc_pmic_core.h
index 33aacd9baddc..9498d6719847 100644
--- a/drivers/mfd/intel_soc_pmic_core.h
+++ b/drivers/mfd/intel_soc_pmic_core.h
@@ -23,7 +23,7 @@ struct intel_soc_pmic_config {
23 unsigned long irq_flags; 23 unsigned long irq_flags;
24 struct mfd_cell *cell_dev; 24 struct mfd_cell *cell_dev;
25 int n_cell_devs; 25 int n_cell_devs;
26 struct regmap_config *regmap_config; 26 const struct regmap_config *regmap_config;
27 struct regmap_irq_chip *irq_chip; 27 struct regmap_irq_chip *irq_chip;
28}; 28};
29 29
diff --git a/drivers/mfd/intel_soc_pmic_crc.c b/drivers/mfd/intel_soc_pmic_crc.c
index c85e2ecb868a..4cc1b324e971 100644
--- a/drivers/mfd/intel_soc_pmic_crc.c
+++ b/drivers/mfd/intel_soc_pmic_crc.c
@@ -111,7 +111,7 @@ static struct mfd_cell crystal_cove_dev[] = {
111 }, 111 },
112}; 112};
113 113
114static struct regmap_config crystal_cove_regmap_config = { 114static const struct regmap_config crystal_cove_regmap_config = {
115 .reg_bits = 8, 115 .reg_bits = 8,
116 .val_bits = 8, 116 .val_bits = 8,
117 117
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index 8c29f7b27324..d42fbb667d8c 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -583,7 +583,7 @@ static bool lm3533_precious_register(struct device *dev, unsigned int reg)
583 } 583 }
584} 584}
585 585
586static struct regmap_config regmap_config = { 586static const struct regmap_config regmap_config = {
587 .reg_bits = 8, 587 .reg_bits = 8,
588 .val_bits = 8, 588 .val_bits = 8,
589 .max_register = LM3533_REG_MAX, 589 .max_register = LM3533_REG_MAX,
diff --git a/drivers/mfd/lpc_sch.c b/drivers/mfd/lpc_sch.c
index 5c38df35a84d..a56e4ba5227b 100644
--- a/drivers/mfd/lpc_sch.c
+++ b/drivers/mfd/lpc_sch.c
@@ -75,6 +75,7 @@ static struct lpc_sch_info sch_chipset_info[] = {
75 [LPC_QUARK_X1000] = { 75 [LPC_QUARK_X1000] = {
76 .io_size_gpio = GPIO_IO_SIZE, 76 .io_size_gpio = GPIO_IO_SIZE,
77 .irq_gpio = GPIO_IRQ_QUARK_X1000, 77 .irq_gpio = GPIO_IRQ_QUARK_X1000,
78 .io_size_wdt = WDT_IO_SIZE,
78 }, 79 },
79}; 80};
80 81
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index 929795eae9fc..760d08d7923d 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -111,17 +111,17 @@ static bool max77802_is_volatile_reg(struct device *dev, unsigned int reg)
111 max77802_rtc_is_volatile_reg(dev, reg)); 111 max77802_rtc_is_volatile_reg(dev, reg));
112} 112}
113 113
114static struct regmap_config max77686_regmap_config = { 114static const struct regmap_config max77686_regmap_config = {
115 .reg_bits = 8, 115 .reg_bits = 8,
116 .val_bits = 8, 116 .val_bits = 8,
117}; 117};
118 118
119static struct regmap_config max77686_rtc_regmap_config = { 119static const struct regmap_config max77686_rtc_regmap_config = {
120 .reg_bits = 8, 120 .reg_bits = 8,
121 .val_bits = 8, 121 .val_bits = 8,
122}; 122};
123 123
124static struct regmap_config max77802_regmap_config = { 124static const struct regmap_config max77802_regmap_config = {
125 .reg_bits = 8, 125 .reg_bits = 8,
126 .val_bits = 8, 126 .val_bits = 8,
127 .writeable_reg = max77802_is_accessible_reg, 127 .writeable_reg = max77802_is_accessible_reg,
@@ -205,24 +205,10 @@ static const struct of_device_id max77686_pmic_dt_match[] = {
205 { }, 205 { },
206}; 206};
207 207
208static struct max77686_platform_data *max77686_i2c_parse_dt_pdata(struct device
209 *dev)
210{
211 struct max77686_platform_data *pd;
212
213 pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
214 if (!pd)
215 return NULL;
216
217 dev->platform_data = pd;
218 return pd;
219}
220
221static int max77686_i2c_probe(struct i2c_client *i2c, 208static int max77686_i2c_probe(struct i2c_client *i2c,
222 const struct i2c_device_id *id) 209 const struct i2c_device_id *id)
223{ 210{
224 struct max77686_dev *max77686 = NULL; 211 struct max77686_dev *max77686 = NULL;
225 struct max77686_platform_data *pdata = dev_get_platdata(&i2c->dev);
226 const struct of_device_id *match; 212 const struct of_device_id *match;
227 unsigned int data; 213 unsigned int data;
228 int ret = 0; 214 int ret = 0;
@@ -233,14 +219,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
233 const struct mfd_cell *cells; 219 const struct mfd_cell *cells;
234 int n_devs; 220 int n_devs;
235 221
236 if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node && !pdata)
237 pdata = max77686_i2c_parse_dt_pdata(&i2c->dev);
238
239 if (!pdata) {
240 dev_err(&i2c->dev, "No platform data found.\n");
241 return -EINVAL;
242 }
243
244 max77686 = devm_kzalloc(&i2c->dev, 222 max77686 = devm_kzalloc(&i2c->dev,
245 sizeof(struct max77686_dev), GFP_KERNEL); 223 sizeof(struct max77686_dev), GFP_KERNEL);
246 if (!max77686) 224 if (!max77686)
@@ -259,7 +237,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
259 max77686->dev = &i2c->dev; 237 max77686->dev = &i2c->dev;
260 max77686->i2c = i2c; 238 max77686->i2c = i2c;
261 239
262 max77686->wakeup = pdata->wakeup;
263 max77686->irq = i2c->irq; 240 max77686->irq = i2c->irq;
264 241
265 if (max77686->type == TYPE_MAX77686) { 242 if (max77686->type == TYPE_MAX77686) {
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index ae3addb153a2..68b844811566 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -46,7 +46,7 @@ static const struct of_device_id mc13xxx_dt_ids[] = {
46}; 46};
47MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids); 47MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids);
48 48
49static struct regmap_config mc13xxx_regmap_i2c_config = { 49static const struct regmap_config mc13xxx_regmap_i2c_config = {
50 .reg_bits = 8, 50 .reg_bits = 8,
51 .val_bits = 24, 51 .val_bits = 24,
52 52
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 702925e242c9..58a170e45d88 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -48,7 +48,7 @@ static const struct of_device_id mc13xxx_dt_ids[] = {
48}; 48};
49MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids); 49MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids);
50 50
51static struct regmap_config mc13xxx_regmap_spi_config = { 51static const struct regmap_config mc13xxx_regmap_spi_config = {
52 .reg_bits = 7, 52 .reg_bits = 7,
53 .pad_bits = 1, 53 .pad_bits = 1,
54 .val_bits = 24, 54 .val_bits = 24,
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 04cd54dd507c..1d924d1533c0 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -129,16 +129,6 @@ static inline u32 usbhs_read(void __iomem *base, u32 reg)
129 return readl_relaxed(base + reg); 129 return readl_relaxed(base + reg);
130} 130}
131 131
132static inline void usbhs_writeb(void __iomem *base, u8 reg, u8 val)
133{
134 writeb_relaxed(val, base + reg);
135}
136
137static inline u8 usbhs_readb(void __iomem *base, u8 reg)
138{
139 return readb_relaxed(base + reg);
140}
141
142/*-------------------------------------------------------------------------*/ 132/*-------------------------------------------------------------------------*/
143 133
144/** 134/**
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 43664eb69c93..6155d123a84e 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -183,7 +183,7 @@ static int pcf50633_resume(struct device *dev)
183 183
184static SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume); 184static SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume);
185 185
186static struct regmap_config pcf50633_regmap_config = { 186static const struct regmap_config pcf50633_regmap_config = {
187 .reg_bits = 8, 187 .reg_bits = 8,
188 .val_bits = 8, 188 .val_bits = 8,
189}; 189};
diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
new file mode 100644
index 000000000000..f696328c2933
--- /dev/null
+++ b/drivers/mfd/qcom_rpm.c
@@ -0,0 +1,581 @@
1/*
2 * Copyright (c) 2014, Sony Mobile Communications AB.
3 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
4 * Author: Bjorn Andersson <bjorn.andersson@sonymobile.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/module.h>
17#include <linux/platform_device.h>
18#include <linux/of_platform.h>
19#include <linux/io.h>
20#include <linux/interrupt.h>
21#include <linux/mfd/qcom_rpm.h>
22#include <linux/mfd/syscon.h>
23#include <linux/regmap.h>
24
25#include <dt-bindings/mfd/qcom-rpm.h>
26
27struct qcom_rpm_resource {
28 unsigned target_id;
29 unsigned status_id;
30 unsigned select_id;
31 unsigned size;
32};
33
34struct qcom_rpm_data {
35 u32 version;
36 const struct qcom_rpm_resource *resource_table;
37 unsigned n_resources;
38};
39
40struct qcom_rpm {
41 struct device *dev;
42 struct regmap *ipc_regmap;
43 unsigned ipc_offset;
44 unsigned ipc_bit;
45
46 struct completion ack;
47 struct mutex lock;
48
49 void __iomem *status_regs;
50 void __iomem *ctrl_regs;
51 void __iomem *req_regs;
52
53 u32 ack_status;
54
55 const struct qcom_rpm_data *data;
56};
57
58#define RPM_STATUS_REG(rpm, i) ((rpm)->status_regs + (i) * 4)
59#define RPM_CTRL_REG(rpm, i) ((rpm)->ctrl_regs + (i) * 4)
60#define RPM_REQ_REG(rpm, i) ((rpm)->req_regs + (i) * 4)
61
62#define RPM_REQUEST_TIMEOUT (5 * HZ)
63
64#define RPM_REQUEST_CONTEXT 3
65#define RPM_REQ_SELECT 11
66#define RPM_ACK_CONTEXT 15
67#define RPM_ACK_SELECTOR 23
68#define RPM_SELECT_SIZE 7
69
70#define RPM_NOTIFICATION BIT(30)
71#define RPM_REJECTED BIT(31)
72
73#define RPM_SIGNAL BIT(2)
74
75static const struct qcom_rpm_resource apq8064_rpm_resource_table[] = {
76 [QCOM_RPM_CXO_CLK] = { 25, 9, 5, 1 },
77 [QCOM_RPM_PXO_CLK] = { 26, 10, 6, 1 },
78 [QCOM_RPM_APPS_FABRIC_CLK] = { 27, 11, 8, 1 },
79 [QCOM_RPM_SYS_FABRIC_CLK] = { 28, 12, 9, 1 },
80 [QCOM_RPM_MM_FABRIC_CLK] = { 29, 13, 10, 1 },
81 [QCOM_RPM_DAYTONA_FABRIC_CLK] = { 30, 14, 11, 1 },
82 [QCOM_RPM_SFPB_CLK] = { 31, 15, 12, 1 },
83 [QCOM_RPM_CFPB_CLK] = { 32, 16, 13, 1 },
84 [QCOM_RPM_MMFPB_CLK] = { 33, 17, 14, 1 },
85 [QCOM_RPM_EBI1_CLK] = { 34, 18, 16, 1 },
86 [QCOM_RPM_APPS_FABRIC_HALT] = { 35, 19, 18, 1 },
87 [QCOM_RPM_APPS_FABRIC_MODE] = { 37, 20, 19, 1 },
88 [QCOM_RPM_APPS_FABRIC_IOCTL] = { 40, 21, 20, 1 },
89 [QCOM_RPM_APPS_FABRIC_ARB] = { 41, 22, 21, 12 },
90 [QCOM_RPM_SYS_FABRIC_HALT] = { 53, 23, 22, 1 },
91 [QCOM_RPM_SYS_FABRIC_MODE] = { 55, 24, 23, 1 },
92 [QCOM_RPM_SYS_FABRIC_IOCTL] = { 58, 25, 24, 1 },
93 [QCOM_RPM_SYS_FABRIC_ARB] = { 59, 26, 25, 30 },
94 [QCOM_RPM_MM_FABRIC_HALT] = { 89, 27, 26, 1 },
95 [QCOM_RPM_MM_FABRIC_MODE] = { 91, 28, 27, 1 },
96 [QCOM_RPM_MM_FABRIC_IOCTL] = { 94, 29, 28, 1 },
97 [QCOM_RPM_MM_FABRIC_ARB] = { 95, 30, 29, 21 },
98 [QCOM_RPM_PM8921_SMPS1] = { 116, 31, 30, 2 },
99 [QCOM_RPM_PM8921_SMPS2] = { 118, 33, 31, 2 },
100 [QCOM_RPM_PM8921_SMPS3] = { 120, 35, 32, 2 },
101 [QCOM_RPM_PM8921_SMPS4] = { 122, 37, 33, 2 },
102 [QCOM_RPM_PM8921_SMPS5] = { 124, 39, 34, 2 },
103 [QCOM_RPM_PM8921_SMPS6] = { 126, 41, 35, 2 },
104 [QCOM_RPM_PM8921_SMPS7] = { 128, 43, 36, 2 },
105 [QCOM_RPM_PM8921_SMPS8] = { 130, 45, 37, 2 },
106 [QCOM_RPM_PM8921_LDO1] = { 132, 47, 38, 2 },
107 [QCOM_RPM_PM8921_LDO2] = { 134, 49, 39, 2 },
108 [QCOM_RPM_PM8921_LDO3] = { 136, 51, 40, 2 },
109 [QCOM_RPM_PM8921_LDO4] = { 138, 53, 41, 2 },
110 [QCOM_RPM_PM8921_LDO5] = { 140, 55, 42, 2 },
111 [QCOM_RPM_PM8921_LDO6] = { 142, 57, 43, 2 },
112 [QCOM_RPM_PM8921_LDO7] = { 144, 59, 44, 2 },
113 [QCOM_RPM_PM8921_LDO8] = { 146, 61, 45, 2 },
114 [QCOM_RPM_PM8921_LDO9] = { 148, 63, 46, 2 },
115 [QCOM_RPM_PM8921_LDO10] = { 150, 65, 47, 2 },
116 [QCOM_RPM_PM8921_LDO11] = { 152, 67, 48, 2 },
117 [QCOM_RPM_PM8921_LDO12] = { 154, 69, 49, 2 },
118 [QCOM_RPM_PM8921_LDO13] = { 156, 71, 50, 2 },
119 [QCOM_RPM_PM8921_LDO14] = { 158, 73, 51, 2 },
120 [QCOM_RPM_PM8921_LDO15] = { 160, 75, 52, 2 },
121 [QCOM_RPM_PM8921_LDO16] = { 162, 77, 53, 2 },
122 [QCOM_RPM_PM8921_LDO17] = { 164, 79, 54, 2 },
123 [QCOM_RPM_PM8921_LDO18] = { 166, 81, 55, 2 },
124 [QCOM_RPM_PM8921_LDO19] = { 168, 83, 56, 2 },
125 [QCOM_RPM_PM8921_LDO20] = { 170, 85, 57, 2 },
126 [QCOM_RPM_PM8921_LDO21] = { 172, 87, 58, 2 },
127 [QCOM_RPM_PM8921_LDO22] = { 174, 89, 59, 2 },
128 [QCOM_RPM_PM8921_LDO23] = { 176, 91, 60, 2 },
129 [QCOM_RPM_PM8921_LDO24] = { 178, 93, 61, 2 },
130 [QCOM_RPM_PM8921_LDO25] = { 180, 95, 62, 2 },
131 [QCOM_RPM_PM8921_LDO26] = { 182, 97, 63, 2 },
132 [QCOM_RPM_PM8921_LDO27] = { 184, 99, 64, 2 },
133 [QCOM_RPM_PM8921_LDO28] = { 186, 101, 65, 2 },
134 [QCOM_RPM_PM8921_LDO29] = { 188, 103, 66, 2 },
135 [QCOM_RPM_PM8921_CLK1] = { 190, 105, 67, 2 },
136 [QCOM_RPM_PM8921_CLK2] = { 192, 107, 68, 2 },
137 [QCOM_RPM_PM8921_LVS1] = { 194, 109, 69, 1 },
138 [QCOM_RPM_PM8921_LVS2] = { 195, 110, 70, 1 },
139 [QCOM_RPM_PM8921_LVS3] = { 196, 111, 71, 1 },
140 [QCOM_RPM_PM8921_LVS4] = { 197, 112, 72, 1 },
141 [QCOM_RPM_PM8921_LVS5] = { 198, 113, 73, 1 },
142 [QCOM_RPM_PM8921_LVS6] = { 199, 114, 74, 1 },
143 [QCOM_RPM_PM8921_LVS7] = { 200, 115, 75, 1 },
144 [QCOM_RPM_PM8821_SMPS1] = { 201, 116, 76, 2 },
145 [QCOM_RPM_PM8821_SMPS2] = { 203, 118, 77, 2 },
146 [QCOM_RPM_PM8821_LDO1] = { 205, 120, 78, 2 },
147 [QCOM_RPM_PM8921_NCP] = { 207, 122, 80, 2 },
148 [QCOM_RPM_CXO_BUFFERS] = { 209, 124, 81, 1 },
149 [QCOM_RPM_USB_OTG_SWITCH] = { 210, 125, 82, 1 },
150 [QCOM_RPM_HDMI_SWITCH] = { 211, 126, 83, 1 },
151 [QCOM_RPM_DDR_DMM] = { 212, 127, 84, 2 },
152 [QCOM_RPM_VDDMIN_GPIO] = { 215, 131, 89, 1 },
153};
154
155static const struct qcom_rpm_data apq8064_template = {
156 .version = 3,
157 .resource_table = apq8064_rpm_resource_table,
158 .n_resources = ARRAY_SIZE(apq8064_rpm_resource_table),
159};
160
161static const struct qcom_rpm_resource msm8660_rpm_resource_table[] = {
162 [QCOM_RPM_CXO_CLK] = { 32, 12, 5, 1 },
163 [QCOM_RPM_PXO_CLK] = { 33, 13, 6, 1 },
164 [QCOM_RPM_PLL_4] = { 34, 14, 7, 1 },
165 [QCOM_RPM_APPS_FABRIC_CLK] = { 35, 15, 8, 1 },
166 [QCOM_RPM_SYS_FABRIC_CLK] = { 36, 16, 9, 1 },
167 [QCOM_RPM_MM_FABRIC_CLK] = { 37, 17, 10, 1 },
168 [QCOM_RPM_DAYTONA_FABRIC_CLK] = { 38, 18, 11, 1 },
169 [QCOM_RPM_SFPB_CLK] = { 39, 19, 12, 1 },
170 [QCOM_RPM_CFPB_CLK] = { 40, 20, 13, 1 },
171 [QCOM_RPM_MMFPB_CLK] = { 41, 21, 14, 1 },
172 [QCOM_RPM_SMI_CLK] = { 42, 22, 15, 1 },
173 [QCOM_RPM_EBI1_CLK] = { 43, 23, 16, 1 },
174 [QCOM_RPM_APPS_L2_CACHE_CTL] = { 44, 24, 17, 1 },
175 [QCOM_RPM_APPS_FABRIC_HALT] = { 45, 25, 18, 2 },
176 [QCOM_RPM_APPS_FABRIC_MODE] = { 47, 26, 19, 3 },
177 [QCOM_RPM_APPS_FABRIC_ARB] = { 51, 28, 21, 6 },
178 [QCOM_RPM_SYS_FABRIC_HALT] = { 63, 29, 22, 2 },
179 [QCOM_RPM_SYS_FABRIC_MODE] = { 65, 30, 23, 3 },
180 [QCOM_RPM_SYS_FABRIC_ARB] = { 69, 32, 25, 22 },
181 [QCOM_RPM_MM_FABRIC_HALT] = { 105, 33, 26, 2 },
182 [QCOM_RPM_MM_FABRIC_MODE] = { 107, 34, 27, 3 },
183 [QCOM_RPM_MM_FABRIC_ARB] = { 111, 36, 29, 23 },
184 [QCOM_RPM_PM8901_SMPS0] = { 134, 37, 30, 2 },
185 [QCOM_RPM_PM8901_SMPS1] = { 136, 39, 31, 2 },
186 [QCOM_RPM_PM8901_SMPS2] = { 138, 41, 32, 2 },
187 [QCOM_RPM_PM8901_SMPS3] = { 140, 43, 33, 2 },
188 [QCOM_RPM_PM8901_SMPS4] = { 142, 45, 34, 2 },
189 [QCOM_RPM_PM8901_LDO0] = { 144, 47, 35, 2 },
190 [QCOM_RPM_PM8901_LDO1] = { 146, 49, 36, 2 },
191 [QCOM_RPM_PM8901_LDO2] = { 148, 51, 37, 2 },
192 [QCOM_RPM_PM8901_LDO3] = { 150, 53, 38, 2 },
193 [QCOM_RPM_PM8901_LDO4] = { 152, 55, 39, 2 },
194 [QCOM_RPM_PM8901_LDO5] = { 154, 57, 40, 2 },
195 [QCOM_RPM_PM8901_LDO6] = { 156, 59, 41, 2 },
196 [QCOM_RPM_PM8901_LVS0] = { 158, 61, 42, 1 },
197 [QCOM_RPM_PM8901_LVS1] = { 159, 62, 43, 1 },
198 [QCOM_RPM_PM8901_LVS2] = { 160, 63, 44, 1 },
199 [QCOM_RPM_PM8901_LVS3] = { 161, 64, 45, 1 },
200 [QCOM_RPM_PM8901_MVS] = { 162, 65, 46, 1 },
201 [QCOM_RPM_PM8058_SMPS0] = { 163, 66, 47, 2 },
202 [QCOM_RPM_PM8058_SMPS1] = { 165, 68, 48, 2 },
203 [QCOM_RPM_PM8058_SMPS2] = { 167, 70, 49, 2 },
204 [QCOM_RPM_PM8058_SMPS3] = { 169, 72, 50, 2 },
205 [QCOM_RPM_PM8058_SMPS4] = { 171, 74, 51, 2 },
206 [QCOM_RPM_PM8058_LDO0] = { 173, 76, 52, 2 },
207 [QCOM_RPM_PM8058_LDO1] = { 175, 78, 53, 2 },
208 [QCOM_RPM_PM8058_LDO2] = { 177, 80, 54, 2 },
209 [QCOM_RPM_PM8058_LDO3] = { 179, 82, 55, 2 },
210 [QCOM_RPM_PM8058_LDO4] = { 181, 84, 56, 2 },
211 [QCOM_RPM_PM8058_LDO5] = { 183, 86, 57, 2 },
212 [QCOM_RPM_PM8058_LDO6] = { 185, 88, 58, 2 },
213 [QCOM_RPM_PM8058_LDO7] = { 187, 90, 59, 2 },
214 [QCOM_RPM_PM8058_LDO8] = { 189, 92, 60, 2 },
215 [QCOM_RPM_PM8058_LDO9] = { 191, 94, 61, 2 },
216 [QCOM_RPM_PM8058_LDO10] = { 193, 96, 62, 2 },
217 [QCOM_RPM_PM8058_LDO11] = { 195, 98, 63, 2 },
218 [QCOM_RPM_PM8058_LDO12] = { 197, 100, 64, 2 },
219 [QCOM_RPM_PM8058_LDO13] = { 199, 102, 65, 2 },
220 [QCOM_RPM_PM8058_LDO14] = { 201, 104, 66, 2 },
221 [QCOM_RPM_PM8058_LDO15] = { 203, 106, 67, 2 },
222 [QCOM_RPM_PM8058_LDO16] = { 205, 108, 68, 2 },
223 [QCOM_RPM_PM8058_LDO17] = { 207, 110, 69, 2 },
224 [QCOM_RPM_PM8058_LDO18] = { 209, 112, 70, 2 },
225 [QCOM_RPM_PM8058_LDO19] = { 211, 114, 71, 2 },
226 [QCOM_RPM_PM8058_LDO20] = { 213, 116, 72, 2 },
227 [QCOM_RPM_PM8058_LDO21] = { 215, 118, 73, 2 },
228 [QCOM_RPM_PM8058_LDO22] = { 217, 120, 74, 2 },
229 [QCOM_RPM_PM8058_LDO23] = { 219, 122, 75, 2 },
230 [QCOM_RPM_PM8058_LDO24] = { 221, 124, 76, 2 },
231 [QCOM_RPM_PM8058_LDO25] = { 223, 126, 77, 2 },
232 [QCOM_RPM_PM8058_LVS0] = { 225, 128, 78, 1 },
233 [QCOM_RPM_PM8058_LVS1] = { 226, 129, 79, 1 },
234 [QCOM_RPM_PM8058_NCP] = { 227, 130, 80, 2 },
235 [QCOM_RPM_CXO_BUFFERS] = { 229, 132, 81, 1 },
236};
237
238static const struct qcom_rpm_data msm8660_template = {
239 .version = 2,
240 .resource_table = msm8660_rpm_resource_table,
241 .n_resources = ARRAY_SIZE(msm8660_rpm_resource_table),
242};
243
244static const struct qcom_rpm_resource msm8960_rpm_resource_table[] = {
245 [QCOM_RPM_CXO_CLK] = { 25, 9, 5, 1 },
246 [QCOM_RPM_PXO_CLK] = { 26, 10, 6, 1 },
247 [QCOM_RPM_APPS_FABRIC_CLK] = { 27, 11, 8, 1 },
248 [QCOM_RPM_SYS_FABRIC_CLK] = { 28, 12, 9, 1 },
249 [QCOM_RPM_MM_FABRIC_CLK] = { 29, 13, 10, 1 },
250 [QCOM_RPM_DAYTONA_FABRIC_CLK] = { 30, 14, 11, 1 },
251 [QCOM_RPM_SFPB_CLK] = { 31, 15, 12, 1 },
252 [QCOM_RPM_CFPB_CLK] = { 32, 16, 13, 1 },
253 [QCOM_RPM_MMFPB_CLK] = { 33, 17, 14, 1 },
254 [QCOM_RPM_EBI1_CLK] = { 34, 18, 16, 1 },
255 [QCOM_RPM_APPS_FABRIC_HALT] = { 35, 19, 18, 1 },
256 [QCOM_RPM_APPS_FABRIC_MODE] = { 37, 20, 19, 1 },
257 [QCOM_RPM_APPS_FABRIC_IOCTL] = { 40, 21, 20, 1 },
258 [QCOM_RPM_APPS_FABRIC_ARB] = { 41, 22, 21, 12 },
259 [QCOM_RPM_SYS_FABRIC_HALT] = { 53, 23, 22, 1 },
260 [QCOM_RPM_SYS_FABRIC_MODE] = { 55, 24, 23, 1 },
261 [QCOM_RPM_SYS_FABRIC_IOCTL] = { 58, 25, 24, 1 },
262 [QCOM_RPM_SYS_FABRIC_ARB] = { 59, 26, 25, 29 },
263 [QCOM_RPM_MM_FABRIC_HALT] = { 88, 27, 26, 1 },
264 [QCOM_RPM_MM_FABRIC_MODE] = { 90, 28, 27, 1 },
265 [QCOM_RPM_MM_FABRIC_IOCTL] = { 93, 29, 28, 1 },
266 [QCOM_RPM_MM_FABRIC_ARB] = { 94, 30, 29, 23 },
267 [QCOM_RPM_PM8921_SMPS1] = { 117, 31, 30, 2 },
268 [QCOM_RPM_PM8921_SMPS2] = { 119, 33, 31, 2 },
269 [QCOM_RPM_PM8921_SMPS3] = { 121, 35, 32, 2 },
270 [QCOM_RPM_PM8921_SMPS4] = { 123, 37, 33, 2 },
271 [QCOM_RPM_PM8921_SMPS5] = { 125, 39, 34, 2 },
272 [QCOM_RPM_PM8921_SMPS6] = { 127, 41, 35, 2 },
273 [QCOM_RPM_PM8921_SMPS7] = { 129, 43, 36, 2 },
274 [QCOM_RPM_PM8921_SMPS8] = { 131, 45, 37, 2 },
275 [QCOM_RPM_PM8921_LDO1] = { 133, 47, 38, 2 },
276 [QCOM_RPM_PM8921_LDO2] = { 135, 49, 39, 2 },
277 [QCOM_RPM_PM8921_LDO3] = { 137, 51, 40, 2 },
278 [QCOM_RPM_PM8921_LDO4] = { 139, 53, 41, 2 },
279 [QCOM_RPM_PM8921_LDO5] = { 141, 55, 42, 2 },
280 [QCOM_RPM_PM8921_LDO6] = { 143, 57, 43, 2 },
281 [QCOM_RPM_PM8921_LDO7] = { 145, 59, 44, 2 },
282 [QCOM_RPM_PM8921_LDO8] = { 147, 61, 45, 2 },
283 [QCOM_RPM_PM8921_LDO9] = { 149, 63, 46, 2 },
284 [QCOM_RPM_PM8921_LDO10] = { 151, 65, 47, 2 },
285 [QCOM_RPM_PM8921_LDO11] = { 153, 67, 48, 2 },
286 [QCOM_RPM_PM8921_LDO12] = { 155, 69, 49, 2 },
287 [QCOM_RPM_PM8921_LDO13] = { 157, 71, 50, 2 },
288 [QCOM_RPM_PM8921_LDO14] = { 159, 73, 51, 2 },
289 [QCOM_RPM_PM8921_LDO15] = { 161, 75, 52, 2 },
290 [QCOM_RPM_PM8921_LDO16] = { 163, 77, 53, 2 },
291 [QCOM_RPM_PM8921_LDO17] = { 165, 79, 54, 2 },
292 [QCOM_RPM_PM8921_LDO18] = { 167, 81, 55, 2 },
293 [QCOM_RPM_PM8921_LDO19] = { 169, 83, 56, 2 },
294 [QCOM_RPM_PM8921_LDO20] = { 171, 85, 57, 2 },
295 [QCOM_RPM_PM8921_LDO21] = { 173, 87, 58, 2 },
296 [QCOM_RPM_PM8921_LDO22] = { 175, 89, 59, 2 },
297 [QCOM_RPM_PM8921_LDO23] = { 177, 91, 60, 2 },
298 [QCOM_RPM_PM8921_LDO24] = { 179, 93, 61, 2 },
299 [QCOM_RPM_PM8921_LDO25] = { 181, 95, 62, 2 },
300 [QCOM_RPM_PM8921_LDO26] = { 183, 97, 63, 2 },
301 [QCOM_RPM_PM8921_LDO27] = { 185, 99, 64, 2 },
302 [QCOM_RPM_PM8921_LDO28] = { 187, 101, 65, 2 },
303 [QCOM_RPM_PM8921_LDO29] = { 189, 103, 66, 2 },
304 [QCOM_RPM_PM8921_CLK1] = { 191, 105, 67, 2 },
305 [QCOM_RPM_PM8921_CLK2] = { 193, 107, 68, 2 },
306 [QCOM_RPM_PM8921_LVS1] = { 195, 109, 69, 1 },
307 [QCOM_RPM_PM8921_LVS2] = { 196, 110, 70, 1 },
308 [QCOM_RPM_PM8921_LVS3] = { 197, 111, 71, 1 },
309 [QCOM_RPM_PM8921_LVS4] = { 198, 112, 72, 1 },
310 [QCOM_RPM_PM8921_LVS5] = { 199, 113, 73, 1 },
311 [QCOM_RPM_PM8921_LVS6] = { 200, 114, 74, 1 },
312 [QCOM_RPM_PM8921_LVS7] = { 201, 115, 75, 1 },
313 [QCOM_RPM_PM8921_NCP] = { 202, 116, 80, 2 },
314 [QCOM_RPM_CXO_BUFFERS] = { 204, 118, 81, 1 },
315 [QCOM_RPM_USB_OTG_SWITCH] = { 205, 119, 82, 1 },
316 [QCOM_RPM_HDMI_SWITCH] = { 206, 120, 83, 1 },
317 [QCOM_RPM_DDR_DMM] = { 207, 121, 84, 2 },
318};
319
320static const struct qcom_rpm_data msm8960_template = {
321 .version = 3,
322 .resource_table = msm8960_rpm_resource_table,
323 .n_resources = ARRAY_SIZE(msm8960_rpm_resource_table),
324};
325
326static const struct of_device_id qcom_rpm_of_match[] = {
327 { .compatible = "qcom,rpm-apq8064", .data = &apq8064_template },
328 { .compatible = "qcom,rpm-msm8660", .data = &msm8660_template },
329 { .compatible = "qcom,rpm-msm8960", .data = &msm8960_template },
330 { }
331};
332MODULE_DEVICE_TABLE(of, qcom_rpm_of_match);
333
334int qcom_rpm_write(struct qcom_rpm *rpm,
335 int state,
336 int resource,
337 u32 *buf, size_t count)
338{
339 const struct qcom_rpm_resource *res;
340 const struct qcom_rpm_data *data = rpm->data;
341 u32 sel_mask[RPM_SELECT_SIZE] = { 0 };
342 int left;
343 int ret = 0;
344 int i;
345
346 if (WARN_ON(resource < 0 || resource >= data->n_resources))
347 return -EINVAL;
348
349 res = &data->resource_table[resource];
350 if (WARN_ON(res->size != count))
351 return -EINVAL;
352
353 mutex_lock(&rpm->lock);
354
355 for (i = 0; i < res->size; i++)
356 writel_relaxed(buf[i], RPM_REQ_REG(rpm, res->target_id + i));
357
358 bitmap_set((unsigned long *)sel_mask, res->select_id, 1);
359 for (i = 0; i < ARRAY_SIZE(sel_mask); i++) {
360 writel_relaxed(sel_mask[i],
361 RPM_CTRL_REG(rpm, RPM_REQ_SELECT + i));
362 }
363
364 writel_relaxed(BIT(state), RPM_CTRL_REG(rpm, RPM_REQUEST_CONTEXT));
365
366 reinit_completion(&rpm->ack);
367 regmap_write(rpm->ipc_regmap, rpm->ipc_offset, BIT(rpm->ipc_bit));
368
369 left = wait_for_completion_timeout(&rpm->ack, RPM_REQUEST_TIMEOUT);
370 if (!left)
371 ret = -ETIMEDOUT;
372 else if (rpm->ack_status & RPM_REJECTED)
373 ret = -EIO;
374
375 mutex_unlock(&rpm->lock);
376
377 return ret;
378}
379EXPORT_SYMBOL(qcom_rpm_write);
380
381static irqreturn_t qcom_rpm_ack_interrupt(int irq, void *dev)
382{
383 struct qcom_rpm *rpm = dev;
384 u32 ack;
385 int i;
386
387 ack = readl_relaxed(RPM_CTRL_REG(rpm, RPM_ACK_CONTEXT));
388 for (i = 0; i < RPM_SELECT_SIZE; i++)
389 writel_relaxed(0, RPM_CTRL_REG(rpm, RPM_ACK_SELECTOR + i));
390 writel(0, RPM_CTRL_REG(rpm, RPM_ACK_CONTEXT));
391
392 if (ack & RPM_NOTIFICATION) {
393 dev_warn(rpm->dev, "ignoring notification!\n");
394 } else {
395 rpm->ack_status = ack;
396 complete(&rpm->ack);
397 }
398
399 return IRQ_HANDLED;
400}
401
402static irqreturn_t qcom_rpm_err_interrupt(int irq, void *dev)
403{
404 struct qcom_rpm *rpm = dev;
405
406 regmap_write(rpm->ipc_regmap, rpm->ipc_offset, BIT(rpm->ipc_bit));
407 dev_err(rpm->dev, "RPM triggered fatal error\n");
408
409 return IRQ_HANDLED;
410}
411
412static irqreturn_t qcom_rpm_wakeup_interrupt(int irq, void *dev)
413{
414 return IRQ_HANDLED;
415}
416
417static int qcom_rpm_probe(struct platform_device *pdev)
418{
419 const struct of_device_id *match;
420 struct device_node *syscon_np;
421 struct resource *res;
422 struct qcom_rpm *rpm;
423 u32 fw_version[3];
424 int irq_wakeup;
425 int irq_ack;
426 int irq_err;
427 int ret;
428
429 rpm = devm_kzalloc(&pdev->dev, sizeof(*rpm), GFP_KERNEL);
430 if (!rpm)
431 return -ENOMEM;
432
433 rpm->dev = &pdev->dev;
434 mutex_init(&rpm->lock);
435 init_completion(&rpm->ack);
436
437 irq_ack = platform_get_irq_byname(pdev, "ack");
438 if (irq_ack < 0) {
439 dev_err(&pdev->dev, "required ack interrupt missing\n");
440 return irq_ack;
441 }
442
443 irq_err = platform_get_irq_byname(pdev, "err");
444 if (irq_err < 0) {
445 dev_err(&pdev->dev, "required err interrupt missing\n");
446 return irq_err;
447 }
448
449 irq_wakeup = platform_get_irq_byname(pdev, "wakeup");
450 if (irq_wakeup < 0) {
451 dev_err(&pdev->dev, "required wakeup interrupt missing\n");
452 return irq_wakeup;
453 }
454
455 match = of_match_device(qcom_rpm_of_match, &pdev->dev);
456 rpm->data = match->data;
457
458 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
459 rpm->status_regs = devm_ioremap_resource(&pdev->dev, res);
460 if (IS_ERR(rpm->status_regs))
461 return PTR_ERR(rpm->status_regs);
462 rpm->ctrl_regs = rpm->status_regs + 0x400;
463 rpm->req_regs = rpm->status_regs + 0x600;
464
465 syscon_np = of_parse_phandle(pdev->dev.of_node, "qcom,ipc", 0);
466 if (!syscon_np) {
467 dev_err(&pdev->dev, "no qcom,ipc node\n");
468 return -ENODEV;
469 }
470
471 rpm->ipc_regmap = syscon_node_to_regmap(syscon_np);
472 if (IS_ERR(rpm->ipc_regmap))
473 return PTR_ERR(rpm->ipc_regmap);
474
475 ret = of_property_read_u32_index(pdev->dev.of_node, "qcom,ipc", 1,
476 &rpm->ipc_offset);
477 if (ret < 0) {
478 dev_err(&pdev->dev, "no offset in qcom,ipc\n");
479 return -EINVAL;
480 }
481
482 ret = of_property_read_u32_index(pdev->dev.of_node, "qcom,ipc", 2,
483 &rpm->ipc_bit);
484 if (ret < 0) {
485 dev_err(&pdev->dev, "no bit in qcom,ipc\n");
486 return -EINVAL;
487 }
488
489 dev_set_drvdata(&pdev->dev, rpm);
490
491 fw_version[0] = readl(RPM_STATUS_REG(rpm, 0));
492 fw_version[1] = readl(RPM_STATUS_REG(rpm, 1));
493 fw_version[2] = readl(RPM_STATUS_REG(rpm, 2));
494 if (fw_version[0] != rpm->data->version) {
495 dev_err(&pdev->dev,
496 "RPM version %u.%u.%u incompatible with driver version %u",
497 fw_version[0],
498 fw_version[1],
499 fw_version[2],
500 rpm->data->version);
501 return -EFAULT;
502 }
503
504 dev_info(&pdev->dev, "RPM firmware %u.%u.%u\n", fw_version[0],
505 fw_version[1],
506 fw_version[2]);
507
508 ret = devm_request_irq(&pdev->dev,
509 irq_ack,
510 qcom_rpm_ack_interrupt,
511 IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND,
512 "qcom_rpm_ack",
513 rpm);
514 if (ret) {
515 dev_err(&pdev->dev, "failed to request ack interrupt\n");
516 return ret;
517 }
518
519 ret = irq_set_irq_wake(irq_ack, 1);
520 if (ret)
521 dev_warn(&pdev->dev, "failed to mark ack irq as wakeup\n");
522
523 ret = devm_request_irq(&pdev->dev,
524 irq_err,
525 qcom_rpm_err_interrupt,
526 IRQF_TRIGGER_RISING,
527 "qcom_rpm_err",
528 rpm);
529 if (ret) {
530 dev_err(&pdev->dev, "failed to request err interrupt\n");
531 return ret;
532 }
533
534 ret = devm_request_irq(&pdev->dev,
535 irq_wakeup,
536 qcom_rpm_wakeup_interrupt,
537 IRQF_TRIGGER_RISING,
538 "qcom_rpm_wakeup",
539 rpm);
540 if (ret) {
541 dev_err(&pdev->dev, "failed to request wakeup interrupt\n");
542 return ret;
543 }
544
545 ret = irq_set_irq_wake(irq_wakeup, 1);
546 if (ret)
547 dev_warn(&pdev->dev, "failed to mark wakeup irq as wakeup\n");
548
549 return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
550}
551
552static int qcom_rpm_remove(struct platform_device *pdev)
553{
554 of_platform_depopulate(&pdev->dev);
555 return 0;
556}
557
558static struct platform_driver qcom_rpm_driver = {
559 .probe = qcom_rpm_probe,
560 .remove = qcom_rpm_remove,
561 .driver = {
562 .name = "qcom_rpm",
563 .of_match_table = qcom_rpm_of_match,
564 },
565};
566
567static int __init qcom_rpm_init(void)
568{
569 return platform_driver_register(&qcom_rpm_driver);
570}
571arch_initcall(qcom_rpm_init);
572
573static void __exit qcom_rpm_exit(void)
574{
575 platform_driver_unregister(&qcom_rpm_driver);
576}
577module_exit(qcom_rpm_exit)
578
579MODULE_DESCRIPTION("Qualcomm Resource Power Manager driver");
580MODULE_LICENSE("GPL v2");
581MODULE_AUTHOR("Bjorn Andersson <bjorn.andersson@sonymobile.com>");
diff --git a/drivers/mfd/retu-mfd.c b/drivers/mfd/retu-mfd.c
index 663f8a37aa6b..2d64430c719b 100644
--- a/drivers/mfd/retu-mfd.c
+++ b/drivers/mfd/retu-mfd.c
@@ -222,7 +222,7 @@ static struct regmap_bus retu_bus = {
222 .val_format_endian_default = REGMAP_ENDIAN_NATIVE, 222 .val_format_endian_default = REGMAP_ENDIAN_NATIVE,
223}; 223};
224 224
225static struct regmap_config retu_config = { 225static const struct regmap_config retu_config = {
226 .reg_bits = 8, 226 .reg_bits = 8,
227 .val_bits = 16, 227 .val_bits = 16,
228}; 228};
diff --git a/drivers/mfd/rt5033.c b/drivers/mfd/rt5033.c
new file mode 100644
index 000000000000..db395a6c52bc
--- /dev/null
+++ b/drivers/mfd/rt5033.c
@@ -0,0 +1,142 @@
1/*
2 * MFD core driver for the Richtek RT5033.
3 *
4 * RT5033 comprises multiple sub-devices switcing charger, fuel gauge,
5 * flash LED, current source, LDO and BUCK regulators.
6 *
7 * Copyright (C) 2014 Samsung Electronics, Co., Ltd.
8 * Author: Beomho Seo <beomho.seo@samsung.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 version 2 as
12 * published bythe Free Software Foundation.
13 */
14
15#include <linux/err.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/of_device.h>
19#include <linux/mfd/core.h>
20#include <linux/mfd/rt5033.h>
21#include <linux/mfd/rt5033-private.h>
22
23static const struct regmap_irq rt5033_irqs[] = {
24 { .mask = RT5033_PMIC_IRQ_BUCKOCP, },
25 { .mask = RT5033_PMIC_IRQ_BUCKLV, },
26 { .mask = RT5033_PMIC_IRQ_SAFELDOLV, },
27 { .mask = RT5033_PMIC_IRQ_LDOLV, },
28 { .mask = RT5033_PMIC_IRQ_OT, },
29 { .mask = RT5033_PMIC_IRQ_VDDA_UV, },
30};
31
32static const struct regmap_irq_chip rt5033_irq_chip = {
33 .name = "rt5033",
34 .status_base = RT5033_REG_PMIC_IRQ_STAT,
35 .mask_base = RT5033_REG_PMIC_IRQ_CTRL,
36 .mask_invert = true,
37 .num_regs = 1,
38 .irqs = rt5033_irqs,
39 .num_irqs = ARRAY_SIZE(rt5033_irqs),
40};
41
42static const struct mfd_cell rt5033_devs[] = {
43 { .name = "rt5033-regulator", },
44 {
45 .name = "rt5033-charger",
46 .of_compatible = "richtek,rt5033-charger",
47 }, {
48 .name = "rt5033-battery",
49 .of_compatible = "richtek,rt5033-battery",
50 },
51};
52
53static const struct regmap_config rt5033_regmap_config = {
54 .reg_bits = 8,
55 .val_bits = 8,
56 .max_register = RT5033_REG_END,
57};
58
59static int rt5033_i2c_probe(struct i2c_client *i2c,
60 const struct i2c_device_id *id)
61{
62 struct rt5033_dev *rt5033;
63 unsigned int dev_id;
64 int ret;
65
66 rt5033 = devm_kzalloc(&i2c->dev, sizeof(*rt5033), GFP_KERNEL);
67 if (!rt5033)
68 return -ENOMEM;
69
70 i2c_set_clientdata(i2c, rt5033);
71 rt5033->dev = &i2c->dev;
72 rt5033->irq = i2c->irq;
73 rt5033->wakeup = true;
74
75 rt5033->regmap = devm_regmap_init_i2c(i2c, &rt5033_regmap_config);
76 if (IS_ERR(rt5033->regmap)) {
77 dev_err(&i2c->dev, "Failed to allocate register map.\n");
78 return PTR_ERR(rt5033->regmap);
79 }
80
81 ret = regmap_read(rt5033->regmap, RT5033_REG_DEVICE_ID, &dev_id);
82 if (ret) {
83 dev_err(&i2c->dev, "Device not found\n");
84 return -ENODEV;
85 }
86 dev_info(&i2c->dev, "Device found Device ID: %04x\n", dev_id);
87
88 ret = regmap_add_irq_chip(rt5033->regmap, rt5033->irq,
89 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
90 0, &rt5033_irq_chip, &rt5033->irq_data);
91 if (ret) {
92 dev_err(&i2c->dev, "Failed to request IRQ %d: %d\n",
93 rt5033->irq, ret);
94 return ret;
95 }
96
97 ret = mfd_add_devices(rt5033->dev, -1, rt5033_devs,
98 ARRAY_SIZE(rt5033_devs), NULL, 0,
99 regmap_irq_get_domain(rt5033->irq_data));
100 if (ret < 0) {
101 dev_err(&i2c->dev, "Failed to add RT5033 child devices.\n");
102 return ret;
103 }
104
105 device_init_wakeup(rt5033->dev, rt5033->wakeup);
106
107 return 0;
108}
109
110static int rt5033_i2c_remove(struct i2c_client *i2c)
111{
112 mfd_remove_devices(&i2c->dev);
113
114 return 0;
115}
116
117static const struct i2c_device_id rt5033_i2c_id[] = {
118 { "rt5033", },
119 { }
120};
121MODULE_DEVICE_TABLE(i2c, rt5033_i2c_id);
122
123static const struct of_device_id rt5033_dt_match[] = {
124 { .compatible = "richtek,rt5033", },
125 { }
126};
127
128static struct i2c_driver rt5033_driver = {
129 .driver = {
130 .name = "rt5033",
131 .of_match_table = of_match_ptr(rt5033_dt_match),
132 },
133 .probe = rt5033_i2c_probe,
134 .remove = rt5033_i2c_remove,
135 .id_table = rt5033_i2c_id,
136};
137module_i2c_driver(rt5033_driver);
138
139MODULE_ALIAS("i2c:rt5033");
140MODULE_DESCRIPTION("Richtek RT5033 multi-function core driver");
141MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
142MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
index 210d1f85679e..ede50244f265 100644
--- a/drivers/mfd/rtsx_usb.c
+++ b/drivers/mfd/rtsx_usb.c
@@ -681,9 +681,27 @@ static void rtsx_usb_disconnect(struct usb_interface *intf)
681#ifdef CONFIG_PM 681#ifdef CONFIG_PM
682static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message) 682static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message)
683{ 683{
684 struct rtsx_ucr *ucr =
685 (struct rtsx_ucr *)usb_get_intfdata(intf);
686 u16 val = 0;
687
684 dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n", 688 dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n",
685 __func__, message.event); 689 __func__, message.event);
686 690
691 if (PMSG_IS_AUTO(message)) {
692 if (mutex_trylock(&ucr->dev_mutex)) {
693 rtsx_usb_get_card_status(ucr, &val);
694 mutex_unlock(&ucr->dev_mutex);
695
696 /* Defer the autosuspend if card exists */
697 if (val & (SD_CD | MS_CD))
698 return -EAGAIN;
699 } else {
700 /* There is an ongoing operation*/
701 return -EAGAIN;
702 }
703 }
704
687 return 0; 705 return 0;
688} 706}
689 707
diff --git a/drivers/mfd/smsc-ece1099.c b/drivers/mfd/smsc-ece1099.c
index 90112d4cc905..03246880d484 100644
--- a/drivers/mfd/smsc-ece1099.c
+++ b/drivers/mfd/smsc-ece1099.c
@@ -24,7 +24,7 @@
24#include <linux/mfd/smsc.h> 24#include <linux/mfd/smsc.h>
25#include <linux/of_platform.h> 25#include <linux/of_platform.h>
26 26
27static struct regmap_config smsc_regmap_config = { 27static const struct regmap_config smsc_regmap_config = {
28 .reg_bits = 8, 28 .reg_bits = 8,
29 .val_bits = 8, 29 .val_bits = 8,
30 .max_register = SMSC_VEN_ID_H, 30 .max_register = SMSC_VEN_ID_H,
diff --git a/drivers/mfd/sun6i-prcm.c b/drivers/mfd/sun6i-prcm.c
index 2f2e9f062571..191173166d65 100644
--- a/drivers/mfd/sun6i-prcm.c
+++ b/drivers/mfd/sun6i-prcm.c
@@ -41,6 +41,14 @@ static const struct resource sun6i_a31_apb0_gates_clk_res[] = {
41 }, 41 },
42}; 42};
43 43
44static const struct resource sun6i_a31_ir_clk_res[] = {
45 {
46 .start = 0x54,
47 .end = 0x57,
48 .flags = IORESOURCE_MEM,
49 },
50};
51
44static const struct resource sun6i_a31_apb0_rstc_res[] = { 52static const struct resource sun6i_a31_apb0_rstc_res[] = {
45 { 53 {
46 .start = 0xb0, 54 .start = 0xb0,
@@ -69,6 +77,12 @@ static const struct mfd_cell sun6i_a31_prcm_subdevs[] = {
69 .resources = sun6i_a31_apb0_gates_clk_res, 77 .resources = sun6i_a31_apb0_gates_clk_res,
70 }, 78 },
71 { 79 {
80 .name = "sun6i-a31-ir-clk",
81 .of_compatible = "allwinner,sun4i-a10-mod0-clk",
82 .num_resources = ARRAY_SIZE(sun6i_a31_ir_clk_res),
83 .resources = sun6i_a31_ir_clk_res,
84 },
85 {
72 .name = "sun6i-a31-apb0-clock-reset", 86 .name = "sun6i-a31-apb0-clock-reset",
73 .of_compatible = "allwinner,sun6i-a31-clock-reset", 87 .of_compatible = "allwinner,sun6i-a31-clock-reset",
74 .num_resources = ARRAY_SIZE(sun6i_a31_apb0_rstc_res), 88 .num_resources = ARRAY_SIZE(sun6i_a31_apb0_rstc_res),
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
index 80a919a8ca97..7d1cfc1d3ce0 100644
--- a/drivers/mfd/tps65217.c
+++ b/drivers/mfd/tps65217.c
@@ -145,7 +145,7 @@ int tps65217_clear_bits(struct tps65217 *tps, unsigned int reg,
145} 145}
146EXPORT_SYMBOL_GPL(tps65217_clear_bits); 146EXPORT_SYMBOL_GPL(tps65217_clear_bits);
147 147
148static struct regmap_config tps65217_regmap_config = { 148static const struct regmap_config tps65217_regmap_config = {
149 .reg_bits = 8, 149 .reg_bits = 8,
150 .val_bits = 8, 150 .val_bits = 8,
151 151
diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
index d6b764349f9d..7af11a8b9753 100644
--- a/drivers/mfd/tps65218.c
+++ b/drivers/mfd/tps65218.c
@@ -135,7 +135,7 @@ static const struct regmap_access_table tps65218_volatile_table = {
135 .n_yes_ranges = ARRAY_SIZE(tps65218_yes_ranges), 135 .n_yes_ranges = ARRAY_SIZE(tps65218_yes_ranges),
136}; 136};
137 137
138static struct regmap_config tps65218_regmap_config = { 138static const struct regmap_config tps65218_regmap_config = {
139 .reg_bits = 8, 139 .reg_bits = 8,
140 .val_bits = 8, 140 .val_bits = 8,
141 .cache_type = REGCACHE_RBTREE, 141 .cache_type = REGCACHE_RBTREE,
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index db11b4f40611..489674a2497e 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -207,7 +207,7 @@ static struct twl_mapping twl4030_map[] = {
207 { 2, TWL5031_BASEADD_INTERRUPTS }, 207 { 2, TWL5031_BASEADD_INTERRUPTS },
208}; 208};
209 209
210static struct reg_default twl4030_49_defaults[] = { 210static const struct reg_default twl4030_49_defaults[] = {
211 /* Audio Registers */ 211 /* Audio Registers */
212 { 0x01, 0x00}, /* CODEC_MODE */ 212 { 0x01, 0x00}, /* CODEC_MODE */
213 { 0x02, 0x00}, /* OPTION */ 213 { 0x02, 0x00}, /* OPTION */
@@ -306,7 +306,7 @@ static const struct regmap_access_table twl4030_49_volatile_table = {
306 .n_yes_ranges = ARRAY_SIZE(twl4030_49_volatile_ranges), 306 .n_yes_ranges = ARRAY_SIZE(twl4030_49_volatile_ranges),
307}; 307};
308 308
309static struct regmap_config twl4030_regmap_config[4] = { 309static const struct regmap_config twl4030_regmap_config[4] = {
310 { 310 {
311 /* Address 0x48 */ 311 /* Address 0x48 */
312 .reg_bits = 8, 312 .reg_bits = 8,
@@ -369,7 +369,7 @@ static struct twl_mapping twl6030_map[] = {
369 { 1, TWL6030_BASEADD_GASGAUGE }, 369 { 1, TWL6030_BASEADD_GASGAUGE },
370}; 370};
371 371
372static struct regmap_config twl6030_regmap_config[3] = { 372static const struct regmap_config twl6030_regmap_config[3] = {
373 { 373 {
374 /* Address 0x48 */ 374 /* Address 0x48 */
375 .reg_bits = 8, 375 .reg_bits = 8,
@@ -1087,7 +1087,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1087 struct twl4030_platform_data *pdata = dev_get_platdata(&client->dev); 1087 struct twl4030_platform_data *pdata = dev_get_platdata(&client->dev);
1088 struct device_node *node = client->dev.of_node; 1088 struct device_node *node = client->dev.of_node;
1089 struct platform_device *pdev; 1089 struct platform_device *pdev;
1090 struct regmap_config *twl_regmap_config; 1090 const struct regmap_config *twl_regmap_config;
1091 int irq_base = 0; 1091 int irq_base = 0;
1092 int status; 1092 int status;
1093 unsigned i, num_slaves; 1093 unsigned i, num_slaves;
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 9687645162ae..f71ee3dbc2a2 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -44,7 +44,7 @@
44#define VIBRACTRL_MEMBER(reg) ((reg == TWL6040_REG_VIBCTLL) ? 0 : 1) 44#define VIBRACTRL_MEMBER(reg) ((reg == TWL6040_REG_VIBCTLL) ? 0 : 1)
45#define TWL6040_NUM_SUPPLIES (2) 45#define TWL6040_NUM_SUPPLIES (2)
46 46
47static struct reg_default twl6040_defaults[] = { 47static const struct reg_default twl6040_defaults[] = {
48 { 0x01, 0x4B }, /* REG_ASICID (ro) */ 48 { 0x01, 0x4B }, /* REG_ASICID (ro) */
49 { 0x02, 0x00 }, /* REG_ASICREV (ro) */ 49 { 0x02, 0x00 }, /* REG_ASICREV (ro) */
50 { 0x03, 0x00 }, /* REG_INTID */ 50 { 0x03, 0x00 }, /* REG_INTID */
@@ -580,7 +580,7 @@ static bool twl6040_writeable_reg(struct device *dev, unsigned int reg)
580 } 580 }
581} 581}
582 582
583static struct regmap_config twl6040_regmap_config = { 583static const struct regmap_config twl6040_regmap_config = {
584 .reg_bits = 8, 584 .reg_bits = 8,
585 .val_bits = 8, 585 .val_bits = 8,
586 586
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 6ca9d25cc3f0..53ae5af5d6e4 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -36,12 +36,12 @@
36static const struct mfd_cell wm8994_regulator_devs[] = { 36static const struct mfd_cell wm8994_regulator_devs[] = {
37 { 37 {
38 .name = "wm8994-ldo", 38 .name = "wm8994-ldo",
39 .id = 1, 39 .id = 0,
40 .pm_runtime_no_callbacks = true, 40 .pm_runtime_no_callbacks = true,
41 }, 41 },
42 { 42 {
43 .name = "wm8994-ldo", 43 .name = "wm8994-ldo",
44 .id = 2, 44 .id = 1,
45 .pm_runtime_no_callbacks = true, 45 .pm_runtime_no_callbacks = true,
46 }, 46 },
47}; 47};
@@ -344,7 +344,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
344 dev_set_drvdata(wm8994->dev, wm8994); 344 dev_set_drvdata(wm8994->dev, wm8994);
345 345
346 /* Add the on-chip regulators first for bootstrapping */ 346 /* Add the on-chip regulators first for bootstrapping */
347 ret = mfd_add_devices(wm8994->dev, -1, 347 ret = mfd_add_devices(wm8994->dev, 0,
348 wm8994_regulator_devs, 348 wm8994_regulator_devs,
349 ARRAY_SIZE(wm8994_regulator_devs), 349 ARRAY_SIZE(wm8994_regulator_devs),
350 NULL, 0, NULL); 350 NULL, 0, NULL);