From patchwork Wed Oct 13 21:30:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitri Belimov X-Patchwork-Id: 249831 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 o9D7TRC6007679 for ; Wed, 13 Oct 2010 07:29:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753121Ab0JMH3X (ORCPT ); Wed, 13 Oct 2010 03:29:23 -0400 Received: from mail-ew0-f46.google.com ([209.85.215.46]:57745 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752960Ab0JMH3W (ORCPT ); Wed, 13 Oct 2010 03:29:22 -0400 Received: by ewy20 with SMTP id 20so1892172ewy.19 for ; Wed, 13 Oct 2010 00:29:21 -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:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=a39H2eO8LRMvla81ZRBaP4nbbXooGkcXI464gMzGY34=; b=c7sPIlA9LHs5sbhNwd5AQ3MWmhEmsf4/jH4bZIMfl4e8J3/chOlNSRBsSap+R43Us0 mT1SEQM6vldaWQLSHI/wN+RTk3bnjPWx+BZljuDyRi8e2F5jXr/WiEVPkBTH5kZJb5// RmZ/CH5KUh6OQ4BxnrGewnISTOdMCUt+4Dhio= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=BoQsTmydud561svGTi1p+UYT3eCTkYOCSSx1FYhutw0vqi9hWLcGQFYDZWAhwmoZAO SPx/Dq227Da1hauONsY8fOgrFV7gsLYwS1HpXLT+O8kZf87PcCg+xZG4LfSlG8LBMUYZ Godkv76lX51dKpL+falCyB3ujSCnOdMA4S4E8= Received: by 10.213.21.133 with SMTP id j5mr175828ebb.95.1286954961338; Wed, 13 Oct 2010 00:29:21 -0700 (PDT) Received: from glory.local ([83.234.160.236]) by mx.google.com with ESMTPS id q54sm10575298eeh.0.2010.10.13.00.29.17 (version=SSLv3 cipher=RC4-MD5); Wed, 13 Oct 2010 00:29:18 -0700 (PDT) Date: Wed, 13 Oct 2010 17:30:10 -0400 From: Dmitri Belimov To: Devin Heitmueller Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Stefan Ringel , Bee Hock Goh Subject: [PATCH] xc5000 and switch RF input Message-ID: <20101013173010.74ee2827@glory.local> In-Reply-To: References: <20100518173011.5d9c7f2c@glory.loctelecom.ru> <20100525114939.067404eb@glory.loctelecom.ru> <4C32044C.3060007@redhat.com> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.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 (demeter1.kernel.org [140.211.167.41]); Wed, 13 Oct 2010 07:29:27 +0000 (UTC) diff -r 1da5fed5c8b2 linux/drivers/media/common/tuners/xc5000.c --- a/linux/drivers/media/common/tuners/xc5000.c Sun Sep 19 02:23:09 2010 -0300 +++ b/linux/drivers/media/common/tuners/xc5000.c Wed Oct 13 10:49:45 2010 +1000 @@ -903,10 +903,33 @@ switch (params->mode) { case V4L2_TUNER_RADIO: ret = xc5000_set_radio_freq(fe, params); + if (fe->callback) { + fe->callback(((fe->dvb) && (fe->dvb->priv)) ? + fe->dvb->priv : + priv->i2c_props.adap->algo_data, + DVB_FRONTEND_COMPONENT_TUNER, + XC5000_TUNER_SET_RADIO, 0); + } break; case V4L2_TUNER_ANALOG_TV: + ret = xc5000_set_tv_freq(fe, params); + if (fe->callback) { + fe->callback(((fe->dvb) && (fe->dvb->priv)) ? + fe->dvb->priv : + priv->i2c_props.adap->algo_data, + DVB_FRONTEND_COMPONENT_TUNER, + XC5000_TUNER_SET_ANALOG_TV, 0); + } + break; case V4L2_TUNER_DIGITAL_TV: ret = xc5000_set_tv_freq(fe, params); + if (fe->callback) { + fe->callback(((fe->dvb) && (fe->dvb->priv)) ? + fe->dvb->priv : + priv->i2c_props.adap->algo_data, + DVB_FRONTEND_COMPONENT_TUNER, + XC5000_TUNER_SET_DIGITAL_TV, 0); + } break; } diff -r 1da5fed5c8b2 linux/drivers/media/common/tuners/xc5000.h --- a/linux/drivers/media/common/tuners/xc5000.h Sun Sep 19 02:23:09 2010 -0300 +++ b/linux/drivers/media/common/tuners/xc5000.h Wed Oct 13 10:49:45 2010 +1000 @@ -35,6 +35,9 @@ /* xc5000 callback command */ #define XC5000_TUNER_RESET 0 +#define XC5000_TUNER_SET_RADIO 1 +#define XC5000_TUNER_SET_ANALOG_TV 2 +#define XC5000_TUNER_SET_DIGITAL_TV 3 /* Possible Radio inputs */ #define XC5000_RADIO_NOT_CONFIGURED 0 diff -r 1da5fed5c8b2 linux/drivers/media/video/saa7134/saa7134-cards.c --- a/linux/drivers/media/video/saa7134/saa7134-cards.c Sun Sep 19 02:23:09 2010 -0300 +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c Wed Oct 13 10:49:45 2010 +1000 @@ -6842,12 +6842,53 @@ case SAA7134_BOARD_BEHOLD_X7: case SAA7134_BOARD_BEHOLD_H7: case SAA7134_BOARD_BEHOLD_A7: - if (command == XC5000_TUNER_RESET) { - /* Down and UP pheripherial RESET pin for reset all chips */ + switch (command) { + case XC5000_TUNER_RESET: + /* Down/UP pheripherial RESET pin for reset all chips */ saa_writeb(SAA7134_SPECIAL_MODE, 0x00); msleep(10); saa_writeb(SAA7134_SPECIAL_MODE, 0x01); msleep(10); + break; + case XC5000_TUNER_SET_RADIO: + { + static u8 zl10353_ant2_enable[] = { 0x63, 0x40 }; + struct i2c_msg zl10353_msg = {.addr = 0x1e >> 1, + .flags = 0, .len = 2}; + + zl10353_msg.buf = zl10353_ant2_enable; + + /* Switch RF to the ANT2 source */ + if (i2c_transfer(&dev->i2c_adap, &zl10353_msg, 1) != 1) { + printk(KERN_INFO "could not access RF + source control\n"); + return -EIO; + } + + msleep(10); + } + break; + case XC5000_TUNER_SET_ANALOG_TV: + case XC5000_TUNER_SET_DIGITAL_TV: + { + static u8 zl10353_ant1_enable[] = { 0x63, 0x00 }; + struct i2c_msg zl10353_msg = {.addr = 0x1e >> 1, + .flags = 0, .len = 2}; + + zl10353_msg.buf = zl10353_ant1_enable; + + /* Switch RF to the ANT1 source */ + if (i2c_transfer(&dev->i2c_adap, &zl10353_msg, 1) != 1) { + printk(KERN_INFO "could not access RF + source control\n"); + return -EIO; + } + + msleep(10); + } + break; + default: + break; } break; default: Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov