diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-05-20 06:00:43 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-05-20 06:00:43 -0400 |
commit | d71f4cece4bd97d05592836202fc04ff2e7817e3 (patch) | |
tree | 6c877c7a938758b1323d9c97d46b9c536e618c69 /drivers/mfd/wm8994-core.c | |
parent | 19008bdacb9f7841166ebafe0aef361ee582ffbf (diff) | |
parent | ad8332c1302bcb4f80d593fd3eb477be9d7f5604 (diff) |
Merge branch 'topic/asoc' into for-linus
Conflicts:
sound/soc/codecs/ad1938.c
Diffstat (limited to 'drivers/mfd/wm8994-core.c')
-rw-r--r-- | drivers/mfd/wm8994-core.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index cc524df10aa..ec71c936890 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -173,9 +173,34 @@ static struct mfd_cell wm8994_regulator_devs[] = { | |||
173 | { .name = "wm8994-ldo", .id = 2 }, | 173 | { .name = "wm8994-ldo", .id = 2 }, |
174 | }; | 174 | }; |
175 | 175 | ||
176 | static struct resource wm8994_codec_resources[] = { | ||
177 | { | ||
178 | .start = WM8994_IRQ_TEMP_SHUT, | ||
179 | .end = WM8994_IRQ_TEMP_WARN, | ||
180 | .flags = IORESOURCE_IRQ, | ||
181 | }, | ||
182 | }; | ||
183 | |||
184 | static struct resource wm8994_gpio_resources[] = { | ||
185 | { | ||
186 | .start = WM8994_IRQ_GPIO(1), | ||
187 | .end = WM8994_IRQ_GPIO(11), | ||
188 | .flags = IORESOURCE_IRQ, | ||
189 | }, | ||
190 | }; | ||
191 | |||
176 | static struct mfd_cell wm8994_devs[] = { | 192 | static struct mfd_cell wm8994_devs[] = { |
177 | { .name = "wm8994-codec" }, | 193 | { |
178 | { .name = "wm8994-gpio" }, | 194 | .name = "wm8994-codec", |
195 | .num_resources = ARRAY_SIZE(wm8994_codec_resources), | ||
196 | .resources = wm8994_codec_resources, | ||
197 | }, | ||
198 | |||
199 | { | ||
200 | .name = "wm8994-gpio", | ||
201 | .num_resources = ARRAY_SIZE(wm8994_gpio_resources), | ||
202 | .resources = wm8994_gpio_resources, | ||
203 | }, | ||
179 | }; | 204 | }; |
180 | 205 | ||
181 | /* | 206 | /* |
@@ -236,6 +261,11 @@ static int wm8994_device_resume(struct device *dev) | |||
236 | return ret; | 261 | return ret; |
237 | } | 262 | } |
238 | 263 | ||
264 | ret = wm8994_write(wm8994, WM8994_INTERRUPT_STATUS_1_MASK, | ||
265 | WM8994_NUM_IRQ_REGS * 2, &wm8994->irq_masks_cur); | ||
266 | if (ret < 0) | ||
267 | dev_err(dev, "Failed to restore interrupt masks: %d\n", ret); | ||
268 | |||
239 | ret = wm8994_write(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS * 2, | 269 | ret = wm8994_write(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS * 2, |
240 | &wm8994->ldo_regs); | 270 | &wm8994->ldo_regs); |
241 | if (ret < 0) | 271 | if (ret < 0) |
@@ -348,6 +378,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq) | |||
348 | 378 | ||
349 | 379 | ||
350 | if (pdata) { | 380 | if (pdata) { |
381 | wm8994->irq_base = pdata->irq_base; | ||
351 | wm8994->gpio_base = pdata->gpio_base; | 382 | wm8994->gpio_base = pdata->gpio_base; |
352 | 383 | ||
353 | /* GPIO configuration is only applied if it's non-zero */ | 384 | /* GPIO configuration is only applied if it's non-zero */ |
@@ -375,16 +406,20 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq) | |||
375 | WM8994_LDO1_DISCH, 0); | 406 | WM8994_LDO1_DISCH, 0); |
376 | } | 407 | } |
377 | 408 | ||
409 | wm8994_irq_init(wm8994); | ||
410 | |||
378 | ret = mfd_add_devices(wm8994->dev, -1, | 411 | ret = mfd_add_devices(wm8994->dev, -1, |
379 | wm8994_devs, ARRAY_SIZE(wm8994_devs), | 412 | wm8994_devs, ARRAY_SIZE(wm8994_devs), |
380 | NULL, 0); | 413 | NULL, 0); |
381 | if (ret != 0) { | 414 | if (ret != 0) { |
382 | dev_err(wm8994->dev, "Failed to add children: %d\n", ret); | 415 | dev_err(wm8994->dev, "Failed to add children: %d\n", ret); |
383 | goto err_enable; | 416 | goto err_irq; |
384 | } | 417 | } |
385 | 418 | ||
386 | return 0; | 419 | return 0; |
387 | 420 | ||
421 | err_irq: | ||
422 | wm8994_irq_exit(wm8994); | ||
388 | err_enable: | 423 | err_enable: |
389 | regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies), | 424 | regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies), |
390 | wm8994->supplies); | 425 | wm8994->supplies); |
@@ -401,6 +436,7 @@ err: | |||
401 | static void wm8994_device_exit(struct wm8994 *wm8994) | 436 | static void wm8994_device_exit(struct wm8994 *wm8994) |
402 | { | 437 | { |
403 | mfd_remove_devices(wm8994->dev); | 438 | mfd_remove_devices(wm8994->dev); |
439 | wm8994_irq_exit(wm8994); | ||
404 | regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies), | 440 | regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies), |
405 | wm8994->supplies); | 441 | wm8994->supplies); |
406 | regulator_bulk_free(ARRAY_SIZE(wm8994_main_supplies), wm8994->supplies); | 442 | regulator_bulk_free(ARRAY_SIZE(wm8994_main_supplies), wm8994->supplies); |
@@ -469,6 +505,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c, | |||
469 | wm8994->control_data = i2c; | 505 | wm8994->control_data = i2c; |
470 | wm8994->read_dev = wm8994_i2c_read_device; | 506 | wm8994->read_dev = wm8994_i2c_read_device; |
471 | wm8994->write_dev = wm8994_i2c_write_device; | 507 | wm8994->write_dev = wm8994_i2c_write_device; |
508 | wm8994->irq = i2c->irq; | ||
472 | 509 | ||
473 | return wm8994_device_init(wm8994, id->driver_data, i2c->irq); | 510 | return wm8994_device_init(wm8994, id->driver_data, i2c->irq); |
474 | } | 511 | } |