[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>
This commit is contained in:
Malcolm Priestley 2014-05-24 06:35:57 -03:00 коммит произвёл Mauro Carvalho Chehab
Родитель 3c1e7f2756
Коммит 3a370222b0
1 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -125,14 +125,13 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#define TUNER_RS2000 0x4 #define TUNER_RS2000 0x4
struct lme2510_state { struct lme2510_state {
unsigned long int_urb_due;
u8 id; u8 id;
u8 tuner_config; u8 tuner_config;
u8 signal_lock; u8 signal_lock;
u8 signal_level; u8 signal_level;
u8 signal_sn; u8 signal_sn;
u8 time_key; u8 time_key;
u8 last_key;
u8 key_timeout;
u8 i2c_talk_onoff; u8 i2c_talk_onoff;
u8 i2c_gate; u8 i2c_gate;
u8 i2c_tuner_gate_w; u8 i2c_tuner_gate_w;
@ -323,7 +322,7 @@ static void lme2510_int_response(struct urb *lme_urb)
} }
break; break;
case TUNER_RS2000: case TUNER_RS2000:
if (ibuf[1] == 0x3 && ibuf[6] == 0xff) if (ibuf[2] & 0x1)
st->signal_lock = 0xff; st->signal_lock = 0xff;
else else
st->signal_lock = 0x00; st->signal_lock = 0x00;
@ -343,7 +342,12 @@ static void lme2510_int_response(struct urb *lme_urb)
break; break;
} }
} }
usb_submit_urb(lme_urb, GFP_ATOMIC); usb_submit_urb(lme_urb, GFP_ATOMIC);
/* interrupt urb is due every 48 msecs while streaming
* add 12msecs for system lag */
st->int_urb_due = jiffies + msecs_to_jiffies(60);
} }
static int lme2510_int_read(struct dvb_usb_adapter *adap) static int lme2510_int_read(struct dvb_usb_adapter *adap)
@ -584,14 +588,13 @@ static int lme2510_msg(struct dvb_usb_device *d,
switch (wbuf[3]) { switch (wbuf[3]) {
case 0x8c: case 0x8c:
rbuf[0] = 0x55; rbuf[0] = 0x55;
rbuf[1] = 0xff; rbuf[1] = st->signal_lock;
if (st->last_key == st->time_key) {
st->key_timeout++; /* If int_urb_due overdue
if (st->key_timeout > 5) * set rbuf[1] to 0 to clear lock */
rbuf[1] = 0; if (time_after(jiffies, st->int_urb_due))
} else rbuf[1] = 0;
st->key_timeout = 0;
st->last_key = st->time_key;
break; break;
default: default:
lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);