changeset 102:6e661e828b43

send tuners to sleep mode when they are inactive
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 24 Feb 2010 22:44:06 +0900
parents 3f7288b0672c
children 387d18563ef8
files driver/pt1_pci.c driver/pt1_tuner.c driver/pt1_tuner_data.c driver/pt1_tuner_data.h
diffstat 4 files changed, 59 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/driver/pt1_pci.c	Sun Feb 14 22:12:10 2010 +0900
+++ b/driver/pt1_pci.c	Wed Feb 24 22:44:06 2010 +0900
@@ -342,6 +342,12 @@
 						mutex_unlock(&device[lp]->lock);
 						return -EIO ;
 					}
+
+					/* wake tuner up */
+					set_sleepmode(channel->ptr->regs, &channel->lock,
+								  channel->address, channel->type,
+								  TYPE_WAKEUP);
+
 					channel->drop  = 0 ;
 					channel->valid = TRUE ;
 					channel->overflow = 0 ;
@@ -380,6 +386,11 @@
 		wake_up(&channel->ptr->dma_wait_q);
 	}
 	mutex_unlock(&channel->ptr->lock);
+
+	/* send tuner to sleep */
+	set_sleepmode(channel->ptr->regs, &channel->lock,
+				  channel->address, channel->type, TYPE_SLEEP);
+
 	return 0;
 }
 
@@ -447,17 +458,19 @@
 #if 0
 				printk(KERN_INFO "clockmargin = (%x)\n", (tmcc.clockmargin & 0xFF));
 				printk(KERN_INFO "carriermargin  = (%x)\n", (tmcc.carriermargin & 0xFF));
-
-				for(lp = 0 ; lp < MAX_BS_TS_ID ; lp++){
-					if(tmcc.ts_id[lp].ts_id == 0xFFFF){
-						continue ;
+				{
+					int lp;
+					for(lp = 0 ; lp < MAX_BS_TS_ID ; lp++){
+						if(tmcc.ts_id[lp].ts_id == 0xFFFF){
+							continue ;
+						}
+						printk(KERN_INFO "Slot(%d:%x)\n", lp, tmcc.ts_id[lp].ts_id);
+						printk(KERN_INFO "mode (low/high) = (%x:%x)\n",
+							   tmcc.ts_id[lp].low_mode, tmcc.ts_id[lp].high_mode);
+						printk(KERN_INFO "slot (low/high) = (%x:%x)\n",
+							   tmcc.ts_id[lp].low_slot,
+							   tmcc.ts_id[lp].high_slot);
 					}
-					printk(KERN_INFO "Slot(%d:%x)\n", lp, tmcc.ts_id[lp].ts_id);
-					printk(KERN_INFO "mode (low/high) = (%x:%x)\n",
-							tmcc.ts_id[lp].low_mode, tmcc.ts_id[lp].high_mode);
-					printk(KERN_INFO "slot (low/high) = (%x:%x)\n",
-							tmcc.ts_id[lp].low_slot,
-							tmcc.ts_id[lp].high_slot);
 				}
 #endif
 				ts_lock(channel->ptr->regs,
--- a/driver/pt1_tuner.c	Sun Feb 14 22:12:10 2010 +0900
+++ b/driver/pt1_tuner.c	Wed Feb 24 22:44:06 2010 +0900
@@ -194,23 +194,21 @@
 		case CHANNEL_TYPE_ISDB_S:
 			printk(KERN_INFO "PT1:ISDB-S Wakeup\n");
 			memcpy(&wk, &isdb_s_wake, sizeof(WBLOCK));
-			wk.addr = address ;
+			wk.addr = address;
 			i2c_write(regs, lock, &wk);
 
-			memcpy(&wk, &isdb_s_sleep, sizeof(WBLOCK));
-			wk.value[1] = 0x01 ;
-			wk.addr = address ;
+			memcpy(&wk, &isdb_s_wake2, sizeof(WBLOCK));
+			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 ;
+			wk.addr = address;
 			i2c_write(regs, lock, &wk);
 
-			memcpy(&wk, &isdb_s_sleep, sizeof(WBLOCK));
-			wk.value[1] = 0x90 ;
-			wk.addr = address ;
+			memcpy(&wk, &isdb_t_wake2, sizeof(WBLOCK));
+			wk.addr = address;
 			i2c_write(regs, lock, &wk);
 			break ;
 		}
--- a/driver/pt1_tuner_data.c	Sun Feb 14 22:12:10 2010 +0900
+++ b/driver/pt1_tuner_data.c	Wed Feb 24 22:44:06 2010 +0900
@@ -21,41 +21,48 @@
 /* 省電力テーブル                                                          */
 /***************************************************************************/
 /*
-ISDB-Sの省電力設定
-                       C0 C1
-送信:7Bit Address Mode(1b/19):17:00
-ISDB-Sの省電力無効(2コマンド)
-                       C0 C1
-送信:7Bit Address Mode(1B/19):fe:c0:f0:04
-送信:7Bit Address Mode(1B/19):17:01
+ISDB-S省電力
+送信:7Bit Address Mode(1b):17:01
+
+ISDB-S省電力OFF
+送信:7Bit Address Mode(1b):fe:c0:e4:fe:c0:f4:d6
+送信:7Bit Address Mode(1b):17:00
 */
+WBLOCK	isdb_s_sleep = {
+	0,
+	2,
+	{0x17, 0x01}
+};
 WBLOCK	isdb_s_wake = {
 	0,
-	4,
-	{0xFE, 0xC0, 0xF0, 0x04}
+	7,
+	{0xFE, 0xC0, 0xE4, 0xFE, 0xC0, 0xF4, 0xD6}
 };
-WBLOCK	isdb_s_sleep = {
+WBLOCK	isdb_s_wake2 = {
 	0,
 	2,
 	{0x17, 0x00}
 };
+
 /*
-ISDB-Tの省電力設定
-                       C0 C1
-送信:7Bit Address Mode(1A/18):03:80
+ISDB-T省電力
+送信:7Bit Address Mode(1a):03:90
 
-ISDB-Tの省電力無効(2コマンド)
-                       C0 C1
-送信:7Bit Address Mode(1A/18):fe:c2
-送信:7Bit Address Mode(1A/18):03:90
+ISDB-T省電力OFF
+送信:7Bit Address Mode(1a):fe:c2:0e:7f:c1:84:80
+送信:7Bit Address Mode(1a):03:80
 */
-
+WBLOCK	isdb_t_sleep = {
+	0,
+	2,
+	{0x03, 0x90}
+};
 WBLOCK	isdb_t_wake = {
 	0,
-	2,
-	{0xFE, 0xC2}
+	7,
+	{0xFE, 0xC2, 0x0E, 0x7F, 0xC1, 0x84, 0x80}
 };
-WBLOCK	isdb_t_sleep = {
+WBLOCK	isdb_t_wake2 = {
 	0,
 	2,
 	{0x03, 0x80}
--- a/driver/pt1_tuner_data.h	Sun Feb 14 22:12:10 2010 +0900
+++ b/driver/pt1_tuner_data.h	Wed Feb 24 22:44:06 2010 +0900
@@ -71,6 +71,8 @@
 /***************************************************************************/
 extern	WBLOCK	isdb_s_wake;
 extern	WBLOCK	isdb_t_wake;
+extern	WBLOCK	isdb_s_wake2;
+extern	WBLOCK	isdb_t_wake2;
 
 extern	WBLOCK	isdb_s_sleep;
 extern	WBLOCK	isdb_t_sleep;