Lines Matching full:led
12 * @brief LED driver for the TLC59108 I2C LED driver
16 #include <zephyr/drivers/led.h>
25 /* TLC59108 max supported LED id */
28 /* TLC59108 select registers determine the source that drives LED outputs */
29 #define TLC59108_LED_OFF 0x0 /* LED driver off */
30 #define TLC59108_LED_ON 0x1 /* LED driver on */
60 static int tlc59108_set_ledout(const struct device *dev, uint32_t led, in tlc59108_set_ledout() argument
65 if (led < 4) { in tlc59108_set_ledout()
67 TLC59108_MASK << (led << 1), val << (led << 1))) { in tlc59108_set_ledout()
68 LOG_ERR("LED reg 0x%x update failed", TLC59108_LEDOUT0); in tlc59108_set_ledout()
73 TLC59108_MASK << ((led - 4) << 1), in tlc59108_set_ledout()
74 val << ((led - 4) << 1))) { in tlc59108_set_ledout()
75 LOG_ERR("LED reg 0x%x update failed", TLC59108_LEDOUT1); in tlc59108_set_ledout()
83 static int tlc59108_led_blink(const struct device *dev, uint32_t led, in tlc59108_led_blink() argument
94 if (led > TLC59108_MAX_LED) { in tlc59108_led_blink()
110 LOG_ERR("LED reg 0x%x write failed", TLC59108_GRPPWM); in tlc59108_led_blink()
122 LOG_ERR("LED reg 0x%x write failed", TLC59108_GRPFREQ); in tlc59108_led_blink()
129 LOG_ERR("LED reg 0x%x update failed", TLC59108_MODE2); in tlc59108_led_blink()
133 /* Select the GRPPWM source to drive the LED output */ in tlc59108_led_blink()
134 return tlc59108_set_ledout(dev, led, TLC59108_LED_GRP_PWM); in tlc59108_led_blink()
137 static int tlc59108_led_set_brightness(const struct device *dev, uint32_t led, in tlc59108_led_set_brightness() argument
145 if (led > TLC59108_MAX_LED) { in tlc59108_led_set_brightness()
154 /* Set the LED brightness value */ in tlc59108_led_set_brightness()
156 if (i2c_reg_write_byte_dt(&config->i2c, TLC59108_PWM_BASE + led, val)) { in tlc59108_led_set_brightness()
157 LOG_ERR("LED 0x%x reg write failed", TLC59108_PWM_BASE + led); in tlc59108_led_set_brightness()
161 /* Set the LED driver to be controlled through its PWMx register. */ in tlc59108_led_set_brightness()
162 return tlc59108_set_ledout(dev, led, TLC59108_LED_PWM); in tlc59108_led_set_brightness()
165 static inline int tlc59108_led_on(const struct device *dev, uint32_t led) in tlc59108_led_on() argument
167 if (led > TLC59108_MAX_LED) { in tlc59108_led_on()
171 /* Set LED state to ON */ in tlc59108_led_on()
172 return tlc59108_set_ledout(dev, led, TLC59108_LED_ON); in tlc59108_led_on()
175 static inline int tlc59108_led_off(const struct device *dev, uint32_t led) in tlc59108_led_off() argument
177 if (led > TLC59108_MAX_LED) { in tlc59108_led_off()
181 /* Set LED state to OFF */ in tlc59108_led_off()
182 return tlc59108_set_ledout(dev, led, TLC59108_LED_OFF); in tlc59108_led_off()
198 LOG_ERR("LED reg 0x%x update failed", TLC59108_MODE1); in tlc59108_led_init()
211 static DEVICE_API(led, tlc59108_led_api) = {