Lines Matching +full:led +full:- +full:duty +full:- +full:cycle

4  * SPDX-License-Identifier: Apache-2.0
11 * @brief LP5569 LED controller
13 * The LP5569 is a 9-channel LED driver that communicates over I2C.
17 #include <zephyr/drivers/led.h>
34 /* PWM base Register for controlling the duty-cycle */
41 static int lp5569_led_set_brightness(const struct device *dev, uint32_t led, in lp5569_led_set_brightness() argument
44 const struct lp5569_config *config = dev->config; in lp5569_led_set_brightness()
48 if (led >= LP5569_NUM_LEDS || brightness > 100) { in lp5569_led_set_brightness()
49 return -EINVAL; in lp5569_led_set_brightness()
52 /* Map 0-100 % to 0-255 pwm register value */ in lp5569_led_set_brightness()
55 ret = i2c_reg_write_byte_dt(&config->bus, LP5569_LED0_PWM + led, val); in lp5569_led_set_brightness()
57 LOG_ERR("LED reg update failed"); in lp5569_led_set_brightness()
64 static inline int lp5569_led_on(const struct device *dev, uint32_t led) in lp5569_led_on() argument
66 /* Set LED brightness to 100 % */ in lp5569_led_on()
67 return lp5569_led_set_brightness(dev, led, 100); in lp5569_led_on()
70 static inline int lp5569_led_off(const struct device *dev, uint32_t led) in lp5569_led_off() argument
72 /* Set LED brightness to 0 % */ in lp5569_led_off()
73 return lp5569_led_set_brightness(dev, led, 0); in lp5569_led_off()
78 const struct lp5569_config *config = dev->config; in lp5569_enable()
81 if (!i2c_is_ready_dt(&config->bus)) { in lp5569_enable()
83 return -ENODEV; in lp5569_enable()
86 ret = i2c_reg_write_byte_dt(&config->bus, LP5569_CONFIG, in lp5569_enable()
93 ret = i2c_reg_write_byte_dt(&config->bus, LP5569_MISC, in lp5569_enable()
96 LOG_ERR("LED reg update failed"); in lp5569_enable()
110 LOG_INF("Init %s as PM_DEVICE_STATE_OFF", dev->name); in lp5569_init()
121 const struct lp5569_config *config = dev->config; in lp5569_pm_action()
135 ret = i2c_reg_update_byte_dt(&config->bus, LP5569_CONFIG, in lp5569_pm_action()
143 return -ENOTSUP; in lp5569_pm_action()