Mercurial > pt1
comparison 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 |
comparison
equal
deleted
inserted
replaced
8:6da603afd363 | 9:07b2fc07ff48 |
---|---|
16 #include "pt1_com.h" | 16 #include "pt1_com.h" |
17 #include "pt1_pci.h" | 17 #include "pt1_pci.h" |
18 #include "pt1_i2c.h" | 18 #include "pt1_i2c.h" |
19 #include "pt1_tuner.h" | 19 #include "pt1_tuner.h" |
20 #include "pt1_tuner_data.h" | 20 #include "pt1_tuner_data.h" |
21 /* | 21 |
22 LNB : BIT 2 1 | |
23 OFF : 0 0 | |
24 +15V: 1 1 | |
25 +11V: 1 0 | |
26 | |
27 TUNER: BIT 3 0 | |
28 POWER-OFF : 0 0 | |
29 POWER-ON RESET : 0 1 | |
30 POWER-ON ONLY : 1 1 | |
31 */ | |
32 typedef struct _TUNER_INFO{ | 22 typedef struct _TUNER_INFO{ |
33 int isdb_s ; | 23 int isdb_s ; |
34 int isdb_t ; | 24 int isdb_t ; |
35 }TUNER_INFO; | 25 }TUNER_INFO; |
36 | 26 |
65 case LNB_15V: val = (1 << BIT_LNB_UP) | (1 << BIT_LNB_DOWN) ; break ; | 55 case LNB_15V: val = (1 << BIT_LNB_UP) | (1 << BIT_LNB_DOWN) ; break ; |
66 } | 56 } |
67 | 57 |
68 switch(tuner){ | 58 switch(tuner){ |
69 case TUNER_POWER_ON_RESET_ENABLE: val |= (1 << BIT_TUNER) ; break ; | 59 case TUNER_POWER_ON_RESET_ENABLE: val |= (1 << BIT_TUNER) ; break ; |
70 case TUNER_POWER_ON_RESET_DISABLE: val = (1 << BIT_TUNER) | (1 << BIT_RESET) ; break ; | 60 case TUNER_POWER_ON_RESET_DISABLE: val |= (1 << BIT_TUNER) | (1 << BIT_RESET) ; break ; |
71 } | 61 } |
72 | 62 |
73 writel(val, (regs + 4)); | 63 writel(val, (regs + 4)); |
74 } | 64 } |
75 static int init_isdb_s(void __iomem *regs, struct mutex *lock, __u32 addr) | 65 static int init_isdb_s(void __iomem *regs, struct mutex *lock, __u32 addr) |
305 tsid += 1; | 295 tsid += 1; |
306 tsid->ts_id = ts_id.ts[0] ; | 296 tsid->ts_id = ts_id.ts[0] ; |
307 tsid += 1; | 297 tsid += 1; |
308 } | 298 } |
309 | 299 |
310 memcpy(&wk, &bs_get_cn, sizeof(WBLOCK)); | |
311 wk.addr = addr; | |
312 tmcc->cn[0] = i2c_read(regs, lock, &wk, 1); | |
313 | |
314 memcpy(&wk, &bs_get_agc, sizeof(WBLOCK)); | 300 memcpy(&wk, &bs_get_agc, sizeof(WBLOCK)); |
315 wk.addr = addr; | |
316 tmcc->cn[1] = i2c_read(regs, lock, &wk, 1); | |
317 | |
318 memcpy(&wk, &bs_get_maxagc, sizeof(WBLOCK)); | |
319 wk.addr = addr; | 301 wk.addr = addr; |
320 tmcc->agc = i2c_read(regs, lock, &wk, 1); | 302 tmcc->agc = i2c_read(regs, lock, &wk, 1); |
321 | 303 |
322 // TS-ID別の情報を取得 | 304 // TS-ID別の情報を取得 |
323 tsid = &tmcc->ts_id[0] ; | 305 tsid = &tmcc->ts_id[0] ; |
345 memcpy(&wk, &bs_get_carrir, sizeof(WBLOCK)); | 327 memcpy(&wk, &bs_get_carrir, sizeof(WBLOCK)); |
346 wk.addr = addr; | 328 wk.addr = addr; |
347 tmcc->carriermargin = i2c_read(regs, lock, &wk, 1); | 329 tmcc->carriermargin = i2c_read(regs, lock, &wk, 1); |
348 return 0 ; | 330 return 0 ; |
349 } | 331 } |
332 int isdb_s_read_signal_strength(void __iomem *regs, struct mutex *lock, int addr) | |
333 { | |
334 WBLOCK wk; | |
335 __u32 val ; | |
336 __u32 val2; | |
337 int val3 ; | |
338 | |
339 memcpy(&wk, &bs_get_signal1, sizeof(WBLOCK)); | |
340 wk.addr = addr; | |
341 val = i2c_read(regs, lock, &wk, 1); | |
342 | |
343 memcpy(&wk, &bs_get_signal2, sizeof(WBLOCK)); | |
344 wk.addr = addr; | |
345 val2 = i2c_read(regs, lock, &wk, 1); | |
346 val3 = (((val << 8) & 0XFF00) | (val2 & 0XFF)); | |
347 | |
348 return val3 ; | |
349 } | |
350 | |
350 __u32 getfrequency_add(__u32 channel) | 351 __u32 getfrequency_add(__u32 channel) |
351 { | 352 { |
352 int lp ; | 353 int lp ; |
353 | 354 |
354 for(lp = 0 ; lp < 10 ; lp++){ | 355 for(lp = 0 ; lp < 10 ; lp++){ |
444 if(tmcclock != TRUE){ | 445 if(tmcclock != TRUE){ |
445 return -EIO ; | 446 return -EIO ; |
446 } | 447 } |
447 return 0 ; | 448 return 0 ; |
448 } | 449 } |
450 int isdb_t_read_signal_strength(void __iomem *regs, struct mutex *lock, int addr) | |
451 { | |
452 __u32 val ; | |
453 __u32 val2; | |
454 __u32 val3; | |
455 WBLOCK wk; | |
456 | |
457 memcpy(&wk, &isdb_t_signal1, sizeof(WBLOCK)); | |
458 wk.addr = addr; | |
459 val = i2c_read(regs, lock, &wk, 1); | |
460 printk(KERN_INFO "CN(1)Val(%x)\n", val); | |
461 | |
462 memcpy(&wk, &isdb_t_signal2, sizeof(WBLOCK)); | |
463 wk.addr = addr; | |
464 val2 = i2c_read(regs, lock, &wk, 1); | |
465 val3 = (((val << 8) & 0XFF00) | (val2 & 0XFF)); | |
466 return val3 ; | |
467 } | |
449 #if 0 | 468 #if 0 |
450 int isdb_t_tune(void __iomem *regs, struct mutex *lock, int addr, int channel, ISDB_T_TMCC *tmcc) | 469 int isdb_t_tune(void __iomem *regs, struct mutex *lock, int addr, int channel, ISDB_T_TMCC *tmcc) |
451 { | 470 { |
452 | 471 |
453 int lp ; | 472 int lp ; |