From patchwork Sat Jan 30 08:04:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ivanov <123kash@gmail.com> X-Patchwork-Id: 75873 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 o0U84d30028470 for ; Sat, 30 Jan 2010 08:04:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752353Ab0A3IEi (ORCPT ); Sat, 30 Jan 2010 03:04:38 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752219Ab0A3IEi (ORCPT ); Sat, 30 Jan 2010 03:04:38 -0500 Received: from mail-bw0-f227.google.com ([209.85.218.227]:63997 "EHLO mail-bw0-f227.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751902Ab0A3IEh (ORCPT ); Sat, 30 Jan 2010 03:04:37 -0500 Received: by bwz27 with SMTP id 27so1979918bwz.21 for ; Sat, 30 Jan 2010 00:04:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=qtx4gGJC9KIIg6l8pV/aDt050CAa7wUjh9dDFg/qFeY=; b=tVSzeyfTihqOTafIhcrgDX27go/Au0kskY4pSiL2o6SEauKaIq9EOornQ7T/QDQfbO yxuLBMJ7qyY3uTErLhsFSW7gp5808+XLTikt8+GAn2ifK6W/qvZC4l598XDoRgYGnYfS lUYuCT4/5jvsF548y8Pj3OivQJZcoYqRXmfy0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=lMBuv0qZj7Lg3YHWet+Pm4hHGpL3marm0c0GmZha0WYRdd2UneylaZnk5v0eM3FJF+ o/J4YSOAT8xnhjOu8IOeFuYKbi447LuZd0Qu/8cWC20k9WoLC/I8+sBmrFYD/d+rr4eN 60t53O1jh/nvaInxgqUWLcfnCSGWDm6hl8wHA= MIME-Version: 1.0 Received: by 10.204.156.27 with SMTP id u27mr568389bkw.61.1264838674977; Sat, 30 Jan 2010 00:04:34 -0800 (PST) In-Reply-To: References: Date: Sat, 30 Jan 2010 11:04:34 +0300 Message-ID: Subject: [PATCH] Add support for Twinhan 1027 DVB-S card From: Sergey Ivanov <123kash@gmail.com> To: linux-media@vger.kernel.org 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]); Sat, 30 Jan 2010 08:04:39 +0000 (UTC) diff -r d6520e486ee6 linux/drivers/media/video/cx88/cx88-dvb.c --- a/linux/drivers/media/video/cx88/cx88-dvb.c Sat Jan 30 01:27:34 2010 -0200 +++ b/linux/drivers/media/video/cx88/cx88-dvb.c Sat Jan 30 11:02:24 2010 +0300 @@ -57,6 +57,7 @@ #include "stv0900.h" #include "stb6100.h" #include "stb6100_proc.h" +#include "mb86a16.h" MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); MODULE_AUTHOR("Chris Pascoe "); @@ -251,6 +252,10 @@ .if2 = 45600, }; +static struct mb86a16_config twinhan_vp1027 = { + .demod_address = 0x08, +}; + #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) { @@ -430,15 +435,41 @@ cx_set(MO_GP0_IO, 0x6040); switch (voltage) { - case SEC_VOLTAGE_13: - cx_clear(MO_GP0_IO, 0x20); - break; - case SEC_VOLTAGE_18: - cx_set(MO_GP0_IO, 0x20); - break; - case SEC_VOLTAGE_OFF: - cx_clear(MO_GP0_IO, 0x20); - break; + case SEC_VOLTAGE_13: + cx_clear(MO_GP0_IO, 0x20); + break; + case SEC_VOLTAGE_18: + cx_set(MO_GP0_IO, 0x20); + break; + case SEC_VOLTAGE_OFF: + cx_clear(MO_GP0_IO, 0x20); + break; + } + + if (core->prev_set_voltage) + return core->prev_set_voltage(fe, voltage); + return 0; +} + +static int vp1027_set_voltage(struct dvb_frontend *fe, + fe_sec_voltage_t voltage) +{ + struct cx8802_dev *dev = fe->dvb->priv; + struct cx88_core *core = dev->core; + + switch (voltage) { + case SEC_VOLTAGE_13: + dprintk(1, "LNB SEC Voltage=13\n"); + cx_write(MO_GP0_IO, 0x00001220); + break; + case SEC_VOLTAGE_18: + dprintk(1, "LNB SEC Voltage=18\n"); + cx_write(MO_GP0_IO, 0x00001222); + break; + case SEC_VOLTAGE_OFF: + dprintk(1, "LNB Voltage OFF\n"); + cx_write(MO_GP0_IO, 0x00001230); + break; } if (core->prev_set_voltage) @@ -1210,6 +1241,19 @@ } break; } + case CX88_BOARD_TWINHAN_VP1027_DVBS: + dev->ts_gen_cntrl = 0x00; + fe0->dvb.frontend = dvb_attach(mb86a16_attach, + &twinhan_vp1027, + &core->i2c_adap); + if (fe0->dvb.frontend) { + core->prev_set_voltage = + fe0->dvb.frontend->ops.set_voltage; + fe0->dvb.frontend->ops.set_voltage = + vp1027_set_voltage; + } + break; + default: printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", core->name); diff -r d6520e486ee6 linux/drivers/media/video/cx88/cx88.h --- a/linux/drivers/media/video/cx88/cx88.h Sat Jan 30 01:27:34 2010 -0200 +++ b/linux/drivers/media/video/cx88/cx88.h Sat Jan 30 11:02:24 2010 +0300 @@ -240,6 +240,7 @@ #define CX88_BOARD_WINFAST_DTV1800H 81 #define CX88_BOARD_WINFAST_DTV2000H_J 82 #define CX88_BOARD_PROF_7301 83 +#define CX88_BOARD_TWINHAN_VP1027_DVBS 84 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1,