ITE: drivers/pwm: Add the flag of PWM output open-drain mode

This flag is used when the PWM output is set to open-drain mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
This commit is contained in:
Tim Lin 2023-08-23 13:33:47 +08:00 committed by Carles Cufí
commit ed37374dac
4 changed files with 27 additions and 0 deletions

View file

@ -106,6 +106,11 @@ static int pwm_it8xxx2_set_cycles(const struct device *dev,
*reg_pwmpol &= ~BIT(ch);
}
/* Enable PWM output open-drain */
if (flags & PWM_IT8XXX2_OPEN_DRAIN) {
inst->PWMODENR |= BIT(ch);
}
/* If pulse cycles is 0, set duty cycle 0 and enable pwm channel */
if (pulse_cycles == 0) {
*reg_dcr = 0;