From patchwork Wed Jan 30 10:32:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gon Solo X-Patchwork-Id: 10788165 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 EA5FB14E1 for ; Wed, 30 Jan 2019 10:32:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46FC2E6C5 for ; Wed, 30 Jan 2019 10:32:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C89782E75E; Wed, 30 Jan 2019 10:32:32 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 3C3D82E6C5 for ; Wed, 30 Jan 2019 10:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730707AbfA3Kc1 (ORCPT ); Wed, 30 Jan 2019 05:32:27 -0500 Received: from mail-wr1-f54.google.com ([209.85.221.54]:42030 "EHLO mail-wr1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730703AbfA3Kc0 (ORCPT ); Wed, 30 Jan 2019 05:32:26 -0500 Received: by mail-wr1-f54.google.com with SMTP id q18so25405675wrx.9; Wed, 30 Jan 2019 02:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=+rnZqE4S60seD2FdTfpbyFltki4Zf8ZNAwLWaQqbIqo=; b=sXvPfL2qysmFO/yB/3ggIuVflSH1fB1v28iRpLWCPEszYLZ3bMWCYP5MGwSCM6EhAQ 1gWywnnqX2pbrMhwAPEp8Bt6tMR3B0SKB0ih0fkqSjOxA6Gb3gMhU1Rp9/ZS5B5s9NoQ 1t+NPu/IZ5HmdryY8wP6D/YW4SXWbf0XOIpyIJS9zqeWRk3DTYdfzIIXwSBogYO11FBO Bu5uar3uBN5OzToujXRfGWYHIgGyHL8qnTv54AzTfOvbA3uDZ5cjKJnO8xTcgfeOLEHg RAo6lZIkUW6vW4g9BJBAcdBuiB0W+c2rQI0bK8iIMJU3SZNd7i/LQ9RudQm4mWg0B+A5 EGyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=+rnZqE4S60seD2FdTfpbyFltki4Zf8ZNAwLWaQqbIqo=; b=JqegzLCW2qyB6NjUol9jW3ltMr+xUf/uZMw7l4BOrpXCAzb3DV5S4YMV6rZk1Dg/7h oVxgshMUURby88/Njuj92oPEIrAZExm2Kcdsl9OVD348lDD9ZjyulHjaq6s8HwjgK4CG dqYjPgFxxMB0vgV3wzWuA94kNdXrq5IVjpEgOkmeEG8WyUvA1nYdPi23NyACqf487xPy OyvcXeK7UDNLmPfgtAhPqi8OdH5BXrqXRz6el32hGTpTqdOJ/8Cddij0Sv2dIl0WsI5L 1xph62x8pN6zcvJ78zVVCGYoQ5tNRUAixR9wpdK6K7qJntDuaY+ykRHZntW4m7TSr5vM m8QA== X-Gm-Message-State: AHQUAub0hq/4WVye2+EpyWwEJ/FbSQdUYmVWJtUUvW3HJ3qadDmNfkxC 8cb/rbhJyQTUNOmLSK96pI+14Q6eMVHmAcYEq1M= X-Google-Smtp-Source: AHgI3IZXKf7iknRdsdV7+Z22dFJncrcJQryO2ybsB9eW2KfMW2xc0x6NWordqnDDck7+QWAUzfjLyPm+VsrJm8oqsyk= X-Received: by 2002:adf:80a9:: with SMTP id 38mr15146737wrl.137.1548844343571; Wed, 30 Jan 2019 02:32:23 -0800 (PST) MIME-Version: 1.0 From: Gonsolo Date: Wed, 30 Jan 2019 11:32:12 +0100 Message-ID: Subject: DVB-T2 Stick To: crope@iki.fi, linux-media@vger.kernel.org, Linux Kernel 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 Hi! The following patch adds support for the Logilink VG0022A DVB-T2 stick. After patching and building the kernel it shows up with lsusb and I used w_scan to scan for channels and vlc for watching. The original patches were from Andreas Kemnade. The only thing that doesn't work is wake up after standby. Do you think you can apply this patch? Thanks diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index d389f1fc237a..1f923418ff10 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -84,7 +84,7 @@ static int si2157_init(struct dvb_frontend *fe) struct si2157_cmd cmd; const struct firmware *fw; const char *fw_name; - unsigned int uitmp, chip_id; + unsigned int uitmp; dev_dbg(&client->dev, "\n"); @@ -126,7 +126,7 @@ static int si2157_init(struct dvb_frontend *fe) if (ret) goto err; } - +#if 0 /* query chip revision */ memcpy(cmd.args, "\x02", 1); cmd.wlen = 1; @@ -146,6 +146,8 @@ static int si2157_init(struct dvb_frontend *fe) #define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0) switch (chip_id) { +#endif + switch (dev->chip_id) { case SI2158_A20: case SI2148_A20: fw_name = SI2158_A20_FIRMWARE; @@ -166,9 +168,9 @@ static int si2157_init(struct dvb_frontend *fe) goto err; } - dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n", - cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]); - +// dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n", +// cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]); +// if (fw_name == NULL) goto skip_fw_download; @@ -461,6 +463,38 @@ static int si2157_probe(struct i2c_client *client, memcpy(&fe->ops.tuner_ops, &si2157_ops, sizeof(struct dvb_tuner_ops)); fe->tuner_priv = client; + /* power up */ + if (dev->chiptype == SI2157_CHIPTYPE_SI2146) { + memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9); + cmd.wlen = 9; + } else { + memcpy(cmd.args, + "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", + 15); + cmd.wlen = 15; + } + cmd.rlen = 1; + ret = si2157_cmd_execute(client, &cmd); + if (ret) + goto err; + /* query chip revision */ + /* hack: do it here because after the si2168 gets 0101, commands will + * still be executed here but no result + */ + memcpy(cmd.args, "\x02", 1); + cmd.wlen = 1; + cmd.rlen = 13; + ret = si2157_cmd_execute(client, &cmd); + if (ret) + goto err_kfree; + dev->chip_id = cmd.args[1] << 24 | + cmd.args[2] << 16 | + cmd.args[3] << 8 | + cmd.args[4] << 0; + dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n", + cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]); + + #ifdef CONFIG_MEDIA_CONTROLLER if (cfg->mdev) { dev->mdev = cfg->mdev; diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index 50f86300d965..3592146cf49a 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -37,6 +37,7 @@ struct si2157_dev { u8 chiptype; u8 if_port; u32 if_frequency; + u32 chip_id; struct delayed_work stat_work; #if defined(CONFIG_MEDIA_CONTROLLER) @@ -51,6 +52,13 @@ struct si2157_dev { #define SI2157_CHIPTYPE_SI2146 1 #define SI2157_CHIPTYPE_SI2141 2 +#define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0) +#define SI2148_A20 ('A' << 24 | 48 << 16 | '2' << 8 | '0' << 0) +#define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0) +#define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0) +#define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0) +#define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0) + /* firmware command struct */ #define SI2157_ARGLEN 30 struct si2157_cmd { diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 80d3bd3a0f24..28b073bfe0d4 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1216,8 +1216,51 @@ static int it930x_frontend_attach(struct dvb_usb_adapter *adap) struct si2168_config si2168_config; struct i2c_adapter *adapter; - dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); - + //dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); + dev_dbg(&intf->dev, "%s adap->id=%d\n", __func__, 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]; @@ -2128,6 +2171,8 @@ static const struct usb_device_id af9035_id_table[] = { /* IT930x devices */ { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9303, &it930x_props, "ITE 9303 Generic", NULL) }, + { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x0100, + &it930x_props, "Logilink VG0022A", NULL) }, { } }; MODULE_DEVICE_TABLE(usb, af9035_id_table);