2 * Copyright (c) 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
5 * SPDX-License-Identifier: GPL-2.0+
12 * struct led_uc_plat - Platform data the uclass stores about each device
21 * struct led_uc_priv - Private data the uclass stores about each device
23 * @period_ms: Flash period in milliseconds
33 #ifdef CONFIG_LED_BLINK
42 * set_state() - set the state of an LED
44 * @dev: LED device to change
45 * @state: LED state to set
46 * @return 0 if OK, -ve on error
48 int (*set_state)(struct udevice *dev, enum led_state_t state);
51 * led_get_state() - get the state of an LED
53 * @dev: LED device to change
54 * @return LED state led_state_t, or -ve on error
56 enum led_state_t (*get_state)(struct udevice *dev);
58 #ifdef CONFIG_LED_BLINK
60 * led_set_period() - set the blink period of an LED
62 * Thie records the period if supported, or returns -ENOSYS if not.
63 * To start the LED blinking, use set_state().
65 * @dev: LED device to change
66 * @period_ms: LED blink period in milliseconds
67 * @return 0 if OK, -ve on error
69 int (*set_period)(struct udevice *dev, int period_ms);
73 #define led_get_ops(dev) ((struct led_ops *)(dev)->driver->ops)
76 * led_get_by_label() - Find an LED device by label
78 * @label: LED label to look up
79 * @devp: Returns the associated device, if found
80 * @return 0 if found, -ENODEV if not found, other -ve on error
82 int led_get_by_label(const char *label, struct udevice **devp);
85 * led_set_state() - set the state of an LED
87 * @dev: LED device to change
88 * @state: LED state to set
89 * @return 0 if OK, -ve on error
91 int led_set_state(struct udevice *dev, enum led_state_t state);
94 * led_get_state() - get the state of an LED
96 * @dev: LED device to change
97 * @return LED state led_state_t, or -ve on error
99 enum led_state_t led_get_state(struct udevice *dev);
102 * led_set_period() - set the blink period of an LED
104 * @dev: LED device to change
105 * @period_ms: LED blink period in milliseconds
106 * @return 0 if OK, -ve on error
108 int led_set_period(struct udevice *dev, int period_ms);