diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/tda9887.c | 19 | ||||
-rw-r--r-- | drivers/media/video/tuner-simple.c | 55 | ||||
-rw-r--r-- | drivers/media/video/tuner-types.c | 5 |
3 files changed, 57 insertions, 22 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index a8f773274fe3..aa311e4f1f61 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -97,6 +97,8 @@ struct tvnorm { | |||
97 | #define cAudioIF_6_5 0x03 // bit e0:1 | 97 | #define cAudioIF_6_5 0x03 // bit e0:1 |
98 | 98 | ||
99 | 99 | ||
100 | #define cVideoIFMask 0x1c // bit e2:4 | ||
101 | /* Video IF selection in TV Mode (bit B3=0) */ | ||
100 | #define cVideoIF_58_75 0x00 // bit e2:4 | 102 | #define cVideoIF_58_75 0x00 // bit e2:4 |
101 | #define cVideoIF_45_75 0x04 // bit e2:4 | 103 | #define cVideoIF_45_75 0x04 // bit e2:4 |
102 | #define cVideoIF_38_90 0x08 // bit e2:4 | 104 | #define cVideoIF_38_90 0x08 // bit e2:4 |
@@ -106,6 +108,13 @@ struct tvnorm { | |||
106 | #define cRadioIF_45_75 0x18 // bit e2:4 | 108 | #define cRadioIF_45_75 0x18 // bit e2:4 |
107 | #define cRadioIF_38_90 0x1C // bit e2:4 | 109 | #define cRadioIF_38_90 0x1C // bit e2:4 |
108 | 110 | ||
111 | /* IF1 selection in Radio Mode (bit B3=1) */ | ||
112 | #define cRadioIF_33_30 0x00 // bit e2,4 (also 0x10,0x14) | ||
113 | #define cRadioIF_41_30 0x04 // bit e2,4 | ||
114 | |||
115 | /* Output of AFC pin in radio mode when bit E7=1 */ | ||
116 | #define cRadioAGC_SIF 0x00 // bit e3 | ||
117 | #define cRadioAGC_FM 0x08 // bit e3 | ||
109 | 118 | ||
110 | #define cTunerGainNormal 0x00 // bit e5 | 119 | #define cTunerGainNormal 0x00 // bit e5 |
111 | #define cTunerGainLow 0x20 // bit e5 | 120 | #define cTunerGainLow 0x20 // bit e5 |
@@ -487,9 +496,13 @@ static int tda9887_set_config(struct tuner *t, char *buf) | |||
487 | if (t->tda9887_config & TDA9887_GATING_18) | 496 | if (t->tda9887_config & TDA9887_GATING_18) |
488 | buf[3] &= ~cGating_36; | 497 | buf[3] &= ~cGating_36; |
489 | 498 | ||
490 | if (t->tda9887_config & TDA9887_GAIN_NORMAL) { | 499 | if (t->mode == V4L2_TUNER_RADIO) { |
491 | radio_stereo.e &= ~cTunerGainLow; | 500 | if (t->tda9887_config & TDA9887_RIF_41_3) { |
492 | radio_mono.e &= ~cTunerGainLow; | 501 | buf[3] &= ~cVideoIFMask; |
502 | buf[3] |= cRadioIF_41_30; | ||
503 | } | ||
504 | if (t->tda9887_config & TDA9887_GAIN_NORMAL) | ||
505 | buf[3] &= ~cTunerGainLow; | ||
493 | } | 506 | } |
494 | 507 | ||
495 | return 0; | 508 | return 0; |
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 2d57e8bc0db3..10a7d36a2646 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -402,53 +402,68 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
402 | u8 buffer[4]; | 402 | u8 buffer[4]; |
403 | u16 div; | 403 | u16 div; |
404 | int rc, j; | 404 | int rc, j; |
405 | enum param_type desired_type = TUNER_PARAM_TYPE_RADIO; | ||
406 | struct tuner_params *params; | 405 | struct tuner_params *params; |
407 | 406 | ||
408 | tun = &tuners[t->type]; | 407 | tun = &tuners[t->type]; |
409 | 408 | ||
410 | for (j = 0; j < tun->count-1; j++) { | 409 | for (j = tun->count-1; j > 0; j--) |
411 | if (desired_type != tun->params[j].type) | 410 | if (tun->params[j].type == TUNER_PARAM_TYPE_RADIO) |
412 | continue; | 411 | break; |
412 | /* default params (j=0) will be used if desired type wasn't found */ | ||
413 | params = &tun->params[j]; | ||
414 | |||
415 | /* Select Radio 1st IF used */ | ||
416 | switch (params->radio_if) { | ||
417 | case 0: /* 10.7 MHz */ | ||
418 | freq += (unsigned int)(10.7*16000); | ||
413 | break; | 419 | break; |
420 | case 1: /* 33.3 MHz */ | ||
421 | freq += (unsigned int)(33.3*16000); | ||
422 | break; | ||
423 | case 2: /* 41.3 MHz */ | ||
424 | freq += (unsigned int)(41.3*16000); | ||
425 | break; | ||
426 | default: | ||
427 | tuner_warn("Unsupported radio_if value %d\n", params->radio_if); | ||
428 | return; | ||
414 | } | 429 | } |
415 | /* use default tuner_params if desired_type not available */ | ||
416 | if (desired_type != tun->params[j].type) | ||
417 | j = 0; | ||
418 | |||
419 | div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ | ||
420 | params = &tun->params[j]; | ||
421 | buffer[2] = (params->ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ | ||
422 | 430 | ||
431 | /* Bandswitch byte */ | ||
423 | switch (t->type) { | 432 | switch (t->type) { |
424 | case TUNER_TENA_9533_DI: | 433 | case TUNER_TENA_9533_DI: |
425 | case TUNER_YMEC_TVF_5533MF: | 434 | case TUNER_YMEC_TVF_5533MF: |
426 | tuner_dbg ("This tuner doesn't have FM. Most cards has a TEA5767 for FM\n"); | 435 | tuner_dbg ("This tuner doesn't have FM. Most cards have a TEA5767 for FM\n"); |
427 | return; | 436 | return; |
428 | case TUNER_PHILIPS_FM1216ME_MK3: | 437 | case TUNER_PHILIPS_FM1216ME_MK3: |
429 | case TUNER_PHILIPS_FM1236_MK3: | 438 | case TUNER_PHILIPS_FM1236_MK3: |
430 | case TUNER_PHILIPS_FMD1216ME_MK3: | 439 | case TUNER_PHILIPS_FMD1216ME_MK3: |
431 | case TUNER_LG_NTSC_TAPE: | 440 | case TUNER_LG_NTSC_TAPE: |
441 | case TUNER_PHILIPS_FM1256_IH3: | ||
432 | buffer[3] = 0x19; | 442 | buffer[3] = 0x19; |
433 | break; | 443 | break; |
434 | case TUNER_TNF_5335MF: | 444 | case TUNER_TNF_5335MF: |
435 | buffer[3] = 0x11; | 445 | buffer[3] = 0x11; |
436 | break; | 446 | break; |
437 | case TUNER_PHILIPS_FM1256_IH3: | ||
438 | div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */ | ||
439 | buffer[3] = 0x19; | ||
440 | break; | ||
441 | case TUNER_LG_PAL_FM: | 447 | case TUNER_LG_PAL_FM: |
442 | buffer[3] = 0xa5; | 448 | buffer[3] = 0xa5; |
443 | break; | 449 | break; |
444 | case TUNER_MICROTUNE_4049FM5: | 450 | case TUNER_THOMSON_DTT761X: |
445 | div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */ | 451 | buffer[3] = 0x39; |
446 | buffer[3] = 0xa4; | ||
447 | break; | 452 | break; |
453 | case TUNER_MICROTUNE_4049FM5: | ||
448 | default: | 454 | default: |
449 | buffer[3] = 0xa4; | 455 | buffer[3] = 0xa4; |
450 | break; | 456 | break; |
451 | } | 457 | } |
458 | |||
459 | buffer[2] = (params->ranges[0].config & ~TUNER_RATIO_MASK) | | ||
460 | TUNER_RATIO_SELECT_50; /* 50 kHz step */ | ||
461 | |||
462 | /* Convert from 1/16 kHz V4L steps to 1/20 MHz (=50 kHz) PLL steps | ||
463 | freq * (1 Mhz / 16000 V4L steps) * (20 PLL steps / 1 MHz) = | ||
464 | freq * (1/800) */ | ||
465 | div = (freq + 400) / 800; | ||
466 | |||
452 | if (params->cb_first_if_lower_freq && div < t->last_div) { | 467 | if (params->cb_first_if_lower_freq && div < t->last_div) { |
453 | buffer[0] = buffer[2]; | 468 | buffer[0] = buffer[2]; |
454 | buffer[1] = buffer[3]; | 469 | buffer[1] = buffer[3]; |
@@ -475,6 +490,8 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
475 | config &= ~TDA9887_PORT1_ACTIVE;*/ | 490 | config &= ~TDA9887_PORT1_ACTIVE;*/ |
476 | if (params->fm_gain_normal) | 491 | if (params->fm_gain_normal) |
477 | config |= TDA9887_GAIN_NORMAL; | 492 | config |= TDA9887_GAIN_NORMAL; |
493 | if (params->radio_if == 2) | ||
494 | config |= TDA9887_RIF_41_3; | ||
478 | i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config); | 495 | i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config); |
479 | } | 496 | } |
480 | if (4 != (rc = i2c_master_send(c,buffer,4))) | 497 | if (4 != (rc = i2c_master_send(c,buffer,4))) |
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c index 53a99b39387f..c6a7934bd5a6 100644 --- a/drivers/media/video/tuner-types.c +++ b/drivers/media/video/tuner-types.c | |||
@@ -652,6 +652,7 @@ static struct tuner_params tuner_microtune_4049_fm5_params[] = { | |||
652 | .port1_invert_for_secam_lc = 1, | 652 | .port1_invert_for_secam_lc = 1, |
653 | .default_pll_gating_18 = 1, | 653 | .default_pll_gating_18 = 1, |
654 | .fm_gain_normal=1, | 654 | .fm_gain_normal=1, |
655 | .radio_if = 1, /* 33.3 MHz */ | ||
655 | }, | 656 | }, |
656 | }; | 657 | }; |
657 | 658 | ||
@@ -733,6 +734,7 @@ static struct tuner_params tuner_philips_fm1256_ih3_params[] = { | |||
733 | .type = TUNER_PARAM_TYPE_PAL, | 734 | .type = TUNER_PARAM_TYPE_PAL, |
734 | .ranges = tuner_fm1236_mk3_ntsc_ranges, | 735 | .ranges = tuner_fm1236_mk3_ntsc_ranges, |
735 | .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges), | 736 | .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges), |
737 | .radio_if = 1, /* 33.3 MHz */ | ||
736 | }, | 738 | }, |
737 | }; | 739 | }; |
738 | 740 | ||
@@ -859,6 +861,9 @@ static struct tuner_params tuner_thomson_dtt761x_params[] = { | |||
859 | .type = TUNER_PARAM_TYPE_NTSC, | 861 | .type = TUNER_PARAM_TYPE_NTSC, |
860 | .ranges = tuner_thomson_dtt761x_ntsc_ranges, | 862 | .ranges = tuner_thomson_dtt761x_ntsc_ranges, |
861 | .count = ARRAY_SIZE(tuner_thomson_dtt761x_ntsc_ranges), | 863 | .count = ARRAY_SIZE(tuner_thomson_dtt761x_ntsc_ranges), |
864 | .has_tda9887 = 1, | ||
865 | .fm_gain_normal = 1, | ||
866 | .radio_if = 2, /* 41.3 MHz */ | ||
862 | }, | 867 | }, |
863 | }; | 868 | }; |
864 | 869 | ||