From patchwork Tue May 5 16:54:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 6339911 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 91C219F1C2 for ; Tue, 5 May 2015 16:54:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5713E201F4 for ; Tue, 5 May 2015 16:54:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E04AF200E0 for ; Tue, 5 May 2015 16:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030597AbbEEQyt (ORCPT ); Tue, 5 May 2015 12:54:49 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:33686 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030483AbbEEQyr (ORCPT ); Tue, 5 May 2015 12:54:47 -0400 Received: by layy10 with SMTP id y10so132531026lay.0 for ; Tue, 05 May 2015 09:54:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=YKRazxjfKm5hccwoIMrCcJldf/4e3F+9AZQ5KrRFjf0=; b=En1Ynh9gOaM/hS8po5d+4//VEVJ2K/hxKf9OoTkWyKhZMRaoGPh2Z7TcJq48ivj6rh yCjD320kfcy1/eF+UXt1qwsRl2W7+9HY3nGvha73uYhHv/wD5ZXdFhvZZoPqJ9qxm4cU RWYQWQ1oDOti7KWSIfDiACHVaJ/xXsn5+r6F4/zzkstRXzLaCrOvPBaCPS55lgco5ZNr d5D5DwEWvUi3agCPyJ/0TmcoSpH/RgQ49FFau9PGE5PHjARpHmKiNG6YEfM3dn5C5ZVC T8sS626R62PvTPG35flOfSs+kvyv0HxzYu/ZbIa29+FcvCFhK6nOUxEN+Gdo4g+Y/AEs N2iA== X-Gm-Message-State: ALoCoQl0mEKNH5awVUkZQUS6guqHty9O+kA3OQQ0Jr5wP/QGftu1GKDKMLOFujrcGuSPm7i4pgpb X-Received: by 10.112.97.202 with SMTP id ec10mr22905405lbb.4.1430844885335; Tue, 05 May 2015 09:54:45 -0700 (PDT) Received: from dl160.lan (188-67-118-178.bb.dnainternet.fi. [188.67.118.178]) by mx.google.com with ESMTPSA id z1sm4177919laz.48.2015.05.05.09.54.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 09:54:44 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH v4 4/6] si2157: support selection of IF interface Date: Tue, 5 May 2015 19:54:17 +0300 Message-Id: <1430844859-24947-5-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430844859-24947-1-git-send-email-olli.salonen@iki.fi> References: <1430844859-24947-1-git-send-email-olli.salonen@iki.fi> 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The chips supported by the si2157 driver have two IF outputs (either pins 12+13 or pins 9+11). Instead of hardcoding the output to be used add an option to choose which output shall be used. As this patch changes the default behaviour, the IF interface is specified in each driver currently using si2157 driver. This is to keep bisectability. Signed-off-by: Olli Salonen --- drivers/media/pci/cx23885/cx23885-dvb.c | 4 ++++ drivers/media/pci/saa7164/saa7164-dvb.c | 3 +++ drivers/media/pci/smipcie/smipcie.c | 1 + drivers/media/tuners/si2157.c | 4 +++- drivers/media/tuners/si2157.h | 6 ++++++ drivers/media/tuners/si2157_priv.h | 1 + drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 ++ drivers/media/usb/dvb-usb-v2/af9035.c | 1 + drivers/media/usb/dvb-usb-v2/dvbsky.c | 2 ++ drivers/media/usb/dvb-usb/cxusb.c | 1 + drivers/media/usb/em28xx/em28xx-dvb.c | 2 ++ 11 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 745caab..37fd013 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -1912,6 +1912,7 @@ static int dvb_register(struct cx23885_tsport *port) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = fe0->dvb.frontend; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; @@ -1957,6 +1958,7 @@ static int dvb_register(struct cx23885_tsport *port) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = fe0->dvb.frontend; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; @@ -2093,6 +2095,7 @@ static int dvb_register(struct cx23885_tsport *port) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = fe0->dvb.frontend; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; @@ -2172,6 +2175,7 @@ static int dvb_register(struct cx23885_tsport *port) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = fe0->dvb.frontend; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; diff --git a/drivers/media/pci/saa7164/saa7164-dvb.c b/drivers/media/pci/saa7164/saa7164-dvb.c index 9969800..e9a783b 100644 --- a/drivers/media/pci/saa7164/saa7164-dvb.c +++ b/drivers/media/pci/saa7164/saa7164-dvb.c @@ -111,6 +111,7 @@ static struct lgdt3306a_config hauppauge_hvr2255b_config = { static struct si2157_config hauppauge_hvr2255_tuner_config = { .inversion = 1, + .if_port = 1, }; static int si2157_attach(struct saa7164_port *port, struct i2c_adapter *adapter, @@ -665,6 +666,7 @@ int saa7164_dvb_register(struct saa7164_port *port) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); + si2157_config.if_port = 1; si2157_config.fe = port->dvb.frontend; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); @@ -710,6 +712,7 @@ int saa7164_dvb_register(struct saa7164_port *port) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = port->dvb.frontend; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0xc0 >> 1; diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c index 4115925..143fd78 100644 --- a/drivers/media/pci/smipcie/smipcie.c +++ b/drivers/media/pci/smipcie/smipcie.c @@ -657,6 +657,7 @@ static int smi_dvbsky_sit2_fe_attach(struct smi_port *port) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = port->fe; + si2157_config.if_port = 1; memset(&client_info, 0, sizeof(struct i2c_board_info)); strlcpy(client_info.type, "si2157", I2C_NAME_SIZE); diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index d74ae26..cdaf687 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe) if (dev->chiptype == SI2157_CHIPTYPE_SI2146) memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6); else - memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6); + memcpy(cmd.args, "\x14\x00\x02\x07\x00\x00", 6); + cmd.args[4] = dev->if_port; cmd.wlen = 6; cmd.rlen = 4; ret = si2157_cmd_execute(client, &cmd); @@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client, i2c_set_clientdata(client, dev); dev->fe = cfg->fe; dev->inversion = cfg->inversion; + dev->if_port = cfg->if_port; dev->fw_loaded = false; dev->chiptype = (u8)id->driver_data; dev->if_frequency = 5000000; /* default value of property 0x0706 */ diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h index a564c4a..4db97ab 100644 --- a/drivers/media/tuners/si2157.h +++ b/drivers/media/tuners/si2157.h @@ -34,6 +34,12 @@ struct si2157_config { * Spectral Inversion */ bool inversion; + + /* + * Port selection + * Select the RF interface to use (pins 9+11 or 12+13) + */ + u8 if_port; }; #endif diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index cd8fa5b..71a5f8c 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -28,6 +28,7 @@ struct si2157_dev { bool fw_loaded; bool inversion; u8 chiptype; + u8 if_port; u32 if_frequency; }; diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 610d567..66ee161 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -797,6 +797,7 @@ static int dvb_init(struct cx231xx *dev) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = dev->dvb->frontend; + si2157_config.if_port = 1; si2157_config.inversion = true; strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; @@ -852,6 +853,7 @@ static int dvb_init(struct cx231xx *dev) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = dev->dvb->frontend; + si2157_config.if_port = 1; si2157_config.inversion = true; strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 80a29f5..7b7f75d 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1569,6 +1569,7 @@ static int it930x_tuner_attach(struct dvb_usb_adapter *adap) memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = adap->fe[0]; + si2157_config.if_port = 1; ret = af9035_add_i2c_dev(d, "si2157", 0x63, &si2157_config, state->i2c_adapter_demod); diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index 0f73b1d..57c8c2d 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -549,6 +549,7 @@ static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = adap->fe[0]; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; @@ -633,6 +634,7 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = adap->fe[0]; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index ffc3704..ab71511 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -1350,6 +1350,7 @@ static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = adap->fe_adap[0].fe; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index a5b22c5..5b7c7c88 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1579,6 +1579,7 @@ static int em28xx_dvb_init(struct em28xx *dev) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = dvb->fe[0]; + si2157_config.if_port = 1; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; @@ -1639,6 +1640,7 @@ static int em28xx_dvb_init(struct em28xx *dev) /* attach tuner */ memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = dvb->fe[0]; + si2157_config.if_port = 0; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2146", I2C_NAME_SIZE); info.addr = 0x60;