mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
pwm: meson: Consider 128 a valid pre-divider
The pre-divider allows configuring longer PWM periods compared to using
the input clock directly. The pre-divider is 7 bit wide, meaning it's
maximum value is 128 (the register value is off-by-one: 0x7f or 127).
Change the loop to also allow for the maximum possible value to be
considered valid.
Fixes: 211ed63075 ("pwm: Add support for Meson PWM Controller")
Signed-off-by: Martin Blumenstingl <[email protected]>
Acked-by: Uwe Kleine-König <[email protected]>
Reviewed-by: Neil Armstrong <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
This commit is contained in:
parent
9ff06679e1
commit
51496e4446
1 changed files with 2 additions and 2 deletions
|
|
@ -184,7 +184,7 @@ static int meson_pwm_calc(struct meson_pwm *meson,
|
|||
do_div(fin_ps, fin_freq);
|
||||
|
||||
/* Calc pre_div with the period */
|
||||
for (pre_div = 0; pre_div < MISC_CLK_DIV_MASK; pre_div++) {
|
||||
for (pre_div = 0; pre_div <= MISC_CLK_DIV_MASK; pre_div++) {
|
||||
cnt = DIV_ROUND_CLOSEST_ULL((u64)period * 1000,
|
||||
fin_ps * (pre_div + 1));
|
||||
dev_dbg(meson->chip.dev, "fin_ps=%llu pre_div=%u cnt=%u\n",
|
||||
|
|
@ -193,7 +193,7 @@ static int meson_pwm_calc(struct meson_pwm *meson,
|
|||
break;
|
||||
}
|
||||
|
||||
if (pre_div == MISC_CLK_DIV_MASK) {
|
||||
if (pre_div > MISC_CLK_DIV_MASK) {
|
||||
dev_err(meson->chip.dev, "unable to get period pre_div\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue