Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mark Brown and committed by
Samuel Ortiz
63aed85e 7e9f9fd4

+21
+15
drivers/mfd/wm831x-core.c
··· 1172 1172 }, 1173 1173 }; 1174 1174 1175 + static struct mfd_cell backlight_devs[] = { 1176 + { 1177 + .name = "wm831x-backlight", 1178 + }, 1179 + }; 1180 + 1175 1181 /* 1176 1182 * Instantiate the generic non-control parts of the device. 1177 1183 */ ··· 1329 1323 if (ret != 0) { 1330 1324 dev_err(wm831x->dev, "Failed to add children\n"); 1331 1325 goto err_irq; 1326 + } 1327 + 1328 + if (pdata && pdata->backlight) { 1329 + /* Treat errors as non-critical */ 1330 + ret = mfd_add_devices(wm831x->dev, -1, backlight_devs, 1331 + ARRAY_SIZE(backlight_devs), NULL, 0); 1332 + if (ret < 0) 1333 + dev_err(wm831x->dev, "Failed to add backlight: %d\n", 1334 + ret); 1332 1335 } 1333 1336 1334 1337 if (pdata && pdata->post_init) {
+6
include/linux/mfd/wm831x/pdata.h
··· 18 18 struct wm831x; 19 19 struct regulator_init_data; 20 20 21 + struct wm831x_backlight_pdata { 22 + int isink; /** ISINK to use, 1 or 2 */ 23 + int max_uA; /** Maximum current to allow */ 24 + }; 25 + 21 26 struct wm831x_backup_pdata { 22 27 int charger_enable; 23 28 int no_constant_voltage; /** Disable constant voltage charging */ ··· 92 87 int (*post_init)(struct wm831x *wm831x); 93 88 94 89 int gpio_base; 90 + struct wm831x_backlight_pdata *backlight; 95 91 struct wm831x_backup_pdata *backup; 96 92 struct wm831x_battery_pdata *battery; 97 93 struct wm831x_touch_pdata *touch;