From patchwork Tue May 18 07:23:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitri Belimov X-Patchwork-Id: 100364 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4I7NGWv003082 for ; Tue, 18 May 2010 07:23:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754833Ab0ERHXO (ORCPT ); Tue, 18 May 2010 03:23:14 -0400 Received: from fg-out-1718.google.com ([72.14.220.152]:62305 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699Ab0ERHXN (ORCPT ); Tue, 18 May 2010 03:23:13 -0400 Received: by fg-out-1718.google.com with SMTP id 22so917840fge.1 for ; Tue, 18 May 2010 00:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:x-mailer:mime-version:content-type; bh=L5b+dtp/dWHqo02UtiIzZD8/J/LKQR5MAgk8/YQiHD4=; b=mdBbA6JniCdoUFGTqug70+vVW3Ocl5W7EVkgeD1IJw5YP2ddhrC05a+FE93e/vjBka hIesPtY9Uj8KjZEAOiDExx/JDBJcVu4O+g0+lGNlL8qnmYdWX3a6Rf5oJqJHu9Lf66cf guUBk/mTpmkVARznN5korcBT5TnAFHphFthfo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:x-mailer:mime-version:content-type; b=epRHazQ4+JulH4Y5eDvR23ZHxAjm4SgSckrWo4e9LxpP3rgP7XvUrnkBTndMTGa1Uj wTpxdryEoPZf8Nza4cbBSI3ht+f+6Oa2u9R/CrjRbf83WRXD0yhioNC52QrXgVB2M/15 OK2qucGdqAqi2iaRu5HhnJQ+D9fuv9NgfHR6I= Received: by 10.87.19.37 with SMTP id w37mr10254368fgi.25.1274167390582; Tue, 18 May 2010 00:23:10 -0700 (PDT) Received: from glory.loctelecom.ru (ns2.openhardware.ru [84.19.183.172]) by mx.google.com with ESMTPS id d6sm10756527fga.8.2010.05.18.00.23.08 (version=SSLv3 cipher=RC4-MD5); Tue, 18 May 2010 00:23:09 -0700 (PDT) Date: Tue, 18 May 2010 17:23:29 +1000 From: Dmitri Belimov To: Linux Media Mailing List , Stefan Ringel , Mauro Carvalho Chehab , Bee Hock Goh Subject: [PATCH] tm6000, reset I2C bus function Message-ID: <20100518172329.6d9b520a@glory.loctelecom.ru> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.16.1; i486-pc-linux-gnu) Mime-Version: 1.0 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.3 (demeter.kernel.org [140.211.167.41]); Tue, 18 May 2010 07:23:16 +0000 (UTC) diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000-cards.c --- a/linux/drivers/staging/tm6000/tm6000-cards.c Sun May 16 18:48:01 2010 -0300 +++ b/linux/drivers/staging/tm6000/tm6000-cards.c Tue May 18 11:14:55 2010 +1000 @@ -378,13 +378,7 @@ tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 0x02, arg); msleep(10); - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_CLK, 0); - if (rc < 0) - return rc; - msleep(10); - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_CLK, 1); + rc = tm6000_i2c_reset(dev, 10); break; case XC2028_TUNER_RESET: /* Reset codes during load firmware */ @@ -438,14 +432,7 @@ break; case 2: - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_CLK, 0); - if (rc < 0) - return rc; - msleep(100); - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_CLK, 1); - msleep(100); + rc = tm6000_i2c_reset(dev, 100); break; } } diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000-core.c --- a/linux/drivers/staging/tm6000/tm6000-core.c Sun May 16 18:48:01 2010 -0300 +++ b/linux/drivers/staging/tm6000/tm6000-core.c Tue May 18 11:14:55 2010 +1000 @@ -156,6 +156,22 @@ return rc; return buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24; +} + +int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep) +{ + int rc; + + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 0); + if (rc < 0) + return rc; + + msleep(tsleep); + + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1); + msleep(tsleep); + + return rc; } void tm6000_set_fourcc_format(struct tm6000_core *dev) diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000.h --- a/linux/drivers/staging/tm6000/tm6000.h Sun May 16 18:48:01 2010 -0300 +++ b/linux/drivers/staging/tm6000/tm6000.h Tue May 18 11:14:55 2010 +1000 @@ -241,6 +241,8 @@ int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_get_reg32(struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); +int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep); + int tm6000_init (struct tm6000_core *dev); int tm6000_init_analog_mode (struct tm6000_core *dev); Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov