18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci/* 48c2ecf20Sopenharmony_ci * tveeprom - Contains structures and functions to work with Hauppauge 58c2ecf20Sopenharmony_ci * eeproms. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/if_ether.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/** 118c2ecf20Sopenharmony_ci * enum tveeprom_audio_processor - Specifies the type of audio processor 128c2ecf20Sopenharmony_ci * used on a Hauppauge device. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * @TVEEPROM_AUDPROC_NONE: No audio processor present 158c2ecf20Sopenharmony_ci * @TVEEPROM_AUDPROC_INTERNAL: The audio processor is internal to the 168c2ecf20Sopenharmony_ci * video processor 178c2ecf20Sopenharmony_ci * @TVEEPROM_AUDPROC_MSP: The audio processor is a MSPXXXX device 188c2ecf20Sopenharmony_ci * @TVEEPROM_AUDPROC_OTHER: The audio processor is another device 198c2ecf20Sopenharmony_ci */ 208c2ecf20Sopenharmony_cienum tveeprom_audio_processor { 218c2ecf20Sopenharmony_ci TVEEPROM_AUDPROC_NONE, 228c2ecf20Sopenharmony_ci TVEEPROM_AUDPROC_INTERNAL, 238c2ecf20Sopenharmony_ci TVEEPROM_AUDPROC_MSP, 248c2ecf20Sopenharmony_ci TVEEPROM_AUDPROC_OTHER, 258c2ecf20Sopenharmony_ci}; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/** 288c2ecf20Sopenharmony_ci * struct tveeprom - Contains the fields parsed from Hauppauge eeproms 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci * @has_radio: 1 if the device has radio; 0 otherwise. 318c2ecf20Sopenharmony_ci * 328c2ecf20Sopenharmony_ci * @has_ir: If has_ir == 0, then it is unknown what the IR 338c2ecf20Sopenharmony_ci * capabilities are. Otherwise: 348c2ecf20Sopenharmony_ci * bit 0) 1 (= IR capabilities are known); 358c2ecf20Sopenharmony_ci * bit 1) IR receiver present; 368c2ecf20Sopenharmony_ci * bit 2) IR transmitter (blaster) present. 378c2ecf20Sopenharmony_ci * 388c2ecf20Sopenharmony_ci * @has_MAC_address: 0: no MAC, 1: MAC present, 2: unknown. 398c2ecf20Sopenharmony_ci * @tuner_type: type of the tuner (TUNER_*, as defined at 408c2ecf20Sopenharmony_ci * include/media/tuner.h). 418c2ecf20Sopenharmony_ci * 428c2ecf20Sopenharmony_ci * @tuner_formats: Supported analog TV standards (V4L2_STD_*). 438c2ecf20Sopenharmony_ci * @tuner_hauppauge_model: Hauppauge's code for the device model number. 448c2ecf20Sopenharmony_ci * @tuner2_type: type of the second tuner (TUNER_*, as defined 458c2ecf20Sopenharmony_ci * at include/media/tuner.h). 468c2ecf20Sopenharmony_ci * 478c2ecf20Sopenharmony_ci * @tuner2_formats: Tuner 2 supported analog TV standards 488c2ecf20Sopenharmony_ci * (V4L2_STD_*). 498c2ecf20Sopenharmony_ci * 508c2ecf20Sopenharmony_ci * @tuner2_hauppauge_model: tuner 2 Hauppauge's code for the device model 518c2ecf20Sopenharmony_ci * number. 528c2ecf20Sopenharmony_ci * 538c2ecf20Sopenharmony_ci * @audio_processor: analog audio decoder, as defined by enum 548c2ecf20Sopenharmony_ci * tveeprom_audio_processor. 558c2ecf20Sopenharmony_ci * 568c2ecf20Sopenharmony_ci * @decoder_processor: Hauppauge's code for the decoder chipset. 578c2ecf20Sopenharmony_ci * Unused by the drivers, as they probe the 588c2ecf20Sopenharmony_ci * decoder based on the PCI or USB ID. 598c2ecf20Sopenharmony_ci * 608c2ecf20Sopenharmony_ci * @model: Hauppauge's model number 618c2ecf20Sopenharmony_ci * 628c2ecf20Sopenharmony_ci * @revision: Card revision number 638c2ecf20Sopenharmony_ci * 648c2ecf20Sopenharmony_ci * @serial_number: Card's serial number 658c2ecf20Sopenharmony_ci * 668c2ecf20Sopenharmony_ci * @rev_str: Card revision converted to number 678c2ecf20Sopenharmony_ci * 688c2ecf20Sopenharmony_ci * @MAC_address: MAC address for the network interface 698c2ecf20Sopenharmony_ci */ 708c2ecf20Sopenharmony_cistruct tveeprom { 718c2ecf20Sopenharmony_ci u32 has_radio; 728c2ecf20Sopenharmony_ci u32 has_ir; 738c2ecf20Sopenharmony_ci u32 has_MAC_address; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci u32 tuner_type; 768c2ecf20Sopenharmony_ci u32 tuner_formats; 778c2ecf20Sopenharmony_ci u32 tuner_hauppauge_model; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci u32 tuner2_type; 808c2ecf20Sopenharmony_ci u32 tuner2_formats; 818c2ecf20Sopenharmony_ci u32 tuner2_hauppauge_model; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci u32 audio_processor; 848c2ecf20Sopenharmony_ci u32 decoder_processor; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci u32 model; 878c2ecf20Sopenharmony_ci u32 revision; 888c2ecf20Sopenharmony_ci u32 serial_number; 898c2ecf20Sopenharmony_ci char rev_str[5]; 908c2ecf20Sopenharmony_ci u8 MAC_address[ETH_ALEN]; 918c2ecf20Sopenharmony_ci}; 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci/** 948c2ecf20Sopenharmony_ci * tveeprom_hauppauge_analog - Fill struct tveeprom using the contents 958c2ecf20Sopenharmony_ci * of the eeprom previously filled at 968c2ecf20Sopenharmony_ci * @eeprom_data field. 978c2ecf20Sopenharmony_ci * 988c2ecf20Sopenharmony_ci * @tvee: Struct to where the eeprom parsed data will be filled; 998c2ecf20Sopenharmony_ci * @eeprom_data: Array with the contents of the eeprom_data. It should 1008c2ecf20Sopenharmony_ci * contain 256 bytes filled with the contents of the 1018c2ecf20Sopenharmony_ci * eeprom read from the Hauppauge device. 1028c2ecf20Sopenharmony_ci */ 1038c2ecf20Sopenharmony_civoid tveeprom_hauppauge_analog(struct tveeprom *tvee, 1048c2ecf20Sopenharmony_ci unsigned char *eeprom_data); 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/** 1078c2ecf20Sopenharmony_ci * tveeprom_read - Reads the contents of the eeprom found at the Hauppauge 1088c2ecf20Sopenharmony_ci * devices. 1098c2ecf20Sopenharmony_ci * 1108c2ecf20Sopenharmony_ci * @c: I2C client struct 1118c2ecf20Sopenharmony_ci * @eedata: Array where the eeprom content will be stored. 1128c2ecf20Sopenharmony_ci * @len: Size of @eedata array. If the eeprom content will be latter 1138c2ecf20Sopenharmony_ci * be parsed by tveeprom_hauppauge_analog(), len should be, at 1148c2ecf20Sopenharmony_ci * least, 256. 1158c2ecf20Sopenharmony_ci */ 1168c2ecf20Sopenharmony_ciint tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len); 117