From patchwork Wed Feb 20 21:36:04 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: 10822733 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 A1F2E6C2 for ; Wed, 20 Feb 2019 21:36:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F0682EAE2 for ; Wed, 20 Feb 2019 21:36:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81FA92F6A2; Wed, 20 Feb 2019 21:36:04 +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 E53FB2EAE2 for ; Wed, 20 Feb 2019 21:36:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726738AbfBTVgD convert rfc822-to-8bit (ORCPT ); Wed, 20 Feb 2019 16:36:03 -0500 Received: from relayout03-q02.e.movistar.es ([86.109.101.162]:48557 "EHLO relayout03-q02.e.movistar.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbfBTVgD (ORCPT ); Wed, 20 Feb 2019 16:36:03 -0500 Received: from relayout03-redir.e.movistar.es (relayout03-redir.e.movistar.es [86.109.101.203]) by relayout03-out.e.movistar.es (Postfix) with ESMTP id 444WBB16DLzQjq8; Wed, 20 Feb 2019 22:36:02 +0100 (CET) Received: from [192.168.0.161] (static-146-187-224-77.ipcom.comunitel.net [77.224.187.146]) (Authenticated sender: jareguero@telefonica.net) by relayout03.e.movistar.es (Postfix) with ESMTPA id 444WB728wRzMlJl; Wed, 20 Feb 2019 22:35:59 +0100 (CET) Date: Wed, 20 Feb 2019 22:36:04 +0100 User-Agent: K-9 Mail for Android MIME-Version: 1.0 Subject: [PATCH V2 1/2] af9035: init i2c already in it930x_frontend_attach To: Linux media , Sean Young , Antti Palosaari , jose.alberto.reguero@gmail.com From: Jose Alberto Reguero Message-ID: <77409C7A-37D1-45F1-A188-97FF92C79699@telefonica.net> X-CTCH-Score: 0.000 X-CTCH-ScoreCust: 0.000 X-TnetOut-Country: IP: 77.224.187.146 | Country: ES X-TnetOut-Information: AntiSPAM and AntiVIRUS on relayout03 X-TnetOut-MsgID: 444WB728wRzMlJl.A4412 X-TnetOut-SpamCheck: no es spam, Unknown X-TnetOut-From: jareguero@telefonica.net X-TnetOut-Watermark: 1551303361.84634@LBjBn959frLmDl0mMqcfKg 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 This patch init i2c in it930x_frontend_attach instead of it930x_tuner_attach. From: 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; From patchwork Wed Feb 20 21:36:16 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: 10822735 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 E102C6C2 for ; Wed, 20 Feb 2019 21:36:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE15E2F69C for ; Wed, 20 Feb 2019 21:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C27FD2F6A2; Wed, 20 Feb 2019 21:36:16 +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 61B1C2F69C for ; Wed, 20 Feb 2019 21:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726886AbfBTVgQ convert rfc822-to-8bit (ORCPT ); Wed, 20 Feb 2019 16:36:16 -0500 Received: from relayout02-q01.e.movistar.es ([86.109.101.151]:64721 "EHLO relayout02-q01.e.movistar.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbfBTVgP (ORCPT ); Wed, 20 Feb 2019 16:36:15 -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 444WBQ1fwNzhYNB; Wed, 20 Feb 2019 22:36:14 +0100 (CET) Received: from [192.168.0.161] (static-146-187-224-77.ipcom.comunitel.net [77.224.187.146]) (Authenticated sender: jareguero@telefonica.net) by relayout02.e.movistar.es (Postfix) with ESMTPA id 444WBP1rSVzdZTC; Wed, 20 Feb 2019 22:36:13 +0100 (CET) Date: Wed, 20 Feb 2019 22:36:16 +0100 User-Agent: K-9 Mail for Android MIME-Version: 1.0 Subject: [PATCH V2 2/2] Add suport for Avermedia TD310 To: Linux media , Sean Young , Antti Palosaari , jose.alberto.reguero@gmail.com From: Jose Alberto Reguero Message-ID: <97905686-6FE3-4EFE-9B1B-B137631FBAD3@telefonica.net> X-CTCH-Score: 0.000 X-CTCH-ScoreCust: 0.000 X-TnetOut-Country: IP: 77.224.187.146 | Country: ES X-TnetOut-Information: AntiSPAM and AntiVIRUS on relayout02 X-TnetOut-MsgID: 444WBP1rSVzdZTC.A912B X-TnetOut-SpamCheck: no es spam, Unknown X-TnetOut-From: jareguero@telefonica.net X-TnetOut-Watermark: 1551303374.11288@b77kPQxJEJuQNhR15+ftYw 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 This patch add support for Avermedia TD310 usb stik. 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 2019-02-20 16:54:24.121847069 +0100 +++ linux.new/drivers/media/usb/dvb-usb-v2/af9035.c 2019-02-20 16:53:50.148848459 +0100 @@ -1215,6 +1215,7 @@ static int it930x_frontend_attach(struct int ret; struct si2168_config si2168_config; struct i2c_adapter *adapter; + u8 i2c_addr; dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); @@ -1267,7 +1268,11 @@ static int it930x_frontend_attach(struct state->af9033_config[adap->id].fe = &adap->fe[0]; state->af9033_config[adap->id].ops = &state->ops; - ret = af9035_add_i2c_dev(d, "si2168", 0x67, &si2168_config, + i2c_addr = 0x67; + if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) && + (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_TD310)) + i2c_addr = 0x64; + ret = af9035_add_i2c_dev(d, "si2168", i2c_addr, &si2168_config, &d->i2c_adap); if (ret) goto err; @@ -1614,13 +1619,20 @@ static int it930x_tuner_attach(struct dv struct usb_interface *intf = d->intf; int ret; struct si2157_config si2157_config; + u8 i2c_addr; dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); 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, + i2c_addr = 0x63; + if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) && + (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_TD310)) { + i2c_addr = 0x60; + si2157_config.if_port = 0; + } + ret = af9035_add_i2c_dev(d, "si2157", i2c_addr, &si2157_config, state->i2c_adapter_demod); if (ret) @@ -2128,6 +2140,8 @@ static const struct usb_device_id af9035 /* IT930x devices */ { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9303, &it930x_props, "ITE 9303 Generic", NULL) }, + { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD310, + &it930x_props, "AVerMedia TD310 DVB-T2", NULL) }, { } }; MODULE_DEVICE_TABLE(usb, af9035_id_table); diff -upr linux/include/media/dvb-usb-ids.h linux.new/include/media/dvb-usb-ids.h --- linux/include/media/dvb-usb-ids.h 2018-05-05 07:40:18.000000000 +0200 +++ linux.new/include/media/dvb-usb-ids.h 2019-02-20 16:53:50.149848459 +0100 @@ -258,6 +258,7 @@ #define USB_PID_AVERMEDIA_A867 0xa867 #define USB_PID_AVERMEDIA_H335 0x0335 #define USB_PID_AVERMEDIA_TD110 0xa110 +#define USB_PID_AVERMEDIA_TD310 0x1871 #define USB_PID_AVERMEDIA_TWINSTAR 0x0825 #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 #define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM 0x3009