aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm8994-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/wm8994-core.c')
-rw-r--r--drivers/mfd/wm8994-core.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 844e1c1b7d90..39cde82afb48 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -172,9 +172,34 @@ static struct mfd_cell wm8994_regulator_devs[] = {
172 { .name = "wm8994-ldo", .id = 2 }, 172 { .name = "wm8994-ldo", .id = 2 },
173}; 173};
174 174
175static struct resource wm8994_codec_resources[] = {
176 {
177 .start = WM8994_IRQ_TEMP_SHUT,
178 .end = WM8994_IRQ_TEMP_WARN,
179 .flags = IORESOURCE_IRQ,
180 },
181};
182
183static struct resource wm8994_gpio_resources[] = {
184 {
185 .start = WM8994_IRQ_GPIO(1),
186 .end = WM8994_IRQ_GPIO(11),
187 .flags = IORESOURCE_IRQ,
188 },
189};
190
175static struct mfd_cell wm8994_devs[] = { 191static struct mfd_cell wm8994_devs[] = {
176 { .name = "wm8994-codec" }, 192 {
177 { .name = "wm8994-gpio" }, 193 .name = "wm8994-codec",
194 .num_resources = ARRAY_SIZE(wm8994_codec_resources),
195 .resources = wm8994_codec_resources,
196 },
197
198 {
199 .name = "wm8994-gpio",
200 .num_resources = ARRAY_SIZE(wm8994_gpio_resources),
201 .resources = wm8994_gpio_resources,
202 },
178}; 203};
179 204
180/* 205/*
@@ -235,6 +260,11 @@ static int wm8994_device_resume(struct device *dev)
235 return ret; 260 return ret;
236 } 261 }
237 262
263 ret = wm8994_write(wm8994, WM8994_INTERRUPT_STATUS_1_MASK,
264 WM8994_NUM_IRQ_REGS * 2, &wm8994->irq_masks_cur);
265 if (ret < 0)
266 dev_err(dev, "Failed to restore interrupt masks: %d\n", ret);
267
238 ret = wm8994_write(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS * 2, 268 ret = wm8994_write(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS * 2,
239 &wm8994->ldo_regs); 269 &wm8994->ldo_regs);
240 if (ret < 0) 270 if (ret < 0)
@@ -347,6 +377,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
347 377
348 378
349 if (pdata) { 379 if (pdata) {
380 wm8994->irq_base = pdata->irq_base;
350 wm8994->gpio_base = pdata->gpio_base; 381 wm8994->gpio_base = pdata->gpio_base;
351 382
352 /* GPIO configuration is only applied if it's non-zero */ 383 /* GPIO configuration is only applied if it's non-zero */
@@ -374,16 +405,20 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
374 WM8994_LDO1_DISCH, 0); 405 WM8994_LDO1_DISCH, 0);
375 } 406 }
376 407
408 wm8994_irq_init(wm8994);
409
377 ret = mfd_add_devices(wm8994->dev, -1, 410 ret = mfd_add_devices(wm8994->dev, -1,
378 wm8994_devs, ARRAY_SIZE(wm8994_devs), 411 wm8994_devs, ARRAY_SIZE(wm8994_devs),
379 NULL, 0); 412 NULL, 0);
380 if (ret != 0) { 413 if (ret != 0) {
381 dev_err(wm8994->dev, "Failed to add children: %d\n", ret); 414 dev_err(wm8994->dev, "Failed to add children: %d\n", ret);
382 goto err_enable; 415 goto err_irq;
383 } 416 }
384 417
385 return 0; 418 return 0;
386 419
420err_irq:
421 wm8994_irq_exit(wm8994);
387err_enable: 422err_enable:
388 regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies), 423 regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
389 wm8994->supplies); 424 wm8994->supplies);
@@ -400,6 +435,7 @@ err:
400static void wm8994_device_exit(struct wm8994 *wm8994) 435static void wm8994_device_exit(struct wm8994 *wm8994)
401{ 436{
402 mfd_remove_devices(wm8994->dev); 437 mfd_remove_devices(wm8994->dev);
438 wm8994_irq_exit(wm8994);
403 regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies), 439 regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
404 wm8994->supplies); 440 wm8994->supplies);
405 regulator_bulk_free(ARRAY_SIZE(wm8994_main_supplies), wm8994->supplies); 441 regulator_bulk_free(ARRAY_SIZE(wm8994_main_supplies), wm8994->supplies);
@@ -468,6 +504,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c,
468 wm8994->control_data = i2c; 504 wm8994->control_data = i2c;
469 wm8994->read_dev = wm8994_i2c_read_device; 505 wm8994->read_dev = wm8994_i2c_read_device;
470 wm8994->write_dev = wm8994_i2c_write_device; 506 wm8994->write_dev = wm8994_i2c_write_device;
507 wm8994->irq = i2c->irq;
471 508
472 return wm8994_device_init(wm8994, id->driver_data, i2c->irq); 509 return wm8994_device_init(wm8994, id->driver_data, i2c->irq);
473} 510}