Commit 63aed85e authored by Mark Brown's avatar Mark Brown Committed by Samuel Ortiz

mfd: Conditionally add WM831x backlight subdevice

The WM831x backlight driver requires at least the specification of the
current sink to use and a maximum current to allow them to function and
will actively interfere with other users of the regulators it uses if
misconfigured so only register the subdevice for it if this platform
data has been supplied.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 7e9f9fd4
...@@ -1172,6 +1172,12 @@ static struct mfd_cell wm8312_devs[] = { ...@@ -1172,6 +1172,12 @@ static struct mfd_cell wm8312_devs[] = {
}, },
}; };
static struct mfd_cell backlight_devs[] = {
{
.name = "wm831x-backlight",
},
};
/* /*
* Instantiate the generic non-control parts of the device. * Instantiate the generic non-control parts of the device.
*/ */
...@@ -1325,6 +1331,15 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) ...@@ -1325,6 +1331,15 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
goto err_irq; goto err_irq;
} }
if (pdata && pdata->backlight) {
/* Treat errors as non-critical */
ret = mfd_add_devices(wm831x->dev, -1, backlight_devs,
ARRAY_SIZE(backlight_devs), NULL, 0);
if (ret < 0)
dev_err(wm831x->dev, "Failed to add backlight: %d\n",
ret);
}
if (pdata && pdata->post_init) { if (pdata && pdata->post_init) {
ret = pdata->post_init(wm831x); ret = pdata->post_init(wm831x);
if (ret != 0) { if (ret != 0) {
......
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
struct wm831x; struct wm831x;
struct regulator_init_data; struct regulator_init_data;
struct wm831x_backlight_pdata {
int isink; /** ISINK to use, 1 or 2 */
int max_uA; /** Maximum current to allow */
};
struct wm831x_backup_pdata { struct wm831x_backup_pdata {
int charger_enable; int charger_enable;
int no_constant_voltage; /** Disable constant voltage charging */ int no_constant_voltage; /** Disable constant voltage charging */
...@@ -87,6 +92,7 @@ struct wm831x_pdata { ...@@ -87,6 +92,7 @@ struct wm831x_pdata {
int (*post_init)(struct wm831x *wm831x); int (*post_init)(struct wm831x *wm831x);
int gpio_base; int gpio_base;
struct wm831x_backlight_pdata *backlight;
struct wm831x_backup_pdata *backup; struct wm831x_backup_pdata *backup;
struct wm831x_battery_pdata *battery; struct wm831x_battery_pdata *battery;
struct wm831x_touch_pdata *touch; struct wm831x_touch_pdata *touch;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment