Skip to content
Commit 11fc4edc authored by Sean Young's avatar Sean Young Committed by Thierry Reding
Browse files

pwm: bcm2835: Improve precision of PWM



If sending IR with carrier of 455kHz using the pwm-ir-tx driver, the
carrier ends up being 476kHz. The clock is set to bcm2835-pwm with a
rate of 10MHz.

A carrier of 455kHz has a period of 2198ns, but the arithmetic truncates
this to 2100ns rather than 2200ns. So, use DIV_ROUND_CLOSEST() to reduce
rounding errors, and we have a much more accurate carrier of 454.5kHz.

Reported-by: default avatarAndreas Christ <andreas@christ-faesch.ch>
Signed-off-by: default avatarSean Young <sean@mess.org>
Acked-by: default avatarStefan Wahren <wahrenst@gmx.net>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 3f467ebe
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment