diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2017-03-17 10:05:18 +0000 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2017-03-23 11:45:50 +0000 |
commit | f6dd8449cd50de25881b76cecf1086bebeb11fe8 (patch) | |
tree | fa757139b73dc9a8e79e46952d93db19dd5e8068 /drivers/mfd/wm831x-core.c | |
parent | c1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201 (diff) |
mfd: wm831x: Add basic device tree binding
Add the basic ability to register the device through device tree, more
work is needed to get each individual sub-driver functioning correctly
but this is enough to get the device to probe from device tree.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/wm831x-core.c')
-rw-r--r-- | drivers/mfd/wm831x-core.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 3e0e99ec5836..13a4c1190dca 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c @@ -19,6 +19,8 @@ #include <linux/mfd/core.h> #include <linux/slab.h> #include <linux/err.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <linux/mfd/wm831x/core.h> #include <linux/mfd/wm831x/pdata.h> @@ -1613,12 +1615,24 @@ struct regmap_config wm831x_regmap_config = { }; EXPORT_SYMBOL_GPL(wm831x_regmap_config); +const struct of_device_id wm831x_of_match[] = { + { .compatible = "wlf,wm8310", .data = (void *)WM8310 }, + { .compatible = "wlf,wm8311", .data = (void *)WM8311 }, + { .compatible = "wlf,wm8312", .data = (void *)WM8312 }, + { .compatible = "wlf,wm8320", .data = (void *)WM8320 }, + { .compatible = "wlf,wm8321", .data = (void *)WM8321 }, + { .compatible = "wlf,wm8325", .data = (void *)WM8325 }, + { .compatible = "wlf,wm8326", .data = (void *)WM8326 }, + { }, +}; +EXPORT_SYMBOL_GPL(wm831x_of_match); + /* * Instantiate the generic non-control parts of the device. */ -int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) +int wm831x_device_init(struct wm831x *wm831x, int irq) { - struct wm831x_pdata *pdata = dev_get_platdata(wm831x->dev); + struct wm831x_pdata *pdata = &wm831x->pdata; int rev, wm831x_num; enum wm831x_parent parent; int ret, i; @@ -1627,8 +1641,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) mutex_init(&wm831x->key_lock); dev_set_drvdata(wm831x->dev, wm831x); - if (pdata) - wm831x->soft_shutdown = pdata->soft_shutdown; + wm831x->soft_shutdown = pdata->soft_shutdown; ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID); if (ret < 0) { @@ -1663,7 +1676,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) */ if (ret == 0) { dev_info(wm831x->dev, "Device is an engineering sample\n"); - ret = id; + ret = wm831x->type; } switch (ret) { @@ -1736,9 +1749,9 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) /* This will need revisiting in future but is OK for all * current parts. */ - if (parent != id) - dev_warn(wm831x->dev, "Device was registered as a WM%lx\n", - id); + if (parent != wm831x->type) + dev_warn(wm831x->dev, "Device was registered as a WM%x\n", + wm831x->type); /* Bootstrap the user key */ ret = wm831x_reg_read(wm831x, WM831X_SECURITY_KEY); |