summaryrefslogtreecommitdiff
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-08-06 15:25:52 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-08-20 09:55:48 -0400
commite5e26439d1c46c8a201b0d05c719e33f0f091802 (patch)
treed4ad1aa893c13fe975129104f50392b2040003b0 /drivers/media/rc
parent4fe055ecfc0a597e19dc159cf5289fd8f18ef9e3 (diff)
media: rc-core: improve ir_raw_store_edge() handling
The gpio-ir-recv driver does many wakeups (once per edge); the saa7134 driver has special handling to only wakeup 15ms after the first edge. Make this part of rc-core so gpio-ir-recv also benefits from this (so a rc-5 keypress now causes 3 wakeups rather than 24). Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/rc-core-priv.h2
-rw-r--r--drivers/media/rc/rc-ir-raw.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index b3e7cac2c3ee..cae13efc1a88 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -43,6 +43,8 @@ struct ir_raw_event_ctrl {
ktime_t last_event; /* when last event occurred */
enum raw_event_type last_type; /* last event type */
struct rc_dev *dev; /* pointer to the parent rc_dev */
+ /* edge driver */
+ struct timer_list edge_handle;
/* raw decoder state follows */
struct ir_raw_event prev_ev;
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index b6d256f03847..07a694298119 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -133,6 +133,11 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type)
dev->raw->last_event = now;
dev->raw->last_type = type;
+
+ if (!timer_pending(&dev->raw->edge_handle))
+ mod_timer(&dev->raw->edge_handle,
+ jiffies + msecs_to_jiffies(15));
+
return rc;
}
EXPORT_SYMBOL_GPL(ir_raw_event_store_edge);
@@ -483,6 +488,13 @@ int ir_raw_encode_scancode(enum rc_type protocol, u32 scancode,
}
EXPORT_SYMBOL(ir_raw_encode_scancode);
+static void edge_handle(unsigned long arg)
+{
+ struct rc_dev *dev = (struct rc_dev *)arg;
+
+ ir_raw_event_handle(dev);
+}
+
/*
* Used to (un)register raw event clients
*/
@@ -504,6 +516,8 @@ int ir_raw_event_prepare(struct rc_dev *dev)
dev->raw->dev = dev;
dev->change_protocol = change_protocol;
+ setup_timer(&dev->raw->edge_handle, edge_handle,
+ (unsigned long)dev);
INIT_KFIFO(dev->raw->kfifo);
return 0;
@@ -555,6 +569,7 @@ void ir_raw_event_unregister(struct rc_dev *dev)
return;
kthread_stop(dev->raw->thread);
+ del_timer_sync(&dev->raw->edge_handle);
mutex_lock(&ir_raw_handler_lock);
list_del(&dev->raw->list);