# HG changeset patch # User Yoshiki Yazawa # Date 1260165717 -32400 # Node ID 3c2123189edfc324366638d755331333a410afd1 # Parent 5a0126d8af171b007c8c0ffe0cd335c8070f2649 improve PT2 support. - update read check in initialization - PT2 specific RAM phase initialization diff -r 5a0126d8af17 -r 3c2123189edf driver/pt1_i2c.c --- a/driver/pt1_i2c.c Tue Dec 01 20:24:22 2009 +0900 +++ b/driver/pt1_i2c.c Mon Dec 07 15:01:57 2009 +0900 @@ -17,6 +17,7 @@ #include "pt1_com.h" #include "pt1_i2c.h" #include "pt1_pci.h" +#include "pt1_tuner.h" #define PROGRAM_ADDRESS 1024 static int state = STATE_STOP ; @@ -40,12 +41,13 @@ writel(val, regs + FIFO_ADDR); } -int xc3s_init(void __iomem *regs) +int xc3s_init(void __iomem *regs, int cardtype) { __u32 val ; int lp ; int rc ; + int phase = XC3S_PCI_CLOCK; /* val = (1 << 19) | (1 << 27) | (1 << 16) | (1 << 24) | (1 << 17) | (1 << 25); @@ -98,7 +100,15 @@ if(rc){ return -EIO ; } - for(lp = 0 ; lp < XC3S_PCI_CLOCK ; lp++){ + switch(cardtype) { + case PT1: + phase = XC3S_PCI_CLOCK; + break; + case PT2: + phase = XC3S_PCI_CLOCK_PT2; + break; + } + for(lp = 0; lp < phase; lp++){ rc = i2c_lock_one(regs, WRITE_RAM_ENABLE, RAM_SHIFT); if(rc < 0){ printk(KERN_ERR "PT1:LOCK FALUT\n"); diff -r 5a0126d8af17 -r 3c2123189edf driver/pt1_i2c.h --- a/driver/pt1_i2c.h Tue Dec 01 20:24:22 2009 +0900 +++ b/driver/pt1_i2c.h Mon Dec 07 15:01:57 2009 +0900 @@ -52,6 +52,7 @@ #define READ_UNLOCK (1 << 31) #define XC3S_PCI_CLOCK (512 / 4) +#define XC3S_PCI_CLOCK_PT2 (166) /***************************************************************************/ /* I2Cアドレス定義 */ /***************************************************************************/ @@ -74,7 +75,7 @@ /* 関数定義 */ /***************************************************************************/ //extern __u32 makei2c(void __iomem *, __u32, __u32, __u32, __u32, __u32, __u32); -extern int xc3s_init(void __iomem *); +extern int xc3s_init(void __iomem *, int); extern void SetStream(void __iomem *, __u32, __u32); extern void blockwrite(void __iomem *, WBLOCK *); extern void i2c_write(void __iomem *, struct mutex *, WBLOCK *); diff -r 5a0126d8af17 -r 3c2123189edf driver/pt1_pci.c --- a/driver/pt1_pci.c Tue Dec 01 20:24:22 2009 +0900 +++ b/driver/pt1_pci.c Mon Dec 07 15:01:57 2009 +0900 @@ -686,17 +686,17 @@ dev_conf->mmio_len = pci_resource_len(pdev, 0); dummy = request_mem_region(dev_conf->mmio_start, dev_conf->mmio_len, DEV_NAME); if (!dummy) { - printk(KERN_ERR "PT1: cannot request iomem (0x%llx).\n", (unsigned long long) dev_conf->mmio_start); + printk(KERN_ERR "PT1:cannot request iomem (0x%llx).\n", (unsigned long long) dev_conf->mmio_start); goto out_err_regbase; } dev_conf->regs = ioremap(dev_conf->mmio_start, dev_conf->mmio_len); if (!dev_conf->regs){ - printk(KERN_ERR "pt1: Can't remap register area.\n"); + printk(KERN_ERR "pt1:Can't remap register area.\n"); goto out_err_regbase; } // 初期化処理 - if(xc3s_init(dev_conf->regs)){ + if(xc3s_init(dev_conf->regs, dev_conf->cardtype)){ printk(KERN_ERR "Error xc3s_init\n"); goto out_err_fpga; } @@ -734,7 +734,7 @@ minor = MINOR(dev_conf->dev) ; dev_conf->base_minor = minor ; for(lp = 0 ; lp < MAX_PCI_DEVICE ; lp++){ - printk(KERN_INFO "PT1: device[%d]=%p\n", lp, device[lp]); + printk(KERN_INFO "PT1:device[%d]=%p\n", lp, device[lp]); if(device[lp] == NULL){ device[lp] = dev_conf ; dev_conf->card_number = lp; @@ -785,7 +785,7 @@ goto out_err_v4l; } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - printk(KERN_INFO "PT1: card_number = %d\n", + printk(KERN_INFO "PT1:card_number = %d\n", dev_conf->card_number); device_create(pt1video_class, NULL, diff -r 5a0126d8af17 -r 3c2123189edf driver/pt1_tuner.c --- a/driver/pt1_tuner.c Tue Dec 01 20:24:22 2009 +0900 +++ b/driver/pt1_tuner.c Mon Dec 07 15:01:57 2009 +0900 @@ -106,20 +106,24 @@ memcpy(&wk, &isdb_s_init1, sizeof(WBLOCK)); wk.addr = addr; val = i2c_read(regs, lock, &wk, 1); - if((val & 0xff) != 0x41){ - printk(KERN_INFO "PT1:ISDB-S Read(%x)\n", val); - return -EIO ; - } if(cardtype == PT1) { - for(lp = 0 ; lp < PT1_MAX_ISDB_S_INIT ; lp++){ + if((val & 0xff) != 0x4c) { + printk(KERN_INFO "PT1:ISDB-S Read(%x)\n", val); + return -EIO ; + } + for(lp = 0 ; lp < PT1_MAX_ISDB_S_INIT ; lp++) { memcpy(&wk, isdb_s_initial_pt1[lp], sizeof(WBLOCK)); wk.addr = addr; i2c_write(regs, lock, &wk); } } else if(cardtype == PT2) { - for(lp = 0 ; lp < PT2_MAX_ISDB_S_INIT ; lp++){ + if((val & 0xff) != 0x52) { + printk(KERN_INFO "PT2:ISDB-S Read(%x)\n", val); + return -EIO ; + } + for(lp = 0 ; lp < PT2_MAX_ISDB_S_INIT ; lp++) { memcpy(&wk, isdb_s_initial_pt2[lp], sizeof(WBLOCK)); wk.addr = addr; i2c_write(regs, lock, &wk); diff -r 5a0126d8af17 -r 3c2123189edf driver/pt1_tuner_data.c --- a/driver/pt1_tuner_data.c Tue Dec 01 20:24:22 2009 +0900 +++ b/driver/pt1_tuner_data.c Mon Dec 07 15:01:57 2009 +0900 @@ -77,7 +77,7 @@ WBLOCK isdb_s_init1 ={ 0, 1, - {0x07} + {0x0f} }; // ISDB-S初期化値2 WBLOCK isdb_s_init2 ={ @@ -85,7 +85,6 @@ 2, {0x04, 0x02} }; - // ISDB-S初期化値3 WBLOCK isdb_s_init3 ={ 0,