aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/tuner-xc2028.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common/tuners/tuner-xc2028.c')
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.c83
1 files changed, 36 insertions, 47 deletions
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index 4df952c47f86..d052c264a457 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -1087,65 +1087,26 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe,
1087static int xc2028_set_params(struct dvb_frontend *fe, 1087static int xc2028_set_params(struct dvb_frontend *fe,
1088 struct dvb_frontend_parameters *p) 1088 struct dvb_frontend_parameters *p)
1089{ 1089{
1090 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1091 u32 delsys = c->delivery_system;
1092 u32 bw = c->bandwidth_hz;
1090 struct xc2028_data *priv = fe->tuner_priv; 1093 struct xc2028_data *priv = fe->tuner_priv;
1091 unsigned int type=0; 1094 unsigned int type=0;
1092 fe_bandwidth_t bw = BANDWIDTH_8_MHZ;
1093 u16 demod = 0; 1095 u16 demod = 0;
1094 1096
1095 tuner_dbg("%s called\n", __func__); 1097 tuner_dbg("%s called\n", __func__);
1096 1098
1097 switch(fe->ops.info.type) { 1099 switch (delsys) {
1098 case FE_OFDM: 1100 case SYS_DVBT:
1099 bw = p->u.ofdm.bandwidth; 1101 case SYS_DVBT2:
1100 /* 1102 /*
1101 * The only countries with 6MHz seem to be Taiwan/Uruguay. 1103 * The only countries with 6MHz seem to be Taiwan/Uruguay.
1102 * Both seem to require QAM firmware for OFDM decoding 1104 * Both seem to require QAM firmware for OFDM decoding
1103 * Tested in Taiwan by Terry Wu <terrywu2009@gmail.com> 1105 * Tested in Taiwan by Terry Wu <terrywu2009@gmail.com>
1104 */ 1106 */
1105 if (bw == BANDWIDTH_6_MHZ) 1107 if (bw <= 6000000)
1106 type |= QAM; 1108 type |= QAM;
1107 break;
1108 case FE_ATSC:
1109 bw = BANDWIDTH_6_MHZ;
1110 /* The only ATSC firmware (at least on v2.7) is D2633 */
1111 type |= ATSC | D2633;
1112 break;
1113 /* DVB-S and pure QAM (FE_QAM) are not supported */
1114 default:
1115 return -EINVAL;
1116 }
1117
1118 switch (bw) {
1119 case BANDWIDTH_8_MHZ:
1120 if (p->frequency < 470000000)
1121 priv->ctrl.vhfbw7 = 0;
1122 else
1123 priv->ctrl.uhfbw8 = 1;
1124 type |= (priv->ctrl.vhfbw7 && priv->ctrl.uhfbw8) ? DTV78 : DTV8;
1125 type |= F8MHZ;
1126 break;
1127 case BANDWIDTH_7_MHZ:
1128 if (p->frequency < 470000000)
1129 priv->ctrl.vhfbw7 = 1;
1130 else
1131 priv->ctrl.uhfbw8 = 0;
1132 type |= (priv->ctrl.vhfbw7 && priv->ctrl.uhfbw8) ? DTV78 : DTV7;
1133 type |= F8MHZ;
1134 break;
1135 case BANDWIDTH_6_MHZ:
1136 type |= DTV6;
1137 priv->ctrl.vhfbw7 = 0;
1138 priv->ctrl.uhfbw8 = 0;
1139 break;
1140 default:
1141 tuner_err("error: bandwidth not supported.\n");
1142 };
1143 1109
1144 /*
1145 Selects between D2633 or D2620 firmware.
1146 It doesn't make sense for ATSC, since it should be D2633 on all cases
1147 */
1148 if (fe->ops.info.type != FE_ATSC) {
1149 switch (priv->ctrl.type) { 1110 switch (priv->ctrl.type) {
1150 case XC2028_D2633: 1111 case XC2028_D2633:
1151 type |= D2633; 1112 type |= D2633;
@@ -1161,6 +1122,34 @@ static int xc2028_set_params(struct dvb_frontend *fe,
1161 else 1122 else
1162 type |= D2620; 1123 type |= D2620;
1163 } 1124 }
1125 break;
1126 case SYS_ATSC:
1127 /* The only ATSC firmware (at least on v2.7) is D2633 */
1128 type |= ATSC | D2633;
1129 break;
1130 /* DVB-S and pure QAM (FE_QAM) are not supported */
1131 default:
1132 return -EINVAL;
1133 }
1134
1135 if (bw <= 6000000) {
1136 type |= DTV6;
1137 priv->ctrl.vhfbw7 = 0;
1138 priv->ctrl.uhfbw8 = 0;
1139 } else if (bw <= 7000000) {
1140 if (c->frequency < 470000000)
1141 priv->ctrl.vhfbw7 = 1;
1142 else
1143 priv->ctrl.uhfbw8 = 0;
1144 type |= (priv->ctrl.vhfbw7 && priv->ctrl.uhfbw8) ? DTV78 : DTV7;
1145 type |= F8MHZ;
1146 } else {
1147 if (c->frequency < 470000000)
1148 priv->ctrl.vhfbw7 = 0;
1149 else
1150 priv->ctrl.uhfbw8 = 1;
1151 type |= (priv->ctrl.vhfbw7 && priv->ctrl.uhfbw8) ? DTV78 : DTV8;
1152 type |= F8MHZ;
1164 } 1153 }
1165 1154
1166 /* All S-code tables need a 200kHz shift */ 1155 /* All S-code tables need a 200kHz shift */
@@ -1185,7 +1174,7 @@ static int xc2028_set_params(struct dvb_frontend *fe,
1185 */ 1174 */
1186 } 1175 }
1187 1176
1188 return generic_set_freq(fe, p->frequency, 1177 return generic_set_freq(fe, c->frequency,
1189 V4L2_TUNER_DIGITAL_TV, type, 0, demod); 1178 V4L2_TUNER_DIGITAL_TV, type, 0, demod);
1190} 1179}
1191 1180