aw_pwm: fix programming of the period
The programmed value is biased by one: 0 means 1 cycle, 1 means 2 cycles, etc. MFC after: 3 weeks
This commit is contained in:
parent
1c2c602a17
commit
fc1ec731c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366140
@ -293,7 +293,7 @@ aw_pwm_channel_config(device_t dev, u_int channel, u_int period, u_int duty)
|
||||
AW_PWM_WRITE(sc, AW_PWM_CTRL, reg);
|
||||
|
||||
/* Write the total/active cycles */
|
||||
reg = ((clk_rate / period_freq) << AW_PWM_PERIOD_TOTAL_SHIFT) |
|
||||
reg = ((clk_rate / period_freq - 1) << AW_PWM_PERIOD_TOTAL_SHIFT) |
|
||||
((clk_rate / duty_freq) << AW_PWM_PERIOD_ACTIVE_SHIFT);
|
||||
AW_PWM_WRITE(sc, AW_PWM_PERIOD, reg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user