aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-07-27 09:45:55 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2009-09-17 03:46:58 -0400
commit63aed85e3535b4603798184cc941e49de386d354 (patch)
tree9fadb2c68ec7702327b725043c2e214e0263a154
parent7e9f9fd4b8285c52c0950a1929864346de5caa6d (diff)
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: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/wm831x-core.c15
-rw-r--r--include/linux/mfd/wm831x/pdata.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 42bef1dd2ca1..bc40ea315cc0 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1172,6 +1172,12 @@ static struct mfd_cell wm8312_devs[] = {
1172 }, 1172 },
1173}; 1173};
1174 1174
1175static struct mfd_cell backlight_devs[] = {
1176 {
1177 .name = "wm831x-backlight",
1178 },
1179};
1180
1175/* 1181/*
1176 * Instantiate the generic non-control parts of the device. 1182 * Instantiate the generic non-control parts of the device.
1177 */ 1183 */
@@ -1325,6 +1331,15 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1325 goto err_irq; 1331 goto err_irq;
1326 } 1332 }
1327 1333
1334 if (pdata && pdata->backlight) {
1335 /* Treat errors as non-critical */
1336 ret = mfd_add_devices(wm831x->dev, -1, backlight_devs,
1337 ARRAY_SIZE(backlight_devs), NULL, 0);
1338 if (ret < 0)
1339 dev_err(wm831x->dev, "Failed to add backlight: %d\n",
1340 ret);
1341 }
1342
1328 if (pdata && pdata->post_init) { 1343 if (pdata && pdata->post_init) {
1329 ret = pdata->post_init(wm831x); 1344 ret = pdata->post_init(wm831x);
1330 if (ret != 0) { 1345 if (ret != 0) {
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index 571e60136264..90d820260aad 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -18,6 +18,11 @@
18struct wm831x; 18struct wm831x;
19struct regulator_init_data; 19struct regulator_init_data;
20 20
21struct wm831x_backlight_pdata {
22 int isink; /** ISINK to use, 1 or 2 */
23 int max_uA; /** Maximum current to allow */
24};
25
21struct wm831x_backup_pdata { 26struct wm831x_backup_pdata {
22 int charger_enable; 27 int charger_enable;
23 int no_constant_voltage; /** Disable constant voltage charging */ 28 int no_constant_voltage; /** Disable constant voltage charging */
@@ -87,6 +92,7 @@ struct wm831x_pdata {
87 int (*post_init)(struct wm831x *wm831x); 92 int (*post_init)(struct wm831x *wm831x);
88 93
89 int gpio_base; 94 int gpio_base;
95 struct wm831x_backlight_pdata *backlight;
90 struct wm831x_backup_pdata *backup; 96 struct wm831x_backup_pdata *backup;
91 struct wm831x_battery_pdata *battery; 97 struct wm831x_battery_pdata *battery;
92 struct wm831x_touch_pdata *touch; 98 struct wm831x_touch_pdata *touch;