mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
pwm: rp1: Correct period off-by-1 error
Correct the set_period method to pass (period - 1), as required by the PIO state machine. Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This commit is contained in:
@@ -83,7 +83,7 @@ static inline void pwm_program_init(PIO pio, uint sm, uint offset, uint pin)
|
|||||||
/* Write `period` to the input shift register - must be disabled */
|
/* Write `period` to the input shift register - must be disabled */
|
||||||
static void pio_pwm_set_period(PIO pio, uint sm, uint32_t period)
|
static void pio_pwm_set_period(PIO pio, uint sm, uint32_t period)
|
||||||
{
|
{
|
||||||
pio_sm_put_blocking(pio, sm, period);
|
pio_sm_put_blocking(pio, sm, period - 1);
|
||||||
pio_sm_exec(pio, sm, pio_encode_pull(false, false));
|
pio_sm_exec(pio, sm, pio_encode_pull(false, false));
|
||||||
pio_sm_exec(pio, sm, pio_encode_out(pio_isr, 32));
|
pio_sm_exec(pio, sm, pio_encode_out(pio_isr, 32));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user