diff driver/pt1_tuner.c @ 9:07b2fc07ff48

updated to current driver to support signal strength.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 23 Feb 2009 14:28:35 +0900
parents 67e8eca28a80
children 98a92ce5382e
line wrap: on
line diff
--- a/driver/pt1_tuner.c	Mon Feb 23 03:06:17 2009 +0900
+++ b/driver/pt1_tuner.c	Mon Feb 23 14:28:35 2009 +0900
@@ -18,17 +18,7 @@
 #include	"pt1_i2c.h"
 #include	"pt1_tuner.h"
 #include	"pt1_tuner_data.h"
-/*
-  LNB  : BIT 2 1
-   OFF :     0 0
-   +15V:     1 1
-   +11V:     1 0
 
-  TUNER: BIT        3 0
-   POWER-OFF      : 0 0
-   POWER-ON RESET : 0 1
-   POWER-ON ONLY  : 1 1
-*/
 typedef	struct	_TUNER_INFO{
 	int		isdb_s ;
 	int		isdb_t ;
@@ -67,7 +57,7 @@
 
 	switch(tuner){
 		case TUNER_POWER_ON_RESET_ENABLE: val |= (1 << BIT_TUNER) ; break ;
-		case TUNER_POWER_ON_RESET_DISABLE: val = (1 << BIT_TUNER) | (1 << BIT_RESET) ; break ;
+		case TUNER_POWER_ON_RESET_DISABLE: val |= (1 << BIT_TUNER) | (1 << BIT_RESET) ; break ;
 	}
 
 	writel(val, (regs + 4));
@@ -307,16 +297,8 @@
 		tsid += 1;
 	}
 
-	memcpy(&wk, &bs_get_cn, sizeof(WBLOCK));
-	wk.addr = addr;
-	tmcc->cn[0] = i2c_read(regs, lock, &wk, 1);
-
 	memcpy(&wk, &bs_get_agc, sizeof(WBLOCK));
 	wk.addr = addr;
-	tmcc->cn[1] = i2c_read(regs, lock, &wk, 1);
-
-	memcpy(&wk, &bs_get_maxagc, sizeof(WBLOCK));
-	wk.addr = addr;
 	tmcc->agc = i2c_read(regs, lock, &wk, 1);
 
 	// TS-ID別の情報を取得
@@ -347,6 +329,25 @@
 	tmcc->carriermargin = i2c_read(regs, lock, &wk, 1);
 	return 0 ;
 }
+int		isdb_s_read_signal_strength(void __iomem *regs, struct mutex *lock, int addr)
+{
+	WBLOCK	wk;
+	__u32	val ;
+	__u32	val2;
+	int		val3 ;
+
+	memcpy(&wk, &bs_get_signal1, sizeof(WBLOCK));
+	wk.addr = addr;
+	val = i2c_read(regs, lock, &wk, 1);
+
+	memcpy(&wk, &bs_get_signal2, sizeof(WBLOCK));
+	wk.addr = addr;
+	val2 = i2c_read(regs, lock, &wk, 1);
+	val3 = (((val << 8) & 0XFF00) | (val2 & 0XFF));
+
+	return val3 ;
+}
+
 __u32	getfrequency_add(__u32 channel)
 {
 	int		lp ;
@@ -446,6 +447,24 @@
 	}
 	return 0 ;
 }
+int		isdb_t_read_signal_strength(void __iomem *regs, struct mutex *lock, int addr)
+{
+	__u32	val ;
+	__u32	val2;
+	__u32	val3;
+	WBLOCK	wk;
+
+	memcpy(&wk, &isdb_t_signal1, sizeof(WBLOCK));
+	wk.addr = addr;
+	val = i2c_read(regs, lock, &wk, 1);
+	printk(KERN_INFO "CN(1)Val(%x)\n", val);
+
+	memcpy(&wk, &isdb_t_signal2, sizeof(WBLOCK));
+	wk.addr = addr;
+	val2 = i2c_read(regs, lock, &wk, 1);
+	val3 = (((val << 8) & 0XFF00) | (val2 & 0XFF));
+	return val3 ;
+}
 #if 0
 int		isdb_t_tune(void __iomem *regs, struct mutex *lock, int addr, int channel, ISDB_T_TMCC *tmcc)
 {