aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Toth <stoth@hauppauge.com>2008-01-13 21:44:47 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:09:50 -0400
commita589b66546d3d81e28dd95d3463c9e9da3d68728 (patch)
tree4998829e5a63b26a2ef6c63d43638c7406f2bd26
parentb1b81f1db73f00e595585b16aa31293a791964c0 (diff)
V4L/DVB (7726): cx23885: Enable cx23417 support on the HVR1800
cx23885: Enable cx23417 support on the HVR1800 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>
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c22
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c45
-rw-r--r--drivers/media/video/cx23885/cx23885-i2c.c23
-rw-r--r--drivers/media/video/cx23885/cx23885.h1
4 files changed, 89 insertions, 2 deletions
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index 0f4b325f2d89..6ebf58724a01 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -73,6 +73,7 @@ struct cx23885_board cx23885_boards[] = {
73 [CX23885_BOARD_HAUPPAUGE_HVR1800] = { 73 [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
74 .name = "Hauppauge WinTV-HVR1800", 74 .name = "Hauppauge WinTV-HVR1800",
75 .porta = CX23885_ANALOG_VIDEO, 75 .porta = CX23885_ANALOG_VIDEO,
76 .portb = CX23885_MPEG_ENCODER,
76 .portc = CX23885_MPEG_DVB, 77 .portc = CX23885_MPEG_DVB,
77 .tuner_type = TUNER_PHILIPS_TDA8290, 78 .tuner_type = TUNER_PHILIPS_TDA8290,
78 .tuner_addr = 0x42, /* 0x84 >> 1 */ 79 .tuner_addr = 0x42, /* 0x84 >> 1 */
@@ -336,6 +337,10 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
336 /* GPIO-15-18 cx23417 READY, CS, RD, WR */ 337 /* GPIO-15-18 cx23417 READY, CS, RD, WR */
337 /* GPIO-19 IR_RX */ 338 /* GPIO-19 IR_RX */
338 339
340 /* CX23417 GPIO's */
341 /* EIO15 Zilog Reset */
342 /* EIO14 S5H1409/CX24227 Reset */
343
339 /* Force the TDA8295A into reset and back */ 344 /* Force the TDA8295A into reset and back */
340 cx_set(GP0_IO, 0x00040004); 345 cx_set(GP0_IO, 0x00040004);
341 mdelay(20); 346 mdelay(20);
@@ -443,10 +448,25 @@ void cx23885_card_setup(struct cx23885_dev *dev)
443 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ 448 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
444 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; 449 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
445 break; 450 break;
451 case CX23885_BOARD_HAUPPAUGE_HVR1800:
452 /* Defaults for VID B - Analog encoder */
453 /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
454 ts1->gen_ctrl_val = 0x10e;
455 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
456 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
457
458 /* APB_TSVALERR_POL (active low)*/
459 ts1->vld_misc_val = 0x2000;
460 ts1->hw_sop_ctrl_val = (0x47 << 16 | 188 << 4 | 0xc);
461
462 /* Defaults for VID C */
463 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
464 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
465 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
466 break;
446 case CX23885_BOARD_HAUPPAUGE_HVR1250: 467 case CX23885_BOARD_HAUPPAUGE_HVR1250:
447 case CX23885_BOARD_HAUPPAUGE_HVR1500: 468 case CX23885_BOARD_HAUPPAUGE_HVR1500:
448 case CX23885_BOARD_HAUPPAUGE_HVR1500Q: 469 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
449 case CX23885_BOARD_HAUPPAUGE_HVR1800:
450 case CX23885_BOARD_HAUPPAUGE_HVR1800lp: 470 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
451 case CX23885_BOARD_HAUPPAUGE_HVR1200: 471 case CX23885_BOARD_HAUPPAUGE_HVR1200:
452 case CX23885_BOARD_HAUPPAUGE_HVR1700: 472 case CX23885_BOARD_HAUPPAUGE_HVR1700:
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 7f7446a76465..f24abcd06dea 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1037,6 +1037,7 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1037 struct cx23885_buffer *buf) 1037 struct cx23885_buffer *buf)
1038{ 1038{
1039 struct cx23885_dev *dev = port->dev; 1039 struct cx23885_dev *dev = port->dev;
1040 u32 reg;
1040 1041
1041 dprintk(1, "%s() w: %d, h: %d, f: %d\n", __func__, 1042 dprintk(1, "%s() w: %d, h: %d, f: %d\n", __func__,
1042 buf->vb.width, buf->vb.height, buf->vb.field); 1043 buf->vb.width, buf->vb.height, buf->vb.field);
@@ -1062,6 +1063,9 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1062 return -EINVAL; 1063 return -EINVAL;
1063 } 1064 }
1064 1065
1066 if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER)
1067 cx23885_av_clk(dev, 0);
1068
1065 udelay(100); 1069 udelay(100);
1066 1070
1067 /* If the port supports SRC SELECT, configure it */ 1071 /* If the port supports SRC SELECT, configure it */
@@ -1079,6 +1083,21 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1079 cx_write(port->reg_gpcnt_ctl, 3); 1083 cx_write(port->reg_gpcnt_ctl, 3);
1080 q->count = 1; 1084 q->count = 1;
1081 1085
1086 if (cx23885_boards[dev->board].portb & CX23885_MPEG_ENCODER) {
1087
1088 reg = cx_read(PAD_CTRL);
1089 reg = reg & ~0x1; /* Clear TS1_OE */
1090
1091 /* FIXME, bit 2 writing here is questionable */
1092 /* set TS1_SOP_OE and TS1_OE_HI */
1093 reg = reg | 0xa;
1094 cx_write(PAD_CTRL, reg);
1095
1096 /* FIXME and these two registers should be documented. */
1097 cx_write(CLK_DELAY, cx_read(CLK_DELAY) | 0x80000011);
1098 cx_write(ALT_PIN_OUT_SEL, 0x10100045);
1099 }
1100
1082 switch(dev->bridge) { 1101 switch(dev->bridge) {
1083 case CX23885_BRIDGE_885: 1102 case CX23885_BRIDGE_885:
1084 case CX23885_BRIDGE_887: 1103 case CX23885_BRIDGE_887:
@@ -1094,6 +1113,9 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1094 1113
1095 cx_set(DEV_CNTRL2, (1<<5)); /* Enable RISC controller */ 1114 cx_set(DEV_CNTRL2, (1<<5)); /* Enable RISC controller */
1096 1115
1116 if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER)
1117 cx23885_av_clk(dev, 1);
1118
1097 if (debug > 4) 1119 if (debug > 4)
1098 cx23885_tsport_reg_dump(port); 1120 cx23885_tsport_reg_dump(port);
1099 1121
@@ -1103,12 +1125,32 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1103static int cx23885_stop_dma(struct cx23885_tsport *port) 1125static int cx23885_stop_dma(struct cx23885_tsport *port)
1104{ 1126{
1105 struct cx23885_dev *dev = port->dev; 1127 struct cx23885_dev *dev = port->dev;
1128 u32 reg;
1129
1106 dprintk(1, "%s()\n", __func__); 1130 dprintk(1, "%s()\n", __func__);
1107 1131
1108 /* Stop interrupts and DMA */ 1132 /* Stop interrupts and DMA */
1109 cx_clear(port->reg_ts_int_msk, port->ts_int_msk_val); 1133 cx_clear(port->reg_ts_int_msk, port->ts_int_msk_val);
1110 cx_clear(port->reg_dma_ctl, port->dma_ctl_val); 1134 cx_clear(port->reg_dma_ctl, port->dma_ctl_val);
1111 1135
1136 if (cx23885_boards[dev->board].portb & CX23885_MPEG_ENCODER) {
1137
1138 reg = cx_read(PAD_CTRL);
1139
1140 /* Set TS1_OE */
1141 reg = reg | 0x1;
1142
1143 /* clear TS1_SOP_OE and TS1_OE_HI */
1144 reg = reg & ~0xa;
1145 cx_write(PAD_CTRL, reg);
1146 cx_write(port->reg_src_sel, 0);
1147 cx_write(port->reg_gen_ctrl, 8);
1148
1149 }
1150
1151 if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER)
1152 cx23885_av_clk(dev, 0);
1153
1112 return 0; 1154 return 0;
1113} 1155}
1114 1156
@@ -1525,7 +1567,8 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev,
1525 printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, " 1567 printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, "
1526 "latency: %d, mmio: 0x%llx\n", dev->name, 1568 "latency: %d, mmio: 0x%llx\n", dev->name,
1527 pci_name(pci_dev), dev->pci_rev, pci_dev->irq, 1569 pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
1528 dev->pci_lat, (unsigned long long)pci_resource_start(pci_dev,0)); 1570 dev->pci_lat,
1571 (unsigned long long)pci_resource_start(pci_dev, 0));
1529 1572
1530 pci_set_master(pci_dev); 1573 pci_set_master(pci_dev);
1531 if (!pci_dma_supported(pci_dev, 0xffffffff)) { 1574 if (!pci_dma_supported(pci_dev, 0xffffffff)) {
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c
index 3928945df5f5..c6bb0a05bc1c 100644
--- a/drivers/media/video/cx23885/cx23885-i2c.c
+++ b/drivers/media/video/cx23885/cx23885-i2c.c
@@ -423,6 +423,29 @@ int cx23885_i2c_unregister(struct cx23885_i2c *bus)
423 return 0; 423 return 0;
424} 424}
425 425
426void cx23885_av_clk(struct cx23885_dev *dev, int enable)
427{
428 /* write 0 to bus 2 addr 0x144 via i2x_xfer() */
429 char buffer[3];
430 struct i2c_msg msg;
431 dprintk(1, "%s(enabled = %d)\n", __func__, enable);
432
433 /* Register 0x144 */
434 buffer[0] = 0x01;
435 buffer[1] = 0x44;
436 if (enable == 1)
437 buffer[2] = 0x05;
438 else
439 buffer[2] = 0x00;
440
441 msg.addr = 0x44;
442 msg.flags = I2C_M_TEN;
443 msg.len = 3;
444 msg.buf = buffer;
445
446 i2c_xfer(&dev->i2c_bus[2].i2c_adap, &msg, 1);
447}
448
426/* ----------------------------------------------------------------------- */ 449/* ----------------------------------------------------------------------- */
427 450
428/* 451/*
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index e42b6878ba23..32af87f25e7b 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -446,6 +446,7 @@ extern int cx23885_i2c_register(struct cx23885_i2c *bus);
446extern int cx23885_i2c_unregister(struct cx23885_i2c *bus); 446extern int cx23885_i2c_unregister(struct cx23885_i2c *bus);
447extern void cx23885_call_i2c_clients(struct cx23885_i2c *bus, unsigned int cmd, 447extern void cx23885_call_i2c_clients(struct cx23885_i2c *bus, unsigned int cmd,
448 void *arg); 448 void *arg);
449extern void cx23885_av_clk(struct cx23885_dev *dev, int enable);
449 450
450/* ----------------------------------------------------------- */ 451/* ----------------------------------------------------------- */
451/* cx23885-417.c */ 452/* cx23885-417.c */