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