Date: Sat, 21 Sep 2019 23:15:48 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-arm@FreeBSD.org Subject: [Bug 240740] aw_pwm - clk_rate may be never found Message-ID: <bug-240740-7@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240740 Bug ID: 240740 Summary: aw_pwm - clk_rate may be never found Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: arm Assignee: freebsd-arm@FreeBSD.org Reporter: k.lewandowski@me.com I found this when I was looking at aw_pwm.c code, I tried to contact manu@ but never got any feedback. Suspected line is: https://github.com/freebsd/freebsd/blob/master/sys/arm/allwinner/aw_pwm.c#L276 If 'div' does not fit '0xffff' (prescaler == 1) at the beginning: ... div = AW_PWM_MAX_FREQ / period_freq; if ((div - 1) > AW_PWM_PERIOD_TOTAL_MASK) { ... then traversing prescalers and multiplying freq: ... div = (AW_PWM_MAX_FREQ * aw_pwm_clk_prescaler[i]) / period_freq; ... will make the 'div' even bigger and this condition: ... if ((div - 1) < AW_PWM_PERIOD_TOTAL_MASK ) ... will never be met. Shouldn't prescaler be used to divide the AW_PWM_MAX_FREQ instead? And with prescalers visited in increasing order eventually best match would be found? I may be wrong though, just wanted to check, -- Krystian -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240740-7>
