aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2014-05-24 05:35:57 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-06-17 11:04:47 -0400
commit3a370222b0c514360863ec79c1481dffbbf1ddab (patch)
treef2315765635caa6362d0c6430e7ed0d4254046a9
parent3c1e7f27561038d683f519a5fb723743e7b8e83b (diff)
[media] lmedm04: rs2000 check if interrupt urb is over due
Change handling of signal_lock on rs2000. Use ibuf[2] to detect lock as there is a longer wait for lock to appear in ibuf[6]. Remove last_key and key_timeout and use jiffies plus 60ms to detect that streaming is still active. If the current jiffies is time_after the interrupt urb overdue and clear signal lock. This results in far faster recovery of lock and streaming. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/usb/dvb-usb-v2/lmedm04.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index f674dc024d06..7d685bc8c2c0 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -125,14 +125,13 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
125#define TUNER_RS2000 0x4 125#define TUNER_RS2000 0x4
126 126
127struct lme2510_state { 127struct lme2510_state {
128 unsigned long int_urb_due;
128 u8 id; 129 u8 id;
129 u8 tuner_config; 130 u8 tuner_config;
130 u8 signal_lock; 131 u8 signal_lock;
131 u8 signal_level; 132 u8 signal_level;
132 u8 signal_sn; 133 u8 signal_sn;
133 u8 time_key; 134 u8 time_key;
134 u8 last_key;
135 u8 key_timeout;
136 u8 i2c_talk_onoff; 135 u8 i2c_talk_onoff;
137 u8 i2c_gate; 136 u8 i2c_gate;
138 u8 i2c_tuner_gate_w; 137 u8 i2c_tuner_gate_w;
@@ -323,7 +322,7 @@ static void lme2510_int_response(struct urb *lme_urb)
323 } 322 }
324 break; 323 break;
325 case TUNER_RS2000: 324 case TUNER_RS2000:
326 if (ibuf[1] == 0x3 && ibuf[6] == 0xff) 325 if (ibuf[2] & 0x1)
327 st->signal_lock = 0xff; 326 st->signal_lock = 0xff;
328 else 327 else
329 st->signal_lock = 0x00; 328 st->signal_lock = 0x00;
@@ -343,7 +342,12 @@ static void lme2510_int_response(struct urb *lme_urb)
343 break; 342 break;
344 } 343 }
345 } 344 }
345
346 usb_submit_urb(lme_urb, GFP_ATOMIC); 346 usb_submit_urb(lme_urb, GFP_ATOMIC);
347
348 /* interrupt urb is due every 48 msecs while streaming
349 * add 12msecs for system lag */
350 st->int_urb_due = jiffies + msecs_to_jiffies(60);
347} 351}
348 352
349static int lme2510_int_read(struct dvb_usb_adapter *adap) 353static int lme2510_int_read(struct dvb_usb_adapter *adap)
@@ -584,14 +588,13 @@ static int lme2510_msg(struct dvb_usb_device *d,
584 switch (wbuf[3]) { 588 switch (wbuf[3]) {
585 case 0x8c: 589 case 0x8c:
586 rbuf[0] = 0x55; 590 rbuf[0] = 0x55;
587 rbuf[1] = 0xff; 591 rbuf[1] = st->signal_lock;
588 if (st->last_key == st->time_key) { 592
589 st->key_timeout++; 593 /* If int_urb_due overdue
590 if (st->key_timeout > 5) 594 * set rbuf[1] to 0 to clear lock */
591 rbuf[1] = 0; 595 if (time_after(jiffies, st->int_urb_due))
592 } else 596 rbuf[1] = 0;
593 st->key_timeout = 0; 597
594 st->last_key = st->time_key;
595 break; 598 break;
596 default: 599 default:
597 lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); 600 lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);