RE: Re-tune channels after errors - Mygica T230 DVB-T2 ยป linux-media-revert-cxusb-geniatech-t230-resync-ts-fifo-after-lock.patch
drivers/media/usb/dvb-usb/cxusb.c | ||
---|---|---|
369 | 369 |
return 0; |
370 | 370 |
} |
371 | 371 | |
372 |
static int cxusb_read_status(struct dvb_frontend *fe, |
|
373 |
enum fe_status *status) |
|
374 |
{ |
|
375 |
struct dvb_usb_adapter *adap = (struct dvb_usb_adapter *)fe->dvb->priv; |
|
376 |
struct cxusb_state *state = (struct cxusb_state *)adap->dev->priv; |
|
377 |
int ret; |
|
378 | ||
379 |
ret = state->fe_read_status(fe, status); |
|
380 | ||
381 |
/* it need resync slave fifo when signal change from unlock to lock.*/ |
|
382 |
if ((*status & FE_HAS_LOCK) && (!state->last_lock)) { |
|
383 |
mutex_lock(&state->stream_mutex); |
|
384 |
cxusb_streaming_ctrl(adap, 1); |
|
385 |
mutex_unlock(&state->stream_mutex); |
|
386 |
} |
|
387 | ||
388 |
state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0; |
|
389 |
return ret; |
|
390 |
} |
|
391 | ||
392 | 372 |
static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d) |
393 | 373 |
{ |
394 | 374 |
int ep = d->props.generic_bulk_ctrl_endpoint; |
... | ... | |
1392 | 1372 | |
1393 | 1373 |
st->i2c_client_tuner = client_tuner; |
1394 | 1374 | |
1395 |
/* hook fe: need to resync the slave fifo when signal locks. */ |
|
1396 |
mutex_init(&st->stream_mutex); |
|
1397 |
st->last_lock = 0; |
|
1398 |
st->fe_read_status = adap->fe_adap[0].fe->ops.read_status; |
|
1399 |
adap->fe_adap[0].fe->ops.read_status = cxusb_read_status; |
|
1400 | ||
1401 | 1375 |
return 0; |
1402 | 1376 |
} |
1403 | 1377 |
drivers/media/usb/dvb-usb/cxusb.h | ||
---|---|---|
37 | 37 |
struct i2c_client *i2c_client_tuner; |
38 | 38 | |
39 | 39 |
unsigned char data[MAX_XFER_SIZE]; |
40 | ||
41 |
struct mutex stream_mutex; |
|
42 |
u8 last_lock; |
|
43 |
int (*fe_read_status)(struct dvb_frontend *fe, |
|
44 |
enum fe_status *status); |
|
45 | 40 |
}; |
46 | 41 | |
47 | 42 |
#endif |