aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-11-11 17:26:03 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-11 17:26:03 -0500
commit2440f7aff46af4187d0518e92adaddf475aa82b0 (patch)
treec01e1ec4c8845c0704d0d6699418f8b7f386fa52
parent39ce61a846c8e1fa00cb57ad5af021542e6e8403 (diff)
[media] Properly implement ITU-T J.88 Annex C support
The Annex C support were broken with the previous implementation, as, at xc5000 and tda18271c2dd, it were choosing the wrong bandwidth for some symbol rates. At DRX-J, it were always selecting Annex A, even having Annex C support coded there. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/common/tuners/xc5000.c26
-rw-r--r--drivers/media/dvb/frontends/drxk_hard.c7
-rw-r--r--drivers/media/dvb/frontends/tda18271c2dd.c32
3 files changed, 37 insertions, 28 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index aa1b2e844d32..88b329cd8e41 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -628,20 +628,12 @@ static void xc_debug_dump(struct xc5000_priv *priv)
628 dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality); 628 dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality);
629} 629}
630 630
631/*
632 * As defined on EN 300 429, the DVB-C roll-off factor is 0.15.
633 * So, the amount of the needed bandwith is given by:
634 * Bw = Symbol_rate * (1 + 0.15)
635 * As such, the maximum symbol rate supported by 6 MHz is given by:
636 * max_symbol_rate = 6 MHz / 1.15 = 5217391 Bauds
637 */
638#define MAX_SYMBOL_RATE_6MHz 5217391
639
640static int xc5000_set_params(struct dvb_frontend *fe, 631static int xc5000_set_params(struct dvb_frontend *fe,
641 struct dvb_frontend_parameters *params) 632 struct dvb_frontend_parameters *params)
642{ 633{
643 struct xc5000_priv *priv = fe->tuner_priv; 634 struct xc5000_priv *priv = fe->tuner_priv;
644 int ret; 635 int ret;
636 u32 bw;
645 637
646 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { 638 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
647 if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { 639 if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) {
@@ -707,11 +699,19 @@ static int xc5000_set_params(struct dvb_frontend *fe,
707 dprintk(1, "%s() QAM modulation\n", __func__); 699 dprintk(1, "%s() QAM modulation\n", __func__);
708 priv->rf_mode = XC_RF_MODE_CABLE; 700 priv->rf_mode = XC_RF_MODE_CABLE;
709 /* 701 /*
710 * Using a 8MHz bandwidth sometimes fail 702 * Using a higher bandwidth at the tuner filter may
711 * with 6MHz-spaced channels, due to inter-carrier 703 * allow inter-carrier interference.
712 * interference. So, use DTV6 firmware 704 * So, determine the minimal channel spacing, in order
705 * to better adjust the tuner filter.
706 * According with ITU-T J.83, the bandwidth is given by:
707 * bw = Simbol Rate * (1 + roll_off), where the roll_off
708 * is equal to 0.15 for Annex A, and 0.13 for annex C
713 */ 709 */
714 if (params->u.qam.symbol_rate <= MAX_SYMBOL_RATE_6MHz) { 710 if (fe->dtv_property_cache.rolloff == ROLLOFF_13)
711 bw = (params->u.qam.symbol_rate * 13) / 10;
712 else
713 bw = (params->u.qam.symbol_rate * 15) / 10;
714 if (bw <= 6000000) {
715 priv->bandwidth = BANDWIDTH_6_MHZ; 715 priv->bandwidth = BANDWIDTH_6_MHZ;
716 priv->video_standard = DTV6; 716 priv->video_standard = DTV6;
717 priv->freq_hz = params->frequency - 1750000; 717 priv->freq_hz = params->frequency - 1750000;
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index f6431ef827dc..dc13fd86c4f5 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -6218,6 +6218,13 @@ static int drxk_set_parameters(struct dvb_frontend *fe,
6218 return -EINVAL; 6218 return -EINVAL;
6219 } 6219 }
6220 6220
6221 if (state->m_OperationMode == OM_QAM_ITU_A ||
6222 state->m_OperationMode == OM_QAM_ITU_C) {
6223 if (fe->dtv_property_cache.rolloff == ROLLOFF_13)
6224 state->m_OperationMode = OM_QAM_ITU_C;
6225 else
6226 state->m_OperationMode = OM_QAM_ITU_A;
6227 }
6221 6228
6222 if (fe->ops.i2c_gate_ctrl) 6229 if (fe->ops.i2c_gate_ctrl)
6223 fe->ops.i2c_gate_ctrl(fe, 1); 6230 fe->ops.i2c_gate_ctrl(fe, 1);
diff --git a/drivers/media/dvb/frontends/tda18271c2dd.c b/drivers/media/dvb/frontends/tda18271c2dd.c
index 1b1bf200c55c..de544f6a4d70 100644
--- a/drivers/media/dvb/frontends/tda18271c2dd.c
+++ b/drivers/media/dvb/frontends/tda18271c2dd.c
@@ -1123,20 +1123,6 @@ static int release(struct dvb_frontend *fe)
1123 return 0; 1123 return 0;
1124} 1124}
1125 1125
1126/*
1127 * As defined on EN 300 429 Annex A and on ITU-T J.83 annex A, the DVB-C
1128 * roll-off factor is 0.15.
1129 * According with the specs, the amount of the needed bandwith is given by:
1130 * Bw = Symbol_rate * (1 + 0.15)
1131 * As such, the maximum symbol rate supported by 6 MHz is
1132 * max_symbol_rate = 6 MHz / 1.15 = 5217391 Bauds
1133 *NOTE: For ITU-T J.83 Annex C, the roll-off factor is 0.13. So:
1134 * max_symbol_rate = 6 MHz / 1.13 = 5309735 Baud
1135 * That means that an adjustment is needed for Japan,
1136 * but, as currently DRX-K is hardcoded to Annex A, let's stick
1137 * with 0.15 roll-off factor.
1138 */
1139#define MAX_SYMBOL_RATE_6MHz 5217391
1140 1126
1141static int set_params(struct dvb_frontend *fe, 1127static int set_params(struct dvb_frontend *fe,
1142 struct dvb_frontend_parameters *params) 1128 struct dvb_frontend_parameters *params)
@@ -1144,6 +1130,7 @@ static int set_params(struct dvb_frontend *fe,
1144 struct tda_state *state = fe->tuner_priv; 1130 struct tda_state *state = fe->tuner_priv;
1145 int status = 0; 1131 int status = 0;
1146 int Standard; 1132 int Standard;
1133 u32 bw;
1147 1134
1148 state->m_Frequency = params->frequency; 1135 state->m_Frequency = params->frequency;
1149 1136
@@ -1161,8 +1148,23 @@ static int set_params(struct dvb_frontend *fe,
1161 break; 1148 break;
1162 } 1149 }
1163 else if (fe->ops.info.type == FE_QAM) { 1150 else if (fe->ops.info.type == FE_QAM) {
1164 if (params->u.qam.symbol_rate <= MAX_SYMBOL_RATE_6MHz) 1151 /*
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 * 13) / 10;
1162 else
1163 bw = (params->u.qam.symbol_rate * 15) / 10;
1164 if (bw <= 6000000)
1165 Standard = HF_DVBC_6MHZ; 1165 Standard = HF_DVBC_6MHZ;
1166 else if (bw <= 7000000)
1167 Standard = HF_DVBC_7MHZ;
1166 else 1168 else
1167 Standard = HF_DVBC_8MHZ; 1169 Standard = HF_DVBC_8MHZ;
1168 } else 1170 } else