Lines Matching +full:current +full:- +full:limit
2 * Copyright 2022-2023 Daniel DeGrasse <daniel@degrasse.com>
4 * SPDX-License-Identifier: Apache-2.0
36 #define GLOBAL_CURRENT_CTRL_REG 0x1 /* global current control register */
70 const struct is31fl3733_config *config = dev->config; in is31fl3733_select_page()
71 struct is31fl3733_data *data = dev->data; in is31fl3733_select_page()
74 if (data->selected_page == page) { in is31fl3733_select_page()
80 ret = i2c_reg_write_byte_dt(&config->bus, CMD_LOCK_REG, CMD_LOCK_UNLOCK); in is31fl3733_select_page()
87 ret = i2c_reg_write_byte_dt(&config->bus, CMD_SEL_REG, page); in is31fl3733_select_page()
92 data->selected_page = page; in is31fl3733_select_page()
99 const struct is31fl3733_config *config = dev->config; in is31fl3733_led_set_brightness()
104 return -EINVAL; in is31fl3733_led_set_brightness()
113 return i2c_reg_write_byte_dt(&config->bus, led, led_brightness); in is31fl3733_led_set_brightness()
129 const struct is31fl3733_config *config = dev->config; in is31fl3733_led_write_channels()
130 struct is31fl3733_data *data = dev->data; in is31fl3733_led_write_channels()
135 return -EINVAL; in is31fl3733_led_write_channels()
137 pwm_start = data->scratch_buf + start_channel; in is31fl3733_led_write_channels()
149 return i2c_write_dt(&config->bus, pwm_start, num_channels + 1); in is31fl3733_led_write_channels()
154 const struct is31fl3733_config *config = dev->config; in is31fl3733_init()
155 struct is31fl3733_data *data = dev->data; in is31fl3733_init()
159 if (!i2c_is_ready_dt(&config->bus)) { in is31fl3733_init()
161 return -ENODEV; in is31fl3733_init()
163 if (config->sdb.port != NULL) { in is31fl3733_init()
164 if (!gpio_is_ready_dt(&config->sdb)) { in is31fl3733_init()
166 return -ENODEV; in is31fl3733_init()
169 ret = gpio_pin_configure_dt(&config->sdb, GPIO_OUTPUT_ACTIVE); in is31fl3733_init()
183 ret = i2c_reg_read_byte_dt(&config->bus, RESET_REG, &dummy); in is31fl3733_init()
193 /* Set global current control register based off devicetree value */ in is31fl3733_init()
194 ret = i2c_reg_write_byte_dt(&config->bus, GLOBAL_CURRENT_CTRL_REG, in is31fl3733_init()
195 config->current_limit); in is31fl3733_init()
202 data->conf_reg = (config->sync << CONF_REG_SYNC_SHIFT) | CONF_REG_SSD_MASK; in is31fl3733_init()
203 ret = i2c_reg_write_byte_dt(&config->bus, CONF_REG, data->conf_reg); in is31fl3733_init()
209 data->scratch_buf[0] = 0x0; in is31fl3733_init()
210 memset(data->scratch_buf + 1, 0xFF, (IS31FL3733_MAX_LED / 8)); in is31fl3733_init()
216 return i2c_write_dt(&config->bus, data->scratch_buf, in is31fl3733_init()
226 * flicker-free display updates, or power saving.
234 const struct is31fl3733_config *config = dev->config; in is31fl3733_blank()
235 struct is31fl3733_data *data = dev->data; in is31fl3733_blank()
244 data->conf_reg &= ~CONF_REG_SSD_MASK; in is31fl3733_blank()
246 data->conf_reg |= CONF_REG_SSD_MASK; in is31fl3733_blank()
249 return i2c_reg_write_byte_dt(&config->bus, CONF_REG, data->conf_reg); in is31fl3733_blank()
253 * @brief Sets led current limit
255 * Sets the current limit for the LED driver. This is a separate value
256 * from per-led brightness, and applies to all LEDs.
257 * This value sets the output current limit according
258 * to the following formula: (840/R_ISET) * (limit/256)
261 * @param limit: current limit to apply
264 int is31fl3733_current_limit(const struct device *dev, uint8_t limit) in is31fl3733_current_limit() argument
266 const struct is31fl3733_config *config = dev->config; in is31fl3733_current_limit()
274 /* Set global current control register */ in is31fl3733_current_limit()
275 return i2c_reg_write_byte_dt(&config->bus, GLOBAL_CURRENT_CTRL_REG, limit); in is31fl3733_current_limit()