Skip to content

Commit

Permalink
media: gpio-ir-tx: improve precision of transmitted signal due to sch…
Browse files Browse the repository at this point in the history
…eduling

[ Upstream commit ea8912b ]

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: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
seanyoung authored and gregkh committed Sep 3, 2020
1 parent 6ba0470 commit 8f409e7
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/media/rc/gpio-ir-tx.c
Expand Up @@ -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]);
Expand Down

0 comments on commit 8f409e7

Please sign in to comment.