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

4  * SPDX-License-Identifier: Apache-2.0
21 const struct vcnl4040_config *config = dev->config; in vcnl4040_read()
25 ret = i2c_write_read_dt(&config->i2c, in vcnl4040_read()
37 const struct vcnl4040_config *config = dev->config; in vcnl4040_write()
44 ret = i2c_write_dt(&config->i2c, buf, sizeof(buf)); in vcnl4040_write()
56 struct vcnl4040_data *data = dev->data; in vcnl4040_sample_fetch()
66 k_mutex_lock(&data->mutex, K_FOREVER); in vcnl4040_sample_fetch()
70 &data->proximity); in vcnl4040_sample_fetch()
79 &data->light); in vcnl4040_sample_fetch()
86 k_mutex_unlock(&data->mutex); in vcnl4040_sample_fetch()
95 struct vcnl4040_data *data = dev->data; in vcnl4040_channel_get()
98 k_mutex_lock(&data->mutex, K_FOREVER); in vcnl4040_channel_get()
102 val->val1 = data->proximity; in vcnl4040_channel_get()
103 val->val2 = 0; in vcnl4040_channel_get()
108 val->val1 = data->light * data->sensitivity; in vcnl4040_channel_get()
109 val->val2 = 0; in vcnl4040_channel_get()
114 ret = -ENOTSUP; in vcnl4040_channel_get()
117 k_mutex_unlock(&data->mutex); in vcnl4040_channel_get()
124 const struct vcnl4040_config *config = dev->config; in vcnl4040_reg_setup()
130 struct vcnl4040_data *data = dev->data; in vcnl4040_reg_setup()
133 value[VCNL4040_REG_ALS_CONF] = config->als_it << VCNL4040_ALS_IT_POS; in vcnl4040_reg_setup()
142 switch (config->als_it) { in vcnl4040_reg_setup()
144 data->sensitivity = 0.12; in vcnl4040_reg_setup()
147 data->sensitivity = 0.06; in vcnl4040_reg_setup()
150 data->sensitivity = 0.03; in vcnl4040_reg_setup()
153 data->sensitivity = 0.015; in vcnl4040_reg_setup()
156 data->sensitivity = 1.0; in vcnl4040_reg_setup()
158 config->als_it); in vcnl4040_reg_setup()
167 /* Set duty cycle */ in vcnl4040_reg_setup()
168 value[VCNL4040_REG_PS_CONF] |= config->led_dc << VCNL4040_PS_DUTY_POS; in vcnl4040_reg_setup()
170 value[VCNL4040_REG_PS_CONF] |= config->proxy_it << VCNL4040_PS_IT_POS; in vcnl4040_reg_setup()
174 /* Set LED current */ in vcnl4040_reg_setup()
175 value[VCNL4040_REG_PS_MS] = config->led_i << VCNL4040_LED_I_POS; in vcnl4040_reg_setup()
245 return -ENOTSUP; in vcnl4040_pm_action()
254 const struct vcnl4040_config *config = dev->config; in vcnl4040_init()
255 struct vcnl4040_data *data = dev->data; in vcnl4040_init()
259 if (!device_is_ready(config->i2c.bus)) { in vcnl4040_init()
261 return -ENODEV; in vcnl4040_init()
267 return -EIO; in vcnl4040_init()
272 return -EIO; in vcnl4040_init()
277 return -EIO; in vcnl4040_init()
280 k_mutex_init(&data->mutex); in vcnl4040_init()
285 return -EIO; in vcnl4040_init()