From patchwork Wed Feb 3 20:25:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Ringel X-Patchwork-Id: 76799 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 o13KQlSb029797 for ; Wed, 3 Feb 2010 20:26:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757906Ab0BCU0V (ORCPT ); Wed, 3 Feb 2010 15:26:21 -0500 Received: from mail-in-02.arcor-online.net ([151.189.21.42]:37043 "EHLO mail-in-02.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757904Ab0BCU0U (ORCPT ); Wed, 3 Feb 2010 15:26:20 -0500 Received: from mail-in-04-z2.arcor-online.net (mail-in-04-z2.arcor-online.net [151.189.8.16]) by mx.arcor.de (Postfix) with ESMTP id A74C13FE486; Wed, 3 Feb 2010 21:26:18 +0100 (CET) Received: from mail-in-06.arcor-online.net (mail-in-06.arcor-online.net [151.189.21.46]) by mail-in-04-z2.arcor-online.net (Postfix) with ESMTP id 9D64BAC828; Wed, 3 Feb 2010 21:26:18 +0100 (CET) Received: from [192.168.2.102] (dslb-188-103-200-201.pools.arcor-ip.net [188.103.200.201]) (Authenticated sender: stefan.ringel@arcor.de) by mail-in-06.arcor-online.net (Postfix) with ESMTPA id 22FF539A38E; Wed, 3 Feb 2010 21:26:18 +0100 (CET) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-06.arcor-online.net 22FF539A38E DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1265228778; bh=uRgxyXhsOgFsMbIFeeFFa8s4LukjeiZqUnhFzwBqkpU=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=eNzcY4NK/Zgo/ygUqXlDTKjadYS/cwxu2znsV7I+JUeKjjMLKgZM8/ufODI1YSEta A6/8u1e8v6VdjvnJYMLDrp0vRXJay/BKJaRHRLANRb2pI40xnzltnXWcOmkIEjqQoC orloL1egUa+FdTY5WRZphewJIs6EyCv03zSTKRjw= Message-ID: <4B69DBCC.50108@arcor.de> Date: Wed, 03 Feb 2010 21:25:48 +0100 From: Stefan Ringel User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.5) Gecko/20091130 SUSE/3.0.0-1.1.1 Thunderbird/3.0 MIME-Version: 1.0 To: Mauro Carvalho Chehab CC: linux-media@vger.kernel.org, Devin Heitmueller Subject: [PATCH 9/15] - tm6000 analog digital switch References: <4B673790.3030706@arcor.de> <4B673B2D.6040507@arcor.de> <4B675B19.3080705@redhat.com> <4B685FB9.1010805@arcor.de> <4B688507.606@redhat.com> <4B688E41.2050806@arcor.de> <4B689094.2070204@redhat.com> <4B6894FE.6010202@arcor.de> <4B69D83D.5050809@arcor.de> <4B69D8CC.2030008@arcor.de> In-Reply-To: <4B69D8CC.2030008@arcor.de> 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]); Wed, 03 Feb 2010 20:26:47 +0000 (UTC) --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c @@ -15,6 +15,7 @@ #include #include #include +#include "compat.h" #include #include "tuner-i2c.h" #include "tuner-xc2028.h" @@ -994,6 +995,13 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, buf[0], buf[1], buf[2], buf[3], freq / 1000000, (freq % 1000000) / 1000); + if (priv->ctrl.switch_mode) { + if (new_mode == T_ANALOG_TV) + do_tuner_callback(fe, SWITCH_TV_MODE, 0); + if (new_mode == T_DIGITAL_TV) + do_tuner_callback(fe, SWITCH_TV_MODE, 1); + } + rc = 0; ret: --- a/drivers/media/common/tuners/tuner-xc2028.h +++ b/drivers/media/common/tuners/tuner-xc2028.h @@ -42,6 +42,7 @@ struct xc2028_ctrl { unsigned int disable_power_mgmt:1; unsigned int read_not_reliable:1; unsigned int demod; + unsigned int switch_mode:1; enum firmware_type type:2; }; @@ -54,6 +55,7 @@ struct xc2028_config { /* xc2028 commands for callback */ #define XC2028_TUNER_RESET 0 #define XC2028_RESET_CLK 1 +#define SWITCH_TV_MODE 2 #if defined(CONFIG_MEDIA_TUNER_XC2028) || (defined(CONFIG_MEDIA_TUNER_XC2028_MODULE) && defined(MODULE)) extern struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -269,13 +291,33 @@ static int tm6000_tuner_callback(void *ptr, int component, int command, int arg) TM6000_GPIO_CLK, 0); if (rc<0) return rc; - msleep(100); + msleep(10); rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1); - msleep(100); + msleep(10); + break; + } + break; + + case SWITCH_TV_MODE: + /* switch between analog and digital */ + switch (arg) { + case 0: + printk(KERN_INFO "switch to analog"); + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6010_GPIO_5, 1); + printk(KERN_INFO "analog"); + break; + case 1: + printk(KERN_INFO "switch to digital"); + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6010_GPIO_5, 0); + printk(KERN_INFO "digital"); break; } + break; } + return (rc); } --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -235,7 +268,8 @@ int tm6000_dvb_register(struct tm6000_core *dev) .i2c_adap = &dev->i2c_adap, .i2c_addr = dev->tuner_addr, }; - + + dvb->frontend->callback = tm6000_tuner_callback; ret = dvb_register_frontend(&dvb->adapter, dvb->frontend); if (ret < 0) { printk(KERN_ERR --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -269,13 +291,33 @@ static int tm6000_tuner_callback(void *ptr, int component, int command, int arg) TM6000_GPIO_CLK, 0); if (rc<0) return rc; - msleep(100); + msleep(10); rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1); - msleep(100); + msleep(10); + break; + } + break; + + case SWITCH_TV_MODE: + /* switch between analog and digital */ + switch (arg) { + case 0: + printk(KERN_INFO "switch to analog"); + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6010_GPIO_5, 1); + printk(KERN_INFO "analog"); + break; + case 1: + printk(KERN_INFO "switch to digital"); + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6010_GPIO_5, 0); + printk(KERN_INFO "digital"); break; } + break; } + return (rc); }