2 * Copyright (c) 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
5 * SPDX-License-Identifier: GPL-2.0+
13 #include <dm/uclass-internal.h>
15 int led_get_by_label(const char *label, struct udevice **devp)
21 ret = uclass_get(UCLASS_LED, &uc);
24 uclass_foreach_dev(dev, uc) {
25 struct led_uclass_plat *uc_plat = dev_get_uclass_platdata(dev);
27 /* Ignore the top-level LED node */
28 if (uc_plat->label && !strcmp(label, uc_plat->label))
29 return uclass_get_device_tail(dev, 0, devp);
35 int led_set_on(struct udevice *dev, int on)
37 struct led_ops *ops = led_get_ops(dev);
42 return ops->set_on(dev, on);
45 UCLASS_DRIVER(led) = {
48 .per_device_platdata_auto_alloc_size = sizeof(struct led_uclass_plat),