aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorSteven Toth <stoth@hauppauge.com>2008-01-10 00:24:27 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:04:49 -0500
commitc771261330c90b7c77f686a1aa0fb4f756e07b5f (patch)
tree30f9666dbed681421ce2ea1ca1a8728447e67233 /drivers/media
parent69ad6e56bade948793957a295b3bf1376cffdf65 (diff)
V4L/DVB (7006): cx23885: Track the board clock frequency and allow overrides
The cx23885/6/8 all have different clock rates, this patch allows the core to compensate, and developers to allow vendor specific overrides. This patches will be used by future analog video and encoder patches. Signed-off-by: Steven Toth <stoth@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c8
-rw-r--r--drivers/media/video/cx23885/cx23885.h15
3 files changed, 25 insertions, 0 deletions
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index 901bebcca7c3..a4bac43cf9f5 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -32,6 +32,8 @@
32struct cx23885_board cx23885_boards[] = { 32struct cx23885_board cx23885_boards[] = {
33 [CX23885_BOARD_UNKNOWN] = { 33 [CX23885_BOARD_UNKNOWN] = {
34 .name = "UNKNOWN/GENERIC", 34 .name = "UNKNOWN/GENERIC",
35 /* Ensure safe default for unknown boards */
36 .clk_freq = 0,
35 .input = {{ 37 .input = {{
36 .type = CX23885_VMUX_COMPOSITE1, 38 .type = CX23885_VMUX_COMPOSITE1,
37 .vmux = 0, 39 .vmux = 0,
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 31723dd7cbdc..8616a26895d8 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -759,10 +759,14 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
759 if(dev->pci->device == 0x8880) { 759 if(dev->pci->device == 0x8880) {
760 dev->bridge = CX23885_BRIDGE_887; 760 dev->bridge = CX23885_BRIDGE_887;
761 dev->sram_channels = cx23887_sram_channels; 761 dev->sram_channels = cx23887_sram_channels;
762 /* Apply a sensible clock frequency for the PCIe bridge */
763 dev->clk_freq = 25000000;
762 } else 764 } else
763 if(dev->pci->device == 0x8852) { 765 if(dev->pci->device == 0x8852) {
764 dev->bridge = CX23885_BRIDGE_885; 766 dev->bridge = CX23885_BRIDGE_885;
765 dev->sram_channels = cx23885_sram_channels; 767 dev->sram_channels = cx23885_sram_channels;
768 /* Apply a sensible clock frequency for the PCIe bridge */
769 dev->clk_freq = 28000000;
766 } else 770 } else
767 BUG(); 771 BUG();
768 772
@@ -782,6 +786,10 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
782 cx23885_card_list(dev); 786 cx23885_card_list(dev);
783 } 787 }
784 788
789 /* If the user specific a clk freq override, apply it */
790 if (cx23885_boards[dev->board].clk_freq > 0)
791 dev->clk_freq = cx23885_boards[dev->board].clk_freq;
792
785 dev->pci_bus = dev->pci->bus->number; 793 dev->pci_bus = dev->pci->bus->number;
786 dev->pci_slot = PCI_SLOT(dev->pci->devfn); 794 dev->pci_slot = PCI_SLOT(dev->pci->devfn);
787 dev->pci_irqmask = 0x001f00; 795 dev->pci_irqmask = 0x001f00;
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index 48d0c87ddbc2..b957242dcd5e 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -100,6 +100,17 @@ typedef enum {
100struct cx23885_board { 100struct cx23885_board {
101 char *name; 101 char *name;
102 port_t portb, portc; 102 port_t portb, portc;
103
104 /* Vendors can and do run the PCIe bridge at different
105 * clock rates, driven physically by crystals on the PCBs.
106 * The core has to accomodate this. This allows the user
107 * to add new boards with new frequencys. The value is
108 * expressed in Hz.
109 *
110 * The core framework will default this value based on
111 * current designs, but it can vary.
112 */
113 u32 clk_freq;
103 struct cx23885_input input[MAX_CX23885_INPUT]; 114 struct cx23885_input input[MAX_CX23885_INPUT];
104}; 115};
105 116
@@ -193,6 +204,10 @@ struct cx23885_dev {
193 int pci_irqmask; 204 int pci_irqmask;
194 int hwrevision; 205 int hwrevision;
195 206
207 /* This valud is board specific and is used to configure the
208 * AV core so we see nice clean and stable video and audio. */
209 u32 clk_freq;
210
196 /* I2C adapters: Master 1 & 2 (External) & Master 3 (Internal only) */ 211 /* I2C adapters: Master 1 & 2 (External) & Master 3 (Internal only) */
197 struct cx23885_i2c i2c_bus[3]; 212 struct cx23885_i2c i2c_bus[3];
198 213