From patchwork Thu Mar 7 23:11:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Alberto Reguero X-Patchwork-Id: 10843955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA13914E1 for ; Thu, 7 Mar 2019 23:12:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5EDB2F983 for ; Thu, 7 Mar 2019 23:12:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7AB82F98B; Thu, 7 Mar 2019 23:12:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A63E72F988 for ; Thu, 7 Mar 2019 23:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726266AbfCGXMA convert rfc822-to-8bit (ORCPT ); Thu, 7 Mar 2019 18:12:00 -0500 Received: from relayout02-q02.e.movistar.es ([86.109.101.152]:43025 "EHLO relayout02-q02.e.movistar.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726172AbfCGXMA (ORCPT ); Thu, 7 Mar 2019 18:12:00 -0500 Received: from relayout02-redir.e.movistar.es (relayout02-redir.e.movistar.es [86.109.101.202]) by relayout02-out.e.movistar.es (Postfix) with ESMTP id 44Fmby1fHnzhYXs; Fri, 8 Mar 2019 00:11:58 +0100 (CET) Received: from [192.168.0.167] (unknown [47.62.122.75]) (Authenticated sender: jareguero@telefonica.net) by relayout02.e.movistar.es (Postfix) with ESMTPA id 44Fmbx1h0szdZqS; Fri, 8 Mar 2019 00:11:57 +0100 (CET) Date: Fri, 08 Mar 2019 00:11:58 +0100 User-Agent: K-9 Mail for Android MIME-Version: 1.0 Subject: [PATCH V4 1/2] init i2c already in it930x_frontend_attach To: Linux media , Sean Young , Antti Palosaari , Andreas Kemnade , jose.alberto.reguero@gmail.com From: Jose Alberto Reguero Message-ID: <3280B2FE-5401-479F-BD3B-F4F48DA4E464@telefonica.net> X-CTCH-Score: 0.000 X-CTCH-ScoreCust: 0.000 X-TnetOut-Country: IP: 47.62.122.75 | Country: ES X-TnetOut-Information: AntiSPAM and AntiVIRUS on relayout02 X-TnetOut-MsgID: 44Fmbx1h0szdZqS.AA002 X-TnetOut-SpamCheck: no es spam, Unknown X-TnetOut-From: jareguero@telefonica.net X-TnetOut-Watermark: 1552605118.10246@Bpg7hcDNyXLJXQiFg6yYTg Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP i2c bus is already needed when the frontend is probed, so init it already in it930x_frontend_attach.That prevents errors like si2168: probe of 6-0067 failed with error -5 From: Andreas Kemnade Signed-off-by: Andreas Kemnade Signed-off-by: Jose Alberto Reguero diff -upr linux/drivers/media/usb/dvb-usb-v2/af9035.c linux.new/drivers/media/usb/dvb-usb-v2/af9035.c --- linux/drivers/media/usb/dvb-usb-v2/af9035.c 2018-09-12 07:40:12.000000000 +0200 +++ linux.new/drivers/media/usb/dvb-usb-v2/af9035.c 2019-02-20 16:45:17.467869437 +0100 @@ -1218,6 +1218,48 @@ static int it930x_frontend_attach(struct dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); + /* I2C master bus 2 clock speed 300k */ + ret = af9035_wr_reg(d, 0x00f6a7, 0x07); + if (ret < 0) + goto err; + + /* I2C master bus 1,3 clock speed 300k */ + ret = af9035_wr_reg(d, 0x00f103, 0x07); + if (ret < 0) + goto err; + + /* set gpio11 low */ + ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01); + if (ret < 0) + goto err; + + ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01); + if (ret < 0) + goto err; + + ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01); + if (ret < 0) + goto err; + + /* Tuner enable using gpiot2_en, gpiot2_on and gpiot2_o (reset) */ + ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01); + if (ret < 0) + goto err; + + ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01); + if (ret < 0) + goto err; + + ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01); + if (ret < 0) + goto err; + + msleep(200); + + ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01); + if (ret < 0) + goto err; + memset(&si2168_config, 0, sizeof(si2168_config)); si2168_config.i2c_adapter = &adapter; si2168_config.fe = &adap->fe[0]; @@ -1575,48 +1617,6 @@ static int it930x_tuner_attach(struct dv dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); - /* I2C master bus 2 clock speed 300k */ - ret = af9035_wr_reg(d, 0x00f6a7, 0x07); - if (ret < 0) - goto err; - - /* I2C master bus 1,3 clock speed 300k */ - ret = af9035_wr_reg(d, 0x00f103, 0x07); - if (ret < 0) - goto err; - - /* set gpio11 low */ - ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01); - if (ret < 0) - goto err; - - ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01); - if (ret < 0) - goto err; - - ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01); - if (ret < 0) - goto err; - - /* Tuner enable using gpiot2_en, gpiot2_on and gpiot2_o (reset) */ - ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01); - if (ret < 0) - goto err; - - ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01); - if (ret < 0) - goto err; - - ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01); - if (ret < 0) - goto err; - - msleep(200); - - ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01); - if (ret < 0) - goto err; - memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = adap->fe[0]; si2157_config.if_port = 1;