diff options
author | Istvan Varga <istvan_v@mailbox.hu> | 2011-06-04 11:12:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:52:38 -0400 |
commit | 30f544ec56eefc628e73e23324dc18105ad13012 (patch) | |
tree | 577ede2d52a54424a11c2c16bb8da6fa87959e93 /drivers/media/common/tuners/xc4000.c | |
parent | f4312e2fd4ca44e1defad1637d054bbe11a4ade6 (diff) |
[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>
Diffstat (limited to 'drivers/media/common/tuners/xc4000.c')
-rw-r--r-- | drivers/media/common/tuners/xc4000.c | 67 |
1 files changed, 55 insertions, 12 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 24afebb93331..bf3f6f1664cd 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c | |||
@@ -131,6 +131,7 @@ struct xc4000_priv { | |||
131 | #define XREG_SEEK_MODE 0x06 | 131 | #define XREG_SEEK_MODE 0x06 |
132 | #define XREG_POWER_DOWN 0x08 | 132 | #define XREG_POWER_DOWN 0x08 |
133 | #define XREG_SIGNALSOURCE 0x0A | 133 | #define XREG_SIGNALSOURCE 0x0A |
134 | #define XREG_SMOOTHEDCVBS 0x0E | ||
134 | #define XREG_AMPLITUDE 0x10 | 135 | #define XREG_AMPLITUDE 0x10 |
135 | 136 | ||
136 | /* Registers (Read-only) */ | 137 | /* Registers (Read-only) */ |
@@ -1218,15 +1219,35 @@ static int xc4000_set_params(struct dvb_frontend *fe, | |||
1218 | "xc4000: xc_SetSignalSource(%d) failed\n", | 1219 | "xc4000: xc_SetSignalSource(%d) failed\n", |
1219 | priv->rf_mode); | 1220 | priv->rf_mode); |
1220 | goto fail; | 1221 | 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 | } | ||
1221 | } | 1234 | } |
1222 | 1235 | ||
1223 | ret = xc_SetTVStandard(priv, | 1236 | if (priv->card_type == XC4000_CARD_WINFAST_CX88) { |
1224 | XC4000_Standard[priv->video_standard].VideoMode, | 1237 | if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) |
1225 | XC4000_Standard[priv->video_standard].AudioMode); | 1238 | ret = 0; |
1226 | if (ret != XC_RESULT_SUCCESS) { | 1239 | if (xc_write_reg(priv, XREG_AMPLITUDE, |
1227 | printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); | 1240 | (priv->firm_version == 0x0102 ? 132 : 134)) |
1228 | goto fail; | 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 | } | ||
1229 | } | 1249 | } |
1250 | |||
1230 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); | 1251 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); |
1231 | 1252 | ||
1232 | ret = 0; | 1253 | ret = 0; |
@@ -1311,14 +1332,36 @@ tune_channel: | |||
1311 | "xc4000: xc_SetSignalSource(%d) failed\n", | 1332 | "xc4000: xc_SetSignalSource(%d) failed\n", |
1312 | priv->rf_mode); | 1333 | priv->rf_mode); |
1313 | goto fail; | 1334 | 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 | } | ||
1314 | } | 1352 | } |
1315 | 1353 | ||
1316 | ret = xc_SetTVStandard(priv, | 1354 | if (priv->card_type == XC4000_CARD_WINFAST_CX88) { |
1317 | XC4000_Standard[priv->video_standard].VideoMode, | 1355 | if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) |
1318 | XC4000_Standard[priv->video_standard].AudioMode); | 1356 | ret = 0; |
1319 | if (ret != XC_RESULT_SUCCESS) { | 1357 | if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0) |
1320 | printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); | 1358 | ret = -EREMOTEIO; |
1321 | goto fail; | 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 | } | ||
1322 | } | 1365 | } |
1323 | 1366 | ||
1324 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); | 1367 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); |