changeset 77:517e61637f7b

a bit cleanup
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 01 Dec 2009 18:33:01 +0900
parents d1c740aa1b67
children 5a0126d8af17
files driver/pt1_i2c.c driver/pt1_tuner.c driver/pt1_tuner_data.c driver/pt1_tuner_data.h
diffstat 4 files changed, 50 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/driver/pt1_i2c.c	Sat Nov 28 06:24:21 2009 +0900
+++ b/driver/pt1_i2c.c	Tue Dec 01 18:33:01 2009 +0900
@@ -35,7 +35,7 @@
 
 	__u32		val ;
 	val =  ((base_addr << I2C_DATA) | (writemode << I2C_WRIET_MODE) |
-			( data_en << I2C_DATA_EN) | 
+			( data_en << I2C_DATA_EN) |
 			(clock << I2C_CLOCK) | (busy << I2C_BUSY) | i2caddr) ;
 	writel(val, regs + FIFO_ADDR);
 }
@@ -57,7 +57,7 @@
 	// XC3S初期化
 	for(lp = 0 ; lp < PROGRAM_ADDRESS ; lp++){
 		makei2c(regs, lp, 0, READ_EN, DATA_DIS, CLOCK_DIS, BUSY_DIS);
-	}   
+	}
 	// XC3S 初期化待ち (512 PCI Clocks)
 	for(lp = 0 ; lp <  XC3S_PCI_CLOCK ; lp++){
 		makei2c(regs, 0, 0, READ_EN, DATA_DIS, CLOCK_DIS, BUSY_DIS);
@@ -291,7 +291,7 @@
 	clock = TRUE ;
 	address += 1 ;
 
-	// ここから Read 
+	// ここから Read
 	start_i2c(regs, &address, &clock, old_bits);
 	old_bits = 0 ;
 	// まずアドレスを書く
--- a/driver/pt1_tuner.c	Sat Nov 28 06:24:21 2009 +0900
+++ b/driver/pt1_tuner.c	Tue Dec 01 18:33:01 2009 +0900
@@ -49,7 +49,7 @@
 
 void	settuner_reset(void __iomem *regs, int cardtype, __u32 lnb, __u32 tuner)
 {
-	__u32	val = 0;
+	__u32	val = TUNER_POWER_OFF;
 	switch(lnb){
 		case LNB_11V:
 			val = (1 << BIT_LNB_DOWN);
@@ -112,14 +112,14 @@
 	}
 
 	if(cardtype == PT1) {
-		for(lp = 0 ; lp < MAX_ISDB_S_INIT ; lp++){
+		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 < MAX_ISDB_S_INIT2 ; lp++){
+		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);
@@ -135,14 +135,14 @@
 
 	// ISDB-S/T初期化
 	if(cardtype == PT1) {
-		for(lp = 0 ; lp < MAX_ISDB_T_INIT ; lp++){
+		for(lp = 0 ; lp < PT1_MAX_ISDB_T_INIT ; lp++){
 			memcpy(&wk, isdb_t_initial_pt1[lp], sizeof(WBLOCK));
 			wk.addr = addr;
 			i2c_write(regs, lock, &wk);
 		}
 	}
 	else if(cardtype == PT2) {
-		for(lp = 0 ; lp < MAX_ISDB_T_INIT2 ; lp++){
+		for(lp = 0 ; lp < PT2_MAX_ISDB_T_INIT ; lp++){
 			memcpy(&wk, isdb_t_initial_pt2[lp], sizeof(WBLOCK));
 			wk.addr = addr;
 			i2c_write(regs, lock, &wk);
@@ -187,34 +187,46 @@
 
 	if(type == TYPE_WAKEUP){
 		switch(tuner_type){
-			case CHANNEL_TYPE_ISDB_S:
-				memcpy(&wk, &isdb_s_wake, sizeof(WBLOCK));
-				break ;
-			case CHANNEL_TYPE_ISDB_T:
-				memcpy(&wk, &isdb_t_wake, sizeof(WBLOCK));
-				break ;
+		case CHANNEL_TYPE_ISDB_S:
+			printk(KERN_INFO "PT1:ISDB-S Wakeup\n");
+			memcpy(&wk, &isdb_s_wake, sizeof(WBLOCK));
+			wk.addr = address ;
+			i2c_write(regs, lock, &wk);
+
+			memcpy(&wk, &isdb_s_sleep, sizeof(WBLOCK));
+			wk.value[1] = 0x01 ;
+			wk.addr = address ;
+			i2c_write(regs, lock, &wk);
+			break ;
+		case CHANNEL_TYPE_ISDB_T:
+			printk(KERN_INFO "PT1:ISDB-T Wakeup\n");
+			memcpy(&wk, &isdb_t_wake, sizeof(WBLOCK));
+			wk.addr = address ;
+			i2c_write(regs, lock, &wk);
+
+			memcpy(&wk, &isdb_s_sleep, sizeof(WBLOCK));
+			wk.value[1] = 0x90 ;
+			wk.addr = address ;
+			i2c_write(regs, lock, &wk);
+			break ;
 		}
-		wk.addr = address ;
-		i2c_write(regs, lock, &wk);
 	}
-	switch(tuner_type){
+	if(type == TYPE_SLEEP){
+		switch(tuner_type){
 		case CHANNEL_TYPE_ISDB_S:
 			printk(KERN_INFO "PT1:ISDB-S Sleep\n");
 			memcpy(&wk, &isdb_s_sleep, sizeof(WBLOCK));
-			if(type == TYPE_WAKEUP){
-				wk.value[1] = 0x01 ;
-			}
+			wk.addr = address;
+			i2c_write(regs, lock, &wk);
 			break ;
 		case CHANNEL_TYPE_ISDB_T:
 			printk(KERN_INFO "PT1:ISDB-T Sleep\n");
 			memcpy(&wk, &isdb_t_sleep, sizeof(WBLOCK));
-			if(type == TYPE_WAKEUP){
-				wk.value[1] = 0x90 ;
-			}
+			wk.addr = address;
+			i2c_write(regs, lock, &wk);
 			break ;
+		}
 	}
-	wk.addr = address;
-	i2c_write(regs, lock, &wk);
 }
 
 int		bs_frequency(void __iomem *regs, struct mutex *lock, int addr, int channel)
--- a/driver/pt1_tuner_data.c	Sat Nov 28 06:24:21 2009 +0900
+++ b/driver/pt1_tuner_data.c	Tue Dec 01 18:33:01 2009 +0900
@@ -180,7 +180,6 @@
 WBLOCK	isdb_s_init18 ={
 	0,
 	2,
-//	{0x8E, 0x02}
 	{0x8E, 0x26}
 };
 // ISDB-S初期化値19
@@ -280,14 +279,12 @@
 WBLOCK	isdb_t_init13 ={
 	0,
 	2,
-//	{0x75, 0x02}
 	{0x75, 0x0a}
 };
 // ISDB-T初期化値14
 WBLOCK	isdb_t_init14 ={
 	0,
 	2,
-//	{0x76, 0x4E}
 	{0x76, 0x4c}
 };
 // ISDB-T初期化値15
@@ -311,7 +308,7 @@
 /***************************************************************************/
 /* 初期化データブロック定義(ISDB-S)                                        */
 /***************************************************************************/
-WBLOCK	*isdb_s_initial_pt1[MAX_ISDB_S_INIT] =
+WBLOCK	*isdb_s_initial_pt1[PT1_MAX_ISDB_S_INIT] =
 {
 	&isdb_s_init2, &isdb_s_init3, &isdb_s_init4, &isdb_s_init5,
 	&isdb_s_init6, &isdb_s_init7, &isdb_s_init8, &isdb_s_init9,
@@ -319,7 +316,7 @@
 	&isdb_s_init14, &isdb_s_init15, &isdb_s_init16, &isdb_s_init17,
 	&isdb_s_init18, &isdb_s_init19, &isdb_s_init20
 };
-WBLOCK	*isdb_s_initial_pt2[MAX_ISDB_S_INIT2] =
+WBLOCK	*isdb_s_initial_pt2[PT2_MAX_ISDB_S_INIT] =
 {
 	&isdb_s_init2, &isdb_s_init4, &isdb_s_init5,
 	&isdb_s_init6, &isdb_s_init7, &isdb_s_init8, &isdb_s_init9,
@@ -330,14 +327,14 @@
 /***************************************************************************/
 /* 初期化データブロック定義(ISDB-T)                                        */
 /***************************************************************************/
-WBLOCK	*isdb_t_initial_pt1[MAX_ISDB_T_INIT] =
+WBLOCK	*isdb_t_initial_pt1[PT1_MAX_ISDB_T_INIT] =
 {
 	&isdb_t_init1, &isdb_t_init2, &isdb_t_init3, &isdb_t_init4,
 	&isdb_t_init5, &isdb_t_init6, &isdb_t_init7, &isdb_t_init8,
 	&isdb_t_init9, &isdb_t_init10, &isdb_t_init11, &isdb_t_init12,
 	&isdb_t_init13, &isdb_t_init14, &isdb_t_init15, &isdb_t_init16
 };
-WBLOCK	*isdb_t_initial_pt2[MAX_ISDB_T_INIT2] =
+WBLOCK	*isdb_t_initial_pt2[PT2_MAX_ISDB_T_INIT] =
 {
 	&isdb_t_init1, &isdb_t_init3, &isdb_t_init4,
 	&isdb_t_init5, &isdb_t_init6,
--- a/driver/pt1_tuner_data.h	Sat Nov 28 06:24:21 2009 +0900
+++ b/driver/pt1_tuner_data.h	Tue Dec 01 18:33:01 2009 +0900
@@ -3,10 +3,11 @@
 /***************************************************************************/
 /*                                                                         */
 /***************************************************************************/
-#define		MAX_ISDB_S_INIT		19			// ISDB-S 初期化データ数
-#define		MAX_ISDB_T_INIT		16			// ISDB-S 初期化データ数
-#define		MAX_ISDB_S_INIT2	18			// ISDB-S 初期化データ数
-#define		MAX_ISDB_T_INIT2	12			// ISDB-S 初期化データ数
+#define		PT1_MAX_ISDB_S_INIT	19			// ISDB-S 初期化データ数
+#define		PT1_MAX_ISDB_T_INIT	16			// ISDB-T 初期化データ数
+#define		PT2_MAX_ISDB_S_INIT 	18			// ISDB-S 初期化データ数
+#define		PT2_MAX_ISDB_T_INIT 	12			// ISDB-T 初期化データ数
+
 #define		MAX_BS_CHANNEL		36			// 周波数テーブル数
 #define		MAX_ISDB_T_CHANNEL	113			// 周波数テーブル数(地デジタル)
 #define		MAX_BS_CHANNEL_PLL_COMMAND	3	// PLLロックするためのコマンド数
@@ -29,10 +30,10 @@
 extern	WBLOCK	isdb_s_init21;		//ISDB-S最終
 extern	WBLOCK	isdb_t_init17;		//ISDB-T最終
 extern	WBLOCK	bs_pll_lock;		//ISDB-S PLLロック確認
-extern	WBLOCK	*isdb_s_initial_pt1[MAX_ISDB_S_INIT];
-extern	WBLOCK	*isdb_s_initial_pt2[MAX_ISDB_S_INIT2];
-extern	WBLOCK	*isdb_t_initial_pt1[MAX_ISDB_T_INIT];
-extern	WBLOCK	*isdb_t_initial_pt2[MAX_ISDB_T_INIT2];
+extern	WBLOCK	*isdb_s_initial_pt1[PT1_MAX_ISDB_S_INIT];
+extern	WBLOCK	*isdb_t_initial_pt1[PT1_MAX_ISDB_T_INIT];
+extern	WBLOCK	*isdb_s_initial_pt2[PT2_MAX_ISDB_S_INIT];
+extern	WBLOCK	*isdb_t_initial_pt2[PT2_MAX_ISDB_T_INIT];
 /***************************************************************************/
 /* BS用データ定義                                                          */
 /***************************************************************************/