tveeprom.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * tveeprom - Contains structures and functions to work with Hauppauge
  4. * eeproms.
  5. */
  6. #include <linux/if_ether.h>
  7. /**
  8. * enum tveeprom_audio_processor - Specifies the type of audio processor
  9. * used on a Hauppauge device.
  10. *
  11. * @TVEEPROM_AUDPROC_NONE: No audio processor present
  12. * @TVEEPROM_AUDPROC_INTERNAL: The audio processor is internal to the
  13. * video processor
  14. * @TVEEPROM_AUDPROC_MSP: The audio processor is a MSPXXXX device
  15. * @TVEEPROM_AUDPROC_OTHER: The audio processor is another device
  16. */
  17. enum tveeprom_audio_processor {
  18. TVEEPROM_AUDPROC_NONE,
  19. TVEEPROM_AUDPROC_INTERNAL,
  20. TVEEPROM_AUDPROC_MSP,
  21. TVEEPROM_AUDPROC_OTHER,
  22. };
  23. /**
  24. * struct tveeprom - Contains the fields parsed from Hauppauge eeproms
  25. *
  26. * @has_radio: 1 if the device has radio; 0 otherwise.
  27. *
  28. * @has_ir: If has_ir == 0, then it is unknown what the IR
  29. * capabilities are. Otherwise:
  30. * bit 0) 1 (= IR capabilities are known);
  31. * bit 1) IR receiver present;
  32. * bit 2) IR transmitter (blaster) present.
  33. *
  34. * @has_MAC_address: 0: no MAC, 1: MAC present, 2: unknown.
  35. * @tuner_type: type of the tuner (TUNER_*, as defined at
  36. * include/media/tuner.h).
  37. *
  38. * @tuner_formats: Supported analog TV standards (V4L2_STD_*).
  39. * @tuner_hauppauge_model: Hauppauge's code for the device model number.
  40. * @tuner2_type: type of the second tuner (TUNER_*, as defined
  41. * at include/media/tuner.h).
  42. *
  43. * @tuner2_formats: Tuner 2 supported analog TV standards
  44. * (V4L2_STD_*).
  45. *
  46. * @tuner2_hauppauge_model: tuner 2 Hauppauge's code for the device model
  47. * number.
  48. *
  49. * @audio_processor: analog audio decoder, as defined by enum
  50. * tveeprom_audio_processor.
  51. *
  52. * @decoder_processor: Hauppauge's code for the decoder chipset.
  53. * Unused by the drivers, as they probe the
  54. * decoder based on the PCI or USB ID.
  55. *
  56. * @model: Hauppauge's model number
  57. *
  58. * @revision: Card revision number
  59. *
  60. * @serial_number: Card's serial number
  61. *
  62. * @rev_str: Card revision converted to number
  63. *
  64. * @MAC_address: MAC address for the network interface
  65. */
  66. struct tveeprom {
  67. u32 has_radio;
  68. u32 has_ir;
  69. u32 has_MAC_address;
  70. u32 tuner_type;
  71. u32 tuner_formats;
  72. u32 tuner_hauppauge_model;
  73. u32 tuner2_type;
  74. u32 tuner2_formats;
  75. u32 tuner2_hauppauge_model;
  76. u32 audio_processor;
  77. u32 decoder_processor;
  78. u32 model;
  79. u32 revision;
  80. u32 serial_number;
  81. char rev_str[5];
  82. u8 MAC_address[ETH_ALEN];
  83. };
  84. /**
  85. * tveeprom_hauppauge_analog - Fill struct tveeprom using the contents
  86. * of the eeprom previously filled at
  87. * @eeprom_data field.
  88. *
  89. * @tvee: Struct to where the eeprom parsed data will be filled;
  90. * @eeprom_data: Array with the contents of the eeprom_data. It should
  91. * contain 256 bytes filled with the contents of the
  92. * eeprom read from the Hauppauge device.
  93. */
  94. void tveeprom_hauppauge_analog(struct tveeprom *tvee,
  95. unsigned char *eeprom_data);
  96. /**
  97. * tveeprom_read - Reads the contents of the eeprom found at the Hauppauge
  98. * devices.
  99. *
  100. * @c: I2C client struct
  101. * @eedata: Array where the eeprom content will be stored.
  102. * @len: Size of @eedata array. If the eeprom content will be latter
  103. * be parsed by tveeprom_hauppauge_analog(), len should be, at
  104. * least, 256.
  105. */
  106. int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len);