Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 1 | /* |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 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 |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 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) { |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 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 " |
| 27 | "linux-dvb@linuxtv.org.", |
| 28 | v.misc_204.Rev_N_sig_revision_hi); |
| 29 | break; |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | if ((fc->has_32_hw_pid_filter = v.misc_204.Rev_N_sig_caps)) |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 33 | deb_info("this FlexCop has " |
| 34 | "the additional 32 hardware pid filter.\n"); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 35 | else |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 36 | deb_info("this FlexCop has " |
| 37 | "the 6 basic main hardware pid filter.\n"); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 38 | /* bus parts have to decide if hw pid filtering is used or not. */ |
| 39 | } |
| 40 | |
Adrian Bunk | a22a6865 | 2006-01-23 09:58:17 -0200 | [diff] [blame] | 41 | static const char *flexcop_revision_names[] = { |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 42 | "Unknown chip", |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 43 | "FlexCopII", |
| 44 | "FlexCopIIb", |
| 45 | "FlexCopIII", |
| 46 | }; |
| 47 | |
Adrian Bunk | a22a6865 | 2006-01-23 09:58:17 -0200 | [diff] [blame] | 48 | static const char *flexcop_device_names[] = { |
Matthias Schwarzott | 1c905a4 | 2009-05-22 07:19:14 -0300 | [diff] [blame] | 49 | [FC_UNK] = "Unknown device", |
| 50 | [FC_CABLE] = "Cable2PC/CableStar 2 DVB-C", |
| 51 | [FC_AIR_DVBT] = "Air2PC/AirStar 2 DVB-T", |
| 52 | [FC_AIR_ATSC1] = "Air2PC/AirStar 2 ATSC 1st generation", |
| 53 | [FC_AIR_ATSC2] = "Air2PC/AirStar 2 ATSC 2nd generation", |
| 54 | [FC_AIR_ATSC3] = "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)", |
| 55 | [FC_SKY_REV23] = "Sky2PC/SkyStar 2 DVB-S rev 2.3 (old version)", |
| 56 | [FC_SKY_REV26] = "Sky2PC/SkyStar 2 DVB-S rev 2.6", |
| 57 | [FC_SKY_REV27] = "Sky2PC/SkyStar 2 DVB-S rev 2.7a/u", |
| 58 | [FC_SKY_REV28] = "Sky2PC/SkyStar 2 DVB-S rev 2.8", |
Jemma Denson | 5afc9a2 | 2015-04-14 09:04:50 -0300 | [diff] [blame^] | 59 | [FC_SKYS2_REV33] = "Sky2PC/SkyStar S2 DVB-S/S2 rev 3.3", |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
Adrian Bunk | a22a6865 | 2006-01-23 09:58:17 -0200 | [diff] [blame] | 62 | static const char *flexcop_bus_names[] = { |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 63 | "USB", |
| 64 | "PCI", |
| 65 | }; |
| 66 | |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 67 | void flexcop_device_name(struct flexcop_device *fc, |
| 68 | const char *prefix, const char *suffix) |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 69 | { |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 70 | info("%s '%s' at the '%s' bus controlled by a '%s' %s", |
| 71 | prefix, flexcop_device_names[fc->dev_type], |
| 72 | flexcop_bus_names[fc->bus_type], |
| 73 | flexcop_revision_names[fc->rev], suffix); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 74 | } |
Patrick Boettcher | 64221be | 2005-07-07 17:57:49 -0700 | [diff] [blame] | 75 | |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 76 | void flexcop_dump_reg(struct flexcop_device *fc, |
| 77 | flexcop_ibi_register reg, int num) |
Patrick Boettcher | 64221be | 2005-07-07 17:57:49 -0700 | [diff] [blame] | 78 | { |
| 79 | flexcop_ibi_value v; |
| 80 | int i; |
| 81 | for (i = 0; i < num; i++) { |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 82 | v = fc->read_ibi_reg(fc, reg+4*i); |
| 83 | deb_rdump("0x%03x: %08x, ", reg+4*i, v.raw); |
Patrick Boettcher | 64221be | 2005-07-07 17:57:49 -0700 | [diff] [blame] | 84 | } |
| 85 | deb_rdump("\n"); |
| 86 | } |
| 87 | EXPORT_SYMBOL(flexcop_dump_reg); |