summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2020-05-02 15:50:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-03 12:24:23 +0300
commit0961d7fe12491b474546952e25b441b9e56915c6 (patch)
treedc350525f0ecf40a28e7674c96d233698ed25b8c /drivers
parent70323cca909d68ec88d44141a357b4c77e194492 (diff)
downloadlinux-0961d7fe12491b474546952e25b441b9e56915c6.tar.xz
media: gpio-ir-tx: improve precision of transmitted signal due to scheduling
[ Upstream commit ea8912b788f8144e7d32ee61e5ccba45424bef83 ] 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/rc/gpio-ir-tx.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/media/rc/gpio-ir-tx.c b/drivers/media/rc/gpio-ir-tx.c
index cd476cab9782..4e70b67ccd18 100644
--- a/drivers/media/rc/gpio-ir-tx.c
+++ b/drivers/media/rc/gpio-ir-tx.c
@@ -87,13 +87,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]);