flexcop-misc.c 2.4 KB

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