ITE drivers/pwm: fix target frequency below 324Hz on it8xxx2

after the second times will not operating in correct output frequency.

Signed-off-by: Richard Yim <yimjiajun@icloud.com>
This commit is contained in:
Richard Yim 2022-06-24 16:54:09 +08:00 committed by Carles Cufí
commit 1b4e5b8d35

View file

@ -141,8 +141,11 @@ static int pwm_it8xxx2_set_cycles(const struct device *dev,
* <=324Hz in board dts. Now change prescaler clock source from 8MHz to
* 32.768KHz to support pwm output in mode.
*/
if ((target_freq <= 324) && (inst->PCFSR & BIT(prs_sel))) {
inst->PCFSR &= ~BIT(prs_sel);
if (target_freq <= 324) {
if (inst->PCFSR & BIT(prs_sel)) {
inst->PCFSR &= ~BIT(prs_sel);
}
pwm_clk_src = (uint64_t) 32768;
}