From patchwork Mon Mar 28 18:55:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 669842 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2SIuDsW004591 for ; Mon, 28 Mar 2011 18:56:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754889Ab1C1S4K (ORCPT ); Mon, 28 Mar 2011 14:56:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63690 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754816Ab1C1S4J (ORCPT ); Mon, 28 Mar 2011 14:56:09 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2SIu2ua004829 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 28 Mar 2011 14:56:02 -0400 Received: from [10.3.231.98] (vpn-231-98.phx2.redhat.com [10.3.231.98]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2SItxNf018845; Mon, 28 Mar 2011 14:56:00 -0400 Message-ID: <4D90D9BE.2080606@redhat.com> Date: Mon, 28 Mar 2011 15:55:58 -0300 From: Mauro Carvalho Chehab User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Red Hat/3.1.7-3.el6_0 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: Devin Heitmueller CC: Dmitry Belimov , "Igor M. Liplianin" , linux-media@vger.kernel.org Subject: [media] xc5000: Improve it to work better with 6MHz-spaced channels X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 28 Mar 2011 18:56:13 +0000 (UTC) diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 1e28f7d..3cb8473 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c @@ -628,6 +628,15 @@ static void xc_debug_dump(struct xc5000_priv *priv) dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality); } +/* + * As defined on EN 300 429, the DVB-C roll-off factor is 0.15. + * So, the amount of the needed bandwith is given by: + * Bw = Symbol_rate * (1 + 0.15) + * As such, the maximum symbol rate supported by 6 MHz is given by: + * max_symbol_rate = 6 MHz / 1.15 = 5217391 Bauds + */ +#define MAX_SYMBOL_RATE_6MHz 5217391 + static int xc5000_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { @@ -688,7 +697,6 @@ static int xc5000_set_params(struct dvb_frontend *fe, } priv->rf_mode = XC_RF_MODE_AIR; } else if (fe->ops.info.type == FE_QAM) { - dprintk(1, "%s() QAM\n", __func__); switch (params->u.qam.modulation) { case QAM_16: case QAM_32: @@ -697,12 +705,24 @@ static int xc5000_set_params(struct dvb_frontend *fe, case QAM_256: case QAM_AUTO: dprintk(1, "%s() QAM modulation\n", __func__); - priv->bandwidth = BANDWIDTH_8_MHZ; - priv->video_standard = DTV7_8; - priv->freq_hz = params->frequency - 2750000; priv->rf_mode = XC_RF_MODE_CABLE; + /* + * Using a 8MHz bandwidth sometimes fail + * with 6MHz-spaced channels, due to inter-carrier + * interference. So, use DTV6 firmware + */ + if (params->u.qam.symbol_rate <= MAX_SYMBOL_RATE_6MHz) { + priv->bandwidth = BANDWIDTH_6_MHZ; + priv->video_standard = DTV6; + priv->freq_hz = params->frequency - 1750000; + } else { + priv->bandwidth = BANDWIDTH_8_MHZ; + priv->video_standard = DTV7_8; + priv->freq_hz = params->frequency - 2750000; + } break; default: + dprintk(1, "%s() Unsupported QAM type\n", __func__); return -EINVAL; } } else {