diff driver/pt1_tuner.c @ 77:517e61637f7b

a bit cleanup
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 01 Dec 2009 18:33:01 +0900
parents 28f25ec7f962
children 3c2123189edf
line wrap: on
line diff
--- 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)