From patchwork Tue Jul 22 15:54:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Alves X-Patchwork-Id: 4604111 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4E4F3C0514 for ; Tue, 22 Jul 2014 15:54:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D0CC20148 for ; Tue, 22 Jul 2014 15:54:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7090B20142 for ; Tue, 22 Jul 2014 15:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755835AbaGVPyZ (ORCPT ); Tue, 22 Jul 2014 11:54:25 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:59062 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755465AbaGVPyY (ORCPT ); Tue, 22 Jul 2014 11:54:24 -0400 Received: by mail-wi0-f182.google.com with SMTP id d1so682510wiv.15 for ; Tue, 22 Jul 2014 08:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=itP/+l1SDiH7pPifruF+e73SJg4pZPAZRDOFJd4UQzM=; b=Qp7C77NUTm7cfqEmIYiy3X8sMyqE33orwLo0g3Nb1okxN9N7YI12xOkrHO1J816Vd1 aMiOrKTl8Sl4zkCjacxXNfyzWq8EPz7mDp+qPF8+DWN83jL5Okz2SttRxRHNN2rBq18J dqQzKe4NuJEITDzSWcTZVUqOYtCvJFwAlgToCePXmnwBf7jpw9OoEOBY9MFqbS+X28lM 8nzJlSgozA/RJHC2wjTQ1xio+N8n21NrT32e/wX05+3QO9B6uO5xS2Yz7vw33hhhEfHf /NqvvU115ccIZiXtRnuSwJSzzyWCpKQF5ay5SapDsc/RB8vd05HZNZn1RXPcVnlQoPIg IqtQ== X-Received: by 10.180.189.234 with SMTP id gl10mr15884344wic.56.1406044462014; Tue, 22 Jul 2014 08:54:22 -0700 (PDT) Received: from localhost.localdomain (a89-152-208-230.cpe.netcabo.pt. [89.152.208.230]) by mx.google.com with ESMTPSA id de5sm3977074wib.18.2014.07.22.08.54.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Jul 2014 08:54:21 -0700 (PDT) From: Luis Alves To: linux-media@vger.kernel.org Cc: crope@iki.fi, Luis Alves Subject: [PATCH] si2168: Add ts_mode config. Date: Tue, 22 Jul 2014 16:54:17 +0100 Message-Id: <1406044457-15923-1-git-send-email-ljalvs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the TS mode as a config option: - ts_mode added to config struct. - Possible (interesting) values are * Parallel mode = 0x06 * Serial mode = 0x03 Currently the modules using this demod only use parallel mode. Regards, Luis Signed-off-by: Luis Alves --- drivers/media/dvb-frontends/si2168.c | 17 ++++++++++------- drivers/media/dvb-frontends/si2168.h | 6 ++++++ drivers/media/usb/dvb-usb/cxusb.c | 1 + drivers/media/usb/em28xx/em28xx-dvb.c | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c index 41bdbc4..d45a1c6 100644 --- a/drivers/media/dvb-frontends/si2168.c +++ b/drivers/media/dvb-frontends/si2168.c @@ -297,13 +297,6 @@ static int si2168_set_frontend(struct dvb_frontend *fe) if (ret) goto err; - memcpy(cmd.args, "\x14\x00\x01\x10\x16\x00", 6); - cmd.wlen = 6; - cmd.rlen = 4; - ret = si2168_cmd_execute(s, &cmd); - if (ret) - goto err; - memcpy(cmd.args, "\x14\x00\x09\x10\xe3\x18", 6); cmd.wlen = 6; cmd.rlen = 4; @@ -350,6 +343,7 @@ err: static int si2168_init(struct dvb_frontend *fe) { struct si2168 *s = fe->demodulator_priv; + struct si2168_config *config = s->client->dev.platform_data; int ret, len, remaining; const struct firmware *fw = NULL; u8 *fw_file; @@ -479,6 +473,15 @@ static int si2168_init(struct dvb_frontend *fe) dev_info(&s->client->dev, "%s: found a '%s' in warm state\n", KBUILD_MODNAME, si2168_ops.info.name); + /* Set TSMODE */ + memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6); + cmd.args[4] |= config->ts_mode; + cmd.wlen = 6; + cmd.rlen = 4; + ret = si2168_cmd_execute(s, &cmd); + if (ret) + goto err; + s->active = true; return 0; diff --git a/drivers/media/dvb-frontends/si2168.h b/drivers/media/dvb-frontends/si2168.h index 3c5b5ab..ebbf309 100644 --- a/drivers/media/dvb-frontends/si2168.h +++ b/drivers/media/dvb-frontends/si2168.h @@ -34,6 +34,12 @@ struct si2168_config { * returned by driver */ struct i2c_adapter **i2c_adapter; + + /* TS mode */ + u8 ts_mode; }; +#define SI2168_TSMODE_PARALLEL 0x06 +#define SI2168_TSMODE_SERIAL 0x03 + #endif diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index b7461ac..18a2720 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -1369,6 +1369,7 @@ static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap) /* attach frontend */ si2168_config.i2c_adapter = &adapter; si2168_config.fe = &adap->fe_adap[0].fe; + si2168_config.ts_mode = SI2168_TSMODE_PARALLEL; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2168", I2C_NAME_SIZE); info.addr = 0x64; diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index 96a0bdb..27d5d84 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1525,6 +1525,7 @@ static int em28xx_dvb_init(struct em28xx *dev) /* attach demod */ si2168_config.i2c_adapter = &adapter; si2168_config.fe = &dvb->fe[0]; + si2168_config.ts_mode = SI2168_TSMODE_PARALLEL; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2168", I2C_NAME_SIZE); info.addr = 0x64;