diff options
author | Holger Waechtler <devnull@localhost> | 2003-01-23 16:56:54 +0000 |
---|---|---|
committer | Holger Waechtler <devnull@localhost> | 2003-01-23 16:56:54 +0000 |
commit | 58865887921e0e3a5a9d58444f9f13489223dbb4 (patch) | |
tree | 2e98d6d83d8672f4bfeab04277d68d2ec8069035 /linux/drivers/media/dvb/ttpci-budget/budget-core.c | |
parent | 5635f7b773082be731d50738b45b4e639db56f1a (diff) | |
download | mediapointer-dvb-s2-58865887921e0e3a5a9d58444f9f13489223dbb4.tar.gz mediapointer-dvb-s2-58865887921e0e3a5a9d58444f9f13489223dbb4.tar.bz2 |
apply patch by <emard@softhome.net> in order to support nova-patched av7110 cards
Diffstat (limited to 'linux/drivers/media/dvb/ttpci-budget/budget-core.c')
-rw-r--r-- | linux/drivers/media/dvb/ttpci-budget/budget-core.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/linux/drivers/media/dvb/ttpci-budget/budget-core.c b/linux/drivers/media/dvb/ttpci-budget/budget-core.c index 72eee8b0c..dde4a5930 100644 --- a/linux/drivers/media/dvb/ttpci-budget/budget-core.c +++ b/linux/drivers/media/dvb/ttpci-budget/budget-core.c @@ -4,6 +4,7 @@ #endif int budget_debug = 0; +int budget_patch = 0; /**************************************************************************** * General helper functions @@ -387,7 +388,10 @@ int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *i int pages = (length+PAGE_SIZE-1)/PAGE_SIZE; int ret = 0; struct budget_info *bi = info->ext_priv; - + + if (bi->type == BUDGET_PATCH && budget_patch <= 0) + return -EOPNOTSUPP; + if (!(budget = kmalloc (sizeof (struct budget_s), GFP_KERNEL))) { printk ("%s: out of memory!\n", __FUNCTION__); return -ENOMEM; @@ -412,6 +416,52 @@ int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *i saa7146_write(dev, GPIO_CTRL, 0x500000); saa7146_i2c_adapter_prepare(dev, NULL, SAA7146_I2C_BUS_BIT_RATE_3200); + + if (budget->card->type == BUDGET_PATCH && budget_patch > 0) + { + int cnt; +/* +** This code will setup the SAA7146_RPS1 to generate a square +** wave on GPIO3, changing when a field (TS_HEIGHT/2 "lines" of +** TS_WIDTH packets) has been acquired on SAA7146_D1B video port; +** then, this GPIO3 output which is connected to the D1B_VSYNC +** input, will trigger the acquisition of the alternate field +** and so on. +** Currently, the TT_budget / WinTV_Nova cards have two ICs +** (74HCT4040, LVC74) for the generation of this VSYNC signal, +** which seems that can be done perfectly without this :-)). +*/ + cnt = 0; // Setup RPS1 "program" (p35) + // Wait Source Line Counter Threshold (p36) + dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | EVT_HS); + // Set GPIO3=1 (p42) + dev->rps1[cnt++]=cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)); + dev->rps1[cnt++]=cpu_to_le32(GPIO3_MSK); + dev->rps1[cnt++]=cpu_to_le32(SAA7146_GPIO_OUTHI<<24); + // Wait reset Source Line Counter Threshold (p36) + dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS); + // Wait Source Line Counter Threshold + dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | EVT_HS); + // Set GPIO3=0 (p42) + dev->rps1[cnt++]=cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)); + dev->rps1[cnt++]=cpu_to_le32(GPIO3_MSK); + dev->rps1[cnt++]=cpu_to_le32(SAA7146_GPIO_OUTLO<<24); + // Wait reset Source Line Counter Threshold (p36) + dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS); + // Jump to begin of RPS program (p37) + dev->rps1[cnt++]=cpu_to_le32(CMD_JUMP); + dev->rps1[cnt++]=cpu_to_le32(virt_to_bus(&dev->rps1[0])); + + // Fix VSYNC level + saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); + // Set RPS1 Address register to point to RPS code (r108 p42) + saa7146_write(dev, RPS_ADDR1, virt_to_bus(&dev->rps1[0])); + // Set Source Line Counter Threshold, using BRS (rCC p43) + saa7146_write(dev, RPS_THRESH1, ((TS_HEIGHT/2) | MASK_12)); + // Enable RPS1 (rFC p33) + saa7146_write(dev, MC1, (MASK_13 | MASK_29)); + } + budget->i2c_bus = dvb_register_i2c_bus (master_xfer, dev, budget->dvb_adapter, 0); if (!budget->i2c_bus) { @@ -502,5 +552,6 @@ EXPORT_SYMBOL_GPL(budget_detach); EXPORT_SYMBOL_GPL(budget_debug); MODULE_PARM(budget_debug,"i"); +MODULE_PARM(budget_patch,"i"); MODULE_LICENSE("GPL"); |