From 59ad4e578af215f7ad8d922b512467764c84c302 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:12:42 -0300 Subject: [PATCH] --- yaml --- r: 261253 b: refs/heads/master c: 30f544ec56eefc628e73e23324dc18105ad13012 h: refs/heads/master i: 261251: a5bdd480b70f1fe6eec189b318660177e74f91a4 v: v3 --- [refs] | 2 +- trunk/drivers/media/common/tuners/xc4000.c | 67 ++++++++++++++++++---- 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 1da3949d43e2..cc18e564d1f2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f4312e2fd4ca44e1defad1637d054bbe11a4ade6 +refs/heads/master: 30f544ec56eefc628e73e23324dc18105ad13012 diff --git a/trunk/drivers/media/common/tuners/xc4000.c b/trunk/drivers/media/common/tuners/xc4000.c index 24afebb93331..bf3f6f1664cd 100644 --- a/trunk/drivers/media/common/tuners/xc4000.c +++ b/trunk/drivers/media/common/tuners/xc4000.c @@ -131,6 +131,7 @@ struct xc4000_priv { #define XREG_SEEK_MODE 0x06 #define XREG_POWER_DOWN 0x08 #define XREG_SIGNALSOURCE 0x0A +#define XREG_SMOOTHEDCVBS 0x0E #define XREG_AMPLITUDE 0x10 /* Registers (Read-only) */ @@ -1218,15 +1219,35 @@ static int xc4000_set_params(struct dvb_frontend *fe, "xc4000: xc_SetSignalSource(%d) failed\n", priv->rf_mode); goto fail; + } else { + u16 video_mode, audio_mode; + video_mode = XC4000_Standard[priv->video_standard].VideoMode; + audio_mode = XC4000_Standard[priv->video_standard].AudioMode; + if (type == DTV6 && priv->firm_version != 0x0102) + video_mode |= 0x0001; + ret = xc_SetTVStandard(priv, video_mode, audio_mode); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); + /* DJH - do not return when it fails... */ + /* goto fail; */ + } } - ret = xc_SetTVStandard(priv, - XC4000_Standard[priv->video_standard].VideoMode, - XC4000_Standard[priv->video_standard].AudioMode); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); - goto fail; + if (priv->card_type == XC4000_CARD_WINFAST_CX88) { + if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) + ret = 0; + if (xc_write_reg(priv, XREG_AMPLITUDE, + (priv->firm_version == 0x0102 ? 132 : 134)) + != 0) + ret = -EREMOTEIO; + if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) + ret = -EREMOTEIO; + if (ret != 0) { + printk(KERN_ERR "xc4000: setting registers failed\n"); + /* goto fail; */ + } } + xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); ret = 0; @@ -1311,14 +1332,36 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, "xc4000: xc_SetSignalSource(%d) failed\n", priv->rf_mode); goto fail; + } else { + u16 video_mode, audio_mode; + video_mode = XC4000_Standard[priv->video_standard].VideoMode; + audio_mode = XC4000_Standard[priv->video_standard].AudioMode; + if (priv->video_standard < XC4000_BG_PAL_A2) { + if (0 /*type & NOGD*/) + video_mode &= 0xFF7F; + } else if (priv->video_standard < XC4000_I_PAL_NICAM) { + if (priv->card_type == XC4000_CARD_WINFAST_CX88 && + priv->firm_version == 0x0102) + video_mode &= 0xFEFF; + } + ret = xc_SetTVStandard(priv, video_mode, audio_mode); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); + goto fail; + } } - ret = xc_SetTVStandard(priv, - XC4000_Standard[priv->video_standard].VideoMode, - XC4000_Standard[priv->video_standard].AudioMode); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); - goto fail; + if (priv->card_type == XC4000_CARD_WINFAST_CX88) { + if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) + ret = 0; + if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0) + ret = -EREMOTEIO; + if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) + ret = -EREMOTEIO; + if (ret != 0) { + printk(KERN_ERR "xc4000: setting registers failed\n"); + goto fail; + } } xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG);