aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/xc4000.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common/tuners/xc4000.c')
-rw-r--r--drivers/media/common/tuners/xc4000.c91
1 files changed, 51 insertions, 40 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c
index b3b33d266b7c..1263bfe12bc2 100644
--- a/drivers/media/common/tuners/xc4000.c
+++ b/drivers/media/common/tuners/xc4000.c
@@ -174,25 +174,29 @@ struct XC_TV_STANDARD {
174}; 174};
175 175
176/* Tuner standards */ 176/* Tuner standards */
177#define MN_NTSC_PAL_BTSC 0 177#define XC4000_MN_NTSC_PAL_BTSC 0
178#define MN_NTSC_PAL_A2 1 178#define XC4000_MN_NTSC_PAL_A2 1
179#define MN_NTSC_PAL_EIAJ 2 179#define XC4000_MN_NTSC_PAL_EIAJ 2
180#define MN_NTSC_PAL_Mono 3 180#define XC4000_MN_NTSC_PAL_Mono 3
181#define BG_PAL_A2 4 181#define XC4000_BG_PAL_A2 4
182#define BG_PAL_NICAM 5 182#define XC4000_BG_PAL_NICAM 5
183#define BG_PAL_MONO 6 183#define XC4000_BG_PAL_MONO 6
184#define I_PAL_NICAM 7 184#define XC4000_I_PAL_NICAM 7
185#define I_PAL_NICAM_MONO 8 185#define XC4000_I_PAL_NICAM_MONO 8
186#define DK_PAL_A2 9 186#define XC4000_DK_PAL_A2 9
187#define DK_PAL_NICAM 10 187#define XC4000_DK_PAL_NICAM 10
188#define DK_PAL_MONO 11 188#define XC4000_DK_PAL_MONO 11
189#define DK_SECAM_A2DK1 12 189#define XC4000_DK_SECAM_A2DK1 12
190#define DK_SECAM_A2LDK3 13 190#define XC4000_DK_SECAM_A2LDK3 13
191#define DK_SECAM_A2MONO 14 191#define XC4000_DK_SECAM_A2MONO 14
192#define L_SECAM_NICAM 15 192#define XC4000_L_SECAM_NICAM 15
193#define LC_SECAM_NICAM 16 193#define XC4000_LC_SECAM_NICAM 16
194#define FM_Radio_INPUT2 21 194#define XC4000_DTV6 17
195#define FM_Radio_INPUT1 22 195#define XC4000_DTV8 18
196#define XC4000_DTV7_8 19
197#define XC4000_DTV7 20
198#define XC4000_FM_Radio_INPUT2 21
199#define XC4000_FM_Radio_INPUT1 22
196 200
197/* WAS : 201/* WAS :
198static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { 202static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = {
@@ -1205,15 +1209,11 @@ static int xc4000_set_params(struct dvb_frontend *fe,
1205 struct dvb_frontend_parameters *params) 1209 struct dvb_frontend_parameters *params)
1206{ 1210{
1207 struct xc4000_priv *priv = fe->tuner_priv; 1211 struct xc4000_priv *priv = fe->tuner_priv;
1212 unsigned int type;
1208 int ret; 1213 int ret;
1209 1214
1210 dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); 1215 dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency);
1211 1216
1212 /* FIXME: setup proper parameters */
1213 if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) {
1214 return -EREMOTEIO;
1215 }
1216
1217 if (fe->ops.info.type == FE_ATSC) { 1217 if (fe->ops.info.type == FE_ATSC) {
1218 dprintk(1, "%s() ATSC\n", __func__); 1218 dprintk(1, "%s() ATSC\n", __func__);
1219 switch (params->u.vsb.modulation) { 1219 switch (params->u.vsb.modulation) {
@@ -1223,7 +1223,8 @@ static int xc4000_set_params(struct dvb_frontend *fe,
1223 priv->rf_mode = XC_RF_MODE_AIR; 1223 priv->rf_mode = XC_RF_MODE_AIR;
1224 priv->freq_hz = params->frequency - 1750000; 1224 priv->freq_hz = params->frequency - 1750000;
1225 priv->bandwidth = BANDWIDTH_6_MHZ; 1225 priv->bandwidth = BANDWIDTH_6_MHZ;
1226 priv->video_standard = DTV6; 1226 priv->video_standard = XC4000_DTV6;
1227 type = DTV6;
1227 break; 1228 break;
1228 case QAM_64: 1229 case QAM_64:
1229 case QAM_256: 1230 case QAM_256:
@@ -1232,7 +1233,8 @@ static int xc4000_set_params(struct dvb_frontend *fe,
1232 priv->rf_mode = XC_RF_MODE_CABLE; 1233 priv->rf_mode = XC_RF_MODE_CABLE;
1233 priv->freq_hz = params->frequency - 1750000; 1234 priv->freq_hz = params->frequency - 1750000;
1234 priv->bandwidth = BANDWIDTH_6_MHZ; 1235 priv->bandwidth = BANDWIDTH_6_MHZ;
1235 priv->video_standard = DTV6; 1236 priv->video_standard = XC4000_DTV6;
1237 type = DTV6;
1236 break; 1238 break;
1237 default: 1239 default:
1238 return -EINVAL; 1240 return -EINVAL;
@@ -1242,16 +1244,19 @@ static int xc4000_set_params(struct dvb_frontend *fe,
1242 switch (params->u.ofdm.bandwidth) { 1244 switch (params->u.ofdm.bandwidth) {
1243 case BANDWIDTH_6_MHZ: 1245 case BANDWIDTH_6_MHZ:
1244 priv->bandwidth = BANDWIDTH_6_MHZ; 1246 priv->bandwidth = BANDWIDTH_6_MHZ;
1245 priv->video_standard = DTV6; 1247 priv->video_standard = XC4000_DTV6;
1246 priv->freq_hz = params->frequency - 1750000; 1248 priv->freq_hz = params->frequency - 1750000;
1249 type = DTV6;
1247 break; 1250 break;
1248 case BANDWIDTH_7_MHZ: 1251 case BANDWIDTH_7_MHZ:
1249 printk(KERN_ERR "xc4000 bandwidth 7MHz not supported\n"); 1252 printk(KERN_ERR "xc4000 bandwidth 7MHz not supported\n");
1253 type = DTV7;
1250 return -EINVAL; 1254 return -EINVAL;
1251 case BANDWIDTH_8_MHZ: 1255 case BANDWIDTH_8_MHZ:
1252 priv->bandwidth = BANDWIDTH_8_MHZ; 1256 priv->bandwidth = BANDWIDTH_8_MHZ;
1253 priv->video_standard = DTV8; 1257 priv->video_standard = XC4000_DTV8;
1254 priv->freq_hz = params->frequency - 2750000; 1258 priv->freq_hz = params->frequency - 2750000;
1259 type = DTV8;
1255 break; 1260 break;
1256 default: 1261 default:
1257 printk(KERN_ERR "xc4000 bandwidth not set!\n"); 1262 printk(KERN_ERR "xc4000 bandwidth not set!\n");
@@ -1266,6 +1271,11 @@ static int xc4000_set_params(struct dvb_frontend *fe,
1266 dprintk(1, "%s() frequency=%d (compensated)\n", 1271 dprintk(1, "%s() frequency=%d (compensated)\n",
1267 __func__, priv->freq_hz); 1272 __func__, priv->freq_hz);
1268 1273
1274 /* Make sure the correct firmware type is loaded */
1275 if (check_firmware(fe, type, 0, priv->if_khz) != XC_RESULT_SUCCESS) {
1276 return -EREMOTEIO;
1277 }
1278
1269 ret = xc_SetSignalSource(priv, priv->rf_mode); 1279 ret = xc_SetSignalSource(priv, priv->rf_mode);
1270 if (ret != XC_RESULT_SUCCESS) { 1280 if (ret != XC_RESULT_SUCCESS) {
1271 printk(KERN_ERR 1281 printk(KERN_ERR
@@ -1325,11 +1335,6 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe,
1325 dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", 1335 dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n",
1326 __func__, params->frequency); 1336 __func__, params->frequency);
1327 1337
1328 /* FIXME: setup proper parameters */
1329 if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) {
1330 return -EREMOTEIO;
1331 }
1332
1333 /* Fix me: it could be air. */ 1338 /* Fix me: it could be air. */
1334 priv->rf_mode = params->mode; 1339 priv->rf_mode = params->mode;
1335 if (params->mode > XC_RF_MODE_CABLE) 1340 if (params->mode > XC_RF_MODE_CABLE)
@@ -1343,45 +1348,51 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe,
1343 */ 1348 */
1344 if (params->std & V4L2_STD_MN) { 1349 if (params->std & V4L2_STD_MN) {
1345 /* default to BTSC audio standard */ 1350 /* default to BTSC audio standard */
1346 priv->video_standard = MN_NTSC_PAL_BTSC; 1351 priv->video_standard = XC4000_MN_NTSC_PAL_BTSC;
1347 goto tune_channel; 1352 goto tune_channel;
1348 } 1353 }
1349 1354
1350 if (params->std & V4L2_STD_PAL_BG) { 1355 if (params->std & V4L2_STD_PAL_BG) {
1351 /* default to NICAM audio standard */ 1356 /* default to NICAM audio standard */
1352 priv->video_standard = BG_PAL_NICAM; 1357 priv->video_standard = XC4000_BG_PAL_NICAM;
1353 goto tune_channel; 1358 goto tune_channel;
1354 } 1359 }
1355 1360
1356 if (params->std & V4L2_STD_PAL_I) { 1361 if (params->std & V4L2_STD_PAL_I) {
1357 /* default to NICAM audio standard */ 1362 /* default to NICAM audio standard */
1358 priv->video_standard = I_PAL_NICAM; 1363 priv->video_standard = XC4000_I_PAL_NICAM;
1359 goto tune_channel; 1364 goto tune_channel;
1360 } 1365 }
1361 1366
1362 if (params->std & V4L2_STD_PAL_DK) { 1367 if (params->std & V4L2_STD_PAL_DK) {
1363 /* default to NICAM audio standard */ 1368 /* default to NICAM audio standard */
1364 priv->video_standard = DK_PAL_NICAM; 1369 priv->video_standard = XC4000_DK_PAL_NICAM;
1365 goto tune_channel; 1370 goto tune_channel;
1366 } 1371 }
1367 1372
1368 if (params->std & V4L2_STD_SECAM_DK) { 1373 if (params->std & V4L2_STD_SECAM_DK) {
1369 /* default to A2 DK1 audio standard */ 1374 /* default to A2 DK1 audio standard */
1370 priv->video_standard = DK_SECAM_A2DK1; 1375 priv->video_standard = XC4000_DK_SECAM_A2DK1;
1371 goto tune_channel; 1376 goto tune_channel;
1372 } 1377 }
1373 1378
1374 if (params->std & V4L2_STD_SECAM_L) { 1379 if (params->std & V4L2_STD_SECAM_L) {
1375 priv->video_standard = L_SECAM_NICAM; 1380 priv->video_standard = XC4000_L_SECAM_NICAM;
1376 goto tune_channel; 1381 goto tune_channel;
1377 } 1382 }
1378 1383
1379 if (params->std & V4L2_STD_SECAM_LC) { 1384 if (params->std & V4L2_STD_SECAM_LC) {
1380 priv->video_standard = LC_SECAM_NICAM; 1385 priv->video_standard = XC4000_LC_SECAM_NICAM;
1381 goto tune_channel; 1386 goto tune_channel;
1382 } 1387 }
1383 1388
1384tune_channel: 1389tune_channel:
1390
1391 /* FIXME - firmware type not being set properly */
1392 if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) {
1393 return -EREMOTEIO;
1394 }
1395
1385 ret = xc_SetSignalSource(priv, priv->rf_mode); 1396 ret = xc_SetSignalSource(priv, priv->rf_mode);
1386 if (ret != XC_RESULT_SUCCESS) { 1397 if (ret != XC_RESULT_SUCCESS) {
1387 printk(KERN_ERR 1398 printk(KERN_ERR