blob: b56eaee82aa58e52f7f0a978863a2144ab88276b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Mauro Carvalho Chehabac19ecc2005-06-23 22:05:09 -07002
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -03003/*
4 * tveeprom - Contains structures and functions to work with Hauppauge
5 * eeproms.
6 */
Hans Verkuil33001012013-05-29 06:59:45 -03007
Joe Perches574e2af2013-08-01 16:17:48 -07008#include <linux/if_ether.h>
9
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030010/**
11 * enum tveeprom_audio_processor - Specifies the type of audio processor
12 * used on a Hauppauge device.
13 *
14 * @TVEEPROM_AUDPROC_NONE: No audio processor present
15 * @TVEEPROM_AUDPROC_INTERNAL: The audio processor is internal to the
16 * video processor
17 * @TVEEPROM_AUDPROC_MSP: The audio processor is a MSPXXXX device
18 * @TVEEPROM_AUDPROC_OTHER: The audio processor is another device
19 */
20enum tveeprom_audio_processor {
21 TVEEPROM_AUDPROC_NONE,
22 TVEEPROM_AUDPROC_INTERNAL,
23 TVEEPROM_AUDPROC_MSP,
24 TVEEPROM_AUDPROC_OTHER,
25};
26
27/**
28 * struct tveeprom - Contains the fields parsed from Hauppauge eeproms
29 *
30 * @has_radio: 1 if the device has radio; 0 otherwise.
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030031 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030032 * @has_ir: If has_ir == 0, then it is unknown what the IR
33 * capabilities are. Otherwise:
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030034 * bit 0) 1 (= IR capabilities are known);
35 * bit 1) IR receiver present;
36 * bit 2) IR transmitter (blaster) present.
37 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030038 * @has_MAC_address: 0: no MAC, 1: MAC present, 2: unknown.
39 * @tuner_type: type of the tuner (TUNER_*, as defined at
40 * include/media/tuner.h).
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030041 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030042 * @tuner_formats: Supported analog TV standards (V4L2_STD_*).
43 * @tuner_hauppauge_model: Hauppauge's code for the device model number.
44 * @tuner2_type: type of the second tuner (TUNER_*, as defined
45 * at include/media/tuner.h).
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030046 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030047 * @tuner2_formats: Tuner 2 supported analog TV standards
48 * (V4L2_STD_*).
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030049 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030050 * @tuner2_hauppauge_model: tuner 2 Hauppauge's code for the device model
51 * number.
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030052 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030053 * @audio_processor: analog audio decoder, as defined by enum
54 * tveeprom_audio_processor.
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030055 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030056 * @decoder_processor: Hauppauge's code for the decoder chipset.
57 * Unused by the drivers, as they probe the
58 * decoder based on the PCI or USB ID.
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030059 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030060 * @model: Hauppauge's model number
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030061 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030062 * @revision: Card revision number
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030063 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030064 * @serial_number: Card's serial number
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030065 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030066 * @rev_str: Card revision converted to number
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030067 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030068 * @MAC_address: MAC address for the network interface
69 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070070struct tveeprom {
71 u32 has_radio;
Hans Verkuilb654fcdc2008-07-22 15:50:31 -030072 u32 has_ir;
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030073 u32 has_MAC_address;
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
75 u32 tuner_type;
76 u32 tuner_formats;
Hans Verkuilf95006f2005-12-01 00:51:42 -080077 u32 tuner_hauppauge_model;
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
Mauro Carvalho Chehab0f97a932005-09-09 13:04:05 -070079 u32 tuner2_type;
80 u32 tuner2_formats;
Hans Verkuilf95006f2005-12-01 00:51:42 -080081 u32 tuner2_hauppauge_model;
Mauro Carvalho Chehab0f97a932005-09-09 13:04:05 -070082
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 u32 audio_processor;
Mauro Carvalho Chehab0f97a932005-09-09 13:04:05 -070084 u32 decoder_processor;
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86 u32 model;
87 u32 revision;
88 u32 serial_number;
89 char rev_str[5];
Joe Perches574e2af2013-08-01 16:17:48 -070090 u8 MAC_address[ETH_ALEN];
Linus Torvalds1da177e2005-04-16 15:20:36 -070091};
92
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030093/**
94 * tveeprom_hauppauge_analog - Fill struct tveeprom using the contents
95 * of the eeprom previously filled at
96 * @eeprom_data field.
97 *
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -030098 * @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 Chehab446aba62017-03-03 07:28:29 -0300103void tveeprom_hauppauge_analog(struct tveeprom *tvee,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 unsigned char *eeprom_data);
105
Mauro Carvalho Chehab326ab272015-10-05 13:08:34 -0300106/**
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 Torvalds1da177e2005-04-16 15:20:36 -0700116int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len);