Commit f961e71a authored by Alex Woods's avatar Alex Woods Committed by Mauro Carvalho Chehab

V4L/DVB (3154): TTUSB DEC driver patch roundup

- Collection of patches from Peter Beutner addressing:
- add symbolrates to the DVB-S frontend description
- fix capability flags in DVB-S frontend describtion
- remove some void casts
- disable zig-zag scanning as it makes no sense for DVB-T
- set sensible min_delay value
- return an error for requested filter types the driver can't handle
Signed-off-by: default avatarPeter Beutner <p.beutner@gmx.net>
Signed-off-by: default avatarAlex Woods <linux-dvb@giblets.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
parent e4acba3c
...@@ -369,7 +369,7 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode, ...@@ -369,7 +369,7 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode,
static int ttusb_dec_audio_pes2ts_cb(void *priv, unsigned char *data) static int ttusb_dec_audio_pes2ts_cb(void *priv, unsigned char *data)
{ {
struct ttusb_dec *dec = (struct ttusb_dec *)priv; struct ttusb_dec *dec = priv;
dec->audio_filter->feed->cb.ts(data, 188, NULL, 0, dec->audio_filter->feed->cb.ts(data, 188, NULL, 0,
&dec->audio_filter->feed->feed.ts, &dec->audio_filter->feed->feed.ts,
...@@ -380,7 +380,7 @@ static int ttusb_dec_audio_pes2ts_cb(void *priv, unsigned char *data) ...@@ -380,7 +380,7 @@ static int ttusb_dec_audio_pes2ts_cb(void *priv, unsigned char *data)
static int ttusb_dec_video_pes2ts_cb(void *priv, unsigned char *data) static int ttusb_dec_video_pes2ts_cb(void *priv, unsigned char *data)
{ {
struct ttusb_dec *dec = (struct ttusb_dec *)priv; struct ttusb_dec *dec = priv;
dec->video_filter->feed->cb.ts(data, 188, NULL, 0, dec->video_filter->feed->cb.ts(data, 188, NULL, 0,
&dec->video_filter->feed->feed.ts, &dec->video_filter->feed->feed.ts,
...@@ -965,8 +965,8 @@ static int ttusb_dec_start_ts_feed(struct dvb_demux_feed *dvbdmxfeed) ...@@ -965,8 +965,8 @@ static int ttusb_dec_start_ts_feed(struct dvb_demux_feed *dvbdmxfeed)
case DMX_TS_PES_TELETEXT: case DMX_TS_PES_TELETEXT:
dec->pid[DMX_PES_TELETEXT] = dvbdmxfeed->pid; dec->pid[DMX_PES_TELETEXT] = dvbdmxfeed->pid;
dprintk(" pes_type: DMX_TS_PES_TELETEXT\n"); dprintk(" pes_type: DMX_TS_PES_TELETEXT(not supported)\n");
break; return -ENOSYS;
case DMX_TS_PES_PCR: case DMX_TS_PES_PCR:
dprintk(" pes_type: DMX_TS_PES_PCR\n"); dprintk(" pes_type: DMX_TS_PES_PCR\n");
...@@ -975,8 +975,8 @@ static int ttusb_dec_start_ts_feed(struct dvb_demux_feed *dvbdmxfeed) ...@@ -975,8 +975,8 @@ static int ttusb_dec_start_ts_feed(struct dvb_demux_feed *dvbdmxfeed)
break; break;
case DMX_TS_PES_OTHER: case DMX_TS_PES_OTHER:
dprintk(" pes_type: DMX_TS_PES_OTHER\n"); dprintk(" pes_type: DMX_TS_PES_OTHER(not supported)\n");
break; return -ENOSYS;
default: default:
dprintk(" pes_type: unknown (%d)\n", dvbdmxfeed->pes_type); dprintk(" pes_type: unknown (%d)\n", dvbdmxfeed->pes_type);
...@@ -1395,6 +1395,7 @@ static int ttusb_dec_init_stb(struct ttusb_dec *dec) ...@@ -1395,6 +1395,7 @@ static int ttusb_dec_init_stb(struct ttusb_dec *dec)
/* We can't trust the USB IDs that some firmwares /* We can't trust the USB IDs that some firmwares
give the box */ give the box */
switch (model) { switch (model) {
case 0x00070001:
case 0x00070008: case 0x00070008:
case 0x0007000c: case 0x0007000c:
ttusb_dec_set_model(dec, TTUSB_DEC3000S); ttusb_dec_set_model(dec, TTUSB_DEC3000S);
...@@ -1588,7 +1589,7 @@ static int fe_send_command(struct dvb_frontend* fe, const u8 command, ...@@ -1588,7 +1589,7 @@ static int fe_send_command(struct dvb_frontend* fe, const u8 command,
int param_length, const u8 params[], int param_length, const u8 params[],
int *result_length, u8 cmd_result[]) int *result_length, u8 cmd_result[])
{ {
struct ttusb_dec* dec = (struct ttusb_dec*) fe->dvb->priv; struct ttusb_dec* dec = fe->dvb->priv;
return ttusb_dec_send_command(dec, command, param_length, params, result_length, cmd_result); return ttusb_dec_send_command(dec, command, param_length, params, result_length, cmd_result);
} }
......
...@@ -42,8 +42,39 @@ struct ttusbdecfe_state { ...@@ -42,8 +42,39 @@ struct ttusbdecfe_state {
static int ttusbdecfe_read_status(struct dvb_frontend* fe, fe_status_t* status) static int ttusbdecfe_read_status(struct dvb_frontend* fe, fe_status_t* status)
{ {
struct ttusbdecfe_state* state = fe->demodulator_priv;
u8 b[] = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
u8 result[4];
int len, ret;
*status=0;
ret=state->config->send_command(fe, 0x73, sizeof(b), b, &len, result);
if(ret)
return ret;
if(len != 4) {
printk(KERN_ERR "%s: unexpected reply\n", __FUNCTION__);
return -EIO;
}
switch(result[3]) {
case 1: /* not tuned yet */
case 2: /* no signal/no lock*/
break;
case 3: /* signal found and locked*/
*status = FE_HAS_SIGNAL | FE_HAS_VITERBI | *status = FE_HAS_SIGNAL | FE_HAS_VITERBI |
FE_HAS_SYNC | FE_HAS_CARRIER | FE_HAS_LOCK; FE_HAS_SYNC | FE_HAS_CARRIER | FE_HAS_LOCK;
break;
case 4:
*status = FE_TIMEDOUT;
break;
default:
pr_info("%s: returned unknown value: %d\n",
__FUNCTION__, result[3]);
return -EIO;
}
return 0; return 0;
} }
...@@ -64,6 +95,16 @@ static int ttusbdecfe_dvbt_set_frontend(struct dvb_frontend* fe, struct dvb_fron ...@@ -64,6 +95,16 @@ static int ttusbdecfe_dvbt_set_frontend(struct dvb_frontend* fe, struct dvb_fron
return 0; return 0;
} }
static int ttusbdecfe_dvbt_get_tune_settings(struct dvb_frontend* fe,
struct dvb_frontend_tune_settings* fesettings)
{
fesettings->min_delay_ms = 1500;
/* Drift compensation makes no sense for DVB-T */
fesettings->step_size = 0;
fesettings->max_drift = 0;
return 0;
}
static int ttusbdecfe_dvbs_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) static int ttusbdecfe_dvbs_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
{ {
struct ttusbdecfe_state* state = (struct ttusbdecfe_state*) fe->demodulator_priv; struct ttusbdecfe_state* state = (struct ttusbdecfe_state*) fe->demodulator_priv;
...@@ -212,6 +253,8 @@ static struct dvb_frontend_ops ttusbdecfe_dvbt_ops = { ...@@ -212,6 +253,8 @@ static struct dvb_frontend_ops ttusbdecfe_dvbt_ops = {
.set_frontend = ttusbdecfe_dvbt_set_frontend, .set_frontend = ttusbdecfe_dvbt_set_frontend,
.get_tune_settings = ttusbdecfe_dvbt_get_tune_settings,
.read_status = ttusbdecfe_read_status, .read_status = ttusbdecfe_read_status,
}; };
...@@ -223,11 +266,11 @@ static struct dvb_frontend_ops ttusbdecfe_dvbs_ops = { ...@@ -223,11 +266,11 @@ static struct dvb_frontend_ops ttusbdecfe_dvbs_ops = {
.frequency_min = 950000, .frequency_min = 950000,
.frequency_max = 2150000, .frequency_max = 2150000,
.frequency_stepsize = 125, .frequency_stepsize = 125,
.symbol_rate_min = 1000000, /* guessed */
.symbol_rate_max = 45000000, /* guessed */
.caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | FE_CAN_QPSK
FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
FE_CAN_HIERARCHY_AUTO,
}, },
.release = ttusbdecfe_release, .release = ttusbdecfe_release,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment