aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885/cx23885-cards.c
diff options
context:
space:
mode:
authorSteven Toth <stoth@hauppauge.com>2007-03-11 19:44:05 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:07:56 -0400
commitd19770e5178a4bc49641711246360c25781d20a4 (patch)
treea8984db06c4344b00718e958c12ee403eb339278 /drivers/media/video/cx23885/cx23885-cards.c
parent275511a0aca8483c03df1c6e3a33a27cee334709 (diff)
V4L/DVB (6150): Add CX23885/CX23887 PCIe bridge driver
This is a new framework to support boards based on the CX23885/7 PCIe bridge. The framework supports digital (no analog yet) Signed-off-by: Steven Toth <stoth@hauppauge.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-cards.c')
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c198
1 files changed, 198 insertions, 0 deletions
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
new file mode 100644
index 000000000000..9344fb5d95f6
--- /dev/null
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -0,0 +1,198 @@
1/*
2 * Driver for the Conexant CX23885 PCIe bridge
3 *
4 * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/pci.h>
25#include <linux/delay.h>
26
27#include "cx23885.h"
28
29/* ------------------------------------------------------------------ */
30/* board config info */
31
32struct cx23885_board cx23885_boards[] = {
33 [CX23885_BOARD_UNKNOWN] = {
34 .name = "UNKNOWN/GENERIC",
35 .bridge = CX23885_BRIDGE_UNDEFINED,
36 .input = {{
37 .type = CX23885_VMUX_COMPOSITE1,
38 .vmux = 0,
39 },{
40 .type = CX23885_VMUX_COMPOSITE2,
41 .vmux = 1,
42 },{
43 .type = CX23885_VMUX_COMPOSITE3,
44 .vmux = 2,
45 },{
46 .type = CX23885_VMUX_COMPOSITE4,
47 .vmux = 3,
48 }},
49 },
50 [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = {
51 .name = "Hauppauge WinTV-HVR1800lp",
52 .bridge = CX23885_BRIDGE_885,
53 .portc = CX23885_MPEG_DVB,
54 .input = {{
55 .type = CX23885_VMUX_TELEVISION,
56 .vmux = 0,
57 .gpio0 = 0xff00,
58 },{
59 .type = CX23885_VMUX_DEBUG,
60 .vmux = 0,
61 .gpio0 = 0xff01,
62 },{
63 .type = CX23885_VMUX_COMPOSITE1,
64 .vmux = 1,
65 .gpio0 = 0xff02,
66 },{
67 .type = CX23885_VMUX_SVIDEO,
68 .vmux = 2,
69 .gpio0 = 0xff02,
70 }},
71 },
72 [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
73 .name = "Hauppauge WinTV-HVR1800",
74 .bridge = CX23885_BRIDGE_887,
75 .portc = CX23885_MPEG_DVB,
76 .input = {{
77 .type = CX23885_VMUX_TELEVISION,
78 .vmux = 0,
79 .gpio0 = 0xff00,
80 },{
81 .type = CX23885_VMUX_DEBUG,
82 .vmux = 0,
83 .gpio0 = 0xff01,
84 },{
85 .type = CX23885_VMUX_COMPOSITE1,
86 .vmux = 1,
87 .gpio0 = 0xff02,
88 },{
89 .type = CX23885_VMUX_SVIDEO,
90 .vmux = 2,
91 .gpio0 = 0xff02,
92 }},
93 },
94};
95const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
96
97/* ------------------------------------------------------------------ */
98/* PCI subsystem IDs */
99
100struct cx23885_subid cx23885_subids[] = {
101 {
102 .subvendor = 0x0070,
103 .subdevice = 0x3400,
104 .card = CX23885_BOARD_UNKNOWN,
105 },{
106 .subvendor = 0x0070,
107 .subdevice = 0x7600,
108 .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp,
109 },{
110 .subvendor = 0x0070,
111 .subdevice = 0x7800,
112 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
113 },{
114 .subvendor = 0x0070,
115 .subdevice = 0x7801,
116 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
117 },
118};
119const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
120
121void cx23885_card_list(struct cx23885_dev *dev)
122{
123 int i;
124
125 if (0 == dev->pci->subsystem_vendor &&
126 0 == dev->pci->subsystem_device) {
127 printk("%s: Your board has no valid PCIe Subsystem ID and thus can't\n"
128 "%s: be autodetected. Please pass card=<n> insmod option to\n"
129 "%s: workaround that. Redirect complaints to the vendor of\n"
130 "%s: the TV card. Best regards,\n"
131 "%s: -- tux\n",
132 dev->name, dev->name, dev->name, dev->name, dev->name);
133 } else {
134 printk("%s: Your board isn't known (yet) to the driver. You can\n"
135 "%s: try to pick one of the existing card configs via\n"
136 "%s: card=<n> insmod option. Updating to the latest\n"
137 "%s: version might help as well.\n",
138 dev->name, dev->name, dev->name, dev->name);
139 }
140 printk("%s: Here is a list of valid choices for the card=<n> insmod option:\n",
141 dev->name);
142 for (i = 0; i < cx23885_bcount; i++)
143 printk("%s: card=%d -> %s\n",
144 dev->name, i, cx23885_boards[i].name);
145}
146
147static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
148{
149 struct tveeprom tv;
150
151 tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv, eeprom_data);
152
153
154 /* Make sure we support the board model */
155 switch (tv.model)
156 {
157 case 76601: /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual channel ATSC and MPEG2 HW Encoder */
158 case 77001: /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC and Basic analog */
159 case 78501: /* WinTV-HVR1800 (PCIe, Retail, IR, Dual channel ATSC and MPEG2 HW Encoder */
160 case 78521: /* WinTV-HVR1800 (PCIe, Retail, IR, Dual channel ATSC and MPEG2 HW Encoder */
161 break;
162 default:
163 printk("%s: warning: unknown hauppauge model #%d\n", dev->name, tv.model);
164 break;
165 }
166
167 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
168 dev->name, tv.model);
169}
170
171void cx23885_card_setup(struct cx23885_dev *dev)
172{
173 static u8 eeprom[256];
174
175 if (dev->i2c_bus[0].i2c_rc == 0) {
176 dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1;
177 tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom, sizeof(eeprom));
178 }
179
180 switch (dev->board) {
181 case CX23885_BOARD_HAUPPAUGE_HVR1800:
182 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
183 if (dev->i2c_bus[0].i2c_rc == 0)
184 hauppauge_eeprom(dev, eeprom+0x80);
185 break;
186 }
187}
188
189/* ------------------------------------------------------------------ */
190
191EXPORT_SYMBOL(cx23885_boards);
192
193/*
194 * Local variables:
195 * c-basic-offset: 8
196 * End:
197 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
198 */