12 #include <linux/kernel.h>
19 #include <linux/slab.h>
20 #include <linux/module.h>
23 static const int isink_cur[] = {
90 #define to_wm8350_led(led_cdev) \
91 container_of(led_cdev, struct wm8350_led, cdev)
102 dev_err(led->
cdev.dev,
"Failed to enable ISINK: %d\n", ret);
108 dev_err(led->
cdev.dev,
"Failed to enable DCDC: %d\n", ret);
125 dev_err(led->
cdev.dev,
"Failed to disable DCDC: %d\n", ret);
131 dev_err(led->
cdev.dev,
"Failed to disable ISINK: %d\n", ret);
151 spin_unlock_irqrestore(&led->
value_lock, flags);
152 wm8350_led_disable(led);
162 spin_unlock_irqrestore(&led->
value_lock, flags);
171 wm8350_led_enable(led);
177 static void wm8350_led_set(
struct led_classdev *led_cdev,
186 spin_unlock_irqrestore(&led->
value_lock, flags);
191 struct wm8350_led *led = platform_get_drvdata(pdev);
195 wm8350_led_disable(led);
211 if (pdata->
max_uA < isink_cur[0]) {
212 dev_err(&pdev->
dev,
"Invalid maximum current %duA\n",
220 return PTR_ERR(isink);
226 return PTR_ERR(dcdc);
233 led->
cdev.brightness_set = wm8350_led_set;
241 for (i = 0; i <
ARRAY_SIZE(isink_cur) - 1; i++)
242 if (isink_cur[i] >= pdata->
max_uA)
245 if (pdata->
max_uA != isink_cur[i])
247 "Maximum current %duA is not directly supported,"
248 " check platform data\n",
255 platform_set_drvdata(pdev, led);
262 struct wm8350_led *led = platform_get_drvdata(pdev);
266 wm8350_led_disable(led);
272 .name =
"wm8350-led",
275 .probe = wm8350_led_probe,
276 .remove = wm8350_led_remove,
277 .shutdown = wm8350_led_shutdown,