Lines Matching +full:duty +full:- +full:cycle
4 * SPDX-License-Identifier: Apache-2.0
46 /* PWM duty cycle register */
56 const struct pwm_it8801_config *config = dev->config; in pwm_enable()
60 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_mcr, in pwm_enable()
63 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_mcr, in pwm_enable()
88 const struct pwm_it8801_config *config = dev->config; in pwm_it8801_set_cycles()
89 int ch = config->channel, ret; in pwm_it8801_set_cycles()
90 uint8_t duty, mask; in pwm_it8801_set_cycles() local
92 /* Enable PWM output push-pull */ in pwm_it8801_set_cycles()
96 ret = i2c_reg_update_byte_dt(&config->i2c_dev, IT8801_REG_PWMODDSR, mask, mask); in pwm_it8801_set_cycles()
98 LOG_ERR("Failed to set push-pull (ret %d)", ret); in pwm_it8801_set_cycles()
103 /* Set PWM channel duty cycle */ in pwm_it8801_set_cycles()
105 duty = 0; in pwm_it8801_set_cycles()
107 duty = pulse_cycles * 256 / period_cycles - 1; in pwm_it8801_set_cycles()
109 LOG_DBG("IT8801 pwm duty cycles = %d", duty); in pwm_it8801_set_cycles()
111 ret = i2c_reg_write_byte_dt(&config->i2c_dev, config->reg_dcr, duty); in pwm_it8801_set_cycles()
125 const struct pwm_it8801_config *config = dev->config; in pwm_it8801_init()
128 /* Verify multi-function parent is ready */ in pwm_it8801_init()
129 if (!device_is_ready(config->mfd)) { in pwm_it8801_init()
130 LOG_ERR("(pwm)%s is not ready", config->mfd->name); in pwm_it8801_init()
131 return -ENODEV; in pwm_it8801_init()
137 for (int i = 0; i < config->mfdctrl_len; i++) { in pwm_it8801_init()
139 ret = mfd_it8801_configure_pins(&config->i2c_dev, config->altctrl[i].gpiocr, in pwm_it8801_init()
140 config->altctrl[i].pin, in pwm_it8801_init()
141 config->altctrl[i].alt_func); in pwm_it8801_init()