diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 14:10:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 14:10:27 -0400 |
commit | 3aa78e0cb5c9b8b4ed2a617bb1e1542bfb508379 (patch) | |
tree | a446e1f8a81f63933423ef11ea7d31cc918b30f6 /drivers | |
parent | dc5ef1f56968c67e81ad1c81ab7dce678f480285 (diff) | |
parent | 25f311fa58c18c19ae1348336265ccb8368638f0 (diff) |
Merge tag 'mfd-3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next
Pull MFD update from Samuel Ortiz:
"For the 3.11 merge we only have one new MFD driver for the Kontron
PLD.
But we also have:
- Support for the TPS659038 PMIC from the palmas driver.
- Intel's Coleto Creek and Avoton SoCs support from the lpc_ich
driver.
- RTL8411B support from the rtsx driver.
- More DT support for the Arizona, max8998, twl4030-power and the
ti_am335x_tsadc drivers.
- The SSBI driver move under MFD.
- A conversion to the devm_* API for most of the MFD drivers.
- The twl4030-power got split from twl-core into its own module.
- A major ti_am335x_adc cleanup, leading to a proper DT support.
- Our regular arizona and wm* updates and cleanups from the Wolfson
folks.
- A better error handling and initialization, and a regulator
subdevice addition for the 88pm80x driver.
- A bulk platform_set_drvdata() call removal that's no longer need
since commit 0998d0631001 ("device-core: Ensure drvdata = NULL when
no driver is bound")
* tag 'mfd-3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next: (102 commits)
mfd: sec: Provide max_register to regmap
mfd: wm8994: Remove duplicate check for active JACKDET
MAINTAINERS: Add include directory to MFD file patterns
mfd: sec: Remove fields not used since regmap conversion
watchdog: Kontron PLD watchdog timer driver
mfd: max8998: Add support for Device Tree
regulator: max8998: Use arrays for specifying voltages in platform data
mfd: max8998: Add irq domain support
regulator: palmas: Add TPS659038 support
mfd: Kontron PLD mfd driver
mfd: palmas: Add TPS659038 PMIC support
mfd: palmas: Add SMPS10_BOOST feature
mfd: palmas: Check if irq is valid
mfd: lpc_ich: iTCO_wdt patch for Intel Coleto Creek DeviceIDs
mfd: twl-core: Change TWL6025 references to TWL6032
mfd: davinci_voicecodec: Fix build breakage
mfd: vexpress: Make the driver optional for arm and arm64
mfd: htc-egpio: Use devm_ioremap_nocache() instead of ioremap_nocache()
mfd: davinci_voicecodec: Convert to use devm_* APIs
mfd: twl4030-power: Fix relocking on error
...
Diffstat (limited to 'drivers')
71 files changed, 4383 insertions, 892 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index ae050b54c368..aa43b911ccef 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -52,8 +52,6 @@ source "drivers/i2c/Kconfig" | |||
52 | 52 | ||
53 | source "drivers/spi/Kconfig" | 53 | source "drivers/spi/Kconfig" |
54 | 54 | ||
55 | source "drivers/ssbi/Kconfig" | ||
56 | |||
57 | source "drivers/hsi/Kconfig" | 55 | source "drivers/hsi/Kconfig" |
58 | 56 | ||
59 | source "drivers/pps/Kconfig" | 57 | source "drivers/pps/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index 336b0ad0acd0..ab93de8297f1 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -117,7 +117,6 @@ obj-y += firmware/ | |||
117 | obj-$(CONFIG_CRYPTO) += crypto/ | 117 | obj-$(CONFIG_CRYPTO) += crypto/ |
118 | obj-$(CONFIG_SUPERH) += sh/ | 118 | obj-$(CONFIG_SUPERH) += sh/ |
119 | obj-$(CONFIG_ARCH_SHMOBILE) += sh/ | 119 | obj-$(CONFIG_ARCH_SHMOBILE) += sh/ |
120 | obj-$(CONFIG_SSBI) += ssbi/ | ||
121 | ifndef CONFIG_ARCH_USES_GETTIMEOFFSET | 120 | ifndef CONFIG_ARCH_USES_GETTIMEOFFSET |
122 | obj-y += clocksource/ | 121 | obj-y += clocksource/ |
123 | endif | 122 | endif |
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 5f9a7e7d3135..4427e8e46a7f 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -22,13 +22,18 @@ | |||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/iio/iio.h> | 24 | #include <linux/iio/iio.h> |
25 | #include <linux/of.h> | ||
26 | #include <linux/of_device.h> | ||
27 | #include <linux/iio/machine.h> | ||
28 | #include <linux/iio/driver.h> | ||
25 | 29 | ||
26 | #include <linux/mfd/ti_am335x_tscadc.h> | 30 | #include <linux/mfd/ti_am335x_tscadc.h> |
27 | #include <linux/platform_data/ti_am335x_adc.h> | ||
28 | 31 | ||
29 | struct tiadc_device { | 32 | struct tiadc_device { |
30 | struct ti_tscadc_dev *mfd_tscadc; | 33 | struct ti_tscadc_dev *mfd_tscadc; |
31 | int channels; | 34 | int channels; |
35 | u8 channel_line[8]; | ||
36 | u8 channel_step[8]; | ||
32 | }; | 37 | }; |
33 | 38 | ||
34 | static unsigned int tiadc_readl(struct tiadc_device *adc, unsigned int reg) | 39 | static unsigned int tiadc_readl(struct tiadc_device *adc, unsigned int reg) |
@@ -42,10 +47,20 @@ static void tiadc_writel(struct tiadc_device *adc, unsigned int reg, | |||
42 | writel(val, adc->mfd_tscadc->tscadc_base + reg); | 47 | writel(val, adc->mfd_tscadc->tscadc_base + reg); |
43 | } | 48 | } |
44 | 49 | ||
50 | static u32 get_adc_step_mask(struct tiadc_device *adc_dev) | ||
51 | { | ||
52 | u32 step_en; | ||
53 | |||
54 | step_en = ((1 << adc_dev->channels) - 1); | ||
55 | step_en <<= TOTAL_STEPS - adc_dev->channels + 1; | ||
56 | return step_en; | ||
57 | } | ||
58 | |||
45 | static void tiadc_step_config(struct tiadc_device *adc_dev) | 59 | static void tiadc_step_config(struct tiadc_device *adc_dev) |
46 | { | 60 | { |
47 | unsigned int stepconfig; | 61 | unsigned int stepconfig; |
48 | int i, channels = 0, steps; | 62 | int i, steps; |
63 | u32 step_en; | ||
49 | 64 | ||
50 | /* | 65 | /* |
51 | * There are 16 configurable steps and 8 analog input | 66 | * There are 16 configurable steps and 8 analog input |
@@ -58,43 +73,63 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) | |||
58 | */ | 73 | */ |
59 | 74 | ||
60 | steps = TOTAL_STEPS - adc_dev->channels; | 75 | steps = TOTAL_STEPS - adc_dev->channels; |
61 | channels = TOTAL_CHANNELS - adc_dev->channels; | ||
62 | |||
63 | stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1; | 76 | stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1; |
64 | 77 | ||
65 | for (i = (steps + 1); i <= TOTAL_STEPS; i++) { | 78 | for (i = 0; i < adc_dev->channels; i++) { |
66 | tiadc_writel(adc_dev, REG_STEPCONFIG(i), | 79 | int chan; |
67 | stepconfig | STEPCONFIG_INP(channels)); | 80 | |
68 | tiadc_writel(adc_dev, REG_STEPDELAY(i), | 81 | chan = adc_dev->channel_line[i]; |
82 | tiadc_writel(adc_dev, REG_STEPCONFIG(steps), | ||
83 | stepconfig | STEPCONFIG_INP(chan)); | ||
84 | tiadc_writel(adc_dev, REG_STEPDELAY(steps), | ||
69 | STEPCONFIG_OPENDLY); | 85 | STEPCONFIG_OPENDLY); |
70 | channels++; | 86 | adc_dev->channel_step[i] = steps; |
87 | steps++; | ||
71 | } | 88 | } |
72 | tiadc_writel(adc_dev, REG_SE, STPENB_STEPENB); | 89 | step_en = get_adc_step_mask(adc_dev); |
90 | am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); | ||
73 | } | 91 | } |
74 | 92 | ||
93 | static const char * const chan_name_ain[] = { | ||
94 | "AIN0", | ||
95 | "AIN1", | ||
96 | "AIN2", | ||
97 | "AIN3", | ||
98 | "AIN4", | ||
99 | "AIN5", | ||
100 | "AIN6", | ||
101 | "AIN7", | ||
102 | }; | ||
103 | |||
75 | static int tiadc_channel_init(struct iio_dev *indio_dev, int channels) | 104 | static int tiadc_channel_init(struct iio_dev *indio_dev, int channels) |
76 | { | 105 | { |
106 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | ||
77 | struct iio_chan_spec *chan_array; | 107 | struct iio_chan_spec *chan_array; |
108 | struct iio_chan_spec *chan; | ||
78 | int i; | 109 | int i; |
79 | 110 | ||
80 | indio_dev->num_channels = channels; | 111 | indio_dev->num_channels = channels; |
81 | chan_array = kcalloc(indio_dev->num_channels, | 112 | chan_array = kcalloc(channels, |
82 | sizeof(struct iio_chan_spec), GFP_KERNEL); | 113 | sizeof(struct iio_chan_spec), GFP_KERNEL); |
83 | |||
84 | if (chan_array == NULL) | 114 | if (chan_array == NULL) |
85 | return -ENOMEM; | 115 | return -ENOMEM; |
86 | 116 | ||
87 | for (i = 0; i < (indio_dev->num_channels); i++) { | 117 | chan = chan_array; |
88 | struct iio_chan_spec *chan = chan_array + i; | 118 | for (i = 0; i < channels; i++, chan++) { |
119 | |||
89 | chan->type = IIO_VOLTAGE; | 120 | chan->type = IIO_VOLTAGE; |
90 | chan->indexed = 1; | 121 | chan->indexed = 1; |
91 | chan->channel = i; | 122 | chan->channel = adc_dev->channel_line[i]; |
92 | chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW); | 123 | chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW); |
124 | chan->datasheet_name = chan_name_ain[chan->channel]; | ||
125 | chan->scan_type.sign = 'u'; | ||
126 | chan->scan_type.realbits = 12; | ||
127 | chan->scan_type.storagebits = 32; | ||
93 | } | 128 | } |
94 | 129 | ||
95 | indio_dev->channels = chan_array; | 130 | indio_dev->channels = chan_array; |
96 | 131 | ||
97 | return indio_dev->num_channels; | 132 | return 0; |
98 | } | 133 | } |
99 | 134 | ||
100 | static void tiadc_channels_remove(struct iio_dev *indio_dev) | 135 | static void tiadc_channels_remove(struct iio_dev *indio_dev) |
@@ -108,7 +143,9 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
108 | { | 143 | { |
109 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | 144 | struct tiadc_device *adc_dev = iio_priv(indio_dev); |
110 | int i; | 145 | int i; |
111 | unsigned int fifo1count, readx1; | 146 | unsigned int fifo1count, read; |
147 | u32 step = UINT_MAX; | ||
148 | bool found = false; | ||
112 | 149 | ||
113 | /* | 150 | /* |
114 | * When the sub-system is first enabled, | 151 | * When the sub-system is first enabled, |
@@ -121,14 +158,26 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
121 | * Hence we need to flush out this data. | 158 | * Hence we need to flush out this data. |
122 | */ | 159 | */ |
123 | 160 | ||
161 | for (i = 0; i < ARRAY_SIZE(adc_dev->channel_step); i++) { | ||
162 | if (chan->channel == adc_dev->channel_line[i]) { | ||
163 | step = adc_dev->channel_step[i]; | ||
164 | break; | ||
165 | } | ||
166 | } | ||
167 | if (WARN_ON_ONCE(step == UINT_MAX)) | ||
168 | return -EINVAL; | ||
169 | |||
124 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); | 170 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); |
125 | for (i = 0; i < fifo1count; i++) { | 171 | for (i = 0; i < fifo1count; i++) { |
126 | readx1 = tiadc_readl(adc_dev, REG_FIFO1); | 172 | read = tiadc_readl(adc_dev, REG_FIFO1); |
127 | if (i == chan->channel) | 173 | if (read >> 16 == step) { |
128 | *val = readx1 & 0xfff; | 174 | *val = read & 0xfff; |
175 | found = true; | ||
176 | } | ||
129 | } | 177 | } |
130 | tiadc_writel(adc_dev, REG_SE, STPENB_STEPENB); | 178 | am335x_tsc_se_update(adc_dev->mfd_tscadc); |
131 | 179 | if (found == false) | |
180 | return -EBUSY; | ||
132 | return IIO_VAL_INT; | 181 | return IIO_VAL_INT; |
133 | } | 182 | } |
134 | 183 | ||
@@ -140,13 +189,15 @@ static int tiadc_probe(struct platform_device *pdev) | |||
140 | { | 189 | { |
141 | struct iio_dev *indio_dev; | 190 | struct iio_dev *indio_dev; |
142 | struct tiadc_device *adc_dev; | 191 | struct tiadc_device *adc_dev; |
143 | struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data; | 192 | struct device_node *node = pdev->dev.of_node; |
144 | struct mfd_tscadc_board *pdata; | 193 | struct property *prop; |
194 | const __be32 *cur; | ||
145 | int err; | 195 | int err; |
196 | u32 val; | ||
197 | int channels = 0; | ||
146 | 198 | ||
147 | pdata = tscadc_dev->dev->platform_data; | 199 | if (!node) { |
148 | if (!pdata || !pdata->adc_init) { | 200 | dev_err(&pdev->dev, "Could not find valid DT data.\n"); |
149 | dev_err(&pdev->dev, "Could not find platform data\n"); | ||
150 | return -EINVAL; | 201 | return -EINVAL; |
151 | } | 202 | } |
152 | 203 | ||
@@ -158,8 +209,13 @@ static int tiadc_probe(struct platform_device *pdev) | |||
158 | } | 209 | } |
159 | adc_dev = iio_priv(indio_dev); | 210 | adc_dev = iio_priv(indio_dev); |
160 | 211 | ||
161 | adc_dev->mfd_tscadc = tscadc_dev; | 212 | adc_dev->mfd_tscadc = ti_tscadc_dev_get(pdev); |
162 | adc_dev->channels = pdata->adc_init->adc_channels; | 213 | |
214 | of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) { | ||
215 | adc_dev->channel_line[channels] = val; | ||
216 | channels++; | ||
217 | } | ||
218 | adc_dev->channels = channels; | ||
163 | 219 | ||
164 | indio_dev->dev.parent = &pdev->dev; | 220 | indio_dev->dev.parent = &pdev->dev; |
165 | indio_dev->name = dev_name(&pdev->dev); | 221 | indio_dev->name = dev_name(&pdev->dev); |
@@ -191,10 +247,15 @@ err_ret: | |||
191 | static int tiadc_remove(struct platform_device *pdev) | 247 | static int tiadc_remove(struct platform_device *pdev) |
192 | { | 248 | { |
193 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | 249 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); |
250 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | ||
251 | u32 step_en; | ||
194 | 252 | ||
195 | iio_device_unregister(indio_dev); | 253 | iio_device_unregister(indio_dev); |
196 | tiadc_channels_remove(indio_dev); | 254 | tiadc_channels_remove(indio_dev); |
197 | 255 | ||
256 | step_en = get_adc_step_mask(adc_dev); | ||
257 | am335x_tsc_se_clr(adc_dev->mfd_tscadc, step_en); | ||
258 | |||
198 | iio_device_free(indio_dev); | 259 | iio_device_free(indio_dev); |
199 | 260 | ||
200 | return 0; | 261 | return 0; |
@@ -205,9 +266,10 @@ static int tiadc_suspend(struct device *dev) | |||
205 | { | 266 | { |
206 | struct iio_dev *indio_dev = dev_get_drvdata(dev); | 267 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
207 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | 268 | struct tiadc_device *adc_dev = iio_priv(indio_dev); |
208 | struct ti_tscadc_dev *tscadc_dev = dev->platform_data; | 269 | struct ti_tscadc_dev *tscadc_dev; |
209 | unsigned int idle; | 270 | unsigned int idle; |
210 | 271 | ||
272 | tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev)); | ||
211 | if (!device_may_wakeup(tscadc_dev->dev)) { | 273 | if (!device_may_wakeup(tscadc_dev->dev)) { |
212 | idle = tiadc_readl(adc_dev, REG_CTRL); | 274 | idle = tiadc_readl(adc_dev, REG_CTRL); |
213 | idle &= ~(CNTRLREG_TSCSSENB); | 275 | idle &= ~(CNTRLREG_TSCSSENB); |
@@ -243,16 +305,22 @@ static const struct dev_pm_ops tiadc_pm_ops = { | |||
243 | #define TIADC_PM_OPS NULL | 305 | #define TIADC_PM_OPS NULL |
244 | #endif | 306 | #endif |
245 | 307 | ||
308 | static const struct of_device_id ti_adc_dt_ids[] = { | ||
309 | { .compatible = "ti,am3359-adc", }, | ||
310 | { } | ||
311 | }; | ||
312 | MODULE_DEVICE_TABLE(of, ti_adc_dt_ids); | ||
313 | |||
246 | static struct platform_driver tiadc_driver = { | 314 | static struct platform_driver tiadc_driver = { |
247 | .driver = { | 315 | .driver = { |
248 | .name = "tiadc", | 316 | .name = "TI-am335x-adc", |
249 | .owner = THIS_MODULE, | 317 | .owner = THIS_MODULE, |
250 | .pm = TIADC_PM_OPS, | 318 | .pm = TIADC_PM_OPS, |
319 | .of_match_table = of_match_ptr(ti_adc_dt_ids), | ||
251 | }, | 320 | }, |
252 | .probe = tiadc_probe, | 321 | .probe = tiadc_probe, |
253 | .remove = tiadc_remove, | 322 | .remove = tiadc_remove, |
254 | }; | 323 | }; |
255 | |||
256 | module_platform_driver(tiadc_driver); | 324 | module_platform_driver(tiadc_driver); |
257 | 325 | ||
258 | MODULE_DESCRIPTION("TI ADC controller driver"); | 326 | MODULE_DESCRIPTION("TI ADC controller driver"); |
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index 50fb1293874e..e1c5300cacfc 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c | |||
@@ -24,8 +24,9 @@ | |||
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/input/ti_am335x_tsc.h> | ||
28 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/of.h> | ||
29 | #include <linux/of_device.h> | ||
29 | 30 | ||
30 | #include <linux/mfd/ti_am335x_tscadc.h> | 31 | #include <linux/mfd/ti_am335x_tscadc.h> |
31 | 32 | ||
@@ -33,6 +34,13 @@ | |||
33 | #define SEQ_SETTLE 275 | 34 | #define SEQ_SETTLE 275 |
34 | #define MAX_12BIT ((1 << 12) - 1) | 35 | #define MAX_12BIT ((1 << 12) - 1) |
35 | 36 | ||
37 | static const int config_pins[] = { | ||
38 | STEPCONFIG_XPP, | ||
39 | STEPCONFIG_XNN, | ||
40 | STEPCONFIG_YPP, | ||
41 | STEPCONFIG_YNN, | ||
42 | }; | ||
43 | |||
36 | struct titsc { | 44 | struct titsc { |
37 | struct input_dev *input; | 45 | struct input_dev *input; |
38 | struct ti_tscadc_dev *mfd_tscadc; | 46 | struct ti_tscadc_dev *mfd_tscadc; |
@@ -40,7 +48,10 @@ struct titsc { | |||
40 | unsigned int wires; | 48 | unsigned int wires; |
41 | unsigned int x_plate_resistance; | 49 | unsigned int x_plate_resistance; |
42 | bool pen_down; | 50 | bool pen_down; |
43 | int steps_to_configure; | 51 | int coordinate_readouts; |
52 | u32 config_inp[4]; | ||
53 | u32 bit_xp, bit_xn, bit_yp, bit_yn; | ||
54 | u32 inp_xp, inp_xn, inp_yp, inp_yn; | ||
44 | }; | 55 | }; |
45 | 56 | ||
46 | static unsigned int titsc_readl(struct titsc *ts, unsigned int reg) | 57 | static unsigned int titsc_readl(struct titsc *ts, unsigned int reg) |
@@ -54,92 +65,153 @@ static void titsc_writel(struct titsc *tsc, unsigned int reg, | |||
54 | writel(val, tsc->mfd_tscadc->tscadc_base + reg); | 65 | writel(val, tsc->mfd_tscadc->tscadc_base + reg); |
55 | } | 66 | } |
56 | 67 | ||
68 | static int titsc_config_wires(struct titsc *ts_dev) | ||
69 | { | ||
70 | u32 analog_line[4]; | ||
71 | u32 wire_order[4]; | ||
72 | int i, bit_cfg; | ||
73 | |||
74 | for (i = 0; i < 4; i++) { | ||
75 | /* | ||
76 | * Get the order in which TSC wires are attached | ||
77 | * w.r.t. each of the analog input lines on the EVM. | ||
78 | */ | ||
79 | analog_line[i] = (ts_dev->config_inp[i] & 0xF0) >> 4; | ||
80 | wire_order[i] = ts_dev->config_inp[i] & 0x0F; | ||
81 | if (WARN_ON(analog_line[i] > 7)) | ||
82 | return -EINVAL; | ||
83 | if (WARN_ON(wire_order[i] > ARRAY_SIZE(config_pins))) | ||
84 | return -EINVAL; | ||
85 | } | ||
86 | |||
87 | for (i = 0; i < 4; i++) { | ||
88 | int an_line; | ||
89 | int wi_order; | ||
90 | |||
91 | an_line = analog_line[i]; | ||
92 | wi_order = wire_order[i]; | ||
93 | bit_cfg = config_pins[wi_order]; | ||
94 | if (bit_cfg == 0) | ||
95 | return -EINVAL; | ||
96 | switch (wi_order) { | ||
97 | case 0: | ||
98 | ts_dev->bit_xp = bit_cfg; | ||
99 | ts_dev->inp_xp = an_line; | ||
100 | break; | ||
101 | |||
102 | case 1: | ||
103 | ts_dev->bit_xn = bit_cfg; | ||
104 | ts_dev->inp_xn = an_line; | ||
105 | break; | ||
106 | |||
107 | case 2: | ||
108 | ts_dev->bit_yp = bit_cfg; | ||
109 | ts_dev->inp_yp = an_line; | ||
110 | break; | ||
111 | case 3: | ||
112 | ts_dev->bit_yn = bit_cfg; | ||
113 | ts_dev->inp_yn = an_line; | ||
114 | break; | ||
115 | } | ||
116 | } | ||
117 | return 0; | ||
118 | } | ||
119 | |||
57 | static void titsc_step_config(struct titsc *ts_dev) | 120 | static void titsc_step_config(struct titsc *ts_dev) |
58 | { | 121 | { |
59 | unsigned int config; | 122 | unsigned int config; |
60 | int i, total_steps; | 123 | int i; |
61 | 124 | int end_step; | |
62 | /* Configure the Step registers */ | 125 | u32 stepenable; |
63 | total_steps = 2 * ts_dev->steps_to_configure; | ||
64 | 126 | ||
65 | config = STEPCONFIG_MODE_HWSYNC | | 127 | config = STEPCONFIG_MODE_HWSYNC | |
66 | STEPCONFIG_AVG_16 | STEPCONFIG_XPP; | 128 | STEPCONFIG_AVG_16 | ts_dev->bit_xp; |
67 | switch (ts_dev->wires) { | 129 | switch (ts_dev->wires) { |
68 | case 4: | 130 | case 4: |
69 | config |= STEPCONFIG_INP_AN2 | STEPCONFIG_XNN; | 131 | config |= STEPCONFIG_INP(ts_dev->inp_yp) | ts_dev->bit_xn; |
70 | break; | 132 | break; |
71 | case 5: | 133 | case 5: |
72 | config |= STEPCONFIG_YNN | | 134 | config |= ts_dev->bit_yn | |
73 | STEPCONFIG_INP_AN4 | STEPCONFIG_XNN | | 135 | STEPCONFIG_INP_AN4 | ts_dev->bit_xn | |
74 | STEPCONFIG_YPP; | 136 | ts_dev->bit_yp; |
75 | break; | 137 | break; |
76 | case 8: | 138 | case 8: |
77 | config |= STEPCONFIG_INP_AN2 | STEPCONFIG_XNN; | 139 | config |= STEPCONFIG_INP(ts_dev->inp_yp) | ts_dev->bit_xn; |
78 | break; | 140 | break; |
79 | } | 141 | } |
80 | 142 | ||
81 | for (i = 1; i <= ts_dev->steps_to_configure; i++) { | 143 | /* 1 … coordinate_readouts is for X */ |
144 | end_step = ts_dev->coordinate_readouts; | ||
145 | for (i = 0; i < end_step; i++) { | ||
82 | titsc_writel(ts_dev, REG_STEPCONFIG(i), config); | 146 | titsc_writel(ts_dev, REG_STEPCONFIG(i), config); |
83 | titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); | 147 | titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); |
84 | } | 148 | } |
85 | 149 | ||
86 | config = 0; | 150 | config = 0; |
87 | config = STEPCONFIG_MODE_HWSYNC | | 151 | config = STEPCONFIG_MODE_HWSYNC | |
88 | STEPCONFIG_AVG_16 | STEPCONFIG_YNN | | 152 | STEPCONFIG_AVG_16 | ts_dev->bit_yn | |
89 | STEPCONFIG_INM_ADCREFM | STEPCONFIG_FIFO1; | 153 | STEPCONFIG_INM_ADCREFM; |
90 | switch (ts_dev->wires) { | 154 | switch (ts_dev->wires) { |
91 | case 4: | 155 | case 4: |
92 | config |= STEPCONFIG_YPP; | 156 | config |= ts_dev->bit_yp | STEPCONFIG_INP(ts_dev->inp_xp); |
93 | break; | 157 | break; |
94 | case 5: | 158 | case 5: |
95 | config |= STEPCONFIG_XPP | STEPCONFIG_INP_AN4 | | 159 | config |= ts_dev->bit_xp | STEPCONFIG_INP_AN4 | |
96 | STEPCONFIG_XNP | STEPCONFIG_YPN; | 160 | ts_dev->bit_xn | ts_dev->bit_yp; |
97 | break; | 161 | break; |
98 | case 8: | 162 | case 8: |
99 | config |= STEPCONFIG_YPP; | 163 | config |= ts_dev->bit_yp | STEPCONFIG_INP(ts_dev->inp_xp); |
100 | break; | 164 | break; |
101 | } | 165 | } |
102 | 166 | ||
103 | for (i = (ts_dev->steps_to_configure + 1); i <= total_steps; i++) { | 167 | /* coordinate_readouts … coordinate_readouts * 2 is for Y */ |
168 | end_step = ts_dev->coordinate_readouts * 2; | ||
169 | for (i = ts_dev->coordinate_readouts; i < end_step; i++) { | ||
104 | titsc_writel(ts_dev, REG_STEPCONFIG(i), config); | 170 | titsc_writel(ts_dev, REG_STEPCONFIG(i), config); |
105 | titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); | 171 | titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); |
106 | } | 172 | } |
107 | 173 | ||
108 | config = 0; | ||
109 | /* Charge step configuration */ | 174 | /* Charge step configuration */ |
110 | config = STEPCONFIG_XPP | STEPCONFIG_YNN | | 175 | config = ts_dev->bit_xp | ts_dev->bit_yn | |
111 | STEPCHARGE_RFP_XPUL | STEPCHARGE_RFM_XNUR | | 176 | STEPCHARGE_RFP_XPUL | STEPCHARGE_RFM_XNUR | |
112 | STEPCHARGE_INM_AN1 | STEPCHARGE_INP_AN1; | 177 | STEPCHARGE_INM_AN1 | STEPCHARGE_INP(ts_dev->inp_yp); |
113 | 178 | ||
114 | titsc_writel(ts_dev, REG_CHARGECONFIG, config); | 179 | titsc_writel(ts_dev, REG_CHARGECONFIG, config); |
115 | titsc_writel(ts_dev, REG_CHARGEDELAY, CHARGEDLY_OPENDLY); | 180 | titsc_writel(ts_dev, REG_CHARGEDELAY, CHARGEDLY_OPENDLY); |
116 | 181 | ||
117 | config = 0; | 182 | /* coordinate_readouts * 2 … coordinate_readouts * 2 + 2 is for Z */ |
118 | /* Configure to calculate pressure */ | ||
119 | config = STEPCONFIG_MODE_HWSYNC | | 183 | config = STEPCONFIG_MODE_HWSYNC | |
120 | STEPCONFIG_AVG_16 | STEPCONFIG_YPP | | 184 | STEPCONFIG_AVG_16 | ts_dev->bit_yp | |
121 | STEPCONFIG_XNN | STEPCONFIG_INM_ADCREFM; | 185 | ts_dev->bit_xn | STEPCONFIG_INM_ADCREFM | |
122 | titsc_writel(ts_dev, REG_STEPCONFIG(total_steps + 1), config); | 186 | STEPCONFIG_INP(ts_dev->inp_xp); |
123 | titsc_writel(ts_dev, REG_STEPDELAY(total_steps + 1), | 187 | titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config); |
188 | titsc_writel(ts_dev, REG_STEPDELAY(end_step), | ||
124 | STEPCONFIG_OPENDLY); | 189 | STEPCONFIG_OPENDLY); |
125 | 190 | ||
126 | config |= STEPCONFIG_INP_AN3 | STEPCONFIG_FIFO1; | 191 | end_step++; |
127 | titsc_writel(ts_dev, REG_STEPCONFIG(total_steps + 2), config); | 192 | config |= STEPCONFIG_INP(ts_dev->inp_yn); |
128 | titsc_writel(ts_dev, REG_STEPDELAY(total_steps + 2), | 193 | titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config); |
194 | titsc_writel(ts_dev, REG_STEPDELAY(end_step), | ||
129 | STEPCONFIG_OPENDLY); | 195 | STEPCONFIG_OPENDLY); |
130 | 196 | ||
131 | titsc_writel(ts_dev, REG_SE, STPENB_STEPENB_TC); | 197 | /* The steps1 … end and bit 0 for TS_Charge */ |
198 | stepenable = (1 << (end_step + 2)) - 1; | ||
199 | am335x_tsc_se_set(ts_dev->mfd_tscadc, stepenable); | ||
132 | } | 200 | } |
133 | 201 | ||
134 | static void titsc_read_coordinates(struct titsc *ts_dev, | 202 | static void titsc_read_coordinates(struct titsc *ts_dev, |
135 | unsigned int *x, unsigned int *y) | 203 | u32 *x, u32 *y, u32 *z1, u32 *z2) |
136 | { | 204 | { |
137 | unsigned int fifocount = titsc_readl(ts_dev, REG_FIFO0CNT); | 205 | unsigned int fifocount = titsc_readl(ts_dev, REG_FIFO0CNT); |
138 | unsigned int prev_val_x = ~0, prev_val_y = ~0; | 206 | unsigned int prev_val_x = ~0, prev_val_y = ~0; |
139 | unsigned int prev_diff_x = ~0, prev_diff_y = ~0; | 207 | unsigned int prev_diff_x = ~0, prev_diff_y = ~0; |
140 | unsigned int read, diff; | 208 | unsigned int read, diff; |
141 | unsigned int i, channel; | 209 | unsigned int i, channel; |
210 | unsigned int creads = ts_dev->coordinate_readouts; | ||
142 | 211 | ||
212 | *z1 = *z2 = 0; | ||
213 | if (fifocount % (creads * 2 + 2)) | ||
214 | fifocount -= fifocount % (creads * 2 + 2); | ||
143 | /* | 215 | /* |
144 | * Delta filter is used to remove large variations in sampled | 216 | * Delta filter is used to remove large variations in sampled |
145 | * values from ADC. The filter tries to predict where the next | 217 | * values from ADC. The filter tries to predict where the next |
@@ -148,32 +220,32 @@ static void titsc_read_coordinates(struct titsc *ts_dev, | |||
148 | * algorithm compares the difference with that of a present value, | 220 | * algorithm compares the difference with that of a present value, |
149 | * if true the value is reported to the sub system. | 221 | * if true the value is reported to the sub system. |
150 | */ | 222 | */ |
151 | for (i = 0; i < fifocount - 1; i++) { | 223 | for (i = 0; i < fifocount; i++) { |
152 | read = titsc_readl(ts_dev, REG_FIFO0); | 224 | read = titsc_readl(ts_dev, REG_FIFO0); |
153 | channel = read & 0xf0000; | 225 | |
154 | channel = channel >> 0x10; | 226 | channel = (read & 0xf0000) >> 16; |
155 | if ((channel >= 0) && (channel < ts_dev->steps_to_configure)) { | 227 | read &= 0xfff; |
156 | read &= 0xfff; | 228 | if (channel < creads) { |
157 | diff = abs(read - prev_val_x); | 229 | diff = abs(read - prev_val_x); |
158 | if (diff < prev_diff_x) { | 230 | if (diff < prev_diff_x) { |
159 | prev_diff_x = diff; | 231 | prev_diff_x = diff; |
160 | *x = read; | 232 | *x = read; |
161 | } | 233 | } |
162 | prev_val_x = read; | 234 | prev_val_x = read; |
163 | } | ||
164 | 235 | ||
165 | read = titsc_readl(ts_dev, REG_FIFO1); | 236 | } else if (channel < creads * 2) { |
166 | channel = read & 0xf0000; | ||
167 | channel = channel >> 0x10; | ||
168 | if ((channel >= ts_dev->steps_to_configure) && | ||
169 | (channel < (2 * ts_dev->steps_to_configure - 1))) { | ||
170 | read &= 0xfff; | ||
171 | diff = abs(read - prev_val_y); | 237 | diff = abs(read - prev_val_y); |
172 | if (diff < prev_diff_y) { | 238 | if (diff < prev_diff_y) { |
173 | prev_diff_y = diff; | 239 | prev_diff_y = diff; |
174 | *y = read; | 240 | *y = read; |
175 | } | 241 | } |
176 | prev_val_y = read; | 242 | prev_val_y = read; |
243 | |||
244 | } else if (channel < creads * 2 + 1) { | ||
245 | *z1 = read; | ||
246 | |||
247 | } else if (channel < creads * 2 + 2) { | ||
248 | *z2 = read; | ||
177 | } | 249 | } |
178 | } | 250 | } |
179 | } | 251 | } |
@@ -186,23 +258,11 @@ static irqreturn_t titsc_irq(int irq, void *dev) | |||
186 | unsigned int x = 0, y = 0; | 258 | unsigned int x = 0, y = 0; |
187 | unsigned int z1, z2, z; | 259 | unsigned int z1, z2, z; |
188 | unsigned int fsm; | 260 | unsigned int fsm; |
189 | unsigned int fifo1count, fifo0count; | ||
190 | int i; | ||
191 | 261 | ||
192 | status = titsc_readl(ts_dev, REG_IRQSTATUS); | 262 | status = titsc_readl(ts_dev, REG_IRQSTATUS); |
193 | if (status & IRQENB_FIFO0THRES) { | 263 | if (status & IRQENB_FIFO0THRES) { |
194 | titsc_read_coordinates(ts_dev, &x, &y); | ||
195 | 264 | ||
196 | z1 = titsc_readl(ts_dev, REG_FIFO0) & 0xfff; | 265 | titsc_read_coordinates(ts_dev, &x, &y, &z1, &z2); |
197 | z2 = titsc_readl(ts_dev, REG_FIFO1) & 0xfff; | ||
198 | |||
199 | fifo1count = titsc_readl(ts_dev, REG_FIFO1CNT); | ||
200 | for (i = 0; i < fifo1count; i++) | ||
201 | titsc_readl(ts_dev, REG_FIFO1); | ||
202 | |||
203 | fifo0count = titsc_readl(ts_dev, REG_FIFO0CNT); | ||
204 | for (i = 0; i < fifo0count; i++) | ||
205 | titsc_readl(ts_dev, REG_FIFO0); | ||
206 | 266 | ||
207 | if (ts_dev->pen_down && z1 != 0 && z2 != 0) { | 267 | if (ts_dev->pen_down && z1 != 0 && z2 != 0) { |
208 | /* | 268 | /* |
@@ -210,10 +270,10 @@ static irqreturn_t titsc_irq(int irq, void *dev) | |||
210 | * Resistance(touch) = x plate resistance * | 270 | * Resistance(touch) = x plate resistance * |
211 | * x postion/4096 * ((z2 / z1) - 1) | 271 | * x postion/4096 * ((z2 / z1) - 1) |
212 | */ | 272 | */ |
213 | z = z2 - z1; | 273 | z = z1 - z2; |
214 | z *= x; | 274 | z *= x; |
215 | z *= ts_dev->x_plate_resistance; | 275 | z *= ts_dev->x_plate_resistance; |
216 | z /= z1; | 276 | z /= z2; |
217 | z = (z + 2047) >> 12; | 277 | z = (z + 2047) >> 12; |
218 | 278 | ||
219 | if (z <= MAX_12BIT) { | 279 | if (z <= MAX_12BIT) { |
@@ -248,10 +308,53 @@ static irqreturn_t titsc_irq(int irq, void *dev) | |||
248 | irqclr |= IRQENB_PENUP; | 308 | irqclr |= IRQENB_PENUP; |
249 | } | 309 | } |
250 | 310 | ||
251 | titsc_writel(ts_dev, REG_IRQSTATUS, irqclr); | 311 | if (status & IRQENB_HW_PEN) { |
312 | |||
313 | titsc_writel(ts_dev, REG_IRQWAKEUP, 0x00); | ||
314 | titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN); | ||
315 | } | ||
252 | 316 | ||
253 | titsc_writel(ts_dev, REG_SE, STPENB_STEPENB_TC); | 317 | if (irqclr) { |
254 | return IRQ_HANDLED; | 318 | titsc_writel(ts_dev, REG_IRQSTATUS, irqclr); |
319 | am335x_tsc_se_update(ts_dev->mfd_tscadc); | ||
320 | return IRQ_HANDLED; | ||
321 | } | ||
322 | return IRQ_NONE; | ||
323 | } | ||
324 | |||
325 | static int titsc_parse_dt(struct platform_device *pdev, | ||
326 | struct titsc *ts_dev) | ||
327 | { | ||
328 | struct device_node *node = pdev->dev.of_node; | ||
329 | int err; | ||
330 | |||
331 | if (!node) | ||
332 | return -EINVAL; | ||
333 | |||
334 | err = of_property_read_u32(node, "ti,wires", &ts_dev->wires); | ||
335 | if (err < 0) | ||
336 | return err; | ||
337 | switch (ts_dev->wires) { | ||
338 | case 4: | ||
339 | case 5: | ||
340 | case 8: | ||
341 | break; | ||
342 | default: | ||
343 | return -EINVAL; | ||
344 | } | ||
345 | |||
346 | err = of_property_read_u32(node, "ti,x-plate-resistance", | ||
347 | &ts_dev->x_plate_resistance); | ||
348 | if (err < 0) | ||
349 | return err; | ||
350 | |||
351 | err = of_property_read_u32(node, "ti,coordiante-readouts", | ||
352 | &ts_dev->coordinate_readouts); | ||
353 | if (err < 0) | ||
354 | return err; | ||
355 | |||
356 | return of_property_read_u32_array(node, "ti,wire-config", | ||
357 | ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp)); | ||
255 | } | 358 | } |
256 | 359 | ||
257 | /* | 360 | /* |
@@ -262,17 +365,9 @@ static int titsc_probe(struct platform_device *pdev) | |||
262 | { | 365 | { |
263 | struct titsc *ts_dev; | 366 | struct titsc *ts_dev; |
264 | struct input_dev *input_dev; | 367 | struct input_dev *input_dev; |
265 | struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data; | 368 | struct ti_tscadc_dev *tscadc_dev = ti_tscadc_dev_get(pdev); |
266 | struct mfd_tscadc_board *pdata; | ||
267 | int err; | 369 | int err; |
268 | 370 | ||
269 | pdata = tscadc_dev->dev->platform_data; | ||
270 | |||
271 | if (!pdata) { | ||
272 | dev_err(&pdev->dev, "Could not find platform data\n"); | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | |||
276 | /* Allocate memory for device */ | 371 | /* Allocate memory for device */ |
277 | ts_dev = kzalloc(sizeof(struct titsc), GFP_KERNEL); | 372 | ts_dev = kzalloc(sizeof(struct titsc), GFP_KERNEL); |
278 | input_dev = input_allocate_device(); | 373 | input_dev = input_allocate_device(); |
@@ -286,9 +381,12 @@ static int titsc_probe(struct platform_device *pdev) | |||
286 | ts_dev->mfd_tscadc = tscadc_dev; | 381 | ts_dev->mfd_tscadc = tscadc_dev; |
287 | ts_dev->input = input_dev; | 382 | ts_dev->input = input_dev; |
288 | ts_dev->irq = tscadc_dev->irq; | 383 | ts_dev->irq = tscadc_dev->irq; |
289 | ts_dev->wires = pdata->tsc_init->wires; | 384 | |
290 | ts_dev->x_plate_resistance = pdata->tsc_init->x_plate_resistance; | 385 | err = titsc_parse_dt(pdev, ts_dev); |
291 | ts_dev->steps_to_configure = pdata->tsc_init->steps_to_configure; | 386 | if (err) { |
387 | dev_err(&pdev->dev, "Could not find valid DT data.\n"); | ||
388 | goto err_free_mem; | ||
389 | } | ||
292 | 390 | ||
293 | err = request_irq(ts_dev->irq, titsc_irq, | 391 | err = request_irq(ts_dev->irq, titsc_irq, |
294 | 0, pdev->dev.driver->name, ts_dev); | 392 | 0, pdev->dev.driver->name, ts_dev); |
@@ -298,8 +396,14 @@ static int titsc_probe(struct platform_device *pdev) | |||
298 | } | 396 | } |
299 | 397 | ||
300 | titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES); | 398 | titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES); |
399 | err = titsc_config_wires(ts_dev); | ||
400 | if (err) { | ||
401 | dev_err(&pdev->dev, "wrong i/p wire configuration\n"); | ||
402 | goto err_free_irq; | ||
403 | } | ||
301 | titsc_step_config(ts_dev); | 404 | titsc_step_config(ts_dev); |
302 | titsc_writel(ts_dev, REG_FIFO0THR, ts_dev->steps_to_configure); | 405 | titsc_writel(ts_dev, REG_FIFO0THR, |
406 | ts_dev->coordinate_readouts * 2 + 2 - 1); | ||
303 | 407 | ||
304 | input_dev->name = "ti-tsc"; | 408 | input_dev->name = "ti-tsc"; |
305 | input_dev->dev.parent = &pdev->dev; | 409 | input_dev->dev.parent = &pdev->dev; |
@@ -329,11 +433,16 @@ err_free_mem: | |||
329 | 433 | ||
330 | static int titsc_remove(struct platform_device *pdev) | 434 | static int titsc_remove(struct platform_device *pdev) |
331 | { | 435 | { |
332 | struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data; | 436 | struct titsc *ts_dev = platform_get_drvdata(pdev); |
333 | struct titsc *ts_dev = tscadc_dev->tsc; | 437 | u32 steps; |
334 | 438 | ||
335 | free_irq(ts_dev->irq, ts_dev); | 439 | free_irq(ts_dev->irq, ts_dev); |
336 | 440 | ||
441 | /* total steps followed by the enable mask */ | ||
442 | steps = 2 * ts_dev->coordinate_readouts + 2; | ||
443 | steps = (1 << steps) - 1; | ||
444 | am335x_tsc_se_clr(ts_dev->mfd_tscadc, steps); | ||
445 | |||
337 | input_unregister_device(ts_dev->input); | 446 | input_unregister_device(ts_dev->input); |
338 | 447 | ||
339 | kfree(ts_dev); | 448 | kfree(ts_dev); |
@@ -343,10 +452,11 @@ static int titsc_remove(struct platform_device *pdev) | |||
343 | #ifdef CONFIG_PM | 452 | #ifdef CONFIG_PM |
344 | static int titsc_suspend(struct device *dev) | 453 | static int titsc_suspend(struct device *dev) |
345 | { | 454 | { |
346 | struct ti_tscadc_dev *tscadc_dev = dev->platform_data; | 455 | struct titsc *ts_dev = dev_get_drvdata(dev); |
347 | struct titsc *ts_dev = tscadc_dev->tsc; | 456 | struct ti_tscadc_dev *tscadc_dev; |
348 | unsigned int idle; | 457 | unsigned int idle; |
349 | 458 | ||
459 | tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev)); | ||
350 | if (device_may_wakeup(tscadc_dev->dev)) { | 460 | if (device_may_wakeup(tscadc_dev->dev)) { |
351 | idle = titsc_readl(ts_dev, REG_IRQENABLE); | 461 | idle = titsc_readl(ts_dev, REG_IRQENABLE); |
352 | titsc_writel(ts_dev, REG_IRQENABLE, | 462 | titsc_writel(ts_dev, REG_IRQENABLE, |
@@ -358,9 +468,10 @@ static int titsc_suspend(struct device *dev) | |||
358 | 468 | ||
359 | static int titsc_resume(struct device *dev) | 469 | static int titsc_resume(struct device *dev) |
360 | { | 470 | { |
361 | struct ti_tscadc_dev *tscadc_dev = dev->platform_data; | 471 | struct titsc *ts_dev = dev_get_drvdata(dev); |
362 | struct titsc *ts_dev = tscadc_dev->tsc; | 472 | struct ti_tscadc_dev *tscadc_dev; |
363 | 473 | ||
474 | tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev)); | ||
364 | if (device_may_wakeup(tscadc_dev->dev)) { | 475 | if (device_may_wakeup(tscadc_dev->dev)) { |
365 | titsc_writel(ts_dev, REG_IRQWAKEUP, | 476 | titsc_writel(ts_dev, REG_IRQWAKEUP, |
366 | 0x00); | 477 | 0x00); |
@@ -368,7 +479,7 @@ static int titsc_resume(struct device *dev) | |||
368 | } | 479 | } |
369 | titsc_step_config(ts_dev); | 480 | titsc_step_config(ts_dev); |
370 | titsc_writel(ts_dev, REG_FIFO0THR, | 481 | titsc_writel(ts_dev, REG_FIFO0THR, |
371 | ts_dev->steps_to_configure); | 482 | ts_dev->coordinate_readouts * 2 + 2 - 1); |
372 | return 0; | 483 | return 0; |
373 | } | 484 | } |
374 | 485 | ||
@@ -381,13 +492,20 @@ static const struct dev_pm_ops titsc_pm_ops = { | |||
381 | #define TITSC_PM_OPS NULL | 492 | #define TITSC_PM_OPS NULL |
382 | #endif | 493 | #endif |
383 | 494 | ||
495 | static const struct of_device_id ti_tsc_dt_ids[] = { | ||
496 | { .compatible = "ti,am3359-tsc", }, | ||
497 | { } | ||
498 | }; | ||
499 | MODULE_DEVICE_TABLE(of, ti_tsc_dt_ids); | ||
500 | |||
384 | static struct platform_driver ti_tsc_driver = { | 501 | static struct platform_driver ti_tsc_driver = { |
385 | .probe = titsc_probe, | 502 | .probe = titsc_probe, |
386 | .remove = titsc_remove, | 503 | .remove = titsc_remove, |
387 | .driver = { | 504 | .driver = { |
388 | .name = "tsc", | 505 | .name = "TI-am335x-tsc", |
389 | .owner = THIS_MODULE, | 506 | .owner = THIS_MODULE, |
390 | .pm = TITSC_PM_OPS, | 507 | .pm = TITSC_PM_OPS, |
508 | .of_match_table = of_match_ptr(ti_tsc_dt_ids), | ||
391 | }, | 509 | }, |
392 | }; | 510 | }; |
393 | module_platform_driver(ti_tsc_driver); | 511 | module_platform_driver(ti_tsc_driver); |
diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 582bda543520..6c954835d61e 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c | |||
@@ -22,13 +22,12 @@ | |||
22 | 22 | ||
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/err.h> | ||
25 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
26 | #include <linux/mfd/core.h> | 27 | #include <linux/mfd/core.h> |
27 | #include <linux/mfd/88pm80x.h> | 28 | #include <linux/mfd/88pm80x.h> |
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
29 | 30 | ||
30 | #define PM800_CHIP_ID (0x00) | ||
31 | |||
32 | /* Interrupt Registers */ | 31 | /* Interrupt Registers */ |
33 | #define PM800_INT_STATUS1 (0x05) | 32 | #define PM800_INT_STATUS1 (0x05) |
34 | #define PM800_ONKEY_INT_STS1 (1 << 0) | 33 | #define PM800_ONKEY_INT_STS1 (1 << 0) |
@@ -113,20 +112,11 @@ enum { | |||
113 | PM800_MAX_IRQ, | 112 | PM800_MAX_IRQ, |
114 | }; | 113 | }; |
115 | 114 | ||
116 | enum { | 115 | /* PM800: generation identification number */ |
117 | /* Procida */ | 116 | #define PM800_CHIP_GEN_ID_NUM 0x3 |
118 | PM800_CHIP_A0 = 0x60, | ||
119 | PM800_CHIP_A1 = 0x61, | ||
120 | PM800_CHIP_B0 = 0x62, | ||
121 | PM800_CHIP_C0 = 0x63, | ||
122 | PM800_CHIP_END = PM800_CHIP_C0, | ||
123 | |||
124 | /* Make sure to update this to the last stepping */ | ||
125 | PM8XXX_CHIP_END = PM800_CHIP_END | ||
126 | }; | ||
127 | 117 | ||
128 | static const struct i2c_device_id pm80x_id_table[] = { | 118 | static const struct i2c_device_id pm80x_id_table[] = { |
129 | {"88PM800", CHIP_PM800}, | 119 | {"88PM800", 0}, |
130 | {} /* NULL terminated */ | 120 | {} /* NULL terminated */ |
131 | }; | 121 | }; |
132 | MODULE_DEVICE_TABLE(i2c, pm80x_id_table); | 122 | MODULE_DEVICE_TABLE(i2c, pm80x_id_table); |
@@ -167,6 +157,13 @@ static struct mfd_cell onkey_devs[] = { | |||
167 | }, | 157 | }, |
168 | }; | 158 | }; |
169 | 159 | ||
160 | static struct mfd_cell regulator_devs[] = { | ||
161 | { | ||
162 | .name = "88pm80x-regulator", | ||
163 | .id = -1, | ||
164 | }, | ||
165 | }; | ||
166 | |||
170 | static const struct regmap_irq pm800_irqs[] = { | 167 | static const struct regmap_irq pm800_irqs[] = { |
171 | /* INT0 */ | 168 | /* INT0 */ |
172 | [PM800_IRQ_ONKEY] = { | 169 | [PM800_IRQ_ONKEY] = { |
@@ -315,10 +312,59 @@ out: | |||
315 | return ret; | 312 | return ret; |
316 | } | 313 | } |
317 | 314 | ||
315 | static int device_onkey_init(struct pm80x_chip *chip, | ||
316 | struct pm80x_platform_data *pdata) | ||
317 | { | ||
318 | int ret; | ||
319 | |||
320 | ret = mfd_add_devices(chip->dev, 0, &onkey_devs[0], | ||
321 | ARRAY_SIZE(onkey_devs), &onkey_resources[0], 0, | ||
322 | NULL); | ||
323 | if (ret) { | ||
324 | dev_err(chip->dev, "Failed to add onkey subdev\n"); | ||
325 | return ret; | ||
326 | } | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static int device_rtc_init(struct pm80x_chip *chip, | ||
332 | struct pm80x_platform_data *pdata) | ||
333 | { | ||
334 | int ret; | ||
335 | |||
336 | rtc_devs[0].platform_data = pdata->rtc; | ||
337 | rtc_devs[0].pdata_size = | ||
338 | pdata->rtc ? sizeof(struct pm80x_rtc_pdata) : 0; | ||
339 | ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], | ||
340 | ARRAY_SIZE(rtc_devs), NULL, 0, NULL); | ||
341 | if (ret) { | ||
342 | dev_err(chip->dev, "Failed to add rtc subdev\n"); | ||
343 | return ret; | ||
344 | } | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static int device_regulator_init(struct pm80x_chip *chip, | ||
350 | struct pm80x_platform_data *pdata) | ||
351 | { | ||
352 | int ret; | ||
353 | |||
354 | ret = mfd_add_devices(chip->dev, 0, ®ulator_devs[0], | ||
355 | ARRAY_SIZE(regulator_devs), NULL, 0, NULL); | ||
356 | if (ret) { | ||
357 | dev_err(chip->dev, "Failed to add regulator subdev\n"); | ||
358 | return ret; | ||
359 | } | ||
360 | |||
361 | return 0; | ||
362 | } | ||
363 | |||
318 | static int device_irq_init_800(struct pm80x_chip *chip) | 364 | static int device_irq_init_800(struct pm80x_chip *chip) |
319 | { | 365 | { |
320 | struct regmap *map = chip->regmap; | 366 | struct regmap *map = chip->regmap; |
321 | unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; | 367 | unsigned long flags = IRQF_ONESHOT; |
322 | int data, mask, ret = -EINVAL; | 368 | int data, mask, ret = -EINVAL; |
323 | 369 | ||
324 | if (!map || !chip->irq) { | 370 | if (!map || !chip->irq) { |
@@ -362,6 +408,7 @@ static struct regmap_irq_chip pm800_irq_chip = { | |||
362 | .status_base = PM800_INT_STATUS1, | 408 | .status_base = PM800_INT_STATUS1, |
363 | .mask_base = PM800_INT_ENA_1, | 409 | .mask_base = PM800_INT_ENA_1, |
364 | .ack_base = PM800_INT_STATUS1, | 410 | .ack_base = PM800_INT_STATUS1, |
411 | .mask_invert = 1, | ||
365 | }; | 412 | }; |
366 | 413 | ||
367 | static int pm800_pages_init(struct pm80x_chip *chip) | 414 | static int pm800_pages_init(struct pm80x_chip *chip) |
@@ -369,77 +416,72 @@ static int pm800_pages_init(struct pm80x_chip *chip) | |||
369 | struct pm80x_subchip *subchip; | 416 | struct pm80x_subchip *subchip; |
370 | struct i2c_client *client = chip->client; | 417 | struct i2c_client *client = chip->client; |
371 | 418 | ||
419 | int ret = 0; | ||
420 | |||
372 | subchip = chip->subchip; | 421 | subchip = chip->subchip; |
373 | /* PM800 block power: i2c addr 0x31 */ | 422 | if (!subchip || !subchip->power_page_addr || !subchip->gpadc_page_addr) |
374 | if (subchip->power_page_addr) { | 423 | return -ENODEV; |
375 | subchip->power_page = | 424 | |
376 | i2c_new_dummy(client->adapter, subchip->power_page_addr); | 425 | /* PM800 block power page */ |
377 | subchip->regmap_power = | 426 | subchip->power_page = i2c_new_dummy(client->adapter, |
378 | devm_regmap_init_i2c(subchip->power_page, | 427 | subchip->power_page_addr); |
379 | &pm80x_regmap_config); | 428 | if (subchip->power_page == NULL) { |
380 | i2c_set_clientdata(subchip->power_page, chip); | 429 | ret = -ENODEV; |
381 | } else | 430 | goto out; |
382 | dev_info(chip->dev, | 431 | } |
383 | "PM800 block power 0x31: No power_page_addr\n"); | ||
384 | |||
385 | /* PM800 block GPADC: i2c addr 0x32 */ | ||
386 | if (subchip->gpadc_page_addr) { | ||
387 | subchip->gpadc_page = i2c_new_dummy(client->adapter, | ||
388 | subchip->gpadc_page_addr); | ||
389 | subchip->regmap_gpadc = | ||
390 | devm_regmap_init_i2c(subchip->gpadc_page, | ||
391 | &pm80x_regmap_config); | ||
392 | i2c_set_clientdata(subchip->gpadc_page, chip); | ||
393 | } else | ||
394 | dev_info(chip->dev, | ||
395 | "PM800 block GPADC 0x32: No gpadc_page_addr\n"); | ||
396 | 432 | ||
397 | return 0; | 433 | subchip->regmap_power = devm_regmap_init_i2c(subchip->power_page, |
434 | &pm80x_regmap_config); | ||
435 | if (IS_ERR(subchip->regmap_power)) { | ||
436 | ret = PTR_ERR(subchip->regmap_power); | ||
437 | dev_err(chip->dev, | ||
438 | "Failed to allocate regmap_power: %d\n", ret); | ||
439 | goto out; | ||
440 | } | ||
441 | |||
442 | i2c_set_clientdata(subchip->power_page, chip); | ||
443 | |||
444 | /* PM800 block GPADC */ | ||
445 | subchip->gpadc_page = i2c_new_dummy(client->adapter, | ||
446 | subchip->gpadc_page_addr); | ||
447 | if (subchip->gpadc_page == NULL) { | ||
448 | ret = -ENODEV; | ||
449 | goto out; | ||
450 | } | ||
451 | |||
452 | subchip->regmap_gpadc = devm_regmap_init_i2c(subchip->gpadc_page, | ||
453 | &pm80x_regmap_config); | ||
454 | if (IS_ERR(subchip->regmap_gpadc)) { | ||
455 | ret = PTR_ERR(subchip->regmap_gpadc); | ||
456 | dev_err(chip->dev, | ||
457 | "Failed to allocate regmap_gpadc: %d\n", ret); | ||
458 | goto out; | ||
459 | } | ||
460 | i2c_set_clientdata(subchip->gpadc_page, chip); | ||
461 | |||
462 | out: | ||
463 | return ret; | ||
398 | } | 464 | } |
399 | 465 | ||
400 | static void pm800_pages_exit(struct pm80x_chip *chip) | 466 | static void pm800_pages_exit(struct pm80x_chip *chip) |
401 | { | 467 | { |
402 | struct pm80x_subchip *subchip; | 468 | struct pm80x_subchip *subchip; |
403 | 469 | ||
404 | regmap_exit(chip->regmap); | ||
405 | i2c_unregister_device(chip->client); | ||
406 | |||
407 | subchip = chip->subchip; | 470 | subchip = chip->subchip; |
408 | if (subchip->power_page) { | 471 | |
409 | regmap_exit(subchip->regmap_power); | 472 | if (subchip && subchip->power_page) |
410 | i2c_unregister_device(subchip->power_page); | 473 | i2c_unregister_device(subchip->power_page); |
411 | } | 474 | |
412 | if (subchip->gpadc_page) { | 475 | if (subchip && subchip->gpadc_page) |
413 | regmap_exit(subchip->regmap_gpadc); | ||
414 | i2c_unregister_device(subchip->gpadc_page); | 476 | i2c_unregister_device(subchip->gpadc_page); |
415 | } | ||
416 | } | 477 | } |
417 | 478 | ||
418 | static int device_800_init(struct pm80x_chip *chip, | 479 | static int device_800_init(struct pm80x_chip *chip, |
419 | struct pm80x_platform_data *pdata) | 480 | struct pm80x_platform_data *pdata) |
420 | { | 481 | { |
421 | int ret, pmic_id; | 482 | int ret; |
422 | unsigned int val; | 483 | unsigned int val; |
423 | 484 | ||
424 | ret = regmap_read(chip->regmap, PM800_CHIP_ID, &val); | ||
425 | if (ret < 0) { | ||
426 | dev_err(chip->dev, "Failed to read CHIP ID: %d\n", ret); | ||
427 | goto out; | ||
428 | } | ||
429 | |||
430 | pmic_id = val & PM80X_VERSION_MASK; | ||
431 | |||
432 | if ((pmic_id >= PM800_CHIP_A0) && (pmic_id <= PM800_CHIP_END)) { | ||
433 | chip->version = val; | ||
434 | dev_info(chip->dev, | ||
435 | "88PM80x:Marvell 88PM800 (ID:0x%x) detected\n", val); | ||
436 | } else { | ||
437 | dev_err(chip->dev, | ||
438 | "Failed to detect Marvell 88PM800:ChipID[0x%x]\n", val); | ||
439 | ret = -EINVAL; | ||
440 | goto out; | ||
441 | } | ||
442 | |||
443 | /* | 485 | /* |
444 | * alarm wake up bit will be clear in device_irq_init(), | 486 | * alarm wake up bit will be clear in device_irq_init(), |
445 | * read before that | 487 | * read before that |
@@ -468,27 +510,22 @@ static int device_800_init(struct pm80x_chip *chip, | |||
468 | goto out; | 510 | goto out; |
469 | } | 511 | } |
470 | 512 | ||
471 | ret = | 513 | ret = device_onkey_init(chip, pdata); |
472 | mfd_add_devices(chip->dev, 0, &onkey_devs[0], | 514 | if (ret) { |
473 | ARRAY_SIZE(onkey_devs), &onkey_resources[0], 0, | ||
474 | NULL); | ||
475 | if (ret < 0) { | ||
476 | dev_err(chip->dev, "Failed to add onkey subdev\n"); | 515 | dev_err(chip->dev, "Failed to add onkey subdev\n"); |
477 | goto out_dev; | 516 | goto out_dev; |
478 | } else | 517 | } |
479 | dev_info(chip->dev, "[%s]:Added mfd onkey_devs\n", __func__); | 518 | |
480 | 519 | ret = device_rtc_init(chip, pdata); | |
481 | if (pdata && pdata->rtc) { | 520 | if (ret) { |
482 | rtc_devs[0].platform_data = pdata->rtc; | 521 | dev_err(chip->dev, "Failed to add rtc subdev\n"); |
483 | rtc_devs[0].pdata_size = sizeof(struct pm80x_rtc_pdata); | 522 | goto out; |
484 | ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], | 523 | } |
485 | ARRAY_SIZE(rtc_devs), NULL, 0, NULL); | 524 | |
486 | if (ret < 0) { | 525 | ret = device_regulator_init(chip, pdata); |
487 | dev_err(chip->dev, "Failed to add rtc subdev\n"); | 526 | if (ret) { |
488 | goto out_dev; | 527 | dev_err(chip->dev, "Failed to add regulators subdev\n"); |
489 | } else | 528 | goto out; |
490 | dev_info(chip->dev, | ||
491 | "[%s]:Added mfd rtc_devs\n", __func__); | ||
492 | } | 529 | } |
493 | 530 | ||
494 | return 0; | 531 | return 0; |
@@ -507,7 +544,7 @@ static int pm800_probe(struct i2c_client *client, | |||
507 | struct pm80x_platform_data *pdata = client->dev.platform_data; | 544 | struct pm80x_platform_data *pdata = client->dev.platform_data; |
508 | struct pm80x_subchip *subchip; | 545 | struct pm80x_subchip *subchip; |
509 | 546 | ||
510 | ret = pm80x_init(client, id); | 547 | ret = pm80x_init(client); |
511 | if (ret) { | 548 | if (ret) { |
512 | dev_err(&client->dev, "pm800_init fail\n"); | 549 | dev_err(&client->dev, "pm800_init fail\n"); |
513 | goto out_init; | 550 | goto out_init; |
@@ -524,28 +561,31 @@ static int pm800_probe(struct i2c_client *client, | |||
524 | goto err_subchip_alloc; | 561 | goto err_subchip_alloc; |
525 | } | 562 | } |
526 | 563 | ||
527 | subchip->power_page_addr = pdata->power_page_addr; | 564 | /* pm800 has 2 addtional pages to support power and gpadc. */ |
528 | subchip->gpadc_page_addr = pdata->gpadc_page_addr; | 565 | subchip->power_page_addr = client->addr + 1; |
566 | subchip->gpadc_page_addr = client->addr + 2; | ||
529 | chip->subchip = subchip; | 567 | chip->subchip = subchip; |
530 | 568 | ||
531 | ret = device_800_init(chip, pdata); | ||
532 | if (ret) { | ||
533 | dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id); | ||
534 | goto err_subchip_alloc; | ||
535 | } | ||
536 | |||
537 | ret = pm800_pages_init(chip); | 569 | ret = pm800_pages_init(chip); |
538 | if (ret) { | 570 | if (ret) { |
539 | dev_err(&client->dev, "pm800_pages_init failed!\n"); | 571 | dev_err(&client->dev, "pm800_pages_init failed!\n"); |
540 | goto err_page_init; | 572 | goto err_page_init; |
541 | } | 573 | } |
542 | 574 | ||
575 | ret = device_800_init(chip, pdata); | ||
576 | if (ret) { | ||
577 | dev_err(chip->dev, "Failed to initialize 88pm800 devices\n"); | ||
578 | goto err_device_init; | ||
579 | } | ||
580 | |||
543 | if (pdata->plat_config) | 581 | if (pdata->plat_config) |
544 | pdata->plat_config(chip, pdata); | 582 | pdata->plat_config(chip, pdata); |
545 | 583 | ||
584 | return 0; | ||
585 | |||
586 | err_device_init: | ||
587 | pm800_pages_exit(chip); | ||
546 | err_page_init: | 588 | err_page_init: |
547 | mfd_remove_devices(chip->dev); | ||
548 | device_irq_exit_800(chip); | ||
549 | err_subchip_alloc: | 589 | err_subchip_alloc: |
550 | pm80x_deinit(); | 590 | pm80x_deinit(); |
551 | out_init: | 591 | out_init: |
@@ -567,7 +607,7 @@ static int pm800_remove(struct i2c_client *client) | |||
567 | 607 | ||
568 | static struct i2c_driver pm800_driver = { | 608 | static struct i2c_driver pm800_driver = { |
569 | .driver = { | 609 | .driver = { |
570 | .name = "88PM80X", | 610 | .name = "88PM800", |
571 | .owner = THIS_MODULE, | 611 | .owner = THIS_MODULE, |
572 | .pm = &pm80x_pm_ops, | 612 | .pm = &pm80x_pm_ops, |
573 | }, | 613 | }, |
diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 65d7ac099b20..521602231c7b 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c | |||
@@ -29,10 +29,8 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | 31 | ||
32 | #define PM805_CHIP_ID (0x00) | ||
33 | |||
34 | static const struct i2c_device_id pm80x_id_table[] = { | 32 | static const struct i2c_device_id pm80x_id_table[] = { |
35 | {"88PM805", CHIP_PM805}, | 33 | {"88PM805", 0}, |
36 | {} /* NULL terminated */ | 34 | {} /* NULL terminated */ |
37 | }; | 35 | }; |
38 | MODULE_DEVICE_TABLE(i2c, pm80x_id_table); | 36 | MODULE_DEVICE_TABLE(i2c, pm80x_id_table); |
@@ -138,7 +136,7 @@ static struct regmap_irq pm805_irqs[] = { | |||
138 | static int device_irq_init_805(struct pm80x_chip *chip) | 136 | static int device_irq_init_805(struct pm80x_chip *chip) |
139 | { | 137 | { |
140 | struct regmap *map = chip->regmap; | 138 | struct regmap *map = chip->regmap; |
141 | unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; | 139 | unsigned long flags = IRQF_ONESHOT; |
142 | int data, mask, ret = -EINVAL; | 140 | int data, mask, ret = -EINVAL; |
143 | 141 | ||
144 | if (!map || !chip->irq) { | 142 | if (!map || !chip->irq) { |
@@ -192,7 +190,6 @@ static struct regmap_irq_chip pm805_irq_chip = { | |||
192 | static int device_805_init(struct pm80x_chip *chip) | 190 | static int device_805_init(struct pm80x_chip *chip) |
193 | { | 191 | { |
194 | int ret = 0; | 192 | int ret = 0; |
195 | unsigned int val; | ||
196 | struct regmap *map = chip->regmap; | 193 | struct regmap *map = chip->regmap; |
197 | 194 | ||
198 | if (!map) { | 195 | if (!map) { |
@@ -200,13 +197,6 @@ static int device_805_init(struct pm80x_chip *chip) | |||
200 | return -EINVAL; | 197 | return -EINVAL; |
201 | } | 198 | } |
202 | 199 | ||
203 | ret = regmap_read(map, PM805_CHIP_ID, &val); | ||
204 | if (ret < 0) { | ||
205 | dev_err(chip->dev, "Failed to read CHIP ID: %d\n", ret); | ||
206 | goto out_irq_init; | ||
207 | } | ||
208 | chip->version = val; | ||
209 | |||
210 | chip->regmap_irq_chip = &pm805_irq_chip; | 200 | chip->regmap_irq_chip = &pm805_irq_chip; |
211 | 201 | ||
212 | ret = device_irq_init_805(chip); | 202 | ret = device_irq_init_805(chip); |
@@ -239,7 +229,7 @@ static int pm805_probe(struct i2c_client *client, | |||
239 | struct pm80x_chip *chip; | 229 | struct pm80x_chip *chip; |
240 | struct pm80x_platform_data *pdata = client->dev.platform_data; | 230 | struct pm80x_platform_data *pdata = client->dev.platform_data; |
241 | 231 | ||
242 | ret = pm80x_init(client, id); | 232 | ret = pm80x_init(client); |
243 | if (ret) { | 233 | if (ret) { |
244 | dev_err(&client->dev, "pm805_init fail!\n"); | 234 | dev_err(&client->dev, "pm805_init fail!\n"); |
245 | goto out_init; | 235 | goto out_init; |
@@ -249,7 +239,7 @@ static int pm805_probe(struct i2c_client *client, | |||
249 | 239 | ||
250 | ret = device_805_init(chip); | 240 | ret = device_805_init(chip); |
251 | if (ret) { | 241 | if (ret) { |
252 | dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id); | 242 | dev_err(chip->dev, "Failed to initialize 88pm805 devices\n"); |
253 | goto err_805_init; | 243 | goto err_805_init; |
254 | } | 244 | } |
255 | 245 | ||
@@ -276,7 +266,7 @@ static int pm805_remove(struct i2c_client *client) | |||
276 | 266 | ||
277 | static struct i2c_driver pm805_driver = { | 267 | static struct i2c_driver pm805_driver = { |
278 | .driver = { | 268 | .driver = { |
279 | .name = "88PM80X", | 269 | .name = "88PM805", |
280 | .owner = THIS_MODULE, | 270 | .owner = THIS_MODULE, |
281 | .pm = &pm80x_pm_ops, | 271 | .pm = &pm80x_pm_ops, |
282 | }, | 272 | }, |
diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index f736a46eb8c0..5e72f65ef94c 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c | |||
@@ -18,6 +18,23 @@ | |||
18 | #include <linux/uaccess.h> | 18 | #include <linux/uaccess.h> |
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | 20 | ||
21 | /* 88pm80x chips have same definition for chip id register. */ | ||
22 | #define PM80X_CHIP_ID (0x00) | ||
23 | #define PM80X_CHIP_ID_NUM(x) (((x) >> 5) & 0x7) | ||
24 | #define PM80X_CHIP_ID_REVISION(x) ((x) & 0x1F) | ||
25 | |||
26 | struct pm80x_chip_mapping { | ||
27 | unsigned int id; | ||
28 | int type; | ||
29 | }; | ||
30 | |||
31 | static struct pm80x_chip_mapping chip_mapping[] = { | ||
32 | /* 88PM800 chip id number */ | ||
33 | {0x3, CHIP_PM800}, | ||
34 | /* 88PM805 chip id number */ | ||
35 | {0x0, CHIP_PM805}, | ||
36 | }; | ||
37 | |||
21 | /* | 38 | /* |
22 | * workaround: some registers needed by pm805 are defined in pm800, so | 39 | * workaround: some registers needed by pm805 are defined in pm800, so |
23 | * need to use this global variable to maintain the relation between | 40 | * need to use this global variable to maintain the relation between |
@@ -31,12 +48,13 @@ const struct regmap_config pm80x_regmap_config = { | |||
31 | }; | 48 | }; |
32 | EXPORT_SYMBOL_GPL(pm80x_regmap_config); | 49 | EXPORT_SYMBOL_GPL(pm80x_regmap_config); |
33 | 50 | ||
34 | int pm80x_init(struct i2c_client *client, | 51 | |
35 | const struct i2c_device_id *id) | 52 | int pm80x_init(struct i2c_client *client) |
36 | { | 53 | { |
37 | struct pm80x_chip *chip; | 54 | struct pm80x_chip *chip; |
38 | struct regmap *map; | 55 | struct regmap *map; |
39 | int ret = 0; | 56 | unsigned int val; |
57 | int i, ret = 0; | ||
40 | 58 | ||
41 | chip = | 59 | chip = |
42 | devm_kzalloc(&client->dev, sizeof(struct pm80x_chip), GFP_KERNEL); | 60 | devm_kzalloc(&client->dev, sizeof(struct pm80x_chip), GFP_KERNEL); |
@@ -51,10 +69,6 @@ int pm80x_init(struct i2c_client *client, | |||
51 | return ret; | 69 | return ret; |
52 | } | 70 | } |
53 | 71 | ||
54 | chip->id = id->driver_data; | ||
55 | if (chip->id < CHIP_PM800 || chip->id > CHIP_PM805) | ||
56 | return -EINVAL; | ||
57 | |||
58 | chip->client = client; | 72 | chip->client = client; |
59 | chip->regmap = map; | 73 | chip->regmap = map; |
60 | 74 | ||
@@ -64,6 +78,25 @@ int pm80x_init(struct i2c_client *client, | |||
64 | dev_set_drvdata(chip->dev, chip); | 78 | dev_set_drvdata(chip->dev, chip); |
65 | i2c_set_clientdata(chip->client, chip); | 79 | i2c_set_clientdata(chip->client, chip); |
66 | 80 | ||
81 | ret = regmap_read(chip->regmap, PM80X_CHIP_ID, &val); | ||
82 | if (ret < 0) { | ||
83 | dev_err(chip->dev, "Failed to read CHIP ID: %d\n", ret); | ||
84 | return ret; | ||
85 | } | ||
86 | |||
87 | for (i = 0; i < ARRAY_SIZE(chip_mapping); i++) { | ||
88 | if (chip_mapping[i].id == PM80X_CHIP_ID_NUM(val)) { | ||
89 | chip->type = chip_mapping[i].type; | ||
90 | break; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | if (i == ARRAY_SIZE(chip_mapping)) { | ||
95 | dev_err(chip->dev, | ||
96 | "Failed to detect Marvell 88PM800:ChipID[0x%x]\n", val); | ||
97 | return -EINVAL; | ||
98 | } | ||
99 | |||
67 | device_init_wakeup(&client->dev, 1); | 100 | device_init_wakeup(&client->dev, 1); |
68 | 101 | ||
69 | /* | 102 | /* |
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 31ca55548ef9..eeb481d426b5 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c | |||
@@ -1150,17 +1150,17 @@ static int pm860x_probe(struct i2c_client *client, | |||
1150 | return -EINVAL; | 1150 | return -EINVAL; |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | chip = kzalloc(sizeof(struct pm860x_chip), GFP_KERNEL); | 1153 | chip = devm_kzalloc(&client->dev, |
1154 | sizeof(struct pm860x_chip), GFP_KERNEL); | ||
1154 | if (chip == NULL) | 1155 | if (chip == NULL) |
1155 | return -ENOMEM; | 1156 | return -ENOMEM; |
1156 | 1157 | ||
1157 | chip->id = verify_addr(client); | 1158 | chip->id = verify_addr(client); |
1158 | chip->regmap = regmap_init_i2c(client, &pm860x_regmap_config); | 1159 | chip->regmap = devm_regmap_init_i2c(client, &pm860x_regmap_config); |
1159 | if (IS_ERR(chip->regmap)) { | 1160 | if (IS_ERR(chip->regmap)) { |
1160 | ret = PTR_ERR(chip->regmap); | 1161 | ret = PTR_ERR(chip->regmap); |
1161 | dev_err(&client->dev, "Failed to allocate register map: %d\n", | 1162 | dev_err(&client->dev, "Failed to allocate register map: %d\n", |
1162 | ret); | 1163 | ret); |
1163 | kfree(chip); | ||
1164 | return ret; | 1164 | return ret; |
1165 | } | 1165 | } |
1166 | chip->client = client; | 1166 | chip->client = client; |
@@ -1203,8 +1203,6 @@ static int pm860x_remove(struct i2c_client *client) | |||
1203 | regmap_exit(chip->regmap_companion); | 1203 | regmap_exit(chip->regmap_companion); |
1204 | i2c_unregister_device(chip->companion); | 1204 | i2c_unregister_device(chip->companion); |
1205 | } | 1205 | } |
1206 | regmap_exit(chip->regmap); | ||
1207 | kfree(chip); | ||
1208 | return 0; | 1206 | return 0; |
1209 | } | 1207 | } |
1210 | 1208 | ||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index d54e985748b7..aecd6ddcbbbf 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -53,7 +53,7 @@ config MFD_CROS_EC | |||
53 | help | 53 | help |
54 | If you say Y here you get support for the ChromeOS Embedded | 54 | If you say Y here you get support for the ChromeOS Embedded |
55 | Controller (EC) providing keyboard, battery and power services. | 55 | Controller (EC) providing keyboard, battery and power services. |
56 | You also ned to enable the driver for the bus you are using. The | 56 | You also need to enable the driver for the bus you are using. The |
57 | protocol for talking to the EC is defined by the bus driver. | 57 | protocol for talking to the EC is defined by the bus driver. |
58 | 58 | ||
59 | config MFD_CROS_EC_I2C | 59 | config MFD_CROS_EC_I2C |
@@ -242,6 +242,27 @@ config MFD_JZ4740_ADC | |||
242 | Say yes here if you want support for the ADC unit in the JZ4740 SoC. | 242 | Say yes here if you want support for the ADC unit in the JZ4740 SoC. |
243 | This driver is necessary for jz4740-battery and jz4740-hwmon driver. | 243 | This driver is necessary for jz4740-battery and jz4740-hwmon driver. |
244 | 244 | ||
245 | config MFD_KEMPLD | ||
246 | tristate "Kontron module PLD device" | ||
247 | select MFD_CORE | ||
248 | help | ||
249 | This is the core driver for the PLD (Programmable Logic Device) found | ||
250 | on some Kontron ETX and COMexpress (ETXexpress) modules. The PLD | ||
251 | device may provide functions like watchdog, GPIO, UART and I2C bus. | ||
252 | |||
253 | The following modules are supported: | ||
254 | * COMe-bIP# | ||
255 | * COMe-bPC2 (ETXexpress-PC) | ||
256 | * COMe-bSC# (ETXexpress-SC T#) | ||
257 | * COMe-cCT6 | ||
258 | * COMe-cDC2 (microETXexpress-DC) | ||
259 | * COMe-cPC2 (microETXexpress-PC) | ||
260 | * COMe-mCT10 | ||
261 | * ETX-OH | ||
262 | |||
263 | This driver can also be built as a module. If so, the module | ||
264 | will be called kempld-core. | ||
265 | |||
245 | config MFD_88PM800 | 266 | config MFD_88PM800 |
246 | tristate "Marvell 88PM800" | 267 | tristate "Marvell 88PM800" |
247 | depends on I2C=y && GENERIC_HARDIRQS | 268 | depends on I2C=y && GENERIC_HARDIRQS |
@@ -342,6 +363,7 @@ config MFD_MAX8998 | |||
342 | bool "Maxim Semiconductor MAX8998/National LP3974 PMIC Support" | 363 | bool "Maxim Semiconductor MAX8998/National LP3974 PMIC Support" |
343 | depends on I2C=y && GENERIC_HARDIRQS | 364 | depends on I2C=y && GENERIC_HARDIRQS |
344 | select MFD_CORE | 365 | select MFD_CORE |
366 | select IRQ_DOMAIN | ||
345 | help | 367 | help |
346 | Say yes here to support for Maxim Semiconductor MAX8998 and | 368 | Say yes here to support for Maxim Semiconductor MAX8998 and |
347 | National Semiconductor LP3974. This is a Power Management IC. | 369 | National Semiconductor LP3974. This is a Power Management IC. |
@@ -419,7 +441,8 @@ config MFD_PM8XXX | |||
419 | 441 | ||
420 | config MFD_PM8921_CORE | 442 | config MFD_PM8921_CORE |
421 | tristate "Qualcomm PM8921 PMIC chip" | 443 | tristate "Qualcomm PM8921 PMIC chip" |
422 | depends on SSBI && BROKEN | 444 | depends on (ARCH_MSM || HEXAGON) |
445 | depends on BROKEN | ||
423 | select MFD_CORE | 446 | select MFD_CORE |
424 | select MFD_PM8XXX | 447 | select MFD_PM8XXX |
425 | help | 448 | help |
@@ -1046,6 +1069,12 @@ config MFD_WM5110 | |||
1046 | help | 1069 | help |
1047 | Support for Wolfson Microelectronics WM5110 low power audio SoC | 1070 | Support for Wolfson Microelectronics WM5110 low power audio SoC |
1048 | 1071 | ||
1072 | config MFD_WM8997 | ||
1073 | bool "Support Wolfson Microelectronics WM8997" | ||
1074 | depends on MFD_ARIZONA | ||
1075 | help | ||
1076 | Support for Wolfson Microelectronics WM8997 low power audio SoC | ||
1077 | |||
1049 | config MFD_WM8400 | 1078 | config MFD_WM8400 |
1050 | bool "Wolfson Microelectronics WM8400" | 1079 | bool "Wolfson Microelectronics WM8400" |
1051 | select MFD_CORE | 1080 | select MFD_CORE |
@@ -1144,7 +1173,8 @@ config MCP_UCB1200_TS | |||
1144 | endmenu | 1173 | endmenu |
1145 | 1174 | ||
1146 | config VEXPRESS_CONFIG | 1175 | config VEXPRESS_CONFIG |
1147 | bool | 1176 | bool "ARM Versatile Express platform infrastructure" |
1177 | depends on ARM || ARM64 | ||
1148 | help | 1178 | help |
1149 | Platform configuration infrastructure for the ARM Ltd. | 1179 | Platform configuration infrastructure for the ARM Ltd. |
1150 | Versatile Express. | 1180 | Versatile Express. |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 718e94a2a9a7..3c90051ffa5a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -43,6 +43,9 @@ endif | |||
43 | ifneq ($(CONFIG_MFD_WM5110),n) | 43 | ifneq ($(CONFIG_MFD_WM5110),n) |
44 | obj-$(CONFIG_MFD_ARIZONA) += wm5110-tables.o | 44 | obj-$(CONFIG_MFD_ARIZONA) += wm5110-tables.o |
45 | endif | 45 | endif |
46 | ifneq ($(CONFIG_MFD_WM8997),n) | ||
47 | obj-$(CONFIG_MFD_ARIZONA) += wm8997-tables.o | ||
48 | endif | ||
46 | obj-$(CONFIG_MFD_WM8400) += wm8400-core.o | 49 | obj-$(CONFIG_MFD_WM8400) += wm8400-core.o |
47 | wm831x-objs := wm831x-core.o wm831x-irq.o wm831x-otp.o | 50 | wm831x-objs := wm831x-core.o wm831x-irq.o wm831x-otp.o |
48 | wm831x-objs += wm831x-auxadc.o | 51 | wm831x-objs += wm831x-auxadc.o |
@@ -126,6 +129,7 @@ obj-$(CONFIG_MFD_DB8500_PRCMU) += db8500-prcmu.o | |||
126 | obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o | 129 | obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o |
127 | obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o | 130 | obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o |
128 | obj-$(CONFIG_PMIC_ADP5520) += adp5520.o | 131 | obj-$(CONFIG_PMIC_ADP5520) += adp5520.o |
132 | obj-$(CONFIG_MFD_KEMPLD) += kempld-core.o | ||
129 | obj-$(CONFIG_LPC_SCH) += lpc_sch.o | 133 | obj-$(CONFIG_LPC_SCH) += lpc_sch.o |
130 | obj-$(CONFIG_LPC_ICH) += lpc_ich.o | 134 | obj-$(CONFIG_LPC_ICH) += lpc_ich.o |
131 | obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o | 135 | obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o |
@@ -140,7 +144,7 @@ obj-$(CONFIG_MFD_SI476X_CORE) += si476x-core.o | |||
140 | 144 | ||
141 | obj-$(CONFIG_MFD_CS5535) += cs5535-mfd.o | 145 | obj-$(CONFIG_MFD_CS5535) += cs5535-mfd.o |
142 | obj-$(CONFIG_MFD_OMAP_USB_HOST) += omap-usb-host.o omap-usb-tll.o | 146 | obj-$(CONFIG_MFD_OMAP_USB_HOST) += omap-usb-host.o omap-usb-tll.o |
143 | obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o | 147 | obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o ssbi.o |
144 | obj-$(CONFIG_MFD_PM8XXX_IRQ) += pm8xxx-irq.o | 148 | obj-$(CONFIG_MFD_PM8XXX_IRQ) += pm8xxx-irq.o |
145 | obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o | 149 | obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o |
146 | obj-$(CONFIG_MFD_TPS65090) += tps65090.o | 150 | obj-$(CONFIG_MFD_TPS65090) += tps65090.o |
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index dfdb0a2b6835..d4f594517521 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c | |||
@@ -312,8 +312,9 @@ static ssize_t aat2870_reg_write_file(struct file *file, | |||
312 | while (*start == ' ') | 312 | while (*start == ' ') |
313 | start++; | 313 | start++; |
314 | 314 | ||
315 | if (strict_strtoul(start, 16, &val)) | 315 | ret = kstrtoul(start, 16, &val); |
316 | return -EINVAL; | 316 | if (ret) |
317 | return ret; | ||
317 | 318 | ||
318 | ret = aat2870->write(aat2870, (u8)addr, (u8)val); | 319 | ret = aat2870->write(aat2870, (u8)addr, (u8)val); |
319 | if (ret) | 320 | if (ret) |
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index a9bb140bc86b..ddc669d19530 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c | |||
@@ -491,7 +491,7 @@ static ssize_t ab3100_get_set_reg(struct file *file, | |||
491 | char buf[32]; | 491 | char buf[32]; |
492 | ssize_t buf_size; | 492 | ssize_t buf_size; |
493 | int regp; | 493 | int regp; |
494 | unsigned long user_reg; | 494 | u8 user_reg; |
495 | int err; | 495 | int err; |
496 | int i = 0; | 496 | int i = 0; |
497 | 497 | ||
@@ -514,34 +514,29 @@ static ssize_t ab3100_get_set_reg(struct file *file, | |||
514 | /* | 514 | /* |
515 | * Advance pointer to end of string then terminate | 515 | * Advance pointer to end of string then terminate |
516 | * the register string. This is needed to satisfy | 516 | * the register string. This is needed to satisfy |
517 | * the strict_strtoul() function. | 517 | * the kstrtou8() function. |
518 | */ | 518 | */ |
519 | while ((i < buf_size) && (buf[i] != ' ')) | 519 | while ((i < buf_size) && (buf[i] != ' ')) |
520 | i++; | 520 | i++; |
521 | buf[i] = '\0'; | 521 | buf[i] = '\0'; |
522 | 522 | ||
523 | err = strict_strtoul(&buf[regp], 16, &user_reg); | 523 | err = kstrtou8(&buf[regp], 16, &user_reg); |
524 | if (err) | 524 | if (err) |
525 | return err; | 525 | return err; |
526 | if (user_reg > 0xff) | ||
527 | return -EINVAL; | ||
528 | 526 | ||
529 | /* Either we read or we write a register here */ | 527 | /* Either we read or we write a register here */ |
530 | if (!priv->mode) { | 528 | if (!priv->mode) { |
531 | /* Reading */ | 529 | /* Reading */ |
532 | u8 reg = (u8) user_reg; | ||
533 | u8 regvalue; | 530 | u8 regvalue; |
534 | 531 | ||
535 | ab3100_get_register_interruptible(ab3100, reg, ®value); | 532 | ab3100_get_register_interruptible(ab3100, user_reg, ®value); |
536 | 533 | ||
537 | dev_info(ab3100->dev, | 534 | dev_info(ab3100->dev, |
538 | "debug read AB3100 reg[0x%02x]: 0x%02x\n", | 535 | "debug read AB3100 reg[0x%02x]: 0x%02x\n", |
539 | reg, regvalue); | 536 | user_reg, regvalue); |
540 | } else { | 537 | } else { |
541 | int valp; | 538 | int valp; |
542 | unsigned long user_value; | 539 | u8 user_value; |
543 | u8 reg = (u8) user_reg; | ||
544 | u8 value; | ||
545 | u8 regvalue; | 540 | u8 regvalue; |
546 | 541 | ||
547 | /* | 542 | /* |
@@ -557,20 +552,17 @@ static ssize_t ab3100_get_set_reg(struct file *file, | |||
557 | i++; | 552 | i++; |
558 | buf[i] = '\0'; | 553 | buf[i] = '\0'; |
559 | 554 | ||
560 | err = strict_strtoul(&buf[valp], 16, &user_value); | 555 | err = kstrtou8(&buf[valp], 16, &user_value); |
561 | if (err) | 556 | if (err) |
562 | return err; | 557 | return err; |
563 | if (user_reg > 0xff) | ||
564 | return -EINVAL; | ||
565 | 558 | ||
566 | value = (u8) user_value; | 559 | ab3100_set_register_interruptible(ab3100, user_reg, user_value); |
567 | ab3100_set_register_interruptible(ab3100, reg, value); | 560 | ab3100_get_register_interruptible(ab3100, user_reg, ®value); |
568 | ab3100_get_register_interruptible(ab3100, reg, ®value); | ||
569 | 561 | ||
570 | dev_info(ab3100->dev, | 562 | dev_info(ab3100->dev, |
571 | "debug write reg[0x%02x] with 0x%02x, " | 563 | "debug write reg[0x%02x] with 0x%02x, " |
572 | "after readback: 0x%02x\n", | 564 | "after readback: 0x%02x\n", |
573 | reg, value, regvalue); | 565 | user_reg, user_value, regvalue); |
574 | } | 566 | } |
575 | return buf_size; | 567 | return buf_size; |
576 | } | 568 | } |
diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c index d7ce016029fa..c9af16cc7310 100644 --- a/drivers/mfd/ab3100-otp.c +++ b/drivers/mfd/ab3100-otp.c | |||
@@ -187,7 +187,7 @@ static int __init ab3100_otp_probe(struct platform_device *pdev) | |||
187 | int err = 0; | 187 | int err = 0; |
188 | int i; | 188 | int i; |
189 | 189 | ||
190 | otp = kzalloc(sizeof(struct ab3100_otp), GFP_KERNEL); | 190 | otp = devm_kzalloc(&pdev->dev, sizeof(struct ab3100_otp), GFP_KERNEL); |
191 | if (!otp) { | 191 | if (!otp) { |
192 | dev_err(&pdev->dev, "could not allocate AB3100 OTP device\n"); | 192 | dev_err(&pdev->dev, "could not allocate AB3100 OTP device\n"); |
193 | return -ENOMEM; | 193 | return -ENOMEM; |
@@ -199,7 +199,7 @@ static int __init ab3100_otp_probe(struct platform_device *pdev) | |||
199 | 199 | ||
200 | err = ab3100_otp_read(otp); | 200 | err = ab3100_otp_read(otp); |
201 | if (err) | 201 | if (err) |
202 | goto err_otp_read; | 202 | return err; |
203 | 203 | ||
204 | dev_info(&pdev->dev, "AB3100 OTP readout registered\n"); | 204 | dev_info(&pdev->dev, "AB3100 OTP readout registered\n"); |
205 | 205 | ||
@@ -208,22 +208,19 @@ static int __init ab3100_otp_probe(struct platform_device *pdev) | |||
208 | err = device_create_file(&pdev->dev, | 208 | err = device_create_file(&pdev->dev, |
209 | &ab3100_otp_attrs[i]); | 209 | &ab3100_otp_attrs[i]); |
210 | if (err) | 210 | if (err) |
211 | goto err_create_file; | 211 | goto err; |
212 | } | 212 | } |
213 | 213 | ||
214 | /* debugfs entries */ | 214 | /* debugfs entries */ |
215 | err = ab3100_otp_init_debugfs(&pdev->dev, otp); | 215 | err = ab3100_otp_init_debugfs(&pdev->dev, otp); |
216 | if (err) | 216 | if (err) |
217 | goto err_init_debugfs; | 217 | goto err; |
218 | 218 | ||
219 | return 0; | 219 | return 0; |
220 | 220 | ||
221 | err_init_debugfs: | 221 | err: |
222 | err_create_file: | ||
223 | while (--i >= 0) | 222 | while (--i >= 0) |
224 | device_remove_file(&pdev->dev, &ab3100_otp_attrs[i]); | 223 | device_remove_file(&pdev->dev, &ab3100_otp_attrs[i]); |
225 | err_otp_read: | ||
226 | kfree(otp); | ||
227 | return err; | 224 | return err; |
228 | } | 225 | } |
229 | 226 | ||
@@ -236,7 +233,6 @@ static int __exit ab3100_otp_remove(struct platform_device *pdev) | |||
236 | device_remove_file(&pdev->dev, | 233 | device_remove_file(&pdev->dev, |
237 | &ab3100_otp_attrs[i]); | 234 | &ab3100_otp_attrs[i]); |
238 | ab3100_otp_exit_debugfs(otp); | 235 | ab3100_otp_exit_debugfs(otp); |
239 | kfree(otp); | ||
240 | return 0; | 236 | return 0; |
241 | } | 237 | } |
242 | 238 | ||
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 258b367e3989..b6c2cdc76091 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -650,6 +650,21 @@ static struct resource ab8500_rtc_resources[] = { | |||
650 | }, | 650 | }, |
651 | }; | 651 | }; |
652 | 652 | ||
653 | static struct resource ab8540_rtc_resources[] = { | ||
654 | { | ||
655 | .name = "1S", | ||
656 | .start = AB8540_INT_RTC_1S, | ||
657 | .end = AB8540_INT_RTC_1S, | ||
658 | .flags = IORESOURCE_IRQ, | ||
659 | }, | ||
660 | { | ||
661 | .name = "ALARM", | ||
662 | .start = AB8500_INT_RTC_ALARM, | ||
663 | .end = AB8500_INT_RTC_ALARM, | ||
664 | .flags = IORESOURCE_IRQ, | ||
665 | }, | ||
666 | }; | ||
667 | |||
653 | static struct resource ab8500_poweronkey_db_resources[] = { | 668 | static struct resource ab8500_poweronkey_db_resources[] = { |
654 | { | 669 | { |
655 | .name = "ONKEY_DBF", | 670 | .name = "ONKEY_DBF", |
@@ -1051,6 +1066,10 @@ static struct mfd_cell ab8500_devs[] = { | |||
1051 | .of_compatible = "stericsson,ab8500-sysctrl", | 1066 | .of_compatible = "stericsson,ab8500-sysctrl", |
1052 | }, | 1067 | }, |
1053 | { | 1068 | { |
1069 | .name = "ab8500-ext-regulator", | ||
1070 | .of_compatible = "stericsson,ab8500-ext-regulator", | ||
1071 | }, | ||
1072 | { | ||
1054 | .name = "ab8500-regulator", | 1073 | .name = "ab8500-regulator", |
1055 | .of_compatible = "stericsson,ab8500-regulator", | 1074 | .of_compatible = "stericsson,ab8500-regulator", |
1056 | }, | 1075 | }, |
@@ -1099,10 +1118,6 @@ static struct mfd_cell ab8500_devs[] = { | |||
1099 | .id = 3, | 1118 | .id = 3, |
1100 | }, | 1119 | }, |
1101 | { | 1120 | { |
1102 | .name = "ab8500-leds", | ||
1103 | .of_compatible = "stericsson,ab8500-leds", | ||
1104 | }, | ||
1105 | { | ||
1106 | .name = "ab8500-denc", | 1121 | .name = "ab8500-denc", |
1107 | .of_compatible = "stericsson,ab8500-denc", | 1122 | .of_compatible = "stericsson,ab8500-denc", |
1108 | }, | 1123 | }, |
@@ -1124,6 +1139,7 @@ static struct mfd_cell ab8500_devs[] = { | |||
1124 | }, | 1139 | }, |
1125 | { | 1140 | { |
1126 | .name = "ab8500-codec", | 1141 | .name = "ab8500-codec", |
1142 | .of_compatible = "stericsson,ab8500-codec", | ||
1127 | }, | 1143 | }, |
1128 | }; | 1144 | }; |
1129 | 1145 | ||
@@ -1139,6 +1155,9 @@ static struct mfd_cell ab9540_devs[] = { | |||
1139 | .name = "ab8500-sysctrl", | 1155 | .name = "ab8500-sysctrl", |
1140 | }, | 1156 | }, |
1141 | { | 1157 | { |
1158 | .name = "ab8500-ext-regulator", | ||
1159 | }, | ||
1160 | { | ||
1142 | .name = "ab8500-regulator", | 1161 | .name = "ab8500-regulator", |
1143 | }, | 1162 | }, |
1144 | { | 1163 | { |
@@ -1171,9 +1190,6 @@ static struct mfd_cell ab9540_devs[] = { | |||
1171 | .id = 1, | 1190 | .id = 1, |
1172 | }, | 1191 | }, |
1173 | { | 1192 | { |
1174 | .name = "ab8500-leds", | ||
1175 | }, | ||
1176 | { | ||
1177 | .name = "abx500-temp", | 1193 | .name = "abx500-temp", |
1178 | .num_resources = ARRAY_SIZE(ab8500_temp_resources), | 1194 | .num_resources = ARRAY_SIZE(ab8500_temp_resources), |
1179 | .resources = ab8500_temp_resources, | 1195 | .resources = ab8500_temp_resources, |
@@ -1242,9 +1258,6 @@ static struct mfd_cell ab8505_devs[] = { | |||
1242 | .id = 1, | 1258 | .id = 1, |
1243 | }, | 1259 | }, |
1244 | { | 1260 | { |
1245 | .name = "ab8500-leds", | ||
1246 | }, | ||
1247 | { | ||
1248 | .name = "pinctrl-ab8505", | 1261 | .name = "pinctrl-ab8505", |
1249 | }, | 1262 | }, |
1250 | { | 1263 | { |
@@ -1274,6 +1287,9 @@ static struct mfd_cell ab8540_devs[] = { | |||
1274 | .name = "ab8500-sysctrl", | 1287 | .name = "ab8500-sysctrl", |
1275 | }, | 1288 | }, |
1276 | { | 1289 | { |
1290 | .name = "ab8500-ext-regulator", | ||
1291 | }, | ||
1292 | { | ||
1277 | .name = "ab8500-regulator", | 1293 | .name = "ab8500-regulator", |
1278 | }, | 1294 | }, |
1279 | { | 1295 | { |
@@ -1287,11 +1303,6 @@ static struct mfd_cell ab8540_devs[] = { | |||
1287 | .resources = ab8505_gpadc_resources, | 1303 | .resources = ab8505_gpadc_resources, |
1288 | }, | 1304 | }, |
1289 | { | 1305 | { |
1290 | .name = "ab8500-rtc", | ||
1291 | .num_resources = ARRAY_SIZE(ab8500_rtc_resources), | ||
1292 | .resources = ab8500_rtc_resources, | ||
1293 | }, | ||
1294 | { | ||
1295 | .name = "ab8500-acc-det", | 1306 | .name = "ab8500-acc-det", |
1296 | .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), | 1307 | .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), |
1297 | .resources = ab8500_av_acc_detect_resources, | 1308 | .resources = ab8500_av_acc_detect_resources, |
@@ -1306,9 +1317,6 @@ static struct mfd_cell ab8540_devs[] = { | |||
1306 | .id = 1, | 1317 | .id = 1, |
1307 | }, | 1318 | }, |
1308 | { | 1319 | { |
1309 | .name = "ab8500-leds", | ||
1310 | }, | ||
1311 | { | ||
1312 | .name = "abx500-temp", | 1320 | .name = "abx500-temp", |
1313 | .num_resources = ARRAY_SIZE(ab8500_temp_resources), | 1321 | .num_resources = ARRAY_SIZE(ab8500_temp_resources), |
1314 | .resources = ab8500_temp_resources, | 1322 | .resources = ab8500_temp_resources, |
@@ -1331,6 +1339,24 @@ static struct mfd_cell ab8540_devs[] = { | |||
1331 | }, | 1339 | }, |
1332 | }; | 1340 | }; |
1333 | 1341 | ||
1342 | static struct mfd_cell ab8540_cut1_devs[] = { | ||
1343 | { | ||
1344 | .name = "ab8500-rtc", | ||
1345 | .of_compatible = "stericsson,ab8500-rtc", | ||
1346 | .num_resources = ARRAY_SIZE(ab8500_rtc_resources), | ||
1347 | .resources = ab8500_rtc_resources, | ||
1348 | }, | ||
1349 | }; | ||
1350 | |||
1351 | static struct mfd_cell ab8540_cut2_devs[] = { | ||
1352 | { | ||
1353 | .name = "ab8540-rtc", | ||
1354 | .of_compatible = "stericsson,ab8540-rtc", | ||
1355 | .num_resources = ARRAY_SIZE(ab8540_rtc_resources), | ||
1356 | .resources = ab8540_rtc_resources, | ||
1357 | }, | ||
1358 | }; | ||
1359 | |||
1334 | static ssize_t show_chip_id(struct device *dev, | 1360 | static ssize_t show_chip_id(struct device *dev, |
1335 | struct device_attribute *attr, char *buf) | 1361 | struct device_attribute *attr, char *buf) |
1336 | { | 1362 | { |
@@ -1734,11 +1760,22 @@ static int ab8500_probe(struct platform_device *pdev) | |||
1734 | ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, | 1760 | ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, |
1735 | ARRAY_SIZE(ab9540_devs), NULL, | 1761 | ARRAY_SIZE(ab9540_devs), NULL, |
1736 | ab8500->irq_base, ab8500->domain); | 1762 | ab8500->irq_base, ab8500->domain); |
1737 | else if (is_ab8540(ab8500)) | 1763 | else if (is_ab8540(ab8500)) { |
1738 | ret = mfd_add_devices(ab8500->dev, 0, ab8540_devs, | 1764 | ret = mfd_add_devices(ab8500->dev, 0, ab8540_devs, |
1739 | ARRAY_SIZE(ab8540_devs), NULL, | 1765 | ARRAY_SIZE(ab8540_devs), NULL, |
1740 | ab8500->irq_base, ab8500->domain); | 1766 | ab8500->irq_base, NULL); |
1741 | else if (is_ab8505(ab8500)) | 1767 | if (ret) |
1768 | return ret; | ||
1769 | |||
1770 | if (is_ab8540_1p2_or_earlier(ab8500)) | ||
1771 | ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut1_devs, | ||
1772 | ARRAY_SIZE(ab8540_cut1_devs), NULL, | ||
1773 | ab8500->irq_base, NULL); | ||
1774 | else /* ab8540 >= cut2 */ | ||
1775 | ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut2_devs, | ||
1776 | ARRAY_SIZE(ab8540_cut2_devs), NULL, | ||
1777 | ab8500->irq_base, NULL); | ||
1778 | } else if (is_ab8505(ab8500)) | ||
1742 | ret = mfd_add_devices(ab8500->dev, 0, ab8505_devs, | 1779 | ret = mfd_add_devices(ab8500->dev, 0, ab8505_devs, |
1743 | ARRAY_SIZE(ab8505_devs), NULL, | 1780 | ARRAY_SIZE(ab8505_devs), NULL, |
1744 | ab8500->irq_base, ab8500->domain); | 1781 | ab8500->irq_base, ab8500->domain); |
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 37b7ce4c7c3b..7d1f1b08fc4b 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c | |||
@@ -2757,7 +2757,7 @@ static ssize_t show_irq(struct device *dev, | |||
2757 | unsigned int irq_index; | 2757 | unsigned int irq_index; |
2758 | int err; | 2758 | int err; |
2759 | 2759 | ||
2760 | err = strict_strtoul(attr->attr.name, 0, &name); | 2760 | err = kstrtoul(attr->attr.name, 0, &name); |
2761 | if (err) | 2761 | if (err) |
2762 | return err; | 2762 | return err; |
2763 | 2763 | ||
@@ -2937,7 +2937,6 @@ static struct dentry *ab8500_gpadc_dir; | |||
2937 | static int ab8500_debug_probe(struct platform_device *plf) | 2937 | static int ab8500_debug_probe(struct platform_device *plf) |
2938 | { | 2938 | { |
2939 | struct dentry *file; | 2939 | struct dentry *file; |
2940 | int ret = -ENOMEM; | ||
2941 | struct ab8500 *ab8500; | 2940 | struct ab8500 *ab8500; |
2942 | struct resource *res; | 2941 | struct resource *res; |
2943 | debug_bank = AB8500_MISC; | 2942 | debug_bank = AB8500_MISC; |
@@ -2946,24 +2945,26 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2946 | ab8500 = dev_get_drvdata(plf->dev.parent); | 2945 | ab8500 = dev_get_drvdata(plf->dev.parent); |
2947 | num_irqs = ab8500->mask_size; | 2946 | num_irqs = ab8500->mask_size; |
2948 | 2947 | ||
2949 | irq_count = kzalloc(sizeof(*irq_count)*num_irqs, GFP_KERNEL); | 2948 | irq_count = devm_kzalloc(&plf->dev, |
2949 | sizeof(*irq_count)*num_irqs, GFP_KERNEL); | ||
2950 | if (!irq_count) | 2950 | if (!irq_count) |
2951 | return -ENOMEM; | 2951 | return -ENOMEM; |
2952 | 2952 | ||
2953 | dev_attr = kzalloc(sizeof(*dev_attr)*num_irqs,GFP_KERNEL); | 2953 | dev_attr = devm_kzalloc(&plf->dev, |
2954 | sizeof(*dev_attr)*num_irqs,GFP_KERNEL); | ||
2954 | if (!dev_attr) | 2955 | if (!dev_attr) |
2955 | goto out_freeirq_count; | 2956 | return -ENOMEM; |
2956 | 2957 | ||
2957 | event_name = kzalloc(sizeof(*event_name)*num_irqs, GFP_KERNEL); | 2958 | event_name = devm_kzalloc(&plf->dev, |
2959 | sizeof(*event_name)*num_irqs, GFP_KERNEL); | ||
2958 | if (!event_name) | 2960 | if (!event_name) |
2959 | goto out_freedev_attr; | 2961 | return -ENOMEM; |
2960 | 2962 | ||
2961 | res = platform_get_resource_byname(plf, 0, "IRQ_AB8500"); | 2963 | res = platform_get_resource_byname(plf, 0, "IRQ_AB8500"); |
2962 | if (!res) { | 2964 | if (!res) { |
2963 | dev_err(&plf->dev, "AB8500 irq not found, err %d\n", | 2965 | dev_err(&plf->dev, "AB8500 irq not found, err %d\n", |
2964 | irq_first); | 2966 | irq_first); |
2965 | ret = -ENXIO; | 2967 | return ENXIO; |
2966 | goto out_freeevent_name; | ||
2967 | } | 2968 | } |
2968 | irq_ab8500 = res->start; | 2969 | irq_ab8500 = res->start; |
2969 | 2970 | ||
@@ -2971,16 +2972,14 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2971 | if (irq_first < 0) { | 2972 | if (irq_first < 0) { |
2972 | dev_err(&plf->dev, "First irq not found, err %d\n", | 2973 | dev_err(&plf->dev, "First irq not found, err %d\n", |
2973 | irq_first); | 2974 | irq_first); |
2974 | ret = irq_first; | 2975 | return irq_first; |
2975 | goto out_freeevent_name; | ||
2976 | } | 2976 | } |
2977 | 2977 | ||
2978 | irq_last = platform_get_irq_byname(plf, "IRQ_LAST"); | 2978 | irq_last = platform_get_irq_byname(plf, "IRQ_LAST"); |
2979 | if (irq_last < 0) { | 2979 | if (irq_last < 0) { |
2980 | dev_err(&plf->dev, "Last irq not found, err %d\n", | 2980 | dev_err(&plf->dev, "Last irq not found, err %d\n", |
2981 | irq_last); | 2981 | irq_last); |
2982 | ret = irq_last; | 2982 | return irq_last; |
2983 | goto out_freeevent_name; | ||
2984 | } | 2983 | } |
2985 | 2984 | ||
2986 | ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL); | 2985 | ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL); |
@@ -3189,22 +3188,13 @@ err: | |||
3189 | if (ab8500_dir) | 3188 | if (ab8500_dir) |
3190 | debugfs_remove_recursive(ab8500_dir); | 3189 | debugfs_remove_recursive(ab8500_dir); |
3191 | dev_err(&plf->dev, "failed to create debugfs entries.\n"); | 3190 | dev_err(&plf->dev, "failed to create debugfs entries.\n"); |
3192 | out_freeevent_name: | ||
3193 | kfree(event_name); | ||
3194 | out_freedev_attr: | ||
3195 | kfree(dev_attr); | ||
3196 | out_freeirq_count: | ||
3197 | kfree(irq_count); | ||
3198 | 3191 | ||
3199 | return ret; | 3192 | return -ENOMEM; |
3200 | } | 3193 | } |
3201 | 3194 | ||
3202 | static int ab8500_debug_remove(struct platform_device *plf) | 3195 | static int ab8500_debug_remove(struct platform_device *plf) |
3203 | { | 3196 | { |
3204 | debugfs_remove_recursive(ab8500_dir); | 3197 | debugfs_remove_recursive(ab8500_dir); |
3205 | kfree(event_name); | ||
3206 | kfree(dev_attr); | ||
3207 | kfree(irq_count); | ||
3208 | 3198 | ||
3209 | return 0; | 3199 | return 0; |
3210 | } | 3200 | } |
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index 3598b0ecf8c7..7623e9123828 100644 --- a/drivers/mfd/ab8500-gpadc.c +++ b/drivers/mfd/ab8500-gpadc.c | |||
@@ -919,7 +919,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
919 | int ret = 0; | 919 | int ret = 0; |
920 | struct ab8500_gpadc *gpadc; | 920 | struct ab8500_gpadc *gpadc; |
921 | 921 | ||
922 | gpadc = kzalloc(sizeof(struct ab8500_gpadc), GFP_KERNEL); | 922 | gpadc = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_gpadc), GFP_KERNEL); |
923 | if (!gpadc) { | 923 | if (!gpadc) { |
924 | dev_err(&pdev->dev, "Error: No memory\n"); | 924 | dev_err(&pdev->dev, "Error: No memory\n"); |
925 | return -ENOMEM; | 925 | return -ENOMEM; |
@@ -999,8 +999,6 @@ fail_irq: | |||
999 | free_irq(gpadc->irq_sw, gpadc); | 999 | free_irq(gpadc->irq_sw, gpadc); |
1000 | free_irq(gpadc->irq_hw, gpadc); | 1000 | free_irq(gpadc->irq_hw, gpadc); |
1001 | fail: | 1001 | fail: |
1002 | kfree(gpadc); | ||
1003 | gpadc = NULL; | ||
1004 | return ret; | 1002 | return ret; |
1005 | } | 1003 | } |
1006 | 1004 | ||
@@ -1025,8 +1023,6 @@ static int ab8500_gpadc_remove(struct platform_device *pdev) | |||
1025 | 1023 | ||
1026 | pm_runtime_put_noidle(gpadc->dev); | 1024 | pm_runtime_put_noidle(gpadc->dev); |
1027 | 1025 | ||
1028 | kfree(gpadc); | ||
1029 | gpadc = NULL; | ||
1030 | return 0; | 1026 | return 0; |
1031 | } | 1027 | } |
1032 | 1028 | ||
diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c index 3714acb61458..f3a15aa54d7b 100644 --- a/drivers/mfd/abx500-core.c +++ b/drivers/mfd/abx500-core.c | |||
@@ -36,7 +36,9 @@ int abx500_register_ops(struct device *dev, struct abx500_ops *ops) | |||
36 | { | 36 | { |
37 | struct abx500_device_entry *dev_entry; | 37 | struct abx500_device_entry *dev_entry; |
38 | 38 | ||
39 | dev_entry = kzalloc(sizeof(struct abx500_device_entry), GFP_KERNEL); | 39 | dev_entry = devm_kzalloc(dev, |
40 | sizeof(struct abx500_device_entry), | ||
41 | GFP_KERNEL); | ||
40 | if (!dev_entry) { | 42 | if (!dev_entry) { |
41 | dev_err(dev, "register_ops kzalloc failed"); | 43 | dev_err(dev, "register_ops kzalloc failed"); |
42 | return -ENOMEM; | 44 | return -ENOMEM; |
@@ -54,12 +56,8 @@ void abx500_remove_ops(struct device *dev) | |||
54 | struct abx500_device_entry *dev_entry, *tmp; | 56 | struct abx500_device_entry *dev_entry, *tmp; |
55 | 57 | ||
56 | list_for_each_entry_safe(dev_entry, tmp, &abx500_list, list) | 58 | list_for_each_entry_safe(dev_entry, tmp, &abx500_list, list) |
57 | { | 59 | if (dev_entry->dev == dev) |
58 | if (dev_entry->dev == dev) { | ||
59 | list_del(&dev_entry->list); | 60 | list_del(&dev_entry->list); |
60 | kfree(dev_entry); | ||
61 | } | ||
62 | } | ||
63 | } | 61 | } |
64 | EXPORT_SYMBOL(abx500_remove_ops); | 62 | EXPORT_SYMBOL(abx500_remove_ops); |
65 | 63 | ||
diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c index 0d2eba023439..28346ad0b4a6 100644 --- a/drivers/mfd/adp5520.c +++ b/drivers/mfd/adp5520.c | |||
@@ -223,7 +223,7 @@ static int adp5520_probe(struct i2c_client *client, | |||
223 | return -ENODEV; | 223 | return -ENODEV; |
224 | } | 224 | } |
225 | 225 | ||
226 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 226 | chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); |
227 | if (!chip) | 227 | if (!chip) |
228 | return -ENOMEM; | 228 | return -ENOMEM; |
229 | 229 | ||
@@ -244,7 +244,7 @@ static int adp5520_probe(struct i2c_client *client, | |||
244 | if (ret) { | 244 | if (ret) { |
245 | dev_err(&client->dev, "failed to request irq %d\n", | 245 | dev_err(&client->dev, "failed to request irq %d\n", |
246 | chip->irq); | 246 | chip->irq); |
247 | goto out_free_chip; | 247 | return ret; |
248 | } | 248 | } |
249 | } | 249 | } |
250 | 250 | ||
@@ -302,9 +302,6 @@ out_free_irq: | |||
302 | if (chip->irq) | 302 | if (chip->irq) |
303 | free_irq(chip->irq, chip); | 303 | free_irq(chip->irq, chip); |
304 | 304 | ||
305 | out_free_chip: | ||
306 | kfree(chip); | ||
307 | |||
308 | return ret; | 305 | return ret; |
309 | } | 306 | } |
310 | 307 | ||
@@ -317,7 +314,6 @@ static int adp5520_remove(struct i2c_client *client) | |||
317 | 314 | ||
318 | adp5520_remove_subdevs(chip); | 315 | adp5520_remove_subdevs(chip); |
319 | adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0); | 316 | adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0); |
320 | kfree(chip); | ||
321 | return 0; | 317 | return 0; |
322 | } | 318 | } |
323 | 319 | ||
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 74b4481754fd..89a115301a0c 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c | |||
@@ -554,6 +554,7 @@ static int arizona_of_get_core_pdata(struct arizona *arizona) | |||
554 | const struct of_device_id arizona_of_match[] = { | 554 | const struct of_device_id arizona_of_match[] = { |
555 | { .compatible = "wlf,wm5102", .data = (void *)WM5102 }, | 555 | { .compatible = "wlf,wm5102", .data = (void *)WM5102 }, |
556 | { .compatible = "wlf,wm5110", .data = (void *)WM5110 }, | 556 | { .compatible = "wlf,wm5110", .data = (void *)WM5110 }, |
557 | { .compatible = "wlf,wm8997", .data = (void *)WM8997 }, | ||
557 | {}, | 558 | {}, |
558 | }; | 559 | }; |
559 | EXPORT_SYMBOL_GPL(arizona_of_match); | 560 | EXPORT_SYMBOL_GPL(arizona_of_match); |
@@ -586,6 +587,15 @@ static struct mfd_cell wm5110_devs[] = { | |||
586 | { .name = "wm5110-codec" }, | 587 | { .name = "wm5110-codec" }, |
587 | }; | 588 | }; |
588 | 589 | ||
590 | static struct mfd_cell wm8997_devs[] = { | ||
591 | { .name = "arizona-micsupp" }, | ||
592 | { .name = "arizona-extcon" }, | ||
593 | { .name = "arizona-gpio" }, | ||
594 | { .name = "arizona-haptics" }, | ||
595 | { .name = "arizona-pwm" }, | ||
596 | { .name = "wm8997-codec" }, | ||
597 | }; | ||
598 | |||
589 | int arizona_dev_init(struct arizona *arizona) | 599 | int arizona_dev_init(struct arizona *arizona) |
590 | { | 600 | { |
591 | struct device *dev = arizona->dev; | 601 | struct device *dev = arizona->dev; |
@@ -608,6 +618,7 @@ int arizona_dev_init(struct arizona *arizona) | |||
608 | switch (arizona->type) { | 618 | switch (arizona->type) { |
609 | case WM5102: | 619 | case WM5102: |
610 | case WM5110: | 620 | case WM5110: |
621 | case WM8997: | ||
611 | for (i = 0; i < ARRAY_SIZE(wm5102_core_supplies); i++) | 622 | for (i = 0; i < ARRAY_SIZE(wm5102_core_supplies); i++) |
612 | arizona->core_supplies[i].supply | 623 | arizona->core_supplies[i].supply |
613 | = wm5102_core_supplies[i]; | 624 | = wm5102_core_supplies[i]; |
@@ -683,6 +694,7 @@ int arizona_dev_init(struct arizona *arizona) | |||
683 | switch (reg) { | 694 | switch (reg) { |
684 | case 0x5102: | 695 | case 0x5102: |
685 | case 0x5110: | 696 | case 0x5110: |
697 | case 0x8997: | ||
686 | break; | 698 | break; |
687 | default: | 699 | default: |
688 | dev_err(arizona->dev, "Unknown device ID: %x\n", reg); | 700 | dev_err(arizona->dev, "Unknown device ID: %x\n", reg); |
@@ -768,6 +780,17 @@ int arizona_dev_init(struct arizona *arizona) | |||
768 | apply_patch = wm5110_patch; | 780 | apply_patch = wm5110_patch; |
769 | break; | 781 | break; |
770 | #endif | 782 | #endif |
783 | #ifdef CONFIG_MFD_WM8997 | ||
784 | case 0x8997: | ||
785 | type_name = "WM8997"; | ||
786 | if (arizona->type != WM8997) { | ||
787 | dev_err(arizona->dev, "WM8997 registered as %d\n", | ||
788 | arizona->type); | ||
789 | arizona->type = WM8997; | ||
790 | } | ||
791 | apply_patch = wm8997_patch; | ||
792 | break; | ||
793 | #endif | ||
771 | default: | 794 | default: |
772 | dev_err(arizona->dev, "Unknown device ID %x\n", reg); | 795 | dev_err(arizona->dev, "Unknown device ID %x\n", reg); |
773 | goto err_reset; | 796 | goto err_reset; |
@@ -934,6 +957,10 @@ int arizona_dev_init(struct arizona *arizona) | |||
934 | ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, | 957 | ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, |
935 | ARRAY_SIZE(wm5110_devs), NULL, 0, NULL); | 958 | ARRAY_SIZE(wm5110_devs), NULL, 0, NULL); |
936 | break; | 959 | break; |
960 | case WM8997: | ||
961 | ret = mfd_add_devices(arizona->dev, -1, wm8997_devs, | ||
962 | ARRAY_SIZE(wm8997_devs), NULL, 0, NULL); | ||
963 | break; | ||
937 | } | 964 | } |
938 | 965 | ||
939 | if (ret != 0) { | 966 | if (ret != 0) { |
diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c index deb267ebf84e..51dbabf7c021 100644 --- a/drivers/mfd/arizona-i2c.c +++ b/drivers/mfd/arizona-i2c.c | |||
@@ -45,6 +45,11 @@ static int arizona_i2c_probe(struct i2c_client *i2c, | |||
45 | regmap_config = &wm5110_i2c_regmap; | 45 | regmap_config = &wm5110_i2c_regmap; |
46 | break; | 46 | break; |
47 | #endif | 47 | #endif |
48 | #ifdef CONFIG_MFD_WM8997 | ||
49 | case WM8997: | ||
50 | regmap_config = &wm8997_i2c_regmap; | ||
51 | break; | ||
52 | #endif | ||
48 | default: | 53 | default: |
49 | dev_err(&i2c->dev, "Unknown device type %ld\n", | 54 | dev_err(&i2c->dev, "Unknown device type %ld\n", |
50 | id->driver_data); | 55 | id->driver_data); |
@@ -80,6 +85,7 @@ static int arizona_i2c_remove(struct i2c_client *i2c) | |||
80 | static const struct i2c_device_id arizona_i2c_id[] = { | 85 | static const struct i2c_device_id arizona_i2c_id[] = { |
81 | { "wm5102", WM5102 }, | 86 | { "wm5102", WM5102 }, |
82 | { "wm5110", WM5110 }, | 87 | { "wm5110", WM5110 }, |
88 | { "wm8997", WM8997 }, | ||
83 | { } | 89 | { } |
84 | }; | 90 | }; |
85 | MODULE_DEVICE_TABLE(i2c, arizona_i2c_id); | 91 | MODULE_DEVICE_TABLE(i2c, arizona_i2c_id); |
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c index 64cd9b6dac92..88758ab9402b 100644 --- a/drivers/mfd/arizona-irq.c +++ b/drivers/mfd/arizona-irq.c | |||
@@ -208,6 +208,14 @@ int arizona_irq_init(struct arizona *arizona) | |||
208 | ctrlif_error = false; | 208 | ctrlif_error = false; |
209 | break; | 209 | break; |
210 | #endif | 210 | #endif |
211 | #ifdef CONFIG_MFD_WM8997 | ||
212 | case WM8997: | ||
213 | aod = &wm8997_aod; | ||
214 | irq = &wm8997_irq; | ||
215 | |||
216 | ctrlif_error = false; | ||
217 | break; | ||
218 | #endif | ||
211 | default: | 219 | default: |
212 | BUG_ON("Unknown Arizona class device" == NULL); | 220 | BUG_ON("Unknown Arizona class device" == NULL); |
213 | return -EINVAL; | 221 | return -EINVAL; |
diff --git a/drivers/mfd/arizona.h b/drivers/mfd/arizona.h index db55d9854a55..b4cef777df73 100644 --- a/drivers/mfd/arizona.h +++ b/drivers/mfd/arizona.h | |||
@@ -25,6 +25,8 @@ extern const struct regmap_config wm5102_spi_regmap; | |||
25 | extern const struct regmap_config wm5110_i2c_regmap; | 25 | extern const struct regmap_config wm5110_i2c_regmap; |
26 | extern const struct regmap_config wm5110_spi_regmap; | 26 | extern const struct regmap_config wm5110_spi_regmap; |
27 | 27 | ||
28 | extern const struct regmap_config wm8997_i2c_regmap; | ||
29 | |||
28 | extern const struct dev_pm_ops arizona_pm_ops; | 30 | extern const struct dev_pm_ops arizona_pm_ops; |
29 | 31 | ||
30 | extern const struct of_device_id arizona_of_match[]; | 32 | extern const struct of_device_id arizona_of_match[]; |
@@ -35,6 +37,9 @@ extern const struct regmap_irq_chip wm5102_irq; | |||
35 | extern const struct regmap_irq_chip wm5110_aod; | 37 | extern const struct regmap_irq_chip wm5110_aod; |
36 | extern const struct regmap_irq_chip wm5110_irq; | 38 | extern const struct regmap_irq_chip wm5110_irq; |
37 | 39 | ||
40 | extern const struct regmap_irq_chip wm8997_aod; | ||
41 | extern const struct regmap_irq_chip wm8997_irq; | ||
42 | |||
38 | int arizona_dev_init(struct arizona *arizona); | 43 | int arizona_dev_init(struct arizona *arizona); |
39 | int arizona_dev_exit(struct arizona *arizona); | 44 | int arizona_dev_exit(struct arizona *arizona); |
40 | int arizona_irq_init(struct arizona *arizona); | 45 | int arizona_irq_init(struct arizona *arizona); |
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 1b15986c01e1..9532f749412f 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -958,7 +958,8 @@ static int __init asic3_probe(struct platform_device *pdev) | |||
958 | unsigned long clksel; | 958 | unsigned long clksel; |
959 | int ret = 0; | 959 | int ret = 0; |
960 | 960 | ||
961 | asic = kzalloc(sizeof(struct asic3), GFP_KERNEL); | 961 | asic = devm_kzalloc(&pdev->dev, |
962 | sizeof(struct asic3), GFP_KERNEL); | ||
962 | if (asic == NULL) { | 963 | if (asic == NULL) { |
963 | printk(KERN_ERR "kzalloc failed\n"); | 964 | printk(KERN_ERR "kzalloc failed\n"); |
964 | return -ENOMEM; | 965 | return -ENOMEM; |
@@ -970,16 +971,14 @@ static int __init asic3_probe(struct platform_device *pdev) | |||
970 | 971 | ||
971 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 972 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
972 | if (!mem) { | 973 | if (!mem) { |
973 | ret = -ENOMEM; | ||
974 | dev_err(asic->dev, "no MEM resource\n"); | 974 | dev_err(asic->dev, "no MEM resource\n"); |
975 | goto out_free; | 975 | return -ENOMEM; |
976 | } | 976 | } |
977 | 977 | ||
978 | asic->mapping = ioremap(mem->start, resource_size(mem)); | 978 | asic->mapping = ioremap(mem->start, resource_size(mem)); |
979 | if (!asic->mapping) { | 979 | if (!asic->mapping) { |
980 | ret = -ENOMEM; | ||
981 | dev_err(asic->dev, "Couldn't ioremap\n"); | 980 | dev_err(asic->dev, "Couldn't ioremap\n"); |
982 | goto out_free; | 981 | return -ENOMEM; |
983 | } | 982 | } |
984 | 983 | ||
985 | asic->irq_base = pdata->irq_base; | 984 | asic->irq_base = pdata->irq_base; |
@@ -1033,9 +1032,6 @@ static int __init asic3_probe(struct platform_device *pdev) | |||
1033 | out_unmap: | 1032 | out_unmap: |
1034 | iounmap(asic->mapping); | 1033 | iounmap(asic->mapping); |
1035 | 1034 | ||
1036 | out_free: | ||
1037 | kfree(asic); | ||
1038 | |||
1039 | return ret; | 1035 | return ret; |
1040 | } | 1036 | } |
1041 | 1037 | ||
@@ -1058,8 +1054,6 @@ static int asic3_remove(struct platform_device *pdev) | |||
1058 | 1054 | ||
1059 | iounmap(asic->mapping); | 1055 | iounmap(asic->mapping); |
1060 | 1056 | ||
1061 | kfree(asic); | ||
1062 | |||
1063 | return 0; | 1057 | return 0; |
1064 | } | 1058 | } |
1065 | 1059 | ||
diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index 10cd14e35eb0..1f36885d674b 100644 --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c | |||
@@ -104,23 +104,19 @@ int cros_ec_register(struct cros_ec_device *ec_dev) | |||
104 | ec_dev->command_sendrecv = cros_ec_command_sendrecv; | 104 | ec_dev->command_sendrecv = cros_ec_command_sendrecv; |
105 | 105 | ||
106 | if (ec_dev->din_size) { | 106 | if (ec_dev->din_size) { |
107 | ec_dev->din = kmalloc(ec_dev->din_size, GFP_KERNEL); | 107 | ec_dev->din = devm_kzalloc(dev, ec_dev->din_size, GFP_KERNEL); |
108 | if (!ec_dev->din) { | 108 | if (!ec_dev->din) |
109 | err = -ENOMEM; | 109 | return -ENOMEM; |
110 | goto fail_din; | ||
111 | } | ||
112 | } | 110 | } |
113 | if (ec_dev->dout_size) { | 111 | if (ec_dev->dout_size) { |
114 | ec_dev->dout = kmalloc(ec_dev->dout_size, GFP_KERNEL); | 112 | ec_dev->dout = devm_kzalloc(dev, ec_dev->dout_size, GFP_KERNEL); |
115 | if (!ec_dev->dout) { | 113 | if (!ec_dev->dout) |
116 | err = -ENOMEM; | 114 | return -ENOMEM; |
117 | goto fail_dout; | ||
118 | } | ||
119 | } | 115 | } |
120 | 116 | ||
121 | if (!ec_dev->irq) { | 117 | if (!ec_dev->irq) { |
122 | dev_dbg(dev, "no valid IRQ: %d\n", ec_dev->irq); | 118 | dev_dbg(dev, "no valid IRQ: %d\n", ec_dev->irq); |
123 | goto fail_irq; | 119 | return err; |
124 | } | 120 | } |
125 | 121 | ||
126 | err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread, | 122 | err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread, |
@@ -128,7 +124,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) | |||
128 | "chromeos-ec", ec_dev); | 124 | "chromeos-ec", ec_dev); |
129 | if (err) { | 125 | if (err) { |
130 | dev_err(dev, "request irq %d: error %d\n", ec_dev->irq, err); | 126 | dev_err(dev, "request irq %d: error %d\n", ec_dev->irq, err); |
131 | goto fail_irq; | 127 | return err; |
132 | } | 128 | } |
133 | 129 | ||
134 | err = mfd_add_devices(dev, 0, cros_devs, | 130 | err = mfd_add_devices(dev, 0, cros_devs, |
@@ -145,11 +141,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) | |||
145 | 141 | ||
146 | fail_mfd: | 142 | fail_mfd: |
147 | free_irq(ec_dev->irq, ec_dev); | 143 | free_irq(ec_dev->irq, ec_dev); |
148 | fail_irq: | 144 | |
149 | kfree(ec_dev->dout); | ||
150 | fail_dout: | ||
151 | kfree(ec_dev->din); | ||
152 | fail_din: | ||
153 | return err; | 145 | return err; |
154 | } | 146 | } |
155 | EXPORT_SYMBOL(cros_ec_register); | 147 | EXPORT_SYMBOL(cros_ec_register); |
@@ -158,8 +150,6 @@ int cros_ec_remove(struct cros_ec_device *ec_dev) | |||
158 | { | 150 | { |
159 | mfd_remove_devices(ec_dev->dev); | 151 | mfd_remove_devices(ec_dev->dev); |
160 | free_irq(ec_dev->irq, ec_dev); | 152 | free_irq(ec_dev->irq, ec_dev); |
161 | kfree(ec_dev->dout); | ||
162 | kfree(ec_dev->din); | ||
163 | 153 | ||
164 | return 0; | 154 | return 0; |
165 | } | 155 | } |
diff --git a/drivers/mfd/davinci_voicecodec.c b/drivers/mfd/davinci_voicecodec.c index c60ab0c3c4db..fb64398506e9 100644 --- a/drivers/mfd/davinci_voicecodec.c +++ b/drivers/mfd/davinci_voicecodec.c | |||
@@ -46,56 +46,39 @@ void davinci_vc_write(struct davinci_vc *davinci_vc, | |||
46 | static int __init davinci_vc_probe(struct platform_device *pdev) | 46 | static int __init davinci_vc_probe(struct platform_device *pdev) |
47 | { | 47 | { |
48 | struct davinci_vc *davinci_vc; | 48 | struct davinci_vc *davinci_vc; |
49 | struct resource *res, *mem; | 49 | struct resource *res; |
50 | struct mfd_cell *cell = NULL; | 50 | struct mfd_cell *cell = NULL; |
51 | int ret; | 51 | int ret; |
52 | 52 | ||
53 | davinci_vc = kzalloc(sizeof(struct davinci_vc), GFP_KERNEL); | 53 | davinci_vc = devm_kzalloc(&pdev->dev, |
54 | sizeof(struct davinci_vc), GFP_KERNEL); | ||
54 | if (!davinci_vc) { | 55 | if (!davinci_vc) { |
55 | dev_dbg(&pdev->dev, | 56 | dev_dbg(&pdev->dev, |
56 | "could not allocate memory for private data\n"); | 57 | "could not allocate memory for private data\n"); |
57 | return -ENOMEM; | 58 | return -ENOMEM; |
58 | } | 59 | } |
59 | 60 | ||
60 | davinci_vc->clk = clk_get(&pdev->dev, NULL); | 61 | davinci_vc->clk = devm_clk_get(&pdev->dev, NULL); |
61 | if (IS_ERR(davinci_vc->clk)) { | 62 | if (IS_ERR(davinci_vc->clk)) { |
62 | dev_dbg(&pdev->dev, | 63 | dev_dbg(&pdev->dev, |
63 | "could not get the clock for voice codec\n"); | 64 | "could not get the clock for voice codec\n"); |
64 | ret = -ENODEV; | 65 | return -ENODEV; |
65 | goto fail1; | ||
66 | } | 66 | } |
67 | clk_enable(davinci_vc->clk); | 67 | clk_enable(davinci_vc->clk); |
68 | 68 | ||
69 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 69 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
70 | if (!res) { | ||
71 | dev_err(&pdev->dev, "no mem resource\n"); | ||
72 | ret = -ENODEV; | ||
73 | goto fail2; | ||
74 | } | ||
75 | 70 | ||
76 | davinci_vc->pbase = res->start; | 71 | davinci_vc->base = devm_ioremap_resource(&pdev->dev, res); |
77 | davinci_vc->base_size = resource_size(res); | 72 | if (IS_ERR(davinci_vc->base)) { |
78 | 73 | ret = PTR_ERR(davinci_vc->base); | |
79 | mem = request_mem_region(davinci_vc->pbase, davinci_vc->base_size, | 74 | goto fail; |
80 | pdev->name); | ||
81 | if (!mem) { | ||
82 | dev_err(&pdev->dev, "VCIF region already claimed\n"); | ||
83 | ret = -EBUSY; | ||
84 | goto fail2; | ||
85 | } | ||
86 | |||
87 | davinci_vc->base = ioremap(davinci_vc->pbase, davinci_vc->base_size); | ||
88 | if (!davinci_vc->base) { | ||
89 | dev_err(&pdev->dev, "can't ioremap mem resource.\n"); | ||
90 | ret = -ENOMEM; | ||
91 | goto fail3; | ||
92 | } | 75 | } |
93 | 76 | ||
94 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 77 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
95 | if (!res) { | 78 | if (!res) { |
96 | dev_err(&pdev->dev, "no DMA resource\n"); | 79 | dev_err(&pdev->dev, "no DMA resource\n"); |
97 | ret = -ENXIO; | 80 | ret = -ENXIO; |
98 | goto fail4; | 81 | goto fail; |
99 | } | 82 | } |
100 | 83 | ||
101 | davinci_vc->davinci_vcif.dma_tx_channel = res->start; | 84 | davinci_vc->davinci_vcif.dma_tx_channel = res->start; |
@@ -106,7 +89,7 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
106 | if (!res) { | 89 | if (!res) { |
107 | dev_err(&pdev->dev, "no DMA resource\n"); | 90 | dev_err(&pdev->dev, "no DMA resource\n"); |
108 | ret = -ENXIO; | 91 | ret = -ENXIO; |
109 | goto fail4; | 92 | goto fail; |
110 | } | 93 | } |
111 | 94 | ||
112 | davinci_vc->davinci_vcif.dma_rx_channel = res->start; | 95 | davinci_vc->davinci_vcif.dma_rx_channel = res->start; |
@@ -132,21 +115,13 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
132 | DAVINCI_VC_CELLS, NULL, 0, NULL); | 115 | DAVINCI_VC_CELLS, NULL, 0, NULL); |
133 | if (ret != 0) { | 116 | if (ret != 0) { |
134 | dev_err(&pdev->dev, "fail to register client devices\n"); | 117 | dev_err(&pdev->dev, "fail to register client devices\n"); |
135 | goto fail4; | 118 | goto fail; |
136 | } | 119 | } |
137 | 120 | ||
138 | return 0; | 121 | return 0; |
139 | 122 | ||
140 | fail4: | 123 | fail: |
141 | iounmap(davinci_vc->base); | ||
142 | fail3: | ||
143 | release_mem_region(davinci_vc->pbase, davinci_vc->base_size); | ||
144 | fail2: | ||
145 | clk_disable(davinci_vc->clk); | 124 | clk_disable(davinci_vc->clk); |
146 | clk_put(davinci_vc->clk); | ||
147 | davinci_vc->clk = NULL; | ||
148 | fail1: | ||
149 | kfree(davinci_vc); | ||
150 | 125 | ||
151 | return ret; | 126 | return ret; |
152 | } | 127 | } |
@@ -157,14 +132,7 @@ static int davinci_vc_remove(struct platform_device *pdev) | |||
157 | 132 | ||
158 | mfd_remove_devices(&pdev->dev); | 133 | mfd_remove_devices(&pdev->dev); |
159 | 134 | ||
160 | iounmap(davinci_vc->base); | ||
161 | release_mem_region(davinci_vc->pbase, davinci_vc->base_size); | ||
162 | |||
163 | clk_disable(davinci_vc->clk); | 135 | clk_disable(davinci_vc->clk); |
164 | clk_put(davinci_vc->clk); | ||
165 | davinci_vc->clk = NULL; | ||
166 | |||
167 | kfree(davinci_vc); | ||
168 | 136 | ||
169 | return 0; | 137 | return 0; |
170 | } | 138 | } |
diff --git a/drivers/mfd/dbx500-prcmu-regs.h b/drivers/mfd/dbx500-prcmu-regs.h index ca355dd423a6..4f6f0fa5d3b7 100644 --- a/drivers/mfd/dbx500-prcmu-regs.h +++ b/drivers/mfd/dbx500-prcmu-regs.h | |||
@@ -16,8 +16,8 @@ | |||
16 | #define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end)) | 16 | #define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end)) |
17 | 17 | ||
18 | #define PRCM_ACLK_MGT (0x004) | 18 | #define PRCM_ACLK_MGT (0x004) |
19 | #define PRCM_SVACLK_MGT (0x008) | 19 | #define PRCM_SVAMMCSPCLK_MGT (0x008) |
20 | #define PRCM_SIACLK_MGT (0x00C) | 20 | #define PRCM_SIAMMDSPCLK_MGT (0x00C) |
21 | #define PRCM_SGACLK_MGT (0x014) | 21 | #define PRCM_SGACLK_MGT (0x014) |
22 | #define PRCM_UARTCLK_MGT (0x018) | 22 | #define PRCM_UARTCLK_MGT (0x018) |
23 | #define PRCM_MSP02CLK_MGT (0x01C) | 23 | #define PRCM_MSP02CLK_MGT (0x01C) |
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c index bbaec0ccba8f..26aca545084b 100644 --- a/drivers/mfd/htc-egpio.c +++ b/drivers/mfd/htc-egpio.c | |||
@@ -270,7 +270,7 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
270 | int ret; | 270 | int ret; |
271 | 271 | ||
272 | /* Initialize ei data structure. */ | 272 | /* Initialize ei data structure. */ |
273 | ei = kzalloc(sizeof(*ei), GFP_KERNEL); | 273 | ei = devm_kzalloc(&pdev->dev, sizeof(*ei), GFP_KERNEL); |
274 | if (!ei) | 274 | if (!ei) |
275 | return -ENOMEM; | 275 | return -ENOMEM; |
276 | 276 | ||
@@ -286,7 +286,8 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
286 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 286 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
287 | if (!res) | 287 | if (!res) |
288 | goto fail; | 288 | goto fail; |
289 | ei->base_addr = ioremap_nocache(res->start, resource_size(res)); | 289 | ei->base_addr = devm_ioremap_nocache(&pdev->dev, res->start, |
290 | resource_size(res)); | ||
290 | if (!ei->base_addr) | 291 | if (!ei->base_addr) |
291 | goto fail; | 292 | goto fail; |
292 | pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); | 293 | pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); |
@@ -306,7 +307,9 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
306 | platform_set_drvdata(pdev, ei); | 307 | platform_set_drvdata(pdev, ei); |
307 | 308 | ||
308 | ei->nchips = pdata->num_chips; | 309 | ei->nchips = pdata->num_chips; |
309 | ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); | 310 | ei->chip = devm_kzalloc(&pdev->dev, |
311 | sizeof(struct egpio_chip) * ei->nchips, | ||
312 | GFP_KERNEL); | ||
310 | if (!ei->chip) { | 313 | if (!ei->chip) { |
311 | ret = -ENOMEM; | 314 | ret = -ENOMEM; |
312 | goto fail; | 315 | goto fail; |
@@ -361,7 +364,6 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
361 | 364 | ||
362 | fail: | 365 | fail: |
363 | printk(KERN_ERR "EGPIO failed to setup\n"); | 366 | printk(KERN_ERR "EGPIO failed to setup\n"); |
364 | kfree(ei); | ||
365 | return ret; | 367 | return ret; |
366 | } | 368 | } |
367 | 369 | ||
@@ -379,9 +381,6 @@ static int __exit egpio_remove(struct platform_device *pdev) | |||
379 | irq_set_chained_handler(ei->chained_irq, NULL); | 381 | irq_set_chained_handler(ei->chained_irq, NULL); |
380 | device_init_wakeup(&pdev->dev, 0); | 382 | device_init_wakeup(&pdev->dev, 0); |
381 | } | 383 | } |
382 | iounmap(ei->base_addr); | ||
383 | kfree(ei->chip); | ||
384 | kfree(ei); | ||
385 | 384 | ||
386 | return 0; | 385 | return 0; |
387 | } | 386 | } |
diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c index 324187c0c124..c9dfce6ae0c2 100644 --- a/drivers/mfd/htc-i2cpld.c +++ b/drivers/mfd/htc-i2cpld.c | |||
@@ -514,8 +514,8 @@ static int htcpld_setup_chips(struct platform_device *pdev) | |||
514 | 514 | ||
515 | /* Setup each chip's output GPIOs */ | 515 | /* Setup each chip's output GPIOs */ |
516 | htcpld->nchips = pdata->num_chip; | 516 | htcpld->nchips = pdata->num_chip; |
517 | htcpld->chip = kzalloc(sizeof(struct htcpld_chip) * htcpld->nchips, | 517 | htcpld->chip = devm_kzalloc(dev, sizeof(struct htcpld_chip) * htcpld->nchips, |
518 | GFP_KERNEL); | 518 | GFP_KERNEL); |
519 | if (!htcpld->chip) { | 519 | if (!htcpld->chip) { |
520 | dev_warn(dev, "Unable to allocate memory for chips\n"); | 520 | dev_warn(dev, "Unable to allocate memory for chips\n"); |
521 | return -ENOMEM; | 521 | return -ENOMEM; |
@@ -580,12 +580,11 @@ static int htcpld_core_probe(struct platform_device *pdev) | |||
580 | return -ENXIO; | 580 | return -ENXIO; |
581 | } | 581 | } |
582 | 582 | ||
583 | htcpld = kzalloc(sizeof(struct htcpld_data), GFP_KERNEL); | 583 | htcpld = devm_kzalloc(dev, sizeof(struct htcpld_data), GFP_KERNEL); |
584 | if (!htcpld) | 584 | if (!htcpld) |
585 | return -ENOMEM; | 585 | return -ENOMEM; |
586 | 586 | ||
587 | /* Find chained irq */ | 587 | /* Find chained irq */ |
588 | ret = -EINVAL; | ||
589 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 588 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
590 | if (res) { | 589 | if (res) { |
591 | int flags; | 590 | int flags; |
@@ -598,7 +597,7 @@ static int htcpld_core_probe(struct platform_device *pdev) | |||
598 | flags, pdev->name, htcpld); | 597 | flags, pdev->name, htcpld); |
599 | if (ret) { | 598 | if (ret) { |
600 | dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret); | 599 | dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret); |
601 | goto fail; | 600 | return ret; |
602 | } else | 601 | } else |
603 | device_init_wakeup(dev, 0); | 602 | device_init_wakeup(dev, 0); |
604 | } | 603 | } |
@@ -609,7 +608,7 @@ static int htcpld_core_probe(struct platform_device *pdev) | |||
609 | /* Setup the htcpld chips */ | 608 | /* Setup the htcpld chips */ |
610 | ret = htcpld_setup_chips(pdev); | 609 | ret = htcpld_setup_chips(pdev); |
611 | if (ret) | 610 | if (ret) |
612 | goto fail; | 611 | return ret; |
613 | 612 | ||
614 | /* Request the GPIO(s) for the int reset and set them up */ | 613 | /* Request the GPIO(s) for the int reset and set them up */ |
615 | if (pdata->int_reset_gpio_hi) { | 614 | if (pdata->int_reset_gpio_hi) { |
@@ -644,10 +643,6 @@ static int htcpld_core_probe(struct platform_device *pdev) | |||
644 | 643 | ||
645 | dev_info(dev, "Initialized successfully\n"); | 644 | dev_info(dev, "Initialized successfully\n"); |
646 | return 0; | 645 | return 0; |
647 | |||
648 | fail: | ||
649 | kfree(htcpld); | ||
650 | return ret; | ||
651 | } | 646 | } |
652 | 647 | ||
653 | /* The I2C Driver -- used internally */ | 648 | /* The I2C Driver -- used internally */ |
diff --git a/drivers/mfd/htc-pasic3.c b/drivers/mfd/htc-pasic3.c index 0285fceb99a6..0a5e85fd8517 100644 --- a/drivers/mfd/htc-pasic3.c +++ b/drivers/mfd/htc-pasic3.c | |||
@@ -147,7 +147,7 @@ static int __init pasic3_probe(struct platform_device *pdev) | |||
147 | if (!request_mem_region(r->start, resource_size(r), "pasic3")) | 147 | if (!request_mem_region(r->start, resource_size(r), "pasic3")) |
148 | return -EBUSY; | 148 | return -EBUSY; |
149 | 149 | ||
150 | asic = kzalloc(sizeof(struct pasic3_data), GFP_KERNEL); | 150 | asic = devm_kzalloc(dev, sizeof(struct pasic3_data), GFP_KERNEL); |
151 | if (!asic) | 151 | if (!asic) |
152 | return -ENOMEM; | 152 | return -ENOMEM; |
153 | 153 | ||
@@ -156,7 +156,6 @@ static int __init pasic3_probe(struct platform_device *pdev) | |||
156 | asic->mapping = ioremap(r->start, resource_size(r)); | 156 | asic->mapping = ioremap(r->start, resource_size(r)); |
157 | if (!asic->mapping) { | 157 | if (!asic->mapping) { |
158 | dev_err(dev, "couldn't ioremap PASIC3\n"); | 158 | dev_err(dev, "couldn't ioremap PASIC3\n"); |
159 | kfree(asic); | ||
160 | return -ENOMEM; | 159 | return -ENOMEM; |
161 | } | 160 | } |
162 | 161 | ||
@@ -195,7 +194,6 @@ static int pasic3_remove(struct platform_device *pdev) | |||
195 | iounmap(asic->mapping); | 194 | iounmap(asic->mapping); |
196 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 195 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
197 | release_mem_region(r->start, resource_size(r)); | 196 | release_mem_region(r->start, resource_size(r)); |
198 | kfree(asic); | ||
199 | return 0; | 197 | return 0; |
200 | } | 198 | } |
201 | 199 | ||
diff --git a/drivers/mfd/intel_msic.c b/drivers/mfd/intel_msic.c index d8d5137f9717..4f2462f0963e 100644 --- a/drivers/mfd/intel_msic.c +++ b/drivers/mfd/intel_msic.c | |||
@@ -438,7 +438,6 @@ static int intel_msic_remove(struct platform_device *pdev) | |||
438 | struct intel_msic *msic = platform_get_drvdata(pdev); | 438 | struct intel_msic *msic = platform_get_drvdata(pdev); |
439 | 439 | ||
440 | intel_msic_remove_devices(msic); | 440 | intel_msic_remove_devices(msic); |
441 | platform_set_drvdata(pdev, NULL); | ||
442 | 441 | ||
443 | return 0; | 442 | return 0; |
444 | } | 443 | } |
diff --git a/drivers/mfd/janz-cmodio.c b/drivers/mfd/janz-cmodio.c index 45ece11cc27c..fcbb2e9dfd37 100644 --- a/drivers/mfd/janz-cmodio.c +++ b/drivers/mfd/janz-cmodio.c | |||
@@ -183,11 +183,10 @@ static int cmodio_pci_probe(struct pci_dev *dev, | |||
183 | struct cmodio_device *priv; | 183 | struct cmodio_device *priv; |
184 | int ret; | 184 | int ret; |
185 | 185 | ||
186 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 186 | priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); |
187 | if (!priv) { | 187 | if (!priv) { |
188 | dev_err(&dev->dev, "unable to allocate private data\n"); | 188 | dev_err(&dev->dev, "unable to allocate private data\n"); |
189 | ret = -ENOMEM; | 189 | return -ENOMEM; |
190 | goto out_return; | ||
191 | } | 190 | } |
192 | 191 | ||
193 | pci_set_drvdata(dev, priv); | 192 | pci_set_drvdata(dev, priv); |
@@ -197,7 +196,7 @@ static int cmodio_pci_probe(struct pci_dev *dev, | |||
197 | ret = pci_enable_device(dev); | 196 | ret = pci_enable_device(dev); |
198 | if (ret) { | 197 | if (ret) { |
199 | dev_err(&dev->dev, "unable to enable device\n"); | 198 | dev_err(&dev->dev, "unable to enable device\n"); |
200 | goto out_free_priv; | 199 | return ret; |
201 | } | 200 | } |
202 | 201 | ||
203 | pci_set_master(dev); | 202 | pci_set_master(dev); |
@@ -248,9 +247,7 @@ out_pci_release_regions: | |||
248 | pci_release_regions(dev); | 247 | pci_release_regions(dev); |
249 | out_pci_disable_device: | 248 | out_pci_disable_device: |
250 | pci_disable_device(dev); | 249 | pci_disable_device(dev); |
251 | out_free_priv: | 250 | |
252 | kfree(priv); | ||
253 | out_return: | ||
254 | return ret; | 251 | return ret; |
255 | } | 252 | } |
256 | 253 | ||
@@ -263,7 +260,6 @@ static void cmodio_pci_remove(struct pci_dev *dev) | |||
263 | iounmap(priv->ctrl); | 260 | iounmap(priv->ctrl); |
264 | pci_release_regions(dev); | 261 | pci_release_regions(dev); |
265 | pci_disable_device(dev); | 262 | pci_disable_device(dev); |
266 | kfree(priv); | ||
267 | } | 263 | } |
268 | 264 | ||
269 | #define PCI_VENDOR_ID_JANZ 0x13c3 | 265 | #define PCI_VENDOR_ID_JANZ 0x13c3 |
diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c index e80587f1a792..3c0e8cf6916b 100644 --- a/drivers/mfd/jz4740-adc.c +++ b/drivers/mfd/jz4740-adc.c | |||
@@ -86,13 +86,13 @@ static void jz4740_adc_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
86 | static inline void jz4740_adc_clk_enable(struct jz4740_adc *adc) | 86 | static inline void jz4740_adc_clk_enable(struct jz4740_adc *adc) |
87 | { | 87 | { |
88 | if (atomic_inc_return(&adc->clk_ref) == 1) | 88 | if (atomic_inc_return(&adc->clk_ref) == 1) |
89 | clk_enable(adc->clk); | 89 | clk_prepare_enable(adc->clk); |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void jz4740_adc_clk_disable(struct jz4740_adc *adc) | 92 | static inline void jz4740_adc_clk_disable(struct jz4740_adc *adc) |
93 | { | 93 | { |
94 | if (atomic_dec_return(&adc->clk_ref) == 0) | 94 | if (atomic_dec_return(&adc->clk_ref) == 0) |
95 | clk_disable(adc->clk); | 95 | clk_disable_unprepare(adc->clk); |
96 | } | 96 | } |
97 | 97 | ||
98 | static inline void jz4740_adc_set_enabled(struct jz4740_adc *adc, int engine, | 98 | static inline void jz4740_adc_set_enabled(struct jz4740_adc *adc, int engine, |
@@ -294,7 +294,6 @@ static int jz4740_adc_probe(struct platform_device *pdev) | |||
294 | err_clk_put: | 294 | err_clk_put: |
295 | clk_put(adc->clk); | 295 | clk_put(adc->clk); |
296 | err_iounmap: | 296 | err_iounmap: |
297 | platform_set_drvdata(pdev, NULL); | ||
298 | iounmap(adc->base); | 297 | iounmap(adc->base); |
299 | err_release_mem_region: | 298 | err_release_mem_region: |
300 | release_mem_region(adc->mem->start, resource_size(adc->mem)); | 299 | release_mem_region(adc->mem->start, resource_size(adc->mem)); |
@@ -317,8 +316,6 @@ static int jz4740_adc_remove(struct platform_device *pdev) | |||
317 | 316 | ||
318 | clk_put(adc->clk); | 317 | clk_put(adc->clk); |
319 | 318 | ||
320 | platform_set_drvdata(pdev, NULL); | ||
321 | |||
322 | return 0; | 319 | return 0; |
323 | } | 320 | } |
324 | 321 | ||
diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c new file mode 100644 index 000000000000..686a4565acb6 --- /dev/null +++ b/drivers/mfd/kempld-core.c | |||
@@ -0,0 +1,641 @@ | |||
1 | /* | ||
2 | * Kontron PLD MFD core driver | ||
3 | * | ||
4 | * Copyright (c) 2010-2013 Kontron Europe GmbH | ||
5 | * Author: Michael Brunner <michael.brunner@kontron.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License 2 as published | ||
9 | * by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/mfd/core.h> | ||
19 | #include <linux/mfd/kempld.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/dmi.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/delay.h> | ||
24 | |||
25 | #define MAX_ID_LEN 4 | ||
26 | static char force_device_id[MAX_ID_LEN + 1] = ""; | ||
27 | module_param_string(force_device_id, force_device_id, sizeof(force_device_id), 0); | ||
28 | MODULE_PARM_DESC(force_device_id, "Override detected product"); | ||
29 | |||
30 | /* | ||
31 | * Get hardware mutex to block firmware from accessing the pld. | ||
32 | * It is possible for the firmware may hold the mutex for an extended length of | ||
33 | * time. This function will block until access has been granted. | ||
34 | */ | ||
35 | static void kempld_get_hardware_mutex(struct kempld_device_data *pld) | ||
36 | { | ||
37 | /* The mutex bit will read 1 until access has been granted */ | ||
38 | while (ioread8(pld->io_index) & KEMPLD_MUTEX_KEY) | ||
39 | msleep(1); | ||
40 | } | ||
41 | |||
42 | static void kempld_release_hardware_mutex(struct kempld_device_data *pld) | ||
43 | { | ||
44 | /* The harware mutex is released when 1 is written to the mutex bit. */ | ||
45 | iowrite8(KEMPLD_MUTEX_KEY, pld->io_index); | ||
46 | } | ||
47 | |||
48 | static int kempld_get_info_generic(struct kempld_device_data *pld) | ||
49 | { | ||
50 | u16 version; | ||
51 | u8 spec; | ||
52 | |||
53 | kempld_get_mutex(pld); | ||
54 | |||
55 | version = kempld_read16(pld, KEMPLD_VERSION); | ||
56 | spec = kempld_read8(pld, KEMPLD_SPEC); | ||
57 | pld->info.buildnr = kempld_read16(pld, KEMPLD_BUILDNR); | ||
58 | |||
59 | pld->info.minor = KEMPLD_VERSION_GET_MINOR(version); | ||
60 | pld->info.major = KEMPLD_VERSION_GET_MAJOR(version); | ||
61 | pld->info.number = KEMPLD_VERSION_GET_NUMBER(version); | ||
62 | pld->info.type = KEMPLD_VERSION_GET_TYPE(version); | ||
63 | |||
64 | if (spec == 0xff) { | ||
65 | pld->info.spec_minor = 0; | ||
66 | pld->info.spec_major = 1; | ||
67 | } else { | ||
68 | pld->info.spec_minor = KEMPLD_SPEC_GET_MINOR(spec); | ||
69 | pld->info.spec_major = KEMPLD_SPEC_GET_MAJOR(spec); | ||
70 | } | ||
71 | |||
72 | if (pld->info.spec_major > 0) | ||
73 | pld->feature_mask = kempld_read16(pld, KEMPLD_FEATURE); | ||
74 | else | ||
75 | pld->feature_mask = 0; | ||
76 | |||
77 | kempld_release_mutex(pld); | ||
78 | |||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | enum kempld_cells { | ||
83 | KEMPLD_I2C = 0, | ||
84 | KEMPLD_WDT, | ||
85 | KEMPLD_GPIO, | ||
86 | KEMPLD_UART, | ||
87 | }; | ||
88 | |||
89 | static struct mfd_cell kempld_devs[] = { | ||
90 | [KEMPLD_I2C] = { | ||
91 | .name = "kempld-i2c", | ||
92 | }, | ||
93 | [KEMPLD_WDT] = { | ||
94 | .name = "kempld-wdt", | ||
95 | }, | ||
96 | [KEMPLD_GPIO] = { | ||
97 | .name = "kempld-gpio", | ||
98 | }, | ||
99 | [KEMPLD_UART] = { | ||
100 | .name = "kempld-uart", | ||
101 | }, | ||
102 | }; | ||
103 | |||
104 | #define KEMPLD_MAX_DEVS ARRAY_SIZE(kempld_devs) | ||
105 | |||
106 | static int kempld_register_cells_generic(struct kempld_device_data *pld) | ||
107 | { | ||
108 | struct mfd_cell devs[KEMPLD_MAX_DEVS]; | ||
109 | int i = 0; | ||
110 | |||
111 | if (pld->feature_mask & KEMPLD_FEATURE_BIT_I2C) | ||
112 | devs[i++] = kempld_devs[KEMPLD_I2C]; | ||
113 | |||
114 | if (pld->feature_mask & KEMPLD_FEATURE_BIT_WATCHDOG) | ||
115 | devs[i++] = kempld_devs[KEMPLD_WDT]; | ||
116 | |||
117 | if (pld->feature_mask & KEMPLD_FEATURE_BIT_GPIO) | ||
118 | devs[i++] = kempld_devs[KEMPLD_GPIO]; | ||
119 | |||
120 | if (pld->feature_mask & KEMPLD_FEATURE_MASK_UART) | ||
121 | devs[i++] = kempld_devs[KEMPLD_UART]; | ||
122 | |||
123 | return mfd_add_devices(pld->dev, -1, devs, i, NULL, 0, NULL); | ||
124 | } | ||
125 | |||
126 | static struct resource kempld_ioresource = { | ||
127 | .start = KEMPLD_IOINDEX, | ||
128 | .end = KEMPLD_IODATA, | ||
129 | .flags = IORESOURCE_IO, | ||
130 | }; | ||
131 | |||
132 | static const struct kempld_platform_data kempld_platform_data_generic = { | ||
133 | .pld_clock = KEMPLD_CLK, | ||
134 | .ioresource = &kempld_ioresource, | ||
135 | .get_hardware_mutex = kempld_get_hardware_mutex, | ||
136 | .release_hardware_mutex = kempld_release_hardware_mutex, | ||
137 | .get_info = kempld_get_info_generic, | ||
138 | .register_cells = kempld_register_cells_generic, | ||
139 | }; | ||
140 | |||
141 | static struct platform_device *kempld_pdev; | ||
142 | |||
143 | static int kempld_create_platform_device(const struct dmi_system_id *id) | ||
144 | { | ||
145 | struct kempld_platform_data *pdata = id->driver_data; | ||
146 | int ret; | ||
147 | |||
148 | kempld_pdev = platform_device_alloc("kempld", -1); | ||
149 | if (!kempld_pdev) | ||
150 | return -ENOMEM; | ||
151 | |||
152 | ret = platform_device_add_data(kempld_pdev, pdata, sizeof(*pdata)); | ||
153 | if (ret) | ||
154 | goto err; | ||
155 | |||
156 | ret = platform_device_add_resources(kempld_pdev, pdata->ioresource, 1); | ||
157 | if (ret) | ||
158 | goto err; | ||
159 | |||
160 | ret = platform_device_add(kempld_pdev); | ||
161 | if (ret) | ||
162 | goto err; | ||
163 | |||
164 | return 0; | ||
165 | err: | ||
166 | platform_device_put(kempld_pdev); | ||
167 | return ret; | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * kempld_read8 - read 8 bit register | ||
172 | * @pld: kempld_device_data structure describing the PLD | ||
173 | * @index: register index on the chip | ||
174 | * | ||
175 | * kempld_get_mutex must be called prior to calling this function. | ||
176 | */ | ||
177 | u8 kempld_read8(struct kempld_device_data *pld, u8 index) | ||
178 | { | ||
179 | iowrite8(index, pld->io_index); | ||
180 | return ioread8(pld->io_data); | ||
181 | } | ||
182 | EXPORT_SYMBOL_GPL(kempld_read8); | ||
183 | |||
184 | /** | ||
185 | * kempld_write8 - write 8 bit register | ||
186 | * @pld: kempld_device_data structure describing the PLD | ||
187 | * @index: register index on the chip | ||
188 | * @data: new register value | ||
189 | * | ||
190 | * kempld_get_mutex must be called prior to calling this function. | ||
191 | */ | ||
192 | void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data) | ||
193 | { | ||
194 | iowrite8(index, pld->io_index); | ||
195 | iowrite8(data, pld->io_data); | ||
196 | } | ||
197 | EXPORT_SYMBOL_GPL(kempld_write8); | ||
198 | |||
199 | /** | ||
200 | * kempld_read16 - read 16 bit register | ||
201 | * @pld: kempld_device_data structure describing the PLD | ||
202 | * @index: register index on the chip | ||
203 | * | ||
204 | * kempld_get_mutex must be called prior to calling this function. | ||
205 | */ | ||
206 | u16 kempld_read16(struct kempld_device_data *pld, u8 index) | ||
207 | { | ||
208 | return kempld_read8(pld, index) | kempld_read8(pld, index + 1) << 8; | ||
209 | } | ||
210 | EXPORT_SYMBOL_GPL(kempld_read16); | ||
211 | |||
212 | /** | ||
213 | * kempld_write16 - write 16 bit register | ||
214 | * @pld: kempld_device_data structure describing the PLD | ||
215 | * @index: register index on the chip | ||
216 | * @data: new register value | ||
217 | * | ||
218 | * kempld_get_mutex must be called prior to calling this function. | ||
219 | */ | ||
220 | void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data) | ||
221 | { | ||
222 | kempld_write8(pld, index, (u8)data); | ||
223 | kempld_write8(pld, index + 1, (u8)(data >> 8)); | ||
224 | } | ||
225 | EXPORT_SYMBOL_GPL(kempld_write16); | ||
226 | |||
227 | /** | ||
228 | * kempld_read32 - read 32 bit register | ||
229 | * @pld: kempld_device_data structure describing the PLD | ||
230 | * @index: register index on the chip | ||
231 | * | ||
232 | * kempld_get_mutex must be called prior to calling this function. | ||
233 | */ | ||
234 | u32 kempld_read32(struct kempld_device_data *pld, u8 index) | ||
235 | { | ||
236 | return kempld_read16(pld, index) | kempld_read16(pld, index + 2) << 16; | ||
237 | } | ||
238 | EXPORT_SYMBOL_GPL(kempld_read32); | ||
239 | |||
240 | /** | ||
241 | * kempld_write32 - write 32 bit register | ||
242 | * @pld: kempld_device_data structure describing the PLD | ||
243 | * @index: register index on the chip | ||
244 | * @data: new register value | ||
245 | * | ||
246 | * kempld_get_mutex must be called prior to calling this function. | ||
247 | */ | ||
248 | void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data) | ||
249 | { | ||
250 | kempld_write16(pld, index, (u16)data); | ||
251 | kempld_write16(pld, index + 2, (u16)(data >> 16)); | ||
252 | } | ||
253 | EXPORT_SYMBOL_GPL(kempld_write32); | ||
254 | |||
255 | /** | ||
256 | * kempld_get_mutex - acquire PLD mutex | ||
257 | * @pld: kempld_device_data structure describing the PLD | ||
258 | */ | ||
259 | void kempld_get_mutex(struct kempld_device_data *pld) | ||
260 | { | ||
261 | struct kempld_platform_data *pdata = pld->dev->platform_data; | ||
262 | |||
263 | mutex_lock(&pld->lock); | ||
264 | pdata->get_hardware_mutex(pld); | ||
265 | } | ||
266 | EXPORT_SYMBOL_GPL(kempld_get_mutex); | ||
267 | |||
268 | /** | ||
269 | * kempld_release_mutex - release PLD mutex | ||
270 | * @pld: kempld_device_data structure describing the PLD | ||
271 | */ | ||
272 | void kempld_release_mutex(struct kempld_device_data *pld) | ||
273 | { | ||
274 | struct kempld_platform_data *pdata = pld->dev->platform_data; | ||
275 | |||
276 | pdata->release_hardware_mutex(pld); | ||
277 | mutex_unlock(&pld->lock); | ||
278 | } | ||
279 | EXPORT_SYMBOL_GPL(kempld_release_mutex); | ||
280 | |||
281 | /** | ||
282 | * kempld_get_info - update device specific information | ||
283 | * @pld: kempld_device_data structure describing the PLD | ||
284 | * | ||
285 | * This function calls the configured board specific kempld_get_info_XXXX | ||
286 | * function which is responsible for gathering information about the specific | ||
287 | * hardware. The information is then stored within the pld structure. | ||
288 | */ | ||
289 | static int kempld_get_info(struct kempld_device_data *pld) | ||
290 | { | ||
291 | struct kempld_platform_data *pdata = pld->dev->platform_data; | ||
292 | |||
293 | return pdata->get_info(pld); | ||
294 | } | ||
295 | |||
296 | /* | ||
297 | * kempld_register_cells - register cell drivers | ||
298 | * | ||
299 | * This function registers cell drivers for the detected hardware by calling | ||
300 | * the configured kempld_register_cells_XXXX function which is responsible | ||
301 | * to detect and register the needed cell drivers. | ||
302 | */ | ||
303 | static int kempld_register_cells(struct kempld_device_data *pld) | ||
304 | { | ||
305 | struct kempld_platform_data *pdata = pld->dev->platform_data; | ||
306 | |||
307 | return pdata->register_cells(pld); | ||
308 | } | ||
309 | |||
310 | static int kempld_detect_device(struct kempld_device_data *pld) | ||
311 | { | ||
312 | char *version_type; | ||
313 | u8 index_reg; | ||
314 | int ret; | ||
315 | |||
316 | mutex_lock(&pld->lock); | ||
317 | |||
318 | /* Check for empty IO space */ | ||
319 | index_reg = ioread8(pld->io_index); | ||
320 | if (index_reg == 0xff && ioread8(pld->io_data) == 0xff) { | ||
321 | mutex_unlock(&pld->lock); | ||
322 | return -ENODEV; | ||
323 | } | ||
324 | |||
325 | /* Release hardware mutex if aquired */ | ||
326 | if (!(index_reg & KEMPLD_MUTEX_KEY)) | ||
327 | iowrite8(KEMPLD_MUTEX_KEY, pld->io_index); | ||
328 | |||
329 | mutex_unlock(&pld->lock); | ||
330 | |||
331 | ret = kempld_get_info(pld); | ||
332 | if (ret) | ||
333 | return ret; | ||
334 | |||
335 | switch (pld->info.type) { | ||
336 | case 0: | ||
337 | version_type = "release"; | ||
338 | break; | ||
339 | case 1: | ||
340 | version_type = "debug"; | ||
341 | break; | ||
342 | case 2: | ||
343 | version_type = "custom"; | ||
344 | break; | ||
345 | default: | ||
346 | version_type = "unspecified"; | ||
347 | } | ||
348 | |||
349 | dev_info(pld->dev, "Found Kontron PLD %d\n", pld->info.number); | ||
350 | dev_info(pld->dev, "%s version %d.%d build %d, specification %d.%d\n", | ||
351 | version_type, pld->info.major, pld->info.minor, | ||
352 | pld->info.buildnr, pld->info.spec_major, | ||
353 | pld->info.spec_minor); | ||
354 | |||
355 | return kempld_register_cells(pld); | ||
356 | } | ||
357 | |||
358 | static int kempld_probe(struct platform_device *pdev) | ||
359 | { | ||
360 | struct kempld_platform_data *pdata = pdev->dev.platform_data; | ||
361 | struct device *dev = &pdev->dev; | ||
362 | struct kempld_device_data *pld; | ||
363 | struct resource *ioport; | ||
364 | int ret; | ||
365 | |||
366 | pld = devm_kzalloc(dev, sizeof(*pld), GFP_KERNEL); | ||
367 | if (!pld) | ||
368 | return -ENOMEM; | ||
369 | |||
370 | ioport = platform_get_resource(pdev, IORESOURCE_IO, 0); | ||
371 | if (!ioport) | ||
372 | return -EINVAL; | ||
373 | |||
374 | pld->io_base = devm_ioport_map(dev, ioport->start, | ||
375 | ioport->end - ioport->start); | ||
376 | if (!pld->io_base) | ||
377 | return -ENOMEM; | ||
378 | |||
379 | pld->io_index = pld->io_base; | ||
380 | pld->io_data = pld->io_base + 1; | ||
381 | pld->pld_clock = pdata->pld_clock; | ||
382 | pld->dev = dev; | ||
383 | |||
384 | mutex_init(&pld->lock); | ||
385 | platform_set_drvdata(pdev, pld); | ||
386 | |||
387 | ret = kempld_detect_device(pld); | ||
388 | if (ret) | ||
389 | return ret; | ||
390 | |||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | static int kempld_remove(struct platform_device *pdev) | ||
395 | { | ||
396 | struct kempld_device_data *pld = platform_get_drvdata(pdev); | ||
397 | struct kempld_platform_data *pdata = pld->dev->platform_data; | ||
398 | |||
399 | mfd_remove_devices(&pdev->dev); | ||
400 | pdata->release_hardware_mutex(pld); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | static struct platform_driver kempld_driver = { | ||
406 | .driver = { | ||
407 | .name = "kempld", | ||
408 | .owner = THIS_MODULE, | ||
409 | }, | ||
410 | .probe = kempld_probe, | ||
411 | .remove = kempld_remove, | ||
412 | }; | ||
413 | |||
414 | static struct dmi_system_id __initdata kempld_dmi_table[] = { | ||
415 | { | ||
416 | .ident = "CCR2", | ||
417 | .matches = { | ||
418 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
419 | DMI_MATCH(DMI_BOARD_NAME, "COMe-bIP2"), | ||
420 | }, | ||
421 | .driver_data = (void *)&kempld_platform_data_generic, | ||
422 | .callback = kempld_create_platform_device, | ||
423 | }, { | ||
424 | .ident = "CCR6", | ||
425 | .matches = { | ||
426 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
427 | DMI_MATCH(DMI_BOARD_NAME, "COMe-bIP6"), | ||
428 | }, | ||
429 | .driver_data = (void *)&kempld_platform_data_generic, | ||
430 | .callback = kempld_create_platform_device, | ||
431 | }, { | ||
432 | .ident = "CHR2", | ||
433 | .matches = { | ||
434 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
435 | DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-SC T2"), | ||
436 | }, | ||
437 | .driver_data = (void *)&kempld_platform_data_generic, | ||
438 | .callback = kempld_create_platform_device, | ||
439 | }, { | ||
440 | .ident = "CHR2", | ||
441 | .matches = { | ||
442 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
443 | DMI_MATCH(DMI_BOARD_NAME, "ETXe-SC T2"), | ||
444 | }, | ||
445 | .driver_data = (void *)&kempld_platform_data_generic, | ||
446 | .callback = kempld_create_platform_device, | ||
447 | }, { | ||
448 | .ident = "CHR2", | ||
449 | .matches = { | ||
450 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
451 | DMI_MATCH(DMI_BOARD_NAME, "COMe-bSC2"), | ||
452 | }, | ||
453 | .driver_data = (void *)&kempld_platform_data_generic, | ||
454 | .callback = kempld_create_platform_device, | ||
455 | }, { | ||
456 | .ident = "CHR6", | ||
457 | .matches = { | ||
458 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
459 | DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-SC T6"), | ||
460 | }, | ||
461 | .driver_data = (void *)&kempld_platform_data_generic, | ||
462 | .callback = kempld_create_platform_device, | ||
463 | }, { | ||
464 | .ident = "CHR6", | ||
465 | .matches = { | ||
466 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
467 | DMI_MATCH(DMI_BOARD_NAME, "ETXe-SC T6"), | ||
468 | }, | ||
469 | .driver_data = (void *)&kempld_platform_data_generic, | ||
470 | .callback = kempld_create_platform_device, | ||
471 | }, { | ||
472 | .ident = "CHR6", | ||
473 | .matches = { | ||
474 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
475 | DMI_MATCH(DMI_BOARD_NAME, "COMe-bSC6"), | ||
476 | }, | ||
477 | .driver_data = (void *)&kempld_platform_data_generic, | ||
478 | .callback = kempld_create_platform_device, | ||
479 | }, { | ||
480 | .ident = "CNTG", | ||
481 | .matches = { | ||
482 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
483 | DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-PC"), | ||
484 | }, | ||
485 | .driver_data = (void *)&kempld_platform_data_generic, | ||
486 | .callback = kempld_create_platform_device, | ||
487 | }, { | ||
488 | .ident = "CNTG", | ||
489 | .matches = { | ||
490 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
491 | DMI_MATCH(DMI_BOARD_NAME, "COMe-bPC2"), | ||
492 | }, | ||
493 | .driver_data = (void *)&kempld_platform_data_generic, | ||
494 | .callback = kempld_create_platform_device, | ||
495 | }, { | ||
496 | .ident = "CNTX", | ||
497 | .matches = { | ||
498 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
499 | DMI_MATCH(DMI_BOARD_NAME, "PXT"), | ||
500 | }, | ||
501 | .driver_data = (void *)&kempld_platform_data_generic, | ||
502 | .callback = kempld_create_platform_device, | ||
503 | }, { | ||
504 | .ident = "FRI2", | ||
505 | .matches = { | ||
506 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
507 | DMI_MATCH(DMI_BIOS_VERSION, "FRI2"), | ||
508 | }, | ||
509 | .driver_data = (void *)&kempld_platform_data_generic, | ||
510 | .callback = kempld_create_platform_device, | ||
511 | }, { | ||
512 | .ident = "FRI2", | ||
513 | .matches = { | ||
514 | DMI_MATCH(DMI_PRODUCT_NAME, "Fish River Island II"), | ||
515 | }, | ||
516 | .driver_data = (void *)&kempld_platform_data_generic, | ||
517 | .callback = kempld_create_platform_device, | ||
518 | }, { | ||
519 | .ident = "MBR1", | ||
520 | .matches = { | ||
521 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
522 | DMI_MATCH(DMI_BOARD_NAME, "ETX-OH"), | ||
523 | }, | ||
524 | .driver_data = (void *)&kempld_platform_data_generic, | ||
525 | .callback = kempld_create_platform_device, | ||
526 | }, { | ||
527 | .ident = "NTC1", | ||
528 | .matches = { | ||
529 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
530 | DMI_MATCH(DMI_BOARD_NAME, "nanoETXexpress-TT"), | ||
531 | }, | ||
532 | .driver_data = (void *)&kempld_platform_data_generic, | ||
533 | .callback = kempld_create_platform_device, | ||
534 | }, { | ||
535 | .ident = "NTC1", | ||
536 | .matches = { | ||
537 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
538 | DMI_MATCH(DMI_BOARD_NAME, "nETXe-TT"), | ||
539 | }, | ||
540 | .driver_data = (void *)&kempld_platform_data_generic, | ||
541 | .callback = kempld_create_platform_device, | ||
542 | }, { | ||
543 | .ident = "NTC1", | ||
544 | .matches = { | ||
545 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
546 | DMI_MATCH(DMI_BOARD_NAME, "COMe-mTT"), | ||
547 | }, | ||
548 | .driver_data = (void *)&kempld_platform_data_generic, | ||
549 | .callback = kempld_create_platform_device, | ||
550 | }, { | ||
551 | .ident = "NUP1", | ||
552 | .matches = { | ||
553 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
554 | DMI_MATCH(DMI_BOARD_NAME, "COMe-mCT"), | ||
555 | }, | ||
556 | .driver_data = (void *)&kempld_platform_data_generic, | ||
557 | .callback = kempld_create_platform_device, | ||
558 | }, { | ||
559 | .ident = "UNP1", | ||
560 | .matches = { | ||
561 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
562 | DMI_MATCH(DMI_BOARD_NAME, "microETXexpress-DC"), | ||
563 | }, | ||
564 | .driver_data = (void *)&kempld_platform_data_generic, | ||
565 | .callback = kempld_create_platform_device, | ||
566 | }, { | ||
567 | .ident = "UNP1", | ||
568 | .matches = { | ||
569 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
570 | DMI_MATCH(DMI_BOARD_NAME, "COMe-cDC2"), | ||
571 | }, | ||
572 | .driver_data = (void *)&kempld_platform_data_generic, | ||
573 | .callback = kempld_create_platform_device, | ||
574 | }, { | ||
575 | .ident = "UNTG", | ||
576 | .matches = { | ||
577 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
578 | DMI_MATCH(DMI_BOARD_NAME, "microETXexpress-PC"), | ||
579 | }, | ||
580 | .driver_data = (void *)&kempld_platform_data_generic, | ||
581 | .callback = kempld_create_platform_device, | ||
582 | }, { | ||
583 | .ident = "UNTG", | ||
584 | .matches = { | ||
585 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
586 | DMI_MATCH(DMI_BOARD_NAME, "COMe-cPC2"), | ||
587 | }, | ||
588 | .driver_data = (void *)&kempld_platform_data_generic, | ||
589 | .callback = kempld_create_platform_device, | ||
590 | }, { | ||
591 | .ident = "UUP6", | ||
592 | .matches = { | ||
593 | DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), | ||
594 | DMI_MATCH(DMI_BOARD_NAME, "COMe-cCT6"), | ||
595 | }, | ||
596 | .driver_data = (void *)&kempld_platform_data_generic, | ||
597 | .callback = kempld_create_platform_device, | ||
598 | }, | ||
599 | {} | ||
600 | }; | ||
601 | MODULE_DEVICE_TABLE(dmi, kempld_dmi_table); | ||
602 | |||
603 | static int __init kempld_init(void) | ||
604 | { | ||
605 | const struct dmi_system_id *id; | ||
606 | int ret; | ||
607 | |||
608 | if (force_device_id[0]) { | ||
609 | for (id = kempld_dmi_table; id->matches[0].slot != DMI_NONE; id++) | ||
610 | if (strstr(id->ident, force_device_id)) | ||
611 | if (id->callback && id->callback(id)) | ||
612 | break; | ||
613 | if (id->matches[0].slot == DMI_NONE) | ||
614 | return -ENODEV; | ||
615 | } else { | ||
616 | if (!dmi_check_system(kempld_dmi_table)) | ||
617 | return -ENODEV; | ||
618 | } | ||
619 | |||
620 | ret = platform_driver_register(&kempld_driver); | ||
621 | if (ret) | ||
622 | return ret; | ||
623 | |||
624 | return 0; | ||
625 | } | ||
626 | |||
627 | static void __exit kempld_exit(void) | ||
628 | { | ||
629 | if (kempld_pdev) | ||
630 | platform_device_unregister(kempld_pdev); | ||
631 | |||
632 | platform_driver_unregister(&kempld_driver); | ||
633 | } | ||
634 | |||
635 | module_init(kempld_init); | ||
636 | module_exit(kempld_exit); | ||
637 | |||
638 | MODULE_DESCRIPTION("KEM PLD Core Driver"); | ||
639 | MODULE_AUTHOR("Michael Brunner <michael.brunner@kontron.com>"); | ||
640 | MODULE_LICENSE("GPL"); | ||
641 | MODULE_ALIAS("platform:kempld-core"); | ||
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index 9f12f91d6296..24033324c17a 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c | |||
@@ -51,6 +51,8 @@ | |||
51 | * document number TBD : Lynx Point | 51 | * document number TBD : Lynx Point |
52 | * document number TBD : Lynx Point-LP | 52 | * document number TBD : Lynx Point-LP |
53 | * document number TBD : Wellsburg | 53 | * document number TBD : Wellsburg |
54 | * document number TBD : Avoton SoC | ||
55 | * document number TBD : Coleto Creek | ||
54 | */ | 56 | */ |
55 | 57 | ||
56 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 58 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
@@ -207,6 +209,8 @@ enum lpc_chipsets { | |||
207 | LPC_LPT, /* Lynx Point */ | 209 | LPC_LPT, /* Lynx Point */ |
208 | LPC_LPT_LP, /* Lynx Point-LP */ | 210 | LPC_LPT_LP, /* Lynx Point-LP */ |
209 | LPC_WBG, /* Wellsburg */ | 211 | LPC_WBG, /* Wellsburg */ |
212 | LPC_AVN, /* Avoton SoC */ | ||
213 | LPC_COLETO, /* Coleto Creek */ | ||
210 | }; | 214 | }; |
211 | 215 | ||
212 | struct lpc_ich_info lpc_chipset_info[] = { | 216 | struct lpc_ich_info lpc_chipset_info[] = { |
@@ -491,6 +495,14 @@ struct lpc_ich_info lpc_chipset_info[] = { | |||
491 | .name = "Wellsburg", | 495 | .name = "Wellsburg", |
492 | .iTCO_version = 2, | 496 | .iTCO_version = 2, |
493 | }, | 497 | }, |
498 | [LPC_AVN] = { | ||
499 | .name = "Avoton SoC", | ||
500 | .iTCO_version = 1, | ||
501 | }, | ||
502 | [LPC_COLETO] = { | ||
503 | .name = "Coleto Creek", | ||
504 | .iTCO_version = 2, | ||
505 | }, | ||
494 | }; | 506 | }; |
495 | 507 | ||
496 | /* | 508 | /* |
@@ -704,6 +716,11 @@ static DEFINE_PCI_DEVICE_TABLE(lpc_ich_ids) = { | |||
704 | { PCI_VDEVICE(INTEL, 0x8d5d), LPC_WBG}, | 716 | { PCI_VDEVICE(INTEL, 0x8d5d), LPC_WBG}, |
705 | { PCI_VDEVICE(INTEL, 0x8d5e), LPC_WBG}, | 717 | { PCI_VDEVICE(INTEL, 0x8d5e), LPC_WBG}, |
706 | { PCI_VDEVICE(INTEL, 0x8d5f), LPC_WBG}, | 718 | { PCI_VDEVICE(INTEL, 0x8d5f), LPC_WBG}, |
719 | { PCI_VDEVICE(INTEL, 0x1f38), LPC_AVN}, | ||
720 | { PCI_VDEVICE(INTEL, 0x1f39), LPC_AVN}, | ||
721 | { PCI_VDEVICE(INTEL, 0x1f3a), LPC_AVN}, | ||
722 | { PCI_VDEVICE(INTEL, 0x1f3b), LPC_AVN}, | ||
723 | { PCI_VDEVICE(INTEL, 0x2390), LPC_COLETO}, | ||
707 | { 0, }, /* End of list */ | 724 | { 0, }, /* End of list */ |
708 | }; | 725 | }; |
709 | MODULE_DEVICE_TABLE(pci, lpc_ich_ids); | 726 | MODULE_DEVICE_TABLE(pci, lpc_ich_ids); |
@@ -973,18 +990,7 @@ static struct pci_driver lpc_ich_driver = { | |||
973 | .remove = lpc_ich_remove, | 990 | .remove = lpc_ich_remove, |
974 | }; | 991 | }; |
975 | 992 | ||
976 | static int __init lpc_ich_init(void) | 993 | module_pci_driver(lpc_ich_driver); |
977 | { | ||
978 | return pci_register_driver(&lpc_ich_driver); | ||
979 | } | ||
980 | |||
981 | static void __exit lpc_ich_exit(void) | ||
982 | { | ||
983 | pci_unregister_driver(&lpc_ich_driver); | ||
984 | } | ||
985 | |||
986 | module_init(lpc_ich_init); | ||
987 | module_exit(lpc_ich_exit); | ||
988 | 994 | ||
989 | MODULE_AUTHOR("Aaron Sierra <asierra@xes-inc.com>"); | 995 | MODULE_AUTHOR("Aaron Sierra <asierra@xes-inc.com>"); |
990 | MODULE_DESCRIPTION("LPC interface for Intel ICH"); | 996 | MODULE_DESCRIPTION("LPC interface for Intel ICH"); |
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 1cbb17609c8b..f27a21831583 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c | |||
@@ -37,6 +37,7 @@ | |||
37 | static struct mfd_cell max77686_devs[] = { | 37 | static struct mfd_cell max77686_devs[] = { |
38 | { .name = "max77686-pmic", }, | 38 | { .name = "max77686-pmic", }, |
39 | { .name = "max77686-rtc", }, | 39 | { .name = "max77686-rtc", }, |
40 | { .name = "max77686-clk", }, | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | static struct regmap_config max77686_regmap_config = { | 43 | static struct regmap_config max77686_regmap_config = { |
@@ -84,12 +85,12 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
84 | pdata = max77686_i2c_parse_dt_pdata(&i2c->dev); | 85 | pdata = max77686_i2c_parse_dt_pdata(&i2c->dev); |
85 | 86 | ||
86 | if (!pdata) { | 87 | if (!pdata) { |
87 | ret = -EIO; | ||
88 | dev_err(&i2c->dev, "No platform data found.\n"); | 88 | dev_err(&i2c->dev, "No platform data found.\n"); |
89 | goto err; | 89 | return -EIO; |
90 | } | 90 | } |
91 | 91 | ||
92 | max77686 = kzalloc(sizeof(struct max77686_dev), GFP_KERNEL); | 92 | max77686 = devm_kzalloc(&i2c->dev, |
93 | sizeof(struct max77686_dev), GFP_KERNEL); | ||
93 | if (max77686 == NULL) | 94 | if (max77686 == NULL) |
94 | return -ENOMEM; | 95 | return -ENOMEM; |
95 | 96 | ||
@@ -107,7 +108,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
107 | ret = PTR_ERR(max77686->regmap); | 108 | ret = PTR_ERR(max77686->regmap); |
108 | dev_err(max77686->dev, "Failed to allocate register map: %d\n", | 109 | dev_err(max77686->dev, "Failed to allocate register map: %d\n", |
109 | ret); | 110 | ret); |
110 | kfree(max77686); | ||
111 | return ret; | 111 | return ret; |
112 | } | 112 | } |
113 | 113 | ||
@@ -115,8 +115,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
115 | MAX77686_REG_DEVICE_ID, &data) < 0) { | 115 | MAX77686_REG_DEVICE_ID, &data) < 0) { |
116 | dev_err(max77686->dev, | 116 | dev_err(max77686->dev, |
117 | "device not found on this channel (this is not an error)\n"); | 117 | "device not found on this channel (this is not an error)\n"); |
118 | ret = -ENODEV; | 118 | return -ENODEV; |
119 | goto err; | ||
120 | } else | 119 | } else |
121 | dev_info(max77686->dev, "device found\n"); | 120 | dev_info(max77686->dev, "device found\n"); |
122 | 121 | ||
@@ -127,17 +126,11 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
127 | 126 | ||
128 | ret = mfd_add_devices(max77686->dev, -1, max77686_devs, | 127 | ret = mfd_add_devices(max77686->dev, -1, max77686_devs, |
129 | ARRAY_SIZE(max77686_devs), NULL, 0, NULL); | 128 | ARRAY_SIZE(max77686_devs), NULL, 0, NULL); |
129 | if (ret < 0) { | ||
130 | mfd_remove_devices(max77686->dev); | ||
131 | i2c_unregister_device(max77686->rtc); | ||
132 | } | ||
130 | 133 | ||
131 | if (ret < 0) | ||
132 | goto err_mfd; | ||
133 | |||
134 | return ret; | ||
135 | |||
136 | err_mfd: | ||
137 | mfd_remove_devices(max77686->dev); | ||
138 | i2c_unregister_device(max77686->rtc); | ||
139 | err: | ||
140 | kfree(max77686); | ||
141 | return ret; | 134 | return ret; |
142 | } | 135 | } |
143 | 136 | ||
@@ -147,7 +140,6 @@ static int max77686_i2c_remove(struct i2c_client *i2c) | |||
147 | 140 | ||
148 | mfd_remove_devices(max77686->dev); | 141 | mfd_remove_devices(max77686->dev); |
149 | i2c_unregister_device(max77686->rtc); | 142 | i2c_unregister_device(max77686->rtc); |
150 | kfree(max77686); | ||
151 | 143 | ||
152 | return 0; | 144 | return 0; |
153 | } | 145 | } |
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c index 92bbebd31598..8042b3205eaa 100644 --- a/drivers/mfd/max8925-i2c.c +++ b/drivers/mfd/max8925-i2c.c | |||
@@ -170,7 +170,8 @@ static int max8925_probe(struct i2c_client *client, | |||
170 | return -EINVAL; | 170 | return -EINVAL; |
171 | } | 171 | } |
172 | 172 | ||
173 | chip = kzalloc(sizeof(struct max8925_chip), GFP_KERNEL); | 173 | chip = devm_kzalloc(&client->dev, |
174 | sizeof(struct max8925_chip), GFP_KERNEL); | ||
174 | if (chip == NULL) | 175 | if (chip == NULL) |
175 | return -ENOMEM; | 176 | return -ENOMEM; |
176 | chip->i2c = client; | 177 | chip->i2c = client; |
@@ -199,7 +200,6 @@ static int max8925_remove(struct i2c_client *client) | |||
199 | max8925_device_exit(chip); | 200 | max8925_device_exit(chip); |
200 | i2c_unregister_device(chip->adc); | 201 | i2c_unregister_device(chip->adc); |
201 | i2c_unregister_device(chip->rtc); | 202 | i2c_unregister_device(chip->rtc); |
202 | kfree(chip); | ||
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
205 | 205 | ||
diff --git a/drivers/mfd/max8998-irq.c b/drivers/mfd/max8998-irq.c index 5919710dc9ed..c469477eb778 100644 --- a/drivers/mfd/max8998-irq.c +++ b/drivers/mfd/max8998-irq.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
17 | #include <linux/irqdomain.h> | ||
17 | #include <linux/mfd/max8998-private.h> | 18 | #include <linux/mfd/max8998-private.h> |
18 | 19 | ||
19 | struct max8998_irq_data { | 20 | struct max8998_irq_data { |
@@ -99,7 +100,8 @@ static struct max8998_irq_data max8998_irqs[] = { | |||
99 | static inline struct max8998_irq_data * | 100 | static inline struct max8998_irq_data * |
100 | irq_to_max8998_irq(struct max8998_dev *max8998, int irq) | 101 | irq_to_max8998_irq(struct max8998_dev *max8998, int irq) |
101 | { | 102 | { |
102 | return &max8998_irqs[irq - max8998->irq_base]; | 103 | struct irq_data *data = irq_get_irq_data(irq); |
104 | return &max8998_irqs[data->hwirq]; | ||
103 | } | 105 | } |
104 | 106 | ||
105 | static void max8998_irq_lock(struct irq_data *data) | 107 | static void max8998_irq_lock(struct irq_data *data) |
@@ -176,8 +178,14 @@ static irqreturn_t max8998_irq_thread(int irq, void *data) | |||
176 | 178 | ||
177 | /* Report */ | 179 | /* Report */ |
178 | for (i = 0; i < MAX8998_IRQ_NR; i++) { | 180 | for (i = 0; i < MAX8998_IRQ_NR; i++) { |
179 | if (irq_reg[max8998_irqs[i].reg - 1] & max8998_irqs[i].mask) | 181 | if (irq_reg[max8998_irqs[i].reg - 1] & max8998_irqs[i].mask) { |
180 | handle_nested_irq(max8998->irq_base + i); | 182 | irq = irq_find_mapping(max8998->irq_domain, i); |
183 | if (WARN_ON(!irq)) { | ||
184 | disable_irq_nosync(max8998->irq); | ||
185 | return IRQ_NONE; | ||
186 | } | ||
187 | handle_nested_irq(irq); | ||
188 | } | ||
181 | } | 189 | } |
182 | 190 | ||
183 | return IRQ_HANDLED; | 191 | return IRQ_HANDLED; |
@@ -185,27 +193,40 @@ static irqreturn_t max8998_irq_thread(int irq, void *data) | |||
185 | 193 | ||
186 | int max8998_irq_resume(struct max8998_dev *max8998) | 194 | int max8998_irq_resume(struct max8998_dev *max8998) |
187 | { | 195 | { |
188 | if (max8998->irq && max8998->irq_base) | 196 | if (max8998->irq && max8998->irq_domain) |
189 | max8998_irq_thread(max8998->irq_base, max8998); | 197 | max8998_irq_thread(max8998->irq, max8998); |
198 | return 0; | ||
199 | } | ||
200 | |||
201 | static int max8998_irq_domain_map(struct irq_domain *d, unsigned int irq, | ||
202 | irq_hw_number_t hw) | ||
203 | { | ||
204 | struct max8997_dev *max8998 = d->host_data; | ||
205 | |||
206 | irq_set_chip_data(irq, max8998); | ||
207 | irq_set_chip_and_handler(irq, &max8998_irq_chip, handle_edge_irq); | ||
208 | irq_set_nested_thread(irq, 1); | ||
209 | #ifdef CONFIG_ARM | ||
210 | set_irq_flags(irq, IRQF_VALID); | ||
211 | #else | ||
212 | irq_set_noprobe(irq); | ||
213 | #endif | ||
190 | return 0; | 214 | return 0; |
191 | } | 215 | } |
192 | 216 | ||
217 | static struct irq_domain_ops max8998_irq_domain_ops = { | ||
218 | .map = max8998_irq_domain_map, | ||
219 | }; | ||
220 | |||
193 | int max8998_irq_init(struct max8998_dev *max8998) | 221 | int max8998_irq_init(struct max8998_dev *max8998) |
194 | { | 222 | { |
195 | int i; | 223 | int i; |
196 | int cur_irq; | ||
197 | int ret; | 224 | int ret; |
225 | struct irq_domain *domain; | ||
198 | 226 | ||
199 | if (!max8998->irq) { | 227 | if (!max8998->irq) { |
200 | dev_warn(max8998->dev, | 228 | dev_warn(max8998->dev, |
201 | "No interrupt specified, no interrupts\n"); | 229 | "No interrupt specified, no interrupts\n"); |
202 | max8998->irq_base = 0; | ||
203 | return 0; | ||
204 | } | ||
205 | |||
206 | if (!max8998->irq_base) { | ||
207 | dev_err(max8998->dev, | ||
208 | "No interrupt base specified, no interrupts\n"); | ||
209 | return 0; | 230 | return 0; |
210 | } | 231 | } |
211 | 232 | ||
@@ -221,19 +242,13 @@ int max8998_irq_init(struct max8998_dev *max8998) | |||
221 | max8998_write_reg(max8998->i2c, MAX8998_REG_STATUSM1, 0xff); | 242 | max8998_write_reg(max8998->i2c, MAX8998_REG_STATUSM1, 0xff); |
222 | max8998_write_reg(max8998->i2c, MAX8998_REG_STATUSM2, 0xff); | 243 | max8998_write_reg(max8998->i2c, MAX8998_REG_STATUSM2, 0xff); |
223 | 244 | ||
224 | /* register with genirq */ | 245 | domain = irq_domain_add_simple(NULL, MAX8998_IRQ_NR, |
225 | for (i = 0; i < MAX8998_IRQ_NR; i++) { | 246 | max8998->irq_base, &max8998_irq_domain_ops, max8998); |
226 | cur_irq = i + max8998->irq_base; | 247 | if (!domain) { |
227 | irq_set_chip_data(cur_irq, max8998); | 248 | dev_err(max8998->dev, "could not create irq domain\n"); |
228 | irq_set_chip_and_handler(cur_irq, &max8998_irq_chip, | 249 | return -ENODEV; |
229 | handle_edge_irq); | ||
230 | irq_set_nested_thread(cur_irq, 1); | ||
231 | #ifdef CONFIG_ARM | ||
232 | set_irq_flags(cur_irq, IRQF_VALID); | ||
233 | #else | ||
234 | irq_set_noprobe(cur_irq); | ||
235 | #endif | ||
236 | } | 250 | } |
251 | max8998->irq_domain = domain; | ||
237 | 252 | ||
238 | ret = request_threaded_irq(max8998->irq, NULL, max8998_irq_thread, | 253 | ret = request_threaded_irq(max8998->irq, NULL, max8998_irq_thread, |
239 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 254 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index d7218cc90945..21af51a499f4 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c | |||
@@ -20,12 +20,15 @@ | |||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/err.h> | ||
23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
24 | #include <linux/moduleparam.h> | 25 | #include <linux/moduleparam.h> |
25 | #include <linux/init.h> | 26 | #include <linux/init.h> |
26 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
27 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
28 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/of.h> | ||
31 | #include <linux/of_irq.h> | ||
29 | #include <linux/pm_runtime.h> | 32 | #include <linux/pm_runtime.h> |
30 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
31 | #include <linux/mfd/core.h> | 34 | #include <linux/mfd/core.h> |
@@ -128,6 +131,56 @@ int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask) | |||
128 | } | 131 | } |
129 | EXPORT_SYMBOL(max8998_update_reg); | 132 | EXPORT_SYMBOL(max8998_update_reg); |
130 | 133 | ||
134 | #ifdef CONFIG_OF | ||
135 | static struct of_device_id max8998_dt_match[] = { | ||
136 | { .compatible = "maxim,max8998", .data = (void *)TYPE_MAX8998 }, | ||
137 | { .compatible = "national,lp3974", .data = (void *)TYPE_LP3974 }, | ||
138 | { .compatible = "ti,lp3974", .data = (void *)TYPE_LP3974 }, | ||
139 | {}, | ||
140 | }; | ||
141 | MODULE_DEVICE_TABLE(of, max8998_dt_match); | ||
142 | #endif | ||
143 | |||
144 | /* | ||
145 | * Only the common platform data elements for max8998 are parsed here from the | ||
146 | * device tree. Other sub-modules of max8998 such as pmic, rtc and others have | ||
147 | * to parse their own platform data elements from device tree. | ||
148 | * | ||
149 | * The max8998 platform data structure is instantiated here and the drivers for | ||
150 | * the sub-modules need not instantiate another instance while parsing their | ||
151 | * platform data. | ||
152 | */ | ||
153 | static struct max8998_platform_data *max8998_i2c_parse_dt_pdata( | ||
154 | struct device *dev) | ||
155 | { | ||
156 | struct max8998_platform_data *pd; | ||
157 | |||
158 | pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); | ||
159 | if (!pd) | ||
160 | return ERR_PTR(-ENOMEM); | ||
161 | |||
162 | pd->ono = irq_of_parse_and_map(dev->of_node, 1); | ||
163 | |||
164 | /* | ||
165 | * ToDo: the 'wakeup' member in the platform data is more of a linux | ||
166 | * specfic information. Hence, there is no binding for that yet and | ||
167 | * not parsed here. | ||
168 | */ | ||
169 | return pd; | ||
170 | } | ||
171 | |||
172 | static inline int max8998_i2c_get_driver_data(struct i2c_client *i2c, | ||
173 | const struct i2c_device_id *id) | ||
174 | { | ||
175 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) { | ||
176 | const struct of_device_id *match; | ||
177 | match = of_match_node(max8998_dt_match, i2c->dev.of_node); | ||
178 | return (int)match->data; | ||
179 | } | ||
180 | |||
181 | return (int)id->driver_data; | ||
182 | } | ||
183 | |||
131 | static int max8998_i2c_probe(struct i2c_client *i2c, | 184 | static int max8998_i2c_probe(struct i2c_client *i2c, |
132 | const struct i2c_device_id *id) | 185 | const struct i2c_device_id *id) |
133 | { | 186 | { |
@@ -139,11 +192,20 @@ static int max8998_i2c_probe(struct i2c_client *i2c, | |||
139 | if (max8998 == NULL) | 192 | if (max8998 == NULL) |
140 | return -ENOMEM; | 193 | return -ENOMEM; |
141 | 194 | ||
195 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) { | ||
196 | pdata = max8998_i2c_parse_dt_pdata(&i2c->dev); | ||
197 | if (IS_ERR(pdata)) { | ||
198 | ret = PTR_ERR(pdata); | ||
199 | goto err; | ||
200 | } | ||
201 | } | ||
202 | |||
142 | i2c_set_clientdata(i2c, max8998); | 203 | i2c_set_clientdata(i2c, max8998); |
143 | max8998->dev = &i2c->dev; | 204 | max8998->dev = &i2c->dev; |
144 | max8998->i2c = i2c; | 205 | max8998->i2c = i2c; |
145 | max8998->irq = i2c->irq; | 206 | max8998->irq = i2c->irq; |
146 | max8998->type = id->driver_data; | 207 | max8998->type = max8998_i2c_get_driver_data(i2c, id); |
208 | max8998->pdata = pdata; | ||
147 | if (pdata) { | 209 | if (pdata) { |
148 | max8998->ono = pdata->ono; | 210 | max8998->ono = pdata->ono; |
149 | max8998->irq_base = pdata->irq_base; | 211 | max8998->irq_base = pdata->irq_base; |
@@ -158,7 +220,7 @@ static int max8998_i2c_probe(struct i2c_client *i2c, | |||
158 | 220 | ||
159 | pm_runtime_set_active(max8998->dev); | 221 | pm_runtime_set_active(max8998->dev); |
160 | 222 | ||
161 | switch (id->driver_data) { | 223 | switch (max8998->type) { |
162 | case TYPE_LP3974: | 224 | case TYPE_LP3974: |
163 | ret = mfd_add_devices(max8998->dev, -1, | 225 | ret = mfd_add_devices(max8998->dev, -1, |
164 | lp3974_devs, ARRAY_SIZE(lp3974_devs), | 226 | lp3974_devs, ARRAY_SIZE(lp3974_devs), |
@@ -314,6 +376,7 @@ static struct i2c_driver max8998_i2c_driver = { | |||
314 | .name = "max8998", | 376 | .name = "max8998", |
315 | .owner = THIS_MODULE, | 377 | .owner = THIS_MODULE, |
316 | .pm = &max8998_pm, | 378 | .pm = &max8998_pm, |
379 | .of_match_table = of_match_ptr(max8998_dt_match), | ||
317 | }, | 380 | }, |
318 | .probe = max8998_i2c_probe, | 381 | .probe = max8998_i2c_probe, |
319 | .remove = max8998_i2c_remove, | 382 | .remove = max8998_i2c_remove, |
diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c index f99d6299ec24..13198d937e36 100644 --- a/drivers/mfd/mcp-sa11x0.c +++ b/drivers/mfd/mcp-sa11x0.c | |||
@@ -225,8 +225,6 @@ static int mcp_sa11x0_probe(struct platform_device *dev) | |||
225 | if (ret == 0) | 225 | if (ret == 0) |
226 | return 0; | 226 | return 0; |
227 | 227 | ||
228 | platform_set_drvdata(dev, NULL); | ||
229 | |||
230 | err_ioremap: | 228 | err_ioremap: |
231 | iounmap(m->base1); | 229 | iounmap(m->base1); |
232 | iounmap(m->base0); | 230 | iounmap(m->base0); |
@@ -252,7 +250,6 @@ static int mcp_sa11x0_remove(struct platform_device *dev) | |||
252 | mem0 = platform_get_resource(dev, IORESOURCE_MEM, 0); | 250 | mem0 = platform_get_resource(dev, IORESOURCE_MEM, 0); |
253 | mem1 = platform_get_resource(dev, IORESOURCE_MEM, 1); | 251 | mem1 = platform_get_resource(dev, IORESOURCE_MEM, 1); |
254 | 252 | ||
255 | platform_set_drvdata(dev, NULL); | ||
256 | mcp_host_del(mcp); | 253 | mcp_host_del(mcp); |
257 | iounmap(m->base1); | 254 | iounmap(m->base1); |
258 | iounmap(m->base0); | 255 | iounmap(m->base0); |
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 53e9fe638d32..e4d1c706df8b 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c | |||
@@ -23,78 +23,7 @@ | |||
23 | #include <linux/err.h> | 23 | #include <linux/err.h> |
24 | #include <linux/mfd/core.h> | 24 | #include <linux/mfd/core.h> |
25 | #include <linux/mfd/palmas.h> | 25 | #include <linux/mfd/palmas.h> |
26 | #include <linux/of_platform.h> | 26 | #include <linux/of_device.h> |
27 | |||
28 | enum palmas_ids { | ||
29 | PALMAS_PMIC_ID, | ||
30 | PALMAS_GPIO_ID, | ||
31 | PALMAS_LEDS_ID, | ||
32 | PALMAS_WDT_ID, | ||
33 | PALMAS_RTC_ID, | ||
34 | PALMAS_PWRBUTTON_ID, | ||
35 | PALMAS_GPADC_ID, | ||
36 | PALMAS_RESOURCE_ID, | ||
37 | PALMAS_CLK_ID, | ||
38 | PALMAS_PWM_ID, | ||
39 | PALMAS_USB_ID, | ||
40 | }; | ||
41 | |||
42 | static struct resource palmas_rtc_resources[] = { | ||
43 | { | ||
44 | .start = PALMAS_RTC_ALARM_IRQ, | ||
45 | .end = PALMAS_RTC_ALARM_IRQ, | ||
46 | .flags = IORESOURCE_IRQ, | ||
47 | }, | ||
48 | }; | ||
49 | |||
50 | static const struct mfd_cell palmas_children[] = { | ||
51 | { | ||
52 | .name = "palmas-pmic", | ||
53 | .id = PALMAS_PMIC_ID, | ||
54 | }, | ||
55 | { | ||
56 | .name = "palmas-gpio", | ||
57 | .id = PALMAS_GPIO_ID, | ||
58 | }, | ||
59 | { | ||
60 | .name = "palmas-leds", | ||
61 | .id = PALMAS_LEDS_ID, | ||
62 | }, | ||
63 | { | ||
64 | .name = "palmas-wdt", | ||
65 | .id = PALMAS_WDT_ID, | ||
66 | }, | ||
67 | { | ||
68 | .name = "palmas-rtc", | ||
69 | .id = PALMAS_RTC_ID, | ||
70 | .resources = &palmas_rtc_resources[0], | ||
71 | .num_resources = ARRAY_SIZE(palmas_rtc_resources), | ||
72 | }, | ||
73 | { | ||
74 | .name = "palmas-pwrbutton", | ||
75 | .id = PALMAS_PWRBUTTON_ID, | ||
76 | }, | ||
77 | { | ||
78 | .name = "palmas-gpadc", | ||
79 | .id = PALMAS_GPADC_ID, | ||
80 | }, | ||
81 | { | ||
82 | .name = "palmas-resource", | ||
83 | .id = PALMAS_RESOURCE_ID, | ||
84 | }, | ||
85 | { | ||
86 | .name = "palmas-clk", | ||
87 | .id = PALMAS_CLK_ID, | ||
88 | }, | ||
89 | { | ||
90 | .name = "palmas-pwm", | ||
91 | .id = PALMAS_PWM_ID, | ||
92 | }, | ||
93 | { | ||
94 | .name = "palmas-usb", | ||
95 | .id = PALMAS_USB_ID, | ||
96 | } | ||
97 | }; | ||
98 | 27 | ||
99 | static const struct regmap_config palmas_regmap_config[PALMAS_NUM_CLIENTS] = { | 28 | static const struct regmap_config palmas_regmap_config[PALMAS_NUM_CLIENTS] = { |
100 | { | 29 | { |
@@ -302,6 +231,21 @@ static void palmas_dt_to_pdata(struct i2c_client *i2c, | |||
302 | palmas_set_pdata_irq_flag(i2c, pdata); | 231 | palmas_set_pdata_irq_flag(i2c, pdata); |
303 | } | 232 | } |
304 | 233 | ||
234 | static unsigned int palmas_features = PALMAS_PMIC_FEATURE_SMPS10_BOOST; | ||
235 | static unsigned int tps659038_features; | ||
236 | |||
237 | static const struct of_device_id of_palmas_match_tbl[] = { | ||
238 | { | ||
239 | .compatible = "ti,palmas", | ||
240 | .data = &palmas_features, | ||
241 | }, | ||
242 | { | ||
243 | .compatible = "ti,tps659038", | ||
244 | .data = &tps659038_features, | ||
245 | }, | ||
246 | { }, | ||
247 | }; | ||
248 | |||
305 | static int palmas_i2c_probe(struct i2c_client *i2c, | 249 | static int palmas_i2c_probe(struct i2c_client *i2c, |
306 | const struct i2c_device_id *id) | 250 | const struct i2c_device_id *id) |
307 | { | 251 | { |
@@ -309,9 +253,9 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
309 | struct palmas_platform_data *pdata; | 253 | struct palmas_platform_data *pdata; |
310 | struct device_node *node = i2c->dev.of_node; | 254 | struct device_node *node = i2c->dev.of_node; |
311 | int ret = 0, i; | 255 | int ret = 0, i; |
312 | unsigned int reg, addr; | 256 | unsigned int reg, addr, *features; |
313 | int slave; | 257 | int slave; |
314 | struct mfd_cell *children; | 258 | const struct of_device_id *match; |
315 | 259 | ||
316 | pdata = dev_get_platdata(&i2c->dev); | 260 | pdata = dev_get_platdata(&i2c->dev); |
317 | 261 | ||
@@ -333,9 +277,16 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
333 | 277 | ||
334 | i2c_set_clientdata(i2c, palmas); | 278 | i2c_set_clientdata(i2c, palmas); |
335 | palmas->dev = &i2c->dev; | 279 | palmas->dev = &i2c->dev; |
336 | palmas->id = id->driver_data; | ||
337 | palmas->irq = i2c->irq; | 280 | palmas->irq = i2c->irq; |
338 | 281 | ||
282 | match = of_match_device(of_match_ptr(of_palmas_match_tbl), &i2c->dev); | ||
283 | |||
284 | if (!match) | ||
285 | return -ENODATA; | ||
286 | |||
287 | features = (unsigned int *)match->data; | ||
288 | palmas->features = *features; | ||
289 | |||
339 | for (i = 0; i < PALMAS_NUM_CLIENTS; i++) { | 290 | for (i = 0; i < PALMAS_NUM_CLIENTS; i++) { |
340 | if (i == 0) | 291 | if (i == 0) |
341 | palmas->i2c_clients[i] = i2c; | 292 | palmas->i2c_clients[i] = i2c; |
@@ -362,6 +313,11 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
362 | } | 313 | } |
363 | } | 314 | } |
364 | 315 | ||
316 | if (!palmas->irq) { | ||
317 | dev_warn(palmas->dev, "IRQ missing: skipping irq request\n"); | ||
318 | goto no_irq; | ||
319 | } | ||
320 | |||
365 | /* Change interrupt line output polarity */ | 321 | /* Change interrupt line output polarity */ |
366 | if (pdata->irq_flags & IRQ_TYPE_LEVEL_HIGH) | 322 | if (pdata->irq_flags & IRQ_TYPE_LEVEL_HIGH) |
367 | reg = PALMAS_POLARITY_CTRL_INT_POLARITY; | 323 | reg = PALMAS_POLARITY_CTRL_INT_POLARITY; |
@@ -388,6 +344,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
388 | if (ret < 0) | 344 | if (ret < 0) |
389 | goto err; | 345 | goto err; |
390 | 346 | ||
347 | no_irq: | ||
391 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE); | 348 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE); |
392 | addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE, | 349 | addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE, |
393 | PALMAS_PRIMARY_SECONDARY_PAD1); | 350 | PALMAS_PRIMARY_SECONDARY_PAD1); |
@@ -472,42 +429,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
472 | return ret; | 429 | return ret; |
473 | } | 430 | } |
474 | 431 | ||
475 | children = kmemdup(palmas_children, sizeof(palmas_children), | ||
476 | GFP_KERNEL); | ||
477 | if (!children) { | ||
478 | ret = -ENOMEM; | ||
479 | goto err_irq; | ||
480 | } | ||
481 | |||
482 | children[PALMAS_PMIC_ID].platform_data = pdata->pmic_pdata; | ||
483 | children[PALMAS_PMIC_ID].pdata_size = sizeof(*pdata->pmic_pdata); | ||
484 | |||
485 | children[PALMAS_GPADC_ID].platform_data = pdata->gpadc_pdata; | ||
486 | children[PALMAS_GPADC_ID].pdata_size = sizeof(*pdata->gpadc_pdata); | ||
487 | |||
488 | children[PALMAS_RESOURCE_ID].platform_data = pdata->resource_pdata; | ||
489 | children[PALMAS_RESOURCE_ID].pdata_size = | ||
490 | sizeof(*pdata->resource_pdata); | ||
491 | |||
492 | children[PALMAS_USB_ID].platform_data = pdata->usb_pdata; | ||
493 | children[PALMAS_USB_ID].pdata_size = sizeof(*pdata->usb_pdata); | ||
494 | |||
495 | children[PALMAS_CLK_ID].platform_data = pdata->clk_pdata; | ||
496 | children[PALMAS_CLK_ID].pdata_size = sizeof(*pdata->clk_pdata); | ||
497 | |||
498 | ret = mfd_add_devices(palmas->dev, -1, | ||
499 | children, ARRAY_SIZE(palmas_children), | ||
500 | NULL, 0, | ||
501 | regmap_irq_get_domain(palmas->irq_data)); | ||
502 | kfree(children); | ||
503 | |||
504 | if (ret < 0) | ||
505 | goto err_devices; | ||
506 | |||
507 | return ret; | 432 | return ret; |
508 | 433 | ||
509 | err_devices: | ||
510 | mfd_remove_devices(palmas->dev); | ||
511 | err_irq: | 434 | err_irq: |
512 | regmap_del_irq_chip(palmas->irq, palmas->irq_data); | 435 | regmap_del_irq_chip(palmas->irq, palmas->irq_data); |
513 | err: | 436 | err: |
@@ -533,11 +456,6 @@ static const struct i2c_device_id palmas_i2c_id[] = { | |||
533 | }; | 456 | }; |
534 | MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); | 457 | MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); |
535 | 458 | ||
536 | static struct of_device_id of_palmas_match_tbl[] = { | ||
537 | { .compatible = "ti,palmas", }, | ||
538 | { /* end */ } | ||
539 | }; | ||
540 | |||
541 | static struct i2c_driver palmas_i2c_driver = { | 459 | static struct i2c_driver palmas_i2c_driver = { |
542 | .driver = { | 460 | .driver = { |
543 | .name = "palmas", | 461 | .name = "palmas", |
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c index 2a2d31687b72..c436bf27e78d 100644 --- a/drivers/mfd/rtl8411.c +++ b/drivers/mfd/rtl8411.c | |||
@@ -35,12 +35,33 @@ static u8 rtl8411_get_ic_version(struct rtsx_pcr *pcr) | |||
35 | return val & 0x0F; | 35 | return val & 0x0F; |
36 | } | 36 | } |
37 | 37 | ||
38 | static int rtl8411b_is_qfn48(struct rtsx_pcr *pcr) | ||
39 | { | ||
40 | u8 val = 0; | ||
41 | |||
42 | rtsx_pci_read_register(pcr, RTL8411B_PACKAGE_MODE, &val); | ||
43 | |||
44 | if (val & 0x2) | ||
45 | return 1; | ||
46 | else | ||
47 | return 0; | ||
48 | } | ||
49 | |||
38 | static int rtl8411_extra_init_hw(struct rtsx_pcr *pcr) | 50 | static int rtl8411_extra_init_hw(struct rtsx_pcr *pcr) |
39 | { | 51 | { |
40 | return rtsx_pci_write_register(pcr, CD_PAD_CTL, | 52 | return rtsx_pci_write_register(pcr, CD_PAD_CTL, |
41 | CD_DISABLE_MASK | CD_AUTO_DISABLE, CD_ENABLE); | 53 | CD_DISABLE_MASK | CD_AUTO_DISABLE, CD_ENABLE); |
42 | } | 54 | } |
43 | 55 | ||
56 | static int rtl8411b_extra_init_hw(struct rtsx_pcr *pcr) | ||
57 | { | ||
58 | if (rtl8411b_is_qfn48(pcr)) | ||
59 | rtsx_pci_write_register(pcr, CARD_PULL_CTL3, 0xFF, 0xF5); | ||
60 | |||
61 | return rtsx_pci_write_register(pcr, CD_PAD_CTL, | ||
62 | CD_DISABLE_MASK | CD_AUTO_DISABLE, CD_ENABLE); | ||
63 | } | ||
64 | |||
44 | static int rtl8411_turn_on_led(struct rtsx_pcr *pcr) | 65 | static int rtl8411_turn_on_led(struct rtsx_pcr *pcr) |
45 | { | 66 | { |
46 | return rtsx_pci_write_register(pcr, CARD_GPIO, 0x01, 0x00); | 67 | return rtsx_pci_write_register(pcr, CARD_GPIO, 0x01, 0x00); |
@@ -214,6 +235,20 @@ static const struct pcr_ops rtl8411_pcr_ops = { | |||
214 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, | 235 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, |
215 | }; | 236 | }; |
216 | 237 | ||
238 | static const struct pcr_ops rtl8411b_pcr_ops = { | ||
239 | .extra_init_hw = rtl8411b_extra_init_hw, | ||
240 | .optimize_phy = NULL, | ||
241 | .turn_on_led = rtl8411_turn_on_led, | ||
242 | .turn_off_led = rtl8411_turn_off_led, | ||
243 | .enable_auto_blink = rtl8411_enable_auto_blink, | ||
244 | .disable_auto_blink = rtl8411_disable_auto_blink, | ||
245 | .card_power_on = rtl8411_card_power_on, | ||
246 | .card_power_off = rtl8411_card_power_off, | ||
247 | .switch_output_voltage = rtl8411_switch_output_voltage, | ||
248 | .cd_deglitch = rtl8411_cd_deglitch, | ||
249 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, | ||
250 | }; | ||
251 | |||
217 | /* SD Pull Control Enable: | 252 | /* SD Pull Control Enable: |
218 | * SD_DAT[3:0] ==> pull up | 253 | * SD_DAT[3:0] ==> pull up |
219 | * SD_CD ==> pull up | 254 | * SD_CD ==> pull up |
@@ -276,6 +311,74 @@ static const u32 rtl8411_ms_pull_ctl_disable_tbl[] = { | |||
276 | 0, | 311 | 0, |
277 | }; | 312 | }; |
278 | 313 | ||
314 | static const u32 rtl8411b_qfn64_sd_pull_ctl_enable_tbl[] = { | ||
315 | RTSX_REG_PAIR(CARD_PULL_CTL1, 0xAA), | ||
316 | RTSX_REG_PAIR(CARD_PULL_CTL2, 0xAA), | ||
317 | RTSX_REG_PAIR(CARD_PULL_CTL3, 0x09 | 0xD0), | ||
318 | RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09 | 0x50), | ||
319 | RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05 | 0x50), | ||
320 | RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11), | ||
321 | 0, | ||
322 | }; | ||
323 | |||
324 | static const u32 rtl8411b_qfn48_sd_pull_ctl_enable_tbl[] = { | ||
325 | RTSX_REG_PAIR(CARD_PULL_CTL2, 0xAA), | ||
326 | RTSX_REG_PAIR(CARD_PULL_CTL3, 0x69 | 0x90), | ||
327 | RTSX_REG_PAIR(CARD_PULL_CTL6, 0x08 | 0x11), | ||
328 | 0, | ||
329 | }; | ||
330 | |||
331 | static const u32 rtl8411b_qfn64_sd_pull_ctl_disable_tbl[] = { | ||
332 | RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65), | ||
333 | RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55), | ||
334 | RTSX_REG_PAIR(CARD_PULL_CTL3, 0x05 | 0xD0), | ||
335 | RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09 | 0x50), | ||
336 | RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05 | 0x50), | ||
337 | RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11), | ||
338 | 0, | ||
339 | }; | ||
340 | |||
341 | static const u32 rtl8411b_qfn48_sd_pull_ctl_disable_tbl[] = { | ||
342 | RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55), | ||
343 | RTSX_REG_PAIR(CARD_PULL_CTL3, 0x65 | 0x90), | ||
344 | RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11), | ||
345 | 0, | ||
346 | }; | ||
347 | |||
348 | static const u32 rtl8411b_qfn64_ms_pull_ctl_enable_tbl[] = { | ||
349 | RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65), | ||
350 | RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55), | ||
351 | RTSX_REG_PAIR(CARD_PULL_CTL3, 0x05 | 0xD0), | ||
352 | RTSX_REG_PAIR(CARD_PULL_CTL4, 0x05 | 0x50), | ||
353 | RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05 | 0x50), | ||
354 | RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11), | ||
355 | 0, | ||
356 | }; | ||
357 | |||
358 | static const u32 rtl8411b_qfn48_ms_pull_ctl_enable_tbl[] = { | ||
359 | RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55), | ||
360 | RTSX_REG_PAIR(CARD_PULL_CTL3, 0x65 | 0x90), | ||
361 | RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11), | ||
362 | 0, | ||
363 | }; | ||
364 | |||
365 | static const u32 rtl8411b_qfn64_ms_pull_ctl_disable_tbl[] = { | ||
366 | RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65), | ||
367 | RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55), | ||
368 | RTSX_REG_PAIR(CARD_PULL_CTL3, 0x05 | 0xD0), | ||
369 | RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09 | 0x50), | ||
370 | RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05 | 0x50), | ||
371 | RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11), | ||
372 | 0, | ||
373 | }; | ||
374 | |||
375 | static const u32 rtl8411b_qfn48_ms_pull_ctl_disable_tbl[] = { | ||
376 | RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55), | ||
377 | RTSX_REG_PAIR(CARD_PULL_CTL3, 0x65 | 0x90), | ||
378 | RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11), | ||
379 | 0, | ||
380 | }; | ||
381 | |||
279 | void rtl8411_init_params(struct rtsx_pcr *pcr) | 382 | void rtl8411_init_params(struct rtsx_pcr *pcr) |
280 | { | 383 | { |
281 | pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104; | 384 | pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104; |
@@ -288,3 +391,32 @@ void rtl8411_init_params(struct rtsx_pcr *pcr) | |||
288 | pcr->ms_pull_ctl_enable_tbl = rtl8411_ms_pull_ctl_enable_tbl; | 391 | pcr->ms_pull_ctl_enable_tbl = rtl8411_ms_pull_ctl_enable_tbl; |
289 | pcr->ms_pull_ctl_disable_tbl = rtl8411_ms_pull_ctl_disable_tbl; | 392 | pcr->ms_pull_ctl_disable_tbl = rtl8411_ms_pull_ctl_disable_tbl; |
290 | } | 393 | } |
394 | |||
395 | void rtl8411b_init_params(struct rtsx_pcr *pcr) | ||
396 | { | ||
397 | pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104; | ||
398 | pcr->num_slots = 2; | ||
399 | pcr->ops = &rtl8411b_pcr_ops; | ||
400 | |||
401 | pcr->ic_version = rtl8411_get_ic_version(pcr); | ||
402 | |||
403 | if (rtl8411b_is_qfn48(pcr)) { | ||
404 | pcr->sd_pull_ctl_enable_tbl = | ||
405 | rtl8411b_qfn48_sd_pull_ctl_enable_tbl; | ||
406 | pcr->sd_pull_ctl_disable_tbl = | ||
407 | rtl8411b_qfn48_sd_pull_ctl_disable_tbl; | ||
408 | pcr->ms_pull_ctl_enable_tbl = | ||
409 | rtl8411b_qfn48_ms_pull_ctl_enable_tbl; | ||
410 | pcr->ms_pull_ctl_disable_tbl = | ||
411 | rtl8411b_qfn48_ms_pull_ctl_disable_tbl; | ||
412 | } else { | ||
413 | pcr->sd_pull_ctl_enable_tbl = | ||
414 | rtl8411b_qfn64_sd_pull_ctl_enable_tbl; | ||
415 | pcr->sd_pull_ctl_disable_tbl = | ||
416 | rtl8411b_qfn64_sd_pull_ctl_disable_tbl; | ||
417 | pcr->ms_pull_ctl_enable_tbl = | ||
418 | rtl8411b_qfn64_ms_pull_ctl_enable_tbl; | ||
419 | pcr->ms_pull_ctl_disable_tbl = | ||
420 | rtl8411b_qfn64_ms_pull_ctl_disable_tbl; | ||
421 | } | ||
422 | } | ||
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index e968c01ca2ac..dd186c4103c1 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -57,6 +57,7 @@ static DEFINE_PCI_DEVICE_TABLE(rtsx_pci_ids) = { | |||
57 | { PCI_DEVICE(0x10EC, 0x5289), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | 57 | { PCI_DEVICE(0x10EC, 0x5289), PCI_CLASS_OTHERS << 16, 0xFF0000 }, |
58 | { PCI_DEVICE(0x10EC, 0x5227), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | 58 | { PCI_DEVICE(0x10EC, 0x5227), PCI_CLASS_OTHERS << 16, 0xFF0000 }, |
59 | { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | 59 | { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 }, |
60 | { PCI_DEVICE(0x10EC, 0x5287), PCI_CLASS_OTHERS << 16, 0xFF0000 }, | ||
60 | { 0, } | 61 | { 0, } |
61 | }; | 62 | }; |
62 | 63 | ||
@@ -1038,6 +1039,10 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr) | |||
1038 | case 0x5249: | 1039 | case 0x5249: |
1039 | rts5249_init_params(pcr); | 1040 | rts5249_init_params(pcr); |
1040 | break; | 1041 | break; |
1042 | |||
1043 | case 0x5287: | ||
1044 | rtl8411b_init_params(pcr); | ||
1045 | break; | ||
1041 | } | 1046 | } |
1042 | 1047 | ||
1043 | dev_dbg(&(pcr->pci->dev), "PID: 0x%04x, IC version: 0x%02x\n", | 1048 | dev_dbg(&(pcr->pci->dev), "PID: 0x%04x, IC version: 0x%02x\n", |
diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h index 55fcfc25c4e4..c0cac7e8972f 100644 --- a/drivers/mfd/rtsx_pcr.h +++ b/drivers/mfd/rtsx_pcr.h | |||
@@ -33,5 +33,6 @@ void rts5229_init_params(struct rtsx_pcr *pcr); | |||
33 | void rtl8411_init_params(struct rtsx_pcr *pcr); | 33 | void rtl8411_init_params(struct rtsx_pcr *pcr); |
34 | void rts5227_init_params(struct rtsx_pcr *pcr); | 34 | void rts5227_init_params(struct rtsx_pcr *pcr); |
35 | void rts5249_init_params(struct rtsx_pcr *pcr); | 35 | void rts5249_init_params(struct rtsx_pcr *pcr); |
36 | void rtl8411b_init_params(struct rtsx_pcr *pcr); | ||
36 | 37 | ||
37 | #endif | 38 | #endif |
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 77ee26ef5941..79767681483a 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include <linux/mfd/samsung/core.h> | 25 | #include <linux/mfd/samsung/core.h> |
26 | #include <linux/mfd/samsung/irq.h> | 26 | #include <linux/mfd/samsung/irq.h> |
27 | #include <linux/mfd/samsung/rtc.h> | 27 | #include <linux/mfd/samsung/rtc.h> |
28 | #include <linux/mfd/samsung/s2mps11.h> | ||
29 | #include <linux/mfd/samsung/s5m8763.h> | ||
30 | #include <linux/mfd/samsung/s5m8767.h> | ||
28 | #include <linux/regmap.h> | 31 | #include <linux/regmap.h> |
29 | 32 | ||
30 | static struct mfd_cell s5m8751_devs[] = { | 33 | static struct mfd_cell s5m8751_devs[] = { |
@@ -105,6 +108,26 @@ static struct regmap_config sec_regmap_config = { | |||
105 | .val_bits = 8, | 108 | .val_bits = 8, |
106 | }; | 109 | }; |
107 | 110 | ||
111 | static struct regmap_config s2mps11_regmap_config = { | ||
112 | .reg_bits = 8, | ||
113 | .val_bits = 8, | ||
114 | |||
115 | .max_register = S2MPS11_REG_L38CTRL, | ||
116 | }; | ||
117 | |||
118 | static struct regmap_config s5m8763_regmap_config = { | ||
119 | .reg_bits = 8, | ||
120 | .val_bits = 8, | ||
121 | |||
122 | .max_register = S5M8763_REG_LBCNFG2, | ||
123 | }; | ||
124 | |||
125 | static struct regmap_config s5m8767_regmap_config = { | ||
126 | .reg_bits = 8, | ||
127 | .val_bits = 8, | ||
128 | |||
129 | .max_register = S5M8767_REG_LDO28CTRL, | ||
130 | }; | ||
108 | 131 | ||
109 | #ifdef CONFIG_OF | 132 | #ifdef CONFIG_OF |
110 | /* | 133 | /* |
@@ -160,6 +183,7 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
160 | const struct i2c_device_id *id) | 183 | const struct i2c_device_id *id) |
161 | { | 184 | { |
162 | struct sec_platform_data *pdata = i2c->dev.platform_data; | 185 | struct sec_platform_data *pdata = i2c->dev.platform_data; |
186 | const struct regmap_config *regmap; | ||
163 | struct sec_pmic_dev *sec_pmic; | 187 | struct sec_pmic_dev *sec_pmic; |
164 | int ret; | 188 | int ret; |
165 | 189 | ||
@@ -190,7 +214,22 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
190 | sec_pmic->pdata = pdata; | 214 | sec_pmic->pdata = pdata; |
191 | } | 215 | } |
192 | 216 | ||
193 | sec_pmic->regmap = devm_regmap_init_i2c(i2c, &sec_regmap_config); | 217 | switch (sec_pmic->device_type) { |
218 | case S2MPS11X: | ||
219 | regmap = &s2mps11_regmap_config; | ||
220 | break; | ||
221 | case S5M8763X: | ||
222 | regmap = &s5m8763_regmap_config; | ||
223 | break; | ||
224 | case S5M8767X: | ||
225 | regmap = &s5m8767_regmap_config; | ||
226 | break; | ||
227 | default: | ||
228 | regmap = &sec_regmap_config; | ||
229 | break; | ||
230 | } | ||
231 | |||
232 | sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap); | ||
194 | if (IS_ERR(sec_pmic->regmap)) { | 233 | if (IS_ERR(sec_pmic->regmap)) { |
195 | ret = PTR_ERR(sec_pmic->regmap); | 234 | ret = PTR_ERR(sec_pmic->regmap); |
196 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", | 235 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
@@ -230,13 +269,12 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
230 | BUG(); | 269 | BUG(); |
231 | } | 270 | } |
232 | 271 | ||
233 | if (ret < 0) | 272 | if (ret) |
234 | goto err; | 273 | goto err; |
235 | 274 | ||
236 | return ret; | 275 | return ret; |
237 | 276 | ||
238 | err: | 277 | err: |
239 | mfd_remove_devices(sec_pmic->dev); | ||
240 | sec_irq_exit(sec_pmic); | 278 | sec_irq_exit(sec_pmic); |
241 | i2c_unregister_device(sec_pmic->rtc); | 279 | i2c_unregister_device(sec_pmic->rtc); |
242 | return ret; | 280 | return ret; |
diff --git a/drivers/ssbi/ssbi.c b/drivers/mfd/ssbi.c index 102a22844297..102a22844297 100644 --- a/drivers/ssbi/ssbi.c +++ b/drivers/mfd/ssbi.c | |||
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index b32940ec9034..a21bff283a98 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c | |||
@@ -422,7 +422,6 @@ static int t7l66xb_remove(struct platform_device *dev) | |||
422 | iounmap(t7l66xb->scr); | 422 | iounmap(t7l66xb->scr); |
423 | release_resource(&t7l66xb->rscr); | 423 | release_resource(&t7l66xb->rscr); |
424 | mfd_remove_devices(&dev->dev); | 424 | mfd_remove_devices(&dev->dev); |
425 | platform_set_drvdata(dev, NULL); | ||
426 | kfree(t7l66xb); | 425 | kfree(t7l66xb); |
427 | 426 | ||
428 | return ret; | 427 | return ret; |
diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c index 366f7b906278..65c425a517c5 100644 --- a/drivers/mfd/tc6387xb.c +++ b/drivers/mfd/tc6387xb.c | |||
@@ -217,7 +217,6 @@ static int tc6387xb_remove(struct platform_device *dev) | |||
217 | release_resource(&tc6387xb->rscr); | 217 | release_resource(&tc6387xb->rscr); |
218 | clk_disable(tc6387xb->clk32k); | 218 | clk_disable(tc6387xb->clk32k); |
219 | clk_put(tc6387xb->clk32k); | 219 | clk_put(tc6387xb->clk32k); |
220 | platform_set_drvdata(dev, NULL); | ||
221 | kfree(tc6387xb); | 220 | kfree(tc6387xb); |
222 | 221 | ||
223 | return 0; | 222 | return 0; |
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index 15e1463e5e13..a563dfa3cf87 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c | |||
@@ -756,7 +756,6 @@ static int tc6393xb_remove(struct platform_device *dev) | |||
756 | clk_disable(tc6393xb->clk); | 756 | clk_disable(tc6393xb->clk); |
757 | iounmap(tc6393xb->scr); | 757 | iounmap(tc6393xb->scr); |
758 | release_resource(&tc6393xb->rscr); | 758 | release_resource(&tc6393xb->rscr); |
759 | platform_set_drvdata(dev, NULL); | ||
760 | clk_put(tc6393xb->clk); | 759 | clk_put(tc6393xb->clk); |
761 | kfree(tc6393xb); | 760 | kfree(tc6393xb); |
762 | 761 | ||
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c index e9f3fb510b44..b003a16ba227 100644 --- a/drivers/mfd/ti_am335x_tscadc.c +++ b/drivers/mfd/ti_am335x_tscadc.c | |||
@@ -22,10 +22,10 @@ | |||
22 | #include <linux/regmap.h> | 22 | #include <linux/regmap.h> |
23 | #include <linux/mfd/core.h> | 23 | #include <linux/mfd/core.h> |
24 | #include <linux/pm_runtime.h> | 24 | #include <linux/pm_runtime.h> |
25 | #include <linux/of.h> | ||
26 | #include <linux/of_device.h> | ||
25 | 27 | ||
26 | #include <linux/mfd/ti_am335x_tscadc.h> | 28 | #include <linux/mfd/ti_am335x_tscadc.h> |
27 | #include <linux/input/ti_am335x_tsc.h> | ||
28 | #include <linux/platform_data/ti_am335x_adc.h> | ||
29 | 29 | ||
30 | static unsigned int tscadc_readl(struct ti_tscadc_dev *tsadc, unsigned int reg) | 30 | static unsigned int tscadc_readl(struct ti_tscadc_dev *tsadc, unsigned int reg) |
31 | { | 31 | { |
@@ -48,6 +48,32 @@ static const struct regmap_config tscadc_regmap_config = { | |||
48 | .val_bits = 32, | 48 | .val_bits = 32, |
49 | }; | 49 | }; |
50 | 50 | ||
51 | void am335x_tsc_se_update(struct ti_tscadc_dev *tsadc) | ||
52 | { | ||
53 | tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache); | ||
54 | } | ||
55 | EXPORT_SYMBOL_GPL(am335x_tsc_se_update); | ||
56 | |||
57 | void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val) | ||
58 | { | ||
59 | spin_lock(&tsadc->reg_lock); | ||
60 | tsadc->reg_se_cache |= val; | ||
61 | spin_unlock(&tsadc->reg_lock); | ||
62 | |||
63 | am335x_tsc_se_update(tsadc); | ||
64 | } | ||
65 | EXPORT_SYMBOL_GPL(am335x_tsc_se_set); | ||
66 | |||
67 | void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val) | ||
68 | { | ||
69 | spin_lock(&tsadc->reg_lock); | ||
70 | tsadc->reg_se_cache &= ~val; | ||
71 | spin_unlock(&tsadc->reg_lock); | ||
72 | |||
73 | am335x_tsc_se_update(tsadc); | ||
74 | } | ||
75 | EXPORT_SYMBOL_GPL(am335x_tsc_se_clr); | ||
76 | |||
51 | static void tscadc_idle_config(struct ti_tscadc_dev *config) | 77 | static void tscadc_idle_config(struct ti_tscadc_dev *config) |
52 | { | 78 | { |
53 | unsigned int idleconfig; | 79 | unsigned int idleconfig; |
@@ -63,27 +89,48 @@ static int ti_tscadc_probe(struct platform_device *pdev) | |||
63 | struct ti_tscadc_dev *tscadc; | 89 | struct ti_tscadc_dev *tscadc; |
64 | struct resource *res; | 90 | struct resource *res; |
65 | struct clk *clk; | 91 | struct clk *clk; |
66 | struct mfd_tscadc_board *pdata = pdev->dev.platform_data; | 92 | struct device_node *node = pdev->dev.of_node; |
67 | struct mfd_cell *cell; | 93 | struct mfd_cell *cell; |
94 | struct property *prop; | ||
95 | const __be32 *cur; | ||
96 | u32 val; | ||
68 | int err, ctrl; | 97 | int err, ctrl; |
69 | int clk_value, clock_rate; | 98 | int clk_value, clock_rate; |
70 | int tsc_wires, adc_channels = 0, total_channels; | 99 | int tsc_wires = 0, adc_channels = 0, total_channels; |
100 | int readouts = 0; | ||
71 | 101 | ||
72 | if (!pdata) { | 102 | if (!pdev->dev.of_node) { |
73 | dev_err(&pdev->dev, "Could not find platform data\n"); | 103 | dev_err(&pdev->dev, "Could not find valid DT data.\n"); |
74 | return -EINVAL; | 104 | return -EINVAL; |
75 | } | 105 | } |
76 | 106 | ||
77 | if (pdata->adc_init) | 107 | node = of_get_child_by_name(pdev->dev.of_node, "tsc"); |
78 | adc_channels = pdata->adc_init->adc_channels; | 108 | of_property_read_u32(node, "ti,wires", &tsc_wires); |
79 | 109 | of_property_read_u32(node, "ti,coordiante-readouts", &readouts); | |
80 | tsc_wires = pdata->tsc_init->wires; | 110 | |
111 | node = of_get_child_by_name(pdev->dev.of_node, "adc"); | ||
112 | of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) { | ||
113 | adc_channels++; | ||
114 | if (val > 7) { | ||
115 | dev_err(&pdev->dev, " PIN numbers are 0..7 (not %d)\n", | ||
116 | val); | ||
117 | return -EINVAL; | ||
118 | } | ||
119 | } | ||
81 | total_channels = tsc_wires + adc_channels; | 120 | total_channels = tsc_wires + adc_channels; |
82 | |||
83 | if (total_channels > 8) { | 121 | if (total_channels > 8) { |
84 | dev_err(&pdev->dev, "Number of i/p channels more than 8\n"); | 122 | dev_err(&pdev->dev, "Number of i/p channels more than 8\n"); |
85 | return -EINVAL; | 123 | return -EINVAL; |
86 | } | 124 | } |
125 | if (total_channels == 0) { | ||
126 | dev_err(&pdev->dev, "Need atleast one channel.\n"); | ||
127 | return -EINVAL; | ||
128 | } | ||
129 | |||
130 | if (readouts * 2 + 2 + adc_channels > 16) { | ||
131 | dev_err(&pdev->dev, "Too many step configurations requested\n"); | ||
132 | return -EINVAL; | ||
133 | } | ||
87 | 134 | ||
88 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 135 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
89 | if (!res) { | 136 | if (!res) { |
@@ -129,6 +176,7 @@ static int ti_tscadc_probe(struct platform_device *pdev) | |||
129 | goto ret; | 176 | goto ret; |
130 | } | 177 | } |
131 | 178 | ||
179 | spin_lock_init(&tscadc->reg_lock); | ||
132 | pm_runtime_enable(&pdev->dev); | 180 | pm_runtime_enable(&pdev->dev); |
133 | pm_runtime_get_sync(&pdev->dev); | 181 | pm_runtime_get_sync(&pdev->dev); |
134 | 182 | ||
@@ -173,26 +221,37 @@ static int ti_tscadc_probe(struct platform_device *pdev) | |||
173 | ctrl |= CNTRLREG_TSCSSENB; | 221 | ctrl |= CNTRLREG_TSCSSENB; |
174 | tscadc_writel(tscadc, REG_CTRL, ctrl); | 222 | tscadc_writel(tscadc, REG_CTRL, ctrl); |
175 | 223 | ||
224 | tscadc->used_cells = 0; | ||
225 | tscadc->tsc_cell = -1; | ||
226 | tscadc->adc_cell = -1; | ||
227 | |||
176 | /* TSC Cell */ | 228 | /* TSC Cell */ |
177 | cell = &tscadc->cells[TSC_CELL]; | 229 | if (tsc_wires > 0) { |
178 | cell->name = "tsc"; | 230 | tscadc->tsc_cell = tscadc->used_cells; |
179 | cell->platform_data = tscadc; | 231 | cell = &tscadc->cells[tscadc->used_cells++]; |
180 | cell->pdata_size = sizeof(*tscadc); | 232 | cell->name = "TI-am335x-tsc"; |
233 | cell->of_compatible = "ti,am3359-tsc"; | ||
234 | cell->platform_data = &tscadc; | ||
235 | cell->pdata_size = sizeof(tscadc); | ||
236 | } | ||
181 | 237 | ||
182 | /* ADC Cell */ | 238 | /* ADC Cell */ |
183 | cell = &tscadc->cells[ADC_CELL]; | 239 | if (adc_channels > 0) { |
184 | cell->name = "tiadc"; | 240 | tscadc->adc_cell = tscadc->used_cells; |
185 | cell->platform_data = tscadc; | 241 | cell = &tscadc->cells[tscadc->used_cells++]; |
186 | cell->pdata_size = sizeof(*tscadc); | 242 | cell->name = "TI-am335x-adc"; |
243 | cell->of_compatible = "ti,am3359-adc"; | ||
244 | cell->platform_data = &tscadc; | ||
245 | cell->pdata_size = sizeof(tscadc); | ||
246 | } | ||
187 | 247 | ||
188 | err = mfd_add_devices(&pdev->dev, pdev->id, tscadc->cells, | 248 | err = mfd_add_devices(&pdev->dev, pdev->id, tscadc->cells, |
189 | TSCADC_CELLS, NULL, 0, NULL); | 249 | tscadc->used_cells, NULL, 0, NULL); |
190 | if (err < 0) | 250 | if (err < 0) |
191 | goto err_disable_clk; | 251 | goto err_disable_clk; |
192 | 252 | ||
193 | device_init_wakeup(&pdev->dev, true); | 253 | device_init_wakeup(&pdev->dev, true); |
194 | platform_set_drvdata(pdev, tscadc); | 254 | platform_set_drvdata(pdev, tscadc); |
195 | |||
196 | return 0; | 255 | return 0; |
197 | 256 | ||
198 | err_disable_clk: | 257 | err_disable_clk: |
@@ -239,7 +298,7 @@ static int tscadc_resume(struct device *dev) | |||
239 | CNTRLREG_STEPID | CNTRLREG_4WIRE; | 298 | CNTRLREG_STEPID | CNTRLREG_4WIRE; |
240 | tscadc_writel(tscadc_dev, REG_CTRL, ctrl); | 299 | tscadc_writel(tscadc_dev, REG_CTRL, ctrl); |
241 | tscadc_idle_config(tscadc_dev); | 300 | tscadc_idle_config(tscadc_dev); |
242 | tscadc_writel(tscadc_dev, REG_SE, STPENB_STEPENB); | 301 | am335x_tsc_se_update(tscadc_dev); |
243 | restore = tscadc_readl(tscadc_dev, REG_CTRL); | 302 | restore = tscadc_readl(tscadc_dev, REG_CTRL); |
244 | tscadc_writel(tscadc_dev, REG_CTRL, | 303 | tscadc_writel(tscadc_dev, REG_CTRL, |
245 | (restore | CNTRLREG_TSCSSENB)); | 304 | (restore | CNTRLREG_TSCSSENB)); |
@@ -256,11 +315,18 @@ static const struct dev_pm_ops tscadc_pm_ops = { | |||
256 | #define TSCADC_PM_OPS NULL | 315 | #define TSCADC_PM_OPS NULL |
257 | #endif | 316 | #endif |
258 | 317 | ||
318 | static const struct of_device_id ti_tscadc_dt_ids[] = { | ||
319 | { .compatible = "ti,am3359-tscadc", }, | ||
320 | { } | ||
321 | }; | ||
322 | MODULE_DEVICE_TABLE(of, ti_tscadc_dt_ids); | ||
323 | |||
259 | static struct platform_driver ti_tscadc_driver = { | 324 | static struct platform_driver ti_tscadc_driver = { |
260 | .driver = { | 325 | .driver = { |
261 | .name = "ti_tscadc", | 326 | .name = "ti_am3359-tscadc", |
262 | .owner = THIS_MODULE, | 327 | .owner = THIS_MODULE, |
263 | .pm = TSCADC_PM_OPS, | 328 | .pm = TSCADC_PM_OPS, |
329 | .of_match_table = of_match_ptr(ti_tscadc_dt_ids), | ||
264 | }, | 330 | }, |
265 | .probe = ti_tscadc_probe, | 331 | .probe = ti_tscadc_probe, |
266 | .remove = ti_tscadc_remove, | 332 | .remove = ti_tscadc_remove, |
diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c index aeb8e40ab424..479886a4cf80 100644 --- a/drivers/mfd/tps65912-core.c +++ b/drivers/mfd/tps65912-core.c | |||
@@ -162,7 +162,6 @@ int tps65912_device_init(struct tps65912 *tps65912) | |||
162 | err: | 162 | err: |
163 | kfree(init_data); | 163 | kfree(init_data); |
164 | mfd_remove_devices(tps65912->dev); | 164 | mfd_remove_devices(tps65912->dev); |
165 | kfree(tps65912); | ||
166 | return ret; | 165 | return ret; |
167 | } | 166 | } |
168 | 167 | ||
@@ -170,7 +169,6 @@ void tps65912_device_exit(struct tps65912 *tps65912) | |||
170 | { | 169 | { |
171 | mfd_remove_devices(tps65912->dev); | 170 | mfd_remove_devices(tps65912->dev); |
172 | tps65912_irq_exit(tps65912); | 171 | tps65912_irq_exit(tps65912); |
173 | kfree(tps65912); | ||
174 | } | 172 | } |
175 | 173 | ||
176 | MODULE_AUTHOR("Margarita Olaya <magi@slimlogic.co.uk>"); | 174 | MODULE_AUTHOR("Margarita Olaya <magi@slimlogic.co.uk>"); |
diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c index c041f2c3d2bd..6a6343ee95fe 100644 --- a/drivers/mfd/tps65912-i2c.c +++ b/drivers/mfd/tps65912-i2c.c | |||
@@ -77,7 +77,8 @@ static int tps65912_i2c_probe(struct i2c_client *i2c, | |||
77 | { | 77 | { |
78 | struct tps65912 *tps65912; | 78 | struct tps65912 *tps65912; |
79 | 79 | ||
80 | tps65912 = kzalloc(sizeof(struct tps65912), GFP_KERNEL); | 80 | tps65912 = devm_kzalloc(&i2c->dev, |
81 | sizeof(struct tps65912), GFP_KERNEL); | ||
81 | if (tps65912 == NULL) | 82 | if (tps65912 == NULL) |
82 | return -ENOMEM; | 83 | return -ENOMEM; |
83 | 84 | ||
diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c index b45f460d299f..69a5178bf152 100644 --- a/drivers/mfd/tps65912-spi.c +++ b/drivers/mfd/tps65912-spi.c | |||
@@ -85,7 +85,8 @@ static int tps65912_spi_probe(struct spi_device *spi) | |||
85 | { | 85 | { |
86 | struct tps65912 *tps65912; | 86 | struct tps65912 *tps65912; |
87 | 87 | ||
88 | tps65912 = kzalloc(sizeof(struct tps65912), GFP_KERNEL); | 88 | tps65912 = devm_kzalloc(&spi->dev, |
89 | sizeof(struct tps65912), GFP_KERNEL); | ||
89 | if (tps65912 == NULL) | 90 | if (tps65912 == NULL) |
90 | return -ENOMEM; | 91 | return -ENOMEM; |
91 | 92 | ||
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 89ab4d970643..7f150d94d295 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
@@ -118,7 +118,7 @@ | |||
118 | #define TWL6030_BASEADD_GASGAUGE 0x00C0 | 118 | #define TWL6030_BASEADD_GASGAUGE 0x00C0 |
119 | #define TWL6030_BASEADD_PIH 0x00D0 | 119 | #define TWL6030_BASEADD_PIH 0x00D0 |
120 | #define TWL6030_BASEADD_CHARGER 0x00E0 | 120 | #define TWL6030_BASEADD_CHARGER 0x00E0 |
121 | #define TWL6025_BASEADD_CHARGER 0x00DA | 121 | #define TWL6032_BASEADD_CHARGER 0x00DA |
122 | #define TWL6030_BASEADD_LED 0x00F4 | 122 | #define TWL6030_BASEADD_LED 0x00F4 |
123 | 123 | ||
124 | /* subchip/slave 2 0x4A - DFT */ | 124 | /* subchip/slave 2 0x4A - DFT */ |
@@ -718,9 +718,9 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, | |||
718 | | REGULATOR_CHANGE_STATUS, | 718 | | REGULATOR_CHANGE_STATUS, |
719 | }; | 719 | }; |
720 | 720 | ||
721 | if (features & TWL6025_SUBCLASS) { | 721 | if (features & TWL6032_SUBCLASS) { |
722 | usb3v3.supply = "ldousb"; | 722 | usb3v3.supply = "ldousb"; |
723 | regulator = TWL6025_REG_LDOUSB; | 723 | regulator = TWL6032_REG_LDOUSB; |
724 | } else { | 724 | } else { |
725 | usb3v3.supply = "vusb"; | 725 | usb3v3.supply = "vusb"; |
726 | regulator = TWL6030_REG_VUSB; | 726 | regulator = TWL6030_REG_VUSB; |
@@ -747,8 +747,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, | |||
747 | usb3v3.dev_name = dev_name(child); | 747 | usb3v3.dev_name = dev_name(child); |
748 | } else if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && | 748 | } else if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && |
749 | twl_class_is_6030()) { | 749 | twl_class_is_6030()) { |
750 | if (features & TWL6025_SUBCLASS) | 750 | if (features & TWL6032_SUBCLASS) |
751 | child = add_regulator(TWL6025_REG_LDOUSB, | 751 | child = add_regulator(TWL6032_REG_LDOUSB, |
752 | pdata->ldousb, features); | 752 | pdata->ldousb, features); |
753 | else | 753 | else |
754 | child = add_regulator(TWL6030_REG_VUSB, | 754 | child = add_regulator(TWL6030_REG_VUSB, |
@@ -872,7 +872,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, | |||
872 | 872 | ||
873 | /* twl6030 regulators */ | 873 | /* twl6030 regulators */ |
874 | if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() && | 874 | if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() && |
875 | !(features & TWL6025_SUBCLASS)) { | 875 | !(features & TWL6032_SUBCLASS)) { |
876 | child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1, | 876 | child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1, |
877 | features); | 877 | features); |
878 | if (IS_ERR(child)) | 878 | if (IS_ERR(child)) |
@@ -952,60 +952,60 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, | |||
952 | return PTR_ERR(child); | 952 | return PTR_ERR(child); |
953 | } | 953 | } |
954 | 954 | ||
955 | /* twl6025 regulators */ | 955 | /* twl6032 regulators */ |
956 | if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() && | 956 | if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() && |
957 | (features & TWL6025_SUBCLASS)) { | 957 | (features & TWL6032_SUBCLASS)) { |
958 | child = add_regulator(TWL6025_REG_LDO5, pdata->ldo5, | 958 | child = add_regulator(TWL6032_REG_LDO5, pdata->ldo5, |
959 | features); | 959 | features); |
960 | if (IS_ERR(child)) | 960 | if (IS_ERR(child)) |
961 | return PTR_ERR(child); | 961 | return PTR_ERR(child); |
962 | 962 | ||
963 | child = add_regulator(TWL6025_REG_LDO1, pdata->ldo1, | 963 | child = add_regulator(TWL6032_REG_LDO1, pdata->ldo1, |
964 | features); | 964 | features); |
965 | if (IS_ERR(child)) | 965 | if (IS_ERR(child)) |
966 | return PTR_ERR(child); | 966 | return PTR_ERR(child); |
967 | 967 | ||
968 | child = add_regulator(TWL6025_REG_LDO7, pdata->ldo7, | 968 | child = add_regulator(TWL6032_REG_LDO7, pdata->ldo7, |
969 | features); | 969 | features); |
970 | if (IS_ERR(child)) | 970 | if (IS_ERR(child)) |
971 | return PTR_ERR(child); | 971 | return PTR_ERR(child); |
972 | 972 | ||
973 | child = add_regulator(TWL6025_REG_LDO6, pdata->ldo6, | 973 | child = add_regulator(TWL6032_REG_LDO6, pdata->ldo6, |
974 | features); | 974 | features); |
975 | if (IS_ERR(child)) | 975 | if (IS_ERR(child)) |
976 | return PTR_ERR(child); | 976 | return PTR_ERR(child); |
977 | 977 | ||
978 | child = add_regulator(TWL6025_REG_LDOLN, pdata->ldoln, | 978 | child = add_regulator(TWL6032_REG_LDOLN, pdata->ldoln, |
979 | features); | 979 | features); |
980 | if (IS_ERR(child)) | 980 | if (IS_ERR(child)) |
981 | return PTR_ERR(child); | 981 | return PTR_ERR(child); |
982 | 982 | ||
983 | child = add_regulator(TWL6025_REG_LDO2, pdata->ldo2, | 983 | child = add_regulator(TWL6032_REG_LDO2, pdata->ldo2, |
984 | features); | 984 | features); |
985 | if (IS_ERR(child)) | 985 | if (IS_ERR(child)) |
986 | return PTR_ERR(child); | 986 | return PTR_ERR(child); |
987 | 987 | ||
988 | child = add_regulator(TWL6025_REG_LDO4, pdata->ldo4, | 988 | child = add_regulator(TWL6032_REG_LDO4, pdata->ldo4, |
989 | features); | 989 | features); |
990 | if (IS_ERR(child)) | 990 | if (IS_ERR(child)) |
991 | return PTR_ERR(child); | 991 | return PTR_ERR(child); |
992 | 992 | ||
993 | child = add_regulator(TWL6025_REG_LDO3, pdata->ldo3, | 993 | child = add_regulator(TWL6032_REG_LDO3, pdata->ldo3, |
994 | features); | 994 | features); |
995 | if (IS_ERR(child)) | 995 | if (IS_ERR(child)) |
996 | return PTR_ERR(child); | 996 | return PTR_ERR(child); |
997 | 997 | ||
998 | child = add_regulator(TWL6025_REG_SMPS3, pdata->smps3, | 998 | child = add_regulator(TWL6032_REG_SMPS3, pdata->smps3, |
999 | features); | 999 | features); |
1000 | if (IS_ERR(child)) | 1000 | if (IS_ERR(child)) |
1001 | return PTR_ERR(child); | 1001 | return PTR_ERR(child); |
1002 | 1002 | ||
1003 | child = add_regulator(TWL6025_REG_SMPS4, pdata->smps4, | 1003 | child = add_regulator(TWL6032_REG_SMPS4, pdata->smps4, |
1004 | features); | 1004 | features); |
1005 | if (IS_ERR(child)) | 1005 | if (IS_ERR(child)) |
1006 | return PTR_ERR(child); | 1006 | return PTR_ERR(child); |
1007 | 1007 | ||
1008 | child = add_regulator(TWL6025_REG_VIO, pdata->vio6025, | 1008 | child = add_regulator(TWL6032_REG_VIO, pdata->vio6025, |
1009 | features); | 1009 | features); |
1010 | if (IS_ERR(child)) | 1010 | if (IS_ERR(child)) |
1011 | return PTR_ERR(child); | 1011 | return PTR_ERR(child); |
@@ -1023,6 +1023,14 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, | |||
1023 | return PTR_ERR(child); | 1023 | return PTR_ERR(child); |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | if (IS_ENABLED(CONFIG_TWL4030_POWER) && pdata->power) { | ||
1027 | child = add_child(TWL_MODULE_PM_MASTER, "twl4030_power", | ||
1028 | pdata->power, sizeof(*pdata->power), false, | ||
1029 | 0, 0); | ||
1030 | if (IS_ERR(child)) | ||
1031 | return PTR_ERR(child); | ||
1032 | } | ||
1033 | |||
1026 | return 0; | 1034 | return 0; |
1027 | } | 1035 | } |
1028 | 1036 | ||
@@ -1176,10 +1184,10 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1176 | if ((id->driver_data) & TWL6030_CLASS) { | 1184 | if ((id->driver_data) & TWL6030_CLASS) { |
1177 | twl_priv->twl_id = TWL6030_CLASS_ID; | 1185 | twl_priv->twl_id = TWL6030_CLASS_ID; |
1178 | twl_priv->twl_map = &twl6030_map[0]; | 1186 | twl_priv->twl_map = &twl6030_map[0]; |
1179 | /* The charger base address is different in twl6025 */ | 1187 | /* The charger base address is different in twl6032 */ |
1180 | if ((id->driver_data) & TWL6025_SUBCLASS) | 1188 | if ((id->driver_data) & TWL6032_SUBCLASS) |
1181 | twl_priv->twl_map[TWL_MODULE_MAIN_CHARGE].base = | 1189 | twl_priv->twl_map[TWL_MODULE_MAIN_CHARGE].base = |
1182 | TWL6025_BASEADD_CHARGER; | 1190 | TWL6032_BASEADD_CHARGER; |
1183 | twl_regmap_config = twl6030_regmap_config; | 1191 | twl_regmap_config = twl6030_regmap_config; |
1184 | } else { | 1192 | } else { |
1185 | twl_priv->twl_id = TWL4030_CLASS_ID; | 1193 | twl_priv->twl_id = TWL4030_CLASS_ID; |
@@ -1234,10 +1242,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1234 | WARN(status < 0, "Error: reading twl_idcode register value\n"); | 1242 | WARN(status < 0, "Error: reading twl_idcode register value\n"); |
1235 | } | 1243 | } |
1236 | 1244 | ||
1237 | /* load power event scripts */ | ||
1238 | if (IS_ENABLED(CONFIG_TWL4030_POWER) && pdata && pdata->power) | ||
1239 | twl4030_power_init(pdata->power); | ||
1240 | |||
1241 | /* Maybe init the T2 Interrupt subsystem */ | 1245 | /* Maybe init the T2 Interrupt subsystem */ |
1242 | if (client->irq) { | 1246 | if (client->irq) { |
1243 | if (twl_class_is_4030()) { | 1247 | if (twl_class_is_4030()) { |
@@ -1292,7 +1296,7 @@ static const struct i2c_device_id twl_ids[] = { | |||
1292 | { "tps65921", TPS_SUBSET }, /* fewer LDOs; no codec, no LED | 1296 | { "tps65921", TPS_SUBSET }, /* fewer LDOs; no codec, no LED |
1293 | and vibrator. Charger in USB module*/ | 1297 | and vibrator. Charger in USB module*/ |
1294 | { "twl6030", TWL6030_CLASS }, /* "Phoenix power chip" */ | 1298 | { "twl6030", TWL6030_CLASS }, /* "Phoenix power chip" */ |
1295 | { "twl6025", TWL6030_CLASS | TWL6025_SUBCLASS }, /* "Phoenix lite" */ | 1299 | { "twl6032", TWL6030_CLASS | TWL6032_SUBCLASS }, /* "Phoenix lite" */ |
1296 | { /* end of list */ }, | 1300 | { /* end of list */ }, |
1297 | }; | 1301 | }; |
1298 | MODULE_DEVICE_TABLE(i2c, twl_ids); | 1302 | MODULE_DEVICE_TABLE(i2c, twl_ids); |
@@ -1305,17 +1309,7 @@ static struct i2c_driver twl_driver = { | |||
1305 | .remove = twl_remove, | 1309 | .remove = twl_remove, |
1306 | }; | 1310 | }; |
1307 | 1311 | ||
1308 | static int __init twl_init(void) | 1312 | module_i2c_driver(twl_driver); |
1309 | { | ||
1310 | return i2c_add_driver(&twl_driver); | ||
1311 | } | ||
1312 | subsys_initcall(twl_init); | ||
1313 | |||
1314 | static void __exit twl_exit(void) | ||
1315 | { | ||
1316 | i2c_del_driver(&twl_driver); | ||
1317 | } | ||
1318 | module_exit(twl_exit); | ||
1319 | 1313 | ||
1320 | MODULE_AUTHOR("Texas Instruments, Inc."); | 1314 | MODULE_AUTHOR("Texas Instruments, Inc."); |
1321 | MODULE_DESCRIPTION("I2C Core interface for TWL"); | 1315 | MODULE_DESCRIPTION("I2C Core interface for TWL"); |
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c index d2ab222138c2..a31fba96ef43 100644 --- a/drivers/mfd/twl4030-audio.c +++ b/drivers/mfd/twl4030-audio.c | |||
@@ -261,10 +261,8 @@ static int twl4030_audio_probe(struct platform_device *pdev) | |||
261 | ret = -ENODEV; | 261 | ret = -ENODEV; |
262 | } | 262 | } |
263 | 263 | ||
264 | if (ret) { | 264 | if (ret) |
265 | platform_set_drvdata(pdev, NULL); | ||
266 | twl4030_audio_dev = NULL; | 265 | twl4030_audio_dev = NULL; |
267 | } | ||
268 | 266 | ||
269 | return ret; | 267 | return ret; |
270 | } | 268 | } |
@@ -272,7 +270,6 @@ static int twl4030_audio_probe(struct platform_device *pdev) | |||
272 | static int twl4030_audio_remove(struct platform_device *pdev) | 270 | static int twl4030_audio_remove(struct platform_device *pdev) |
273 | { | 271 | { |
274 | mfd_remove_devices(&pdev->dev); | 272 | mfd_remove_devices(&pdev->dev); |
275 | platform_set_drvdata(pdev, NULL); | ||
276 | twl4030_audio_dev = NULL; | 273 | twl4030_audio_dev = NULL; |
277 | 274 | ||
278 | return 0; | 275 | return 0; |
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c index 9d2d1bad6780..9aa6d1efa241 100644 --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c | |||
@@ -570,6 +570,7 @@ static struct irq_chip twl4030_sih_irq_chip = { | |||
570 | .irq_set_type = twl4030_sih_set_type, | 570 | .irq_set_type = twl4030_sih_set_type, |
571 | .irq_bus_lock = twl4030_sih_bus_lock, | 571 | .irq_bus_lock = twl4030_sih_bus_lock, |
572 | .irq_bus_sync_unlock = twl4030_sih_bus_sync_unlock, | 572 | .irq_bus_sync_unlock = twl4030_sih_bus_sync_unlock, |
573 | .flags = IRQCHIP_SKIP_SET_WAKE, | ||
573 | }; | 574 | }; |
574 | 575 | ||
575 | /*----------------------------------------------------------------------*/ | 576 | /*----------------------------------------------------------------------*/ |
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c index 42bd3ea5df3c..1ea54d4d003a 100644 --- a/drivers/mfd/twl4030-madc.c +++ b/drivers/mfd/twl4030-madc.c | |||
@@ -775,12 +775,10 @@ static int twl4030_madc_probe(struct platform_device *pdev) | |||
775 | IRQF_TRIGGER_RISING, "twl4030_madc", madc); | 775 | IRQF_TRIGGER_RISING, "twl4030_madc", madc); |
776 | if (ret) { | 776 | if (ret) { |
777 | dev_dbg(&pdev->dev, "could not request irq\n"); | 777 | dev_dbg(&pdev->dev, "could not request irq\n"); |
778 | goto err_irq; | 778 | goto err_i2c; |
779 | } | 779 | } |
780 | twl4030_madc = madc; | 780 | twl4030_madc = madc; |
781 | return 0; | 781 | return 0; |
782 | err_irq: | ||
783 | platform_set_drvdata(pdev, NULL); | ||
784 | err_i2c: | 782 | err_i2c: |
785 | twl4030_madc_set_current_generator(madc, 0, 0); | 783 | twl4030_madc_set_current_generator(madc, 0, 0); |
786 | err_current_generator: | 784 | err_current_generator: |
@@ -796,7 +794,6 @@ static int twl4030_madc_remove(struct platform_device *pdev) | |||
796 | struct twl4030_madc_data *madc = platform_get_drvdata(pdev); | 794 | struct twl4030_madc_data *madc = platform_get_drvdata(pdev); |
797 | 795 | ||
798 | free_irq(platform_get_irq(pdev, 0), madc); | 796 | free_irq(platform_get_irq(pdev, 0), madc); |
799 | platform_set_drvdata(pdev, NULL); | ||
800 | twl4030_madc_set_current_generator(madc, 0, 0); | 797 | twl4030_madc_set_current_generator(madc, 0, 0); |
801 | twl4030_madc_set_power(madc, 0); | 798 | twl4030_madc_set_power(madc, 0); |
802 | kfree(madc); | 799 | kfree(madc); |
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index dd362c1078e1..a5fd3c738211 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/pm.h> | 28 | #include <linux/pm.h> |
29 | #include <linux/i2c/twl.h> | 29 | #include <linux/i2c/twl.h> |
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/of.h> | ||
31 | 32 | ||
32 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
33 | 34 | ||
@@ -492,6 +493,39 @@ int twl4030_remove_script(u8 flags) | |||
492 | return err; | 493 | return err; |
493 | } | 494 | } |
494 | 495 | ||
496 | int twl4030_power_configure_scripts(struct twl4030_power_data *pdata) | ||
497 | { | ||
498 | int err; | ||
499 | int i; | ||
500 | u8 address = twl4030_start_script_address; | ||
501 | |||
502 | for (i = 0; i < pdata->num; i++) { | ||
503 | err = load_twl4030_script(pdata->scripts[i], address); | ||
504 | if (err) | ||
505 | return err; | ||
506 | address += pdata->scripts[i]->size; | ||
507 | } | ||
508 | |||
509 | return 0; | ||
510 | } | ||
511 | |||
512 | int twl4030_power_configure_resources(struct twl4030_power_data *pdata) | ||
513 | { | ||
514 | struct twl4030_resconfig *resconfig = pdata->resource_config; | ||
515 | int err; | ||
516 | |||
517 | if (resconfig) { | ||
518 | while (resconfig->resource) { | ||
519 | err = twl4030_configure_resource(resconfig); | ||
520 | if (err) | ||
521 | return err; | ||
522 | resconfig++; | ||
523 | } | ||
524 | } | ||
525 | |||
526 | return 0; | ||
527 | } | ||
528 | |||
495 | /* | 529 | /* |
496 | * In master mode, start the power off sequence. | 530 | * In master mode, start the power off sequence. |
497 | * After a successful execution, TWL shuts down the power to the SoC | 531 | * After a successful execution, TWL shuts down the power to the SoC |
@@ -507,43 +541,58 @@ void twl4030_power_off(void) | |||
507 | pr_err("TWL4030 Unable to power off\n"); | 541 | pr_err("TWL4030 Unable to power off\n"); |
508 | } | 542 | } |
509 | 543 | ||
510 | void twl4030_power_init(struct twl4030_power_data *twl4030_scripts) | 544 | static bool twl4030_power_use_poweroff(struct twl4030_power_data *pdata, |
545 | struct device_node *node) | ||
511 | { | 546 | { |
547 | if (pdata && pdata->use_poweroff) | ||
548 | return true; | ||
549 | |||
550 | if (of_property_read_bool(node, "ti,use_poweroff")) | ||
551 | return true; | ||
552 | |||
553 | return false; | ||
554 | } | ||
555 | |||
556 | int twl4030_power_probe(struct platform_device *pdev) | ||
557 | { | ||
558 | struct twl4030_power_data *pdata = pdev->dev.platform_data; | ||
559 | struct device_node *node = pdev->dev.of_node; | ||
512 | int err = 0; | 560 | int err = 0; |
513 | int i; | 561 | int err2 = 0; |
514 | struct twl4030_resconfig *resconfig; | 562 | u8 val; |
515 | u8 val, address = twl4030_start_script_address; | 563 | |
564 | if (!pdata && !node) { | ||
565 | dev_err(&pdev->dev, "Platform data is missing\n"); | ||
566 | return -EINVAL; | ||
567 | } | ||
516 | 568 | ||
517 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, | 569 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, |
518 | TWL4030_PM_MASTER_PROTECT_KEY); | 570 | TWL4030_PM_MASTER_PROTECT_KEY); |
519 | if (err) | 571 | err |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, |
520 | goto unlock; | 572 | TWL4030_PM_MASTER_KEY_CFG2, |
521 | |||
522 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2, | ||
523 | TWL4030_PM_MASTER_PROTECT_KEY); | 573 | TWL4030_PM_MASTER_PROTECT_KEY); |
524 | if (err) | ||
525 | goto unlock; | ||
526 | 574 | ||
527 | for (i = 0; i < twl4030_scripts->num; i++) { | 575 | if (err) { |
528 | err = load_twl4030_script(twl4030_scripts->scripts[i], address); | 576 | pr_err("TWL4030 Unable to unlock registers\n"); |
529 | if (err) | 577 | return err; |
530 | goto load; | ||
531 | address += twl4030_scripts->scripts[i]->size; | ||
532 | } | 578 | } |
533 | 579 | ||
534 | resconfig = twl4030_scripts->resource_config; | 580 | if (pdata) { |
535 | if (resconfig) { | 581 | /* TODO: convert to device tree */ |
536 | while (resconfig->resource) { | 582 | err = twl4030_power_configure_scripts(pdata); |
537 | err = twl4030_configure_resource(resconfig); | 583 | if (err) { |
538 | if (err) | 584 | pr_err("TWL4030 failed to load scripts\n"); |
539 | goto resource; | 585 | goto relock; |
540 | resconfig++; | 586 | } |
541 | 587 | err = twl4030_power_configure_resources(pdata); | |
588 | if (err) { | ||
589 | pr_err("TWL4030 failed to configure resource\n"); | ||
590 | goto relock; | ||
542 | } | 591 | } |
543 | } | 592 | } |
544 | 593 | ||
545 | /* Board has to be wired properly to use this feature */ | 594 | /* Board has to be wired properly to use this feature */ |
546 | if (twl4030_scripts->use_poweroff && !pm_power_off) { | 595 | if (twl4030_power_use_poweroff(pdata, node) && !pm_power_off) { |
547 | /* Default for SEQ_OFFSYNC is set, lets ensure this */ | 596 | /* Default for SEQ_OFFSYNC is set, lets ensure this */ |
548 | err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &val, | 597 | err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &val, |
549 | TWL4030_PM_MASTER_CFG_P123_TRANSITION); | 598 | TWL4030_PM_MASTER_CFG_P123_TRANSITION); |
@@ -564,22 +613,43 @@ void twl4030_power_init(struct twl4030_power_data *twl4030_scripts) | |||
564 | } | 613 | } |
565 | 614 | ||
566 | relock: | 615 | relock: |
567 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, | 616 | err2 = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, |
568 | TWL4030_PM_MASTER_PROTECT_KEY); | 617 | TWL4030_PM_MASTER_PROTECT_KEY); |
569 | if (err) | 618 | if (err2) { |
570 | pr_err("TWL4030 Unable to relock registers\n"); | 619 | pr_err("TWL4030 Unable to relock registers\n"); |
571 | return; | 620 | return err2; |
621 | } | ||
572 | 622 | ||
573 | unlock: | 623 | return err; |
574 | if (err) | ||
575 | pr_err("TWL4030 Unable to unlock registers\n"); | ||
576 | return; | ||
577 | load: | ||
578 | if (err) | ||
579 | pr_err("TWL4030 failed to load scripts\n"); | ||
580 | return; | ||
581 | resource: | ||
582 | if (err) | ||
583 | pr_err("TWL4030 failed to configure resource\n"); | ||
584 | return; | ||
585 | } | 624 | } |
625 | |||
626 | static int twl4030_power_remove(struct platform_device *pdev) | ||
627 | { | ||
628 | return 0; | ||
629 | } | ||
630 | |||
631 | #ifdef CONFIG_OF | ||
632 | static const struct of_device_id twl4030_power_of_match[] = { | ||
633 | {.compatible = "ti,twl4030-power", }, | ||
634 | { }, | ||
635 | }; | ||
636 | MODULE_DEVICE_TABLE(of, twl4030_power_of_match); | ||
637 | #endif | ||
638 | |||
639 | static struct platform_driver twl4030_power_driver = { | ||
640 | .driver = { | ||
641 | .name = "twl4030_power", | ||
642 | .owner = THIS_MODULE, | ||
643 | .of_match_table = of_match_ptr(twl4030_power_of_match), | ||
644 | }, | ||
645 | .probe = twl4030_power_probe, | ||
646 | .remove = twl4030_power_remove, | ||
647 | }; | ||
648 | |||
649 | module_platform_driver(twl4030_power_driver); | ||
650 | |||
651 | MODULE_AUTHOR("Nokia Corporation"); | ||
652 | MODULE_AUTHOR("Texas Instruments, Inc."); | ||
653 | MODULE_DESCRIPTION("Power management for TWL4030"); | ||
654 | MODULE_LICENSE("GPL"); | ||
655 | MODULE_ALIAS("platform:twl4030_power"); | ||
diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c index 96a020b1dcd1..981bef4b7ebc 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c | |||
@@ -351,6 +351,8 @@ void __init vexpress_sysreg_of_early_init(void) | |||
351 | } | 351 | } |
352 | 352 | ||
353 | 353 | ||
354 | #ifdef CONFIG_GPIOLIB | ||
355 | |||
354 | #define VEXPRESS_SYSREG_GPIO(_name, _reg, _value) \ | 356 | #define VEXPRESS_SYSREG_GPIO(_name, _reg, _value) \ |
355 | [VEXPRESS_GPIO_##_name] = { \ | 357 | [VEXPRESS_GPIO_##_name] = { \ |
356 | .reg = _reg, \ | 358 | .reg = _reg, \ |
@@ -445,6 +447,8 @@ struct gpio_led_platform_data vexpress_sysreg_leds_pdata = { | |||
445 | .leds = vexpress_sysreg_leds, | 447 | .leds = vexpress_sysreg_leds, |
446 | }; | 448 | }; |
447 | 449 | ||
450 | #endif | ||
451 | |||
448 | 452 | ||
449 | static ssize_t vexpress_sysreg_sys_id_show(struct device *dev, | 453 | static ssize_t vexpress_sysreg_sys_id_show(struct device *dev, |
450 | struct device_attribute *attr, char *buf) | 454 | struct device_attribute *attr, char *buf) |
@@ -480,6 +484,9 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) | |||
480 | setup_timer(&vexpress_sysreg_config_timer, | 484 | setup_timer(&vexpress_sysreg_config_timer, |
481 | vexpress_sysreg_config_complete, 0); | 485 | vexpress_sysreg_config_complete, 0); |
482 | 486 | ||
487 | vexpress_sysreg_dev = &pdev->dev; | ||
488 | |||
489 | #ifdef CONFIG_GPIOLIB | ||
483 | vexpress_sysreg_gpio_chip.dev = &pdev->dev; | 490 | vexpress_sysreg_gpio_chip.dev = &pdev->dev; |
484 | err = gpiochip_add(&vexpress_sysreg_gpio_chip); | 491 | err = gpiochip_add(&vexpress_sysreg_gpio_chip); |
485 | if (err) { | 492 | if (err) { |
@@ -490,11 +497,10 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) | |||
490 | return err; | 497 | return err; |
491 | } | 498 | } |
492 | 499 | ||
493 | vexpress_sysreg_dev = &pdev->dev; | ||
494 | |||
495 | platform_device_register_data(vexpress_sysreg_dev, "leds-gpio", | 500 | platform_device_register_data(vexpress_sysreg_dev, "leds-gpio", |
496 | PLATFORM_DEVID_AUTO, &vexpress_sysreg_leds_pdata, | 501 | PLATFORM_DEVID_AUTO, &vexpress_sysreg_leds_pdata, |
497 | sizeof(vexpress_sysreg_leds_pdata)); | 502 | sizeof(vexpress_sysreg_leds_pdata)); |
503 | #endif | ||
498 | 504 | ||
499 | device_create_file(vexpress_sysreg_dev, &dev_attr_sys_id); | 505 | device_create_file(vexpress_sysreg_dev, &dev_attr_sys_id); |
500 | 506 | ||
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 00e4fe2f3c75..781115e8dca9 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -259,20 +259,6 @@ static int wm8994_suspend(struct device *dev) | |||
259 | break; | 259 | break; |
260 | } | 260 | } |
261 | 261 | ||
262 | switch (wm8994->type) { | ||
263 | case WM1811: | ||
264 | ret = wm8994_reg_read(wm8994, WM8994_ANTIPOP_2); | ||
265 | if (ret < 0) { | ||
266 | dev_err(dev, "Failed to read jackdet: %d\n", ret); | ||
267 | } else if (ret & WM1811_JACKDET_MODE_MASK) { | ||
268 | dev_dbg(dev, "CODEC still active, ignoring suspend\n"); | ||
269 | return 0; | ||
270 | } | ||
271 | break; | ||
272 | default: | ||
273 | break; | ||
274 | } | ||
275 | |||
276 | /* Disable LDO pulldowns while the device is suspended if we | 262 | /* Disable LDO pulldowns while the device is suspended if we |
277 | * don't know that something will be driving them. */ | 263 | * don't know that something will be driving them. */ |
278 | if (!wm8994->ldo_ena_always_driven) | 264 | if (!wm8994->ldo_ena_always_driven) |
@@ -652,6 +638,17 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
652 | return ret; | 638 | return ret; |
653 | } | 639 | } |
654 | 640 | ||
641 | /* Explicitly put the device into reset in case regulators | ||
642 | * don't get disabled in order to ensure we know the device | ||
643 | * state. | ||
644 | */ | ||
645 | ret = wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET, | ||
646 | wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET)); | ||
647 | if (ret != 0) { | ||
648 | dev_err(wm8994->dev, "Failed to reset device: %d\n", ret); | ||
649 | return ret; | ||
650 | } | ||
651 | |||
655 | if (regmap_patch) { | 652 | if (regmap_patch) { |
656 | ret = regmap_register_patch(wm8994->regmap, regmap_patch, | 653 | ret = regmap_register_patch(wm8994->regmap, regmap_patch, |
657 | patch_regs); | 654 | patch_regs); |
diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c index a050e56a9bbd..d3a184a240f5 100644 --- a/drivers/mfd/wm8994-irq.c +++ b/drivers/mfd/wm8994-irq.c | |||
@@ -14,10 +14,12 @@ | |||
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/gpio.h> | ||
17 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
18 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
19 | #include <linux/mfd/core.h> | 20 | #include <linux/mfd/core.h> |
20 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/irqdomain.h> | ||
21 | #include <linux/regmap.h> | 23 | #include <linux/regmap.h> |
22 | 24 | ||
23 | #include <linux/mfd/wm8994/core.h> | 25 | #include <linux/mfd/wm8994/core.h> |
@@ -138,6 +140,55 @@ static struct regmap_irq_chip wm8994_irq_chip = { | |||
138 | .runtime_pm = true, | 140 | .runtime_pm = true, |
139 | }; | 141 | }; |
140 | 142 | ||
143 | static void wm8994_edge_irq_enable(struct irq_data *data) | ||
144 | { | ||
145 | } | ||
146 | |||
147 | static void wm8994_edge_irq_disable(struct irq_data *data) | ||
148 | { | ||
149 | } | ||
150 | |||
151 | static struct irq_chip wm8994_edge_irq_chip = { | ||
152 | .name = "wm8994_edge", | ||
153 | .irq_disable = wm8994_edge_irq_disable, | ||
154 | .irq_enable = wm8994_edge_irq_enable, | ||
155 | }; | ||
156 | |||
157 | static irqreturn_t wm8994_edge_irq(int irq, void *data) | ||
158 | { | ||
159 | struct wm8994 *wm8994 = data; | ||
160 | |||
161 | while (gpio_get_value_cansleep(wm8994->pdata.irq_gpio)) | ||
162 | handle_nested_irq(irq_create_mapping(wm8994->edge_irq, 0)); | ||
163 | |||
164 | return IRQ_HANDLED; | ||
165 | } | ||
166 | |||
167 | static int wm8994_edge_irq_map(struct irq_domain *h, unsigned int virq, | ||
168 | irq_hw_number_t hw) | ||
169 | { | ||
170 | struct wm8994 *wm8994 = h->host_data; | ||
171 | |||
172 | irq_set_chip_data(virq, wm8994); | ||
173 | irq_set_chip_and_handler(virq, &wm8994_edge_irq_chip, handle_edge_irq); | ||
174 | irq_set_nested_thread(virq, 1); | ||
175 | |||
176 | /* ARM needs us to explicitly flag the IRQ as valid | ||
177 | * and will set them noprobe when we do so. */ | ||
178 | #ifdef CONFIG_ARM | ||
179 | set_irq_flags(virq, IRQF_VALID); | ||
180 | #else | ||
181 | irq_set_noprobe(virq); | ||
182 | #endif | ||
183 | |||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | static struct irq_domain_ops wm8994_edge_irq_ops = { | ||
188 | .map = wm8994_edge_irq_map, | ||
189 | .xlate = irq_domain_xlate_twocell, | ||
190 | }; | ||
191 | |||
141 | int wm8994_irq_init(struct wm8994 *wm8994) | 192 | int wm8994_irq_init(struct wm8994 *wm8994) |
142 | { | 193 | { |
143 | int ret; | 194 | int ret; |
@@ -156,10 +207,51 @@ int wm8994_irq_init(struct wm8994 *wm8994) | |||
156 | if (pdata->irq_flags) | 207 | if (pdata->irq_flags) |
157 | irqflags = pdata->irq_flags; | 208 | irqflags = pdata->irq_flags; |
158 | 209 | ||
159 | ret = regmap_add_irq_chip(wm8994->regmap, wm8994->irq, | 210 | /* use a GPIO for edge triggered controllers */ |
160 | irqflags, | 211 | if (irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { |
161 | wm8994->irq_base, &wm8994_irq_chip, | 212 | if (gpio_to_irq(pdata->irq_gpio) != wm8994->irq) { |
162 | &wm8994->irq_data); | 213 | dev_warn(wm8994->dev, "IRQ %d is not GPIO %d (%d)\n", |
214 | wm8994->irq, pdata->irq_gpio, | ||
215 | gpio_to_irq(pdata->irq_gpio)); | ||
216 | wm8994->irq = gpio_to_irq(pdata->irq_gpio); | ||
217 | } | ||
218 | |||
219 | ret = devm_gpio_request_one(wm8994->dev, pdata->irq_gpio, | ||
220 | GPIOF_IN, "WM8994 IRQ"); | ||
221 | |||
222 | if (ret != 0) { | ||
223 | dev_err(wm8994->dev, "Failed to get IRQ GPIO: %d\n", | ||
224 | ret); | ||
225 | return ret; | ||
226 | } | ||
227 | |||
228 | wm8994->edge_irq = irq_domain_add_linear(NULL, 1, | ||
229 | &wm8994_edge_irq_ops, | ||
230 | wm8994); | ||
231 | |||
232 | ret = regmap_add_irq_chip(wm8994->regmap, | ||
233 | irq_create_mapping(wm8994->edge_irq, | ||
234 | 0), | ||
235 | IRQF_ONESHOT, | ||
236 | wm8994->irq_base, &wm8994_irq_chip, | ||
237 | &wm8994->irq_data); | ||
238 | if (ret != 0) { | ||
239 | dev_err(wm8994->dev, "Failed to get IRQ: %d\n", | ||
240 | ret); | ||
241 | return ret; | ||
242 | } | ||
243 | |||
244 | ret = request_threaded_irq(wm8994->irq, | ||
245 | NULL, wm8994_edge_irq, | ||
246 | irqflags, | ||
247 | "WM8994 edge", wm8994); | ||
248 | } else { | ||
249 | ret = regmap_add_irq_chip(wm8994->regmap, wm8994->irq, | ||
250 | irqflags, | ||
251 | wm8994->irq_base, &wm8994_irq_chip, | ||
252 | &wm8994->irq_data); | ||
253 | } | ||
254 | |||
163 | if (ret != 0) { | 255 | if (ret != 0) { |
164 | dev_err(wm8994->dev, "Failed to register IRQ chip: %d\n", ret); | 256 | dev_err(wm8994->dev, "Failed to register IRQ chip: %d\n", ret); |
165 | return ret; | 257 | return ret; |
diff --git a/drivers/mfd/wm8997-tables.c b/drivers/mfd/wm8997-tables.c new file mode 100644 index 000000000000..5aa807687777 --- /dev/null +++ b/drivers/mfd/wm8997-tables.c | |||
@@ -0,0 +1,1525 @@ | |||
1 | /* | ||
2 | * wm8997-tables.c -- WM8997 data tables | ||
3 | * | ||
4 | * Copyright 2012 Wolfson Microelectronics plc | ||
5 | * | ||
6 | * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | |||
15 | #include <linux/mfd/arizona/core.h> | ||
16 | #include <linux/mfd/arizona/registers.h> | ||
17 | |||
18 | #include "arizona.h" | ||
19 | |||
20 | static const struct reg_default wm8997_reva_patch[] = { | ||
21 | { 0x80, 0x0003 }, | ||
22 | { 0x214, 0x0008 }, | ||
23 | { 0x458, 0x0000 }, | ||
24 | { 0x0081, 0xE022 }, | ||
25 | { 0x294, 0x0000 }, | ||
26 | { 0x80, 0x0000 }, | ||
27 | { 0x171, 0x0000 }, | ||
28 | }; | ||
29 | |||
30 | /* We use a function so we can use ARRAY_SIZE() */ | ||
31 | int wm8997_patch(struct arizona *arizona) | ||
32 | { | ||
33 | switch (arizona->rev) { | ||
34 | case 0: | ||
35 | return regmap_register_patch(arizona->regmap, | ||
36 | wm8997_reva_patch, | ||
37 | ARRAY_SIZE(wm8997_reva_patch)); | ||
38 | default: | ||
39 | return 0; | ||
40 | } | ||
41 | } | ||
42 | EXPORT_SYMBOL_GPL(wm8997_patch); | ||
43 | |||
44 | static const struct regmap_irq wm8997_aod_irqs[ARIZONA_NUM_IRQ] = { | ||
45 | [ARIZONA_IRQ_GP5_FALL] = { .mask = ARIZONA_GP5_FALL_EINT1 }, | ||
46 | [ARIZONA_IRQ_GP5_RISE] = { .mask = ARIZONA_GP5_RISE_EINT1 }, | ||
47 | [ARIZONA_IRQ_JD_FALL] = { .mask = ARIZONA_JD1_FALL_EINT1 }, | ||
48 | [ARIZONA_IRQ_JD_RISE] = { .mask = ARIZONA_JD1_RISE_EINT1 }, | ||
49 | }; | ||
50 | |||
51 | const struct regmap_irq_chip wm8997_aod = { | ||
52 | .name = "wm8997 AOD", | ||
53 | .status_base = ARIZONA_AOD_IRQ1, | ||
54 | .mask_base = ARIZONA_AOD_IRQ_MASK_IRQ1, | ||
55 | .ack_base = ARIZONA_AOD_IRQ1, | ||
56 | .num_regs = 1, | ||
57 | .irqs = wm8997_aod_irqs, | ||
58 | .num_irqs = ARRAY_SIZE(wm8997_aod_irqs), | ||
59 | }; | ||
60 | EXPORT_SYMBOL_GPL(wm8997_aod); | ||
61 | |||
62 | static const struct regmap_irq wm8997_irqs[ARIZONA_NUM_IRQ] = { | ||
63 | [ARIZONA_IRQ_GP4] = { .reg_offset = 0, .mask = ARIZONA_GP4_EINT1 }, | ||
64 | [ARIZONA_IRQ_GP3] = { .reg_offset = 0, .mask = ARIZONA_GP3_EINT1 }, | ||
65 | [ARIZONA_IRQ_GP2] = { .reg_offset = 0, .mask = ARIZONA_GP2_EINT1 }, | ||
66 | [ARIZONA_IRQ_GP1] = { .reg_offset = 0, .mask = ARIZONA_GP1_EINT1 }, | ||
67 | |||
68 | [ARIZONA_IRQ_SPK_SHUTDOWN_WARN] = { | ||
69 | .reg_offset = 2, .mask = ARIZONA_SPK_SHUTDOWN_WARN_EINT1 | ||
70 | }, | ||
71 | [ARIZONA_IRQ_SPK_SHUTDOWN] = { | ||
72 | .reg_offset = 2, .mask = ARIZONA_SPK_SHUTDOWN_EINT1 | ||
73 | }, | ||
74 | [ARIZONA_IRQ_HPDET] = { | ||
75 | .reg_offset = 2, .mask = ARIZONA_HPDET_EINT1 | ||
76 | }, | ||
77 | [ARIZONA_IRQ_MICDET] = { | ||
78 | .reg_offset = 2, .mask = ARIZONA_MICDET_EINT1 | ||
79 | }, | ||
80 | [ARIZONA_IRQ_WSEQ_DONE] = { | ||
81 | .reg_offset = 2, .mask = ARIZONA_WSEQ_DONE_EINT1 | ||
82 | }, | ||
83 | [ARIZONA_IRQ_DRC1_SIG_DET] = { | ||
84 | .reg_offset = 2, .mask = ARIZONA_DRC1_SIG_DET_EINT1 | ||
85 | }, | ||
86 | [ARIZONA_IRQ_UNDERCLOCKED] = { | ||
87 | .reg_offset = 2, .mask = ARIZONA_UNDERCLOCKED_EINT1 | ||
88 | }, | ||
89 | [ARIZONA_IRQ_OVERCLOCKED] = { | ||
90 | .reg_offset = 2, .mask = ARIZONA_OVERCLOCKED_EINT1 | ||
91 | }, | ||
92 | [ARIZONA_IRQ_FLL2_LOCK] = { | ||
93 | .reg_offset = 2, .mask = ARIZONA_FLL2_LOCK_EINT1 | ||
94 | }, | ||
95 | [ARIZONA_IRQ_FLL1_LOCK] = { | ||
96 | .reg_offset = 2, .mask = ARIZONA_FLL1_LOCK_EINT1 | ||
97 | }, | ||
98 | [ARIZONA_IRQ_CLKGEN_ERR] = { | ||
99 | .reg_offset = 2, .mask = ARIZONA_CLKGEN_ERR_EINT1 | ||
100 | }, | ||
101 | [ARIZONA_IRQ_CLKGEN_ERR_ASYNC] = { | ||
102 | .reg_offset = 2, .mask = ARIZONA_CLKGEN_ERR_ASYNC_EINT1 | ||
103 | }, | ||
104 | |||
105 | [ARIZONA_IRQ_AIF2_ERR] = { | ||
106 | .reg_offset = 3, .mask = ARIZONA_AIF2_ERR_EINT1 | ||
107 | }, | ||
108 | [ARIZONA_IRQ_AIF1_ERR] = { | ||
109 | .reg_offset = 3, .mask = ARIZONA_AIF1_ERR_EINT1 | ||
110 | }, | ||
111 | [ARIZONA_IRQ_CTRLIF_ERR] = { | ||
112 | .reg_offset = 3, .mask = ARIZONA_CTRLIF_ERR_EINT1 | ||
113 | }, | ||
114 | [ARIZONA_IRQ_MIXER_DROPPED_SAMPLES] = { | ||
115 | .reg_offset = 3, .mask = ARIZONA_MIXER_DROPPED_SAMPLE_EINT1 | ||
116 | }, | ||
117 | [ARIZONA_IRQ_ASYNC_CLK_ENA_LOW] = { | ||
118 | .reg_offset = 3, .mask = ARIZONA_ASYNC_CLK_ENA_LOW_EINT1 | ||
119 | }, | ||
120 | [ARIZONA_IRQ_SYSCLK_ENA_LOW] = { | ||
121 | .reg_offset = 3, .mask = ARIZONA_SYSCLK_ENA_LOW_EINT1 | ||
122 | }, | ||
123 | [ARIZONA_IRQ_ISRC1_CFG_ERR] = { | ||
124 | .reg_offset = 3, .mask = ARIZONA_ISRC1_CFG_ERR_EINT1 | ||
125 | }, | ||
126 | [ARIZONA_IRQ_ISRC2_CFG_ERR] = { | ||
127 | .reg_offset = 3, .mask = ARIZONA_ISRC2_CFG_ERR_EINT1 | ||
128 | }, | ||
129 | |||
130 | [ARIZONA_IRQ_BOOT_DONE] = { | ||
131 | .reg_offset = 4, .mask = ARIZONA_BOOT_DONE_EINT1 | ||
132 | }, | ||
133 | [ARIZONA_IRQ_DCS_DAC_DONE] = { | ||
134 | .reg_offset = 4, .mask = ARIZONA_DCS_DAC_DONE_EINT1 | ||
135 | }, | ||
136 | [ARIZONA_IRQ_DCS_HP_DONE] = { | ||
137 | .reg_offset = 4, .mask = ARIZONA_DCS_HP_DONE_EINT1 | ||
138 | }, | ||
139 | [ARIZONA_IRQ_FLL2_CLOCK_OK] = { | ||
140 | .reg_offset = 4, .mask = ARIZONA_FLL2_CLOCK_OK_EINT1 | ||
141 | }, | ||
142 | [ARIZONA_IRQ_FLL1_CLOCK_OK] = { | ||
143 | .reg_offset = 4, .mask = ARIZONA_FLL1_CLOCK_OK_EINT1 | ||
144 | }, | ||
145 | }; | ||
146 | |||
147 | const struct regmap_irq_chip wm8997_irq = { | ||
148 | .name = "wm8997 IRQ", | ||
149 | .status_base = ARIZONA_INTERRUPT_STATUS_1, | ||
150 | .mask_base = ARIZONA_INTERRUPT_STATUS_1_MASK, | ||
151 | .ack_base = ARIZONA_INTERRUPT_STATUS_1, | ||
152 | .num_regs = 5, | ||
153 | .irqs = wm8997_irqs, | ||
154 | .num_irqs = ARRAY_SIZE(wm8997_irqs), | ||
155 | }; | ||
156 | EXPORT_SYMBOL_GPL(wm8997_irq); | ||
157 | |||
158 | static const struct reg_default wm8997_reg_default[] = { | ||
159 | { 0x00000009, 0x0001 }, /* R9 - Ctrl IF I2C1 CFG 1 */ | ||
160 | { 0x00000016, 0x0000 }, /* R22 - Write Sequencer Ctrl 0 */ | ||
161 | { 0x00000017, 0x0000 }, /* R23 - Write Sequencer Ctrl 1 */ | ||
162 | { 0x00000018, 0x0000 }, /* R24 - Write Sequencer Ctrl 2 */ | ||
163 | { 0x00000020, 0x0000 }, /* R32 - Tone Generator 1 */ | ||
164 | { 0x00000021, 0x1000 }, /* R33 - Tone Generator 2 */ | ||
165 | { 0x00000022, 0x0000 }, /* R34 - Tone Generator 3 */ | ||
166 | { 0x00000023, 0x1000 }, /* R35 - Tone Generator 4 */ | ||
167 | { 0x00000024, 0x0000 }, /* R36 - Tone Generator 5 */ | ||
168 | { 0x00000030, 0x0000 }, /* R48 - PWM Drive 1 */ | ||
169 | { 0x00000031, 0x0100 }, /* R49 - PWM Drive 2 */ | ||
170 | { 0x00000032, 0x0100 }, /* R50 - PWM Drive 3 */ | ||
171 | { 0x00000040, 0x0000 }, /* R64 - Wake control */ | ||
172 | { 0x00000041, 0x0000 }, /* R65 - Sequence control */ | ||
173 | { 0x00000061, 0x01FF }, /* R97 - Sample Rate Sequence Select 1 */ | ||
174 | { 0x00000062, 0x01FF }, /* R98 - Sample Rate Sequence Select 2 */ | ||
175 | { 0x00000063, 0x01FF }, /* R99 - Sample Rate Sequence Select 3 */ | ||
176 | { 0x00000064, 0x01FF }, /* R100 - Sample Rate Sequence Select 4 */ | ||
177 | { 0x00000068, 0x01FF }, /* R104 - Always On Triggers Sequence Select 1 */ | ||
178 | { 0x00000069, 0x01FF }, /* R105 - Always On Triggers Sequence Select 2 */ | ||
179 | { 0x0000006A, 0x01FF }, /* R106 - Always On Triggers Sequence Select 3 */ | ||
180 | { 0x0000006B, 0x01FF }, /* R107 - Always On Triggers Sequence Select 4 */ | ||
181 | { 0x00000070, 0x0000 }, /* R112 - Comfort Noise Generator */ | ||
182 | { 0x00000090, 0x0000 }, /* R144 - Haptics Control 1 */ | ||
183 | { 0x00000091, 0x7FFF }, /* R145 - Haptics Control 2 */ | ||
184 | { 0x00000092, 0x0000 }, /* R146 - Haptics phase 1 intensity */ | ||
185 | { 0x00000093, 0x0000 }, /* R147 - Haptics phase 1 duration */ | ||
186 | { 0x00000094, 0x0000 }, /* R148 - Haptics phase 2 intensity */ | ||
187 | { 0x00000095, 0x0000 }, /* R149 - Haptics phase 2 duration */ | ||
188 | { 0x00000096, 0x0000 }, /* R150 - Haptics phase 3 intensity */ | ||
189 | { 0x00000097, 0x0000 }, /* R151 - Haptics phase 3 duration */ | ||
190 | { 0x00000100, 0x0002 }, /* R256 - Clock 32k 1 */ | ||
191 | { 0x00000101, 0x0304 }, /* R257 - System Clock 1 */ | ||
192 | { 0x00000102, 0x0011 }, /* R258 - Sample rate 1 */ | ||
193 | { 0x00000103, 0x0011 }, /* R259 - Sample rate 2 */ | ||
194 | { 0x00000104, 0x0011 }, /* R260 - Sample rate 3 */ | ||
195 | { 0x00000112, 0x0305 }, /* R274 - Async clock 1 */ | ||
196 | { 0x00000113, 0x0011 }, /* R275 - Async sample rate 1 */ | ||
197 | { 0x00000149, 0x0000 }, /* R329 - Output system clock */ | ||
198 | { 0x0000014A, 0x0000 }, /* R330 - Output async clock */ | ||
199 | { 0x00000152, 0x0000 }, /* R338 - Rate Estimator 1 */ | ||
200 | { 0x00000153, 0x0000 }, /* R339 - Rate Estimator 2 */ | ||
201 | { 0x00000154, 0x0000 }, /* R340 - Rate Estimator 3 */ | ||
202 | { 0x00000155, 0x0000 }, /* R341 - Rate Estimator 4 */ | ||
203 | { 0x00000156, 0x0000 }, /* R342 - Rate Estimator 5 */ | ||
204 | { 0x00000161, 0x0000 }, /* R353 - Dynamic Frequency Scaling 1 */ | ||
205 | { 0x00000171, 0x0000 }, /* R369 - FLL1 Control 1 */ | ||
206 | { 0x00000172, 0x0008 }, /* R370 - FLL1 Control 2 */ | ||
207 | { 0x00000173, 0x0018 }, /* R371 - FLL1 Control 3 */ | ||
208 | { 0x00000174, 0x007D }, /* R372 - FLL1 Control 4 */ | ||
209 | { 0x00000175, 0x0004 }, /* R373 - FLL1 Control 5 */ | ||
210 | { 0x00000176, 0x0000 }, /* R374 - FLL1 Control 6 */ | ||
211 | { 0x00000177, 0x0181 }, /* R375 - FLL1 Loop Filter Test 1 */ | ||
212 | { 0x00000181, 0x0000 }, /* R385 - FLL1 Synchroniser 1 */ | ||
213 | { 0x00000182, 0x0000 }, /* R386 - FLL1 Synchroniser 2 */ | ||
214 | { 0x00000183, 0x0000 }, /* R387 - FLL1 Synchroniser 3 */ | ||
215 | { 0x00000184, 0x0000 }, /* R388 - FLL1 Synchroniser 4 */ | ||
216 | { 0x00000185, 0x0000 }, /* R389 - FLL1 Synchroniser 5 */ | ||
217 | { 0x00000186, 0x0000 }, /* R390 - FLL1 Synchroniser 6 */ | ||
218 | { 0x00000189, 0x0000 }, /* R393 - FLL1 Spread Spectrum */ | ||
219 | { 0x0000018A, 0x0004 }, /* R394 - FLL1 GPIO Clock */ | ||
220 | { 0x00000191, 0x0000 }, /* R401 - FLL2 Control 1 */ | ||
221 | { 0x00000192, 0x0008 }, /* R402 - FLL2 Control 2 */ | ||
222 | { 0x00000193, 0x0018 }, /* R403 - FLL2 Control 3 */ | ||
223 | { 0x00000194, 0x007D }, /* R404 - FLL2 Control 4 */ | ||
224 | { 0x00000195, 0x0004 }, /* R405 - FLL2 Control 5 */ | ||
225 | { 0x00000196, 0x0000 }, /* R406 - FLL2 Control 6 */ | ||
226 | { 0x00000197, 0x0000 }, /* R407 - FLL2 Loop Filter Test 1 */ | ||
227 | { 0x000001A1, 0x0000 }, /* R417 - FLL2 Synchroniser 1 */ | ||
228 | { 0x000001A2, 0x0000 }, /* R418 - FLL2 Synchroniser 2 */ | ||
229 | { 0x000001A3, 0x0000 }, /* R419 - FLL2 Synchroniser 3 */ | ||
230 | { 0x000001A4, 0x0000 }, /* R420 - FLL2 Synchroniser 4 */ | ||
231 | { 0x000001A5, 0x0000 }, /* R421 - FLL2 Synchroniser 5 */ | ||
232 | { 0x000001A6, 0x0000 }, /* R422 - FLL2 Synchroniser 6 */ | ||
233 | { 0x000001A9, 0x0000 }, /* R425 - FLL2 Spread Spectrum */ | ||
234 | { 0x000001AA, 0x0004 }, /* R426 - FLL2 GPIO Clock */ | ||
235 | { 0x00000200, 0x0006 }, /* R512 - Mic Charge Pump 1 */ | ||
236 | { 0x00000210, 0x00D4 }, /* R528 - LDO1 Control 1 */ | ||
237 | { 0x00000212, 0x0000 }, /* R530 - LDO1 Control 2 */ | ||
238 | { 0x00000213, 0x0344 }, /* R531 - LDO2 Control 1 */ | ||
239 | { 0x00000218, 0x01A6 }, /* R536 - Mic Bias Ctrl 1 */ | ||
240 | { 0x00000219, 0x01A6 }, /* R537 - Mic Bias Ctrl 2 */ | ||
241 | { 0x0000021A, 0x01A6 }, /* R538 - Mic Bias Ctrl 3 */ | ||
242 | { 0x00000293, 0x0000 }, /* R659 - Accessory Detect Mode 1 */ | ||
243 | { 0x0000029B, 0x0020 }, /* R667 - Headphone Detect 1 */ | ||
244 | { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */ | ||
245 | { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */ | ||
246 | { 0x000002A5, 0x0000 }, /* R677 - Mic Detect 3 */ | ||
247 | { 0x000002C3, 0x0000 }, /* R707 - Mic noise mix control 1 */ | ||
248 | { 0x000002CB, 0x0000 }, /* R715 - Isolation control */ | ||
249 | { 0x000002D3, 0x0000 }, /* R723 - Jack detect analogue */ | ||
250 | { 0x00000300, 0x0000 }, /* R768 - Input Enables */ | ||
251 | { 0x00000308, 0x0000 }, /* R776 - Input Rate */ | ||
252 | { 0x00000309, 0x0022 }, /* R777 - Input Volume Ramp */ | ||
253 | { 0x00000310, 0x2080 }, /* R784 - IN1L Control */ | ||
254 | { 0x00000311, 0x0180 }, /* R785 - ADC Digital Volume 1L */ | ||
255 | { 0x00000312, 0x0000 }, /* R786 - DMIC1L Control */ | ||
256 | { 0x00000314, 0x0080 }, /* R788 - IN1R Control */ | ||
257 | { 0x00000315, 0x0180 }, /* R789 - ADC Digital Volume 1R */ | ||
258 | { 0x00000316, 0x0000 }, /* R790 - DMIC1R Control */ | ||
259 | { 0x00000318, 0x2080 }, /* R792 - IN2L Control */ | ||
260 | { 0x00000319, 0x0180 }, /* R793 - ADC Digital Volume 2L */ | ||
261 | { 0x0000031A, 0x0000 }, /* R794 - DMIC2L Control */ | ||
262 | { 0x0000031C, 0x0080 }, /* R796 - IN2R Control */ | ||
263 | { 0x0000031D, 0x0180 }, /* R797 - ADC Digital Volume 2R */ | ||
264 | { 0x0000031E, 0x0000 }, /* R798 - DMIC2R Control */ | ||
265 | { 0x00000400, 0x0000 }, /* R1024 - Output Enables 1 */ | ||
266 | { 0x00000408, 0x0000 }, /* R1032 - Output Rate 1 */ | ||
267 | { 0x00000409, 0x0022 }, /* R1033 - Output Volume Ramp */ | ||
268 | { 0x00000410, 0x0080 }, /* R1040 - Output Path Config 1L */ | ||
269 | { 0x00000411, 0x0180 }, /* R1041 - DAC Digital Volume 1L */ | ||
270 | { 0x00000412, 0x0080 }, /* R1042 - DAC Volume Limit 1L */ | ||
271 | { 0x00000413, 0x0001 }, /* R1043 - Noise Gate Select 1L */ | ||
272 | { 0x00000414, 0x0080 }, /* R1044 - Output Path Config 1R */ | ||
273 | { 0x00000415, 0x0180 }, /* R1045 - DAC Digital Volume 1R */ | ||
274 | { 0x00000416, 0x0080 }, /* R1046 - DAC Volume Limit 1R */ | ||
275 | { 0x00000417, 0x0002 }, /* R1047 - Noise Gate Select 1R */ | ||
276 | { 0x00000420, 0x0080 }, /* R1056 - Output Path Config 3L */ | ||
277 | { 0x00000421, 0x0180 }, /* R1057 - DAC Digital Volume 3L */ | ||
278 | { 0x00000422, 0x0080 }, /* R1058 - DAC Volume Limit 3L */ | ||
279 | { 0x00000423, 0x0010 }, /* R1059 - Noise Gate Select 3L */ | ||
280 | { 0x00000428, 0x0000 }, /* R1064 - Output Path Config 4L */ | ||
281 | { 0x00000429, 0x0180 }, /* R1065 - DAC Digital Volume 4L */ | ||
282 | { 0x0000042A, 0x0080 }, /* R1066 - Out Volume 4L */ | ||
283 | { 0x0000042B, 0x0040 }, /* R1067 - Noise Gate Select 4L */ | ||
284 | { 0x00000430, 0x0000 }, /* R1072 - Output Path Config 5L */ | ||
285 | { 0x00000431, 0x0180 }, /* R1073 - DAC Digital Volume 5L */ | ||
286 | { 0x00000432, 0x0080 }, /* R1074 - DAC Volume Limit 5L */ | ||
287 | { 0x00000433, 0x0100 }, /* R1075 - Noise Gate Select 5L */ | ||
288 | { 0x00000435, 0x0180 }, /* R1077 - DAC Digital Volume 5R */ | ||
289 | { 0x00000436, 0x0080 }, /* R1078 - DAC Volume Limit 5R */ | ||
290 | { 0x00000437, 0x0200 }, /* R1079 - Noise Gate Select 5R */ | ||
291 | { 0x00000450, 0x0000 }, /* R1104 - DAC AEC Control 1 */ | ||
292 | { 0x00000458, 0x0000 }, /* R1112 - Noise Gate Control */ | ||
293 | { 0x00000490, 0x0069 }, /* R1168 - PDM SPK1 CTRL 1 */ | ||
294 | { 0x00000491, 0x0000 }, /* R1169 - PDM SPK1 CTRL 2 */ | ||
295 | { 0x00000500, 0x000C }, /* R1280 - AIF1 BCLK Ctrl */ | ||
296 | { 0x00000501, 0x0008 }, /* R1281 - AIF1 Tx Pin Ctrl */ | ||
297 | { 0x00000502, 0x0000 }, /* R1282 - AIF1 Rx Pin Ctrl */ | ||
298 | { 0x00000503, 0x0000 }, /* R1283 - AIF1 Rate Ctrl */ | ||
299 | { 0x00000504, 0x0000 }, /* R1284 - AIF1 Format */ | ||
300 | { 0x00000505, 0x0040 }, /* R1285 - AIF1 Tx BCLK Rate */ | ||
301 | { 0x00000506, 0x0040 }, /* R1286 - AIF1 Rx BCLK Rate */ | ||
302 | { 0x00000507, 0x1818 }, /* R1287 - AIF1 Frame Ctrl 1 */ | ||
303 | { 0x00000508, 0x1818 }, /* R1288 - AIF1 Frame Ctrl 2 */ | ||
304 | { 0x00000509, 0x0000 }, /* R1289 - AIF1 Frame Ctrl 3 */ | ||
305 | { 0x0000050A, 0x0001 }, /* R1290 - AIF1 Frame Ctrl 4 */ | ||
306 | { 0x0000050B, 0x0002 }, /* R1291 - AIF1 Frame Ctrl 5 */ | ||
307 | { 0x0000050C, 0x0003 }, /* R1292 - AIF1 Frame Ctrl 6 */ | ||
308 | { 0x0000050D, 0x0004 }, /* R1293 - AIF1 Frame Ctrl 7 */ | ||
309 | { 0x0000050E, 0x0005 }, /* R1294 - AIF1 Frame Ctrl 8 */ | ||
310 | { 0x0000050F, 0x0006 }, /* R1295 - AIF1 Frame Ctrl 9 */ | ||
311 | { 0x00000510, 0x0007 }, /* R1296 - AIF1 Frame Ctrl 10 */ | ||
312 | { 0x00000511, 0x0000 }, /* R1297 - AIF1 Frame Ctrl 11 */ | ||
313 | { 0x00000512, 0x0001 }, /* R1298 - AIF1 Frame Ctrl 12 */ | ||
314 | { 0x00000513, 0x0002 }, /* R1299 - AIF1 Frame Ctrl 13 */ | ||
315 | { 0x00000514, 0x0003 }, /* R1300 - AIF1 Frame Ctrl 14 */ | ||
316 | { 0x00000515, 0x0004 }, /* R1301 - AIF1 Frame Ctrl 15 */ | ||
317 | { 0x00000516, 0x0005 }, /* R1302 - AIF1 Frame Ctrl 16 */ | ||
318 | { 0x00000517, 0x0006 }, /* R1303 - AIF1 Frame Ctrl 17 */ | ||
319 | { 0x00000518, 0x0007 }, /* R1304 - AIF1 Frame Ctrl 18 */ | ||
320 | { 0x00000519, 0x0000 }, /* R1305 - AIF1 Tx Enables */ | ||
321 | { 0x0000051A, 0x0000 }, /* R1306 - AIF1 Rx Enables */ | ||
322 | { 0x00000540, 0x000C }, /* R1344 - AIF2 BCLK Ctrl */ | ||
323 | { 0x00000541, 0x0008 }, /* R1345 - AIF2 Tx Pin Ctrl */ | ||
324 | { 0x00000542, 0x0000 }, /* R1346 - AIF2 Rx Pin Ctrl */ | ||
325 | { 0x00000543, 0x0000 }, /* R1347 - AIF2 Rate Ctrl */ | ||
326 | { 0x00000544, 0x0000 }, /* R1348 - AIF2 Format */ | ||
327 | { 0x00000545, 0x0040 }, /* R1349 - AIF2 Tx BCLK Rate */ | ||
328 | { 0x00000546, 0x0040 }, /* R1350 - AIF2 Rx BCLK Rate */ | ||
329 | { 0x00000547, 0x1818 }, /* R1351 - AIF2 Frame Ctrl 1 */ | ||
330 | { 0x00000548, 0x1818 }, /* R1352 - AIF2 Frame Ctrl 2 */ | ||
331 | { 0x00000549, 0x0000 }, /* R1353 - AIF2 Frame Ctrl 3 */ | ||
332 | { 0x0000054A, 0x0001 }, /* R1354 - AIF2 Frame Ctrl 4 */ | ||
333 | { 0x00000551, 0x0000 }, /* R1361 - AIF2 Frame Ctrl 11 */ | ||
334 | { 0x00000552, 0x0001 }, /* R1362 - AIF2 Frame Ctrl 12 */ | ||
335 | { 0x00000559, 0x0000 }, /* R1369 - AIF2 Tx Enables */ | ||
336 | { 0x0000055A, 0x0000 }, /* R1370 - AIF2 Rx Enables */ | ||
337 | { 0x000005E3, 0x0004 }, /* R1507 - SLIMbus Framer Ref Gear */ | ||
338 | { 0x000005E5, 0x0000 }, /* R1509 - SLIMbus Rates 1 */ | ||
339 | { 0x000005E6, 0x0000 }, /* R1510 - SLIMbus Rates 2 */ | ||
340 | { 0x000005E7, 0x0000 }, /* R1511 - SLIMbus Rates 3 */ | ||
341 | { 0x000005E8, 0x0000 }, /* R1512 - SLIMbus Rates 4 */ | ||
342 | { 0x000005E9, 0x0000 }, /* R1513 - SLIMbus Rates 5 */ | ||
343 | { 0x000005EA, 0x0000 }, /* R1514 - SLIMbus Rates 6 */ | ||
344 | { 0x000005EB, 0x0000 }, /* R1515 - SLIMbus Rates 7 */ | ||
345 | { 0x000005EC, 0x0000 }, /* R1516 - SLIMbus Rates 8 */ | ||
346 | { 0x000005F5, 0x0000 }, /* R1525 - SLIMbus RX Channel Enable */ | ||
347 | { 0x000005F6, 0x0000 }, /* R1526 - SLIMbus TX Channel Enable */ | ||
348 | { 0x00000640, 0x0000 }, /* R1600 - PWM1MIX Input 1 Source */ | ||
349 | { 0x00000641, 0x0080 }, /* R1601 - PWM1MIX Input 1 Volume */ | ||
350 | { 0x00000642, 0x0000 }, /* R1602 - PWM1MIX Input 2 Source */ | ||
351 | { 0x00000643, 0x0080 }, /* R1603 - PWM1MIX Input 2 Volume */ | ||
352 | { 0x00000644, 0x0000 }, /* R1604 - PWM1MIX Input 3 Source */ | ||
353 | { 0x00000645, 0x0080 }, /* R1605 - PWM1MIX Input 3 Volume */ | ||
354 | { 0x00000646, 0x0000 }, /* R1606 - PWM1MIX Input 4 Source */ | ||
355 | { 0x00000647, 0x0080 }, /* R1607 - PWM1MIX Input 4 Volume */ | ||
356 | { 0x00000648, 0x0000 }, /* R1608 - PWM2MIX Input 1 Source */ | ||
357 | { 0x00000649, 0x0080 }, /* R1609 - PWM2MIX Input 1 Volume */ | ||
358 | { 0x0000064A, 0x0000 }, /* R1610 - PWM2MIX Input 2 Source */ | ||
359 | { 0x0000064B, 0x0080 }, /* R1611 - PWM2MIX Input 2 Volume */ | ||
360 | { 0x0000064C, 0x0000 }, /* R1612 - PWM2MIX Input 3 Source */ | ||
361 | { 0x0000064D, 0x0080 }, /* R1613 - PWM2MIX Input 3 Volume */ | ||
362 | { 0x0000064E, 0x0000 }, /* R1614 - PWM2MIX Input 4 Source */ | ||
363 | { 0x0000064F, 0x0080 }, /* R1615 - PWM2MIX Input 4 Volume */ | ||
364 | { 0x00000660, 0x0000 }, /* R1632 - MICMIX Input 1 Source */ | ||
365 | { 0x00000661, 0x0080 }, /* R1633 - MICMIX Input 1 Volume */ | ||
366 | { 0x00000662, 0x0000 }, /* R1634 - MICMIX Input 2 Source */ | ||
367 | { 0x00000663, 0x0080 }, /* R1635 - MICMIX Input 2 Volume */ | ||
368 | { 0x00000664, 0x0000 }, /* R1636 - MICMIX Input 3 Source */ | ||
369 | { 0x00000665, 0x0080 }, /* R1637 - MICMIX Input 3 Volume */ | ||
370 | { 0x00000666, 0x0000 }, /* R1638 - MICMIX Input 4 Source */ | ||
371 | { 0x00000667, 0x0080 }, /* R1639 - MICMIX Input 4 Volume */ | ||
372 | { 0x00000668, 0x0000 }, /* R1640 - NOISEMIX Input 1 Source */ | ||
373 | { 0x00000669, 0x0080 }, /* R1641 - NOISEMIX Input 1 Volume */ | ||
374 | { 0x0000066A, 0x0000 }, /* R1642 - NOISEMIX Input 2 Source */ | ||
375 | { 0x0000066B, 0x0080 }, /* R1643 - NOISEMIX Input 2 Volume */ | ||
376 | { 0x0000066C, 0x0000 }, /* R1644 - NOISEMIX Input 3 Source */ | ||
377 | { 0x0000066D, 0x0080 }, /* R1645 - NOISEMIX Input 3 Volume */ | ||
378 | { 0x0000066E, 0x0000 }, /* R1646 - NOISEMIX Input 4 Source */ | ||
379 | { 0x0000066F, 0x0080 }, /* R1647 - NOISEMIX Input 4 Volume */ | ||
380 | { 0x00000680, 0x0000 }, /* R1664 - OUT1LMIX Input 1 Source */ | ||
381 | { 0x00000681, 0x0080 }, /* R1665 - OUT1LMIX Input 1 Volume */ | ||
382 | { 0x00000682, 0x0000 }, /* R1666 - OUT1LMIX Input 2 Source */ | ||
383 | { 0x00000683, 0x0080 }, /* R1667 - OUT1LMIX Input 2 Volume */ | ||
384 | { 0x00000684, 0x0000 }, /* R1668 - OUT1LMIX Input 3 Source */ | ||
385 | { 0x00000685, 0x0080 }, /* R1669 - OUT1LMIX Input 3 Volume */ | ||
386 | { 0x00000686, 0x0000 }, /* R1670 - OUT1LMIX Input 4 Source */ | ||
387 | { 0x00000687, 0x0080 }, /* R1671 - OUT1LMIX Input 4 Volume */ | ||
388 | { 0x00000688, 0x0000 }, /* R1672 - OUT1RMIX Input 1 Source */ | ||
389 | { 0x00000689, 0x0080 }, /* R1673 - OUT1RMIX Input 1 Volume */ | ||
390 | { 0x0000068A, 0x0000 }, /* R1674 - OUT1RMIX Input 2 Source */ | ||
391 | { 0x0000068B, 0x0080 }, /* R1675 - OUT1RMIX Input 2 Volume */ | ||
392 | { 0x0000068C, 0x0000 }, /* R1676 - OUT1RMIX Input 3 Source */ | ||
393 | { 0x0000068D, 0x0080 }, /* R1677 - OUT1RMIX Input 3 Volume */ | ||
394 | { 0x0000068E, 0x0000 }, /* R1678 - OUT1RMIX Input 4 Source */ | ||
395 | { 0x0000068F, 0x0080 }, /* R1679 - OUT1RMIX Input 4 Volume */ | ||
396 | { 0x000006A0, 0x0000 }, /* R1696 - OUT3LMIX Input 1 Source */ | ||
397 | { 0x000006A1, 0x0080 }, /* R1697 - OUT3LMIX Input 1 Volume */ | ||
398 | { 0x000006A2, 0x0000 }, /* R1698 - OUT3LMIX Input 2 Source */ | ||
399 | { 0x000006A3, 0x0080 }, /* R1699 - OUT3LMIX Input 2 Volume */ | ||
400 | { 0x000006A4, 0x0000 }, /* R1700 - OUT3LMIX Input 3 Source */ | ||
401 | { 0x000006A5, 0x0080 }, /* R1701 - OUT3LMIX Input 3 Volume */ | ||
402 | { 0x000006A6, 0x0000 }, /* R1702 - OUT3LMIX Input 4 Source */ | ||
403 | { 0x000006A7, 0x0080 }, /* R1703 - OUT3LMIX Input 4 Volume */ | ||
404 | { 0x000006B0, 0x0000 }, /* R1712 - OUT4LMIX Input 1 Source */ | ||
405 | { 0x000006B1, 0x0080 }, /* R1713 - OUT4LMIX Input 1 Volume */ | ||
406 | { 0x000006B2, 0x0000 }, /* R1714 - OUT4LMIX Input 2 Source */ | ||
407 | { 0x000006B3, 0x0080 }, /* R1715 - OUT4LMIX Input 2 Volume */ | ||
408 | { 0x000006B4, 0x0000 }, /* R1716 - OUT4LMIX Input 3 Source */ | ||
409 | { 0x000006B5, 0x0080 }, /* R1717 - OUT4LMIX Input 3 Volume */ | ||
410 | { 0x000006B6, 0x0000 }, /* R1718 - OUT4LMIX Input 4 Source */ | ||
411 | { 0x000006B7, 0x0080 }, /* R1719 - OUT4LMIX Input 4 Volume */ | ||
412 | { 0x000006C0, 0x0000 }, /* R1728 - OUT5LMIX Input 1 Source */ | ||
413 | { 0x000006C1, 0x0080 }, /* R1729 - OUT5LMIX Input 1 Volume */ | ||
414 | { 0x000006C2, 0x0000 }, /* R1730 - OUT5LMIX Input 2 Source */ | ||
415 | { 0x000006C3, 0x0080 }, /* R1731 - OUT5LMIX Input 2 Volume */ | ||
416 | { 0x000006C4, 0x0000 }, /* R1732 - OUT5LMIX Input 3 Source */ | ||
417 | { 0x000006C5, 0x0080 }, /* R1733 - OUT5LMIX Input 3 Volume */ | ||
418 | { 0x000006C6, 0x0000 }, /* R1734 - OUT5LMIX Input 4 Source */ | ||
419 | { 0x000006C7, 0x0080 }, /* R1735 - OUT5LMIX Input 4 Volume */ | ||
420 | { 0x000006C8, 0x0000 }, /* R1736 - OUT5RMIX Input 1 Source */ | ||
421 | { 0x000006C9, 0x0080 }, /* R1737 - OUT5RMIX Input 1 Volume */ | ||
422 | { 0x000006CA, 0x0000 }, /* R1738 - OUT5RMIX Input 2 Source */ | ||
423 | { 0x000006CB, 0x0080 }, /* R1739 - OUT5RMIX Input 2 Volume */ | ||
424 | { 0x000006CC, 0x0000 }, /* R1740 - OUT5RMIX Input 3 Source */ | ||
425 | { 0x000006CD, 0x0080 }, /* R1741 - OUT5RMIX Input 3 Volume */ | ||
426 | { 0x000006CE, 0x0000 }, /* R1742 - OUT5RMIX Input 4 Source */ | ||
427 | { 0x000006CF, 0x0080 }, /* R1743 - OUT5RMIX Input 4 Volume */ | ||
428 | { 0x00000700, 0x0000 }, /* R1792 - AIF1TX1MIX Input 1 Source */ | ||
429 | { 0x00000701, 0x0080 }, /* R1793 - AIF1TX1MIX Input 1 Volume */ | ||
430 | { 0x00000702, 0x0000 }, /* R1794 - AIF1TX1MIX Input 2 Source */ | ||
431 | { 0x00000703, 0x0080 }, /* R1795 - AIF1TX1MIX Input 2 Volume */ | ||
432 | { 0x00000704, 0x0000 }, /* R1796 - AIF1TX1MIX Input 3 Source */ | ||
433 | { 0x00000705, 0x0080 }, /* R1797 - AIF1TX1MIX Input 3 Volume */ | ||
434 | { 0x00000706, 0x0000 }, /* R1798 - AIF1TX1MIX Input 4 Source */ | ||
435 | { 0x00000707, 0x0080 }, /* R1799 - AIF1TX1MIX Input 4 Volume */ | ||
436 | { 0x00000708, 0x0000 }, /* R1800 - AIF1TX2MIX Input 1 Source */ | ||
437 | { 0x00000709, 0x0080 }, /* R1801 - AIF1TX2MIX Input 1 Volume */ | ||
438 | { 0x0000070A, 0x0000 }, /* R1802 - AIF1TX2MIX Input 2 Source */ | ||
439 | { 0x0000070B, 0x0080 }, /* R1803 - AIF1TX2MIX Input 2 Volume */ | ||
440 | { 0x0000070C, 0x0000 }, /* R1804 - AIF1TX2MIX Input 3 Source */ | ||
441 | { 0x0000070D, 0x0080 }, /* R1805 - AIF1TX2MIX Input 3 Volume */ | ||
442 | { 0x0000070E, 0x0000 }, /* R1806 - AIF1TX2MIX Input 4 Source */ | ||
443 | { 0x0000070F, 0x0080 }, /* R1807 - AIF1TX2MIX Input 4 Volume */ | ||
444 | { 0x00000710, 0x0000 }, /* R1808 - AIF1TX3MIX Input 1 Source */ | ||
445 | { 0x00000711, 0x0080 }, /* R1809 - AIF1TX3MIX Input 1 Volume */ | ||
446 | { 0x00000712, 0x0000 }, /* R1810 - AIF1TX3MIX Input 2 Source */ | ||
447 | { 0x00000713, 0x0080 }, /* R1811 - AIF1TX3MIX Input 2 Volume */ | ||
448 | { 0x00000714, 0x0000 }, /* R1812 - AIF1TX3MIX Input 3 Source */ | ||
449 | { 0x00000715, 0x0080 }, /* R1813 - AIF1TX3MIX Input 3 Volume */ | ||
450 | { 0x00000716, 0x0000 }, /* R1814 - AIF1TX3MIX Input 4 Source */ | ||
451 | { 0x00000717, 0x0080 }, /* R1815 - AIF1TX3MIX Input 4 Volume */ | ||
452 | { 0x00000718, 0x0000 }, /* R1816 - AIF1TX4MIX Input 1 Source */ | ||
453 | { 0x00000719, 0x0080 }, /* R1817 - AIF1TX4MIX Input 1 Volume */ | ||
454 | { 0x0000071A, 0x0000 }, /* R1818 - AIF1TX4MIX Input 2 Source */ | ||
455 | { 0x0000071B, 0x0080 }, /* R1819 - AIF1TX4MIX Input 2 Volume */ | ||
456 | { 0x0000071C, 0x0000 }, /* R1820 - AIF1TX4MIX Input 3 Source */ | ||
457 | { 0x0000071D, 0x0080 }, /* R1821 - AIF1TX4MIX Input 3 Volume */ | ||
458 | { 0x0000071E, 0x0000 }, /* R1822 - AIF1TX4MIX Input 4 Source */ | ||
459 | { 0x0000071F, 0x0080 }, /* R1823 - AIF1TX4MIX Input 4 Volume */ | ||
460 | { 0x00000720, 0x0000 }, /* R1824 - AIF1TX5MIX Input 1 Source */ | ||
461 | { 0x00000721, 0x0080 }, /* R1825 - AIF1TX5MIX Input 1 Volume */ | ||
462 | { 0x00000722, 0x0000 }, /* R1826 - AIF1TX5MIX Input 2 Source */ | ||
463 | { 0x00000723, 0x0080 }, /* R1827 - AIF1TX5MIX Input 2 Volume */ | ||
464 | { 0x00000724, 0x0000 }, /* R1828 - AIF1TX5MIX Input 3 Source */ | ||
465 | { 0x00000725, 0x0080 }, /* R1829 - AIF1TX5MIX Input 3 Volume */ | ||
466 | { 0x00000726, 0x0000 }, /* R1830 - AIF1TX5MIX Input 4 Source */ | ||
467 | { 0x00000727, 0x0080 }, /* R1831 - AIF1TX5MIX Input 4 Volume */ | ||
468 | { 0x00000728, 0x0000 }, /* R1832 - AIF1TX6MIX Input 1 Source */ | ||
469 | { 0x00000729, 0x0080 }, /* R1833 - AIF1TX6MIX Input 1 Volume */ | ||
470 | { 0x0000072A, 0x0000 }, /* R1834 - AIF1TX6MIX Input 2 Source */ | ||
471 | { 0x0000072B, 0x0080 }, /* R1835 - AIF1TX6MIX Input 2 Volume */ | ||
472 | { 0x0000072C, 0x0000 }, /* R1836 - AIF1TX6MIX Input 3 Source */ | ||
473 | { 0x0000072D, 0x0080 }, /* R1837 - AIF1TX6MIX Input 3 Volume */ | ||
474 | { 0x0000072E, 0x0000 }, /* R1838 - AIF1TX6MIX Input 4 Source */ | ||
475 | { 0x0000072F, 0x0080 }, /* R1839 - AIF1TX6MIX Input 4 Volume */ | ||
476 | { 0x00000730, 0x0000 }, /* R1840 - AIF1TX7MIX Input 1 Source */ | ||
477 | { 0x00000731, 0x0080 }, /* R1841 - AIF1TX7MIX Input 1 Volume */ | ||
478 | { 0x00000732, 0x0000 }, /* R1842 - AIF1TX7MIX Input 2 Source */ | ||
479 | { 0x00000733, 0x0080 }, /* R1843 - AIF1TX7MIX Input 2 Volume */ | ||
480 | { 0x00000734, 0x0000 }, /* R1844 - AIF1TX7MIX Input 3 Source */ | ||
481 | { 0x00000735, 0x0080 }, /* R1845 - AIF1TX7MIX Input 3 Volume */ | ||
482 | { 0x00000736, 0x0000 }, /* R1846 - AIF1TX7MIX Input 4 Source */ | ||
483 | { 0x00000737, 0x0080 }, /* R1847 - AIF1TX7MIX Input 4 Volume */ | ||
484 | { 0x00000738, 0x0000 }, /* R1848 - AIF1TX8MIX Input 1 Source */ | ||
485 | { 0x00000739, 0x0080 }, /* R1849 - AIF1TX8MIX Input 1 Volume */ | ||
486 | { 0x0000073A, 0x0000 }, /* R1850 - AIF1TX8MIX Input 2 Source */ | ||
487 | { 0x0000073B, 0x0080 }, /* R1851 - AIF1TX8MIX Input 2 Volume */ | ||
488 | { 0x0000073C, 0x0000 }, /* R1852 - AIF1TX8MIX Input 3 Source */ | ||
489 | { 0x0000073D, 0x0080 }, /* R1853 - AIF1TX8MIX Input 3 Volume */ | ||
490 | { 0x0000073E, 0x0000 }, /* R1854 - AIF1TX8MIX Input 4 Source */ | ||
491 | { 0x0000073F, 0x0080 }, /* R1855 - AIF1TX8MIX Input 4 Volume */ | ||
492 | { 0x00000740, 0x0000 }, /* R1856 - AIF2TX1MIX Input 1 Source */ | ||
493 | { 0x00000741, 0x0080 }, /* R1857 - AIF2TX1MIX Input 1 Volume */ | ||
494 | { 0x00000742, 0x0000 }, /* R1858 - AIF2TX1MIX Input 2 Source */ | ||
495 | { 0x00000743, 0x0080 }, /* R1859 - AIF2TX1MIX Input 2 Volume */ | ||
496 | { 0x00000744, 0x0000 }, /* R1860 - AIF2TX1MIX Input 3 Source */ | ||
497 | { 0x00000745, 0x0080 }, /* R1861 - AIF2TX1MIX Input 3 Volume */ | ||
498 | { 0x00000746, 0x0000 }, /* R1862 - AIF2TX1MIX Input 4 Source */ | ||
499 | { 0x00000747, 0x0080 }, /* R1863 - AIF2TX1MIX Input 4 Volume */ | ||
500 | { 0x00000748, 0x0000 }, /* R1864 - AIF2TX2MIX Input 1 Source */ | ||
501 | { 0x00000749, 0x0080 }, /* R1865 - AIF2TX2MIX Input 1 Volume */ | ||
502 | { 0x0000074A, 0x0000 }, /* R1866 - AIF2TX2MIX Input 2 Source */ | ||
503 | { 0x0000074B, 0x0080 }, /* R1867 - AIF2TX2MIX Input 2 Volume */ | ||
504 | { 0x0000074C, 0x0000 }, /* R1868 - AIF2TX2MIX Input 3 Source */ | ||
505 | { 0x0000074D, 0x0080 }, /* R1869 - AIF2TX2MIX Input 3 Volume */ | ||
506 | { 0x0000074E, 0x0000 }, /* R1870 - AIF2TX2MIX Input 4 Source */ | ||
507 | { 0x0000074F, 0x0080 }, /* R1871 - AIF2TX2MIX Input 4 Volume */ | ||
508 | { 0x000007C0, 0x0000 }, /* R1984 - SLIMTX1MIX Input 1 Source */ | ||
509 | { 0x000007C1, 0x0080 }, /* R1985 - SLIMTX1MIX Input 1 Volume */ | ||
510 | { 0x000007C2, 0x0000 }, /* R1986 - SLIMTX1MIX Input 2 Source */ | ||
511 | { 0x000007C3, 0x0080 }, /* R1987 - SLIMTX1MIX Input 2 Volume */ | ||
512 | { 0x000007C4, 0x0000 }, /* R1988 - SLIMTX1MIX Input 3 Source */ | ||
513 | { 0x000007C5, 0x0080 }, /* R1989 - SLIMTX1MIX Input 3 Volume */ | ||
514 | { 0x000007C6, 0x0000 }, /* R1990 - SLIMTX1MIX Input 4 Source */ | ||
515 | { 0x000007C7, 0x0080 }, /* R1991 - SLIMTX1MIX Input 4 Volume */ | ||
516 | { 0x000007C8, 0x0000 }, /* R1992 - SLIMTX2MIX Input 1 Source */ | ||
517 | { 0x000007C9, 0x0080 }, /* R1993 - SLIMTX2MIX Input 1 Volume */ | ||
518 | { 0x000007CA, 0x0000 }, /* R1994 - SLIMTX2MIX Input 2 Source */ | ||
519 | { 0x000007CB, 0x0080 }, /* R1995 - SLIMTX2MIX Input 2 Volume */ | ||
520 | { 0x000007CC, 0x0000 }, /* R1996 - SLIMTX2MIX Input 3 Source */ | ||
521 | { 0x000007CD, 0x0080 }, /* R1997 - SLIMTX2MIX Input 3 Volume */ | ||
522 | { 0x000007CE, 0x0000 }, /* R1998 - SLIMTX2MIX Input 4 Source */ | ||
523 | { 0x000007CF, 0x0080 }, /* R1999 - SLIMTX2MIX Input 4 Volume */ | ||
524 | { 0x000007D0, 0x0000 }, /* R2000 - SLIMTX3MIX Input 1 Source */ | ||
525 | { 0x000007D1, 0x0080 }, /* R2001 - SLIMTX3MIX Input 1 Volume */ | ||
526 | { 0x000007D2, 0x0000 }, /* R2002 - SLIMTX3MIX Input 2 Source */ | ||
527 | { 0x000007D3, 0x0080 }, /* R2003 - SLIMTX3MIX Input 2 Volume */ | ||
528 | { 0x000007D4, 0x0000 }, /* R2004 - SLIMTX3MIX Input 3 Source */ | ||
529 | { 0x000007D5, 0x0080 }, /* R2005 - SLIMTX3MIX Input 3 Volume */ | ||
530 | { 0x000007D6, 0x0000 }, /* R2006 - SLIMTX3MIX Input 4 Source */ | ||
531 | { 0x000007D7, 0x0080 }, /* R2007 - SLIMTX3MIX Input 4 Volume */ | ||
532 | { 0x000007D8, 0x0000 }, /* R2008 - SLIMTX4MIX Input 1 Source */ | ||
533 | { 0x000007D9, 0x0080 }, /* R2009 - SLIMTX4MIX Input 1 Volume */ | ||
534 | { 0x000007DA, 0x0000 }, /* R2010 - SLIMTX4MIX Input 2 Source */ | ||
535 | { 0x000007DB, 0x0080 }, /* R2011 - SLIMTX4MIX Input 2 Volume */ | ||
536 | { 0x000007DC, 0x0000 }, /* R2012 - SLIMTX4MIX Input 3 Source */ | ||
537 | { 0x000007DD, 0x0080 }, /* R2013 - SLIMTX4MIX Input 3 Volume */ | ||
538 | { 0x000007DE, 0x0000 }, /* R2014 - SLIMTX4MIX Input 4 Source */ | ||
539 | { 0x000007DF, 0x0080 }, /* R2015 - SLIMTX4MIX Input 4 Volume */ | ||
540 | { 0x000007E0, 0x0000 }, /* R2016 - SLIMTX5MIX Input 1 Source */ | ||
541 | { 0x000007E1, 0x0080 }, /* R2017 - SLIMTX5MIX Input 1 Volume */ | ||
542 | { 0x000007E2, 0x0000 }, /* R2018 - SLIMTX5MIX Input 2 Source */ | ||
543 | { 0x000007E3, 0x0080 }, /* R2019 - SLIMTX5MIX Input 2 Volume */ | ||
544 | { 0x000007E4, 0x0000 }, /* R2020 - SLIMTX5MIX Input 3 Source */ | ||
545 | { 0x000007E5, 0x0080 }, /* R2021 - SLIMTX5MIX Input 3 Volume */ | ||
546 | { 0x000007E6, 0x0000 }, /* R2022 - SLIMTX5MIX Input 4 Source */ | ||
547 | { 0x000007E7, 0x0080 }, /* R2023 - SLIMTX5MIX Input 4 Volume */ | ||
548 | { 0x000007E8, 0x0000 }, /* R2024 - SLIMTX6MIX Input 1 Source */ | ||
549 | { 0x000007E9, 0x0080 }, /* R2025 - SLIMTX6MIX Input 1 Volume */ | ||
550 | { 0x000007EA, 0x0000 }, /* R2026 - SLIMTX6MIX Input 2 Source */ | ||
551 | { 0x000007EB, 0x0080 }, /* R2027 - SLIMTX6MIX Input 2 Volume */ | ||
552 | { 0x000007EC, 0x0000 }, /* R2028 - SLIMTX6MIX Input 3 Source */ | ||
553 | { 0x000007ED, 0x0080 }, /* R2029 - SLIMTX6MIX Input 3 Volume */ | ||
554 | { 0x000007EE, 0x0000 }, /* R2030 - SLIMTX6MIX Input 4 Source */ | ||
555 | { 0x000007EF, 0x0080 }, /* R2031 - SLIMTX6MIX Input 4 Volume */ | ||
556 | { 0x000007F0, 0x0000 }, /* R2032 - SLIMTX7MIX Input 1 Source */ | ||
557 | { 0x000007F1, 0x0080 }, /* R2033 - SLIMTX7MIX Input 1 Volume */ | ||
558 | { 0x000007F2, 0x0000 }, /* R2034 - SLIMTX7MIX Input 2 Source */ | ||
559 | { 0x000007F3, 0x0080 }, /* R2035 - SLIMTX7MIX Input 2 Volume */ | ||
560 | { 0x000007F4, 0x0000 }, /* R2036 - SLIMTX7MIX Input 3 Source */ | ||
561 | { 0x000007F5, 0x0080 }, /* R2037 - SLIMTX7MIX Input 3 Volume */ | ||
562 | { 0x000007F6, 0x0000 }, /* R2038 - SLIMTX7MIX Input 4 Source */ | ||
563 | { 0x000007F7, 0x0080 }, /* R2039 - SLIMTX7MIX Input 4 Volume */ | ||
564 | { 0x000007F8, 0x0000 }, /* R2040 - SLIMTX8MIX Input 1 Source */ | ||
565 | { 0x000007F9, 0x0080 }, /* R2041 - SLIMTX8MIX Input 1 Volume */ | ||
566 | { 0x000007FA, 0x0000 }, /* R2042 - SLIMTX8MIX Input 2 Source */ | ||
567 | { 0x000007FB, 0x0080 }, /* R2043 - SLIMTX8MIX Input 2 Volume */ | ||
568 | { 0x000007FC, 0x0000 }, /* R2044 - SLIMTX8MIX Input 3 Source */ | ||
569 | { 0x000007FD, 0x0080 }, /* R2045 - SLIMTX8MIX Input 3 Volume */ | ||
570 | { 0x000007FE, 0x0000 }, /* R2046 - SLIMTX8MIX Input 4 Source */ | ||
571 | { 0x000007FF, 0x0080 }, /* R2047 - SLIMTX8MIX Input 4 Volume */ | ||
572 | { 0x00000880, 0x0000 }, /* R2176 - EQ1MIX Input 1 Source */ | ||
573 | { 0x00000881, 0x0080 }, /* R2177 - EQ1MIX Input 1 Volume */ | ||
574 | { 0x00000882, 0x0000 }, /* R2178 - EQ1MIX Input 2 Source */ | ||
575 | { 0x00000883, 0x0080 }, /* R2179 - EQ1MIX Input 2 Volume */ | ||
576 | { 0x00000884, 0x0000 }, /* R2180 - EQ1MIX Input 3 Source */ | ||
577 | { 0x00000885, 0x0080 }, /* R2181 - EQ1MIX Input 3 Volume */ | ||
578 | { 0x00000886, 0x0000 }, /* R2182 - EQ1MIX Input 4 Source */ | ||
579 | { 0x00000887, 0x0080 }, /* R2183 - EQ1MIX Input 4 Volume */ | ||
580 | { 0x00000888, 0x0000 }, /* R2184 - EQ2MIX Input 1 Source */ | ||
581 | { 0x00000889, 0x0080 }, /* R2185 - EQ2MIX Input 1 Volume */ | ||
582 | { 0x0000088A, 0x0000 }, /* R2186 - EQ2MIX Input 2 Source */ | ||
583 | { 0x0000088B, 0x0080 }, /* R2187 - EQ2MIX Input 2 Volume */ | ||
584 | { 0x0000088C, 0x0000 }, /* R2188 - EQ2MIX Input 3 Source */ | ||
585 | { 0x0000088D, 0x0080 }, /* R2189 - EQ2MIX Input 3 Volume */ | ||
586 | { 0x0000088E, 0x0000 }, /* R2190 - EQ2MIX Input 4 Source */ | ||
587 | { 0x0000088F, 0x0080 }, /* R2191 - EQ2MIX Input 4 Volume */ | ||
588 | { 0x00000890, 0x0000 }, /* R2192 - EQ3MIX Input 1 Source */ | ||
589 | { 0x00000891, 0x0080 }, /* R2193 - EQ3MIX Input 1 Volume */ | ||
590 | { 0x00000892, 0x0000 }, /* R2194 - EQ3MIX Input 2 Source */ | ||
591 | { 0x00000893, 0x0080 }, /* R2195 - EQ3MIX Input 2 Volume */ | ||
592 | { 0x00000894, 0x0000 }, /* R2196 - EQ3MIX Input 3 Source */ | ||
593 | { 0x00000895, 0x0080 }, /* R2197 - EQ3MIX Input 3 Volume */ | ||
594 | { 0x00000896, 0x0000 }, /* R2198 - EQ3MIX Input 4 Source */ | ||
595 | { 0x00000897, 0x0080 }, /* R2199 - EQ3MIX Input 4 Volume */ | ||
596 | { 0x00000898, 0x0000 }, /* R2200 - EQ4MIX Input 1 Source */ | ||
597 | { 0x00000899, 0x0080 }, /* R2201 - EQ4MIX Input 1 Volume */ | ||
598 | { 0x0000089A, 0x0000 }, /* R2202 - EQ4MIX Input 2 Source */ | ||
599 | { 0x0000089B, 0x0080 }, /* R2203 - EQ4MIX Input 2 Volume */ | ||
600 | { 0x0000089C, 0x0000 }, /* R2204 - EQ4MIX Input 3 Source */ | ||
601 | { 0x0000089D, 0x0080 }, /* R2205 - EQ4MIX Input 3 Volume */ | ||
602 | { 0x0000089E, 0x0000 }, /* R2206 - EQ4MIX Input 4 Source */ | ||
603 | { 0x0000089F, 0x0080 }, /* R2207 - EQ4MIX Input 4 Volume */ | ||
604 | { 0x000008C0, 0x0000 }, /* R2240 - DRC1LMIX Input 1 Source */ | ||
605 | { 0x000008C1, 0x0080 }, /* R2241 - DRC1LMIX Input 1 Volume */ | ||
606 | { 0x000008C2, 0x0000 }, /* R2242 - DRC1LMIX Input 2 Source */ | ||
607 | { 0x000008C3, 0x0080 }, /* R2243 - DRC1LMIX Input 2 Volume */ | ||
608 | { 0x000008C4, 0x0000 }, /* R2244 - DRC1LMIX Input 3 Source */ | ||
609 | { 0x000008C5, 0x0080 }, /* R2245 - DRC1LMIX Input 3 Volume */ | ||
610 | { 0x000008C6, 0x0000 }, /* R2246 - DRC1LMIX Input 4 Source */ | ||
611 | { 0x000008C7, 0x0080 }, /* R2247 - DRC1LMIX Input 4 Volume */ | ||
612 | { 0x000008C8, 0x0000 }, /* R2248 - DRC1RMIX Input 1 Source */ | ||
613 | { 0x000008C9, 0x0080 }, /* R2249 - DRC1RMIX Input 1 Volume */ | ||
614 | { 0x000008CA, 0x0000 }, /* R2250 - DRC1RMIX Input 2 Source */ | ||
615 | { 0x000008CB, 0x0080 }, /* R2251 - DRC1RMIX Input 2 Volume */ | ||
616 | { 0x000008CC, 0x0000 }, /* R2252 - DRC1RMIX Input 3 Source */ | ||
617 | { 0x000008CD, 0x0080 }, /* R2253 - DRC1RMIX Input 3 Volume */ | ||
618 | { 0x000008CE, 0x0000 }, /* R2254 - DRC1RMIX Input 4 Source */ | ||
619 | { 0x000008CF, 0x0080 }, /* R2255 - DRC1RMIX Input 4 Volume */ | ||
620 | { 0x00000900, 0x0000 }, /* R2304 - HPLP1MIX Input 1 Source */ | ||
621 | { 0x00000901, 0x0080 }, /* R2305 - HPLP1MIX Input 1 Volume */ | ||
622 | { 0x00000902, 0x0000 }, /* R2306 - HPLP1MIX Input 2 Source */ | ||
623 | { 0x00000903, 0x0080 }, /* R2307 - HPLP1MIX Input 2 Volume */ | ||
624 | { 0x00000904, 0x0000 }, /* R2308 - HPLP1MIX Input 3 Source */ | ||
625 | { 0x00000905, 0x0080 }, /* R2309 - HPLP1MIX Input 3 Volume */ | ||
626 | { 0x00000906, 0x0000 }, /* R2310 - HPLP1MIX Input 4 Source */ | ||
627 | { 0x00000907, 0x0080 }, /* R2311 - HPLP1MIX Input 4 Volume */ | ||
628 | { 0x00000908, 0x0000 }, /* R2312 - HPLP2MIX Input 1 Source */ | ||
629 | { 0x00000909, 0x0080 }, /* R2313 - HPLP2MIX Input 1 Volume */ | ||
630 | { 0x0000090A, 0x0000 }, /* R2314 - HPLP2MIX Input 2 Source */ | ||
631 | { 0x0000090B, 0x0080 }, /* R2315 - HPLP2MIX Input 2 Volume */ | ||
632 | { 0x0000090C, 0x0000 }, /* R2316 - HPLP2MIX Input 3 Source */ | ||
633 | { 0x0000090D, 0x0080 }, /* R2317 - HPLP2MIX Input 3 Volume */ | ||
634 | { 0x0000090E, 0x0000 }, /* R2318 - HPLP2MIX Input 4 Source */ | ||
635 | { 0x0000090F, 0x0080 }, /* R2319 - HPLP2MIX Input 4 Volume */ | ||
636 | { 0x00000910, 0x0000 }, /* R2320 - HPLP3MIX Input 1 Source */ | ||
637 | { 0x00000911, 0x0080 }, /* R2321 - HPLP3MIX Input 1 Volume */ | ||
638 | { 0x00000912, 0x0000 }, /* R2322 - HPLP3MIX Input 2 Source */ | ||
639 | { 0x00000913, 0x0080 }, /* R2323 - HPLP3MIX Input 2 Volume */ | ||
640 | { 0x00000914, 0x0000 }, /* R2324 - HPLP3MIX Input 3 Source */ | ||
641 | { 0x00000915, 0x0080 }, /* R2325 - HPLP3MIX Input 3 Volume */ | ||
642 | { 0x00000916, 0x0000 }, /* R2326 - HPLP3MIX Input 4 Source */ | ||
643 | { 0x00000917, 0x0080 }, /* R2327 - HPLP3MIX Input 4 Volume */ | ||
644 | { 0x00000918, 0x0000 }, /* R2328 - HPLP4MIX Input 1 Source */ | ||
645 | { 0x00000919, 0x0080 }, /* R2329 - HPLP4MIX Input 1 Volume */ | ||
646 | { 0x0000091A, 0x0000 }, /* R2330 - HPLP4MIX Input 2 Source */ | ||
647 | { 0x0000091B, 0x0080 }, /* R2331 - HPLP4MIX Input 2 Volume */ | ||
648 | { 0x0000091C, 0x0000 }, /* R2332 - HPLP4MIX Input 3 Source */ | ||
649 | { 0x0000091D, 0x0080 }, /* R2333 - HPLP4MIX Input 3 Volume */ | ||
650 | { 0x0000091E, 0x0000 }, /* R2334 - HPLP4MIX Input 4 Source */ | ||
651 | { 0x0000091F, 0x0080 }, /* R2335 - HPLP4MIX Input 4 Volume */ | ||
652 | { 0x00000B00, 0x0000 }, /* R2816 - ISRC1DEC1MIX Input 1 Source */ | ||
653 | { 0x00000B08, 0x0000 }, /* R2824 - ISRC1DEC2MIX Input 1 Source */ | ||
654 | { 0x00000B20, 0x0000 }, /* R2848 - ISRC1INT1MIX Input 1 Source */ | ||
655 | { 0x00000B28, 0x0000 }, /* R2856 - ISRC1INT2MIX Input 1 Source */ | ||
656 | { 0x00000B40, 0x0000 }, /* R2880 - ISRC2DEC1MIX Input 1 Source */ | ||
657 | { 0x00000B48, 0x0000 }, /* R2888 - ISRC2DEC2MIX Input 1 Source */ | ||
658 | { 0x00000B60, 0x0000 }, /* R2912 - ISRC2INT1MIX Input 1 Source */ | ||
659 | { 0x00000B68, 0x0000 }, /* R2920 - ISRC2INT2MIX Input 1 Source */ | ||
660 | { 0x00000C00, 0xA101 }, /* R3072 - GPIO1 CTRL */ | ||
661 | { 0x00000C01, 0xA101 }, /* R3073 - GPIO2 CTRL */ | ||
662 | { 0x00000C02, 0xA101 }, /* R3074 - GPIO3 CTRL */ | ||
663 | { 0x00000C03, 0xA101 }, /* R3075 - GPIO4 CTRL */ | ||
664 | { 0x00000C04, 0xA101 }, /* R3076 - GPIO5 CTRL */ | ||
665 | { 0x00000C0F, 0x0400 }, /* R3087 - IRQ CTRL 1 */ | ||
666 | { 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */ | ||
667 | { 0x00000C20, 0x8002 }, /* R3104 - Misc Pad Ctrl 1 */ | ||
668 | { 0x00000C21, 0x0001 }, /* R3105 - Misc Pad Ctrl 2 */ | ||
669 | { 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */ | ||
670 | { 0x00000C23, 0x0000 }, /* R3107 - Misc Pad Ctrl 4 */ | ||
671 | { 0x00000C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 5 */ | ||
672 | { 0x00000D08, 0xFFFF }, /* R3336 - Interrupt Status 1 Mask */ | ||
673 | { 0x00000D0A, 0xFFFF }, /* R3338 - Interrupt Status 3 Mask */ | ||
674 | { 0x00000D0B, 0xFFFF }, /* R3339 - Interrupt Status 4 Mask */ | ||
675 | { 0x00000D0C, 0xFEFF }, /* R3340 - Interrupt Status 5 Mask */ | ||
676 | { 0x00000D0F, 0x0000 }, /* R3343 - Interrupt Control */ | ||
677 | { 0x00000D18, 0xFFFF }, /* R3352 - IRQ2 Status 1 Mask */ | ||
678 | { 0x00000D1A, 0xFFFF }, /* R3354 - IRQ2 Status 3 Mask */ | ||
679 | { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */ | ||
680 | { 0x00000D1C, 0xFFFF }, /* R3356 - IRQ2 Status 5 Mask */ | ||
681 | { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */ | ||
682 | { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */ | ||
683 | { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */ | ||
684 | { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */ | ||
685 | { 0x00000E00, 0x0000 }, /* R3584 - FX_Ctrl1 */ | ||
686 | { 0x00000E01, 0x0000 }, /* R3585 - FX_Ctrl2 */ | ||
687 | { 0x00000E10, 0x6318 }, /* R3600 - EQ1_1 */ | ||
688 | { 0x00000E11, 0x6300 }, /* R3601 - EQ1_2 */ | ||
689 | { 0x00000E12, 0x0FC8 }, /* R3602 - EQ1_3 */ | ||
690 | { 0x00000E13, 0x03FE }, /* R3603 - EQ1_4 */ | ||
691 | { 0x00000E14, 0x00E0 }, /* R3604 - EQ1_5 */ | ||
692 | { 0x00000E15, 0x1EC4 }, /* R3605 - EQ1_6 */ | ||
693 | { 0x00000E16, 0xF136 }, /* R3606 - EQ1_7 */ | ||
694 | { 0x00000E17, 0x0409 }, /* R3607 - EQ1_8 */ | ||
695 | { 0x00000E18, 0x04CC }, /* R3608 - EQ1_9 */ | ||
696 | { 0x00000E19, 0x1C9B }, /* R3609 - EQ1_10 */ | ||
697 | { 0x00000E1A, 0xF337 }, /* R3610 - EQ1_11 */ | ||
698 | { 0x00000E1B, 0x040B }, /* R3611 - EQ1_12 */ | ||
699 | { 0x00000E1C, 0x0CBB }, /* R3612 - EQ1_13 */ | ||
700 | { 0x00000E1D, 0x16F8 }, /* R3613 - EQ1_14 */ | ||
701 | { 0x00000E1E, 0xF7D9 }, /* R3614 - EQ1_15 */ | ||
702 | { 0x00000E1F, 0x040A }, /* R3615 - EQ1_16 */ | ||
703 | { 0x00000E20, 0x1F14 }, /* R3616 - EQ1_17 */ | ||
704 | { 0x00000E21, 0x058C }, /* R3617 - EQ1_18 */ | ||
705 | { 0x00000E22, 0x0563 }, /* R3618 - EQ1_19 */ | ||
706 | { 0x00000E23, 0x4000 }, /* R3619 - EQ1_20 */ | ||
707 | { 0x00000E24, 0x0B75 }, /* R3620 - EQ1_21 */ | ||
708 | { 0x00000E26, 0x6318 }, /* R3622 - EQ2_1 */ | ||
709 | { 0x00000E27, 0x6300 }, /* R3623 - EQ2_2 */ | ||
710 | { 0x00000E28, 0x0FC8 }, /* R3624 - EQ2_3 */ | ||
711 | { 0x00000E29, 0x03FE }, /* R3625 - EQ2_4 */ | ||
712 | { 0x00000E2A, 0x00E0 }, /* R3626 - EQ2_5 */ | ||
713 | { 0x00000E2B, 0x1EC4 }, /* R3627 - EQ2_6 */ | ||
714 | { 0x00000E2C, 0xF136 }, /* R3628 - EQ2_7 */ | ||
715 | { 0x00000E2D, 0x0409 }, /* R3629 - EQ2_8 */ | ||
716 | { 0x00000E2E, 0x04CC }, /* R3630 - EQ2_9 */ | ||
717 | { 0x00000E2F, 0x1C9B }, /* R3631 - EQ2_10 */ | ||
718 | { 0x00000E30, 0xF337 }, /* R3632 - EQ2_11 */ | ||
719 | { 0x00000E31, 0x040B }, /* R3633 - EQ2_12 */ | ||
720 | { 0x00000E32, 0x0CBB }, /* R3634 - EQ2_13 */ | ||
721 | { 0x00000E33, 0x16F8 }, /* R3635 - EQ2_14 */ | ||
722 | { 0x00000E34, 0xF7D9 }, /* R3636 - EQ2_15 */ | ||
723 | { 0x00000E35, 0x040A }, /* R3637 - EQ2_16 */ | ||
724 | { 0x00000E36, 0x1F14 }, /* R3638 - EQ2_17 */ | ||
725 | { 0x00000E37, 0x058C }, /* R3639 - EQ2_18 */ | ||
726 | { 0x00000E38, 0x0563 }, /* R3640 - EQ2_19 */ | ||
727 | { 0x00000E39, 0x4000 }, /* R3641 - EQ2_20 */ | ||
728 | { 0x00000E3A, 0x0B75 }, /* R3642 - EQ2_21 */ | ||
729 | { 0x00000E3C, 0x6318 }, /* R3644 - EQ3_1 */ | ||
730 | { 0x00000E3D, 0x6300 }, /* R3645 - EQ3_2 */ | ||
731 | { 0x00000E3E, 0x0FC8 }, /* R3646 - EQ3_3 */ | ||
732 | { 0x00000E3F, 0x03FE }, /* R3647 - EQ3_4 */ | ||
733 | { 0x00000E40, 0x00E0 }, /* R3648 - EQ3_5 */ | ||
734 | { 0x00000E41, 0x1EC4 }, /* R3649 - EQ3_6 */ | ||
735 | { 0x00000E42, 0xF136 }, /* R3650 - EQ3_7 */ | ||
736 | { 0x00000E43, 0x0409 }, /* R3651 - EQ3_8 */ | ||
737 | { 0x00000E44, 0x04CC }, /* R3652 - EQ3_9 */ | ||
738 | { 0x00000E45, 0x1C9B }, /* R3653 - EQ3_10 */ | ||
739 | { 0x00000E46, 0xF337 }, /* R3654 - EQ3_11 */ | ||
740 | { 0x00000E47, 0x040B }, /* R3655 - EQ3_12 */ | ||
741 | { 0x00000E48, 0x0CBB }, /* R3656 - EQ3_13 */ | ||
742 | { 0x00000E49, 0x16F8 }, /* R3657 - EQ3_14 */ | ||
743 | { 0x00000E4A, 0xF7D9 }, /* R3658 - EQ3_15 */ | ||
744 | { 0x00000E4B, 0x040A }, /* R3659 - EQ3_16 */ | ||
745 | { 0x00000E4C, 0x1F14 }, /* R3660 - EQ3_17 */ | ||
746 | { 0x00000E4D, 0x058C }, /* R3661 - EQ3_18 */ | ||
747 | { 0x00000E4E, 0x0563 }, /* R3662 - EQ3_19 */ | ||
748 | { 0x00000E4F, 0x4000 }, /* R3663 - EQ3_20 */ | ||
749 | { 0x00000E50, 0x0B75 }, /* R3664 - EQ3_21 */ | ||
750 | { 0x00000E52, 0x6318 }, /* R3666 - EQ4_1 */ | ||
751 | { 0x00000E53, 0x6300 }, /* R3667 - EQ4_2 */ | ||
752 | { 0x00000E54, 0x0FC8 }, /* R3668 - EQ4_3 */ | ||
753 | { 0x00000E55, 0x03FE }, /* R3669 - EQ4_4 */ | ||
754 | { 0x00000E56, 0x00E0 }, /* R3670 - EQ4_5 */ | ||
755 | { 0x00000E57, 0x1EC4 }, /* R3671 - EQ4_6 */ | ||
756 | { 0x00000E58, 0xF136 }, /* R3672 - EQ4_7 */ | ||
757 | { 0x00000E59, 0x0409 }, /* R3673 - EQ4_8 */ | ||
758 | { 0x00000E5A, 0x04CC }, /* R3674 - EQ4_9 */ | ||
759 | { 0x00000E5B, 0x1C9B }, /* R3675 - EQ4_10 */ | ||
760 | { 0x00000E5C, 0xF337 }, /* R3676 - EQ4_11 */ | ||
761 | { 0x00000E5D, 0x040B }, /* R3677 - EQ4_12 */ | ||
762 | { 0x00000E5E, 0x0CBB }, /* R3678 - EQ4_13 */ | ||
763 | { 0x00000E5F, 0x16F8 }, /* R3679 - EQ4_14 */ | ||
764 | { 0x00000E60, 0xF7D9 }, /* R3680 - EQ4_15 */ | ||
765 | { 0x00000E61, 0x040A }, /* R3681 - EQ4_16 */ | ||
766 | { 0x00000E62, 0x1F14 }, /* R3682 - EQ4_17 */ | ||
767 | { 0x00000E63, 0x058C }, /* R3683 - EQ4_18 */ | ||
768 | { 0x00000E64, 0x0563 }, /* R3684 - EQ4_19 */ | ||
769 | { 0x00000E65, 0x4000 }, /* R3685 - EQ4_20 */ | ||
770 | { 0x00000E66, 0x0B75 }, /* R3686 - EQ4_21 */ | ||
771 | { 0x00000E80, 0x0018 }, /* R3712 - DRC1 ctrl1 */ | ||
772 | { 0x00000E81, 0x0933 }, /* R3713 - DRC1 ctrl2 */ | ||
773 | { 0x00000E82, 0x0018 }, /* R3714 - DRC1 ctrl3 */ | ||
774 | { 0x00000E83, 0x0000 }, /* R3715 - DRC1 ctrl4 */ | ||
775 | { 0x00000E84, 0x0000 }, /* R3716 - DRC1 ctrl5 */ | ||
776 | { 0x00000EC0, 0x0000 }, /* R3776 - HPLPF1_1 */ | ||
777 | { 0x00000EC1, 0x0000 }, /* R3777 - HPLPF1_2 */ | ||
778 | { 0x00000EC4, 0x0000 }, /* R3780 - HPLPF2_1 */ | ||
779 | { 0x00000EC5, 0x0000 }, /* R3781 - HPLPF2_2 */ | ||
780 | { 0x00000EC8, 0x0000 }, /* R3784 - HPLPF3_1 */ | ||
781 | { 0x00000EC9, 0x0000 }, /* R3785 - HPLPF3_2 */ | ||
782 | { 0x00000ECC, 0x0000 }, /* R3788 - HPLPF4_1 */ | ||
783 | { 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ | ||
784 | { 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */ | ||
785 | { 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */ | ||
786 | { 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */ | ||
787 | { 0x00000EF3, 0x0000 }, /* R3827 - ISRC 2 CTRL 1 */ | ||
788 | { 0x00000EF4, 0x0000 }, /* R3828 - ISRC 2 CTRL 2 */ | ||
789 | { 0x00000EF5, 0x0000 }, /* R3829 - ISRC 2 CTRL 3 */ | ||
790 | { 0x00001100, 0x0010 }, /* R4352 - DSP1 Control 1 */ | ||
791 | { 0x00001101, 0x0000 }, /* R4353 - DSP1 Clocking 1 */ | ||
792 | }; | ||
793 | |||
794 | static bool wm8997_readable_register(struct device *dev, unsigned int reg) | ||
795 | { | ||
796 | switch (reg) { | ||
797 | case ARIZONA_SOFTWARE_RESET: | ||
798 | case ARIZONA_DEVICE_REVISION: | ||
799 | case ARIZONA_CTRL_IF_I2C1_CFG_1: | ||
800 | case ARIZONA_WRITE_SEQUENCER_CTRL_0: | ||
801 | case ARIZONA_WRITE_SEQUENCER_CTRL_1: | ||
802 | case ARIZONA_WRITE_SEQUENCER_CTRL_2: | ||
803 | case ARIZONA_TONE_GENERATOR_1: | ||
804 | case ARIZONA_TONE_GENERATOR_2: | ||
805 | case ARIZONA_TONE_GENERATOR_3: | ||
806 | case ARIZONA_TONE_GENERATOR_4: | ||
807 | case ARIZONA_TONE_GENERATOR_5: | ||
808 | case ARIZONA_PWM_DRIVE_1: | ||
809 | case ARIZONA_PWM_DRIVE_2: | ||
810 | case ARIZONA_PWM_DRIVE_3: | ||
811 | case ARIZONA_WAKE_CONTROL: | ||
812 | case ARIZONA_SEQUENCE_CONTROL: | ||
813 | case ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_1: | ||
814 | case ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_2: | ||
815 | case ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_3: | ||
816 | case ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_4: | ||
817 | case ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_1: | ||
818 | case ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_2: | ||
819 | case ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_3: | ||
820 | case ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_4: | ||
821 | case ARIZONA_COMFORT_NOISE_GENERATOR: | ||
822 | case ARIZONA_HAPTICS_CONTROL_1: | ||
823 | case ARIZONA_HAPTICS_CONTROL_2: | ||
824 | case ARIZONA_HAPTICS_PHASE_1_INTENSITY: | ||
825 | case ARIZONA_HAPTICS_PHASE_1_DURATION: | ||
826 | case ARIZONA_HAPTICS_PHASE_2_INTENSITY: | ||
827 | case ARIZONA_HAPTICS_PHASE_2_DURATION: | ||
828 | case ARIZONA_HAPTICS_PHASE_3_INTENSITY: | ||
829 | case ARIZONA_HAPTICS_PHASE_3_DURATION: | ||
830 | case ARIZONA_HAPTICS_STATUS: | ||
831 | case ARIZONA_CLOCK_32K_1: | ||
832 | case ARIZONA_SYSTEM_CLOCK_1: | ||
833 | case ARIZONA_SAMPLE_RATE_1: | ||
834 | case ARIZONA_SAMPLE_RATE_2: | ||
835 | case ARIZONA_SAMPLE_RATE_3: | ||
836 | case ARIZONA_SAMPLE_RATE_1_STATUS: | ||
837 | case ARIZONA_SAMPLE_RATE_2_STATUS: | ||
838 | case ARIZONA_SAMPLE_RATE_3_STATUS: | ||
839 | case ARIZONA_ASYNC_CLOCK_1: | ||
840 | case ARIZONA_ASYNC_SAMPLE_RATE_1: | ||
841 | case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS: | ||
842 | case ARIZONA_OUTPUT_SYSTEM_CLOCK: | ||
843 | case ARIZONA_OUTPUT_ASYNC_CLOCK: | ||
844 | case ARIZONA_RATE_ESTIMATOR_1: | ||
845 | case ARIZONA_RATE_ESTIMATOR_2: | ||
846 | case ARIZONA_RATE_ESTIMATOR_3: | ||
847 | case ARIZONA_RATE_ESTIMATOR_4: | ||
848 | case ARIZONA_RATE_ESTIMATOR_5: | ||
849 | case ARIZONA_FLL1_CONTROL_1: | ||
850 | case ARIZONA_FLL1_CONTROL_2: | ||
851 | case ARIZONA_FLL1_CONTROL_3: | ||
852 | case ARIZONA_FLL1_CONTROL_4: | ||
853 | case ARIZONA_FLL1_CONTROL_5: | ||
854 | case ARIZONA_FLL1_CONTROL_6: | ||
855 | case ARIZONA_FLL1_LOOP_FILTER_TEST_1: | ||
856 | case ARIZONA_FLL1_NCO_TEST_0: | ||
857 | case ARIZONA_FLL1_SYNCHRONISER_1: | ||
858 | case ARIZONA_FLL1_SYNCHRONISER_2: | ||
859 | case ARIZONA_FLL1_SYNCHRONISER_3: | ||
860 | case ARIZONA_FLL1_SYNCHRONISER_4: | ||
861 | case ARIZONA_FLL1_SYNCHRONISER_5: | ||
862 | case ARIZONA_FLL1_SYNCHRONISER_6: | ||
863 | case ARIZONA_FLL1_SPREAD_SPECTRUM: | ||
864 | case ARIZONA_FLL1_GPIO_CLOCK: | ||
865 | case ARIZONA_FLL2_CONTROL_1: | ||
866 | case ARIZONA_FLL2_CONTROL_2: | ||
867 | case ARIZONA_FLL2_CONTROL_3: | ||
868 | case ARIZONA_FLL2_CONTROL_4: | ||
869 | case ARIZONA_FLL2_CONTROL_5: | ||
870 | case ARIZONA_FLL2_CONTROL_6: | ||
871 | case ARIZONA_FLL2_LOOP_FILTER_TEST_1: | ||
872 | case ARIZONA_FLL2_NCO_TEST_0: | ||
873 | case ARIZONA_FLL2_SYNCHRONISER_1: | ||
874 | case ARIZONA_FLL2_SYNCHRONISER_2: | ||
875 | case ARIZONA_FLL2_SYNCHRONISER_3: | ||
876 | case ARIZONA_FLL2_SYNCHRONISER_4: | ||
877 | case ARIZONA_FLL2_SYNCHRONISER_5: | ||
878 | case ARIZONA_FLL2_SYNCHRONISER_6: | ||
879 | case ARIZONA_FLL2_SPREAD_SPECTRUM: | ||
880 | case ARIZONA_FLL2_GPIO_CLOCK: | ||
881 | case ARIZONA_MIC_CHARGE_PUMP_1: | ||
882 | case ARIZONA_LDO1_CONTROL_1: | ||
883 | case ARIZONA_LDO2_CONTROL_1: | ||
884 | case ARIZONA_MIC_BIAS_CTRL_1: | ||
885 | case ARIZONA_MIC_BIAS_CTRL_2: | ||
886 | case ARIZONA_MIC_BIAS_CTRL_3: | ||
887 | case ARIZONA_ACCESSORY_DETECT_MODE_1: | ||
888 | case ARIZONA_HEADPHONE_DETECT_1: | ||
889 | case ARIZONA_HEADPHONE_DETECT_2: | ||
890 | case ARIZONA_MIC_DETECT_1: | ||
891 | case ARIZONA_MIC_DETECT_2: | ||
892 | case ARIZONA_MIC_DETECT_3: | ||
893 | case ARIZONA_MIC_NOISE_MIX_CONTROL_1: | ||
894 | case ARIZONA_ISOLATION_CONTROL: | ||
895 | case ARIZONA_JACK_DETECT_ANALOGUE: | ||
896 | case ARIZONA_INPUT_ENABLES: | ||
897 | case ARIZONA_INPUT_ENABLES_STATUS: | ||
898 | case ARIZONA_INPUT_RATE: | ||
899 | case ARIZONA_INPUT_VOLUME_RAMP: | ||
900 | case ARIZONA_IN1L_CONTROL: | ||
901 | case ARIZONA_ADC_DIGITAL_VOLUME_1L: | ||
902 | case ARIZONA_DMIC1L_CONTROL: | ||
903 | case ARIZONA_IN1R_CONTROL: | ||
904 | case ARIZONA_ADC_DIGITAL_VOLUME_1R: | ||
905 | case ARIZONA_DMIC1R_CONTROL: | ||
906 | case ARIZONA_IN2L_CONTROL: | ||
907 | case ARIZONA_ADC_DIGITAL_VOLUME_2L: | ||
908 | case ARIZONA_DMIC2L_CONTROL: | ||
909 | case ARIZONA_IN2R_CONTROL: | ||
910 | case ARIZONA_ADC_DIGITAL_VOLUME_2R: | ||
911 | case ARIZONA_DMIC2R_CONTROL: | ||
912 | case ARIZONA_OUTPUT_ENABLES_1: | ||
913 | case ARIZONA_OUTPUT_STATUS_1: | ||
914 | case ARIZONA_RAW_OUTPUT_STATUS_1: | ||
915 | case ARIZONA_OUTPUT_RATE_1: | ||
916 | case ARIZONA_OUTPUT_VOLUME_RAMP: | ||
917 | case ARIZONA_OUTPUT_PATH_CONFIG_1L: | ||
918 | case ARIZONA_DAC_DIGITAL_VOLUME_1L: | ||
919 | case ARIZONA_DAC_VOLUME_LIMIT_1L: | ||
920 | case ARIZONA_NOISE_GATE_SELECT_1L: | ||
921 | case ARIZONA_OUTPUT_PATH_CONFIG_1R: | ||
922 | case ARIZONA_DAC_DIGITAL_VOLUME_1R: | ||
923 | case ARIZONA_DAC_VOLUME_LIMIT_1R: | ||
924 | case ARIZONA_NOISE_GATE_SELECT_1R: | ||
925 | case ARIZONA_OUTPUT_PATH_CONFIG_3L: | ||
926 | case ARIZONA_DAC_DIGITAL_VOLUME_3L: | ||
927 | case ARIZONA_DAC_VOLUME_LIMIT_3L: | ||
928 | case ARIZONA_NOISE_GATE_SELECT_3L: | ||
929 | case ARIZONA_OUTPUT_PATH_CONFIG_4L: | ||
930 | case ARIZONA_DAC_DIGITAL_VOLUME_4L: | ||
931 | case ARIZONA_OUT_VOLUME_4L: | ||
932 | case ARIZONA_NOISE_GATE_SELECT_4L: | ||
933 | case ARIZONA_OUTPUT_PATH_CONFIG_5L: | ||
934 | case ARIZONA_DAC_DIGITAL_VOLUME_5L: | ||
935 | case ARIZONA_DAC_VOLUME_LIMIT_5L: | ||
936 | case ARIZONA_NOISE_GATE_SELECT_5L: | ||
937 | case ARIZONA_DAC_DIGITAL_VOLUME_5R: | ||
938 | case ARIZONA_DAC_VOLUME_LIMIT_5R: | ||
939 | case ARIZONA_NOISE_GATE_SELECT_5R: | ||
940 | case ARIZONA_DAC_AEC_CONTROL_1: | ||
941 | case ARIZONA_NOISE_GATE_CONTROL: | ||
942 | case ARIZONA_PDM_SPK1_CTRL_1: | ||
943 | case ARIZONA_PDM_SPK1_CTRL_2: | ||
944 | case ARIZONA_AIF1_BCLK_CTRL: | ||
945 | case ARIZONA_AIF1_TX_PIN_CTRL: | ||
946 | case ARIZONA_AIF1_RX_PIN_CTRL: | ||
947 | case ARIZONA_AIF1_RATE_CTRL: | ||
948 | case ARIZONA_AIF1_FORMAT: | ||
949 | case ARIZONA_AIF1_TX_BCLK_RATE: | ||
950 | case ARIZONA_AIF1_RX_BCLK_RATE: | ||
951 | case ARIZONA_AIF1_FRAME_CTRL_1: | ||
952 | case ARIZONA_AIF1_FRAME_CTRL_2: | ||
953 | case ARIZONA_AIF1_FRAME_CTRL_3: | ||
954 | case ARIZONA_AIF1_FRAME_CTRL_4: | ||
955 | case ARIZONA_AIF1_FRAME_CTRL_5: | ||
956 | case ARIZONA_AIF1_FRAME_CTRL_6: | ||
957 | case ARIZONA_AIF1_FRAME_CTRL_7: | ||
958 | case ARIZONA_AIF1_FRAME_CTRL_8: | ||
959 | case ARIZONA_AIF1_FRAME_CTRL_9: | ||
960 | case ARIZONA_AIF1_FRAME_CTRL_10: | ||
961 | case ARIZONA_AIF1_FRAME_CTRL_11: | ||
962 | case ARIZONA_AIF1_FRAME_CTRL_12: | ||
963 | case ARIZONA_AIF1_FRAME_CTRL_13: | ||
964 | case ARIZONA_AIF1_FRAME_CTRL_14: | ||
965 | case ARIZONA_AIF1_FRAME_CTRL_15: | ||
966 | case ARIZONA_AIF1_FRAME_CTRL_16: | ||
967 | case ARIZONA_AIF1_FRAME_CTRL_17: | ||
968 | case ARIZONA_AIF1_FRAME_CTRL_18: | ||
969 | case ARIZONA_AIF1_TX_ENABLES: | ||
970 | case ARIZONA_AIF1_RX_ENABLES: | ||
971 | case ARIZONA_AIF2_BCLK_CTRL: | ||
972 | case ARIZONA_AIF2_TX_PIN_CTRL: | ||
973 | case ARIZONA_AIF2_RX_PIN_CTRL: | ||
974 | case ARIZONA_AIF2_RATE_CTRL: | ||
975 | case ARIZONA_AIF2_FORMAT: | ||
976 | case ARIZONA_AIF2_TX_BCLK_RATE: | ||
977 | case ARIZONA_AIF2_RX_BCLK_RATE: | ||
978 | case ARIZONA_AIF2_FRAME_CTRL_1: | ||
979 | case ARIZONA_AIF2_FRAME_CTRL_2: | ||
980 | case ARIZONA_AIF2_FRAME_CTRL_3: | ||
981 | case ARIZONA_AIF2_FRAME_CTRL_4: | ||
982 | case ARIZONA_AIF2_FRAME_CTRL_11: | ||
983 | case ARIZONA_AIF2_FRAME_CTRL_12: | ||
984 | case ARIZONA_AIF2_TX_ENABLES: | ||
985 | case ARIZONA_AIF2_RX_ENABLES: | ||
986 | case ARIZONA_SLIMBUS_FRAMER_REF_GEAR: | ||
987 | case ARIZONA_SLIMBUS_RATES_1: | ||
988 | case ARIZONA_SLIMBUS_RATES_2: | ||
989 | case ARIZONA_SLIMBUS_RATES_3: | ||
990 | case ARIZONA_SLIMBUS_RATES_4: | ||
991 | case ARIZONA_SLIMBUS_RATES_5: | ||
992 | case ARIZONA_SLIMBUS_RATES_6: | ||
993 | case ARIZONA_SLIMBUS_RATES_7: | ||
994 | case ARIZONA_SLIMBUS_RATES_8: | ||
995 | case ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE: | ||
996 | case ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE: | ||
997 | case ARIZONA_SLIMBUS_RX_PORT_STATUS: | ||
998 | case ARIZONA_SLIMBUS_TX_PORT_STATUS: | ||
999 | case ARIZONA_PWM1MIX_INPUT_1_SOURCE: | ||
1000 | case ARIZONA_PWM1MIX_INPUT_1_VOLUME: | ||
1001 | case ARIZONA_PWM1MIX_INPUT_2_SOURCE: | ||
1002 | case ARIZONA_PWM1MIX_INPUT_2_VOLUME: | ||
1003 | case ARIZONA_PWM1MIX_INPUT_3_SOURCE: | ||
1004 | case ARIZONA_PWM1MIX_INPUT_3_VOLUME: | ||
1005 | case ARIZONA_PWM1MIX_INPUT_4_SOURCE: | ||
1006 | case ARIZONA_PWM1MIX_INPUT_4_VOLUME: | ||
1007 | case ARIZONA_PWM2MIX_INPUT_1_SOURCE: | ||
1008 | case ARIZONA_PWM2MIX_INPUT_1_VOLUME: | ||
1009 | case ARIZONA_PWM2MIX_INPUT_2_SOURCE: | ||
1010 | case ARIZONA_PWM2MIX_INPUT_2_VOLUME: | ||
1011 | case ARIZONA_PWM2MIX_INPUT_3_SOURCE: | ||
1012 | case ARIZONA_PWM2MIX_INPUT_3_VOLUME: | ||
1013 | case ARIZONA_PWM2MIX_INPUT_4_SOURCE: | ||
1014 | case ARIZONA_PWM2MIX_INPUT_4_VOLUME: | ||
1015 | case ARIZONA_MICMIX_INPUT_1_SOURCE: | ||
1016 | case ARIZONA_MICMIX_INPUT_1_VOLUME: | ||
1017 | case ARIZONA_MICMIX_INPUT_2_SOURCE: | ||
1018 | case ARIZONA_MICMIX_INPUT_2_VOLUME: | ||
1019 | case ARIZONA_MICMIX_INPUT_3_SOURCE: | ||
1020 | case ARIZONA_MICMIX_INPUT_3_VOLUME: | ||
1021 | case ARIZONA_MICMIX_INPUT_4_SOURCE: | ||
1022 | case ARIZONA_MICMIX_INPUT_4_VOLUME: | ||
1023 | case ARIZONA_NOISEMIX_INPUT_1_SOURCE: | ||
1024 | case ARIZONA_NOISEMIX_INPUT_1_VOLUME: | ||
1025 | case ARIZONA_NOISEMIX_INPUT_2_SOURCE: | ||
1026 | case ARIZONA_NOISEMIX_INPUT_2_VOLUME: | ||
1027 | case ARIZONA_NOISEMIX_INPUT_3_SOURCE: | ||
1028 | case ARIZONA_NOISEMIX_INPUT_3_VOLUME: | ||
1029 | case ARIZONA_NOISEMIX_INPUT_4_SOURCE: | ||
1030 | case ARIZONA_NOISEMIX_INPUT_4_VOLUME: | ||
1031 | case ARIZONA_OUT1LMIX_INPUT_1_SOURCE: | ||
1032 | case ARIZONA_OUT1LMIX_INPUT_1_VOLUME: | ||
1033 | case ARIZONA_OUT1LMIX_INPUT_2_SOURCE: | ||
1034 | case ARIZONA_OUT1LMIX_INPUT_2_VOLUME: | ||
1035 | case ARIZONA_OUT1LMIX_INPUT_3_SOURCE: | ||
1036 | case ARIZONA_OUT1LMIX_INPUT_3_VOLUME: | ||
1037 | case ARIZONA_OUT1LMIX_INPUT_4_SOURCE: | ||
1038 | case ARIZONA_OUT1LMIX_INPUT_4_VOLUME: | ||
1039 | case ARIZONA_OUT1RMIX_INPUT_1_SOURCE: | ||
1040 | case ARIZONA_OUT1RMIX_INPUT_1_VOLUME: | ||
1041 | case ARIZONA_OUT1RMIX_INPUT_2_SOURCE: | ||
1042 | case ARIZONA_OUT1RMIX_INPUT_2_VOLUME: | ||
1043 | case ARIZONA_OUT1RMIX_INPUT_3_SOURCE: | ||
1044 | case ARIZONA_OUT1RMIX_INPUT_3_VOLUME: | ||
1045 | case ARIZONA_OUT1RMIX_INPUT_4_SOURCE: | ||
1046 | case ARIZONA_OUT1RMIX_INPUT_4_VOLUME: | ||
1047 | case ARIZONA_OUT3LMIX_INPUT_1_SOURCE: | ||
1048 | case ARIZONA_OUT3LMIX_INPUT_1_VOLUME: | ||
1049 | case ARIZONA_OUT3LMIX_INPUT_2_SOURCE: | ||
1050 | case ARIZONA_OUT3LMIX_INPUT_2_VOLUME: | ||
1051 | case ARIZONA_OUT3LMIX_INPUT_3_SOURCE: | ||
1052 | case ARIZONA_OUT3LMIX_INPUT_3_VOLUME: | ||
1053 | case ARIZONA_OUT3LMIX_INPUT_4_SOURCE: | ||
1054 | case ARIZONA_OUT3LMIX_INPUT_4_VOLUME: | ||
1055 | case ARIZONA_OUT4LMIX_INPUT_1_SOURCE: | ||
1056 | case ARIZONA_OUT4LMIX_INPUT_1_VOLUME: | ||
1057 | case ARIZONA_OUT4LMIX_INPUT_2_SOURCE: | ||
1058 | case ARIZONA_OUT4LMIX_INPUT_2_VOLUME: | ||
1059 | case ARIZONA_OUT4LMIX_INPUT_3_SOURCE: | ||
1060 | case ARIZONA_OUT4LMIX_INPUT_3_VOLUME: | ||
1061 | case ARIZONA_OUT4LMIX_INPUT_4_SOURCE: | ||
1062 | case ARIZONA_OUT4LMIX_INPUT_4_VOLUME: | ||
1063 | case ARIZONA_OUT5LMIX_INPUT_1_SOURCE: | ||
1064 | case ARIZONA_OUT5LMIX_INPUT_1_VOLUME: | ||
1065 | case ARIZONA_OUT5LMIX_INPUT_2_SOURCE: | ||
1066 | case ARIZONA_OUT5LMIX_INPUT_2_VOLUME: | ||
1067 | case ARIZONA_OUT5LMIX_INPUT_3_SOURCE: | ||
1068 | case ARIZONA_OUT5LMIX_INPUT_3_VOLUME: | ||
1069 | case ARIZONA_OUT5LMIX_INPUT_4_SOURCE: | ||
1070 | case ARIZONA_OUT5LMIX_INPUT_4_VOLUME: | ||
1071 | case ARIZONA_OUT5RMIX_INPUT_1_SOURCE: | ||
1072 | case ARIZONA_OUT5RMIX_INPUT_1_VOLUME: | ||
1073 | case ARIZONA_OUT5RMIX_INPUT_2_SOURCE: | ||
1074 | case ARIZONA_OUT5RMIX_INPUT_2_VOLUME: | ||
1075 | case ARIZONA_OUT5RMIX_INPUT_3_SOURCE: | ||
1076 | case ARIZONA_OUT5RMIX_INPUT_3_VOLUME: | ||
1077 | case ARIZONA_OUT5RMIX_INPUT_4_SOURCE: | ||
1078 | case ARIZONA_OUT5RMIX_INPUT_4_VOLUME: | ||
1079 | case ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE: | ||
1080 | case ARIZONA_AIF1TX1MIX_INPUT_1_VOLUME: | ||
1081 | case ARIZONA_AIF1TX1MIX_INPUT_2_SOURCE: | ||
1082 | case ARIZONA_AIF1TX1MIX_INPUT_2_VOLUME: | ||
1083 | case ARIZONA_AIF1TX1MIX_INPUT_3_SOURCE: | ||
1084 | case ARIZONA_AIF1TX1MIX_INPUT_3_VOLUME: | ||
1085 | case ARIZONA_AIF1TX1MIX_INPUT_4_SOURCE: | ||
1086 | case ARIZONA_AIF1TX1MIX_INPUT_4_VOLUME: | ||
1087 | case ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE: | ||
1088 | case ARIZONA_AIF1TX2MIX_INPUT_1_VOLUME: | ||
1089 | case ARIZONA_AIF1TX2MIX_INPUT_2_SOURCE: | ||
1090 | case ARIZONA_AIF1TX2MIX_INPUT_2_VOLUME: | ||
1091 | case ARIZONA_AIF1TX2MIX_INPUT_3_SOURCE: | ||
1092 | case ARIZONA_AIF1TX2MIX_INPUT_3_VOLUME: | ||
1093 | case ARIZONA_AIF1TX2MIX_INPUT_4_SOURCE: | ||
1094 | case ARIZONA_AIF1TX2MIX_INPUT_4_VOLUME: | ||
1095 | case ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE: | ||
1096 | case ARIZONA_AIF1TX3MIX_INPUT_1_VOLUME: | ||
1097 | case ARIZONA_AIF1TX3MIX_INPUT_2_SOURCE: | ||
1098 | case ARIZONA_AIF1TX3MIX_INPUT_2_VOLUME: | ||
1099 | case ARIZONA_AIF1TX3MIX_INPUT_3_SOURCE: | ||
1100 | case ARIZONA_AIF1TX3MIX_INPUT_3_VOLUME: | ||
1101 | case ARIZONA_AIF1TX3MIX_INPUT_4_SOURCE: | ||
1102 | case ARIZONA_AIF1TX3MIX_INPUT_4_VOLUME: | ||
1103 | case ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE: | ||
1104 | case ARIZONA_AIF1TX4MIX_INPUT_1_VOLUME: | ||
1105 | case ARIZONA_AIF1TX4MIX_INPUT_2_SOURCE: | ||
1106 | case ARIZONA_AIF1TX4MIX_INPUT_2_VOLUME: | ||
1107 | case ARIZONA_AIF1TX4MIX_INPUT_3_SOURCE: | ||
1108 | case ARIZONA_AIF1TX4MIX_INPUT_3_VOLUME: | ||
1109 | case ARIZONA_AIF1TX4MIX_INPUT_4_SOURCE: | ||
1110 | case ARIZONA_AIF1TX4MIX_INPUT_4_VOLUME: | ||
1111 | case ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE: | ||
1112 | case ARIZONA_AIF1TX5MIX_INPUT_1_VOLUME: | ||
1113 | case ARIZONA_AIF1TX5MIX_INPUT_2_SOURCE: | ||
1114 | case ARIZONA_AIF1TX5MIX_INPUT_2_VOLUME: | ||
1115 | case ARIZONA_AIF1TX5MIX_INPUT_3_SOURCE: | ||
1116 | case ARIZONA_AIF1TX5MIX_INPUT_3_VOLUME: | ||
1117 | case ARIZONA_AIF1TX5MIX_INPUT_4_SOURCE: | ||
1118 | case ARIZONA_AIF1TX5MIX_INPUT_4_VOLUME: | ||
1119 | case ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE: | ||
1120 | case ARIZONA_AIF1TX6MIX_INPUT_1_VOLUME: | ||
1121 | case ARIZONA_AIF1TX6MIX_INPUT_2_SOURCE: | ||
1122 | case ARIZONA_AIF1TX6MIX_INPUT_2_VOLUME: | ||
1123 | case ARIZONA_AIF1TX6MIX_INPUT_3_SOURCE: | ||
1124 | case ARIZONA_AIF1TX6MIX_INPUT_3_VOLUME: | ||
1125 | case ARIZONA_AIF1TX6MIX_INPUT_4_SOURCE: | ||
1126 | case ARIZONA_AIF1TX6MIX_INPUT_4_VOLUME: | ||
1127 | case ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE: | ||
1128 | case ARIZONA_AIF1TX7MIX_INPUT_1_VOLUME: | ||
1129 | case ARIZONA_AIF1TX7MIX_INPUT_2_SOURCE: | ||
1130 | case ARIZONA_AIF1TX7MIX_INPUT_2_VOLUME: | ||
1131 | case ARIZONA_AIF1TX7MIX_INPUT_3_SOURCE: | ||
1132 | case ARIZONA_AIF1TX7MIX_INPUT_3_VOLUME: | ||
1133 | case ARIZONA_AIF1TX7MIX_INPUT_4_SOURCE: | ||
1134 | case ARIZONA_AIF1TX7MIX_INPUT_4_VOLUME: | ||
1135 | case ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE: | ||
1136 | case ARIZONA_AIF1TX8MIX_INPUT_1_VOLUME: | ||
1137 | case ARIZONA_AIF1TX8MIX_INPUT_2_SOURCE: | ||
1138 | case ARIZONA_AIF1TX8MIX_INPUT_2_VOLUME: | ||
1139 | case ARIZONA_AIF1TX8MIX_INPUT_3_SOURCE: | ||
1140 | case ARIZONA_AIF1TX8MIX_INPUT_3_VOLUME: | ||
1141 | case ARIZONA_AIF1TX8MIX_INPUT_4_SOURCE: | ||
1142 | case ARIZONA_AIF1TX8MIX_INPUT_4_VOLUME: | ||
1143 | case ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE: | ||
1144 | case ARIZONA_AIF2TX1MIX_INPUT_1_VOLUME: | ||
1145 | case ARIZONA_AIF2TX1MIX_INPUT_2_SOURCE: | ||
1146 | case ARIZONA_AIF2TX1MIX_INPUT_2_VOLUME: | ||
1147 | case ARIZONA_AIF2TX1MIX_INPUT_3_SOURCE: | ||
1148 | case ARIZONA_AIF2TX1MIX_INPUT_3_VOLUME: | ||
1149 | case ARIZONA_AIF2TX1MIX_INPUT_4_SOURCE: | ||
1150 | case ARIZONA_AIF2TX1MIX_INPUT_4_VOLUME: | ||
1151 | case ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE: | ||
1152 | case ARIZONA_AIF2TX2MIX_INPUT_1_VOLUME: | ||
1153 | case ARIZONA_AIF2TX2MIX_INPUT_2_SOURCE: | ||
1154 | case ARIZONA_AIF2TX2MIX_INPUT_2_VOLUME: | ||
1155 | case ARIZONA_AIF2TX2MIX_INPUT_3_SOURCE: | ||
1156 | case ARIZONA_AIF2TX2MIX_INPUT_3_VOLUME: | ||
1157 | case ARIZONA_AIF2TX2MIX_INPUT_4_SOURCE: | ||
1158 | case ARIZONA_AIF2TX2MIX_INPUT_4_VOLUME: | ||
1159 | case ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE: | ||
1160 | case ARIZONA_SLIMTX1MIX_INPUT_1_VOLUME: | ||
1161 | case ARIZONA_SLIMTX1MIX_INPUT_2_SOURCE: | ||
1162 | case ARIZONA_SLIMTX1MIX_INPUT_2_VOLUME: | ||
1163 | case ARIZONA_SLIMTX1MIX_INPUT_3_SOURCE: | ||
1164 | case ARIZONA_SLIMTX1MIX_INPUT_3_VOLUME: | ||
1165 | case ARIZONA_SLIMTX1MIX_INPUT_4_SOURCE: | ||
1166 | case ARIZONA_SLIMTX1MIX_INPUT_4_VOLUME: | ||
1167 | case ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE: | ||
1168 | case ARIZONA_SLIMTX2MIX_INPUT_1_VOLUME: | ||
1169 | case ARIZONA_SLIMTX2MIX_INPUT_2_SOURCE: | ||
1170 | case ARIZONA_SLIMTX2MIX_INPUT_2_VOLUME: | ||
1171 | case ARIZONA_SLIMTX2MIX_INPUT_3_SOURCE: | ||
1172 | case ARIZONA_SLIMTX2MIX_INPUT_3_VOLUME: | ||
1173 | case ARIZONA_SLIMTX2MIX_INPUT_4_SOURCE: | ||
1174 | case ARIZONA_SLIMTX2MIX_INPUT_4_VOLUME: | ||
1175 | case ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE: | ||
1176 | case ARIZONA_SLIMTX3MIX_INPUT_1_VOLUME: | ||
1177 | case ARIZONA_SLIMTX3MIX_INPUT_2_SOURCE: | ||
1178 | case ARIZONA_SLIMTX3MIX_INPUT_2_VOLUME: | ||
1179 | case ARIZONA_SLIMTX3MIX_INPUT_3_SOURCE: | ||
1180 | case ARIZONA_SLIMTX3MIX_INPUT_3_VOLUME: | ||
1181 | case ARIZONA_SLIMTX3MIX_INPUT_4_SOURCE: | ||
1182 | case ARIZONA_SLIMTX3MIX_INPUT_4_VOLUME: | ||
1183 | case ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE: | ||
1184 | case ARIZONA_SLIMTX4MIX_INPUT_1_VOLUME: | ||
1185 | case ARIZONA_SLIMTX4MIX_INPUT_2_SOURCE: | ||
1186 | case ARIZONA_SLIMTX4MIX_INPUT_2_VOLUME: | ||
1187 | case ARIZONA_SLIMTX4MIX_INPUT_3_SOURCE: | ||
1188 | case ARIZONA_SLIMTX4MIX_INPUT_3_VOLUME: | ||
1189 | case ARIZONA_SLIMTX4MIX_INPUT_4_SOURCE: | ||
1190 | case ARIZONA_SLIMTX4MIX_INPUT_4_VOLUME: | ||
1191 | case ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE: | ||
1192 | case ARIZONA_SLIMTX5MIX_INPUT_1_VOLUME: | ||
1193 | case ARIZONA_SLIMTX5MIX_INPUT_2_SOURCE: | ||
1194 | case ARIZONA_SLIMTX5MIX_INPUT_2_VOLUME: | ||
1195 | case ARIZONA_SLIMTX5MIX_INPUT_3_SOURCE: | ||
1196 | case ARIZONA_SLIMTX5MIX_INPUT_3_VOLUME: | ||
1197 | case ARIZONA_SLIMTX5MIX_INPUT_4_SOURCE: | ||
1198 | case ARIZONA_SLIMTX5MIX_INPUT_4_VOLUME: | ||
1199 | case ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE: | ||
1200 | case ARIZONA_SLIMTX6MIX_INPUT_1_VOLUME: | ||
1201 | case ARIZONA_SLIMTX6MIX_INPUT_2_SOURCE: | ||
1202 | case ARIZONA_SLIMTX6MIX_INPUT_2_VOLUME: | ||
1203 | case ARIZONA_SLIMTX6MIX_INPUT_3_SOURCE: | ||
1204 | case ARIZONA_SLIMTX6MIX_INPUT_3_VOLUME: | ||
1205 | case ARIZONA_SLIMTX6MIX_INPUT_4_SOURCE: | ||
1206 | case ARIZONA_SLIMTX6MIX_INPUT_4_VOLUME: | ||
1207 | case ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE: | ||
1208 | case ARIZONA_SLIMTX7MIX_INPUT_1_VOLUME: | ||
1209 | case ARIZONA_SLIMTX7MIX_INPUT_2_SOURCE: | ||
1210 | case ARIZONA_SLIMTX7MIX_INPUT_2_VOLUME: | ||
1211 | case ARIZONA_SLIMTX7MIX_INPUT_3_SOURCE: | ||
1212 | case ARIZONA_SLIMTX7MIX_INPUT_3_VOLUME: | ||
1213 | case ARIZONA_SLIMTX7MIX_INPUT_4_SOURCE: | ||
1214 | case ARIZONA_SLIMTX7MIX_INPUT_4_VOLUME: | ||
1215 | case ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE: | ||
1216 | case ARIZONA_SLIMTX8MIX_INPUT_1_VOLUME: | ||
1217 | case ARIZONA_SLIMTX8MIX_INPUT_2_SOURCE: | ||
1218 | case ARIZONA_SLIMTX8MIX_INPUT_2_VOLUME: | ||
1219 | case ARIZONA_SLIMTX8MIX_INPUT_3_SOURCE: | ||
1220 | case ARIZONA_SLIMTX8MIX_INPUT_3_VOLUME: | ||
1221 | case ARIZONA_SLIMTX8MIX_INPUT_4_SOURCE: | ||
1222 | case ARIZONA_SLIMTX8MIX_INPUT_4_VOLUME: | ||
1223 | case ARIZONA_EQ1MIX_INPUT_1_SOURCE: | ||
1224 | case ARIZONA_EQ1MIX_INPUT_1_VOLUME: | ||
1225 | case ARIZONA_EQ1MIX_INPUT_2_SOURCE: | ||
1226 | case ARIZONA_EQ1MIX_INPUT_2_VOLUME: | ||
1227 | case ARIZONA_EQ1MIX_INPUT_3_SOURCE: | ||
1228 | case ARIZONA_EQ1MIX_INPUT_3_VOLUME: | ||
1229 | case ARIZONA_EQ1MIX_INPUT_4_SOURCE: | ||
1230 | case ARIZONA_EQ1MIX_INPUT_4_VOLUME: | ||
1231 | case ARIZONA_EQ2MIX_INPUT_1_SOURCE: | ||
1232 | case ARIZONA_EQ2MIX_INPUT_1_VOLUME: | ||
1233 | case ARIZONA_EQ2MIX_INPUT_2_SOURCE: | ||
1234 | case ARIZONA_EQ2MIX_INPUT_2_VOLUME: | ||
1235 | case ARIZONA_EQ2MIX_INPUT_3_SOURCE: | ||
1236 | case ARIZONA_EQ2MIX_INPUT_3_VOLUME: | ||
1237 | case ARIZONA_EQ2MIX_INPUT_4_SOURCE: | ||
1238 | case ARIZONA_EQ2MIX_INPUT_4_VOLUME: | ||
1239 | case ARIZONA_EQ3MIX_INPUT_1_SOURCE: | ||
1240 | case ARIZONA_EQ3MIX_INPUT_1_VOLUME: | ||
1241 | case ARIZONA_EQ3MIX_INPUT_2_SOURCE: | ||
1242 | case ARIZONA_EQ3MIX_INPUT_2_VOLUME: | ||
1243 | case ARIZONA_EQ3MIX_INPUT_3_SOURCE: | ||
1244 | case ARIZONA_EQ3MIX_INPUT_3_VOLUME: | ||
1245 | case ARIZONA_EQ3MIX_INPUT_4_SOURCE: | ||
1246 | case ARIZONA_EQ3MIX_INPUT_4_VOLUME: | ||
1247 | case ARIZONA_EQ4MIX_INPUT_1_SOURCE: | ||
1248 | case ARIZONA_EQ4MIX_INPUT_1_VOLUME: | ||
1249 | case ARIZONA_EQ4MIX_INPUT_2_SOURCE: | ||
1250 | case ARIZONA_EQ4MIX_INPUT_2_VOLUME: | ||
1251 | case ARIZONA_EQ4MIX_INPUT_3_SOURCE: | ||
1252 | case ARIZONA_EQ4MIX_INPUT_3_VOLUME: | ||
1253 | case ARIZONA_EQ4MIX_INPUT_4_SOURCE: | ||
1254 | case ARIZONA_EQ4MIX_INPUT_4_VOLUME: | ||
1255 | case ARIZONA_DRC1LMIX_INPUT_1_SOURCE: | ||
1256 | case ARIZONA_DRC1LMIX_INPUT_1_VOLUME: | ||
1257 | case ARIZONA_DRC1LMIX_INPUT_2_SOURCE: | ||
1258 | case ARIZONA_DRC1LMIX_INPUT_2_VOLUME: | ||
1259 | case ARIZONA_DRC1LMIX_INPUT_3_SOURCE: | ||
1260 | case ARIZONA_DRC1LMIX_INPUT_3_VOLUME: | ||
1261 | case ARIZONA_DRC1LMIX_INPUT_4_SOURCE: | ||
1262 | case ARIZONA_DRC1LMIX_INPUT_4_VOLUME: | ||
1263 | case ARIZONA_DRC1RMIX_INPUT_1_SOURCE: | ||
1264 | case ARIZONA_DRC1RMIX_INPUT_1_VOLUME: | ||
1265 | case ARIZONA_DRC1RMIX_INPUT_2_SOURCE: | ||
1266 | case ARIZONA_DRC1RMIX_INPUT_2_VOLUME: | ||
1267 | case ARIZONA_DRC1RMIX_INPUT_3_SOURCE: | ||
1268 | case ARIZONA_DRC1RMIX_INPUT_3_VOLUME: | ||
1269 | case ARIZONA_DRC1RMIX_INPUT_4_SOURCE: | ||
1270 | case ARIZONA_DRC1RMIX_INPUT_4_VOLUME: | ||
1271 | case ARIZONA_HPLP1MIX_INPUT_1_SOURCE: | ||
1272 | case ARIZONA_HPLP1MIX_INPUT_1_VOLUME: | ||
1273 | case ARIZONA_HPLP1MIX_INPUT_2_SOURCE: | ||
1274 | case ARIZONA_HPLP1MIX_INPUT_2_VOLUME: | ||
1275 | case ARIZONA_HPLP1MIX_INPUT_3_SOURCE: | ||
1276 | case ARIZONA_HPLP1MIX_INPUT_3_VOLUME: | ||
1277 | case ARIZONA_HPLP1MIX_INPUT_4_SOURCE: | ||
1278 | case ARIZONA_HPLP1MIX_INPUT_4_VOLUME: | ||
1279 | case ARIZONA_HPLP2MIX_INPUT_1_SOURCE: | ||
1280 | case ARIZONA_HPLP2MIX_INPUT_1_VOLUME: | ||
1281 | case ARIZONA_HPLP2MIX_INPUT_2_SOURCE: | ||
1282 | case ARIZONA_HPLP2MIX_INPUT_2_VOLUME: | ||
1283 | case ARIZONA_HPLP2MIX_INPUT_3_SOURCE: | ||
1284 | case ARIZONA_HPLP2MIX_INPUT_3_VOLUME: | ||
1285 | case ARIZONA_HPLP2MIX_INPUT_4_SOURCE: | ||
1286 | case ARIZONA_HPLP2MIX_INPUT_4_VOLUME: | ||
1287 | case ARIZONA_HPLP3MIX_INPUT_1_SOURCE: | ||
1288 | case ARIZONA_HPLP3MIX_INPUT_1_VOLUME: | ||
1289 | case ARIZONA_HPLP3MIX_INPUT_2_SOURCE: | ||
1290 | case ARIZONA_HPLP3MIX_INPUT_2_VOLUME: | ||
1291 | case ARIZONA_HPLP3MIX_INPUT_3_SOURCE: | ||
1292 | case ARIZONA_HPLP3MIX_INPUT_3_VOLUME: | ||
1293 | case ARIZONA_HPLP3MIX_INPUT_4_SOURCE: | ||
1294 | case ARIZONA_HPLP3MIX_INPUT_4_VOLUME: | ||
1295 | case ARIZONA_HPLP4MIX_INPUT_1_SOURCE: | ||
1296 | case ARIZONA_HPLP4MIX_INPUT_1_VOLUME: | ||
1297 | case ARIZONA_HPLP4MIX_INPUT_2_SOURCE: | ||
1298 | case ARIZONA_HPLP4MIX_INPUT_2_VOLUME: | ||
1299 | case ARIZONA_HPLP4MIX_INPUT_3_SOURCE: | ||
1300 | case ARIZONA_HPLP4MIX_INPUT_3_VOLUME: | ||
1301 | case ARIZONA_HPLP4MIX_INPUT_4_SOURCE: | ||
1302 | case ARIZONA_HPLP4MIX_INPUT_4_VOLUME: | ||
1303 | case ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE: | ||
1304 | case ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE: | ||
1305 | case ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE: | ||
1306 | case ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE: | ||
1307 | case ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE: | ||
1308 | case ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE: | ||
1309 | case ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE: | ||
1310 | case ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE: | ||
1311 | case ARIZONA_GPIO1_CTRL: | ||
1312 | case ARIZONA_GPIO2_CTRL: | ||
1313 | case ARIZONA_GPIO3_CTRL: | ||
1314 | case ARIZONA_GPIO4_CTRL: | ||
1315 | case ARIZONA_GPIO5_CTRL: | ||
1316 | case ARIZONA_IRQ_CTRL_1: | ||
1317 | case ARIZONA_GPIO_DEBOUNCE_CONFIG: | ||
1318 | case ARIZONA_MISC_PAD_CTRL_1: | ||
1319 | case ARIZONA_MISC_PAD_CTRL_2: | ||
1320 | case ARIZONA_MISC_PAD_CTRL_3: | ||
1321 | case ARIZONA_MISC_PAD_CTRL_4: | ||
1322 | case ARIZONA_MISC_PAD_CTRL_5: | ||
1323 | case ARIZONA_INTERRUPT_STATUS_1: | ||
1324 | case ARIZONA_INTERRUPT_STATUS_2: | ||
1325 | case ARIZONA_INTERRUPT_STATUS_3: | ||
1326 | case ARIZONA_INTERRUPT_STATUS_4: | ||
1327 | case ARIZONA_INTERRUPT_STATUS_5: | ||
1328 | case ARIZONA_INTERRUPT_STATUS_1_MASK: | ||
1329 | case ARIZONA_INTERRUPT_STATUS_3_MASK: | ||
1330 | case ARIZONA_INTERRUPT_STATUS_4_MASK: | ||
1331 | case ARIZONA_INTERRUPT_STATUS_5_MASK: | ||
1332 | case ARIZONA_INTERRUPT_CONTROL: | ||
1333 | case ARIZONA_IRQ2_STATUS_1: | ||
1334 | case ARIZONA_IRQ2_STATUS_3: | ||
1335 | case ARIZONA_IRQ2_STATUS_4: | ||
1336 | case ARIZONA_IRQ2_STATUS_5: | ||
1337 | case ARIZONA_IRQ2_STATUS_1_MASK: | ||
1338 | case ARIZONA_IRQ2_STATUS_3_MASK: | ||
1339 | case ARIZONA_IRQ2_STATUS_4_MASK: | ||
1340 | case ARIZONA_IRQ2_STATUS_5_MASK: | ||
1341 | case ARIZONA_IRQ2_CONTROL: | ||
1342 | case ARIZONA_INTERRUPT_RAW_STATUS_3: | ||
1343 | case ARIZONA_INTERRUPT_RAW_STATUS_4: | ||
1344 | case ARIZONA_INTERRUPT_RAW_STATUS_5: | ||
1345 | case ARIZONA_INTERRUPT_RAW_STATUS_6: | ||
1346 | case ARIZONA_INTERRUPT_RAW_STATUS_7: | ||
1347 | case ARIZONA_INTERRUPT_RAW_STATUS_8: | ||
1348 | case ARIZONA_IRQ_PIN_STATUS: | ||
1349 | case ARIZONA_AOD_WKUP_AND_TRIG: | ||
1350 | case ARIZONA_AOD_IRQ1: | ||
1351 | case ARIZONA_AOD_IRQ2: | ||
1352 | case ARIZONA_AOD_IRQ_MASK_IRQ1: | ||
1353 | case ARIZONA_AOD_IRQ_MASK_IRQ2: | ||
1354 | case ARIZONA_AOD_IRQ_RAW_STATUS: | ||
1355 | case ARIZONA_JACK_DETECT_DEBOUNCE: | ||
1356 | case ARIZONA_FX_CTRL1: | ||
1357 | case ARIZONA_FX_CTRL2: | ||
1358 | case ARIZONA_EQ1_1: | ||
1359 | case ARIZONA_EQ1_2: | ||
1360 | case ARIZONA_EQ1_3: | ||
1361 | case ARIZONA_EQ1_4: | ||
1362 | case ARIZONA_EQ1_5: | ||
1363 | case ARIZONA_EQ1_6: | ||
1364 | case ARIZONA_EQ1_7: | ||
1365 | case ARIZONA_EQ1_8: | ||
1366 | case ARIZONA_EQ1_9: | ||
1367 | case ARIZONA_EQ1_10: | ||
1368 | case ARIZONA_EQ1_11: | ||
1369 | case ARIZONA_EQ1_12: | ||
1370 | case ARIZONA_EQ1_13: | ||
1371 | case ARIZONA_EQ1_14: | ||
1372 | case ARIZONA_EQ1_15: | ||
1373 | case ARIZONA_EQ1_16: | ||
1374 | case ARIZONA_EQ1_17: | ||
1375 | case ARIZONA_EQ1_18: | ||
1376 | case ARIZONA_EQ1_19: | ||
1377 | case ARIZONA_EQ1_20: | ||
1378 | case ARIZONA_EQ1_21: | ||
1379 | case ARIZONA_EQ2_1: | ||
1380 | case ARIZONA_EQ2_2: | ||
1381 | case ARIZONA_EQ2_3: | ||
1382 | case ARIZONA_EQ2_4: | ||
1383 | case ARIZONA_EQ2_5: | ||
1384 | case ARIZONA_EQ2_6: | ||
1385 | case ARIZONA_EQ2_7: | ||
1386 | case ARIZONA_EQ2_8: | ||
1387 | case ARIZONA_EQ2_9: | ||
1388 | case ARIZONA_EQ2_10: | ||
1389 | case ARIZONA_EQ2_11: | ||
1390 | case ARIZONA_EQ2_12: | ||
1391 | case ARIZONA_EQ2_13: | ||
1392 | case ARIZONA_EQ2_14: | ||
1393 | case ARIZONA_EQ2_15: | ||
1394 | case ARIZONA_EQ2_16: | ||
1395 | case ARIZONA_EQ2_17: | ||
1396 | case ARIZONA_EQ2_18: | ||
1397 | case ARIZONA_EQ2_19: | ||
1398 | case ARIZONA_EQ2_20: | ||
1399 | case ARIZONA_EQ2_21: | ||
1400 | case ARIZONA_EQ3_1: | ||
1401 | case ARIZONA_EQ3_2: | ||
1402 | case ARIZONA_EQ3_3: | ||
1403 | case ARIZONA_EQ3_4: | ||
1404 | case ARIZONA_EQ3_5: | ||
1405 | case ARIZONA_EQ3_6: | ||
1406 | case ARIZONA_EQ3_7: | ||
1407 | case ARIZONA_EQ3_8: | ||
1408 | case ARIZONA_EQ3_9: | ||
1409 | case ARIZONA_EQ3_10: | ||
1410 | case ARIZONA_EQ3_11: | ||
1411 | case ARIZONA_EQ3_12: | ||
1412 | case ARIZONA_EQ3_13: | ||
1413 | case ARIZONA_EQ3_14: | ||
1414 | case ARIZONA_EQ3_15: | ||
1415 | case ARIZONA_EQ3_16: | ||
1416 | case ARIZONA_EQ3_17: | ||
1417 | case ARIZONA_EQ3_18: | ||
1418 | case ARIZONA_EQ3_19: | ||
1419 | case ARIZONA_EQ3_20: | ||
1420 | case ARIZONA_EQ3_21: | ||
1421 | case ARIZONA_EQ4_1: | ||
1422 | case ARIZONA_EQ4_2: | ||
1423 | case ARIZONA_EQ4_3: | ||
1424 | case ARIZONA_EQ4_4: | ||
1425 | case ARIZONA_EQ4_5: | ||
1426 | case ARIZONA_EQ4_6: | ||
1427 | case ARIZONA_EQ4_7: | ||
1428 | case ARIZONA_EQ4_8: | ||
1429 | case ARIZONA_EQ4_9: | ||
1430 | case ARIZONA_EQ4_10: | ||
1431 | case ARIZONA_EQ4_11: | ||
1432 | case ARIZONA_EQ4_12: | ||
1433 | case ARIZONA_EQ4_13: | ||
1434 | case ARIZONA_EQ4_14: | ||
1435 | case ARIZONA_EQ4_15: | ||
1436 | case ARIZONA_EQ4_16: | ||
1437 | case ARIZONA_EQ4_17: | ||
1438 | case ARIZONA_EQ4_18: | ||
1439 | case ARIZONA_EQ4_19: | ||
1440 | case ARIZONA_EQ4_20: | ||
1441 | case ARIZONA_EQ4_21: | ||
1442 | case ARIZONA_DRC1_CTRL1: | ||
1443 | case ARIZONA_DRC1_CTRL2: | ||
1444 | case ARIZONA_DRC1_CTRL3: | ||
1445 | case ARIZONA_DRC1_CTRL4: | ||
1446 | case ARIZONA_DRC1_CTRL5: | ||
1447 | case ARIZONA_HPLPF1_1: | ||
1448 | case ARIZONA_HPLPF1_2: | ||
1449 | case ARIZONA_HPLPF2_1: | ||
1450 | case ARIZONA_HPLPF2_2: | ||
1451 | case ARIZONA_HPLPF3_1: | ||
1452 | case ARIZONA_HPLPF3_2: | ||
1453 | case ARIZONA_HPLPF4_1: | ||
1454 | case ARIZONA_HPLPF4_2: | ||
1455 | case ARIZONA_ISRC_1_CTRL_1: | ||
1456 | case ARIZONA_ISRC_1_CTRL_2: | ||
1457 | case ARIZONA_ISRC_1_CTRL_3: | ||
1458 | case ARIZONA_ISRC_2_CTRL_1: | ||
1459 | case ARIZONA_ISRC_2_CTRL_2: | ||
1460 | case ARIZONA_ISRC_2_CTRL_3: | ||
1461 | return true; | ||
1462 | default: | ||
1463 | return false; | ||
1464 | } | ||
1465 | } | ||
1466 | |||
1467 | static bool wm8997_volatile_register(struct device *dev, unsigned int reg) | ||
1468 | { | ||
1469 | switch (reg) { | ||
1470 | case ARIZONA_SOFTWARE_RESET: | ||
1471 | case ARIZONA_DEVICE_REVISION: | ||
1472 | case ARIZONA_HAPTICS_STATUS: | ||
1473 | case ARIZONA_SAMPLE_RATE_1_STATUS: | ||
1474 | case ARIZONA_SAMPLE_RATE_2_STATUS: | ||
1475 | case ARIZONA_SAMPLE_RATE_3_STATUS: | ||
1476 | case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS: | ||
1477 | case ARIZONA_MIC_DETECT_3: | ||
1478 | case ARIZONA_HEADPHONE_DETECT_2: | ||
1479 | case ARIZONA_INPUT_ENABLES_STATUS: | ||
1480 | case ARIZONA_OUTPUT_STATUS_1: | ||
1481 | case ARIZONA_RAW_OUTPUT_STATUS_1: | ||
1482 | case ARIZONA_SLIMBUS_RX_PORT_STATUS: | ||
1483 | case ARIZONA_SLIMBUS_TX_PORT_STATUS: | ||
1484 | case ARIZONA_INTERRUPT_STATUS_1: | ||
1485 | case ARIZONA_INTERRUPT_STATUS_2: | ||
1486 | case ARIZONA_INTERRUPT_STATUS_3: | ||
1487 | case ARIZONA_INTERRUPT_STATUS_4: | ||
1488 | case ARIZONA_INTERRUPT_STATUS_5: | ||
1489 | case ARIZONA_IRQ2_STATUS_1: | ||
1490 | case ARIZONA_IRQ2_STATUS_3: | ||
1491 | case ARIZONA_IRQ2_STATUS_4: | ||
1492 | case ARIZONA_IRQ2_STATUS_5: | ||
1493 | case ARIZONA_INTERRUPT_RAW_STATUS_3: | ||
1494 | case ARIZONA_INTERRUPT_RAW_STATUS_4: | ||
1495 | case ARIZONA_INTERRUPT_RAW_STATUS_5: | ||
1496 | case ARIZONA_INTERRUPT_RAW_STATUS_6: | ||
1497 | case ARIZONA_INTERRUPT_RAW_STATUS_7: | ||
1498 | case ARIZONA_INTERRUPT_RAW_STATUS_8: | ||
1499 | case ARIZONA_IRQ_PIN_STATUS: | ||
1500 | case ARIZONA_AOD_WKUP_AND_TRIG: | ||
1501 | case ARIZONA_AOD_IRQ1: | ||
1502 | case ARIZONA_AOD_IRQ2: | ||
1503 | case ARIZONA_AOD_IRQ_RAW_STATUS: | ||
1504 | case ARIZONA_FX_CTRL2: | ||
1505 | return true; | ||
1506 | default: | ||
1507 | return false; | ||
1508 | } | ||
1509 | } | ||
1510 | |||
1511 | #define WM8997_MAX_REGISTER 0x31ff | ||
1512 | |||
1513 | const struct regmap_config wm8997_i2c_regmap = { | ||
1514 | .reg_bits = 32, | ||
1515 | .val_bits = 16, | ||
1516 | |||
1517 | .max_register = WM8997_MAX_REGISTER, | ||
1518 | .readable_reg = wm8997_readable_register, | ||
1519 | .volatile_reg = wm8997_volatile_register, | ||
1520 | |||
1521 | .cache_type = REGCACHE_RBTREE, | ||
1522 | .reg_defaults = wm8997_reg_default, | ||
1523 | .num_reg_defaults = ARRAY_SIZE(wm8997_reg_default), | ||
1524 | }; | ||
1525 | EXPORT_SYMBOL_GPL(wm8997_i2c_regmap); | ||
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index a57a1b15cdba..a4c53b2d1aaf 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
@@ -28,8 +28,11 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/mutex.h> | 30 | #include <linux/mutex.h> |
31 | #include <linux/of.h> | ||
32 | #include <linux/of_gpio.h> | ||
31 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
32 | #include <linux/regulator/driver.h> | 34 | #include <linux/regulator/driver.h> |
35 | #include <linux/regulator/of_regulator.h> | ||
33 | #include <linux/mfd/max8998.h> | 36 | #include <linux/mfd/max8998.h> |
34 | #include <linux/mfd/max8998-private.h> | 37 | #include <linux/mfd/max8998-private.h> |
35 | 38 | ||
@@ -589,13 +592,13 @@ static struct regulator_desc regulators[] = { | |||
589 | .type = REGULATOR_VOLTAGE, | 592 | .type = REGULATOR_VOLTAGE, |
590 | .owner = THIS_MODULE, | 593 | .owner = THIS_MODULE, |
591 | }, { | 594 | }, { |
592 | .name = "EN32KHz AP", | 595 | .name = "EN32KHz-AP", |
593 | .id = MAX8998_EN32KHZ_AP, | 596 | .id = MAX8998_EN32KHZ_AP, |
594 | .ops = &max8998_others_ops, | 597 | .ops = &max8998_others_ops, |
595 | .type = REGULATOR_VOLTAGE, | 598 | .type = REGULATOR_VOLTAGE, |
596 | .owner = THIS_MODULE, | 599 | .owner = THIS_MODULE, |
597 | }, { | 600 | }, { |
598 | .name = "EN32KHz CP", | 601 | .name = "EN32KHz-CP", |
599 | .id = MAX8998_EN32KHZ_CP, | 602 | .id = MAX8998_EN32KHZ_CP, |
600 | .ops = &max8998_others_ops, | 603 | .ops = &max8998_others_ops, |
601 | .type = REGULATOR_VOLTAGE, | 604 | .type = REGULATOR_VOLTAGE, |
@@ -621,21 +624,140 @@ static struct regulator_desc regulators[] = { | |||
621 | } | 624 | } |
622 | }; | 625 | }; |
623 | 626 | ||
627 | static int max8998_pmic_dt_parse_dvs_gpio(struct max8998_dev *iodev, | ||
628 | struct max8998_platform_data *pdata, | ||
629 | struct device_node *pmic_np) | ||
630 | { | ||
631 | int gpio; | ||
632 | |||
633 | gpio = of_get_named_gpio(pmic_np, "max8998,pmic-buck1-dvs-gpios", 0); | ||
634 | if (!gpio_is_valid(gpio)) { | ||
635 | dev_err(iodev->dev, "invalid buck1 gpio[0]: %d\n", gpio); | ||
636 | return -EINVAL; | ||
637 | } | ||
638 | pdata->buck1_set1 = gpio; | ||
639 | |||
640 | gpio = of_get_named_gpio(pmic_np, "max8998,pmic-buck1-dvs-gpios", 1); | ||
641 | if (!gpio_is_valid(gpio)) { | ||
642 | dev_err(iodev->dev, "invalid buck1 gpio[1]: %d\n", gpio); | ||
643 | return -EINVAL; | ||
644 | } | ||
645 | pdata->buck1_set2 = gpio; | ||
646 | |||
647 | gpio = of_get_named_gpio(pmic_np, "max8998,pmic-buck2-dvs-gpio", 0); | ||
648 | if (!gpio_is_valid(gpio)) { | ||
649 | dev_err(iodev->dev, "invalid buck 2 gpio: %d\n", gpio); | ||
650 | return -EINVAL; | ||
651 | } | ||
652 | pdata->buck2_set3 = gpio; | ||
653 | |||
654 | return 0; | ||
655 | } | ||
656 | |||
657 | static int max8998_pmic_dt_parse_pdata(struct max8998_dev *iodev, | ||
658 | struct max8998_platform_data *pdata) | ||
659 | { | ||
660 | struct device_node *pmic_np = iodev->dev->of_node; | ||
661 | struct device_node *regulators_np, *reg_np; | ||
662 | struct max8998_regulator_data *rdata; | ||
663 | unsigned int i; | ||
664 | int ret; | ||
665 | |||
666 | regulators_np = of_get_child_by_name(pmic_np, "regulators"); | ||
667 | if (!regulators_np) { | ||
668 | dev_err(iodev->dev, "could not find regulators sub-node\n"); | ||
669 | return -EINVAL; | ||
670 | } | ||
671 | |||
672 | /* count the number of regulators to be supported in pmic */ | ||
673 | pdata->num_regulators = of_get_child_count(regulators_np); | ||
674 | |||
675 | rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) * | ||
676 | pdata->num_regulators, GFP_KERNEL); | ||
677 | if (!rdata) | ||
678 | return -ENOMEM; | ||
679 | |||
680 | pdata->regulators = rdata; | ||
681 | for (i = 0; i < ARRAY_SIZE(regulators); ++i) { | ||
682 | reg_np = of_get_child_by_name(regulators_np, | ||
683 | regulators[i].name); | ||
684 | if (!reg_np) | ||
685 | continue; | ||
686 | |||
687 | rdata->id = regulators[i].id; | ||
688 | rdata->initdata = of_get_regulator_init_data( | ||
689 | iodev->dev, reg_np); | ||
690 | rdata->reg_node = reg_np; | ||
691 | ++rdata; | ||
692 | } | ||
693 | pdata->num_regulators = rdata - pdata->regulators; | ||
694 | |||
695 | ret = max8998_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np); | ||
696 | if (ret) | ||
697 | return -EINVAL; | ||
698 | |||
699 | if (of_find_property(pmic_np, "max8998,pmic-buck-voltage-lock", NULL)) | ||
700 | pdata->buck_voltage_lock = true; | ||
701 | |||
702 | ret = of_property_read_u32(pmic_np, | ||
703 | "max8998,pmic-buck1-default-dvs-idx", | ||
704 | &pdata->buck1_default_idx); | ||
705 | if (!ret && pdata->buck1_default_idx >= 4) { | ||
706 | pdata->buck1_default_idx = 0; | ||
707 | dev_warn(iodev->dev, "invalid value for default dvs index, using 0 instead\n"); | ||
708 | } | ||
709 | |||
710 | ret = of_property_read_u32(pmic_np, | ||
711 | "max8998,pmic-buck2-default-dvs-idx", | ||
712 | &pdata->buck2_default_idx); | ||
713 | if (!ret && pdata->buck2_default_idx >= 2) { | ||
714 | pdata->buck2_default_idx = 0; | ||
715 | dev_warn(iodev->dev, "invalid value for default dvs index, using 0 instead\n"); | ||
716 | } | ||
717 | |||
718 | ret = of_property_read_u32_array(pmic_np, | ||
719 | "max8998,pmic-buck1-dvs-voltage", | ||
720 | pdata->buck1_voltage, | ||
721 | ARRAY_SIZE(pdata->buck1_voltage)); | ||
722 | if (ret) { | ||
723 | dev_err(iodev->dev, "buck1 voltages not specified\n"); | ||
724 | return -EINVAL; | ||
725 | } | ||
726 | |||
727 | ret = of_property_read_u32_array(pmic_np, | ||
728 | "max8998,pmic-buck2-dvs-voltage", | ||
729 | pdata->buck2_voltage, | ||
730 | ARRAY_SIZE(pdata->buck2_voltage)); | ||
731 | if (ret) { | ||
732 | dev_err(iodev->dev, "buck2 voltages not specified\n"); | ||
733 | return -EINVAL; | ||
734 | } | ||
735 | |||
736 | return 0; | ||
737 | } | ||
738 | |||
624 | static int max8998_pmic_probe(struct platform_device *pdev) | 739 | static int max8998_pmic_probe(struct platform_device *pdev) |
625 | { | 740 | { |
626 | struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 741 | struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
627 | struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev); | 742 | struct max8998_platform_data *pdata = iodev->pdata; |
628 | struct regulator_config config = { }; | 743 | struct regulator_config config = { }; |
629 | struct regulator_dev **rdev; | 744 | struct regulator_dev **rdev; |
630 | struct max8998_data *max8998; | 745 | struct max8998_data *max8998; |
631 | struct i2c_client *i2c; | 746 | struct i2c_client *i2c; |
632 | int i, ret, size; | 747 | int i, ret, size; |
748 | unsigned int v; | ||
633 | 749 | ||
634 | if (!pdata) { | 750 | if (!pdata) { |
635 | dev_err(pdev->dev.parent, "No platform init data supplied\n"); | 751 | dev_err(pdev->dev.parent, "No platform init data supplied\n"); |
636 | return -ENODEV; | 752 | return -ENODEV; |
637 | } | 753 | } |
638 | 754 | ||
755 | if (IS_ENABLED(CONFIG_OF) && iodev->dev->of_node) { | ||
756 | ret = max8998_pmic_dt_parse_pdata(iodev, pdata); | ||
757 | if (ret) | ||
758 | return ret; | ||
759 | } | ||
760 | |||
639 | max8998 = devm_kzalloc(&pdev->dev, sizeof(struct max8998_data), | 761 | max8998 = devm_kzalloc(&pdev->dev, sizeof(struct max8998_data), |
640 | GFP_KERNEL); | 762 | GFP_KERNEL); |
641 | if (!max8998) | 763 | if (!max8998) |
@@ -688,53 +810,21 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
688 | gpio_request(pdata->buck1_set2, "MAX8998 BUCK1_SET2"); | 810 | gpio_request(pdata->buck1_set2, "MAX8998 BUCK1_SET2"); |
689 | gpio_direction_output(pdata->buck1_set2, | 811 | gpio_direction_output(pdata->buck1_set2, |
690 | (max8998->buck1_idx >> 1) & 0x1); | 812 | (max8998->buck1_idx >> 1) & 0x1); |
691 | /* Set predefined value for BUCK1 register 1 */ | ||
692 | i = 0; | ||
693 | while (buck12_voltage_map_desc.min + | ||
694 | buck12_voltage_map_desc.step*i | ||
695 | < pdata->buck1_voltage1) | ||
696 | i++; | ||
697 | max8998->buck1_vol[0] = i; | ||
698 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i); | ||
699 | if (ret) | ||
700 | goto err_out; | ||
701 | |||
702 | /* Set predefined value for BUCK1 register 2 */ | ||
703 | i = 0; | ||
704 | while (buck12_voltage_map_desc.min + | ||
705 | buck12_voltage_map_desc.step*i | ||
706 | < pdata->buck1_voltage2) | ||
707 | i++; | ||
708 | |||
709 | max8998->buck1_vol[1] = i; | ||
710 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE2, i); | ||
711 | if (ret) | ||
712 | goto err_out; | ||
713 | |||
714 | /* Set predefined value for BUCK1 register 3 */ | ||
715 | i = 0; | ||
716 | while (buck12_voltage_map_desc.min + | ||
717 | buck12_voltage_map_desc.step*i | ||
718 | < pdata->buck1_voltage3) | ||
719 | i++; | ||
720 | |||
721 | max8998->buck1_vol[2] = i; | ||
722 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE3, i); | ||
723 | if (ret) | ||
724 | goto err_out; | ||
725 | |||
726 | /* Set predefined value for BUCK1 register 4 */ | ||
727 | i = 0; | ||
728 | while (buck12_voltage_map_desc.min + | ||
729 | buck12_voltage_map_desc.step*i | ||
730 | < pdata->buck1_voltage4) | ||
731 | i++; | ||
732 | |||
733 | max8998->buck1_vol[3] = i; | ||
734 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE4, i); | ||
735 | if (ret) | ||
736 | goto err_out; | ||
737 | 813 | ||
814 | /* Set predefined values for BUCK1 registers */ | ||
815 | for (v = 0; v < ARRAY_SIZE(pdata->buck1_voltage); ++v) { | ||
816 | i = 0; | ||
817 | while (buck12_voltage_map_desc.min + | ||
818 | buck12_voltage_map_desc.step*i | ||
819 | < pdata->buck1_voltage[v]) | ||
820 | i++; | ||
821 | |||
822 | max8998->buck1_vol[v] = i; | ||
823 | ret = max8998_write_reg(i2c, | ||
824 | MAX8998_REG_BUCK1_VOLTAGE1 + v, i); | ||
825 | if (ret) | ||
826 | goto err_out; | ||
827 | } | ||
738 | } | 828 | } |
739 | 829 | ||
740 | if (gpio_is_valid(pdata->buck2_set3)) { | 830 | if (gpio_is_valid(pdata->buck2_set3)) { |
@@ -750,27 +840,20 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
750 | gpio_direction_output(pdata->buck2_set3, | 840 | gpio_direction_output(pdata->buck2_set3, |
751 | max8998->buck2_idx & 0x1); | 841 | max8998->buck2_idx & 0x1); |
752 | 842 | ||
753 | /* BUCK2 register 1 */ | 843 | /* Set predefined values for BUCK2 registers */ |
754 | i = 0; | 844 | for (v = 0; v < ARRAY_SIZE(pdata->buck2_voltage); ++v) { |
755 | while (buck12_voltage_map_desc.min + | 845 | i = 0; |
756 | buck12_voltage_map_desc.step*i | 846 | while (buck12_voltage_map_desc.min + |
757 | < pdata->buck2_voltage1) | 847 | buck12_voltage_map_desc.step*i |
758 | i++; | 848 | < pdata->buck2_voltage[v]) |
759 | max8998->buck2_vol[0] = i; | 849 | i++; |
760 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i); | 850 | |
761 | if (ret) | 851 | max8998->buck2_vol[v] = i; |
762 | goto err_out; | 852 | ret = max8998_write_reg(i2c, |
763 | 853 | MAX8998_REG_BUCK2_VOLTAGE1 + v, i); | |
764 | /* BUCK2 register 2 */ | 854 | if (ret) |
765 | i = 0; | 855 | goto err_out; |
766 | while (buck12_voltage_map_desc.min + | 856 | } |
767 | buck12_voltage_map_desc.step*i | ||
768 | < pdata->buck2_voltage2) | ||
769 | i++; | ||
770 | max8998->buck2_vol[1] = i; | ||
771 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i); | ||
772 | if (ret) | ||
773 | goto err_out; | ||
774 | } | 857 | } |
775 | 858 | ||
776 | for (i = 0; i < pdata->num_regulators; i++) { | 859 | for (i = 0; i < pdata->num_regulators; i++) { |
@@ -788,13 +871,15 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
788 | } | 871 | } |
789 | 872 | ||
790 | config.dev = max8998->dev; | 873 | config.dev = max8998->dev; |
874 | config.of_node = pdata->regulators[i].reg_node; | ||
791 | config.init_data = pdata->regulators[i].initdata; | 875 | config.init_data = pdata->regulators[i].initdata; |
792 | config.driver_data = max8998; | 876 | config.driver_data = max8998; |
793 | 877 | ||
794 | rdev[i] = regulator_register(®ulators[index], &config); | 878 | rdev[i] = regulator_register(®ulators[index], &config); |
795 | if (IS_ERR(rdev[i])) { | 879 | if (IS_ERR(rdev[i])) { |
796 | ret = PTR_ERR(rdev[i]); | 880 | ret = PTR_ERR(rdev[i]); |
797 | dev_err(max8998->dev, "regulator init failed\n"); | 881 | dev_err(max8998->dev, "regulator %s init failed (%d)\n", |
882 | regulators[index].name, ret); | ||
798 | rdev[i] = NULL; | 883 | rdev[i] = NULL; |
799 | goto err; | 884 | goto err; |
800 | } | 885 | } |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 3ae44ac12a94..d0c87856dd25 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -838,6 +838,9 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
838 | continue; | 838 | continue; |
839 | ramp_delay_support = true; | 839 | ramp_delay_support = true; |
840 | break; | 840 | break; |
841 | case PALMAS_REG_SMPS10: | ||
842 | if (!PALMAS_PMIC_HAS(palmas, SMPS10_BOOST)) | ||
843 | continue; | ||
841 | } | 844 | } |
842 | 845 | ||
843 | if ((id == PALMAS_REG_SMPS6) || (id == PALMAS_REG_SMPS8)) | 846 | if ((id == PALMAS_REG_SMPS6) || (id == PALMAS_REG_SMPS8)) |
@@ -1051,6 +1054,7 @@ static struct of_device_id of_palmas_match_tbl[] = { | |||
1051 | { .compatible = "ti,tps65913-pmic", }, | 1054 | { .compatible = "ti,tps65913-pmic", }, |
1052 | { .compatible = "ti,tps65914-pmic", }, | 1055 | { .compatible = "ti,tps65914-pmic", }, |
1053 | { .compatible = "ti,tps80036-pmic", }, | 1056 | { .compatible = "ti,tps80036-pmic", }, |
1057 | { .compatible = "ti,tps659038-pmic", }, | ||
1054 | { /* end */ } | 1058 | { /* end */ } |
1055 | }; | 1059 | }; |
1056 | 1060 | ||
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index fb6e67d74ffb..93bc4f456da4 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c | |||
@@ -109,7 +109,7 @@ struct twlreg_info { | |||
109 | #define SMPS_OFFSET_EN BIT(0) | 109 | #define SMPS_OFFSET_EN BIT(0) |
110 | #define SMPS_EXTENDED_EN BIT(1) | 110 | #define SMPS_EXTENDED_EN BIT(1) |
111 | 111 | ||
112 | /* twl6025 SMPS EPROM values */ | 112 | /* twl6032 SMPS EPROM values */ |
113 | #define TWL6030_SMPS_OFFSET 0xB0 | 113 | #define TWL6030_SMPS_OFFSET 0xB0 |
114 | #define TWL6030_SMPS_MULT 0xB3 | 114 | #define TWL6030_SMPS_MULT 0xB3 |
115 | #define SMPS_MULTOFFSET_SMPS4 BIT(0) | 115 | #define SMPS_MULTOFFSET_SMPS4 BIT(0) |
@@ -173,7 +173,7 @@ static int twl6030reg_is_enabled(struct regulator_dev *rdev) | |||
173 | struct twlreg_info *info = rdev_get_drvdata(rdev); | 173 | struct twlreg_info *info = rdev_get_drvdata(rdev); |
174 | int grp = 0, val; | 174 | int grp = 0, val; |
175 | 175 | ||
176 | if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS))) { | 176 | if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS))) { |
177 | grp = twlreg_grp(rdev); | 177 | grp = twlreg_grp(rdev); |
178 | if (grp < 0) | 178 | if (grp < 0) |
179 | return grp; | 179 | return grp; |
@@ -211,7 +211,7 @@ static int twl6030reg_enable(struct regulator_dev *rdev) | |||
211 | int grp = 0; | 211 | int grp = 0; |
212 | int ret; | 212 | int ret; |
213 | 213 | ||
214 | if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS))) | 214 | if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS))) |
215 | grp = twlreg_grp(rdev); | 215 | grp = twlreg_grp(rdev); |
216 | if (grp < 0) | 216 | if (grp < 0) |
217 | return grp; | 217 | return grp; |
@@ -245,7 +245,7 @@ static int twl6030reg_disable(struct regulator_dev *rdev) | |||
245 | int grp = 0; | 245 | int grp = 0; |
246 | int ret; | 246 | int ret; |
247 | 247 | ||
248 | if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS))) | 248 | if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS))) |
249 | grp = P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030; | 249 | grp = P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030; |
250 | 250 | ||
251 | /* For 6030, set the off state for all grps enabled */ | 251 | /* For 6030, set the off state for all grps enabled */ |
@@ -339,7 +339,7 @@ static int twl6030reg_set_mode(struct regulator_dev *rdev, unsigned mode) | |||
339 | int grp = 0; | 339 | int grp = 0; |
340 | int val; | 340 | int val; |
341 | 341 | ||
342 | if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS))) | 342 | if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS))) |
343 | grp = twlreg_grp(rdev); | 343 | grp = twlreg_grp(rdev); |
344 | 344 | ||
345 | if (grp < 0) | 345 | if (grp < 0) |
@@ -899,14 +899,14 @@ static const struct twlreg_info TWL6030_INFO_##label = { \ | |||
899 | }, \ | 899 | }, \ |
900 | } | 900 | } |
901 | 901 | ||
902 | #define TWL6025_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) \ | 902 | #define TWL6032_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) \ |
903 | static const struct twlreg_info TWL6025_INFO_##label = { \ | 903 | static const struct twlreg_info TWL6032_INFO_##label = { \ |
904 | .base = offset, \ | 904 | .base = offset, \ |
905 | .min_mV = min_mVolts, \ | 905 | .min_mV = min_mVolts, \ |
906 | .max_mV = max_mVolts, \ | 906 | .max_mV = max_mVolts, \ |
907 | .desc = { \ | 907 | .desc = { \ |
908 | .name = #label, \ | 908 | .name = #label, \ |
909 | .id = TWL6025_REG_##label, \ | 909 | .id = TWL6032_REG_##label, \ |
910 | .n_voltages = 32, \ | 910 | .n_voltages = 32, \ |
911 | .ops = &twl6030ldo_ops, \ | 911 | .ops = &twl6030ldo_ops, \ |
912 | .type = REGULATOR_VOLTAGE, \ | 912 | .type = REGULATOR_VOLTAGE, \ |
@@ -933,14 +933,14 @@ static const struct twlreg_info TWLFIXED_INFO_##label = { \ | |||
933 | }, \ | 933 | }, \ |
934 | } | 934 | } |
935 | 935 | ||
936 | #define TWL6025_ADJUSTABLE_SMPS(label, offset) \ | 936 | #define TWL6032_ADJUSTABLE_SMPS(label, offset) \ |
937 | static const struct twlreg_info TWLSMPS_INFO_##label = { \ | 937 | static const struct twlreg_info TWLSMPS_INFO_##label = { \ |
938 | .base = offset, \ | 938 | .base = offset, \ |
939 | .min_mV = 600, \ | 939 | .min_mV = 600, \ |
940 | .max_mV = 2100, \ | 940 | .max_mV = 2100, \ |
941 | .desc = { \ | 941 | .desc = { \ |
942 | .name = #label, \ | 942 | .name = #label, \ |
943 | .id = TWL6025_REG_##label, \ | 943 | .id = TWL6032_REG_##label, \ |
944 | .n_voltages = 63, \ | 944 | .n_voltages = 63, \ |
945 | .ops = &twlsmps_ops, \ | 945 | .ops = &twlsmps_ops, \ |
946 | .type = REGULATOR_VOLTAGE, \ | 946 | .type = REGULATOR_VOLTAGE, \ |
@@ -981,15 +981,15 @@ TWL6030_ADJUSTABLE_LDO(VMMC, 0x68, 1000, 3300); | |||
981 | TWL6030_ADJUSTABLE_LDO(VPP, 0x6c, 1000, 3300); | 981 | TWL6030_ADJUSTABLE_LDO(VPP, 0x6c, 1000, 3300); |
982 | TWL6030_ADJUSTABLE_LDO(VUSIM, 0x74, 1000, 3300); | 982 | TWL6030_ADJUSTABLE_LDO(VUSIM, 0x74, 1000, 3300); |
983 | /* 6025 are renamed compared to 6030 versions */ | 983 | /* 6025 are renamed compared to 6030 versions */ |
984 | TWL6025_ADJUSTABLE_LDO(LDO2, 0x54, 1000, 3300); | 984 | TWL6032_ADJUSTABLE_LDO(LDO2, 0x54, 1000, 3300); |
985 | TWL6025_ADJUSTABLE_LDO(LDO4, 0x58, 1000, 3300); | 985 | TWL6032_ADJUSTABLE_LDO(LDO4, 0x58, 1000, 3300); |
986 | TWL6025_ADJUSTABLE_LDO(LDO3, 0x5c, 1000, 3300); | 986 | TWL6032_ADJUSTABLE_LDO(LDO3, 0x5c, 1000, 3300); |
987 | TWL6025_ADJUSTABLE_LDO(LDO5, 0x68, 1000, 3300); | 987 | TWL6032_ADJUSTABLE_LDO(LDO5, 0x68, 1000, 3300); |
988 | TWL6025_ADJUSTABLE_LDO(LDO1, 0x6c, 1000, 3300); | 988 | TWL6032_ADJUSTABLE_LDO(LDO1, 0x6c, 1000, 3300); |
989 | TWL6025_ADJUSTABLE_LDO(LDO7, 0x74, 1000, 3300); | 989 | TWL6032_ADJUSTABLE_LDO(LDO7, 0x74, 1000, 3300); |
990 | TWL6025_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300); | 990 | TWL6032_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300); |
991 | TWL6025_ADJUSTABLE_LDO(LDOLN, 0x64, 1000, 3300); | 991 | TWL6032_ADJUSTABLE_LDO(LDOLN, 0x64, 1000, 3300); |
992 | TWL6025_ADJUSTABLE_LDO(LDOUSB, 0x70, 1000, 3300); | 992 | TWL6032_ADJUSTABLE_LDO(LDOUSB, 0x70, 1000, 3300); |
993 | TWL4030_FIXED_LDO(VINTANA1, 0x3f, 1500, 11, 100, 0x08); | 993 | TWL4030_FIXED_LDO(VINTANA1, 0x3f, 1500, 11, 100, 0x08); |
994 | TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08); | 994 | TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08); |
995 | TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17, 100, 0x08); | 995 | TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17, 100, 0x08); |
@@ -1001,9 +1001,9 @@ TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 0); | |||
1001 | TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 0); | 1001 | TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 0); |
1002 | TWL6030_FIXED_LDO(V1V8, 0x16, 1800, 0); | 1002 | TWL6030_FIXED_LDO(V1V8, 0x16, 1800, 0); |
1003 | TWL6030_FIXED_LDO(V2V1, 0x1c, 2100, 0); | 1003 | TWL6030_FIXED_LDO(V2V1, 0x1c, 2100, 0); |
1004 | TWL6025_ADJUSTABLE_SMPS(SMPS3, 0x34); | 1004 | TWL6032_ADJUSTABLE_SMPS(SMPS3, 0x34); |
1005 | TWL6025_ADJUSTABLE_SMPS(SMPS4, 0x10); | 1005 | TWL6032_ADJUSTABLE_SMPS(SMPS4, 0x10); |
1006 | TWL6025_ADJUSTABLE_SMPS(VIO, 0x16); | 1006 | TWL6032_ADJUSTABLE_SMPS(VIO, 0x16); |
1007 | 1007 | ||
1008 | static u8 twl_get_smps_offset(void) | 1008 | static u8 twl_get_smps_offset(void) |
1009 | { | 1009 | { |
@@ -1031,7 +1031,7 @@ static u8 twl_get_smps_mult(void) | |||
1031 | 1031 | ||
1032 | #define TWL4030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL4030, label) | 1032 | #define TWL4030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL4030, label) |
1033 | #define TWL6030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6030, label) | 1033 | #define TWL6030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6030, label) |
1034 | #define TWL6025_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6025, label) | 1034 | #define TWL6032_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6032, label) |
1035 | #define TWLFIXED_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLFIXED, label) | 1035 | #define TWLFIXED_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLFIXED, label) |
1036 | #define TWLSMPS_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLSMPS, label) | 1036 | #define TWLSMPS_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLSMPS, label) |
1037 | 1037 | ||
@@ -1060,15 +1060,15 @@ static const struct of_device_id twl_of_match[] = { | |||
1060 | TWL6030_OF_MATCH("ti,twl6030-vmmc", VMMC), | 1060 | TWL6030_OF_MATCH("ti,twl6030-vmmc", VMMC), |
1061 | TWL6030_OF_MATCH("ti,twl6030-vpp", VPP), | 1061 | TWL6030_OF_MATCH("ti,twl6030-vpp", VPP), |
1062 | TWL6030_OF_MATCH("ti,twl6030-vusim", VUSIM), | 1062 | TWL6030_OF_MATCH("ti,twl6030-vusim", VUSIM), |
1063 | TWL6025_OF_MATCH("ti,twl6025-ldo2", LDO2), | 1063 | TWL6032_OF_MATCH("ti,twl6032-ldo2", LDO2), |
1064 | TWL6025_OF_MATCH("ti,twl6025-ldo4", LDO4), | 1064 | TWL6032_OF_MATCH("ti,twl6032-ldo4", LDO4), |
1065 | TWL6025_OF_MATCH("ti,twl6025-ldo3", LDO3), | 1065 | TWL6032_OF_MATCH("ti,twl6032-ldo3", LDO3), |
1066 | TWL6025_OF_MATCH("ti,twl6025-ldo5", LDO5), | 1066 | TWL6032_OF_MATCH("ti,twl6032-ldo5", LDO5), |
1067 | TWL6025_OF_MATCH("ti,twl6025-ldo1", LDO1), | 1067 | TWL6032_OF_MATCH("ti,twl6032-ldo1", LDO1), |
1068 | TWL6025_OF_MATCH("ti,twl6025-ldo7", LDO7), | 1068 | TWL6032_OF_MATCH("ti,twl6032-ldo7", LDO7), |
1069 | TWL6025_OF_MATCH("ti,twl6025-ldo6", LDO6), | 1069 | TWL6032_OF_MATCH("ti,twl6032-ldo6", LDO6), |
1070 | TWL6025_OF_MATCH("ti,twl6025-ldoln", LDOLN), | 1070 | TWL6032_OF_MATCH("ti,twl6032-ldoln", LDOLN), |
1071 | TWL6025_OF_MATCH("ti,twl6025-ldousb", LDOUSB), | 1071 | TWL6032_OF_MATCH("ti,twl6032-ldousb", LDOUSB), |
1072 | TWLFIXED_OF_MATCH("ti,twl4030-vintana1", VINTANA1), | 1072 | TWLFIXED_OF_MATCH("ti,twl4030-vintana1", VINTANA1), |
1073 | TWLFIXED_OF_MATCH("ti,twl4030-vintdig", VINTDIG), | 1073 | TWLFIXED_OF_MATCH("ti,twl4030-vintdig", VINTDIG), |
1074 | TWLFIXED_OF_MATCH("ti,twl4030-vusb1v5", VUSB1V5), | 1074 | TWLFIXED_OF_MATCH("ti,twl4030-vusb1v5", VUSB1V5), |
@@ -1080,9 +1080,9 @@ static const struct of_device_id twl_of_match[] = { | |||
1080 | TWLFIXED_OF_MATCH("ti,twl6030-vusb", VUSB), | 1080 | TWLFIXED_OF_MATCH("ti,twl6030-vusb", VUSB), |
1081 | TWLFIXED_OF_MATCH("ti,twl6030-v1v8", V1V8), | 1081 | TWLFIXED_OF_MATCH("ti,twl6030-v1v8", V1V8), |
1082 | TWLFIXED_OF_MATCH("ti,twl6030-v2v1", V2V1), | 1082 | TWLFIXED_OF_MATCH("ti,twl6030-v2v1", V2V1), |
1083 | TWLSMPS_OF_MATCH("ti,twl6025-smps3", SMPS3), | 1083 | TWLSMPS_OF_MATCH("ti,twl6032-smps3", SMPS3), |
1084 | TWLSMPS_OF_MATCH("ti,twl6025-smps4", SMPS4), | 1084 | TWLSMPS_OF_MATCH("ti,twl6032-smps4", SMPS4), |
1085 | TWLSMPS_OF_MATCH("ti,twl6025-vio", VIO), | 1085 | TWLSMPS_OF_MATCH("ti,twl6032-vio", VIO), |
1086 | {}, | 1086 | {}, |
1087 | }; | 1087 | }; |
1088 | MODULE_DEVICE_TABLE(of, twl_of_match); | 1088 | MODULE_DEVICE_TABLE(of, twl_of_match); |
@@ -1163,19 +1163,19 @@ static int twlreg_probe(struct platform_device *pdev) | |||
1163 | } | 1163 | } |
1164 | 1164 | ||
1165 | switch (id) { | 1165 | switch (id) { |
1166 | case TWL6025_REG_SMPS3: | 1166 | case TWL6032_REG_SMPS3: |
1167 | if (twl_get_smps_mult() & SMPS_MULTOFFSET_SMPS3) | 1167 | if (twl_get_smps_mult() & SMPS_MULTOFFSET_SMPS3) |
1168 | info->flags |= SMPS_EXTENDED_EN; | 1168 | info->flags |= SMPS_EXTENDED_EN; |
1169 | if (twl_get_smps_offset() & SMPS_MULTOFFSET_SMPS3) | 1169 | if (twl_get_smps_offset() & SMPS_MULTOFFSET_SMPS3) |
1170 | info->flags |= SMPS_OFFSET_EN; | 1170 | info->flags |= SMPS_OFFSET_EN; |
1171 | break; | 1171 | break; |
1172 | case TWL6025_REG_SMPS4: | 1172 | case TWL6032_REG_SMPS4: |
1173 | if (twl_get_smps_mult() & SMPS_MULTOFFSET_SMPS4) | 1173 | if (twl_get_smps_mult() & SMPS_MULTOFFSET_SMPS4) |
1174 | info->flags |= SMPS_EXTENDED_EN; | 1174 | info->flags |= SMPS_EXTENDED_EN; |
1175 | if (twl_get_smps_offset() & SMPS_MULTOFFSET_SMPS4) | 1175 | if (twl_get_smps_offset() & SMPS_MULTOFFSET_SMPS4) |
1176 | info->flags |= SMPS_OFFSET_EN; | 1176 | info->flags |= SMPS_OFFSET_EN; |
1177 | break; | 1177 | break; |
1178 | case TWL6025_REG_VIO: | 1178 | case TWL6032_REG_VIO: |
1179 | if (twl_get_smps_mult() & SMPS_MULTOFFSET_VIO) | 1179 | if (twl_get_smps_mult() & SMPS_MULTOFFSET_VIO) |
1180 | info->flags |= SMPS_EXTENDED_EN; | 1180 | info->flags |= SMPS_EXTENDED_EN; |
1181 | if (twl_get_smps_offset() & SMPS_MULTOFFSET_VIO) | 1181 | if (twl_get_smps_offset() & SMPS_MULTOFFSET_VIO) |
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index 5388336a2c4c..f098ad8382de 100644 --- a/drivers/rtc/rtc-max8998.c +++ b/drivers/rtc/rtc-max8998.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/bcd.h> | 18 | #include <linux/bcd.h> |
19 | #include <linux/irqdomain.h> | ||
19 | #include <linux/rtc.h> | 20 | #include <linux/rtc.h> |
20 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
21 | #include <linux/mfd/max8998.h> | 22 | #include <linux/mfd/max8998.h> |
@@ -252,7 +253,7 @@ static const struct rtc_class_ops max8998_rtc_ops = { | |||
252 | static int max8998_rtc_probe(struct platform_device *pdev) | 253 | static int max8998_rtc_probe(struct platform_device *pdev) |
253 | { | 254 | { |
254 | struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent); | 255 | struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent); |
255 | struct max8998_platform_data *pdata = dev_get_platdata(max8998->dev); | 256 | struct max8998_platform_data *pdata = max8998->pdata; |
256 | struct max8998_rtc_info *info; | 257 | struct max8998_rtc_info *info; |
257 | int ret; | 258 | int ret; |
258 | 259 | ||
@@ -264,7 +265,6 @@ static int max8998_rtc_probe(struct platform_device *pdev) | |||
264 | info->dev = &pdev->dev; | 265 | info->dev = &pdev->dev; |
265 | info->max8998 = max8998; | 266 | info->max8998 = max8998; |
266 | info->rtc = max8998->rtc; | 267 | info->rtc = max8998->rtc; |
267 | info->irq = max8998->irq_base + MAX8998_IRQ_ALARM0; | ||
268 | 268 | ||
269 | platform_set_drvdata(pdev, info); | 269 | platform_set_drvdata(pdev, info); |
270 | 270 | ||
@@ -277,6 +277,15 @@ static int max8998_rtc_probe(struct platform_device *pdev) | |||
277 | return ret; | 277 | return ret; |
278 | } | 278 | } |
279 | 279 | ||
280 | if (!max8998->irq_domain) | ||
281 | goto no_irq; | ||
282 | |||
283 | info->irq = irq_create_mapping(max8998->irq_domain, MAX8998_IRQ_ALARM0); | ||
284 | if (!info->irq) { | ||
285 | dev_warn(&pdev->dev, "Failed to map alarm IRQ\n"); | ||
286 | goto no_irq; | ||
287 | } | ||
288 | |||
280 | ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, | 289 | ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, |
281 | max8998_rtc_alarm_irq, 0, "rtc-alarm0", info); | 290 | max8998_rtc_alarm_irq, 0, "rtc-alarm0", info); |
282 | 291 | ||
@@ -284,6 +293,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) | |||
284 | dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", | 293 | dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", |
285 | info->irq, ret); | 294 | info->irq, ret); |
286 | 295 | ||
296 | no_irq: | ||
287 | dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); | 297 | dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); |
288 | if (pdata && pdata->rtc_delay) { | 298 | if (pdata && pdata->rtc_delay) { |
289 | info->lp3974_bug_workaround = true; | 299 | info->lp3974_bug_workaround = true; |
diff --git a/drivers/ssbi/Kconfig b/drivers/ssbi/Kconfig deleted file mode 100644 index 1ae4040afedd..000000000000 --- a/drivers/ssbi/Kconfig +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | # | ||
2 | # SSBI bus support | ||
3 | # | ||
4 | |||
5 | menu "Qualcomm MSM SSBI bus support" | ||
6 | |||
7 | config SSBI | ||
8 | tristate "Qualcomm Single-wire Serial Bus Interface (SSBI)" | ||
9 | help | ||
10 | If you say yes to this option, support will be included for the | ||
11 | built-in SSBI interface on Qualcomm MSM family processors. | ||
12 | |||
13 | This is required for communicating with Qualcomm PMICs and | ||
14 | other devices that have the SSBI interface. | ||
15 | |||
16 | endmenu | ||
diff --git a/drivers/ssbi/Makefile b/drivers/ssbi/Makefile deleted file mode 100644 index 38fb70c31caf..000000000000 --- a/drivers/ssbi/Makefile +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | obj-$(CONFIG_SSBI) += ssbi.o | ||
diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c index 9de7ada90a8b..1753bd367e0a 100644 --- a/drivers/usb/phy/phy-twl6030-usb.c +++ b/drivers/usb/phy/phy-twl6030-usb.c | |||
@@ -347,7 +347,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) | |||
347 | if (np) { | 347 | if (np) { |
348 | twl->regulator = "usb"; | 348 | twl->regulator = "usb"; |
349 | } else if (pdata) { | 349 | } else if (pdata) { |
350 | if (pdata->features & TWL6025_SUBCLASS) | 350 | if (pdata->features & TWL6032_SUBCLASS) |
351 | twl->regulator = "ldousb"; | 351 | twl->regulator = "ldousb"; |
352 | else | 352 | else |
353 | twl->regulator = "vusb"; | 353 | twl->regulator = "vusb"; |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index e89fc3133972..7460d349df59 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -687,6 +687,17 @@ config HP_WATCHDOG | |||
687 | To compile this driver as a module, choose M here: the module will be | 687 | To compile this driver as a module, choose M here: the module will be |
688 | called hpwdt. | 688 | called hpwdt. |
689 | 689 | ||
690 | config KEMPLD_WDT | ||
691 | tristate "Kontron COM Watchdog Timer" | ||
692 | depends on MFD_KEMPLD | ||
693 | select WATCHDOG_CORE | ||
694 | help | ||
695 | Support for the PLD watchdog on some Kontron ETX and COMexpress | ||
696 | (ETXexpress) modules | ||
697 | |||
698 | This driver can also be built as a module. If so, the module will be | ||
699 | called kempld_wdt. | ||
700 | |||
690 | config HPWDT_NMI_DECODING | 701 | config HPWDT_NMI_DECODING |
691 | bool "NMI decoding support for the HP ProLiant iLO2+ Hardware Watchdog Timer" | 702 | bool "NMI decoding support for the HP ProLiant iLO2+ Hardware Watchdog Timer" |
692 | depends on HP_WATCHDOG | 703 | depends on HP_WATCHDOG |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index a300b948f254..ec268995b261 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -90,6 +90,7 @@ endif | |||
90 | obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o | 90 | obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o |
91 | obj-$(CONFIG_IT87_WDT) += it87_wdt.o | 91 | obj-$(CONFIG_IT87_WDT) += it87_wdt.o |
92 | obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o | 92 | obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o |
93 | obj-$(CONFIG_KEMPLD_WDT) += kempld_wdt.o | ||
93 | obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o | 94 | obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o |
94 | obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o | 95 | obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o |
95 | obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o | 96 | obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o |
diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c new file mode 100644 index 000000000000..491419e0772a --- /dev/null +++ b/drivers/watchdog/kempld_wdt.c | |||
@@ -0,0 +1,581 @@ | |||
1 | /* | ||
2 | * Kontron PLD watchdog driver | ||
3 | * | ||
4 | * Copyright (c) 2010-2013 Kontron Europe GmbH | ||
5 | * Author: Michael Brunner <michael.brunner@kontron.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License 2 as published | ||
9 | * by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * Note: From the PLD watchdog point of view timeout and pretimeout are | ||
17 | * defined differently than in the kernel. | ||
18 | * First the pretimeout stage runs out before the timeout stage gets | ||
19 | * active. | ||
20 | * | ||
21 | * Kernel/API: P-----| pretimeout | ||
22 | * |-----------------------T timeout | ||
23 | * Watchdog: |-----------------P pretimeout_stage | ||
24 | * |-----T timeout_stage | ||
25 | */ | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/moduleparam.h> | ||
29 | #include <linux/miscdevice.h> | ||
30 | #include <linux/uaccess.h> | ||
31 | #include <linux/watchdog.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | #include <linux/mfd/kempld.h> | ||
34 | |||
35 | #define KEMPLD_WDT_STAGE_TIMEOUT(x) (0x1b + (x) * 4) | ||
36 | #define KEMPLD_WDT_STAGE_CFG(x) (0x18 + (x)) | ||
37 | #define STAGE_CFG_GET_PRESCALER(x) (((x) & 0x30) >> 4) | ||
38 | #define STAGE_CFG_SET_PRESCALER(x) (((x) & 0x30) << 4) | ||
39 | #define STAGE_CFG_PRESCALER_MASK 0x30 | ||
40 | #define STAGE_CFG_ACTION_MASK 0x7 | ||
41 | #define STAGE_CFG_ASSERT (1 << 3) | ||
42 | |||
43 | #define KEMPLD_WDT_MAX_STAGES 2 | ||
44 | #define KEMPLD_WDT_KICK 0x16 | ||
45 | #define KEMPLD_WDT_CFG 0x17 | ||
46 | #define KEMPLD_WDT_CFG_ENABLE 0x10 | ||
47 | #define KEMPLD_WDT_CFG_ENABLE_LOCK 0x8 | ||
48 | #define KEMPLD_WDT_CFG_GLOBAL_LOCK 0x80 | ||
49 | |||
50 | enum { | ||
51 | ACTION_NONE = 0, | ||
52 | ACTION_RESET, | ||
53 | ACTION_NMI, | ||
54 | ACTION_SMI, | ||
55 | ACTION_SCI, | ||
56 | ACTION_DELAY, | ||
57 | }; | ||
58 | |||
59 | enum { | ||
60 | STAGE_TIMEOUT = 0, | ||
61 | STAGE_PRETIMEOUT, | ||
62 | }; | ||
63 | |||
64 | enum { | ||
65 | PRESCALER_21 = 0, | ||
66 | PRESCALER_17, | ||
67 | PRESCALER_12, | ||
68 | }; | ||
69 | |||
70 | const u32 kempld_prescaler[] = { | ||
71 | [PRESCALER_21] = (1 << 21) - 1, | ||
72 | [PRESCALER_17] = (1 << 17) - 1, | ||
73 | [PRESCALER_12] = (1 << 12) - 1, | ||
74 | 0, | ||
75 | }; | ||
76 | |||
77 | struct kempld_wdt_stage { | ||
78 | unsigned int id; | ||
79 | u32 mask; | ||
80 | }; | ||
81 | |||
82 | struct kempld_wdt_data { | ||
83 | struct kempld_device_data *pld; | ||
84 | struct watchdog_device wdd; | ||
85 | unsigned int pretimeout; | ||
86 | struct kempld_wdt_stage stage[KEMPLD_WDT_MAX_STAGES]; | ||
87 | #ifdef CONFIG_PM | ||
88 | u8 pm_status_store; | ||
89 | #endif | ||
90 | }; | ||
91 | |||
92 | #define DEFAULT_TIMEOUT 30 /* seconds */ | ||
93 | #define DEFAULT_PRETIMEOUT 0 | ||
94 | |||
95 | static unsigned int timeout = DEFAULT_TIMEOUT; | ||
96 | module_param(timeout, uint, 0); | ||
97 | MODULE_PARM_DESC(timeout, | ||
98 | "Watchdog timeout in seconds. (>=0, default=" | ||
99 | __MODULE_STRING(DEFAULT_TIMEOUT) ")"); | ||
100 | |||
101 | static unsigned int pretimeout = DEFAULT_PRETIMEOUT; | ||
102 | module_param(pretimeout, uint, 0); | ||
103 | MODULE_PARM_DESC(pretimeout, | ||
104 | "Watchdog pretimeout in seconds. (>=0, default=" | ||
105 | __MODULE_STRING(DEFAULT_PRETIMEOUT) ")"); | ||
106 | |||
107 | static bool nowayout = WATCHDOG_NOWAYOUT; | ||
108 | module_param(nowayout, bool, 0); | ||
109 | MODULE_PARM_DESC(nowayout, | ||
110 | "Watchdog cannot be stopped once started (default=" | ||
111 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
112 | |||
113 | static int kempld_wdt_set_stage_action(struct kempld_wdt_data *wdt_data, | ||
114 | struct kempld_wdt_stage *stage, | ||
115 | u8 action) | ||
116 | { | ||
117 | struct kempld_device_data *pld = wdt_data->pld; | ||
118 | u8 stage_cfg; | ||
119 | |||
120 | if (!stage || !stage->mask) | ||
121 | return -EINVAL; | ||
122 | |||
123 | kempld_get_mutex(pld); | ||
124 | stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->id)); | ||
125 | stage_cfg &= ~STAGE_CFG_ACTION_MASK; | ||
126 | stage_cfg |= (action & STAGE_CFG_ACTION_MASK); | ||
127 | |||
128 | if (action == ACTION_RESET) | ||
129 | stage_cfg |= STAGE_CFG_ASSERT; | ||
130 | else | ||
131 | stage_cfg &= ~STAGE_CFG_ASSERT; | ||
132 | |||
133 | kempld_write8(pld, KEMPLD_WDT_STAGE_CFG(stage->id), stage_cfg); | ||
134 | kempld_release_mutex(pld); | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static int kempld_wdt_set_stage_timeout(struct kempld_wdt_data *wdt_data, | ||
140 | struct kempld_wdt_stage *stage, | ||
141 | unsigned int timeout) | ||
142 | { | ||
143 | struct kempld_device_data *pld = wdt_data->pld; | ||
144 | u32 prescaler = kempld_prescaler[PRESCALER_21]; | ||
145 | u64 stage_timeout64; | ||
146 | u32 stage_timeout; | ||
147 | u32 remainder; | ||
148 | u8 stage_cfg; | ||
149 | |||
150 | if (!stage) | ||
151 | return -EINVAL; | ||
152 | |||
153 | stage_timeout64 = (u64)timeout * pld->pld_clock; | ||
154 | remainder = do_div(stage_timeout64, prescaler); | ||
155 | if (remainder) | ||
156 | stage_timeout64++; | ||
157 | |||
158 | if (stage_timeout64 > stage->mask) | ||
159 | return -EINVAL; | ||
160 | |||
161 | stage_timeout = stage_timeout64 & stage->mask; | ||
162 | |||
163 | kempld_get_mutex(pld); | ||
164 | stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->id)); | ||
165 | stage_cfg &= ~STAGE_CFG_PRESCALER_MASK; | ||
166 | stage_cfg |= STAGE_CFG_SET_PRESCALER(prescaler); | ||
167 | kempld_write8(pld, KEMPLD_WDT_STAGE_CFG(stage->id), stage_cfg); | ||
168 | kempld_write32(pld, KEMPLD_WDT_STAGE_TIMEOUT(stage->id), | ||
169 | stage_timeout); | ||
170 | kempld_release_mutex(pld); | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | /* | ||
176 | * kempld_get_mutex must be called prior to calling this function. | ||
177 | */ | ||
178 | static unsigned int kempld_wdt_get_timeout(struct kempld_wdt_data *wdt_data, | ||
179 | struct kempld_wdt_stage *stage) | ||
180 | { | ||
181 | struct kempld_device_data *pld = wdt_data->pld; | ||
182 | unsigned int timeout; | ||
183 | u64 stage_timeout; | ||
184 | u32 prescaler; | ||
185 | u32 remainder; | ||
186 | u8 stage_cfg; | ||
187 | |||
188 | if (!stage->mask) | ||
189 | return 0; | ||
190 | |||
191 | stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->id)); | ||
192 | stage_timeout = kempld_read32(pld, KEMPLD_WDT_STAGE_TIMEOUT(stage->id)); | ||
193 | prescaler = kempld_prescaler[STAGE_CFG_GET_PRESCALER(stage_cfg)]; | ||
194 | |||
195 | stage_timeout = (stage_timeout & stage->mask) * prescaler; | ||
196 | remainder = do_div(stage_timeout, pld->pld_clock); | ||
197 | if (remainder) | ||
198 | stage_timeout++; | ||
199 | |||
200 | timeout = stage_timeout; | ||
201 | WARN_ON_ONCE(timeout != stage_timeout); | ||
202 | |||
203 | return timeout; | ||
204 | } | ||
205 | |||
206 | static int kempld_wdt_set_timeout(struct watchdog_device *wdd, | ||
207 | unsigned int timeout) | ||
208 | { | ||
209 | struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd); | ||
210 | struct kempld_wdt_stage *pretimeout_stage; | ||
211 | struct kempld_wdt_stage *timeout_stage; | ||
212 | int ret; | ||
213 | |||
214 | timeout_stage = &wdt_data->stage[STAGE_TIMEOUT]; | ||
215 | pretimeout_stage = &wdt_data->stage[STAGE_PRETIMEOUT]; | ||
216 | |||
217 | if (pretimeout_stage->mask && wdt_data->pretimeout > 0) | ||
218 | timeout = wdt_data->pretimeout; | ||
219 | |||
220 | ret = kempld_wdt_set_stage_action(wdt_data, timeout_stage, | ||
221 | ACTION_RESET); | ||
222 | if (ret) | ||
223 | return ret; | ||
224 | ret = kempld_wdt_set_stage_timeout(wdt_data, timeout_stage, | ||
225 | timeout); | ||
226 | if (ret) | ||
227 | return ret; | ||
228 | |||
229 | wdd->timeout = timeout; | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | static int kempld_wdt_set_pretimeout(struct watchdog_device *wdd, | ||
234 | unsigned int pretimeout) | ||
235 | { | ||
236 | struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd); | ||
237 | struct kempld_wdt_stage *pretimeout_stage; | ||
238 | u8 action = ACTION_NONE; | ||
239 | int ret; | ||
240 | |||
241 | pretimeout_stage = &wdt_data->stage[STAGE_PRETIMEOUT]; | ||
242 | |||
243 | if (!pretimeout_stage->mask) | ||
244 | return -ENXIO; | ||
245 | |||
246 | if (pretimeout > wdd->timeout) | ||
247 | return -EINVAL; | ||
248 | |||
249 | if (pretimeout > 0) | ||
250 | action = ACTION_NMI; | ||
251 | |||
252 | ret = kempld_wdt_set_stage_action(wdt_data, pretimeout_stage, | ||
253 | action); | ||
254 | if (ret) | ||
255 | return ret; | ||
256 | ret = kempld_wdt_set_stage_timeout(wdt_data, pretimeout_stage, | ||
257 | wdd->timeout - pretimeout); | ||
258 | if (ret) | ||
259 | return ret; | ||
260 | |||
261 | wdt_data->pretimeout = pretimeout; | ||
262 | return 0; | ||
263 | } | ||
264 | |||
265 | static void kempld_wdt_update_timeouts(struct kempld_wdt_data *wdt_data) | ||
266 | { | ||
267 | struct kempld_device_data *pld = wdt_data->pld; | ||
268 | struct kempld_wdt_stage *pretimeout_stage; | ||
269 | struct kempld_wdt_stage *timeout_stage; | ||
270 | unsigned int pretimeout, timeout; | ||
271 | |||
272 | pretimeout_stage = &wdt_data->stage[STAGE_PRETIMEOUT]; | ||
273 | timeout_stage = &wdt_data->stage[STAGE_TIMEOUT]; | ||
274 | |||
275 | kempld_get_mutex(pld); | ||
276 | pretimeout = kempld_wdt_get_timeout(wdt_data, pretimeout_stage); | ||
277 | timeout = kempld_wdt_get_timeout(wdt_data, timeout_stage); | ||
278 | kempld_release_mutex(pld); | ||
279 | |||
280 | if (pretimeout) | ||
281 | wdt_data->pretimeout = timeout; | ||
282 | else | ||
283 | wdt_data->pretimeout = 0; | ||
284 | |||
285 | wdt_data->wdd.timeout = pretimeout + timeout; | ||
286 | } | ||
287 | |||
288 | static int kempld_wdt_start(struct watchdog_device *wdd) | ||
289 | { | ||
290 | struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd); | ||
291 | struct kempld_device_data *pld = wdt_data->pld; | ||
292 | u8 status; | ||
293 | int ret; | ||
294 | |||
295 | ret = kempld_wdt_set_timeout(wdd, wdd->timeout); | ||
296 | if (ret) | ||
297 | return ret; | ||
298 | |||
299 | kempld_get_mutex(pld); | ||
300 | status = kempld_read8(pld, KEMPLD_WDT_CFG); | ||
301 | status |= KEMPLD_WDT_CFG_ENABLE; | ||
302 | kempld_write8(pld, KEMPLD_WDT_CFG, status); | ||
303 | status = kempld_read8(pld, KEMPLD_WDT_CFG); | ||
304 | kempld_release_mutex(pld); | ||
305 | |||
306 | /* Check if the watchdog was enabled */ | ||
307 | if (!(status & KEMPLD_WDT_CFG_ENABLE)) | ||
308 | return -EACCES; | ||
309 | |||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | static int kempld_wdt_stop(struct watchdog_device *wdd) | ||
314 | { | ||
315 | struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd); | ||
316 | struct kempld_device_data *pld = wdt_data->pld; | ||
317 | u8 status; | ||
318 | |||
319 | kempld_get_mutex(pld); | ||
320 | status = kempld_read8(pld, KEMPLD_WDT_CFG); | ||
321 | status &= ~KEMPLD_WDT_CFG_ENABLE; | ||
322 | kempld_write8(pld, KEMPLD_WDT_CFG, status); | ||
323 | status = kempld_read8(pld, KEMPLD_WDT_CFG); | ||
324 | kempld_release_mutex(pld); | ||
325 | |||
326 | /* Check if the watchdog was disabled */ | ||
327 | if (status & KEMPLD_WDT_CFG_ENABLE) | ||
328 | return -EACCES; | ||
329 | |||
330 | return 0; | ||
331 | } | ||
332 | |||
333 | static int kempld_wdt_keepalive(struct watchdog_device *wdd) | ||
334 | { | ||
335 | struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd); | ||
336 | struct kempld_device_data *pld = wdt_data->pld; | ||
337 | |||
338 | kempld_get_mutex(pld); | ||
339 | kempld_write8(pld, KEMPLD_WDT_KICK, 'K'); | ||
340 | kempld_release_mutex(pld); | ||
341 | |||
342 | return 0; | ||
343 | } | ||
344 | |||
345 | static long kempld_wdt_ioctl(struct watchdog_device *wdd, unsigned int cmd, | ||
346 | unsigned long arg) | ||
347 | { | ||
348 | struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd); | ||
349 | void __user *argp = (void __user *)arg; | ||
350 | int ret = -ENOIOCTLCMD; | ||
351 | int __user *p = argp; | ||
352 | int new_value; | ||
353 | |||
354 | switch (cmd) { | ||
355 | case WDIOC_SETPRETIMEOUT: | ||
356 | if (get_user(new_value, p)) | ||
357 | return -EFAULT; | ||
358 | ret = kempld_wdt_set_pretimeout(wdd, new_value); | ||
359 | if (ret) | ||
360 | return ret; | ||
361 | ret = kempld_wdt_keepalive(wdd); | ||
362 | break; | ||
363 | case WDIOC_GETPRETIMEOUT: | ||
364 | ret = put_user(wdt_data->pretimeout, (int *)arg); | ||
365 | break; | ||
366 | } | ||
367 | |||
368 | return ret; | ||
369 | } | ||
370 | |||
371 | static int kempld_wdt_probe_stages(struct watchdog_device *wdd) | ||
372 | { | ||
373 | struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd); | ||
374 | struct kempld_device_data *pld = wdt_data->pld; | ||
375 | struct kempld_wdt_stage *pretimeout_stage; | ||
376 | struct kempld_wdt_stage *timeout_stage; | ||
377 | u8 index, data, data_orig; | ||
378 | u32 mask; | ||
379 | int i, j; | ||
380 | |||
381 | pretimeout_stage = &wdt_data->stage[STAGE_PRETIMEOUT]; | ||
382 | timeout_stage = &wdt_data->stage[STAGE_TIMEOUT]; | ||
383 | |||
384 | pretimeout_stage->mask = 0; | ||
385 | timeout_stage->mask = 0; | ||
386 | |||
387 | for (i = 0; i < 3; i++) { | ||
388 | index = KEMPLD_WDT_STAGE_TIMEOUT(i); | ||
389 | mask = 0; | ||
390 | |||
391 | kempld_get_mutex(pld); | ||
392 | /* Probe each byte individually. */ | ||
393 | for (j = 0; j < 4; j++) { | ||
394 | data_orig = kempld_read8(pld, index + j); | ||
395 | kempld_write8(pld, index + j, 0x00); | ||
396 | data = kempld_read8(pld, index + j); | ||
397 | /* A failed write means this byte is reserved */ | ||
398 | if (data != 0x00) | ||
399 | break; | ||
400 | kempld_write8(pld, index + j, data_orig); | ||
401 | mask |= 0xff << (j * 8); | ||
402 | } | ||
403 | kempld_release_mutex(pld); | ||
404 | |||
405 | /* Assign available stages to timeout and pretimeout */ | ||
406 | if (!timeout_stage->mask) { | ||
407 | timeout_stage->mask = mask; | ||
408 | timeout_stage->id = i; | ||
409 | } else { | ||
410 | if (pld->feature_mask & KEMPLD_FEATURE_BIT_NMI) { | ||
411 | pretimeout_stage->mask = timeout_stage->mask; | ||
412 | timeout_stage->mask = mask; | ||
413 | pretimeout_stage->id = timeout_stage->id; | ||
414 | timeout_stage->id = i; | ||
415 | } | ||
416 | break; | ||
417 | } | ||
418 | } | ||
419 | |||
420 | if (!timeout_stage->mask) | ||
421 | return -ENODEV; | ||
422 | |||
423 | return 0; | ||
424 | } | ||
425 | |||
426 | static struct watchdog_info kempld_wdt_info = { | ||
427 | .identity = "KEMPLD Watchdog", | ||
428 | .options = WDIOF_SETTIMEOUT | | ||
429 | WDIOF_KEEPALIVEPING | | ||
430 | WDIOF_MAGICCLOSE | | ||
431 | WDIOF_PRETIMEOUT | ||
432 | }; | ||
433 | |||
434 | static struct watchdog_ops kempld_wdt_ops = { | ||
435 | .owner = THIS_MODULE, | ||
436 | .start = kempld_wdt_start, | ||
437 | .stop = kempld_wdt_stop, | ||
438 | .ping = kempld_wdt_keepalive, | ||
439 | .set_timeout = kempld_wdt_set_timeout, | ||
440 | .ioctl = kempld_wdt_ioctl, | ||
441 | }; | ||
442 | |||
443 | static int kempld_wdt_probe(struct platform_device *pdev) | ||
444 | { | ||
445 | struct kempld_device_data *pld = dev_get_drvdata(pdev->dev.parent); | ||
446 | struct kempld_wdt_data *wdt_data; | ||
447 | struct device *dev = &pdev->dev; | ||
448 | struct watchdog_device *wdd; | ||
449 | u8 status; | ||
450 | int ret = 0; | ||
451 | |||
452 | wdt_data = devm_kzalloc(dev, sizeof(*wdt_data), GFP_KERNEL); | ||
453 | if (!wdt_data) | ||
454 | return -ENOMEM; | ||
455 | |||
456 | wdt_data->pld = pld; | ||
457 | wdd = &wdt_data->wdd; | ||
458 | wdd->parent = dev; | ||
459 | |||
460 | kempld_get_mutex(pld); | ||
461 | status = kempld_read8(pld, KEMPLD_WDT_CFG); | ||
462 | kempld_release_mutex(pld); | ||
463 | |||
464 | /* Enable nowayout if watchdog is already locked */ | ||
465 | if (status & (KEMPLD_WDT_CFG_ENABLE_LOCK | | ||
466 | KEMPLD_WDT_CFG_GLOBAL_LOCK)) { | ||
467 | if (!nowayout) | ||
468 | dev_warn(dev, | ||
469 | "Forcing nowayout - watchdog lock enabled!\n"); | ||
470 | nowayout = true; | ||
471 | } | ||
472 | |||
473 | wdd->info = &kempld_wdt_info; | ||
474 | wdd->ops = &kempld_wdt_ops; | ||
475 | |||
476 | watchdog_set_drvdata(wdd, wdt_data); | ||
477 | watchdog_set_nowayout(wdd, nowayout); | ||
478 | |||
479 | ret = kempld_wdt_probe_stages(wdd); | ||
480 | if (ret) | ||
481 | return ret; | ||
482 | |||
483 | kempld_wdt_set_timeout(wdd, timeout); | ||
484 | kempld_wdt_set_pretimeout(wdd, pretimeout); | ||
485 | |||
486 | /* Check if watchdog is already enabled */ | ||
487 | if (status & KEMPLD_WDT_CFG_ENABLE) { | ||
488 | /* Get current watchdog settings */ | ||
489 | kempld_wdt_update_timeouts(wdt_data); | ||
490 | dev_info(dev, "Watchdog was already enabled\n"); | ||
491 | } | ||
492 | |||
493 | platform_set_drvdata(pdev, wdt_data); | ||
494 | ret = watchdog_register_device(wdd); | ||
495 | if (ret) | ||
496 | return ret; | ||
497 | |||
498 | dev_info(dev, "Watchdog registered with %ds timeout\n", wdd->timeout); | ||
499 | |||
500 | return 0; | ||
501 | } | ||
502 | |||
503 | static void kempld_wdt_shutdown(struct platform_device *pdev) | ||
504 | { | ||
505 | struct kempld_wdt_data *wdt_data = platform_get_drvdata(pdev); | ||
506 | |||
507 | kempld_wdt_stop(&wdt_data->wdd); | ||
508 | } | ||
509 | |||
510 | static int kempld_wdt_remove(struct platform_device *pdev) | ||
511 | { | ||
512 | struct kempld_wdt_data *wdt_data = platform_get_drvdata(pdev); | ||
513 | struct watchdog_device *wdd = &wdt_data->wdd; | ||
514 | int ret = 0; | ||
515 | |||
516 | if (!nowayout) | ||
517 | ret = kempld_wdt_stop(wdd); | ||
518 | watchdog_unregister_device(wdd); | ||
519 | |||
520 | return ret; | ||
521 | } | ||
522 | |||
523 | #ifdef CONFIG_PM | ||
524 | /* Disable watchdog if it is active during suspend */ | ||
525 | static int kempld_wdt_suspend(struct platform_device *pdev, | ||
526 | pm_message_t message) | ||
527 | { | ||
528 | struct kempld_wdt_data *wdt_data = platform_get_drvdata(pdev); | ||
529 | struct kempld_device_data *pld = wdt_data->pld; | ||
530 | struct watchdog_device *wdd = &wdt_data->wdd; | ||
531 | |||
532 | kempld_get_mutex(pld); | ||
533 | wdt_data->pm_status_store = kempld_read8(pld, KEMPLD_WDT_CFG); | ||
534 | kempld_release_mutex(pld); | ||
535 | |||
536 | kempld_wdt_update_timeouts(wdt_data); | ||
537 | |||
538 | if (wdt_data->pm_status_store & KEMPLD_WDT_CFG_ENABLE) | ||
539 | return kempld_wdt_stop(wdd); | ||
540 | |||
541 | return 0; | ||
542 | } | ||
543 | |||
544 | /* Enable watchdog and configure it if necessary */ | ||
545 | static int kempld_wdt_resume(struct platform_device *pdev) | ||
546 | { | ||
547 | struct kempld_wdt_data *wdt_data = platform_get_drvdata(pdev); | ||
548 | struct watchdog_device *wdd = &wdt_data->wdd; | ||
549 | |||
550 | /* | ||
551 | * If watchdog was stopped before suspend be sure it gets disabled | ||
552 | * again, for the case BIOS has enabled it during resume | ||
553 | */ | ||
554 | if (wdt_data->pm_status_store & KEMPLD_WDT_CFG_ENABLE) | ||
555 | return kempld_wdt_start(wdd); | ||
556 | else | ||
557 | return kempld_wdt_stop(wdd); | ||
558 | } | ||
559 | #else | ||
560 | #define kempld_wdt_suspend NULL | ||
561 | #define kempld_wdt_resume NULL | ||
562 | #endif | ||
563 | |||
564 | static struct platform_driver kempld_wdt_driver = { | ||
565 | .driver = { | ||
566 | .name = "kempld-wdt", | ||
567 | .owner = THIS_MODULE, | ||
568 | }, | ||
569 | .probe = kempld_wdt_probe, | ||
570 | .remove = kempld_wdt_remove, | ||
571 | .shutdown = kempld_wdt_shutdown, | ||
572 | .suspend = kempld_wdt_suspend, | ||
573 | .resume = kempld_wdt_resume, | ||
574 | }; | ||
575 | |||
576 | module_platform_driver(kempld_wdt_driver); | ||
577 | |||
578 | MODULE_DESCRIPTION("KEM PLD Watchdog Driver"); | ||
579 | MODULE_AUTHOR("Michael Brunner <michael.brunner@kontron.com>"); | ||
580 | MODULE_LICENSE("GPL"); | ||
581 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||