aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSri Deevi <Srinivasa.Deevi@conexant.com>2008-06-21 10:06:44 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:11:13 -0400
commit03c2808503b102971226007070c57410267d0b9d (patch)
treeaeb3858db3f6cf61c574181b23804250ad68bfb5
parent464e9f3a0cabce9a7cf51f382f129d464483b0d0 (diff)
V4L/DVB (8089): cx18: add support for Conexant Raptor PAL/SECAM card
Patch provided courtesy of Conexant http://www.conexant.com. Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/cx18/cx18-cards.c55
-rw-r--r--drivers/media/video/cx18/cx18-cards.h8
-rw-r--r--drivers/media/video/cx18/cx18-driver.c3
-rw-r--r--drivers/media/video/cx18/cx18-driver.h4
-rw-r--r--drivers/media/video/cx18/cx18-gpio.c34
-rw-r--r--drivers/media/video/cx18/cx18-gpio.h1
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c20
7 files changed, 122 insertions, 3 deletions
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c
index c26e0ef5b075..90857bedccae 100644
--- a/drivers/media/video/cx18/cx18-cards.c
+++ b/drivers/media/video/cx18/cx18-cards.c
@@ -27,6 +27,8 @@
27#include "cx18-i2c.h" 27#include "cx18-i2c.h"
28#include <media/cs5345.h> 28#include <media/cs5345.h>
29 29
30#define V4L2_STD_NOT_MN (V4L2_STD_PAL|V4L2_STD_SECAM)
31
30/********************** card configuration *******************************/ 32/********************** card configuration *******************************/
31 33
32/* usual i2c tuner addresses to probe */ 34/* usual i2c tuner addresses to probe */
@@ -232,11 +234,64 @@ static const struct cx18_card cx18_card_mpc718 = {
232 .i2c = &cx18_i2c_std, 234 .i2c = &cx18_i2c_std,
233}; 235};
234 236
237/* ------------------------------------------------------------------------- */
238
239/* Conexant Raptor PAL/SECAM: note that this card is analog only! */
240
241static const struct cx18_card_pci_info cx18_pci_cnxt_raptor_pal[] = {
242 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_CONEXANT, 0x0009 },
243 { 0, 0, 0 }
244};
245
246static const struct cx18_card cx18_card_cnxt_raptor_pal = {
247 .type = CX18_CARD_CNXT_RAPTOR_PAL,
248 .name = "Conexant Raptor PAL/SECAM",
249 .comment = "VBI is not yet supported\n",
250 .v4l2_capabilities = CX18_CAP_ENCODER,
251 .hw_audio_ctrl = CX18_HW_CX23418,
252 .hw_muxer = CX18_HW_GPIO,
253 .hw_all = CX18_HW_TUNER | CX18_HW_GPIO,
254 .video_inputs = {
255 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
256 { CX18_CARD_INPUT_SVIDEO1, 1,
257 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
258 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
259 { CX18_CARD_INPUT_SVIDEO2, 2,
260 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
261 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
262 },
263 .audio_inputs = {
264 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 1 },
265 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL, 0 },
266 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL, 0 },
267 },
268 .tuners = {
269 { .std = V4L2_STD_NOT_MN, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
270 },
271 .ddr = {
272 /* MT 46V16M16 memory */
273 .chip_config = 0x50306,
274 .refresh = 0x753,
275 .timing1 = 0x33220953,
276 .timing2 = 0x09,
277 .tune_lane = 0,
278 .initial_emrs = 0,
279 },
280 .gpio_init.initial_value = 0x02,
281 .gpio_init.direction = 0x02,
282 .gpio_audio_input = { .mask = 0x02, .tuner = 0x02, .linein = 0x00 },
283 .pci_list = cx18_pci_cnxt_raptor_pal,
284 .i2c = &cx18_i2c_std,
285};
286
287/* ------------------------------------------------------------------------- */
288
235static const struct cx18_card *cx18_card_list[] = { 289static const struct cx18_card *cx18_card_list[] = {
236 &cx18_card_hvr1600_esmt, 290 &cx18_card_hvr1600_esmt,
237 &cx18_card_hvr1600_samsung, 291 &cx18_card_hvr1600_samsung,
238 &cx18_card_h900, 292 &cx18_card_h900,
239 &cx18_card_mpc718, 293 &cx18_card_mpc718,
294 &cx18_card_cnxt_raptor_pal,
240}; 295};
241 296
242const struct cx18_card *cx18_get_card(u16 index) 297const struct cx18_card *cx18_get_card(u16 index)
diff --git a/drivers/media/video/cx18/cx18-cards.h b/drivers/media/video/cx18/cx18-cards.h
index dc2dd945d4c3..b5f894c0afa9 100644
--- a/drivers/media/video/cx18/cx18-cards.h
+++ b/drivers/media/video/cx18/cx18-cards.h
@@ -85,6 +85,13 @@ struct cx18_gpio_i2c_slave_reset {
85 int msecs_recovery; /* time after deassert for chips to be ready */ 85 int msecs_recovery; /* time after deassert for chips to be ready */
86}; 86};
87 87
88struct ivtv_gpio_audio_input { /* select tuner/line in input */
89 u32 mask; /* leave to 0 if not supported */
90 u32 tuner;
91 u32 linein;
92 u32 radio;
93};
94
88struct cx18_card_tuner { 95struct cx18_card_tuner {
89 v4l2_std_id std; /* standard for which the tuner is suitable */ 96 v4l2_std_id std; /* standard for which the tuner is suitable */
90 int tuner; /* tuner ID (from tuner.h) */ 97 int tuner; /* tuner ID (from tuner.h) */
@@ -123,6 +130,7 @@ struct cx18_card {
123 u8 xceive_pin; /* XCeive tuner GPIO reset pin */ 130 u8 xceive_pin; /* XCeive tuner GPIO reset pin */
124 struct cx18_gpio_init gpio_init; 131 struct cx18_gpio_init gpio_init;
125 struct cx18_gpio_i2c_slave_reset gpio_i2c_slave_reset; 132 struct cx18_gpio_i2c_slave_reset gpio_i2c_slave_reset;
133 struct ivtv_gpio_audio_input gpio_audio_input;
126 134
127 struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS]; 135 struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
128 struct cx18_card_tuner_i2c *i2c; 136 struct cx18_card_tuner_i2c *i2c;
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index e9c7e07b9fed..71bb04ab91d7 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -120,6 +120,7 @@ MODULE_PARM_DESC(cardtype,
120 "\t\t\t 2 = Hauppauge HVR 1600 (Samsung memory)\n" 120 "\t\t\t 2 = Hauppauge HVR 1600 (Samsung memory)\n"
121 "\t\t\t 3 = Compro VideoMate H900\n" 121 "\t\t\t 3 = Compro VideoMate H900\n"
122 "\t\t\t 4 = Yuan MPC718\n" 122 "\t\t\t 4 = Yuan MPC718\n"
123 "\t\t\t 5 = Conexant Raptor PAL/SECAM\n"
123 "\t\t\t 0 = Autodetect (default)\n" 124 "\t\t\t 0 = Autodetect (default)\n"
124 "\t\t\t-1 = Ignore this card\n\t\t"); 125 "\t\t\t-1 = Ignore this card\n\t\t");
125MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60"); 126MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60");
@@ -435,7 +436,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
435 (cx->params.video_temporal_filter_mode << 1) | 436 (cx->params.video_temporal_filter_mode << 1) |
436 (cx->params.video_median_filter_type << 2); 437 (cx->params.video_median_filter_type << 2);
437 cx->params.port = CX2341X_PORT_MEMORY; 438 cx->params.port = CX2341X_PORT_MEMORY;
438 cx->params.capabilities = CX2341X_CAP_HAS_SLICED_VBI; 439 cx->params.capabilities = 0;
439 init_waitqueue_head(&cx->cap_w); 440 init_waitqueue_head(&cx->cap_w);
440 init_waitqueue_head(&cx->mb_apu_waitq); 441 init_waitqueue_head(&cx->mb_apu_waitq);
441 init_waitqueue_head(&cx->mb_cpu_waitq); 442 init_waitqueue_head(&cx->mb_cpu_waitq);
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index de14ab59a206..b421e0268b00 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -75,7 +75,8 @@
75#define CX18_CARD_HVR_1600_SAMSUNG 1 /* Hauppauge HVR 1600 (Samsung memory) */ 75#define CX18_CARD_HVR_1600_SAMSUNG 1 /* Hauppauge HVR 1600 (Samsung memory) */
76#define CX18_CARD_COMPRO_H900 2 /* Compro VideoMate H900 */ 76#define CX18_CARD_COMPRO_H900 2 /* Compro VideoMate H900 */
77#define CX18_CARD_YUAN_MPC718 3 /* Yuan MPC718 */ 77#define CX18_CARD_YUAN_MPC718 3 /* Yuan MPC718 */
78#define CX18_CARD_LAST 3 78#define CX18_CARD_CNXT_RAPTOR_PAL 4 /* Conexant Raptor PAL */
79#define CX18_CARD_LAST 4
79 80
80#define CX18_ENC_STREAM_TYPE_MPG 0 81#define CX18_ENC_STREAM_TYPE_MPG 0
81#define CX18_ENC_STREAM_TYPE_TS 1 82#define CX18_ENC_STREAM_TYPE_TS 1
@@ -94,6 +95,7 @@
94#define CX18_PCI_ID_HAUPPAUGE 0x0070 95#define CX18_PCI_ID_HAUPPAUGE 0x0070
95#define CX18_PCI_ID_COMPRO 0x185b 96#define CX18_PCI_ID_COMPRO 0x185b
96#define CX18_PCI_ID_YUAN 0x12ab 97#define CX18_PCI_ID_YUAN 0x12ab
98#define CX18_PCI_ID_CONEXANT 0x14f1
97 99
98/* ======================================================================== */ 100/* ======================================================================== */
99/* ========================== START USER SETTABLE DMA VARIABLES =========== */ 101/* ========================== START USER SETTABLE DMA VARIABLES =========== */
diff --git a/drivers/media/video/cx18/cx18-gpio.c b/drivers/media/video/cx18/cx18-gpio.c
index b302833f6f9d..089bad6d85a0 100644
--- a/drivers/media/video/cx18/cx18-gpio.c
+++ b/drivers/media/video/cx18/cx18-gpio.c
@@ -122,3 +122,37 @@ int cx18_reset_tuner_gpio(void *dev, int cmd, int value)
122 schedule_timeout_interruptible(msecs_to_jiffies(1)); 122 schedule_timeout_interruptible(msecs_to_jiffies(1));
123 return 0; 123 return 0;
124} 124}
125
126int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg)
127{
128 struct v4l2_routing *route = arg;
129 u32 mask, data;
130
131 switch (command) {
132 case VIDIOC_INT_S_AUDIO_ROUTING:
133 if (route->input > 2)
134 return -EINVAL;
135 mask = cx->card->gpio_audio_input.mask;
136 switch (route->input) {
137 case 0:
138 data = cx->card->gpio_audio_input.tuner;
139 break;
140 case 1:
141 data = cx->card->gpio_audio_input.linein;
142 break;
143 case 2:
144 default:
145 data = cx->card->gpio_audio_input.radio;
146 break;
147 }
148 break;
149
150 default:
151 return -EINVAL;
152 }
153 if (mask) {
154 cx->gpio_val = (cx->gpio_val & ~mask) | (data & mask);
155 gpio_write(cx);
156 }
157 return 0;
158}
diff --git a/drivers/media/video/cx18/cx18-gpio.h b/drivers/media/video/cx18/cx18-gpio.h
index 525c328f748a..7447fed35767 100644
--- a/drivers/media/video/cx18/cx18-gpio.h
+++ b/drivers/media/video/cx18/cx18-gpio.h
@@ -23,3 +23,4 @@
23void cx18_gpio_init(struct cx18 *cx); 23void cx18_gpio_init(struct cx18 *cx);
24void cx18_reset_i2c_slaves_gpio(struct cx18 *cx); 24void cx18_reset_i2c_slaves_gpio(struct cx18 *cx);
25int cx18_reset_tuner_gpio(void *dev, int cmd, int value); 25int cx18_reset_tuner_gpio(void *dev, int cmd, int value);
26int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg);
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index 680bc4e35b79..bca905901d61 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -311,8 +311,12 @@ int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg)
311{ 311{
312 int addr; 312 int addr;
313 313
314 if (hw == CX18_HW_GPIO || hw == 0) 314 if (hw == 0)
315 return 0; 315 return 0;
316
317 if (hw == CX18_HW_GPIO)
318 return cx18_gpio(cx, cmd, arg);
319
316 if (hw == CX18_HW_CX23418) 320 if (hw == CX18_HW_CX23418)
317 return cx18_av_cmd(cx, cmd, arg); 321 return cx18_av_cmd(cx, cmd, arg);
318 322
@@ -350,6 +354,8 @@ void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg)
350 cx18_av_cmd(cx, cmd, arg); 354 cx18_av_cmd(cx, cmd, arg);
351 i2c_clients_command(&cx->i2c_adap[0], cmd, arg); 355 i2c_clients_command(&cx->i2c_adap[0], cmd, arg);
352 i2c_clients_command(&cx->i2c_adap[1], cmd, arg); 356 i2c_clients_command(&cx->i2c_adap[1], cmd, arg);
357 if (cx->hw_flags & CX18_HW_GPIO)
358 cx18_gpio(cx, cmd, arg);
353} 359}
354 360
355/* init + register i2c algo-bit adapter */ 361/* init + register i2c algo-bit adapter */
@@ -358,6 +364,18 @@ int init_cx18_i2c(struct cx18 *cx)
358 int i; 364 int i;
359 CX18_DEBUG_I2C("i2c init\n"); 365 CX18_DEBUG_I2C("i2c init\n");
360 366
367 /* Sanity checks for the I2C hardware arrays. They must be the
368 * same size and GPIO/CX23418 must be the last entries.
369 */
370 if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) ||
371 ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) ||
372 CX18_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 2)) ||
373 CX18_HW_CX23418 != (1 << (ARRAY_SIZE(hw_addrs) - 1)) ||
374 hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) {
375 CX18_ERR("Mismatched I2C hardware arrays\n");
376 return -ENODEV;
377 }
378
361 for (i = 0; i < 2; i++) { 379 for (i = 0; i < 2; i++) {
362 memcpy(&cx->i2c_adap[i], &cx18_i2c_adap_template, 380 memcpy(&cx->i2c_adap[i], &cx18_i2c_adap_template,
363 sizeof(struct i2c_adapter)); 381 sizeof(struct i2c_adapter));