comparison driver/pt1_tuner.c @ 69:272a8fba970b

added very rough support for PT2.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 26 Oct 2009 19:46:49 +0900
parents c701bbc532b4
children 28f25ec7f962
comparison
equal deleted inserted replaced
68:440c13a0030b 69:272a8fba970b
70 } 70 }
71 } 71 }
72 else if(cardtype == PT2) { 72 else if(cardtype == PT2) {
73 switch(tuner){ 73 switch(tuner){
74 case TUNER_POWER_ON_RESET_ENABLE: 74 case TUNER_POWER_ON_RESET_ENABLE:
75 val |= (1 << BIT_TUNER) | (1 << BIT_FRONTEND); 75 val |= (1 << BIT_TUNER)
76 | (1 << BIT_33A1)
77 | (1 << BIT_33A2)
78 | (1 << BIT_5A_)
79 | (1 << BIT_5A1)
80 | (1 << BIT_5A2);
76 break; 81 break;
77 case TUNER_POWER_ON_RESET_DISABLE: 82 case TUNER_POWER_ON_RESET_DISABLE:
78 val |= (1 << BIT_TUNER) | (1 << BIT_FRONTEND) | (1 << BIT_RESET); 83 val |= (1 << BIT_TUNER)
84 | (1 << BIT_RESET)
85 | (1 << BIT_33A1)
86 | (1 << BIT_33A2)
87 | (1 << BIT_5A_)
88 | (1 << BIT_5A1)
89 | (1 << BIT_5A2);
79 break ; 90 break ;
80 } 91 }
81 } 92 }
82 writel(val, (regs + CFG_REGS_ADDR)); 93 writel(val, (regs + CFG_REGS_ADDR));
83 } 94 }
84 static int init_isdb_s(void __iomem *regs, struct mutex *lock, __u32 addr) 95 static int init_isdb_s(void __iomem *regs, int cardtype, struct mutex *lock, __u32 addr)
85 { 96 {
86 97
87 WBLOCK wk; 98 WBLOCK wk;
88 int lp ; 99 int lp ;
89 __u32 val ; 100 __u32 val ;
98 if((val & 0xff) != 0x41){ 109 if((val & 0xff) != 0x41){
99 printk(KERN_INFO "PT1:ISDB-S Read(%x)\n", val); 110 printk(KERN_INFO "PT1:ISDB-S Read(%x)\n", val);
100 return -EIO ; 111 return -EIO ;
101 } 112 }
102 for(lp = 0 ; lp < MAX_ISDB_S_INIT ; lp++){ 113 for(lp = 0 ; lp < MAX_ISDB_S_INIT ; lp++){
103 memcpy(&wk, isdb_s_initial[lp], sizeof(WBLOCK)); 114 if(cardtype == PT1)
115 memcpy(&wk, isdb_s_initial_pt1[lp], sizeof(WBLOCK));
116 if(cardtype == PT2)
117 memcpy(&wk, isdb_s_initial_pt2[lp], sizeof(WBLOCK));
104 wk.addr = addr; 118 wk.addr = addr;
105 i2c_write(regs, lock, &wk); 119 i2c_write(regs, lock, &wk);
106 } 120 }
107 121
108 return 0 ; 122 return 0 ;
109 } 123 }
110 static void init_isdb_t(void __iomem *regs, struct mutex *lock, __u32 addr) 124 static void init_isdb_t(void __iomem *regs, int cardtype, struct mutex *lock, __u32 addr)
111 { 125 {
112 int lp ; 126 int lp ;
113 WBLOCK wk; 127 WBLOCK wk;
114 128
115 // ISDB-S/T初期化 129 // ISDB-S/T初期化
116 for(lp = 0 ; lp < MAX_ISDB_T_INIT ; lp++){ 130 for(lp = 0 ; lp < MAX_ISDB_T_INIT ; lp++){
117 memcpy(&wk, isdb_t_initial[lp], sizeof(WBLOCK)); 131 if(cardtype == PT1)
132 memcpy(&wk, isdb_t_initial_pt1[lp], sizeof(WBLOCK));
133 if(cardtype == PT2)
134 memcpy(&wk, isdb_t_initial_pt2[lp], sizeof(WBLOCK));
118 wk.addr = addr; 135 wk.addr = addr;
119 i2c_write(regs, lock, &wk); 136 i2c_write(regs, lock, &wk);
120 } 137 }
121 138
122 139
123 } 140 }
124 int tuner_init(void __iomem *regs, struct mutex *lock, int tuner_no) 141 int tuner_init(void __iomem *regs, int cardtype, struct mutex *lock, int tuner_no)
125 { 142 {
126 143
127 int rc ; 144 int rc ;
128 WBLOCK wk; 145 WBLOCK wk;
129 146
134 wk.addr = tuner_info[tuner_no].isdb_t ; 151 wk.addr = tuner_info[tuner_no].isdb_t ;
135 i2c_write(regs, lock, &wk); 152 i2c_write(regs, lock, &wk);
136 wk.addr = tuner_info[tuner_no].isdb_s ; 153 wk.addr = tuner_info[tuner_no].isdb_s ;
137 i2c_write(regs, lock, &wk); 154 i2c_write(regs, lock, &wk);
138 155
139 rc = init_isdb_s(regs, lock, tuner_info[tuner_no].isdb_s); 156 rc = init_isdb_s(regs, cardtype, lock, tuner_info[tuner_no].isdb_s);
140 if(rc < 0){ 157 if(rc < 0){
141 return rc ; 158 return rc ;
142 } 159 }
143 init_isdb_t(regs, lock, tuner_info[tuner_no].isdb_t); 160 init_isdb_t(regs, cardtype, lock, tuner_info[tuner_no].isdb_t);
144 161
145 memcpy(&wk, &isdb_s_init21, sizeof(WBLOCK)); 162 memcpy(&wk, &isdb_s_init21, sizeof(WBLOCK));
146 wk.addr = tuner_info[tuner_no].isdb_s ; 163 wk.addr = tuner_info[tuner_no].isdb_s ;
147 i2c_write(regs, lock, &wk); 164 i2c_write(regs, lock, &wk);
148 165