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