From patchwork Tue Jul 15 07:58:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schwarzott X-Patchwork-Id: 24840 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1X6xdj-00025t-Bw; Tue, 15 Jul 2014 09:59:07 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-8) with esmtp id 1X6xdh-0008MR-jh; Tue, 15 Jul 2014 09:59:06 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757844AbaGOH7D (ORCPT + 1 other); Tue, 15 Jul 2014 03:59:03 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:36541 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752949AbaGOH7B (ORCPT ); Tue, 15 Jul 2014 03:59:01 -0400 Received: from gauss.fritz.box (host-188-174-204-36.customer.m-online.net [188.174.204.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zzam) by smtp.gentoo.org (Postfix) with ESMTPSA id EA91C33F281; Tue, 15 Jul 2014 07:58:59 +0000 (UTC) From: Matthias Schwarzott To: crope@iki.fi Cc: Matthias Schwarzott , Linux Media Mailing List Subject: [PATCH 1/2] si2157: Add support for spectrum inversion Date: Tue, 15 Jul 2014 09:58:39 +0200 Message-Id: <1405411120-9569-2-git-send-email-zzam@gentoo.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1405411120-9569-1-git-send-email-zzam@gentoo.org> References: <1405411120-9569-1-git-send-email-zzam@gentoo.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.7.15.75119 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' This is needed for PCTV 522e support. Modify all users of si2157_config to correctly initialize all not mentioned values to 0. Signed-off-by: Matthias Schwarzott --- drivers/media/tuners/si2157.c | 3 +++ drivers/media/tuners/si2157.h | 5 +++++ drivers/media/tuners/si2157_priv.h | 1 + drivers/media/usb/dvb-usb/cxusb.c | 3 +-- drivers/media/usb/em28xx/em28xx-dvb.c | 5 +++-- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index 329004f..4dbd3f1 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -253,6 +253,8 @@ static int si2157_set_params(struct dvb_frontend *fe) memcpy(cmd.args, "\x14\x00\x03\x07\x00\x00", 6); cmd.args[4] = delivery_system | bandwidth; + if (s->inversion) + cmd.args[5] = 0x01; cmd.wlen = 6; cmd.rlen = 1; ret = si2157_cmd_execute(s, &cmd); @@ -307,6 +309,7 @@ static int si2157_probe(struct i2c_client *client, s->client = client; s->fe = cfg->fe; + s->inversion = cfg->inversion; mutex_init(&s->i2c_mutex); /* check if the tuner is there */ diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h index 4465c46..6da4d5d 100644 --- a/drivers/media/tuners/si2157.h +++ b/drivers/media/tuners/si2157.h @@ -29,6 +29,11 @@ struct si2157_config { * frontend */ struct dvb_frontend *fe; + + /* + * Spectral Inversion + */ + bool inversion; }; #endif diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index db79f3c..3ddab5e 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -26,6 +26,7 @@ struct si2157 { struct i2c_client *client; struct dvb_frontend *fe; bool active; + bool inversion; }; /* firmare command struct */ diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index ad20c39..c94a704 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -1337,7 +1337,7 @@ static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap) struct i2c_client *client_tuner; struct i2c_board_info info; struct si2168_config si2168_config; - struct si2157_config si2157_config; + struct si2157_config si2157_config = { .fe = adap->fe_adap[0].fe }; /* reset the tuner */ if (cxusb_tt_ct2_4400_gpio_tuner(d, 0) < 0) { @@ -1371,7 +1371,6 @@ static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap) st->i2c_client_demod = client_demod; /* attach tuner */ - si2157_config.fe = adap->fe_adap[0].fe; 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 a121ed9..d472dc9 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1520,7 +1520,9 @@ static int em28xx_dvb_init(struct em28xx *dev) struct i2c_client *client; struct i2c_board_info info; struct si2168_config si2168_config; - struct si2157_config si2157_config; + struct si2157_config si2157_config = { + .fe = dvb->fe[0] + }; /* attach demod */ si2168_config.i2c_adapter = &adapter; @@ -1545,7 +1547,6 @@ static int em28xx_dvb_init(struct em28xx *dev) dvb->i2c_client_demod = client; /* attach tuner */ - si2157_config.fe = dvb->fe[0]; memset(&info, 0, sizeof(struct i2c_board_info)); strlcpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60;