svn commit: r366139 - head/sys/arm/allwinner
Andriy Gapon
avg at FreeBSD.org
Fri Sep 25 07:40:03 UTC 2020
Author: avg
Date: Fri Sep 25 07:40:02 2020
New Revision: 366139
URL: https://svnweb.freebsd.org/changeset/base/366139
Log:
aw_pwm: fix selection of the prescaler
Prescaling divides the frequency, not multiplies it.
MFC after: 2 weeks
Modified:
head/sys/arm/allwinner/aw_pwm.c
Modified: head/sys/arm/allwinner/aw_pwm.c
==============================================================================
--- head/sys/arm/allwinner/aw_pwm.c Fri Sep 25 07:39:41 2020 (r366138)
+++ head/sys/arm/allwinner/aw_pwm.c Fri Sep 25 07:40:02 2020 (r366139)
@@ -274,7 +274,7 @@ aw_pwm_channel_config(device_t dev, u_int channel, u_i
for (i = 0; i < nitems(aw_pwm_clk_prescaler); i++) {
if (aw_pwm_clk_prescaler[i] == 0)
continue;
- div = (AW_PWM_MAX_FREQ * aw_pwm_clk_prescaler[i]) / period_freq;
+ div = AW_PWM_MAX_FREQ / aw_pwm_clk_prescaler[i] / period_freq;
if ((div - 1) < AW_PWM_PERIOD_TOTAL_MASK ) {
prescaler = i;
clk_rate = AW_PWM_MAX_FREQ / aw_pwm_clk_prescaler[i];
More information about the svn-src-all
mailing list