]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: rtl28xxu: fix idle handling
authorSean Young <sean@mess.org>
Sat, 31 Aug 2019 08:37:39 +0000 (05:37 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 7 Oct 2019 10:42:43 +0000 (07:42 -0300)
Currently the IR receiver is put into idle mode after each interrupt.
However longer IR like NEC can be distributed over multiple interrupts,
so putting the IR into idle in the middle of such a message will break
decoding.

Every IR message has a trailing space of 0xbf (one less than
IR_IDE_LEN{0,1} which is programmed to 0xc0). So, set the timeout to that
value and rc-core will put the IR receiver into idle mode automatically.

Thanks to Jan Pieter van Woerkom <jp@jpvw.nl> for providing the hardware.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/dvb-usb-v2/dvb_usb.h
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
drivers/media/usb/dvb-usb-v2/rtl28xxu.c

index b874a49ececff5bb47ba7174f71a98fce0cd9251..52bcc2d2efe5d4c0b1842adf47563829712111d3 100644 (file)
@@ -121,6 +121,7 @@ struct dvb_usb_driver_info {
  * @interval: time in ms between two queries
  * @driver_type: used to point if a device supports raw mode
  * @bulk_mode: device supports bulk mode for rc (disable polling mode)
+ * @timeout: set to length of last space before raw IR goes idle
  */
 struct dvb_usb_rc {
        const char *map_name;
@@ -130,6 +131,7 @@ struct dvb_usb_rc {
        unsigned int interval;
        enum rc_driver_type driver_type;
        bool bulk_mode;
+       int timeout;
 };
 
 /**
index e5e056bf9dfa4b29b24f53aba0a8968d951a52bd..f1c79f351ec8de1bb13fbecc110a33243161888d 100644 (file)
@@ -150,6 +150,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
        dev->map_name = d->rc.map_name;
        dev->allowed_protocols = d->rc.allowed_protos;
        dev->change_protocol = d->rc.change_protocol;
+       dev->timeout = d->rc.timeout;
        dev->priv = d;
 
        ret = rc_register_device(dev);
index 78ad9adfbeacad32dfe0876df0f7a75f9ad407fb..5016ede7b35f788f2e6718f2a026eda1a2f8d209 100644 (file)
@@ -1781,7 +1781,6 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
        }
 
        /* 'flush' ir_raw_event_store_with_filter() */
-       ir_raw_event_set_idle(d->rc_dev, true);
        ir_raw_event_handle(d->rc_dev);
 exit:
        return ret;
@@ -1804,6 +1803,8 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
        rc->driver_type = RC_DRIVER_IR_RAW;
        rc->query = rtl2832u_rc_query;
        rc->interval = 200;
+       /* we program idle len to 0xc0, set timeout to one less */
+       rc->timeout = 0xbf * 50800;
 
        return 0;
 }