diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-26 13:31:22 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-31 06:52:11 -0500 |
commit | f9e54512fd16379812bcff86d95d0a7d78028b20 (patch) | |
tree | 40b59fe5dd734f3a4e119699dc497013e71db075 | |
parent | 5942c679a8a2cb95331501ff3b6965efed259408 (diff) |
[media] af9005-fe: convert set_fontend to use DVBv5 parameters
Instead of using dvb_frontend_parameters struct, that were
designed for a subset of the supported standards, use the DVBv5
cache information.
Also, fill the supported delivery systems at dvb_frontend_ops
struct.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/dvb-usb/af9005-fe.c | 102 |
1 files changed, 52 insertions, 50 deletions
diff --git a/drivers/media/dvb/dvb-usb/af9005-fe.c b/drivers/media/dvb/dvb-usb/af9005-fe.c index e9addd8203cb..df449498b55d 100644 --- a/drivers/media/dvb/dvb-usb/af9005-fe.c +++ b/drivers/media/dvb/dvb-usb/af9005-fe.c | |||
@@ -303,7 +303,7 @@ static int af9005_get_pre_vit_err_bit_count(struct dvb_frontend *fe, | |||
303 | return -EINVAL; | 303 | return -EINVAL; |
304 | } | 304 | } |
305 | 305 | ||
306 | /* read constellation mode */ | 306 | /* read modulation mode */ |
307 | ret = | 307 | ret = |
308 | af9005_read_register_bits(state->d, xd_g_reg_tpsd_const, | 308 | af9005_read_register_bits(state->d, xd_g_reg_tpsd_const, |
309 | reg_tpsd_const_pos, reg_tpsd_const_len, | 309 | reg_tpsd_const_pos, reg_tpsd_const_len, |
@@ -321,7 +321,7 @@ static int af9005_get_pre_vit_err_bit_count(struct dvb_frontend *fe, | |||
321 | bits = 6; | 321 | bits = 6; |
322 | break; | 322 | break; |
323 | default: | 323 | default: |
324 | err("invalid constellation mode"); | 324 | err("invalid modulation mode"); |
325 | return -EINVAL; | 325 | return -EINVAL; |
326 | } | 326 | } |
327 | *pre_bit_count = super_frame_count * 68 * 4 * x * bits; | 327 | *pre_bit_count = super_frame_count * 68 * 4 * x * bits; |
@@ -533,13 +533,13 @@ static int af9005_fe_read_signal_strength(struct dvb_frontend *fe, | |||
533 | 533 | ||
534 | static int af9005_fe_read_snr(struct dvb_frontend *fe, u16 * snr) | 534 | static int af9005_fe_read_snr(struct dvb_frontend *fe, u16 * snr) |
535 | { | 535 | { |
536 | /* the snr can be derived from the ber and the constellation | 536 | /* the snr can be derived from the ber and the modulation |
537 | but I don't think this kind of complex calculations belong | 537 | but I don't think this kind of complex calculations belong |
538 | in the driver. I may be wrong.... */ | 538 | in the driver. I may be wrong.... */ |
539 | return -ENOSYS; | 539 | return -ENOSYS; |
540 | } | 540 | } |
541 | 541 | ||
542 | static int af9005_fe_program_cfoe(struct dvb_usb_device *d, fe_bandwidth_t bw) | 542 | static int af9005_fe_program_cfoe(struct dvb_usb_device *d, u32 bw) |
543 | { | 543 | { |
544 | u8 temp0, temp1, temp2, temp3, buf[4]; | 544 | u8 temp0, temp1, temp2, temp3, buf[4]; |
545 | int ret; | 545 | int ret; |
@@ -551,7 +551,7 @@ static int af9005_fe_program_cfoe(struct dvb_usb_device *d, fe_bandwidth_t bw) | |||
551 | u32 NS_coeff2_8k; | 551 | u32 NS_coeff2_8k; |
552 | 552 | ||
553 | switch (bw) { | 553 | switch (bw) { |
554 | case BANDWIDTH_6_MHZ: | 554 | case 6000000: |
555 | NS_coeff1_2048Nu = 0x2ADB6DC; | 555 | NS_coeff1_2048Nu = 0x2ADB6DC; |
556 | NS_coeff1_8191Nu = 0xAB7313; | 556 | NS_coeff1_8191Nu = 0xAB7313; |
557 | NS_coeff1_8192Nu = 0xAB6DB7; | 557 | NS_coeff1_8192Nu = 0xAB6DB7; |
@@ -560,7 +560,7 @@ static int af9005_fe_program_cfoe(struct dvb_usb_device *d, fe_bandwidth_t bw) | |||
560 | NS_coeff2_8k = 0x55B6DC; | 560 | NS_coeff2_8k = 0x55B6DC; |
561 | break; | 561 | break; |
562 | 562 | ||
563 | case BANDWIDTH_7_MHZ: | 563 | case 7000000: |
564 | NS_coeff1_2048Nu = 0x3200001; | 564 | NS_coeff1_2048Nu = 0x3200001; |
565 | NS_coeff1_8191Nu = 0xC80640; | 565 | NS_coeff1_8191Nu = 0xC80640; |
566 | NS_coeff1_8192Nu = 0xC80000; | 566 | NS_coeff1_8192Nu = 0xC80000; |
@@ -569,7 +569,7 @@ static int af9005_fe_program_cfoe(struct dvb_usb_device *d, fe_bandwidth_t bw) | |||
569 | NS_coeff2_8k = 0x640000; | 569 | NS_coeff2_8k = 0x640000; |
570 | break; | 570 | break; |
571 | 571 | ||
572 | case BANDWIDTH_8_MHZ: | 572 | case 8000000: |
573 | NS_coeff1_2048Nu = 0x3924926; | 573 | NS_coeff1_2048Nu = 0x3924926; |
574 | NS_coeff1_8191Nu = 0xE4996E; | 574 | NS_coeff1_8191Nu = 0xE4996E; |
575 | NS_coeff1_8192Nu = 0xE49249; | 575 | NS_coeff1_8192Nu = 0xE49249; |
@@ -773,17 +773,17 @@ static int af9005_fe_program_cfoe(struct dvb_usb_device *d, fe_bandwidth_t bw) | |||
773 | 773 | ||
774 | } | 774 | } |
775 | 775 | ||
776 | static int af9005_fe_select_bw(struct dvb_usb_device *d, fe_bandwidth_t bw) | 776 | static int af9005_fe_select_bw(struct dvb_usb_device *d, u32 bw) |
777 | { | 777 | { |
778 | u8 temp; | 778 | u8 temp; |
779 | switch (bw) { | 779 | switch (bw) { |
780 | case BANDWIDTH_6_MHZ: | 780 | case 6000000: |
781 | temp = 0; | 781 | temp = 0; |
782 | break; | 782 | break; |
783 | case BANDWIDTH_7_MHZ: | 783 | case 7000000: |
784 | temp = 1; | 784 | temp = 1; |
785 | break; | 785 | break; |
786 | case BANDWIDTH_8_MHZ: | 786 | case 8000000: |
787 | temp = 2; | 787 | temp = 2; |
788 | break; | 788 | break; |
789 | default: | 789 | default: |
@@ -930,10 +930,11 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
930 | 930 | ||
931 | /* init other parameters: program cfoe and select bandwidth */ | 931 | /* init other parameters: program cfoe and select bandwidth */ |
932 | deb_info("program cfoe\n"); | 932 | deb_info("program cfoe\n"); |
933 | if ((ret = af9005_fe_program_cfoe(state->d, BANDWIDTH_6_MHZ))) | 933 | ret = af9005_fe_program_cfoe(state->d, 6000000); |
934 | if (ret) | ||
934 | return ret; | 935 | return ret; |
935 | /* set read-update bit for constellation */ | 936 | /* set read-update bit for modulation */ |
936 | deb_info("set read-update bit for constellation\n"); | 937 | deb_info("set read-update bit for modulation\n"); |
937 | if ((ret = | 938 | if ((ret = |
938 | af9005_write_register_bits(state->d, xd_p_reg_feq_read_update, | 939 | af9005_write_register_bits(state->d, xd_p_reg_feq_read_update, |
939 | reg_feq_read_update_pos, | 940 | reg_feq_read_update_pos, |
@@ -943,8 +944,8 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
943 | /* sample code has a set MPEG TS code here | 944 | /* sample code has a set MPEG TS code here |
944 | but sniffing reveals that it doesn't do it */ | 945 | but sniffing reveals that it doesn't do it */ |
945 | 946 | ||
946 | /* set read-update bit to 1 for DCA constellation */ | 947 | /* set read-update bit to 1 for DCA modulation */ |
947 | deb_info("set read-update bit 1 for DCA constellation\n"); | 948 | deb_info("set read-update bit 1 for DCA modulation\n"); |
948 | if ((ret = | 949 | if ((ret = |
949 | af9005_write_register_bits(state->d, xd_p_reg_dca_read_update, | 950 | af9005_write_register_bits(state->d, xd_p_reg_dca_read_update, |
950 | reg_dca_read_update_pos, | 951 | reg_dca_read_update_pos, |
@@ -1099,15 +1100,15 @@ static int af9005_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) | |||
1099 | return 0; | 1100 | return 0; |
1100 | } | 1101 | } |
1101 | 1102 | ||
1102 | static int af9005_fe_set_frontend(struct dvb_frontend *fe, | 1103 | static int af9005_fe_set_frontend(struct dvb_frontend *fe) |
1103 | struct dvb_frontend_parameters *fep) | ||
1104 | { | 1104 | { |
1105 | struct dtv_frontend_properties *fep = &fe->dtv_property_cache; | ||
1105 | struct af9005_fe_state *state = fe->demodulator_priv; | 1106 | struct af9005_fe_state *state = fe->demodulator_priv; |
1106 | int ret; | 1107 | int ret; |
1107 | u8 temp, temp0, temp1, temp2; | 1108 | u8 temp, temp0, temp1, temp2; |
1108 | 1109 | ||
1109 | deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency, | 1110 | deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency, |
1110 | fep->u.ofdm.bandwidth); | 1111 | fep->bandwidth_hz); |
1111 | if (fe->ops.tuner_ops.release == NULL) { | 1112 | if (fe->ops.tuner_ops.release == NULL) { |
1112 | err("Tuner not attached"); | 1113 | err("Tuner not attached"); |
1113 | return -ENODEV; | 1114 | return -ENODEV; |
@@ -1167,10 +1168,10 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe, | |||
1167 | 1168 | ||
1168 | /* select bandwidth */ | 1169 | /* select bandwidth */ |
1169 | deb_info("select bandwidth"); | 1170 | deb_info("select bandwidth"); |
1170 | ret = af9005_fe_select_bw(state->d, fep->u.ofdm.bandwidth); | 1171 | ret = af9005_fe_select_bw(state->d, fep->bandwidth_hz); |
1171 | if (ret) | 1172 | if (ret) |
1172 | return ret; | 1173 | return ret; |
1173 | ret = af9005_fe_program_cfoe(state->d, fep->u.ofdm.bandwidth); | 1174 | ret = af9005_fe_program_cfoe(state->d, fep->bandwidth_hz); |
1174 | if (ret) | 1175 | if (ret) |
1175 | return ret; | 1176 | return ret; |
1176 | 1177 | ||
@@ -1226,7 +1227,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe, | |||
1226 | } | 1227 | } |
1227 | 1228 | ||
1228 | static int af9005_fe_get_frontend(struct dvb_frontend *fe, | 1229 | static int af9005_fe_get_frontend(struct dvb_frontend *fe, |
1229 | struct dvb_frontend_parameters *fep) | 1230 | struct dtv_frontend_properties *fep) |
1230 | { | 1231 | { |
1231 | struct af9005_fe_state *state = fe->demodulator_priv; | 1232 | struct af9005_fe_state *state = fe->demodulator_priv; |
1232 | int ret; | 1233 | int ret; |
@@ -1243,15 +1244,15 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe, | |||
1243 | deb_info("CONSTELLATION "); | 1244 | deb_info("CONSTELLATION "); |
1244 | switch (temp) { | 1245 | switch (temp) { |
1245 | case 0: | 1246 | case 0: |
1246 | fep->u.ofdm.constellation = QPSK; | 1247 | fep->modulation = QPSK; |
1247 | deb_info("QPSK\n"); | 1248 | deb_info("QPSK\n"); |
1248 | break; | 1249 | break; |
1249 | case 1: | 1250 | case 1: |
1250 | fep->u.ofdm.constellation = QAM_16; | 1251 | fep->modulation = QAM_16; |
1251 | deb_info("QAM_16\n"); | 1252 | deb_info("QAM_16\n"); |
1252 | break; | 1253 | break; |
1253 | case 2: | 1254 | case 2: |
1254 | fep->u.ofdm.constellation = QAM_64; | 1255 | fep->modulation = QAM_64; |
1255 | deb_info("QAM_64\n"); | 1256 | deb_info("QAM_64\n"); |
1256 | break; | 1257 | break; |
1257 | } | 1258 | } |
@@ -1266,19 +1267,19 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe, | |||
1266 | deb_info("HIERARCHY "); | 1267 | deb_info("HIERARCHY "); |
1267 | switch (temp) { | 1268 | switch (temp) { |
1268 | case 0: | 1269 | case 0: |
1269 | fep->u.ofdm.hierarchy_information = HIERARCHY_NONE; | 1270 | fep->hierarchy = HIERARCHY_NONE; |
1270 | deb_info("NONE\n"); | 1271 | deb_info("NONE\n"); |
1271 | break; | 1272 | break; |
1272 | case 1: | 1273 | case 1: |
1273 | fep->u.ofdm.hierarchy_information = HIERARCHY_1; | 1274 | fep->hierarchy = HIERARCHY_1; |
1274 | deb_info("1\n"); | 1275 | deb_info("1\n"); |
1275 | break; | 1276 | break; |
1276 | case 2: | 1277 | case 2: |
1277 | fep->u.ofdm.hierarchy_information = HIERARCHY_2; | 1278 | fep->hierarchy = HIERARCHY_2; |
1278 | deb_info("2\n"); | 1279 | deb_info("2\n"); |
1279 | break; | 1280 | break; |
1280 | case 3: | 1281 | case 3: |
1281 | fep->u.ofdm.hierarchy_information = HIERARCHY_4; | 1282 | fep->hierarchy = HIERARCHY_4; |
1282 | deb_info("4\n"); | 1283 | deb_info("4\n"); |
1283 | break; | 1284 | break; |
1284 | } | 1285 | } |
@@ -1302,23 +1303,23 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe, | |||
1302 | deb_info("CODERATE HP "); | 1303 | deb_info("CODERATE HP "); |
1303 | switch (temp) { | 1304 | switch (temp) { |
1304 | case 0: | 1305 | case 0: |
1305 | fep->u.ofdm.code_rate_HP = FEC_1_2; | 1306 | fep->code_rate_HP = FEC_1_2; |
1306 | deb_info("FEC_1_2\n"); | 1307 | deb_info("FEC_1_2\n"); |
1307 | break; | 1308 | break; |
1308 | case 1: | 1309 | case 1: |
1309 | fep->u.ofdm.code_rate_HP = FEC_2_3; | 1310 | fep->code_rate_HP = FEC_2_3; |
1310 | deb_info("FEC_2_3\n"); | 1311 | deb_info("FEC_2_3\n"); |
1311 | break; | 1312 | break; |
1312 | case 2: | 1313 | case 2: |
1313 | fep->u.ofdm.code_rate_HP = FEC_3_4; | 1314 | fep->code_rate_HP = FEC_3_4; |
1314 | deb_info("FEC_3_4\n"); | 1315 | deb_info("FEC_3_4\n"); |
1315 | break; | 1316 | break; |
1316 | case 3: | 1317 | case 3: |
1317 | fep->u.ofdm.code_rate_HP = FEC_5_6; | 1318 | fep->code_rate_HP = FEC_5_6; |
1318 | deb_info("FEC_5_6\n"); | 1319 | deb_info("FEC_5_6\n"); |
1319 | break; | 1320 | break; |
1320 | case 4: | 1321 | case 4: |
1321 | fep->u.ofdm.code_rate_HP = FEC_7_8; | 1322 | fep->code_rate_HP = FEC_7_8; |
1322 | deb_info("FEC_7_8\n"); | 1323 | deb_info("FEC_7_8\n"); |
1323 | break; | 1324 | break; |
1324 | } | 1325 | } |
@@ -1333,23 +1334,23 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe, | |||
1333 | deb_info("CODERATE LP "); | 1334 | deb_info("CODERATE LP "); |
1334 | switch (temp) { | 1335 | switch (temp) { |
1335 | case 0: | 1336 | case 0: |
1336 | fep->u.ofdm.code_rate_LP = FEC_1_2; | 1337 | fep->code_rate_LP = FEC_1_2; |
1337 | deb_info("FEC_1_2\n"); | 1338 | deb_info("FEC_1_2\n"); |
1338 | break; | 1339 | break; |
1339 | case 1: | 1340 | case 1: |
1340 | fep->u.ofdm.code_rate_LP = FEC_2_3; | 1341 | fep->code_rate_LP = FEC_2_3; |
1341 | deb_info("FEC_2_3\n"); | 1342 | deb_info("FEC_2_3\n"); |
1342 | break; | 1343 | break; |
1343 | case 2: | 1344 | case 2: |
1344 | fep->u.ofdm.code_rate_LP = FEC_3_4; | 1345 | fep->code_rate_LP = FEC_3_4; |
1345 | deb_info("FEC_3_4\n"); | 1346 | deb_info("FEC_3_4\n"); |
1346 | break; | 1347 | break; |
1347 | case 3: | 1348 | case 3: |
1348 | fep->u.ofdm.code_rate_LP = FEC_5_6; | 1349 | fep->code_rate_LP = FEC_5_6; |
1349 | deb_info("FEC_5_6\n"); | 1350 | deb_info("FEC_5_6\n"); |
1350 | break; | 1351 | break; |
1351 | case 4: | 1352 | case 4: |
1352 | fep->u.ofdm.code_rate_LP = FEC_7_8; | 1353 | fep->code_rate_LP = FEC_7_8; |
1353 | deb_info("FEC_7_8\n"); | 1354 | deb_info("FEC_7_8\n"); |
1354 | break; | 1355 | break; |
1355 | } | 1356 | } |
@@ -1363,19 +1364,19 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe, | |||
1363 | deb_info("GUARD INTERVAL "); | 1364 | deb_info("GUARD INTERVAL "); |
1364 | switch (temp) { | 1365 | switch (temp) { |
1365 | case 0: | 1366 | case 0: |
1366 | fep->u.ofdm.guard_interval = GUARD_INTERVAL_1_32; | 1367 | fep->guard_interval = GUARD_INTERVAL_1_32; |
1367 | deb_info("1_32\n"); | 1368 | deb_info("1_32\n"); |
1368 | break; | 1369 | break; |
1369 | case 1: | 1370 | case 1: |
1370 | fep->u.ofdm.guard_interval = GUARD_INTERVAL_1_16; | 1371 | fep->guard_interval = GUARD_INTERVAL_1_16; |
1371 | deb_info("1_16\n"); | 1372 | deb_info("1_16\n"); |
1372 | break; | 1373 | break; |
1373 | case 2: | 1374 | case 2: |
1374 | fep->u.ofdm.guard_interval = GUARD_INTERVAL_1_8; | 1375 | fep->guard_interval = GUARD_INTERVAL_1_8; |
1375 | deb_info("1_8\n"); | 1376 | deb_info("1_8\n"); |
1376 | break; | 1377 | break; |
1377 | case 3: | 1378 | case 3: |
1378 | fep->u.ofdm.guard_interval = GUARD_INTERVAL_1_4; | 1379 | fep->guard_interval = GUARD_INTERVAL_1_4; |
1379 | deb_info("1_4\n"); | 1380 | deb_info("1_4\n"); |
1380 | break; | 1381 | break; |
1381 | } | 1382 | } |
@@ -1390,11 +1391,11 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe, | |||
1390 | deb_info("TRANSMISSION MODE "); | 1391 | deb_info("TRANSMISSION MODE "); |
1391 | switch (temp) { | 1392 | switch (temp) { |
1392 | case 0: | 1393 | case 0: |
1393 | fep->u.ofdm.transmission_mode = TRANSMISSION_MODE_2K; | 1394 | fep->transmission_mode = TRANSMISSION_MODE_2K; |
1394 | deb_info("2K\n"); | 1395 | deb_info("2K\n"); |
1395 | break; | 1396 | break; |
1396 | case 1: | 1397 | case 1: |
1397 | fep->u.ofdm.transmission_mode = TRANSMISSION_MODE_8K; | 1398 | fep->transmission_mode = TRANSMISSION_MODE_8K; |
1398 | deb_info("8K\n"); | 1399 | deb_info("8K\n"); |
1399 | break; | 1400 | break; |
1400 | } | 1401 | } |
@@ -1406,15 +1407,15 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe, | |||
1406 | deb_info("BANDWIDTH "); | 1407 | deb_info("BANDWIDTH "); |
1407 | switch (temp) { | 1408 | switch (temp) { |
1408 | case 0: | 1409 | case 0: |
1409 | fep->u.ofdm.bandwidth = BANDWIDTH_6_MHZ; | 1410 | fep->bandwidth_hz = 6000000; |
1410 | deb_info("6\n"); | 1411 | deb_info("6\n"); |
1411 | break; | 1412 | break; |
1412 | case 1: | 1413 | case 1: |
1413 | fep->u.ofdm.bandwidth = BANDWIDTH_7_MHZ; | 1414 | fep->bandwidth_hz = 7000000; |
1414 | deb_info("7\n"); | 1415 | deb_info("7\n"); |
1415 | break; | 1416 | break; |
1416 | case 2: | 1417 | case 2: |
1417 | fep->u.ofdm.bandwidth = BANDWIDTH_8_MHZ; | 1418 | fep->bandwidth_hz = 8000000; |
1418 | deb_info("8\n"); | 1419 | deb_info("8\n"); |
1419 | break; | 1420 | break; |
1420 | } | 1421 | } |
@@ -1454,6 +1455,7 @@ struct dvb_frontend *af9005_fe_attach(struct dvb_usb_device *d) | |||
1454 | } | 1455 | } |
1455 | 1456 | ||
1456 | static struct dvb_frontend_ops af9005_fe_ops = { | 1457 | static struct dvb_frontend_ops af9005_fe_ops = { |
1458 | .delsys = { SYS_DVBT }, | ||
1457 | .info = { | 1459 | .info = { |
1458 | .name = "AF9005 USB DVB-T", | 1460 | .name = "AF9005 USB DVB-T", |
1459 | .type = FE_OFDM, | 1461 | .type = FE_OFDM, |
@@ -1475,8 +1477,8 @@ static struct dvb_frontend_ops af9005_fe_ops = { | |||
1475 | .sleep = af9005_fe_sleep, | 1477 | .sleep = af9005_fe_sleep, |
1476 | .ts_bus_ctrl = af9005_ts_bus_ctrl, | 1478 | .ts_bus_ctrl = af9005_ts_bus_ctrl, |
1477 | 1479 | ||
1478 | .set_frontend_legacy = af9005_fe_set_frontend, | 1480 | .set_frontend = af9005_fe_set_frontend, |
1479 | .get_frontend_legacy = af9005_fe_get_frontend, | 1481 | .get_frontend = af9005_fe_get_frontend, |
1480 | 1482 | ||
1481 | .read_status = af9005_fe_read_status, | 1483 | .read_status = af9005_fe_read_status, |
1482 | .read_ber = af9005_fe_read_ber, | 1484 | .read_ber = af9005_fe_read_ber, |