aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/wm8350-core.c12
-rw-r--r--drivers/mfd/wm8350-i2c.c2
-rw-r--r--include/linux/mfd/wm8350/core.h14
3 files changed, 25 insertions, 3 deletions
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index c7552c0b7797..071834ba6954 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -388,7 +388,8 @@ out:
388} 388}
389EXPORT_SYMBOL_GPL(wm8350_create_cache); 389EXPORT_SYMBOL_GPL(wm8350_create_cache);
390 390
391int wm8350_device_init(struct wm8350 *wm8350) 391int wm8350_device_init(struct wm8350 *wm8350,
392 struct wm8350_platform_data *pdata)
392{ 393{
393 int ret = -EINVAL; 394 int ret = -EINVAL;
394 u16 id1, id2, mask, mode; 395 u16 id1, id2, mask, mode;
@@ -439,6 +440,15 @@ int wm8350_device_init(struct wm8350 *wm8350)
439 return ret; 440 return ret;
440 } 441 }
441 442
443 if (pdata->init) {
444 ret = pdata->init(wm8350);
445 if (ret != 0) {
446 dev_err(wm8350->dev, "Platform init() failed: %d\n",
447 ret);
448 goto err;
449 }
450 }
451
442 return 0; 452 return 0;
443 453
444err: 454err:
diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c
index 2b0569cf9512..245b790961aa 100644
--- a/drivers/mfd/wm8350-i2c.c
+++ b/drivers/mfd/wm8350-i2c.c
@@ -65,7 +65,7 @@ static int wm8350_i2c_probe(struct i2c_client *i2c,
65 wm8350->read_dev = wm8350_i2c_read_device; 65 wm8350->read_dev = wm8350_i2c_read_device;
66 wm8350->write_dev = wm8350_i2c_write_device; 66 wm8350->write_dev = wm8350_i2c_write_device;
67 67
68 ret = wm8350_device_init(wm8350); 68 ret = wm8350_device_init(wm8350, i2c->dev.platform_data);
69 if (ret < 0) 69 if (ret < 0)
70 goto err; 70 goto err;
71 71
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 94778c1669dc..8f2beae6278e 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -564,10 +564,22 @@ struct wm8350 {
564 u16 *reg_cache; 564 u16 *reg_cache;
565}; 565};
566 566
567/**
568 * Data to be supplied by the platform to initialise the WM8350.
569 *
570 * @init: Function called during driver initialisation. Should be
571 * used by the platform to configure GPIO functions and similar.
572 */
573struct wm8350_platform_data {
574 int (*init)(struct wm8350 *wm8350);
575};
576
577
567/* 578/*
568 * WM8350 device initialisation and exit. 579 * WM8350 device initialisation and exit.
569 */ 580 */
570int wm8350_device_init(struct wm8350 *wm8350); 581int wm8350_device_init(struct wm8350 *wm8350,
582 struct wm8350_platform_data *pdata);
571void wm8350_device_exit(struct wm8350 *wm8350); 583void wm8350_device_exit(struct wm8350 *wm8350);
572 584
573/* 585/*