aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorManu Abraham <manu@linuxtv.org>2005-09-09 16:03:01 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:43 -0400
commit62121b1f9e25377ff50121f8c34a4aa92c47f465 (patch)
tree8205e4e05bc27e61e41a6985e721aa10740f9677 /drivers
parenta427de6f72bc0d83ebb1d87f9003c5e1009f21cd (diff)
[PATCH] dvb: dst: identify boards
Identify board properly: Add functions to retrieve MAC Address, FW details, Card type and Vendor Information. Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/bt8xx/dst.c89
-rw-r--r--drivers/media/dvb/bt8xx/dst_common.h4
2 files changed, 90 insertions, 3 deletions
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 39835edba1d9..eef34481d535 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -673,7 +673,7 @@ struct dst_types dst_tlist[] = {
673 .offset = 1, 673 .offset = 1,
674 .dst_type = DST_TYPE_IS_CABLE, 674 .dst_type = DST_TYPE_IS_CABLE,
675 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1 675 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1
676 | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD, 676 | DST_TYPE_HAS_FW_2,
677 .dst_feature = DST_TYPE_HAS_CA 677 .dst_feature = DST_TYPE_HAS_CA
678 }, 678 },
679 679
@@ -681,7 +681,7 @@ struct dst_types dst_tlist[] = {
681 .device_id = "DCTNEW", 681 .device_id = "DCTNEW",
682 .offset = 1, 682 .offset = 1,
683 .dst_type = DST_TYPE_IS_CABLE, 683 .dst_type = DST_TYPE_IS_CABLE,
684 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3, 684 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3 | DST_TYPE_HAS_FW_BUILD,
685 .dst_feature = 0 685 .dst_feature = 0
686 }, 686 },
687 687
@@ -689,7 +689,7 @@ struct dst_types dst_tlist[] = {
689 .device_id = "DTT-CI", 689 .device_id = "DTT-CI",
690 .offset = 1, 690 .offset = 1,
691 .dst_type = DST_TYPE_IS_TERR, 691 .dst_type = DST_TYPE_IS_TERR,
692 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD, 692 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2,
693 .dst_feature = 0 693 .dst_feature = 0
694 }, 694 },
695 695
@@ -729,6 +729,71 @@ struct dst_types dst_tlist[] = {
729 729
730}; 730};
731 731
732static int dst_get_mac(struct dst_state *state)
733{
734 u8 get_mac[] = { 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
735 get_mac[7] = dst_check_sum(get_mac, 7);
736 if (dst_command(state, get_mac, 8) < 0) {
737 dprintk(verbose, DST_INFO, 1, "Unsupported Command");
738 return -1;
739 }
740 memset(&state->mac_address, '\0', 8);
741 memcpy(&state->mac_address, &state->rxbuffer, 6);
742 dprintk(verbose, DST_ERROR, 1, "MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]",
743 state->mac_address[0], state->mac_address[1], state->mac_address[2],
744 state->mac_address[4], state->mac_address[5], state->mac_address[6]);
745
746 return 0;
747}
748
749static int dst_fw_ver(struct dst_state *state)
750{
751 u8 get_ver[] = { 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
752 get_ver[7] = dst_check_sum(get_ver, 7);
753 if (dst_command(state, get_ver, 8) < 0) {
754 dprintk(verbose, DST_INFO, 1, "Unsupported Command");
755 return -1;
756 }
757 memset(&state->fw_version, '\0', 8);
758 memcpy(&state->fw_version, &state->rxbuffer, 8);
759 dprintk(verbose, DST_ERROR, 1, "Firmware Ver = %x.%x Build = %02x, on %x:%x, %x-%x-20%02x",
760 state->fw_version[0] >> 4, state->fw_version[0] & 0x0f,
761 state->fw_version[1],
762 state->fw_version[5], state->fw_version[6],
763 state->fw_version[4], state->fw_version[3], state->fw_version[2]);
764
765 return 0;
766}
767
768static int dst_card_type(struct dst_state *state)
769{
770 u8 get_type[] = { 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
771 get_type[7] = dst_check_sum(get_type, 7);
772 if (dst_command(state, get_type, 8) < 0) {
773 dprintk(verbose, DST_INFO, 1, "Unsupported Command");
774 return -1;
775 }
776 memset(&state->card_info, '\0', 8);
777 memcpy(&state->card_info, &state->rxbuffer, 8);
778 dprintk(verbose, DST_ERROR, 1, "Device Model=[%s]", &state->card_info[0]);
779
780 return 0;
781}
782
783static int dst_get_vendor(struct dst_state *state)
784{
785 u8 get_vendor[] = { 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
786 get_vendor[7] = dst_check_sum(get_vendor, 7);
787 if (dst_command(state, get_vendor, 8) < 0) {
788 dprintk(verbose, DST_INFO, 1, "Unsupported Command");
789 return -1;
790 }
791 memset(&state->vendor, '\0', 8);
792 memcpy(&state->vendor, &state->rxbuffer, 8);
793 dprintk(verbose, DST_ERROR, 1, "Vendor=[%s]", &state->vendor[0]);
794
795 return 0;
796}
732 797
733static int dst_get_device_id(struct dst_state *state) 798static int dst_get_device_id(struct dst_state *state)
734{ 799{
@@ -816,6 +881,24 @@ static int dst_probe(struct dst_state *state)
816 dprintk(verbose, DST_ERROR, 1, "unknown device."); 881 dprintk(verbose, DST_ERROR, 1, "unknown device.");
817 return -1; 882 return -1;
818 } 883 }
884 if (dst_get_mac(state) < 0) {
885 dprintk(verbose, DST_INFO, 1, "MAC: Unsupported command");
886 return 0;
887 }
888 if (state->type_flags & DST_TYPE_HAS_FW_BUILD) {
889 if (dst_fw_ver(state) < 0) {
890 dprintk(verbose, DST_INFO, 1, "FW: Unsupported command");
891 return 0;
892 }
893 if (dst_card_type(state) < 0) {
894 dprintk(verbose, DST_INFO, 1, "Card: Unsupported command");
895 return 0;
896 }
897 if (dst_get_vendor(state) < 0) {
898 dprintk(verbose, DST_INFO, 1, "Vendor: Unsupported command");
899 return 0;
900 }
901 }
819 902
820 return 0; 903 return 0;
821} 904}
diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h
index c0ee0b197bb8..3281a6ca3685 100644
--- a/drivers/media/dvb/bt8xx/dst_common.h
+++ b/drivers/media/dvb/bt8xx/dst_common.h
@@ -113,6 +113,10 @@ struct dst_state {
113 fe_sec_mini_cmd_t minicmd; 113 fe_sec_mini_cmd_t minicmd;
114 fe_modulation_t modulation; 114 fe_modulation_t modulation;
115 u8 messages[256]; 115 u8 messages[256];
116 u8 mac_address[8];
117 u8 fw_version[8];
118 u8 card_info[8];
119 u8 vendor[8];
116}; 120};
117 121
118struct dst_types { 122struct dst_types {