Skip to content

Commit 30f544e

Browse files
istvan-vMauro Carvalho Chehab
authored andcommitted
[media] xc4000: setting registers
This patch implements setting the registers in xc4000_set_params() and xc4000_set_analog_params(). A new register is defined which enables filtering of the composite video output (this is needed to avoid bad picture quality with some boards). Signed-off-by: Istvan Varga <istvan_v@mailbox.hu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1 parent f4312e2 commit 30f544e

1 file changed

Lines changed: 55 additions & 12 deletions

File tree

‎drivers/media/common/tuners/xc4000.c‎

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ struct xc4000_priv {
131131
#define XREG_SEEK_MODE 0x06
132132
#define XREG_POWER_DOWN 0x08
133133
#define XREG_SIGNALSOURCE 0x0A
134+
#define XREG_SMOOTHEDCVBS 0x0E
134135
#define XREG_AMPLITUDE 0x10
135136

136137
/* Registers (Read-only) */
@@ -1218,15 +1219,35 @@ static int xc4000_set_params(struct dvb_frontend *fe,
12181219
"xc4000: xc_SetSignalSource(%d) failed\n",
12191220
priv->rf_mode);
12201221
goto fail;
1222+
} else {
1223+
u16 video_mode, audio_mode;
1224+
video_mode = XC4000_Standard[priv->video_standard].VideoMode;
1225+
audio_mode = XC4000_Standard[priv->video_standard].AudioMode;
1226+
if (type == DTV6 && priv->firm_version != 0x0102)
1227+
video_mode |= 0x0001;
1228+
ret = xc_SetTVStandard(priv, video_mode, audio_mode);
1229+
if (ret != XC_RESULT_SUCCESS) {
1230+
printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n");
1231+
/* DJH - do not return when it fails... */
1232+
/* goto fail; */
1233+
}
12211234
}
12221235

1223-
ret = xc_SetTVStandard(priv,
1224-
XC4000_Standard[priv->video_standard].VideoMode,
1225-
XC4000_Standard[priv->video_standard].AudioMode);
1226-
if (ret != XC_RESULT_SUCCESS) {
1227-
printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n");
1228-
goto fail;
1236+
if (priv->card_type == XC4000_CARD_WINFAST_CX88) {
1237+
if (xc_write_reg(priv, XREG_D_CODE, 0) == 0)
1238+
ret = 0;
1239+
if (xc_write_reg(priv, XREG_AMPLITUDE,
1240+
(priv->firm_version == 0x0102 ? 132 : 134))
1241+
!= 0)
1242+
ret = -EREMOTEIO;
1243+
if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0)
1244+
ret = -EREMOTEIO;
1245+
if (ret != 0) {
1246+
printk(KERN_ERR "xc4000: setting registers failed\n");
1247+
/* goto fail; */
1248+
}
12291249
}
1250+
12301251
xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL);
12311252

12321253
ret = 0;
@@ -1311,14 +1332,36 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe,
13111332
"xc4000: xc_SetSignalSource(%d) failed\n",
13121333
priv->rf_mode);
13131334
goto fail;
1335+
} else {
1336+
u16 video_mode, audio_mode;
1337+
video_mode = XC4000_Standard[priv->video_standard].VideoMode;
1338+
audio_mode = XC4000_Standard[priv->video_standard].AudioMode;
1339+
if (priv->video_standard < XC4000_BG_PAL_A2) {
1340+
if (0 /*type & NOGD*/)
1341+
video_mode &= 0xFF7F;
1342+
} else if (priv->video_standard < XC4000_I_PAL_NICAM) {
1343+
if (priv->card_type == XC4000_CARD_WINFAST_CX88 &&
1344+
priv->firm_version == 0x0102)
1345+
video_mode &= 0xFEFF;
1346+
}
1347+
ret = xc_SetTVStandard(priv, video_mode, audio_mode);
1348+
if (ret != XC_RESULT_SUCCESS) {
1349+
printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n");
1350+
goto fail;
1351+
}
13141352
}
13151353

1316-
ret = xc_SetTVStandard(priv,
1317-
XC4000_Standard[priv->video_standard].VideoMode,
1318-
XC4000_Standard[priv->video_standard].AudioMode);
1319-
if (ret != XC_RESULT_SUCCESS) {
1320-
printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n");
1321-
goto fail;
1354+
if (priv->card_type == XC4000_CARD_WINFAST_CX88) {
1355+
if (xc_write_reg(priv, XREG_D_CODE, 0) == 0)
1356+
ret = 0;
1357+
if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0)
1358+
ret = -EREMOTEIO;
1359+
if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0)
1360+
ret = -EREMOTEIO;
1361+
if (ret != 0) {
1362+
printk(KERN_ERR "xc4000: setting registers failed\n");
1363+
goto fail;
1364+
}
13221365
}
13231366

13241367
xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG);

0 commit comments

Comments
 (0)