diff options
Diffstat (limited to 'drivers/media/dvb/frontends/cx24116.c')
-rw-r--r-- | drivers/media/dvb/frontends/cx24116.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index b144b308a4dd..9b6c89e93f16 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c | |||
@@ -106,7 +106,7 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); | |||
106 | #define CX24116_HAS_SYNCLOCK (0x08) | 106 | #define CX24116_HAS_SYNCLOCK (0x08) |
107 | #define CX24116_HAS_UNKNOWN1 (0x10) | 107 | #define CX24116_HAS_UNKNOWN1 (0x10) |
108 | #define CX24116_HAS_UNKNOWN2 (0x20) | 108 | #define CX24116_HAS_UNKNOWN2 (0x20) |
109 | #define CX24116_STATUS_MASK (0x3f) | 109 | #define CX24116_STATUS_MASK (0x0f) |
110 | #define CX24116_SIGNAL_MASK (0xc0) | 110 | #define CX24116_SIGNAL_MASK (0xc0) |
111 | 111 | ||
112 | #define CX24116_DISEQC_TONEOFF (0) /* toneburst never sent */ | 112 | #define CX24116_DISEQC_TONEOFF (0) /* toneburst never sent */ |
@@ -160,6 +160,7 @@ struct cx24116_tuning { | |||
160 | fe_spectral_inversion_t inversion; | 160 | fe_spectral_inversion_t inversion; |
161 | fe_code_rate_t fec; | 161 | fe_code_rate_t fec; |
162 | 162 | ||
163 | fe_delivery_system_t delsys; | ||
163 | fe_modulation_t modulation; | 164 | fe_modulation_t modulation; |
164 | fe_pilot_t pilot; | 165 | fe_pilot_t pilot; |
165 | fe_rolloff_t rolloff; | 166 | fe_rolloff_t rolloff; |
@@ -411,14 +412,15 @@ struct cx24116_modfec { | |||
411 | }; | 412 | }; |
412 | 413 | ||
413 | static int cx24116_lookup_fecmod(struct cx24116_state *state, | 414 | static int cx24116_lookup_fecmod(struct cx24116_state *state, |
414 | fe_modulation_t m, fe_code_rate_t f) | 415 | fe_delivery_system_t d, fe_modulation_t m, fe_code_rate_t f) |
415 | { | 416 | { |
416 | int i, ret = -EOPNOTSUPP; | 417 | int i, ret = -EOPNOTSUPP; |
417 | 418 | ||
418 | dprintk("%s(0x%02x,0x%02x)\n", __func__, m, f); | 419 | dprintk("%s(0x%02x,0x%02x)\n", __func__, m, f); |
419 | 420 | ||
420 | for (i = 0; i < ARRAY_SIZE(CX24116_MODFEC_MODES); i++) { | 421 | for (i = 0; i < ARRAY_SIZE(CX24116_MODFEC_MODES); i++) { |
421 | if ((m == CX24116_MODFEC_MODES[i].modulation) && | 422 | if ((d == CX24116_MODFEC_MODES[i].delivery_system) && |
423 | (m == CX24116_MODFEC_MODES[i].modulation) && | ||
422 | (f == CX24116_MODFEC_MODES[i].fec)) { | 424 | (f == CX24116_MODFEC_MODES[i].fec)) { |
423 | ret = i; | 425 | ret = i; |
424 | break; | 426 | break; |
@@ -429,13 +431,13 @@ static int cx24116_lookup_fecmod(struct cx24116_state *state, | |||
429 | } | 431 | } |
430 | 432 | ||
431 | static int cx24116_set_fec(struct cx24116_state *state, | 433 | static int cx24116_set_fec(struct cx24116_state *state, |
432 | fe_modulation_t mod, fe_code_rate_t fec) | 434 | fe_delivery_system_t delsys, fe_modulation_t mod, fe_code_rate_t fec) |
433 | { | 435 | { |
434 | int ret = 0; | 436 | int ret = 0; |
435 | 437 | ||
436 | dprintk("%s(0x%02x,0x%02x)\n", __func__, mod, fec); | 438 | dprintk("%s(0x%02x,0x%02x)\n", __func__, mod, fec); |
437 | 439 | ||
438 | ret = cx24116_lookup_fecmod(state, mod, fec); | 440 | ret = cx24116_lookup_fecmod(state, delsys, mod, fec); |
439 | 441 | ||
440 | if (ret < 0) | 442 | if (ret < 0) |
441 | return ret; | 443 | return ret; |
@@ -679,7 +681,8 @@ static int cx24116_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
679 | { | 681 | { |
680 | struct cx24116_state *state = fe->demodulator_priv; | 682 | struct cx24116_state *state = fe->demodulator_priv; |
681 | 683 | ||
682 | int lock = cx24116_readreg(state, CX24116_REG_SSTATUS); | 684 | int lock = cx24116_readreg(state, CX24116_REG_SSTATUS) & |
685 | CX24116_STATUS_MASK; | ||
683 | 686 | ||
684 | dprintk("%s: status = 0x%02x\n", __func__, lock); | 687 | dprintk("%s: status = 0x%02x\n", __func__, lock); |
685 | 688 | ||
@@ -1205,7 +1208,7 @@ static int cx24116_set_frontend(struct dvb_frontend *fe, | |||
1205 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 1208 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
1206 | struct cx24116_cmd cmd; | 1209 | struct cx24116_cmd cmd; |
1207 | fe_status_t tunerstat; | 1210 | fe_status_t tunerstat; |
1208 | int i, status, ret, retune; | 1211 | int i, status, ret, retune = 1; |
1209 | 1212 | ||
1210 | dprintk("%s()\n", __func__); | 1213 | dprintk("%s()\n", __func__); |
1211 | 1214 | ||
@@ -1222,7 +1225,6 @@ static int cx24116_set_frontend(struct dvb_frontend *fe, | |||
1222 | 1225 | ||
1223 | /* Pilot doesn't exist in DVB-S, turn bit off */ | 1226 | /* Pilot doesn't exist in DVB-S, turn bit off */ |
1224 | state->dnxt.pilot_val = CX24116_PILOT_OFF; | 1227 | state->dnxt.pilot_val = CX24116_PILOT_OFF; |
1225 | retune = 1; | ||
1226 | 1228 | ||
1227 | /* DVB-S only supports 0.35 */ | 1229 | /* DVB-S only supports 0.35 */ |
1228 | if (c->rolloff != ROLLOFF_35) { | 1230 | if (c->rolloff != ROLLOFF_35) { |
@@ -1250,7 +1252,7 @@ static int cx24116_set_frontend(struct dvb_frontend *fe, | |||
1250 | case PILOT_AUTO: /* Not supported but emulated */ | 1252 | case PILOT_AUTO: /* Not supported but emulated */ |
1251 | state->dnxt.pilot_val = (c->modulation == QPSK) | 1253 | state->dnxt.pilot_val = (c->modulation == QPSK) |
1252 | ? CX24116_PILOT_OFF : CX24116_PILOT_ON; | 1254 | ? CX24116_PILOT_OFF : CX24116_PILOT_ON; |
1253 | retune = 2; | 1255 | retune++; |
1254 | break; | 1256 | break; |
1255 | case PILOT_OFF: | 1257 | case PILOT_OFF: |
1256 | state->dnxt.pilot_val = CX24116_PILOT_OFF; | 1258 | state->dnxt.pilot_val = CX24116_PILOT_OFF; |
@@ -1287,6 +1289,7 @@ static int cx24116_set_frontend(struct dvb_frontend *fe, | |||
1287 | __func__, c->delivery_system); | 1289 | __func__, c->delivery_system); |
1288 | return -EOPNOTSUPP; | 1290 | return -EOPNOTSUPP; |
1289 | } | 1291 | } |
1292 | state->dnxt.delsys = c->delivery_system; | ||
1290 | state->dnxt.modulation = c->modulation; | 1293 | state->dnxt.modulation = c->modulation; |
1291 | state->dnxt.frequency = c->frequency; | 1294 | state->dnxt.frequency = c->frequency; |
1292 | state->dnxt.pilot = c->pilot; | 1295 | state->dnxt.pilot = c->pilot; |
@@ -1297,7 +1300,7 @@ static int cx24116_set_frontend(struct dvb_frontend *fe, | |||
1297 | return ret; | 1300 | return ret; |
1298 | 1301 | ||
1299 | /* FEC_NONE/AUTO for DVB-S2 is not supported and detected here */ | 1302 | /* FEC_NONE/AUTO for DVB-S2 is not supported and detected here */ |
1300 | ret = cx24116_set_fec(state, c->modulation, c->fec_inner); | 1303 | ret = cx24116_set_fec(state, c->delivery_system, c->modulation, c->fec_inner); |
1301 | if (ret != 0) | 1304 | if (ret != 0) |
1302 | return ret; | 1305 | return ret; |
1303 | 1306 | ||
@@ -1308,6 +1311,7 @@ static int cx24116_set_frontend(struct dvb_frontend *fe, | |||
1308 | /* discard the 'current' tuning parameters and prepare to tune */ | 1311 | /* discard the 'current' tuning parameters and prepare to tune */ |
1309 | cx24116_clone_params(fe); | 1312 | cx24116_clone_params(fe); |
1310 | 1313 | ||
1314 | dprintk("%s: delsys = %d\n", __func__, state->dcur.delsys); | ||
1311 | dprintk("%s: modulation = %d\n", __func__, state->dcur.modulation); | 1315 | dprintk("%s: modulation = %d\n", __func__, state->dcur.modulation); |
1312 | dprintk("%s: frequency = %d\n", __func__, state->dcur.frequency); | 1316 | dprintk("%s: frequency = %d\n", __func__, state->dcur.frequency); |
1313 | dprintk("%s: pilot = %d (val = 0x%02x)\n", __func__, | 1317 | dprintk("%s: pilot = %d (val = 0x%02x)\n", __func__, |
@@ -1427,6 +1431,23 @@ tuned: /* Set/Reset B/W */ | |||
1427 | return ret; | 1431 | return ret; |
1428 | } | 1432 | } |
1429 | 1433 | ||
1434 | static int cx24116_tune(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, | ||
1435 | unsigned int mode_flags, unsigned int *delay, fe_status_t *status) | ||
1436 | { | ||
1437 | *delay = HZ / 5; | ||
1438 | if (params) { | ||
1439 | int ret = cx24116_set_frontend(fe, params); | ||
1440 | if (ret) | ||
1441 | return ret; | ||
1442 | } | ||
1443 | return cx24116_read_status(fe, status); | ||
1444 | } | ||
1445 | |||
1446 | static int cx24116_get_algo(struct dvb_frontend *fe) | ||
1447 | { | ||
1448 | return DVBFE_ALGO_HW; | ||
1449 | } | ||
1450 | |||
1430 | static struct dvb_frontend_ops cx24116_ops = { | 1451 | static struct dvb_frontend_ops cx24116_ops = { |
1431 | 1452 | ||
1432 | .info = { | 1453 | .info = { |
@@ -1458,6 +1479,8 @@ static struct dvb_frontend_ops cx24116_ops = { | |||
1458 | .set_voltage = cx24116_set_voltage, | 1479 | .set_voltage = cx24116_set_voltage, |
1459 | .diseqc_send_master_cmd = cx24116_send_diseqc_msg, | 1480 | .diseqc_send_master_cmd = cx24116_send_diseqc_msg, |
1460 | .diseqc_send_burst = cx24116_diseqc_send_burst, | 1481 | .diseqc_send_burst = cx24116_diseqc_send_burst, |
1482 | .get_frontend_algo = cx24116_get_algo, | ||
1483 | .tune = cx24116_tune, | ||
1461 | 1484 | ||
1462 | .set_property = cx24116_set_property, | 1485 | .set_property = cx24116_set_property, |
1463 | .get_property = cx24116_get_property, | 1486 | .get_property = cx24116_get_property, |