aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-driver.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-08-31 23:40:41 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:58 -0400
commitc641d09c60bfa36c7cf70444f24265090e51f5ce (patch)
tree2f3a9cc7d86aed3e0d5f1c7631a7354bb490fb29 /drivers/media/video/cx18/cx18-driver.c
parentb1526421eac9a912b2cda7e147f1da2aa31be278 (diff)
V4L/DVB (8914): cx18: Throttle mmio to/from the CX23418 so boards work in older systems
cx18: Throttle mmio to/from the CX23418 so boards work in older systems. The CX23418 couldn't reliably handle mmio at the rate at which the cx18 driver was attempting to access the chip. The PCI bridge arrangements and settings on modern motherboards still allowed the CX23418 to work OK, but it didn't work well on many older motherboards: mysterious I2C errors, firmware loading errors, etc. This patch adds a throttle to *all* mmio access to the CX23418. It defaults to a delay of 31 ns, but is adjustable by the mmio_ndelay module parm. My HVR-1600 and Raptor PAL/SECAM card now function for analog capture on a motherboard with an Intel 82810E Northbridge and 82801AA Southbridge. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-driver.c')
-rw-r--r--drivers/media/video/cx18/cx18-driver.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index d31e1ec8d14c..202b28190148 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -4,6 +4,7 @@
4 * Derived from ivtv-driver.c 4 * Derived from ivtv-driver.c
5 * 5 *
6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
7 * Copyright (C) 2008 Andy Walls <awalls@radix.net>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -74,10 +75,14 @@ static int radio[CX18_MAX_CARDS] = { -1, -1, -1, -1, -1, -1, -1, -1,
74 -1, -1, -1, -1, -1, -1, -1, -1, 75 -1, -1, -1, -1, -1, -1, -1, -1,
75 -1, -1, -1, -1, -1, -1, -1, -1, 76 -1, -1, -1, -1, -1, -1, -1, -1,
76 -1, -1, -1, -1, -1, -1, -1, -1 }; 77 -1, -1, -1, -1, -1, -1, -1, -1 };
77 78static int mmio_ndelay[CX18_MAX_CARDS] = { -1, -1, -1, -1, -1, -1, -1, -1,
79 -1, -1, -1, -1, -1, -1, -1, -1,
80 -1, -1, -1, -1, -1, -1, -1, -1,
81 -1, -1, -1, -1, -1, -1, -1, -1 };
78static unsigned cardtype_c = 1; 82static unsigned cardtype_c = 1;
79static unsigned tuner_c = 1; 83static unsigned tuner_c = 1;
80static unsigned radio_c = 1; 84static unsigned radio_c = 1;
85static int mmio_ndelay_c = 1;
81static char pal[] = "--"; 86static char pal[] = "--";
82static char secam[] = "--"; 87static char secam[] = "--";
83static char ntsc[] = "-"; 88static char ntsc[] = "-";
@@ -96,6 +101,7 @@ int cx18_debug;
96module_param_array(tuner, int, &tuner_c, 0644); 101module_param_array(tuner, int, &tuner_c, 0644);
97module_param_array(radio, bool, &radio_c, 0644); 102module_param_array(radio, bool, &radio_c, 0644);
98module_param_array(cardtype, int, &cardtype_c, 0644); 103module_param_array(cardtype, int, &cardtype_c, 0644);
104module_param_array(mmio_ndelay, int, &mmio_ndelay_c, 0644);
99module_param_string(pal, pal, sizeof(pal), 0644); 105module_param_string(pal, pal, sizeof(pal), 0644);
100module_param_string(secam, secam, sizeof(secam), 0644); 106module_param_string(secam, secam, sizeof(secam), 0644);
101module_param_string(ntsc, ntsc, sizeof(ntsc), 0644); 107module_param_string(ntsc, ntsc, sizeof(ntsc), 0644);
@@ -141,6 +147,11 @@ MODULE_PARM_DESC(debug,
141MODULE_PARM_DESC(cx18_pci_latency, 147MODULE_PARM_DESC(cx18_pci_latency,
142 "Change the PCI latency to 64 if lower: 0 = No, 1 = Yes,\n" 148 "Change the PCI latency to 64 if lower: 0 = No, 1 = Yes,\n"
143 "\t\t\tDefault: Yes"); 149 "\t\t\tDefault: Yes");
150MODULE_PARM_DESC(mmio_ndelay,
151 "Delay (ns) for each CX23418 memory mapped IO access.\n"
152 "\t\t\tTry larger values that are close to a multiple of the\n"
153 "\t\t\tPCI clock period, 30.3 ns, if your card doesn't work.\n"
154 "\t\t\tDefault: " __stringify(CX18_DEFAULT_MMIO_NDELAY));
144MODULE_PARM_DESC(enc_mpg_buffers, 155MODULE_PARM_DESC(enc_mpg_buffers,
145 "Encoder MPG Buffers (in MB)\n" 156 "Encoder MPG Buffers (in MB)\n"
146 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_MPG_BUFFERS)); 157 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_MPG_BUFFERS));
@@ -357,6 +368,11 @@ static void cx18_process_options(struct cx18 *cx)
357 cx->options.tuner = tuner[cx->num]; 368 cx->options.tuner = tuner[cx->num];
358 cx->options.radio = radio[cx->num]; 369 cx->options.radio = radio[cx->num];
359 370
371 if (mmio_ndelay[cx->num] < 0)
372 cx->options.mmio_ndelay = CX18_DEFAULT_MMIO_NDELAY;
373 else
374 cx->options.mmio_ndelay = mmio_ndelay[cx->num];
375
360 cx->std = cx18_parse_std(cx); 376 cx->std = cx18_parse_std(cx);
361 if (cx->options.cardtype == -1) { 377 if (cx->options.cardtype == -1) {
362 CX18_INFO("Ignore card\n"); 378 CX18_INFO("Ignore card\n");