1*c942fddfSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2b285192aSMauro Carvalho Chehab /*
3b285192aSMauro Carvalho Chehab * Driver for the NXP SAA7164 PCIe bridge
4b285192aSMauro Carvalho Chehab *
563a412ecSSteven Toth * Copyright (c) 2010-2015 Steven Toth <stoth@kernellabs.com>
6b285192aSMauro Carvalho Chehab */
7b285192aSMauro Carvalho Chehab
8b285192aSMauro Carvalho Chehab #include <linux/init.h>
9b285192aSMauro Carvalho Chehab #include <linux/module.h>
10b285192aSMauro Carvalho Chehab #include <linux/pci.h>
11b285192aSMauro Carvalho Chehab #include <linux/delay.h>
12b285192aSMauro Carvalho Chehab
13b285192aSMauro Carvalho Chehab #include "saa7164.h"
14b285192aSMauro Carvalho Chehab
15b285192aSMauro Carvalho Chehab /* The Bridge API needs to understand register widths (in bytes) for the
16b285192aSMauro Carvalho Chehab * attached I2C devices, so we can simplify the virtual i2c mechansms
17b285192aSMauro Carvalho Chehab * and keep the -i2c.c implementation clean.
18b285192aSMauro Carvalho Chehab */
19504b29cbSSteven Toth #define REGLEN_0bit 0
20b285192aSMauro Carvalho Chehab #define REGLEN_8bit 1
21b285192aSMauro Carvalho Chehab #define REGLEN_16bit 2
22b285192aSMauro Carvalho Chehab
23b285192aSMauro Carvalho Chehab struct saa7164_board saa7164_boards[] = {
24b285192aSMauro Carvalho Chehab [SAA7164_BOARD_UNKNOWN] = {
25b285192aSMauro Carvalho Chehab /* Bridge will not load any firmware, without knowing
26b285192aSMauro Carvalho Chehab * the rev this would be fatal. */
27b285192aSMauro Carvalho Chehab .name = "Unknown",
28b285192aSMauro Carvalho Chehab },
29b285192aSMauro Carvalho Chehab [SAA7164_BOARD_UNKNOWN_REV2] = {
30b285192aSMauro Carvalho Chehab /* Bridge will load the v2 f/w and dump descriptors */
31b285192aSMauro Carvalho Chehab /* Required during new board bringup */
32b285192aSMauro Carvalho Chehab .name = "Generic Rev2",
33b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV2,
34b285192aSMauro Carvalho Chehab },
35b285192aSMauro Carvalho Chehab [SAA7164_BOARD_UNKNOWN_REV3] = {
36b285192aSMauro Carvalho Chehab /* Bridge will load the v2 f/w and dump descriptors */
37b285192aSMauro Carvalho Chehab /* Required during new board bringup */
38b285192aSMauro Carvalho Chehab .name = "Generic Rev3",
39b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV3,
40b285192aSMauro Carvalho Chehab },
41b285192aSMauro Carvalho Chehab [SAA7164_BOARD_HAUPPAUGE_HVR2200] = {
42b285192aSMauro Carvalho Chehab .name = "Hauppauge WinTV-HVR2200",
43b285192aSMauro Carvalho Chehab .porta = SAA7164_MPEG_DVB,
44b285192aSMauro Carvalho Chehab .portb = SAA7164_MPEG_DVB,
45b285192aSMauro Carvalho Chehab .portc = SAA7164_MPEG_ENCODER,
46b285192aSMauro Carvalho Chehab .portd = SAA7164_MPEG_ENCODER,
47b285192aSMauro Carvalho Chehab .porte = SAA7164_MPEG_VBI,
48b285192aSMauro Carvalho Chehab .portf = SAA7164_MPEG_VBI,
49b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV3,
50b285192aSMauro Carvalho Chehab .unit = {{
51b285192aSMauro Carvalho Chehab .id = 0x1d,
52b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_EEPROM,
53b285192aSMauro Carvalho Chehab .name = "4K EEPROM",
54b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_0,
55b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xa0 >> 1,
56b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
57b285192aSMauro Carvalho Chehab }, {
58b285192aSMauro Carvalho Chehab .id = 0x04,
59b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
60b285192aSMauro Carvalho Chehab .name = "TDA18271-1",
61b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
62b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
63b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
64b285192aSMauro Carvalho Chehab }, {
65b285192aSMauro Carvalho Chehab .id = 0x1b,
66b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
67b285192aSMauro Carvalho Chehab .name = "TDA18271-2",
68b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
69b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
70b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
71b285192aSMauro Carvalho Chehab }, {
72b285192aSMauro Carvalho Chehab .id = 0x1e,
73b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
74b285192aSMauro Carvalho Chehab .name = "TDA10048-1",
75b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
76b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x10 >> 1,
77b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
78b285192aSMauro Carvalho Chehab }, {
79b285192aSMauro Carvalho Chehab .id = 0x1f,
80b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
81b285192aSMauro Carvalho Chehab .name = "TDA10048-2",
82b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
83b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x12 >> 1,
84b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
85b285192aSMauro Carvalho Chehab } },
86b285192aSMauro Carvalho Chehab },
87b285192aSMauro Carvalho Chehab [SAA7164_BOARD_HAUPPAUGE_HVR2200_2] = {
88b285192aSMauro Carvalho Chehab .name = "Hauppauge WinTV-HVR2200",
89b285192aSMauro Carvalho Chehab .porta = SAA7164_MPEG_DVB,
90b285192aSMauro Carvalho Chehab .portb = SAA7164_MPEG_DVB,
91b285192aSMauro Carvalho Chehab .portc = SAA7164_MPEG_ENCODER,
92b285192aSMauro Carvalho Chehab .portd = SAA7164_MPEG_ENCODER,
93b285192aSMauro Carvalho Chehab .porte = SAA7164_MPEG_VBI,
94b285192aSMauro Carvalho Chehab .portf = SAA7164_MPEG_VBI,
95b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV2,
96b285192aSMauro Carvalho Chehab .unit = {{
97b285192aSMauro Carvalho Chehab .id = 0x06,
98b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_EEPROM,
99b285192aSMauro Carvalho Chehab .name = "4K EEPROM",
100b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_0,
101b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xa0 >> 1,
102b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
103b285192aSMauro Carvalho Chehab }, {
104b285192aSMauro Carvalho Chehab .id = 0x04,
105b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
106b285192aSMauro Carvalho Chehab .name = "TDA18271-1",
107b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
108b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
109b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
110b285192aSMauro Carvalho Chehab }, {
111b285192aSMauro Carvalho Chehab .id = 0x05,
112b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
113b285192aSMauro Carvalho Chehab .name = "TDA10048-1",
114b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
115b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x10 >> 1,
116b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
117b285192aSMauro Carvalho Chehab }, {
118b285192aSMauro Carvalho Chehab .id = 0x1e,
119b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
120b285192aSMauro Carvalho Chehab .name = "TDA18271-2",
121b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
122b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
123b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
124b285192aSMauro Carvalho Chehab }, {
125b285192aSMauro Carvalho Chehab .id = 0x1f,
126b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
127b285192aSMauro Carvalho Chehab .name = "TDA10048-2",
128b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
129b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x12 >> 1,
130b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
131b285192aSMauro Carvalho Chehab } },
132b285192aSMauro Carvalho Chehab },
133b285192aSMauro Carvalho Chehab [SAA7164_BOARD_HAUPPAUGE_HVR2200_3] = {
134b285192aSMauro Carvalho Chehab .name = "Hauppauge WinTV-HVR2200",
135b285192aSMauro Carvalho Chehab .porta = SAA7164_MPEG_DVB,
136b285192aSMauro Carvalho Chehab .portb = SAA7164_MPEG_DVB,
137b285192aSMauro Carvalho Chehab .portc = SAA7164_MPEG_ENCODER,
138b285192aSMauro Carvalho Chehab .portd = SAA7164_MPEG_ENCODER,
139b285192aSMauro Carvalho Chehab .porte = SAA7164_MPEG_VBI,
140b285192aSMauro Carvalho Chehab .portf = SAA7164_MPEG_VBI,
141b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV2,
142b285192aSMauro Carvalho Chehab .unit = {{
143b285192aSMauro Carvalho Chehab .id = 0x1d,
144b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_EEPROM,
145b285192aSMauro Carvalho Chehab .name = "4K EEPROM",
146b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_0,
147b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xa0 >> 1,
148b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
149b285192aSMauro Carvalho Chehab }, {
150b285192aSMauro Carvalho Chehab .id = 0x04,
151b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
152b285192aSMauro Carvalho Chehab .name = "TDA18271-1",
153b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
154b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
155b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
156b285192aSMauro Carvalho Chehab }, {
157b285192aSMauro Carvalho Chehab .id = 0x05,
158b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
159b285192aSMauro Carvalho Chehab .name = "TDA8290-1",
160b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
161b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x84 >> 1,
162b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
163b285192aSMauro Carvalho Chehab }, {
164b285192aSMauro Carvalho Chehab .id = 0x1b,
165b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
166b285192aSMauro Carvalho Chehab .name = "TDA18271-2",
167b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
168b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
169b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
170b285192aSMauro Carvalho Chehab }, {
171b285192aSMauro Carvalho Chehab .id = 0x1c,
172b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
173b285192aSMauro Carvalho Chehab .name = "TDA8290-2",
174b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
175b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x84 >> 1,
176b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
177b285192aSMauro Carvalho Chehab }, {
178b285192aSMauro Carvalho Chehab .id = 0x1e,
179b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
180b285192aSMauro Carvalho Chehab .name = "TDA10048-1",
181b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
182b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x10 >> 1,
183b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
184b285192aSMauro Carvalho Chehab }, {
185b285192aSMauro Carvalho Chehab .id = 0x1f,
186b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
187b285192aSMauro Carvalho Chehab .name = "TDA10048-2",
188b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
189b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x12 >> 1,
190b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
191b285192aSMauro Carvalho Chehab } },
192b285192aSMauro Carvalho Chehab },
193b285192aSMauro Carvalho Chehab [SAA7164_BOARD_HAUPPAUGE_HVR2200_4] = {
194b285192aSMauro Carvalho Chehab .name = "Hauppauge WinTV-HVR2200",
195b285192aSMauro Carvalho Chehab .porta = SAA7164_MPEG_DVB,
196b285192aSMauro Carvalho Chehab .portb = SAA7164_MPEG_DVB,
197b285192aSMauro Carvalho Chehab .portc = SAA7164_MPEG_ENCODER,
198b285192aSMauro Carvalho Chehab .portd = SAA7164_MPEG_ENCODER,
199b285192aSMauro Carvalho Chehab .porte = SAA7164_MPEG_VBI,
200b285192aSMauro Carvalho Chehab .portf = SAA7164_MPEG_VBI,
201b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV3,
202b285192aSMauro Carvalho Chehab .unit = {{
203b285192aSMauro Carvalho Chehab .id = 0x1d,
204b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_EEPROM,
205b285192aSMauro Carvalho Chehab .name = "4K EEPROM",
206b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_0,
207b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xa0 >> 1,
208b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
209b285192aSMauro Carvalho Chehab }, {
210b285192aSMauro Carvalho Chehab .id = 0x04,
211b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
212b285192aSMauro Carvalho Chehab .name = "TDA18271-1",
213b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
214b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
215b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
216b285192aSMauro Carvalho Chehab }, {
217b285192aSMauro Carvalho Chehab .id = 0x05,
218b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
219b285192aSMauro Carvalho Chehab .name = "TDA8290-1",
220b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
221b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x84 >> 1,
222b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
223b285192aSMauro Carvalho Chehab }, {
224b285192aSMauro Carvalho Chehab .id = 0x1b,
225b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
226b285192aSMauro Carvalho Chehab .name = "TDA18271-2",
227b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
228b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
229b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
230b285192aSMauro Carvalho Chehab }, {
231b285192aSMauro Carvalho Chehab .id = 0x1c,
232b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
233b285192aSMauro Carvalho Chehab .name = "TDA8290-2",
234b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
235b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x84 >> 1,
236b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
237b285192aSMauro Carvalho Chehab }, {
238b285192aSMauro Carvalho Chehab .id = 0x1e,
239b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
240b285192aSMauro Carvalho Chehab .name = "TDA10048-1",
241b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
242b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x10 >> 1,
243b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
244b285192aSMauro Carvalho Chehab }, {
245b285192aSMauro Carvalho Chehab .id = 0x1f,
246b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
247b285192aSMauro Carvalho Chehab .name = "TDA10048-2",
248b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
249b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x12 >> 1,
250b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
251b285192aSMauro Carvalho Chehab } },
252b285192aSMauro Carvalho Chehab },
253b285192aSMauro Carvalho Chehab [SAA7164_BOARD_HAUPPAUGE_HVR2250] = {
254b285192aSMauro Carvalho Chehab .name = "Hauppauge WinTV-HVR2250",
255b285192aSMauro Carvalho Chehab .porta = SAA7164_MPEG_DVB,
256b285192aSMauro Carvalho Chehab .portb = SAA7164_MPEG_DVB,
257b285192aSMauro Carvalho Chehab .portc = SAA7164_MPEG_ENCODER,
258b285192aSMauro Carvalho Chehab .portd = SAA7164_MPEG_ENCODER,
259b285192aSMauro Carvalho Chehab .porte = SAA7164_MPEG_VBI,
260b285192aSMauro Carvalho Chehab .portf = SAA7164_MPEG_VBI,
261b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV3,
262b285192aSMauro Carvalho Chehab .unit = {{
263b285192aSMauro Carvalho Chehab .id = 0x22,
264b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_EEPROM,
265b285192aSMauro Carvalho Chehab .name = "4K EEPROM",
266b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_0,
267b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xa0 >> 1,
268b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
269b285192aSMauro Carvalho Chehab }, {
270b285192aSMauro Carvalho Chehab .id = 0x04,
271b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
272b285192aSMauro Carvalho Chehab .name = "TDA18271-1",
273b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
274b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
275b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
276b285192aSMauro Carvalho Chehab }, {
277b285192aSMauro Carvalho Chehab .id = 0x07,
278b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
279b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-1 (TOP)",
280b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
281b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x32 >> 1,
282b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
283b285192aSMauro Carvalho Chehab }, {
284b285192aSMauro Carvalho Chehab .id = 0x08,
285b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
286b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-1 (QAM)",
287b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
288b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x34 >> 1,
289b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
290b285192aSMauro Carvalho Chehab }, {
291b285192aSMauro Carvalho Chehab .id = 0x1e,
292b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
293b285192aSMauro Carvalho Chehab .name = "TDA18271-2",
294b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
295b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
296b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
297b285192aSMauro Carvalho Chehab }, {
298b285192aSMauro Carvalho Chehab .id = 0x20,
299b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
300b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-2 (TOP)",
301b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
302b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x32 >> 1,
303b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
304b285192aSMauro Carvalho Chehab }, {
305b285192aSMauro Carvalho Chehab .id = 0x23,
306b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
307b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-2 (QAM)",
308b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
309b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x34 >> 1,
310b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
311b285192aSMauro Carvalho Chehab } },
312b285192aSMauro Carvalho Chehab },
313b285192aSMauro Carvalho Chehab [SAA7164_BOARD_HAUPPAUGE_HVR2250_2] = {
314b285192aSMauro Carvalho Chehab .name = "Hauppauge WinTV-HVR2250",
315b285192aSMauro Carvalho Chehab .porta = SAA7164_MPEG_DVB,
316b285192aSMauro Carvalho Chehab .portb = SAA7164_MPEG_DVB,
317b285192aSMauro Carvalho Chehab .portc = SAA7164_MPEG_ENCODER,
318b285192aSMauro Carvalho Chehab .portd = SAA7164_MPEG_ENCODER,
319b285192aSMauro Carvalho Chehab .porte = SAA7164_MPEG_VBI,
320b285192aSMauro Carvalho Chehab .portf = SAA7164_MPEG_VBI,
321b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV3,
322b285192aSMauro Carvalho Chehab .unit = {{
323b285192aSMauro Carvalho Chehab .id = 0x28,
324b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_EEPROM,
325b285192aSMauro Carvalho Chehab .name = "4K EEPROM",
326b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_0,
327b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xa0 >> 1,
328b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
329b285192aSMauro Carvalho Chehab }, {
330b285192aSMauro Carvalho Chehab .id = 0x04,
331b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
332b285192aSMauro Carvalho Chehab .name = "TDA18271-1",
333b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
334b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
335b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
336b285192aSMauro Carvalho Chehab }, {
337b285192aSMauro Carvalho Chehab .id = 0x07,
338b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
339b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-1 (TOP)",
340b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
341b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x32 >> 1,
342b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
343b285192aSMauro Carvalho Chehab }, {
344b285192aSMauro Carvalho Chehab .id = 0x08,
345b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
346b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-1 (QAM)",
347b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
348b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x34 >> 1,
349b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
350b285192aSMauro Carvalho Chehab }, {
351b285192aSMauro Carvalho Chehab .id = 0x24,
352b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
353b285192aSMauro Carvalho Chehab .name = "TDA18271-2",
354b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
355b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
356b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
357b285192aSMauro Carvalho Chehab }, {
358b285192aSMauro Carvalho Chehab .id = 0x26,
359b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
360b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-2 (TOP)",
361b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
362b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x32 >> 1,
363b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
364b285192aSMauro Carvalho Chehab }, {
365b285192aSMauro Carvalho Chehab .id = 0x29,
366b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
367b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-2 (QAM)",
368b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
369b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x34 >> 1,
370b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
371b285192aSMauro Carvalho Chehab } },
372b285192aSMauro Carvalho Chehab },
373b285192aSMauro Carvalho Chehab [SAA7164_BOARD_HAUPPAUGE_HVR2250_3] = {
374b285192aSMauro Carvalho Chehab .name = "Hauppauge WinTV-HVR2250",
375b285192aSMauro Carvalho Chehab .porta = SAA7164_MPEG_DVB,
376b285192aSMauro Carvalho Chehab .portb = SAA7164_MPEG_DVB,
377b285192aSMauro Carvalho Chehab .portc = SAA7164_MPEG_ENCODER,
378b285192aSMauro Carvalho Chehab .portd = SAA7164_MPEG_ENCODER,
379b285192aSMauro Carvalho Chehab .porte = SAA7164_MPEG_VBI,
380b285192aSMauro Carvalho Chehab .portf = SAA7164_MPEG_VBI,
381b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV3,
382b285192aSMauro Carvalho Chehab .unit = {{
383b285192aSMauro Carvalho Chehab .id = 0x26,
384b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_EEPROM,
385b285192aSMauro Carvalho Chehab .name = "4K EEPROM",
386b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_0,
387b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xa0 >> 1,
388b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
389b285192aSMauro Carvalho Chehab }, {
390b285192aSMauro Carvalho Chehab .id = 0x04,
391b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
392b285192aSMauro Carvalho Chehab .name = "TDA18271-1",
393b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
394b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
395b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
396b285192aSMauro Carvalho Chehab }, {
397b285192aSMauro Carvalho Chehab .id = 0x07,
398b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
399b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-1 (TOP)",
400b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
401b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x32 >> 1,
402b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
403b285192aSMauro Carvalho Chehab }, {
404b285192aSMauro Carvalho Chehab .id = 0x08,
405b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
406b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-1 (QAM)",
407b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
408b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x34 >> 1,
409b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
410b285192aSMauro Carvalho Chehab }, {
411b285192aSMauro Carvalho Chehab .id = 0x22,
412b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
413b285192aSMauro Carvalho Chehab .name = "TDA18271-2",
414b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
415b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
416b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
417b285192aSMauro Carvalho Chehab }, {
418b285192aSMauro Carvalho Chehab .id = 0x24,
419b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
420b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-2 (TOP)",
421b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
422b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x32 >> 1,
423b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
424b285192aSMauro Carvalho Chehab }, {
425b285192aSMauro Carvalho Chehab .id = 0x27,
426b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
427b285192aSMauro Carvalho Chehab .name = "CX24228/S5H1411-2 (QAM)",
428b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
429b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x34 >> 1,
430b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
431b285192aSMauro Carvalho Chehab } },
432b285192aSMauro Carvalho Chehab },
433b285192aSMauro Carvalho Chehab [SAA7164_BOARD_HAUPPAUGE_HVR2200_5] = {
434b285192aSMauro Carvalho Chehab .name = "Hauppauge WinTV-HVR2200",
435b285192aSMauro Carvalho Chehab .porta = SAA7164_MPEG_DVB,
436b285192aSMauro Carvalho Chehab .portb = SAA7164_MPEG_DVB,
437b285192aSMauro Carvalho Chehab .chiprev = SAA7164_CHIP_REV3,
438b285192aSMauro Carvalho Chehab .unit = {{
439b285192aSMauro Carvalho Chehab .id = 0x23,
440b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_EEPROM,
441b285192aSMauro Carvalho Chehab .name = "4K EEPROM",
442b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_0,
443b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xa0 >> 1,
444b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
445b285192aSMauro Carvalho Chehab }, {
446b285192aSMauro Carvalho Chehab .id = 0x04,
447b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
448b285192aSMauro Carvalho Chehab .name = "TDA18271-1",
449b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
450b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
451b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
452b285192aSMauro Carvalho Chehab }, {
453b285192aSMauro Carvalho Chehab .id = 0x05,
454b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
455b285192aSMauro Carvalho Chehab .name = "TDA8290-1",
456b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
457b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x84 >> 1,
458b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
459b285192aSMauro Carvalho Chehab }, {
460b285192aSMauro Carvalho Chehab .id = 0x21,
461b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_TUNER,
462b285192aSMauro Carvalho Chehab .name = "TDA18271-2",
463b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
464b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0xc0 >> 1,
465b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
466b285192aSMauro Carvalho Chehab }, {
467b285192aSMauro Carvalho Chehab .id = 0x22,
468b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
469b285192aSMauro Carvalho Chehab .name = "TDA8290-2",
470b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
471b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x84 >> 1,
472b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
473b285192aSMauro Carvalho Chehab }, {
474b285192aSMauro Carvalho Chehab .id = 0x24,
475b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
476b285192aSMauro Carvalho Chehab .name = "TDA10048-1",
477b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_1,
478b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x10 >> 1,
479b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
480b285192aSMauro Carvalho Chehab }, {
481b285192aSMauro Carvalho Chehab .id = 0x25,
482b285192aSMauro Carvalho Chehab .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
483b285192aSMauro Carvalho Chehab .name = "TDA10048-2",
484b285192aSMauro Carvalho Chehab .i2c_bus_nr = SAA7164_I2C_BUS_2,
485b285192aSMauro Carvalho Chehab .i2c_bus_addr = 0x12 >> 1,
486b285192aSMauro Carvalho Chehab .i2c_reg_len = REGLEN_8bit,
487b285192aSMauro Carvalho Chehab } },
488b285192aSMauro Carvalho Chehab },
489504b29cbSSteven Toth [SAA7164_BOARD_HAUPPAUGE_HVR2255proto] = {
490504b29cbSSteven Toth .name = "Hauppauge WinTV-HVR2255(proto)",
491504b29cbSSteven Toth .porta = SAA7164_MPEG_DVB,
492504b29cbSSteven Toth .portb = SAA7164_MPEG_DVB,
493504b29cbSSteven Toth .portc = SAA7164_MPEG_ENCODER,
494504b29cbSSteven Toth .portd = SAA7164_MPEG_ENCODER,
495504b29cbSSteven Toth .porte = SAA7164_MPEG_VBI,
496504b29cbSSteven Toth .portf = SAA7164_MPEG_VBI,
497504b29cbSSteven Toth .chiprev = SAA7164_CHIP_REV3,
498504b29cbSSteven Toth .unit = {{
499504b29cbSSteven Toth .id = 0x27,
500504b29cbSSteven Toth .type = SAA7164_UNIT_EEPROM,
501504b29cbSSteven Toth .name = "4K EEPROM",
502504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_0,
503504b29cbSSteven Toth .i2c_bus_addr = 0xa0 >> 1,
504504b29cbSSteven Toth .i2c_reg_len = REGLEN_8bit,
505504b29cbSSteven Toth }, {
506504b29cbSSteven Toth .id = 0x04,
507504b29cbSSteven Toth .type = SAA7164_UNIT_TUNER,
508504b29cbSSteven Toth .name = "SI2157-1",
509504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_0,
510504b29cbSSteven Toth .i2c_bus_addr = 0xc0 >> 1,
511504b29cbSSteven Toth .i2c_reg_len = REGLEN_0bit,
512504b29cbSSteven Toth }, {
513504b29cbSSteven Toth .id = 0x06,
514504b29cbSSteven Toth .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
515504b29cbSSteven Toth .name = "LGDT3306",
516504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_2,
517504b29cbSSteven Toth .i2c_bus_addr = 0xb2 >> 1,
518504b29cbSSteven Toth .i2c_reg_len = REGLEN_8bit,
519504b29cbSSteven Toth }, {
520504b29cbSSteven Toth .id = 0x24,
521504b29cbSSteven Toth .type = SAA7164_UNIT_TUNER,
522504b29cbSSteven Toth .name = "SI2157-2",
523504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_1,
524504b29cbSSteven Toth .i2c_bus_addr = 0xc0 >> 1,
525504b29cbSSteven Toth .i2c_reg_len = REGLEN_0bit,
526504b29cbSSteven Toth }, {
527504b29cbSSteven Toth .id = 0x26,
528504b29cbSSteven Toth .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
529504b29cbSSteven Toth .name = "LGDT3306-2",
530504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_2,
531504b29cbSSteven Toth .i2c_bus_addr = 0x1c >> 1,
532504b29cbSSteven Toth .i2c_reg_len = REGLEN_8bit,
533504b29cbSSteven Toth } },
534504b29cbSSteven Toth },
535504b29cbSSteven Toth [SAA7164_BOARD_HAUPPAUGE_HVR2255] = {
536504b29cbSSteven Toth .name = "Hauppauge WinTV-HVR2255",
537504b29cbSSteven Toth .porta = SAA7164_MPEG_DVB,
538504b29cbSSteven Toth .portb = SAA7164_MPEG_DVB,
539504b29cbSSteven Toth .portc = SAA7164_MPEG_ENCODER,
540504b29cbSSteven Toth .portd = SAA7164_MPEG_ENCODER,
541504b29cbSSteven Toth .porte = SAA7164_MPEG_VBI,
542504b29cbSSteven Toth .portf = SAA7164_MPEG_VBI,
543504b29cbSSteven Toth .chiprev = SAA7164_CHIP_REV3,
544504b29cbSSteven Toth .unit = {{
545504b29cbSSteven Toth .id = 0x28,
546504b29cbSSteven Toth .type = SAA7164_UNIT_EEPROM,
547504b29cbSSteven Toth .name = "4K EEPROM",
548504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_0,
549504b29cbSSteven Toth .i2c_bus_addr = 0xa0 >> 1,
550504b29cbSSteven Toth .i2c_reg_len = REGLEN_8bit,
551504b29cbSSteven Toth }, {
552504b29cbSSteven Toth .id = 0x04,
553504b29cbSSteven Toth .type = SAA7164_UNIT_TUNER,
554504b29cbSSteven Toth .name = "SI2157-1",
555504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_0,
556504b29cbSSteven Toth .i2c_bus_addr = 0xc0 >> 1,
557504b29cbSSteven Toth .i2c_reg_len = REGLEN_0bit,
558504b29cbSSteven Toth }, {
559504b29cbSSteven Toth .id = 0x06,
560504b29cbSSteven Toth .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
561504b29cbSSteven Toth .name = "LGDT3306-1",
562504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_2,
563504b29cbSSteven Toth .i2c_bus_addr = 0xb2 >> 1,
564504b29cbSSteven Toth .i2c_reg_len = REGLEN_8bit,
565504b29cbSSteven Toth }, {
566504b29cbSSteven Toth .id = 0x25,
567504b29cbSSteven Toth .type = SAA7164_UNIT_TUNER,
568504b29cbSSteven Toth .name = "SI2157-2",
569504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_1,
570504b29cbSSteven Toth .i2c_bus_addr = 0xc0 >> 1,
571504b29cbSSteven Toth .i2c_reg_len = REGLEN_0bit,
572504b29cbSSteven Toth }, {
573504b29cbSSteven Toth .id = 0x27,
574504b29cbSSteven Toth .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
575504b29cbSSteven Toth .name = "LGDT3306-2",
576504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_2,
577504b29cbSSteven Toth .i2c_bus_addr = 0x1c >> 1,
578504b29cbSSteven Toth .i2c_reg_len = REGLEN_8bit,
579504b29cbSSteven Toth } },
580504b29cbSSteven Toth },
581504b29cbSSteven Toth [SAA7164_BOARD_HAUPPAUGE_HVR2205] = {
582504b29cbSSteven Toth .name = "Hauppauge WinTV-HVR2205",
583504b29cbSSteven Toth .porta = SAA7164_MPEG_DVB,
584504b29cbSSteven Toth .portb = SAA7164_MPEG_DVB,
585504b29cbSSteven Toth .portc = SAA7164_MPEG_ENCODER,
586504b29cbSSteven Toth .portd = SAA7164_MPEG_ENCODER,
587504b29cbSSteven Toth .porte = SAA7164_MPEG_VBI,
588504b29cbSSteven Toth .portf = SAA7164_MPEG_VBI,
589504b29cbSSteven Toth .chiprev = SAA7164_CHIP_REV3,
590504b29cbSSteven Toth .unit = {{
591504b29cbSSteven Toth .id = 0x28,
592504b29cbSSteven Toth .type = SAA7164_UNIT_EEPROM,
593504b29cbSSteven Toth .name = "4K EEPROM",
594504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_0,
595504b29cbSSteven Toth .i2c_bus_addr = 0xa0 >> 1,
596504b29cbSSteven Toth .i2c_reg_len = REGLEN_8bit,
597504b29cbSSteven Toth }, {
598504b29cbSSteven Toth .id = 0x04,
599504b29cbSSteven Toth .type = SAA7164_UNIT_TUNER,
600504b29cbSSteven Toth .name = "SI2157-1",
601504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_0,
602504b29cbSSteven Toth .i2c_bus_addr = 0xc0 >> 1,
603504b29cbSSteven Toth .i2c_reg_len = REGLEN_0bit,
604504b29cbSSteven Toth }, {
605504b29cbSSteven Toth .id = 0x06,
606504b29cbSSteven Toth .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
607504b29cbSSteven Toth .name = "SI2168-1",
608504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_2,
609504b29cbSSteven Toth .i2c_bus_addr = 0xc8 >> 1,
610d9768728SOlli Salonen .i2c_reg_len = REGLEN_0bit,
611504b29cbSSteven Toth }, {
612504b29cbSSteven Toth .id = 0x25,
613504b29cbSSteven Toth .type = SAA7164_UNIT_TUNER,
614504b29cbSSteven Toth .name = "SI2157-2",
615504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_1,
616504b29cbSSteven Toth .i2c_bus_addr = 0xc0 >> 1,
617504b29cbSSteven Toth .i2c_reg_len = REGLEN_0bit,
618504b29cbSSteven Toth }, {
619504b29cbSSteven Toth .id = 0x27,
620504b29cbSSteven Toth .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
621504b29cbSSteven Toth .name = "SI2168-2",
622504b29cbSSteven Toth .i2c_bus_nr = SAA7164_I2C_BUS_2,
623504b29cbSSteven Toth .i2c_bus_addr = 0xcc >> 1,
624d9768728SOlli Salonen .i2c_reg_len = REGLEN_0bit,
625504b29cbSSteven Toth } },
626504b29cbSSteven Toth },
627b285192aSMauro Carvalho Chehab };
628b285192aSMauro Carvalho Chehab const unsigned int saa7164_bcount = ARRAY_SIZE(saa7164_boards);
629b285192aSMauro Carvalho Chehab
630b285192aSMauro Carvalho Chehab /* ------------------------------------------------------------------ */
631b285192aSMauro Carvalho Chehab /* PCI subsystem IDs */
632b285192aSMauro Carvalho Chehab
633b285192aSMauro Carvalho Chehab struct saa7164_subid saa7164_subids[] = {
634b285192aSMauro Carvalho Chehab {
635b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
636b285192aSMauro Carvalho Chehab .subdevice = 0x8880,
637b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2250,
638b285192aSMauro Carvalho Chehab }, {
639b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
640b285192aSMauro Carvalho Chehab .subdevice = 0x8810,
641b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2250,
642b285192aSMauro Carvalho Chehab }, {
643b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
644b285192aSMauro Carvalho Chehab .subdevice = 0x8980,
645b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2200,
646b285192aSMauro Carvalho Chehab }, {
647b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
648b285192aSMauro Carvalho Chehab .subdevice = 0x8900,
649b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_2,
650b285192aSMauro Carvalho Chehab }, {
651b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
652b285192aSMauro Carvalho Chehab .subdevice = 0x8901,
653b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_3,
654b285192aSMauro Carvalho Chehab }, {
655b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
656b285192aSMauro Carvalho Chehab .subdevice = 0x88A1,
657b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_3,
658b285192aSMauro Carvalho Chehab }, {
659b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
660b285192aSMauro Carvalho Chehab .subdevice = 0x8891,
661b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_2,
662b285192aSMauro Carvalho Chehab }, {
663b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
664b285192aSMauro Carvalho Chehab .subdevice = 0x8851,
665b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_2,
666b285192aSMauro Carvalho Chehab }, {
667b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
668b285192aSMauro Carvalho Chehab .subdevice = 0x8940,
669b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_4,
670b285192aSMauro Carvalho Chehab }, {
671b285192aSMauro Carvalho Chehab .subvendor = 0x0070,
672b285192aSMauro Carvalho Chehab .subdevice = 0x8953,
673b285192aSMauro Carvalho Chehab .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_5,
674504b29cbSSteven Toth }, {
675504b29cbSSteven Toth .subvendor = 0x0070,
676504b29cbSSteven Toth .subdevice = 0xf111,
677504b29cbSSteven Toth .card = SAA7164_BOARD_HAUPPAUGE_HVR2255,
67816790554SMauro Carvalho Chehab /* Prototype card left here for documentation purposes.
679504b29cbSSteven Toth .card = SAA7164_BOARD_HAUPPAUGE_HVR2255proto,
680504b29cbSSteven Toth */
681504b29cbSSteven Toth }, {
682504b29cbSSteven Toth .subvendor = 0x0070,
683504b29cbSSteven Toth .subdevice = 0xf123,
684504b29cbSSteven Toth .card = SAA7164_BOARD_HAUPPAUGE_HVR2205,
685504b29cbSSteven Toth }, {
686504b29cbSSteven Toth .subvendor = 0x0070,
687504b29cbSSteven Toth .subdevice = 0xf120,
688504b29cbSSteven Toth .card = SAA7164_BOARD_HAUPPAUGE_HVR2205,
689b285192aSMauro Carvalho Chehab },
690b285192aSMauro Carvalho Chehab };
691b285192aSMauro Carvalho Chehab const unsigned int saa7164_idcount = ARRAY_SIZE(saa7164_subids);
692b285192aSMauro Carvalho Chehab
saa7164_card_list(struct saa7164_dev * dev)693b285192aSMauro Carvalho Chehab void saa7164_card_list(struct saa7164_dev *dev)
694b285192aSMauro Carvalho Chehab {
695b285192aSMauro Carvalho Chehab int i;
696b285192aSMauro Carvalho Chehab
697b285192aSMauro Carvalho Chehab if (0 == dev->pci->subsystem_vendor &&
698b285192aSMauro Carvalho Chehab 0 == dev->pci->subsystem_device) {
699b285192aSMauro Carvalho Chehab printk(KERN_ERR
700b285192aSMauro Carvalho Chehab "%s: Board has no valid PCIe Subsystem ID and can't\n"
701b285192aSMauro Carvalho Chehab "%s: be autodetected. Pass card=<n> insmod option to\n"
702b285192aSMauro Carvalho Chehab "%s: workaround that. Send complaints to the vendor\n"
703b285192aSMauro Carvalho Chehab "%s: of the TV card. Best regards,\n"
704b285192aSMauro Carvalho Chehab "%s: -- tux\n",
705b285192aSMauro Carvalho Chehab dev->name, dev->name, dev->name, dev->name, dev->name);
706b285192aSMauro Carvalho Chehab } else {
707b285192aSMauro Carvalho Chehab printk(KERN_ERR
708b285192aSMauro Carvalho Chehab "%s: Your board isn't known (yet) to the driver.\n"
709b285192aSMauro Carvalho Chehab "%s: Try to pick one of the existing card configs via\n"
710b285192aSMauro Carvalho Chehab "%s: card=<n> insmod option. Updating to the latest\n"
711b285192aSMauro Carvalho Chehab "%s: version might help as well.\n",
712b285192aSMauro Carvalho Chehab dev->name, dev->name, dev->name, dev->name);
713b285192aSMauro Carvalho Chehab }
714b285192aSMauro Carvalho Chehab
71524f711c1SMauro Carvalho Chehab printk(KERN_ERR "%s: Here are valid choices for the card=<n> insmod option:\n",
71624f711c1SMauro Carvalho Chehab dev->name);
717b285192aSMauro Carvalho Chehab
718b285192aSMauro Carvalho Chehab for (i = 0; i < saa7164_bcount; i++)
719b285192aSMauro Carvalho Chehab printk(KERN_ERR "%s: card=%d -> %s\n",
720b285192aSMauro Carvalho Chehab dev->name, i, saa7164_boards[i].name);
721b285192aSMauro Carvalho Chehab }
722b285192aSMauro Carvalho Chehab
723b285192aSMauro Carvalho Chehab /* TODO: clean this define up into the -cards.c structs */
724b285192aSMauro Carvalho Chehab #define PCIEBRIDGE_UNITID 2
725b285192aSMauro Carvalho Chehab
saa7164_gpio_setup(struct saa7164_dev * dev)726b285192aSMauro Carvalho Chehab void saa7164_gpio_setup(struct saa7164_dev *dev)
727b285192aSMauro Carvalho Chehab {
728b285192aSMauro Carvalho Chehab switch (dev->board) {
729b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200:
730b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
731b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
732b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
733b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200_5:
734b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2250:
735b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2250_2:
736b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2250_3:
737504b29cbSSteven Toth case SAA7164_BOARD_HAUPPAUGE_HVR2255proto:
738504b29cbSSteven Toth case SAA7164_BOARD_HAUPPAUGE_HVR2255:
739504b29cbSSteven Toth case SAA7164_BOARD_HAUPPAUGE_HVR2205:
740b285192aSMauro Carvalho Chehab /*
741504b29cbSSteven Toth HVR2200 / HVR2250
742b285192aSMauro Carvalho Chehab GPIO 2: s5h1411 / tda10048-1 demod reset
743b285192aSMauro Carvalho Chehab GPIO 3: s5h1411 / tda10048-2 demod reset
744b285192aSMauro Carvalho Chehab GPIO 7: IRBlaster Zilog reset
745b285192aSMauro Carvalho Chehab */
746b285192aSMauro Carvalho Chehab
747504b29cbSSteven Toth /* HVR2255
748504b29cbSSteven Toth * GPIO 2: lgdg3306-1 demod reset
749504b29cbSSteven Toth * GPIO 3: lgdt3306-2 demod reset
750504b29cbSSteven Toth */
751504b29cbSSteven Toth
752504b29cbSSteven Toth /* HVR2205
753504b29cbSSteven Toth * GPIO 2: si2168-1 demod reset
754504b29cbSSteven Toth * GPIO 3: si2168-2 demod reset
755504b29cbSSteven Toth */
756504b29cbSSteven Toth
757b285192aSMauro Carvalho Chehab /* Reset parts by going in and out of reset */
758b285192aSMauro Carvalho Chehab saa7164_api_clear_gpiobit(dev, PCIEBRIDGE_UNITID, 2);
759b285192aSMauro Carvalho Chehab saa7164_api_clear_gpiobit(dev, PCIEBRIDGE_UNITID, 3);
760b285192aSMauro Carvalho Chehab
761b285192aSMauro Carvalho Chehab msleep(20);
762b285192aSMauro Carvalho Chehab
763b285192aSMauro Carvalho Chehab saa7164_api_set_gpiobit(dev, PCIEBRIDGE_UNITID, 2);
764b285192aSMauro Carvalho Chehab saa7164_api_set_gpiobit(dev, PCIEBRIDGE_UNITID, 3);
765b285192aSMauro Carvalho Chehab break;
766b285192aSMauro Carvalho Chehab }
767b285192aSMauro Carvalho Chehab }
768b285192aSMauro Carvalho Chehab
hauppauge_eeprom(struct saa7164_dev * dev,u8 * eeprom_data)769b285192aSMauro Carvalho Chehab static void hauppauge_eeprom(struct saa7164_dev *dev, u8 *eeprom_data)
770b285192aSMauro Carvalho Chehab {
771b285192aSMauro Carvalho Chehab struct tveeprom tv;
772b285192aSMauro Carvalho Chehab
773446aba66SMauro Carvalho Chehab tveeprom_hauppauge_analog(&tv, eeprom_data);
774b285192aSMauro Carvalho Chehab
775b285192aSMauro Carvalho Chehab /* Make sure we support the board model */
776b285192aSMauro Carvalho Chehab switch (tv.model) {
777b285192aSMauro Carvalho Chehab case 88001:
778b285192aSMauro Carvalho Chehab /* Development board - Limit circulation */
779b285192aSMauro Carvalho Chehab /* WinTV-HVR2250 (PCIe, Retail, full-height bracket)
780b285192aSMauro Carvalho Chehab * ATSC/QAM (TDA18271/S5H1411) and basic analog, no IR, FM */
781b285192aSMauro Carvalho Chehab case 88021:
782b285192aSMauro Carvalho Chehab /* WinTV-HVR2250 (PCIe, Retail, full-height bracket)
783b285192aSMauro Carvalho Chehab * ATSC/QAM (TDA18271/S5H1411) and basic analog, MCE CIR, FM */
784b285192aSMauro Carvalho Chehab break;
785b285192aSMauro Carvalho Chehab case 88041:
786b285192aSMauro Carvalho Chehab /* WinTV-HVR2250 (PCIe, Retail, full-height bracket)
787b285192aSMauro Carvalho Chehab * ATSC/QAM (TDA18271/S5H1411) and basic analog, no IR, FM */
788b285192aSMauro Carvalho Chehab break;
789b285192aSMauro Carvalho Chehab case 88061:
790b285192aSMauro Carvalho Chehab /* WinTV-HVR2250 (PCIe, Retail, full-height bracket)
791b285192aSMauro Carvalho Chehab * ATSC/QAM (TDA18271/S5H1411) and basic analog, FM */
792b285192aSMauro Carvalho Chehab break;
793b285192aSMauro Carvalho Chehab case 89519:
794b285192aSMauro Carvalho Chehab case 89609:
795b285192aSMauro Carvalho Chehab /* WinTV-HVR2200 (PCIe, Retail, full-height)
796b285192aSMauro Carvalho Chehab * DVB-T (TDA18271/TDA10048) and basic analog, no IR */
797b285192aSMauro Carvalho Chehab break;
798b285192aSMauro Carvalho Chehab case 89619:
799b285192aSMauro Carvalho Chehab /* WinTV-HVR2200 (PCIe, Retail, half-height)
800b285192aSMauro Carvalho Chehab * DVB-T (TDA18271/TDA10048) and basic analog, no IR */
801b285192aSMauro Carvalho Chehab break;
802504b29cbSSteven Toth case 151009:
803504b29cbSSteven Toth /* First production board rev B2I6 */
804504b29cbSSteven Toth /* WinTV-HVR2205 (PCIe, Retail, full-height bracket)
805504b29cbSSteven Toth * DVB-T/T2/C (SI2157/SI2168) and basic analog, FM */
806504b29cbSSteven Toth break;
807504b29cbSSteven Toth case 151609:
808504b29cbSSteven Toth /* First production board rev B2I6 */
809504b29cbSSteven Toth /* WinTV-HVR2205 (PCIe, Retail, half-height bracket)
810504b29cbSSteven Toth * DVB-T/T2/C (SI2157/SI2168) and basic analog, FM */
811504b29cbSSteven Toth break;
812504b29cbSSteven Toth case 151061:
813504b29cbSSteven Toth /* First production board rev B1I6 */
814504b29cbSSteven Toth /* WinTV-HVR2255 (PCIe, Retail, full-height bracket)
815504b29cbSSteven Toth * ATSC/QAM (SI2157/LGDT3306) and basic analog, FM */
816504b29cbSSteven Toth break;
817b285192aSMauro Carvalho Chehab default:
818b285192aSMauro Carvalho Chehab printk(KERN_ERR "%s: Warning: Unknown Hauppauge model #%d\n",
819b285192aSMauro Carvalho Chehab dev->name, tv.model);
820b285192aSMauro Carvalho Chehab break;
821b285192aSMauro Carvalho Chehab }
822b285192aSMauro Carvalho Chehab
823b285192aSMauro Carvalho Chehab printk(KERN_INFO "%s: Hauppauge eeprom: model=%d\n", dev->name,
824b285192aSMauro Carvalho Chehab tv.model);
825b285192aSMauro Carvalho Chehab }
826b285192aSMauro Carvalho Chehab
saa7164_card_setup(struct saa7164_dev * dev)827b285192aSMauro Carvalho Chehab void saa7164_card_setup(struct saa7164_dev *dev)
828b285192aSMauro Carvalho Chehab {
829b285192aSMauro Carvalho Chehab static u8 eeprom[256];
830b285192aSMauro Carvalho Chehab
831b285192aSMauro Carvalho Chehab if (dev->i2c_bus[0].i2c_rc == 0) {
832b285192aSMauro Carvalho Chehab if (saa7164_api_read_eeprom(dev, &eeprom[0],
833b285192aSMauro Carvalho Chehab sizeof(eeprom)) < 0)
834b285192aSMauro Carvalho Chehab return;
835b285192aSMauro Carvalho Chehab }
836b285192aSMauro Carvalho Chehab
837b285192aSMauro Carvalho Chehab switch (dev->board) {
838b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200:
839b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
840b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
841b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
842b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2200_5:
843b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2250:
844b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2250_2:
845b285192aSMauro Carvalho Chehab case SAA7164_BOARD_HAUPPAUGE_HVR2250_3:
846504b29cbSSteven Toth case SAA7164_BOARD_HAUPPAUGE_HVR2255proto:
847504b29cbSSteven Toth case SAA7164_BOARD_HAUPPAUGE_HVR2255:
848504b29cbSSteven Toth case SAA7164_BOARD_HAUPPAUGE_HVR2205:
849b285192aSMauro Carvalho Chehab hauppauge_eeprom(dev, &eeprom[0]);
850b285192aSMauro Carvalho Chehab break;
851b285192aSMauro Carvalho Chehab }
852b285192aSMauro Carvalho Chehab }
853b285192aSMauro Carvalho Chehab
854b285192aSMauro Carvalho Chehab /* With most other drivers, the kernel expects to communicate with subdrivers
855b285192aSMauro Carvalho Chehab * through i2c. This bridge does not allow that, it does not expose any direct
856b285192aSMauro Carvalho Chehab * access to I2C. Instead we have to communicate through the device f/w for
857b285192aSMauro Carvalho Chehab * register access to 'processing units'. Each unit has a unique
858b285192aSMauro Carvalho Chehab * id, regardless of how the physical implementation occurs across
85916790554SMauro Carvalho Chehab * the three physical i2c buses. The being said if we want leverge of
860b285192aSMauro Carvalho Chehab * the existing kernel drivers for tuners and demods we have to 'speak i2c',
861b285192aSMauro Carvalho Chehab * to this bridge implements 3 virtual i2c buses. This is a helper function
862b285192aSMauro Carvalho Chehab * for those.
863b285192aSMauro Carvalho Chehab *
864b285192aSMauro Carvalho Chehab * Description: Translate the kernels notion of an i2c address and bus into
865b285192aSMauro Carvalho Chehab * the appropriate unitid.
866b285192aSMauro Carvalho Chehab */
saa7164_i2caddr_to_unitid(struct saa7164_i2c * bus,int addr)867b285192aSMauro Carvalho Chehab int saa7164_i2caddr_to_unitid(struct saa7164_i2c *bus, int addr)
868b285192aSMauro Carvalho Chehab {
869b285192aSMauro Carvalho Chehab /* For a given bus and i2c device address, return the saa7164 unique
870b285192aSMauro Carvalho Chehab * unitid. < 0 on error */
871b285192aSMauro Carvalho Chehab
872b285192aSMauro Carvalho Chehab struct saa7164_dev *dev = bus->dev;
873b285192aSMauro Carvalho Chehab struct saa7164_unit *unit;
874b285192aSMauro Carvalho Chehab int i;
875b285192aSMauro Carvalho Chehab
876b285192aSMauro Carvalho Chehab for (i = 0; i < SAA7164_MAX_UNITS; i++) {
877b285192aSMauro Carvalho Chehab unit = &saa7164_boards[dev->board].unit[i];
878b285192aSMauro Carvalho Chehab
879b285192aSMauro Carvalho Chehab if (unit->type == SAA7164_UNIT_UNDEFINED)
880b285192aSMauro Carvalho Chehab continue;
881b285192aSMauro Carvalho Chehab if ((bus->nr == unit->i2c_bus_nr) &&
882b285192aSMauro Carvalho Chehab (addr == unit->i2c_bus_addr))
883b285192aSMauro Carvalho Chehab return unit->id;
884b285192aSMauro Carvalho Chehab }
885b285192aSMauro Carvalho Chehab
886b285192aSMauro Carvalho Chehab return -1;
887b285192aSMauro Carvalho Chehab }
888b285192aSMauro Carvalho Chehab
889b285192aSMauro Carvalho Chehab /* The 7164 API needs to know the i2c register length in advance.
890b285192aSMauro Carvalho Chehab * this is a helper function. Based on a specific chip addr and bus return the
891b285192aSMauro Carvalho Chehab * reg length.
892b285192aSMauro Carvalho Chehab */
saa7164_i2caddr_to_reglen(struct saa7164_i2c * bus,int addr)893b285192aSMauro Carvalho Chehab int saa7164_i2caddr_to_reglen(struct saa7164_i2c *bus, int addr)
894b285192aSMauro Carvalho Chehab {
895b285192aSMauro Carvalho Chehab /* For a given bus and i2c device address, return the
896b285192aSMauro Carvalho Chehab * saa7164 registry address width. < 0 on error
897b285192aSMauro Carvalho Chehab */
898b285192aSMauro Carvalho Chehab
899b285192aSMauro Carvalho Chehab struct saa7164_dev *dev = bus->dev;
900b285192aSMauro Carvalho Chehab struct saa7164_unit *unit;
901b285192aSMauro Carvalho Chehab int i;
902b285192aSMauro Carvalho Chehab
903b285192aSMauro Carvalho Chehab for (i = 0; i < SAA7164_MAX_UNITS; i++) {
904b285192aSMauro Carvalho Chehab unit = &saa7164_boards[dev->board].unit[i];
905b285192aSMauro Carvalho Chehab
906b285192aSMauro Carvalho Chehab if (unit->type == SAA7164_UNIT_UNDEFINED)
907b285192aSMauro Carvalho Chehab continue;
908b285192aSMauro Carvalho Chehab
909b285192aSMauro Carvalho Chehab if ((bus->nr == unit->i2c_bus_nr) &&
910b285192aSMauro Carvalho Chehab (addr == unit->i2c_bus_addr))
911b285192aSMauro Carvalho Chehab return unit->i2c_reg_len;
912b285192aSMauro Carvalho Chehab }
913b285192aSMauro Carvalho Chehab
914b285192aSMauro Carvalho Chehab return -1;
915b285192aSMauro Carvalho Chehab }
916b285192aSMauro Carvalho Chehab /* TODO: implement a 'findeeprom' functio like the above and fix any other
917b285192aSMauro Carvalho Chehab * eeprom related todo's in -api.c.
918b285192aSMauro Carvalho Chehab */
919b285192aSMauro Carvalho Chehab
920b285192aSMauro Carvalho Chehab /* Translate a unitid into a x readable device name, for display purposes. */
saa7164_unitid_name(struct saa7164_dev * dev,u8 unitid)921b285192aSMauro Carvalho Chehab char *saa7164_unitid_name(struct saa7164_dev *dev, u8 unitid)
922b285192aSMauro Carvalho Chehab {
923b285192aSMauro Carvalho Chehab char *undefed = "UNDEFINED";
924b285192aSMauro Carvalho Chehab char *bridge = "BRIDGE";
925b285192aSMauro Carvalho Chehab struct saa7164_unit *unit;
926b285192aSMauro Carvalho Chehab int i;
927b285192aSMauro Carvalho Chehab
928b285192aSMauro Carvalho Chehab if (unitid == 0)
929b285192aSMauro Carvalho Chehab return bridge;
930b285192aSMauro Carvalho Chehab
931b285192aSMauro Carvalho Chehab for (i = 0; i < SAA7164_MAX_UNITS; i++) {
932b285192aSMauro Carvalho Chehab unit = &saa7164_boards[dev->board].unit[i];
933b285192aSMauro Carvalho Chehab
934b285192aSMauro Carvalho Chehab if (unit->type == SAA7164_UNIT_UNDEFINED)
935b285192aSMauro Carvalho Chehab continue;
936b285192aSMauro Carvalho Chehab
937b285192aSMauro Carvalho Chehab if (unitid == unit->id)
938b285192aSMauro Carvalho Chehab return unit->name;
939b285192aSMauro Carvalho Chehab }
940b285192aSMauro Carvalho Chehab
941b285192aSMauro Carvalho Chehab return undefed;
942b285192aSMauro Carvalho Chehab }
943b285192aSMauro Carvalho Chehab
944