aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttusb-dec/ttusbdecfe.c')
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusbdecfe.c53
1 files changed, 48 insertions, 5 deletions
diff --git a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
index 725af3af5b27..a5a46175fa09 100644
--- a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
+++ b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
@@ -42,8 +42,39 @@ struct ttusbdecfe_state {
42 42
43static int ttusbdecfe_read_status(struct dvb_frontend* fe, fe_status_t* status) 43static int ttusbdecfe_read_status(struct dvb_frontend* fe, fe_status_t* status)
44{ 44{
45 *status = FE_HAS_SIGNAL | FE_HAS_VITERBI | 45 struct ttusbdecfe_state* state = fe->demodulator_priv;
46 FE_HAS_SYNC | FE_HAS_CARRIER | FE_HAS_LOCK; 46 u8 b[] = { 0x00, 0x00, 0x00, 0x00,
47 0x00, 0x00, 0x00, 0x00 };
48 u8 result[4];
49 int len, ret;
50
51 *status=0;
52
53 ret=state->config->send_command(fe, 0x73, sizeof(b), b, &len, result);
54 if(ret)
55 return ret;
56
57 if(len != 4) {
58 printk(KERN_ERR "%s: unexpected reply\n", __FUNCTION__);
59 return -EIO;
60 }
61
62 switch(result[3]) {
63 case 1: /* not tuned yet */
64 case 2: /* no signal/no lock*/
65 break;
66 case 3: /* signal found and locked*/
67 *status = FE_HAS_SIGNAL | FE_HAS_VITERBI |
68 FE_HAS_SYNC | FE_HAS_CARRIER | FE_HAS_LOCK;
69 break;
70 case 4:
71 *status = FE_TIMEDOUT;
72 break;
73 default:
74 pr_info("%s: returned unknown value: %d\n",
75 __FUNCTION__, result[3]);
76 return -EIO;
77 }
47 78
48 return 0; 79 return 0;
49} 80}
@@ -64,6 +95,16 @@ static int ttusbdecfe_dvbt_set_frontend(struct dvb_frontend* fe, struct dvb_fron
64 return 0; 95 return 0;
65} 96}
66 97
98static int ttusbdecfe_dvbt_get_tune_settings(struct dvb_frontend* fe,
99 struct dvb_frontend_tune_settings* fesettings)
100{
101 fesettings->min_delay_ms = 1500;
102 /* Drift compensation makes no sense for DVB-T */
103 fesettings->step_size = 0;
104 fesettings->max_drift = 0;
105 return 0;
106}
107
67static int ttusbdecfe_dvbs_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) 108static int ttusbdecfe_dvbs_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
68{ 109{
69 struct ttusbdecfe_state* state = (struct ttusbdecfe_state*) fe->demodulator_priv; 110 struct ttusbdecfe_state* state = (struct ttusbdecfe_state*) fe->demodulator_priv;
@@ -212,6 +253,8 @@ static struct dvb_frontend_ops ttusbdecfe_dvbt_ops = {
212 253
213 .set_frontend = ttusbdecfe_dvbt_set_frontend, 254 .set_frontend = ttusbdecfe_dvbt_set_frontend,
214 255
256 .get_tune_settings = ttusbdecfe_dvbt_get_tune_settings,
257
215 .read_status = ttusbdecfe_read_status, 258 .read_status = ttusbdecfe_read_status,
216}; 259};
217 260
@@ -223,11 +266,11 @@ static struct dvb_frontend_ops ttusbdecfe_dvbs_ops = {
223 .frequency_min = 950000, 266 .frequency_min = 950000,
224 .frequency_max = 2150000, 267 .frequency_max = 2150000,
225 .frequency_stepsize = 125, 268 .frequency_stepsize = 125,
269 .symbol_rate_min = 1000000, /* guessed */
270 .symbol_rate_max = 45000000, /* guessed */
226 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | 271 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
227 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | 272 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
228 FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | 273 FE_CAN_QPSK
229 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
230 FE_CAN_HIERARCHY_AUTO,
231 }, 274 },
232 275
233 .release = ttusbdecfe_release, 276 .release = ttusbdecfe_release,