diff driver/pt1_i2c.c @ 79:3c2123189edf

improve PT2 support. - update read check in initialization - PT2 specific RAM phase initialization
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 07 Dec 2009 15:01:57 +0900
parents 517e61637f7b
children b8032e8099de
line wrap: on
line diff
--- 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");