xref: /linux/drivers/media/common/b2c2/flexcop-misc.c (revision a402eae64d0ad12b1c4a411f250d6c161e67f623)
1 /*
2  * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
3  * flexcop-misc.c - miscellaneous functions
4  * see flexcop.c for copyright information
5  */
6 #include "flexcop.h"
7 
8 void flexcop_determine_revision(struct flexcop_device *fc)
9 {
10 	flexcop_ibi_value v = fc->read_ibi_reg(fc,misc_204);
11 
12 	switch (v.misc_204.Rev_N_sig_revision_hi) {
13 	case 0x2:
14 		deb_info("found a FlexCopII.\n");
15 		fc->rev = FLEXCOP_II;
16 		break;
17 	case 0x3:
18 		deb_info("found a FlexCopIIb.\n");
19 		fc->rev = FLEXCOP_IIB;
20 		break;
21 	case 0x0:
22 		deb_info("found a FlexCopIII.\n");
23 		fc->rev = FLEXCOP_III;
24 		break;
25 	default:
26 		err("unknown FlexCop Revision: %x. Please report this to linux-dvb@linuxtv.org.",
27 				v.misc_204.Rev_N_sig_revision_hi);
28 		break;
29 	}
30 
31 	if ((fc->has_32_hw_pid_filter = v.misc_204.Rev_N_sig_caps))
32 		deb_info("this FlexCop has the additional 32 hardware pid filter.\n");
33 	else
34 		deb_info("this FlexCop has the 6 basic main hardware pid filter.\n");
35 	/* bus parts have to decide if hw pid filtering is used or not. */
36 }
37 
38 static const char *flexcop_revision_names[] = {
39 	"Unknown chip",
40 	"FlexCopII",
41 	"FlexCopIIb",
42 	"FlexCopIII",
43 };
44 
45 static const char *flexcop_device_names[] = {
46 	[FC_UNK]	= "Unknown device",
47 	[FC_CABLE]	= "Cable2PC/CableStar 2 DVB-C",
48 	[FC_AIR_DVBT]	= "Air2PC/AirStar 2 DVB-T",
49 	[FC_AIR_ATSC1]	= "Air2PC/AirStar 2 ATSC 1st generation",
50 	[FC_AIR_ATSC2]	= "Air2PC/AirStar 2 ATSC 2nd generation",
51 	[FC_AIR_ATSC3]	= "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)",
52 	[FC_SKY_REV23]	= "Sky2PC/SkyStar 2 DVB-S rev 2.3 (old version)",
53 	[FC_SKY_REV26]	= "Sky2PC/SkyStar 2 DVB-S rev 2.6",
54 	[FC_SKY_REV27]	= "Sky2PC/SkyStar 2 DVB-S rev 2.7a/u",
55 	[FC_SKY_REV28]	= "Sky2PC/SkyStar 2 DVB-S rev 2.8",
56 	[FC_SKYS2_REV33] = "Sky2PC/SkyStar S2 DVB-S/S2 rev 3.3",
57 };
58 
59 static const char *flexcop_bus_names[] = {
60 	"USB",
61 	"PCI",
62 };
63 
64 void flexcop_device_name(struct flexcop_device *fc,
65 		const char *prefix, const char *suffix)
66 {
67 	info("%s '%s' at the '%s' bus controlled by a '%s' %s",
68 			prefix,	flexcop_device_names[fc->dev_type],
69 			flexcop_bus_names[fc->bus_type],
70 			flexcop_revision_names[fc->rev], suffix);
71 }
72 
73 void flexcop_dump_reg(struct flexcop_device *fc,
74 		flexcop_ibi_register reg, int num)
75 {
76 	flexcop_ibi_value v;
77 	int i;
78 	for (i = 0; i < num; i++) {
79 		v = fc->read_ibi_reg(fc, reg+4*i);
80 		deb_rdump("0x%03x: %08x, ", reg+4*i, v.raw);
81 	}
82 	deb_rdump("\n");
83 }
84 EXPORT_SYMBOL(flexcop_dump_reg);
85