diff options
-rw-r--r-- | drivers/media/common/tuners/xc5000.c | 137 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 25 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/drxk_hard.c | 15 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda18271c2dd.c | 44 | ||||
-rw-r--r-- | include/linux/dvb/frontend.h | 2 |
5 files changed, 106 insertions, 117 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 97ad3389634..5c56d3cc030 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
@@ -629,11 +629,13 @@ static void xc_debug_dump(struct xc5000_priv *priv) | |||
629 | } | 629 | } |
630 | 630 | ||
631 | static int xc5000_set_params(struct dvb_frontend *fe, | 631 | static int xc5000_set_params(struct dvb_frontend *fe, |
632 | struct dvb_frontend_parameters *params) | 632 | struct dvb_frontend_parameters *params) |
633 | { | 633 | { |
634 | int ret, b; | ||
634 | struct xc5000_priv *priv = fe->tuner_priv; | 635 | struct xc5000_priv *priv = fe->tuner_priv; |
635 | int ret; | 636 | u32 bw = fe->dtv_property_cache.bandwidth_hz; |
636 | u32 bw; | 637 | u32 freq = fe->dtv_property_cache.frequency; |
638 | u32 delsys = fe->dtv_property_cache.delivery_system; | ||
637 | 639 | ||
638 | if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { | 640 | if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { |
639 | if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { | 641 | if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { |
@@ -642,104 +644,77 @@ static int xc5000_set_params(struct dvb_frontend *fe, | |||
642 | } | 644 | } |
643 | } | 645 | } |
644 | 646 | ||
645 | dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); | 647 | dprintk(1, "%s() frequency=%d (Hz)\n", __func__, freq); |
646 | 648 | ||
647 | if (fe->ops.info.type == FE_ATSC) { | 649 | switch (delsys) { |
648 | dprintk(1, "%s() ATSC\n", __func__); | 650 | case SYS_ATSC: |
649 | switch (params->u.vsb.modulation) { | 651 | dprintk(1, "%s() VSB modulation\n", __func__); |
650 | case VSB_8: | 652 | priv->rf_mode = XC_RF_MODE_AIR; |
651 | case VSB_16: | 653 | priv->freq_hz = freq - 1750000; |
652 | dprintk(1, "%s() VSB modulation\n", __func__); | 654 | priv->bandwidth = BANDWIDTH_6_MHZ; |
653 | priv->rf_mode = XC_RF_MODE_AIR; | 655 | priv->video_standard = DTV6; |
654 | priv->freq_hz = params->frequency - 1750000; | 656 | break; |
655 | priv->bandwidth = BANDWIDTH_6_MHZ; | 657 | case SYS_DVBC_ANNEX_B: |
656 | priv->video_standard = DTV6; | 658 | dprintk(1, "%s() QAM modulation\n", __func__); |
657 | break; | 659 | priv->rf_mode = XC_RF_MODE_CABLE; |
658 | case QAM_64: | 660 | priv->freq_hz = freq - 1750000; |
659 | case QAM_256: | 661 | priv->bandwidth = BANDWIDTH_6_MHZ; |
660 | case QAM_AUTO: | 662 | priv->video_standard = DTV6; |
661 | dprintk(1, "%s() QAM modulation\n", __func__); | 663 | break; |
662 | priv->rf_mode = XC_RF_MODE_CABLE; | 664 | case SYS_DVBT: |
663 | priv->freq_hz = params->frequency - 1750000; | 665 | case SYS_DVBT2: |
664 | priv->bandwidth = BANDWIDTH_6_MHZ; | ||
665 | priv->video_standard = DTV6; | ||
666 | break; | ||
667 | default: | ||
668 | return -EINVAL; | ||
669 | } | ||
670 | } else if (fe->ops.info.type == FE_OFDM) { | ||
671 | dprintk(1, "%s() OFDM\n", __func__); | 666 | dprintk(1, "%s() OFDM\n", __func__); |
672 | switch (params->u.ofdm.bandwidth) { | 667 | switch (bw) { |
673 | case BANDWIDTH_6_MHZ: | 668 | case 6000000: |
674 | priv->bandwidth = BANDWIDTH_6_MHZ; | 669 | priv->bandwidth = BANDWIDTH_6_MHZ; |
675 | priv->video_standard = DTV6; | 670 | priv->video_standard = DTV6; |
676 | priv->freq_hz = params->frequency - 1750000; | 671 | priv->freq_hz = freq - 1750000; |
677 | break; | 672 | break; |
678 | case BANDWIDTH_7_MHZ: | 673 | case 7000000: |
679 | priv->bandwidth = BANDWIDTH_7_MHZ; | 674 | priv->bandwidth = BANDWIDTH_7_MHZ; |
680 | priv->video_standard = DTV7; | 675 | priv->video_standard = DTV7; |
681 | priv->freq_hz = params->frequency - 2250000; | 676 | priv->freq_hz = freq - 2250000; |
682 | break; | 677 | break; |
683 | case BANDWIDTH_8_MHZ: | 678 | case 8000000: |
684 | priv->bandwidth = BANDWIDTH_8_MHZ; | 679 | priv->bandwidth = BANDWIDTH_8_MHZ; |
685 | priv->video_standard = DTV8; | 680 | priv->video_standard = DTV8; |
686 | priv->freq_hz = params->frequency - 2750000; | 681 | priv->freq_hz = freq - 2750000; |
687 | break; | 682 | break; |
688 | default: | 683 | default: |
689 | printk(KERN_ERR "xc5000 bandwidth not set!\n"); | 684 | printk(KERN_ERR "xc5000 bandwidth not set!\n"); |
690 | return -EINVAL; | 685 | return -EINVAL; |
691 | } | 686 | } |
692 | priv->rf_mode = XC_RF_MODE_AIR; | 687 | priv->rf_mode = XC_RF_MODE_AIR; |
693 | } else if (fe->ops.info.type == FE_QAM) { | 688 | case SYS_DVBC_ANNEX_A: |
694 | switch (params->u.qam.modulation) { | 689 | case SYS_DVBC_ANNEX_C: |
695 | case QAM_256: | 690 | dprintk(1, "%s() QAM modulation\n", __func__); |
696 | case QAM_AUTO: | 691 | priv->rf_mode = XC_RF_MODE_CABLE; |
697 | case QAM_16: | 692 | if (bw <= 6000000) { |
698 | case QAM_32: | 693 | priv->bandwidth = BANDWIDTH_6_MHZ; |
699 | case QAM_64: | 694 | priv->video_standard = DTV6; |
700 | case QAM_128: | 695 | priv->freq_hz = freq - 1750000; |
701 | dprintk(1, "%s() QAM modulation\n", __func__); | 696 | b = 6; |
702 | priv->rf_mode = XC_RF_MODE_CABLE; | 697 | } else if (bw <= 7000000) { |
703 | /* | 698 | priv->bandwidth = BANDWIDTH_7_MHZ; |
704 | * Using a higher bandwidth at the tuner filter may | 699 | priv->video_standard = DTV7; |
705 | * allow inter-carrier interference. | 700 | priv->freq_hz = freq - 2250000; |
706 | * So, determine the minimal channel spacing, in order | 701 | b = 7; |
707 | * to better adjust the tuner filter. | 702 | } else { |
708 | * According with ITU-T J.83, the bandwidth is given by: | 703 | priv->bandwidth = BANDWIDTH_8_MHZ; |
709 | * bw = Simbol Rate * (1 + roll_off), where the roll_off | 704 | priv->video_standard = DTV7_8; |
710 | * is equal to 0.15 for Annex A, and 0.13 for annex C | 705 | priv->freq_hz = freq - 2750000; |
711 | */ | 706 | b = 8; |
712 | if (fe->dtv_property_cache.rolloff == ROLLOFF_13) | ||
713 | bw = (params->u.qam.symbol_rate * 113) / 100; | ||
714 | else | ||
715 | bw = (params->u.qam.symbol_rate * 115) / 100; | ||
716 | if (bw <= 6000000) { | ||
717 | priv->bandwidth = BANDWIDTH_6_MHZ; | ||
718 | priv->video_standard = DTV6; | ||
719 | priv->freq_hz = params->frequency - 1750000; | ||
720 | } else if (bw <= 7000000) { | ||
721 | priv->bandwidth = BANDWIDTH_7_MHZ; | ||
722 | priv->video_standard = DTV7; | ||
723 | priv->freq_hz = params->frequency - 2250000; | ||
724 | } else { | ||
725 | priv->bandwidth = BANDWIDTH_8_MHZ; | ||
726 | priv->video_standard = DTV7_8; | ||
727 | priv->freq_hz = params->frequency - 2750000; | ||
728 | } | ||
729 | dprintk(1, "%s() Bandwidth %dMHz (%d)\n", __func__, | ||
730 | BANDWIDTH_6_MHZ ? 6: 8, bw); | ||
731 | break; | ||
732 | default: | ||
733 | dprintk(1, "%s() Unsupported QAM type\n", __func__); | ||
734 | return -EINVAL; | ||
735 | } | 707 | } |
736 | } else { | 708 | dprintk(1, "%s() Bandwidth %dMHz (%d)\n", __func__, |
737 | printk(KERN_ERR "xc5000 modulation type not supported!\n"); | 709 | b, bw); |
710 | break; | ||
711 | default: | ||
712 | printk(KERN_ERR "xc5000: delivery system is not supported!\n"); | ||
738 | return -EINVAL; | 713 | return -EINVAL; |
739 | } | 714 | } |
740 | 715 | ||
741 | dprintk(1, "%s() frequency=%d (compensated)\n", | 716 | dprintk(1, "%s() frequency=%d (compensated to %d)\n", |
742 | __func__, priv->freq_hz); | 717 | __func__, freq, priv->freq_hz); |
743 | 718 | ||
744 | ret = xc_SetSignalSource(priv, priv->rf_mode); | 719 | ret = xc_SetSignalSource(priv, priv->rf_mode); |
745 | if (ret != XC_RESULT_SUCCESS) { | 720 | if (ret != XC_RESULT_SUCCESS) { |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 821b2250ec7..66537b10132 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -1011,7 +1011,7 @@ static void dtv_property_dump(struct dtv_property *tvp) | |||
1011 | 1011 | ||
1012 | static int is_legacy_delivery_system(fe_delivery_system_t s) | 1012 | static int is_legacy_delivery_system(fe_delivery_system_t s) |
1013 | { | 1013 | { |
1014 | if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_AC) || | 1014 | if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_A) || |
1015 | (s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS) || | 1015 | (s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS) || |
1016 | (s == SYS_ATSC)) | 1016 | (s == SYS_ATSC)) |
1017 | return 1; | 1017 | return 1; |
@@ -1032,8 +1032,7 @@ static void dtv_property_cache_init(struct dvb_frontend *fe, | |||
1032 | c->delivery_system = SYS_DVBS; | 1032 | c->delivery_system = SYS_DVBS; |
1033 | break; | 1033 | break; |
1034 | case FE_QAM: | 1034 | case FE_QAM: |
1035 | c->delivery_system = SYS_DVBC_ANNEX_AC; | 1035 | c->delivery_system = SYS_DVBC_ANNEX_A; |
1036 | c->rolloff = ROLLOFF_15; /* implied for Annex A */ | ||
1037 | break; | 1036 | break; |
1038 | case FE_OFDM: | 1037 | case FE_OFDM: |
1039 | c->delivery_system = SYS_DVBT; | 1038 | c->delivery_system = SYS_DVBT; |
@@ -1144,9 +1143,10 @@ static void dtv_property_legacy_params_sync(struct dvb_frontend *fe) | |||
1144 | */ | 1143 | */ |
1145 | static void dtv_property_adv_params_sync(struct dvb_frontend *fe) | 1144 | static void dtv_property_adv_params_sync(struct dvb_frontend *fe) |
1146 | { | 1145 | { |
1147 | const struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 1146 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
1148 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 1147 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
1149 | struct dvb_frontend_parameters *p = &fepriv->parameters_in; | 1148 | struct dvb_frontend_parameters *p = &fepriv->parameters_in; |
1149 | u32 rolloff = 0; | ||
1150 | 1150 | ||
1151 | p->frequency = c->frequency; | 1151 | p->frequency = c->frequency; |
1152 | p->inversion = c->inversion; | 1152 | p->inversion = c->inversion; |
@@ -1178,6 +1178,23 @@ static void dtv_property_adv_params_sync(struct dvb_frontend *fe) | |||
1178 | else | 1178 | else |
1179 | p->u.ofdm.bandwidth = BANDWIDTH_AUTO; | 1179 | p->u.ofdm.bandwidth = BANDWIDTH_AUTO; |
1180 | } | 1180 | } |
1181 | |||
1182 | /* | ||
1183 | * On DVB-C, the bandwidth is a function of roll-off and symbol rate. | ||
1184 | * The bandwidth is required for DVB-C tuners, in order to avoid | ||
1185 | * inter-channel noise. Instead of estimating the minimal required | ||
1186 | * bandwidth on every single driver, calculates it here and fills | ||
1187 | * it at the cache bandwidth parameter. | ||
1188 | * While not officially supported, a side effect of handling it at | ||
1189 | * the cache level is that a program could retrieve the bandwidth | ||
1190 | * via DTV_BANDWIDTH_HZ, wich may be useful for test programs. | ||
1191 | */ | ||
1192 | if (c->delivery_system == SYS_DVBC_ANNEX_A) | ||
1193 | rolloff = 115; | ||
1194 | if (c->delivery_system == SYS_DVBC_ANNEX_C) | ||
1195 | rolloff = 113; | ||
1196 | if (rolloff) | ||
1197 | c->bandwidth_hz = (c->symbol_rate * rolloff) / 100; | ||
1181 | } | 1198 | } |
1182 | 1199 | ||
1183 | static void dtv_property_cache_submit(struct dvb_frontend *fe) | 1200 | static void dtv_property_cache_submit(struct dvb_frontend *fe) |
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index 038e470bf03..a2c81965193 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c | |||
@@ -6215,6 +6215,7 @@ static int drxk_set_parameters(struct dvb_frontend *fe, | |||
6215 | struct dvb_frontend_parameters *p) | 6215 | struct dvb_frontend_parameters *p) |
6216 | { | 6216 | { |
6217 | struct drxk_state *state = fe->demodulator_priv; | 6217 | struct drxk_state *state = fe->demodulator_priv; |
6218 | u32 delsys = fe->dtv_property_cache.delivery_system; | ||
6218 | u32 IF; | 6219 | u32 IF; |
6219 | 6220 | ||
6220 | dprintk(1, "\n"); | 6221 | dprintk(1, "\n"); |
@@ -6225,11 +6226,15 @@ static int drxk_set_parameters(struct dvb_frontend *fe, | |||
6225 | return -EINVAL; | 6226 | return -EINVAL; |
6226 | } | 6227 | } |
6227 | 6228 | ||
6228 | if (fe->ops.info.type == FE_QAM) { | 6229 | switch (delsys) { |
6229 | if (fe->dtv_property_cache.rolloff == ROLLOFF_13) | 6230 | case SYS_DVBC_ANNEX_A: |
6230 | state->m_itut_annex_c = true; | 6231 | state->m_itut_annex_c = false; |
6231 | else | 6232 | break; |
6232 | state->m_itut_annex_c = false; | 6233 | case SYS_DVBC_ANNEX_C: |
6234 | state->m_itut_annex_c = true; | ||
6235 | break; | ||
6236 | default: | ||
6237 | return -EINVAL; | ||
6233 | } | 6238 | } |
6234 | 6239 | ||
6235 | if (fe->ops.i2c_gate_ctrl) | 6240 | if (fe->ops.i2c_gate_ctrl) |
diff --git a/drivers/media/dvb/frontends/tda18271c2dd.c b/drivers/media/dvb/frontends/tda18271c2dd.c index b66ca29704f..0f8e9622bc9 100644 --- a/drivers/media/dvb/frontends/tda18271c2dd.c +++ b/drivers/media/dvb/frontends/tda18271c2dd.c | |||
@@ -1130,50 +1130,44 @@ static int set_params(struct dvb_frontend *fe, | |||
1130 | struct tda_state *state = fe->tuner_priv; | 1130 | struct tda_state *state = fe->tuner_priv; |
1131 | int status = 0; | 1131 | int status = 0; |
1132 | int Standard; | 1132 | int Standard; |
1133 | u32 bw; | 1133 | u32 bw = fe->dtv_property_cache.bandwidth_hz; |
1134 | u32 delsys = fe->dtv_property_cache.delivery_system; | ||
1134 | 1135 | ||
1135 | state->m_Frequency = params->frequency; | 1136 | state->m_Frequency = fe->dtv_property_cache.frequency; |
1136 | 1137 | ||
1137 | if (fe->ops.info.type == FE_OFDM) | 1138 | switch (delsys) { |
1138 | switch (params->u.ofdm.bandwidth) { | 1139 | case SYS_DVBT: |
1139 | case BANDWIDTH_6_MHZ: | 1140 | case SYS_DVBT2: |
1141 | switch (bw) { | ||
1142 | case 6000000: | ||
1140 | Standard = HF_DVBT_6MHZ; | 1143 | Standard = HF_DVBT_6MHZ; |
1141 | break; | 1144 | break; |
1142 | case BANDWIDTH_7_MHZ: | 1145 | case 7000000: |
1143 | Standard = HF_DVBT_7MHZ; | 1146 | Standard = HF_DVBT_7MHZ; |
1144 | break; | 1147 | break; |
1145 | default: | 1148 | case 8000000: |
1146 | case BANDWIDTH_8_MHZ: | ||
1147 | Standard = HF_DVBT_8MHZ; | 1149 | Standard = HF_DVBT_8MHZ; |
1148 | break; | 1150 | break; |
1151 | default: | ||
1152 | return -EINVAL; | ||
1149 | } | 1153 | } |
1150 | else if (fe->ops.info.type == FE_QAM) { | 1154 | case SYS_DVBC_ANNEX_A: |
1151 | /* | 1155 | case SYS_DVBC_ANNEX_C: |
1152 | * Using a higher bandwidth at the tuner filter may | ||
1153 | * allow inter-carrier interference. | ||
1154 | * So, determine the minimal channel spacing, in order | ||
1155 | * to better adjust the tuner filter. | ||
1156 | * According with ITU-T J.83, the bandwidth is given by: | ||
1157 | * bw = Simbol Rate * (1 + roll_off), where the roll_off | ||
1158 | * is equal to 0.15 for Annex A, and 0.13 for annex C | ||
1159 | */ | ||
1160 | if (fe->dtv_property_cache.rolloff == ROLLOFF_13) | ||
1161 | bw = (params->u.qam.symbol_rate * 113) / 100; | ||
1162 | else | ||
1163 | bw = (params->u.qam.symbol_rate * 115) / 100; | ||
1164 | if (bw <= 6000000) | 1156 | if (bw <= 6000000) |
1165 | Standard = HF_DVBC_6MHZ; | 1157 | Standard = HF_DVBC_6MHZ; |
1166 | else if (bw <= 7000000) | 1158 | else if (bw <= 7000000) |
1167 | Standard = HF_DVBC_7MHZ; | 1159 | Standard = HF_DVBC_7MHZ; |
1168 | else | 1160 | else |
1169 | Standard = HF_DVBC_8MHZ; | 1161 | Standard = HF_DVBC_8MHZ; |
1170 | } else | 1162 | default: |
1171 | return -EINVAL; | 1163 | return -EINVAL; |
1164 | } | ||
1172 | do { | 1165 | do { |
1173 | status = RFTrackingFiltersCorrection(state, params->frequency); | 1166 | status = RFTrackingFiltersCorrection(state, state->m_Frequency); |
1174 | if (status < 0) | 1167 | if (status < 0) |
1175 | break; | 1168 | break; |
1176 | status = ChannelConfiguration(state, params->frequency, Standard); | 1169 | status = ChannelConfiguration(state, state->m_Frequency, |
1170 | Standard); | ||
1177 | if (status < 0) | 1171 | if (status < 0) |
1178 | break; | 1172 | break; |
1179 | 1173 | ||
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h index b2a939f8f1e..a3c762383f8 100644 --- a/include/linux/dvb/frontend.h +++ b/include/linux/dvb/frontend.h | |||
@@ -331,8 +331,6 @@ typedef enum fe_rolloff { | |||
331 | ROLLOFF_20, | 331 | ROLLOFF_20, |
332 | ROLLOFF_25, | 332 | ROLLOFF_25, |
333 | ROLLOFF_AUTO, | 333 | ROLLOFF_AUTO, |
334 | ROLLOFF_15, /* DVB-C Annex A */ | ||
335 | ROLLOFF_13, /* DVB-C Annex C */ | ||
336 | } fe_rolloff_t; | 334 | } fe_rolloff_t; |
337 | 335 | ||
338 | typedef enum fe_delivery_system { | 336 | typedef enum fe_delivery_system { |