From patchwork Wed Sep 16 13:50:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soeren.Moch@stud.uni-hannover.de X-Patchwork-Id: 47998 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8GDmGJn008184 for ; Wed, 16 Sep 2009 13:50:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752616AbZIPNu0 (ORCPT ); Wed, 16 Sep 2009 09:50:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752596AbZIPNu0 (ORCPT ); Wed, 16 Sep 2009 09:50:26 -0400 Received: from mx.stud.uni-hannover.de ([130.75.176.3]:41335 "EHLO studserv5d.stud.uni-hannover.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751845AbZIPNuZ (ORCPT ); Wed, 16 Sep 2009 09:50:25 -0400 Received: from [130.75.176.4] (studserv.stud.uni-hannover.de [130.75.176.4]) (authenticated bits=0) by studserv5d.stud.uni-hannover.de (8.14.3/8.14.3) with ESMTP id n8GDo9x5028294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Sep 2009 15:50:20 +0200 (MEST) Message-ID: <4AB0ED11.3090205@stud.uni-hannover.de> Date: Wed, 16 Sep 2009 15:50:09 +0200 From: Soeren Moch User-Agent: Thunderbird 2.0.0.19 (X11/20090110) MIME-Version: 1.0 To: pboettcher@kernellabs.com CC: linux-media@vger.kernel.org, odanet@caramail.com Subject: dib0700 i2c problem / mt2266 patch References: <4A16A8FF.2050308@stud.uni-hannover.de> <4AAE1975.6050707@stud.uni-hannover.de> In-Reply-To: <4AAE1975.6050707@stud.uni-hannover.de> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Patrick, when you are discussing dib0700 issues with dibcom, there is an additional one for the list: When using dib0700 in dual mode (on my nova-td stick), from time to time a tuner hangs up. I never observed this behavior in single mode. It seems to me that there is no proper locking within the dib0700 firmware when accessing both tuner i2c buses "simultaneously". Since I only need UHF channels, I use the attached patch to decrease the number of i2c transactions and tuner registers, which are involved in the channel switch. This solved the tuning problems. Besides the i2c problem, maybe it might be a good idea to integrate this patch into the mt2266 driver anyway, because it considerably speeds up the channel switch. Regards, S:oren --- drivers/media/common/tuners/mt2266.c.orig 2009-06-29 22:11:08.000000000 +0200 +++ drivers/media/common/tuners/mt2266.c 2009-06-29 22:21:01.000000000 +0200 @@ -137,7 +137,6 @@ static int mt2266_set_params(struct dvb_ freq = params->frequency / 1000; // Hz -> kHz if (freq < 470000 && freq > 230000) return -EINVAL; /* Gap between VHF and UHF bands */ - priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; priv->frequency = freq * 1000; tune = 2 * freq * (8192/16) / (FREF/16); @@ -145,21 +144,24 @@ static int mt2266_set_params(struct dvb_ if (band == MT2266_VHF) tune *= 2; - switch (params->u.ofdm.bandwidth) { - case BANDWIDTH_6_MHZ: - mt2266_writeregs(priv, mt2266_init_6mhz, - sizeof(mt2266_init_6mhz)); - break; - case BANDWIDTH_7_MHZ: - mt2266_writeregs(priv, mt2266_init_7mhz, - sizeof(mt2266_init_7mhz)); - break; - case BANDWIDTH_8_MHZ: - default: - mt2266_writeregs(priv, mt2266_init_8mhz, - sizeof(mt2266_init_8mhz)); - break; - } + if (priv->bandwidth != params->u.ofdm.bandwidth) { + priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; + switch (params->u.ofdm.bandwidth) { + case BANDWIDTH_6_MHZ: + mt2266_writeregs(priv, mt2266_init_6mhz, + sizeof(mt2266_init_6mhz)); + break; + case BANDWIDTH_7_MHZ: + mt2266_writeregs(priv, mt2266_init_7mhz, + sizeof(mt2266_init_7mhz)); + break; + case BANDWIDTH_8_MHZ: + default: + mt2266_writeregs(priv, mt2266_init_8mhz, + sizeof(mt2266_init_8mhz)); + break; + } + } if (band == MT2266_VHF && priv->band == MT2266_UHF) { dprintk("Switch from UHF to VHF"); @@ -327,6 +329,7 @@ struct dvb_frontend * mt2266_attach(stru priv->cfg = cfg; priv->i2c = i2c; + priv->bandwidth= BANDWIDTH_8_MHZ; priv->band = MT2266_UHF; if (mt2266_readreg(priv, 0, &id)) {