diff options
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/firewire/firedtv-avc.c | 146 |
1 files changed, 65 insertions, 81 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c index e70642811217..1b31bebc27d6 100644 --- a/drivers/media/dvb/firewire/firedtv-avc.c +++ b/drivers/media/dvb/firewire/firedtv-avc.c | |||
@@ -87,6 +87,21 @@ struct avc_response_frame { | |||
87 | u8 operand[509]; | 87 | u8 operand[509]; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | #define LAST_OPERAND (509 - 1) | ||
91 | |||
92 | static inline void clear_operands(struct avc_command_frame *c, int from, int to) | ||
93 | { | ||
94 | memset(&c->operand[from], 0, to - from + 1); | ||
95 | } | ||
96 | |||
97 | static void pad_operands(struct avc_command_frame *c, int from) | ||
98 | { | ||
99 | int to = ALIGN(from, 4); | ||
100 | |||
101 | if (from <= to && to <= LAST_OPERAND) | ||
102 | clear_operands(c, from, to); | ||
103 | } | ||
104 | |||
90 | #define AVC_DEBUG_READ_DESCRIPTOR 0x0001 | 105 | #define AVC_DEBUG_READ_DESCRIPTOR 0x0001 |
91 | #define AVC_DEBUG_DSIT 0x0002 | 106 | #define AVC_DEBUG_DSIT 0x0002 |
92 | #define AVC_DEBUG_DSD 0x0004 | 107 | #define AVC_DEBUG_DSD 0x0004 |
@@ -303,8 +318,8 @@ static int add_pid_filter(struct firedtv *fdtv, u8 *operand) | |||
303 | * tuning command for setting the relative LNB frequency | 318 | * tuning command for setting the relative LNB frequency |
304 | * (not supported by the AVC standard) | 319 | * (not supported by the AVC standard) |
305 | */ | 320 | */ |
306 | static void avc_tuner_tuneqpsk(struct firedtv *fdtv, | 321 | static int avc_tuner_tuneqpsk(struct firedtv *fdtv, |
307 | struct dvb_frontend_parameters *params) | 322 | struct dvb_frontend_parameters *params) |
308 | { | 323 | { |
309 | struct avc_command_frame *c = (void *)fdtv->avc_data; | 324 | struct avc_command_frame *c = (void *)fdtv->avc_data; |
310 | 325 | ||
@@ -356,14 +371,15 @@ static void avc_tuner_tuneqpsk(struct firedtv *fdtv, | |||
356 | c->operand[13] = 0x1; | 371 | c->operand[13] = 0x1; |
357 | c->operand[14] = 0xff; | 372 | c->operand[14] = 0xff; |
358 | c->operand[15] = 0xff; | 373 | c->operand[15] = 0xff; |
359 | fdtv->avc_data_length = 20; | 374 | |
375 | return 16; | ||
360 | } else { | 376 | } else { |
361 | fdtv->avc_data_length = 16; | 377 | return 13; |
362 | } | 378 | } |
363 | } | 379 | } |
364 | 380 | ||
365 | static void avc_tuner_dsd_dvb_c(struct firedtv *fdtv, | 381 | static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv, |
366 | struct dvb_frontend_parameters *params) | 382 | struct dvb_frontend_parameters *params) |
367 | { | 383 | { |
368 | struct avc_command_frame *c = (void *)fdtv->avc_data; | 384 | struct avc_command_frame *c = (void *)fdtv->avc_data; |
369 | 385 | ||
@@ -427,13 +443,11 @@ static void avc_tuner_dsd_dvb_c(struct firedtv *fdtv, | |||
427 | c->operand[20] = 0x00; | 443 | c->operand[20] = 0x00; |
428 | c->operand[21] = 0x00; | 444 | c->operand[21] = 0x00; |
429 | 445 | ||
430 | /* Add PIDs to filter */ | 446 | return 22 + add_pid_filter(fdtv, &c->operand[22]); |
431 | fdtv->avc_data_length = | ||
432 | ALIGN(22 + add_pid_filter(fdtv, &c->operand[22]) + 3, 4); | ||
433 | } | 447 | } |
434 | 448 | ||
435 | static void avc_tuner_dsd_dvb_t(struct firedtv *fdtv, | 449 | static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv, |
436 | struct dvb_frontend_parameters *params) | 450 | struct dvb_frontend_parameters *params) |
437 | { | 451 | { |
438 | struct dvb_ofdm_parameters *ofdm = ¶ms->u.ofdm; | 452 | struct dvb_ofdm_parameters *ofdm = ¶ms->u.ofdm; |
439 | struct avc_command_frame *c = (void *)fdtv->avc_data; | 453 | struct avc_command_frame *c = (void *)fdtv->avc_data; |
@@ -531,32 +545,31 @@ static void avc_tuner_dsd_dvb_t(struct firedtv *fdtv, | |||
531 | c->operand[15] = 0x00; /* network_ID[0] */ | 545 | c->operand[15] = 0x00; /* network_ID[0] */ |
532 | c->operand[16] = 0x00; /* network_ID[1] */ | 546 | c->operand[16] = 0x00; /* network_ID[1] */ |
533 | 547 | ||
534 | /* Add PIDs to filter */ | 548 | return 17 + add_pid_filter(fdtv, &c->operand[17]); |
535 | fdtv->avc_data_length = | ||
536 | ALIGN(17 + add_pid_filter(fdtv, &c->operand[17]) + 3, 4); | ||
537 | } | 549 | } |
538 | 550 | ||
539 | int avc_tuner_dsd(struct firedtv *fdtv, | 551 | int avc_tuner_dsd(struct firedtv *fdtv, |
540 | struct dvb_frontend_parameters *params) | 552 | struct dvb_frontend_parameters *params) |
541 | { | 553 | { |
542 | struct avc_command_frame *c = (void *)fdtv->avc_data; | 554 | struct avc_command_frame *c = (void *)fdtv->avc_data; |
543 | int ret; | 555 | int pos, ret; |
544 | 556 | ||
545 | mutex_lock(&fdtv->avc_mutex); | 557 | mutex_lock(&fdtv->avc_mutex); |
546 | 558 | ||
547 | memset(c, 0, sizeof(*c)); | ||
548 | |||
549 | c->ctype = AVC_CTYPE_CONTROL; | 559 | c->ctype = AVC_CTYPE_CONTROL; |
550 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 560 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
551 | 561 | ||
552 | switch (fdtv->type) { | 562 | switch (fdtv->type) { |
553 | case FIREDTV_DVB_S: | 563 | case FIREDTV_DVB_S: |
554 | case FIREDTV_DVB_S2: avc_tuner_tuneqpsk(fdtv, params); break; | 564 | case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, params); break; |
555 | case FIREDTV_DVB_C: avc_tuner_dsd_dvb_c(fdtv, params); break; | 565 | case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, params); break; |
556 | case FIREDTV_DVB_T: avc_tuner_dsd_dvb_t(fdtv, params); break; | 566 | case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, params); break; |
557 | default: | 567 | default: |
558 | BUG(); | 568 | BUG(); |
559 | } | 569 | } |
570 | pad_operands(c, pos); | ||
571 | |||
572 | fdtv->avc_data_length = ALIGN(3 + pos, 4); | ||
560 | ret = avc_write(fdtv); | 573 | ret = avc_write(fdtv); |
561 | #if 0 | 574 | #if 0 |
562 | /* | 575 | /* |
@@ -585,8 +598,6 @@ int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]) | |||
585 | 598 | ||
586 | mutex_lock(&fdtv->avc_mutex); | 599 | mutex_lock(&fdtv->avc_mutex); |
587 | 600 | ||
588 | memset(c, 0, sizeof(*c)); | ||
589 | |||
590 | c->ctype = AVC_CTYPE_CONTROL; | 601 | c->ctype = AVC_CTYPE_CONTROL; |
591 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 602 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
592 | c->opcode = AVC_OPCODE_DSD; | 603 | c->opcode = AVC_OPCODE_DSD; |
@@ -608,6 +619,7 @@ int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]) | |||
608 | c->operand[pos++] = 0x00; /* tableID */ | 619 | c->operand[pos++] = 0x00; /* tableID */ |
609 | c->operand[pos++] = 0x00; /* filter_length */ | 620 | c->operand[pos++] = 0x00; /* filter_length */ |
610 | } | 621 | } |
622 | pad_operands(c, pos); | ||
611 | 623 | ||
612 | fdtv->avc_data_length = ALIGN(3 + pos, 4); | 624 | fdtv->avc_data_length = ALIGN(3 + pos, 4); |
613 | ret = avc_write(fdtv); | 625 | ret = avc_write(fdtv); |
@@ -629,8 +641,6 @@ int avc_tuner_get_ts(struct firedtv *fdtv) | |||
629 | 641 | ||
630 | mutex_lock(&fdtv->avc_mutex); | 642 | mutex_lock(&fdtv->avc_mutex); |
631 | 643 | ||
632 | memset(c, 0, sizeof(*c)); | ||
633 | |||
634 | c->ctype = AVC_CTYPE_CONTROL; | 644 | c->ctype = AVC_CTYPE_CONTROL; |
635 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 645 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
636 | c->opcode = AVC_OPCODE_DSIT; | 646 | c->opcode = AVC_OPCODE_DSIT; |
@@ -644,9 +654,12 @@ int avc_tuner_get_ts(struct firedtv *fdtv) | |||
644 | c->operand[4] = 0x00; /* antenna number */ | 654 | c->operand[4] = 0x00; /* antenna number */ |
645 | c->operand[5] = 0x0; /* system_specific_search_flags */ | 655 | c->operand[5] = 0x0; /* system_specific_search_flags */ |
646 | c->operand[6] = sl; /* system_specific_multiplex selection_length */ | 656 | c->operand[6] = sl; /* system_specific_multiplex selection_length */ |
647 | c->operand[7] = 0x00; /* valid_flags [0] */ | 657 | /* |
648 | c->operand[8] = 0x00; /* valid_flags [1] */ | 658 | * operand[7]: valid_flags[0] |
649 | c->operand[7 + sl] = 0x00; /* nr_of_dsit_sel_specs (always 0) */ | 659 | * operand[8]: valid_flags[1] |
660 | * operand[7 + sl]: nr_of_dsit_sel_specs (always 0) | ||
661 | */ | ||
662 | clear_operands(c, 7, 24); | ||
650 | 663 | ||
651 | fdtv->avc_data_length = fdtv->type == FIREDTV_DVB_T ? 24 : 28; | 664 | fdtv->avc_data_length = fdtv->type == FIREDTV_DVB_T ? 24 : 28; |
652 | ret = avc_write(fdtv); | 665 | ret = avc_write(fdtv); |
@@ -669,8 +682,6 @@ int avc_identify_subunit(struct firedtv *fdtv) | |||
669 | 682 | ||
670 | mutex_lock(&fdtv->avc_mutex); | 683 | mutex_lock(&fdtv->avc_mutex); |
671 | 684 | ||
672 | memset(c, 0, sizeof(*c)); | ||
673 | |||
674 | c->ctype = AVC_CTYPE_CONTROL; | 685 | c->ctype = AVC_CTYPE_CONTROL; |
675 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 686 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
676 | c->opcode = AVC_OPCODE_READ_DESCRIPTOR; | 687 | c->opcode = AVC_OPCODE_READ_DESCRIPTOR; |
@@ -682,6 +693,7 @@ int avc_identify_subunit(struct firedtv *fdtv) | |||
682 | c->operand[4] = 0x08; /* length lowbyte */ | 693 | c->operand[4] = 0x08; /* length lowbyte */ |
683 | c->operand[5] = 0x00; /* offset highbyte */ | 694 | c->operand[5] = 0x00; /* offset highbyte */ |
684 | c->operand[6] = 0x0d; /* offset lowbyte */ | 695 | c->operand[6] = 0x0d; /* offset lowbyte */ |
696 | clear_operands(c, 7, 8); /* padding */ | ||
685 | 697 | ||
686 | fdtv->avc_data_length = 12; | 698 | fdtv->avc_data_length = 12; |
687 | ret = avc_write(fdtv); | 699 | ret = avc_write(fdtv); |
@@ -710,19 +722,18 @@ int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat) | |||
710 | 722 | ||
711 | mutex_lock(&fdtv->avc_mutex); | 723 | mutex_lock(&fdtv->avc_mutex); |
712 | 724 | ||
713 | memset(c, 0, sizeof(*c)); | ||
714 | |||
715 | c->ctype = AVC_CTYPE_CONTROL; | 725 | c->ctype = AVC_CTYPE_CONTROL; |
716 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 726 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
717 | c->opcode = AVC_OPCODE_READ_DESCRIPTOR; | 727 | c->opcode = AVC_OPCODE_READ_DESCRIPTOR; |
718 | 728 | ||
719 | c->operand[0] = DESCRIPTOR_TUNER_STATUS; | 729 | c->operand[0] = DESCRIPTOR_TUNER_STATUS; |
720 | c->operand[1] = 0xff; /* read_result_status */ | 730 | c->operand[1] = 0xff; /* read_result_status */ |
721 | c->operand[2] = 0x00; /* reserved */ | 731 | /* |
722 | c->operand[3] = 0; /* SIZEOF_ANTENNA_INPUT_INFO >> 8; */ | 732 | * operand[2]: reserved |
723 | c->operand[4] = 0; /* SIZEOF_ANTENNA_INPUT_INFO & 0xff; */ | 733 | * operand[3]: SIZEOF_ANTENNA_INPUT_INFO >> 8 |
724 | c->operand[5] = 0x00; | 734 | * operand[4]: SIZEOF_ANTENNA_INPUT_INFO & 0xff |
725 | c->operand[6] = 0x00; | 735 | */ |
736 | clear_operands(c, 2, 31); | ||
726 | 737 | ||
727 | fdtv->avc_data_length = 12; | 738 | fdtv->avc_data_length = 12; |
728 | ret = avc_write(fdtv); | 739 | ret = avc_write(fdtv); |
@@ -788,12 +799,10 @@ int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst, | |||
788 | { | 799 | { |
789 | struct avc_command_frame *c = (void *)fdtv->avc_data; | 800 | struct avc_command_frame *c = (void *)fdtv->avc_data; |
790 | struct avc_response_frame *r = (void *)fdtv->avc_data; | 801 | struct avc_response_frame *r = (void *)fdtv->avc_data; |
791 | int i, j, k, ret; | 802 | int pos, j, k, ret; |
792 | 803 | ||
793 | mutex_lock(&fdtv->avc_mutex); | 804 | mutex_lock(&fdtv->avc_mutex); |
794 | 805 | ||
795 | memset(c, 0, sizeof(*c)); | ||
796 | |||
797 | c->ctype = AVC_CTYPE_CONTROL; | 806 | c->ctype = AVC_CTYPE_CONTROL; |
798 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 807 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
799 | c->opcode = AVC_OPCODE_VENDOR; | 808 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -802,23 +811,21 @@ int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst, | |||
802 | c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; | 811 | c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; |
803 | c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; | 812 | c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; |
804 | c->operand[3] = SFE_VENDOR_OPCODE_LNB_CONTROL; | 813 | c->operand[3] = SFE_VENDOR_OPCODE_LNB_CONTROL; |
805 | |||
806 | c->operand[4] = voltage; | 814 | c->operand[4] = voltage; |
807 | c->operand[5] = nrdiseq; | 815 | c->operand[5] = nrdiseq; |
808 | 816 | ||
809 | i = 6; | 817 | pos = 6; |
810 | |||
811 | for (j = 0; j < nrdiseq; j++) { | 818 | for (j = 0; j < nrdiseq; j++) { |
812 | c->operand[i++] = diseqcmd[j].msg_len; | 819 | c->operand[pos++] = diseqcmd[j].msg_len; |
813 | 820 | ||
814 | for (k = 0; k < diseqcmd[j].msg_len; k++) | 821 | for (k = 0; k < diseqcmd[j].msg_len; k++) |
815 | c->operand[i++] = diseqcmd[j].msg[k]; | 822 | c->operand[pos++] = diseqcmd[j].msg[k]; |
816 | } | 823 | } |
824 | c->operand[pos++] = burst; | ||
825 | c->operand[pos++] = conttone; | ||
826 | pad_operands(c, pos); | ||
817 | 827 | ||
818 | c->operand[i++] = burst; | 828 | fdtv->avc_data_length = ALIGN(3 + pos, 4); |
819 | c->operand[i++] = conttone; | ||
820 | |||
821 | fdtv->avc_data_length = ALIGN(3 + i, 4); | ||
822 | ret = avc_write(fdtv); | 829 | ret = avc_write(fdtv); |
823 | if (ret < 0) | 830 | if (ret < 0) |
824 | goto out; | 831 | goto out; |
@@ -840,8 +847,6 @@ int avc_register_remote_control(struct firedtv *fdtv) | |||
840 | 847 | ||
841 | mutex_lock(&fdtv->avc_mutex); | 848 | mutex_lock(&fdtv->avc_mutex); |
842 | 849 | ||
843 | memset(c, 0, sizeof(*c)); | ||
844 | |||
845 | c->ctype = AVC_CTYPE_NOTIFY; | 850 | c->ctype = AVC_CTYPE_NOTIFY; |
846 | c->subunit = AVC_SUBUNIT_TYPE_UNIT | 7; | 851 | c->subunit = AVC_SUBUNIT_TYPE_UNIT | 7; |
847 | c->opcode = AVC_OPCODE_VENDOR; | 852 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -850,6 +855,7 @@ int avc_register_remote_control(struct firedtv *fdtv) | |||
850 | c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; | 855 | c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; |
851 | c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; | 856 | c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; |
852 | c->operand[3] = SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL; | 857 | c->operand[3] = SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL; |
858 | c->operand[4] = 0; /* padding */ | ||
853 | 859 | ||
854 | fdtv->avc_data_length = 8; | 860 | fdtv->avc_data_length = 8; |
855 | ret = avc_write(fdtv); | 861 | ret = avc_write(fdtv); |
@@ -878,8 +884,6 @@ int avc_tuner_host2ca(struct firedtv *fdtv) | |||
878 | 884 | ||
879 | mutex_lock(&fdtv->avc_mutex); | 885 | mutex_lock(&fdtv->avc_mutex); |
880 | 886 | ||
881 | memset(c, 0, sizeof(*c)); | ||
882 | |||
883 | c->ctype = AVC_CTYPE_CONTROL; | 887 | c->ctype = AVC_CTYPE_CONTROL; |
884 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 888 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
885 | c->opcode = AVC_OPCODE_VENDOR; | 889 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -890,8 +894,7 @@ int avc_tuner_host2ca(struct firedtv *fdtv) | |||
890 | c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA; | 894 | c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA; |
891 | c->operand[4] = 0; /* slot */ | 895 | c->operand[4] = 0; /* slot */ |
892 | c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */ | 896 | c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */ |
893 | c->operand[6] = 0; /* more/last */ | 897 | clear_operands(c, 6, 8); |
894 | c->operand[7] = 0; /* length */ | ||
895 | 898 | ||
896 | fdtv->avc_data_length = 12; | 899 | fdtv->avc_data_length = 12; |
897 | ret = avc_write(fdtv); | 900 | ret = avc_write(fdtv); |
@@ -937,8 +940,6 @@ int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len) | |||
937 | 940 | ||
938 | mutex_lock(&fdtv->avc_mutex); | 941 | mutex_lock(&fdtv->avc_mutex); |
939 | 942 | ||
940 | memset(c, 0, sizeof(*c)); | ||
941 | |||
942 | c->ctype = AVC_CTYPE_STATUS; | 943 | c->ctype = AVC_CTYPE_STATUS; |
943 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 944 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
944 | c->opcode = AVC_OPCODE_VENDOR; | 945 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -949,6 +950,7 @@ int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len) | |||
949 | c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST; | 950 | c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST; |
950 | c->operand[4] = 0; /* slot */ | 951 | c->operand[4] = 0; /* slot */ |
951 | c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */ | 952 | c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */ |
953 | clear_operands(c, 6, LAST_OPERAND); | ||
952 | 954 | ||
953 | fdtv->avc_data_length = 12; | 955 | fdtv->avc_data_length = 12; |
954 | ret = avc_write(fdtv); | 956 | ret = avc_write(fdtv); |
@@ -979,8 +981,6 @@ int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len) | |||
979 | 981 | ||
980 | mutex_lock(&fdtv->avc_mutex); | 982 | mutex_lock(&fdtv->avc_mutex); |
981 | 983 | ||
982 | memset(c, 0, sizeof(*c)); | ||
983 | |||
984 | c->ctype = AVC_CTYPE_STATUS; | 984 | c->ctype = AVC_CTYPE_STATUS; |
985 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 985 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
986 | c->opcode = AVC_OPCODE_VENDOR; | 986 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -991,6 +991,7 @@ int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len) | |||
991 | c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST; | 991 | c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST; |
992 | c->operand[4] = 0; /* slot */ | 992 | c->operand[4] = 0; /* slot */ |
993 | c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */ | 993 | c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */ |
994 | clear_operands(c, 6, LAST_OPERAND); | ||
994 | 995 | ||
995 | fdtv->avc_data_length = 12; | 996 | fdtv->avc_data_length = 12; |
996 | ret = avc_write(fdtv); | 997 | ret = avc_write(fdtv); |
@@ -1020,8 +1021,6 @@ int avc_ca_reset(struct firedtv *fdtv) | |||
1020 | 1021 | ||
1021 | mutex_lock(&fdtv->avc_mutex); | 1022 | mutex_lock(&fdtv->avc_mutex); |
1022 | 1023 | ||
1023 | memset(c, 0, sizeof(*c)); | ||
1024 | |||
1025 | c->ctype = AVC_CTYPE_CONTROL; | 1024 | c->ctype = AVC_CTYPE_CONTROL; |
1026 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 1025 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
1027 | c->opcode = AVC_OPCODE_VENDOR; | 1026 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -1064,8 +1063,6 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) | |||
1064 | 1063 | ||
1065 | mutex_lock(&fdtv->avc_mutex); | 1064 | mutex_lock(&fdtv->avc_mutex); |
1066 | 1065 | ||
1067 | memset(c, 0, sizeof(*c)); | ||
1068 | |||
1069 | c->ctype = AVC_CTYPE_CONTROL; | 1066 | c->ctype = AVC_CTYPE_CONTROL; |
1070 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 1067 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
1071 | c->opcode = AVC_OPCODE_VENDOR; | 1068 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -1096,7 +1093,7 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) | |||
1096 | 1093 | ||
1097 | c->operand[12] = 0x02; /* Table id=2 */ | 1094 | c->operand[12] = 0x02; /* Table id=2 */ |
1098 | c->operand[13] = 0x80; /* Section syntax + length */ | 1095 | c->operand[13] = 0x80; /* Section syntax + length */ |
1099 | /* c->operand[14] = XXXprogram_info_length + 12; */ | 1096 | |
1100 | c->operand[15] = msg[1]; /* Program number */ | 1097 | c->operand[15] = msg[1]; /* Program number */ |
1101 | c->operand[16] = msg[2]; | 1098 | c->operand[16] = msg[2]; |
1102 | c->operand[17] = 0x01; /* Version number=0 + current/next=1 */ | 1099 | c->operand[17] = 0x01; /* Version number=0 + current/next=1 */ |
@@ -1144,12 +1141,7 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) | |||
1144 | write_pos += es_info_length; | 1141 | write_pos += es_info_length; |
1145 | } | 1142 | } |
1146 | } | 1143 | } |
1147 | 1144 | write_pos += 4; /* CRC */ | |
1148 | /* CRC */ | ||
1149 | c->operand[write_pos++] = 0x00; | ||
1150 | c->operand[write_pos++] = 0x00; | ||
1151 | c->operand[write_pos++] = 0x00; | ||
1152 | c->operand[write_pos++] = 0x00; | ||
1153 | 1145 | ||
1154 | c->operand[7] = 0x82; | 1146 | c->operand[7] = 0x82; |
1155 | c->operand[8] = (write_pos - 10) >> 8; | 1147 | c->operand[8] = (write_pos - 10) >> 8; |
@@ -1161,6 +1153,7 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) | |||
1161 | c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff; | 1153 | c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff; |
1162 | c->operand[write_pos - 2] = (crc32_csum >> 8) & 0xff; | 1154 | c->operand[write_pos - 2] = (crc32_csum >> 8) & 0xff; |
1163 | c->operand[write_pos - 1] = (crc32_csum >> 0) & 0xff; | 1155 | c->operand[write_pos - 1] = (crc32_csum >> 0) & 0xff; |
1156 | pad_operands(c, write_pos); | ||
1164 | 1157 | ||
1165 | fdtv->avc_data_length = ALIGN(3 + write_pos, 4); | 1158 | fdtv->avc_data_length = ALIGN(3 + write_pos, 4); |
1166 | ret = avc_write(fdtv); | 1159 | ret = avc_write(fdtv); |
@@ -1186,8 +1179,6 @@ int avc_ca_get_time_date(struct firedtv *fdtv, int *interval) | |||
1186 | 1179 | ||
1187 | mutex_lock(&fdtv->avc_mutex); | 1180 | mutex_lock(&fdtv->avc_mutex); |
1188 | 1181 | ||
1189 | memset(c, 0, sizeof(*c)); | ||
1190 | |||
1191 | c->ctype = AVC_CTYPE_STATUS; | 1182 | c->ctype = AVC_CTYPE_STATUS; |
1192 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 1183 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
1193 | c->opcode = AVC_OPCODE_VENDOR; | 1184 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -1198,8 +1189,7 @@ int avc_ca_get_time_date(struct firedtv *fdtv, int *interval) | |||
1198 | c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST; | 1189 | c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST; |
1199 | c->operand[4] = 0; /* slot */ | 1190 | c->operand[4] = 0; /* slot */ |
1200 | c->operand[5] = SFE_VENDOR_TAG_CA_DATE_TIME; /* ca tag */ | 1191 | c->operand[5] = SFE_VENDOR_TAG_CA_DATE_TIME; /* ca tag */ |
1201 | c->operand[6] = 0; /* more/last */ | 1192 | clear_operands(c, 6, LAST_OPERAND); |
1202 | c->operand[7] = 0; /* length */ | ||
1203 | 1193 | ||
1204 | fdtv->avc_data_length = 12; | 1194 | fdtv->avc_data_length = 12; |
1205 | ret = avc_write(fdtv); | 1195 | ret = avc_write(fdtv); |
@@ -1222,8 +1212,6 @@ int avc_ca_enter_menu(struct firedtv *fdtv) | |||
1222 | 1212 | ||
1223 | mutex_lock(&fdtv->avc_mutex); | 1213 | mutex_lock(&fdtv->avc_mutex); |
1224 | 1214 | ||
1225 | memset(c, 0, sizeof(*c)); | ||
1226 | |||
1227 | c->ctype = AVC_CTYPE_STATUS; | 1215 | c->ctype = AVC_CTYPE_STATUS; |
1228 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 1216 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
1229 | c->opcode = AVC_OPCODE_VENDOR; | 1217 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -1234,8 +1222,7 @@ int avc_ca_enter_menu(struct firedtv *fdtv) | |||
1234 | c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA; | 1222 | c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA; |
1235 | c->operand[4] = 0; /* slot */ | 1223 | c->operand[4] = 0; /* slot */ |
1236 | c->operand[5] = SFE_VENDOR_TAG_CA_ENTER_MENU; | 1224 | c->operand[5] = SFE_VENDOR_TAG_CA_ENTER_MENU; |
1237 | c->operand[6] = 0; /* more/last */ | 1225 | clear_operands(c, 6, 8); |
1238 | c->operand[7] = 0; /* length */ | ||
1239 | 1226 | ||
1240 | fdtv->avc_data_length = 12; | 1227 | fdtv->avc_data_length = 12; |
1241 | ret = avc_write(fdtv); | 1228 | ret = avc_write(fdtv); |
@@ -1255,8 +1242,6 @@ int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len) | |||
1255 | 1242 | ||
1256 | mutex_lock(&fdtv->avc_mutex); | 1243 | mutex_lock(&fdtv->avc_mutex); |
1257 | 1244 | ||
1258 | memset(c, 0, sizeof(*c)); | ||
1259 | |||
1260 | c->ctype = AVC_CTYPE_STATUS; | 1245 | c->ctype = AVC_CTYPE_STATUS; |
1261 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; | 1246 | c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; |
1262 | c->opcode = AVC_OPCODE_VENDOR; | 1247 | c->opcode = AVC_OPCODE_VENDOR; |
@@ -1267,8 +1252,7 @@ int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len) | |||
1267 | c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST; | 1252 | c->operand[3] = SFE_VENDOR_OPCODE_CA2HOST; |
1268 | c->operand[4] = 0; /* slot */ | 1253 | c->operand[4] = 0; /* slot */ |
1269 | c->operand[5] = SFE_VENDOR_TAG_CA_MMI; | 1254 | c->operand[5] = SFE_VENDOR_TAG_CA_MMI; |
1270 | c->operand[6] = 0; /* more/last */ | 1255 | clear_operands(c, 6, LAST_OPERAND); |
1271 | c->operand[7] = 0; /* length */ | ||
1272 | 1256 | ||
1273 | fdtv->avc_data_length = 12; | 1257 | fdtv->avc_data_length = 12; |
1274 | ret = avc_write(fdtv); | 1258 | ret = avc_write(fdtv); |