From: Hans Verkuil <hans.verk...@cisco.com> The CEC protocol has a keypress timeout of 550ms. Add support for this.
Note: this really should be defined in a protocol struct. Signed-off-by: Hans Verkuil <hans.verk...@cisco.com> --- drivers/media/rc/rc-main.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index a9eba0013525..073407a78f70 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -33,6 +33,9 @@ /* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */ #define IR_KEYPRESS_TIMEOUT 250 +/* The CEC protocol needs a timeout of 550 */ +#define IR_KEYPRESS_CEC_TIMEOUT 550 + /* Used to keep track of known keymaps */ static LIST_HEAD(rc_map_list); static DEFINE_SPINLOCK(rc_map_lock); @@ -622,7 +625,12 @@ void rc_repeat(struct rc_dev *dev) if (!dev->keypressed) goto out; - dev->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); + if (dev->last_protocol == RC_TYPE_CEC) + dev->keyup_jiffies = jiffies + + msecs_to_jiffies(IR_KEYPRESS_CEC_TIMEOUT); + else + dev->keyup_jiffies = jiffies + + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); mod_timer(&dev->timer_keyup, dev->keyup_jiffies); out: @@ -692,7 +700,12 @@ void rc_keydown(struct rc_dev *dev, enum rc_type protocol, u32 scancode, u8 togg ir_do_keydown(dev, protocol, scancode, keycode, toggle); if (dev->keypressed) { - dev->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); + if (protocol == RC_TYPE_CEC) + dev->keyup_jiffies = jiffies + + msecs_to_jiffies(IR_KEYPRESS_CEC_TIMEOUT); + else + dev->keyup_jiffies = jiffies + + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); mod_timer(&dev->timer_keyup, dev->keyup_jiffies); } spin_unlock_irqrestore(&dev->keylock, flags); -- 2.13.2