Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 /*
0004  * tveeprom - Contains structures and functions to work with Hauppauge
0005  *        eeproms.
0006  */
0007 
0008 #include <linux/if_ether.h>
0009 
0010 /**
0011  * enum tveeprom_audio_processor - Specifies the type of audio processor
0012  *                 used on a Hauppauge device.
0013  *
0014  * @TVEEPROM_AUDPROC_NONE:  No audio processor present
0015  * @TVEEPROM_AUDPROC_INTERNAL:  The audio processor is internal to the
0016  *              video processor
0017  * @TVEEPROM_AUDPROC_MSP:   The audio processor is a MSPXXXX device
0018  * @TVEEPROM_AUDPROC_OTHER: The audio processor is another device
0019  */
0020 enum tveeprom_audio_processor {
0021     TVEEPROM_AUDPROC_NONE,
0022     TVEEPROM_AUDPROC_INTERNAL,
0023     TVEEPROM_AUDPROC_MSP,
0024     TVEEPROM_AUDPROC_OTHER,
0025 };
0026 
0027 /**
0028  * struct tveeprom - Contains the fields parsed from Hauppauge eeproms
0029  *
0030  * @has_radio:          1 if the device has radio; 0 otherwise.
0031  *
0032  * @has_ir:         If has_ir == 0, then it is unknown what the IR
0033  *              capabilities are. Otherwise:
0034  *              bit 0) 1 (= IR capabilities are known);
0035  *              bit 1) IR receiver present;
0036  *              bit 2) IR transmitter (blaster) present.
0037  *
0038  * @has_MAC_address:        0: no MAC, 1: MAC present, 2: unknown.
0039  * @tuner_type:         type of the tuner (TUNER_*, as defined at
0040  *              include/media/tuner.h).
0041  *
0042  * @tuner_formats:      Supported analog TV standards (V4L2_STD_*).
0043  * @tuner_hauppauge_model:  Hauppauge's code for the device model number.
0044  * @tuner2_type:        type of the second tuner (TUNER_*, as defined
0045  *              at include/media/tuner.h).
0046  *
0047  * @tuner2_formats:     Tuner 2 supported analog TV standards
0048  *              (V4L2_STD_*).
0049  *
0050  * @tuner2_hauppauge_model: tuner 2 Hauppauge's code for the device model
0051  *              number.
0052  *
0053  * @audio_processor:        analog audio decoder, as defined by enum
0054  *              tveeprom_audio_processor.
0055  *
0056  * @decoder_processor:      Hauppauge's code for the decoder chipset.
0057  *              Unused by the drivers, as they probe the
0058  *              decoder based on the PCI or USB ID.
0059  *
0060  * @model:          Hauppauge's model number
0061  *
0062  * @revision:           Card revision number
0063  *
0064  * @serial_number:      Card's serial number
0065  *
0066  * @rev_str:            Card revision converted to number
0067  *
0068  * @MAC_address:        MAC address for the network interface
0069  */
0070 struct tveeprom {
0071     u32 has_radio;
0072     u32 has_ir;
0073     u32 has_MAC_address;
0074 
0075     u32 tuner_type;
0076     u32 tuner_formats;
0077     u32 tuner_hauppauge_model;
0078 
0079     u32 tuner2_type;
0080     u32 tuner2_formats;
0081     u32 tuner2_hauppauge_model;
0082 
0083     u32 audio_processor;
0084     u32 decoder_processor;
0085 
0086     u32 model;
0087     u32 revision;
0088     u32 serial_number;
0089     char rev_str[5];
0090     u8 MAC_address[ETH_ALEN];
0091 };
0092 
0093 /**
0094  * tveeprom_hauppauge_analog - Fill struct tveeprom using the contents
0095  *                 of the eeprom previously filled at
0096  *                 @eeprom_data field.
0097  *
0098  * @tvee:       Struct to where the eeprom parsed data will be filled;
0099  * @eeprom_data:    Array with the contents of the eeprom_data. It should
0100  *          contain 256 bytes filled with the contents of the
0101  *          eeprom read from the Hauppauge device.
0102  */
0103 void tveeprom_hauppauge_analog(struct tveeprom *tvee,
0104                    unsigned char *eeprom_data);
0105 
0106 /**
0107  * tveeprom_read - Reads the contents of the eeprom found at the Hauppauge
0108  *         devices.
0109  *
0110  * @c:      I2C client struct
0111  * @eedata: Array where the eeprom content will be stored.
0112  * @len:    Size of @eedata array. If the eeprom content will be latter
0113  *      be parsed by tveeprom_hauppauge_analog(), len should be, at
0114  *      least, 256.
0115  */
0116 int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len);