From patchwork Sat Jan 3 00:08:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Larsson X-Patchwork-Id: 27781 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Y7CH4-0004GY-0V; Sat, 03 Jan 2015 01:08:58 +0100 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 1Y7CH0-00063u-m8; Sat, 03 Jan 2015 01:08:56 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752456AbbACAIu (ORCPT + 1 other); Fri, 2 Jan 2015 19:08:50 -0500 Received: from smtp.bredband2.com ([83.219.192.166]:45907 "EHLO smtp.bredband2.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752377AbbACAIu (ORCPT ); Fri, 2 Jan 2015 19:08:50 -0500 Received: from localhost.localdomain (92-244-23-216.customers.ownit.se [92.244.23.216]) (Authenticated sender: ed8153) by smtp.bredband2.com (Postfix) with ESMTPA id B6C24D42F3; Sat, 3 Jan 2015 01:08:43 +0100 (CET) From: Benjamin Larsson To: crope@iki.fi Cc: Linux Media Mailing List Subject: [PATCH 1/1] rtl28xxu: swap frontend order for devices with slave demodulators Date: Sat, 3 Jan 2015 01:08:43 +0100 Message-Id: <1420243723-5685-1-git-send-email-benjamin@southpole.se> X-Mailer: git-send-email 2.1.0 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: 2015.1.3.27 X-PMX-Spam: Gauge=X, Probability=10%, Report=' HASHBUSTER_BLOCK_V2 0.5, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HASHBUSTER_BLOCK_V2_1 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' Signed-off-by: Benjamin Larsson --- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index ab48b5f..37f8825 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c @@ -863,6 +863,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) /* attach slave demodulator */ if (priv->slave_demod == SLAVE_DEMOD_MN88472) { + struct dvb_frontend *tmp_fe; struct mn88472_config mn88472_config = {}; mn88472_config.fe = &adap->fe[1]; @@ -887,7 +888,13 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) } priv->i2c_client_slave_demod = client; + + /* Swap frontend order */ + tmp_fe = adap->fe[0]; + adap->fe[0] = adap->fe[1]; + adap->fe[1] = tmp_fe; } else { + struct dvb_frontend *tmp_fe; struct mn88473_config mn88473_config = {}; mn88473_config.fe = &adap->fe[1]; @@ -909,6 +916,11 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) } priv->i2c_client_slave_demod = client; + + /* Swap frontend order */ + tmp_fe = adap->fe[0]; + adap->fe[0] = adap->fe[1]; + adap->fe[1] = tmp_fe; } } @@ -1144,12 +1156,6 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) &rtl28xxu_rtl2832_r820t_config, NULL); break; case TUNER_RTL2832_R828D: - fe = dvb_attach(r820t_attach, adap->fe[0], - priv->demod_i2c_adapter, - &rtl2832u_r828d_config); - adap->fe[0]->ops.read_signal_strength = - adap->fe[0]->ops.tuner_ops.get_rf_strength; - if (adap->fe[1]) { fe = dvb_attach(r820t_attach, adap->fe[1], priv->demod_i2c_adapter, @@ -1158,6 +1164,12 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) adap->fe[1]->ops.tuner_ops.get_rf_strength; } + fe = dvb_attach(r820t_attach, adap->fe[0], + priv->demod_i2c_adapter, + &rtl2832u_r828d_config); + adap->fe[0]->ops.read_signal_strength = + adap->fe[0]->ops.tuner_ops.get_rf_strength; + /* attach SDR */ dvb_attach_sdr(rtl2832_sdr_attach, adap->fe[0], &d->i2c_adap, &rtl28xxu_rtl2832_r820t_config, NULL); @@ -1373,7 +1385,7 @@ static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff) /* bypass slave demod TS through master demod */ if (fe->id == 1 && onoff) { - ret = rtl2832_enable_external_ts_if(adap->fe[0]); + ret = rtl2832_enable_external_ts_if(adap->fe[1]); if (ret) goto err; }