Commit ea8912b7 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

media: gpio-ir-tx: improve precision of transmitted signal due to scheduling

usleep_range() may take longer than the max argument due to scheduling,
especially under load. This is causing random errors in the transmitted
IR. Remove the usleep_range() in favour of busy-looping with udelay().
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 0e06a071
......@@ -79,13 +79,8 @@ static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
// space
edge = ktime_add_us(edge, txbuf[i]);
delta = ktime_us_delta(edge, ktime_get());
if (delta > 10) {
spin_unlock_irqrestore(&gpio_ir->lock, flags);
usleep_range(delta, delta + 10);
spin_lock_irqsave(&gpio_ir->lock, flags);
} else if (delta > 0) {
if (delta > 0)
udelay(delta);
}
} else {
// pulse
ktime_t last = ktime_add_us(edge, txbuf[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment