From patchwork Thu Oct 10 09:51:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gon Solo X-Patchwork-Id: 11183053 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F084776 for ; Thu, 10 Oct 2019 09:51:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D03142190F for ; Thu, 10 Oct 2019 09:51:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TFMhmNn6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387802AbfJJJvh (ORCPT ); Thu, 10 Oct 2019 05:51:37 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34101 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387400AbfJJJvg (ORCPT ); Thu, 10 Oct 2019 05:51:36 -0400 Received: by mail-wr1-f67.google.com with SMTP id j11so7070393wrp.1; Thu, 10 Oct 2019 02:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vR/97ha/8nINLtKlRJDAXkvt7wXAGo20zdsTBey8WDA=; b=TFMhmNn6fd8Y1HE/9jdGNBq/1CtQEn8SEuHZY+IeRl2wMKOOVecFJe6MvzmHxl+RrD 5F4uJ9KO/neqIpGzQ/csSMhvjHQ1Wkc80+Qo8IDcavhMaRfx5pzjrz6qDplsJ/d1IOa8 J1vPTfyIqm8kQUA8KQc8Z8RIthCeNnwwy7xJ9hNRuysUkHUsOZs/j88/Ri6fYg5iahYJ kXz8IKfxSwZM2UmYdtEvhh0ep3HfktR1X4WO1J4/MJxNvo7WF9NXnBV4xkQ8/0mbr+YX 9/90WAoaS617Oq30MP+L3lo94v2mCjFqc4bJO0GH85PNtl4D9PXTOR9Z3v2r5yTY6JkE OFxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vR/97ha/8nINLtKlRJDAXkvt7wXAGo20zdsTBey8WDA=; b=AEl0UpMTdgyy65GdoSqWogNJdKlpNJ9bvzXFcbS6w+NubSl3+WPMykOhvxZfnD5h9g bWtZNNQskSX102ZRxA2pYvgyqMy961838kAAiibGDN0DWi3Zg6yn1vsOUv2DsVlspl5k WSIam7fYxz0ycHjLwGW0xhzeHe0Pb49XFYbDyZq39bRlg6tmTQn5D9K/yKCu2TQaxCR0 2cJqMgDFb8AU2cBgS6JN1evJiEEWYYWsZim5XgDiCmjReg4KvgrcPOGpesgzBgd8kqEy BxGl4/lP7kvraSfETZj0y0TfjmWnN4IvjDjwlIMWHt/KPMGhowcmoTmr6hQfswXNMs9u sH8w== X-Gm-Message-State: APjAAAXOSabEnQrj3CNFoCU3r5i7eW/LXzCAaCDsSB8AxSfxxW9KikV4 PHYsLPm39XGLag8DlgY4beI= X-Google-Smtp-Source: APXvYqylf9nKxM3hVAWOugW/T0Pu5gy0Ed8GhiFvEZKb4vDEJGSpBHTcvlBCKf38r+fOzZBQA9UzHg== X-Received: by 2002:adf:e688:: with SMTP id r8mr8260370wrm.342.1570701092960; Thu, 10 Oct 2019 02:51:32 -0700 (PDT) Received: from localhost.localdomain ([46.114.37.24]) by smtp.googlemail.com with ESMTPSA id o4sm11678251wre.91.2019.10.10.02.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 02:51:32 -0700 (PDT) From: Gon Solo To: mchehab+samsung@kernel.org Cc: linux-media@vger.kernel.org, mchehab@infradead.org, jp@jpvw.nl, crope@iki.fi, sean@mess.org, linux-kernel@vger.kernel.org, Gon Solo Subject: [PATCH 1/4] si2168: Use bits and convert to kernel-doc format. Date: Thu, 10 Oct 2019 11:51:00 +0200 Message-Id: <20191010095103.3803-2-gonsolo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191010091848.GA2898@Limone> References: <20191010091848.GA2898@Limone> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Gon Solo --- drivers/media/dvb-frontends/si2168.h | 47 +++++++++++++---------- drivers/media/dvb-frontends/si2168_priv.h | 10 ++--- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/drivers/media/dvb-frontends/si2168.h b/drivers/media/dvb-frontends/si2168.h index 50dccb394efa..ecd21adf8950 100644 --- a/drivers/media/dvb-frontends/si2168.h +++ b/drivers/media/dvb-frontends/si2168.h @@ -9,38 +9,43 @@ #define SI2168_H #include -/* - * I2C address - * 0x64 +/** + * struct si2168_config - configuration parameters for si2168 + * + * @fe: + * frontend returned by driver + * @i2c_adapter: + * tuner I2C adapter returned by driver + * @ts_mode: + * Transport Stream mode. Can be: + * - %SI2168_TS_PARALLEL + * - %SI2168_TS_SERIAL + * - %SI2168_TS_TRISTATE + * - %SI2168_TS_CLK_MANUAL + * @ts_clock_inv: + * TS clock inverted + * @ts_clock_gapped: + * TS clock gapped + * @spectral_inversion: + * Inverted spectrum + * + * Note: + * The I2C address of this demod is 0x64. */ struct si2168_config { - /* - * frontend - * returned by driver - */ struct dvb_frontend **fe; - - /* - * tuner I2C adapter - * returned by driver - */ struct i2c_adapter **i2c_adapter; - /* TS mode */ #define SI2168_TS_PARALLEL 0x06 #define SI2168_TS_SERIAL 0x03 #define SI2168_TS_TRISTATE 0x00 #define SI2168_TS_CLK_MANUAL 0x20 u8 ts_mode; - /* TS clock inverted */ - bool ts_clock_inv; - - /* TS clock gapped */ - bool ts_clock_gapped; - - /* Inverted spectrum */ - bool spectral_inversion; + /* Flags */ + unsigned int ts_clock_inv:1; + unsigned int ts_clock_gapped:1; + unsigned int spectral_inversion:1; }; #endif diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h index 804d5b30c697..18bea5222082 100644 --- a/drivers/media/dvb-frontends/si2168_priv.h +++ b/drivers/media/dvb-frontends/si2168_priv.h @@ -34,12 +34,12 @@ struct si2168_dev { unsigned int chip_id; unsigned int version; const char *firmware_name; - bool active; - bool warm; u8 ts_mode; - bool ts_clock_inv; - bool ts_clock_gapped; - bool spectral_inversion; + unsigned int active:1; + unsigned int warm:1; + unsigned int ts_clock_inv:1; + unsigned int ts_clock_gapped:1; + unsigned int spectral_inversion:1; }; /* firmware command struct */ From patchwork Thu Oct 10 09:51:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gon Solo X-Patchwork-Id: 11183061 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39F3676 for ; Thu, 10 Oct 2019 09:51:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C01D218AC for ; Thu, 10 Oct 2019 09:51:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nmdsPV5M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387871AbfJJJvh (ORCPT ); Thu, 10 Oct 2019 05:51:37 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51220 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387791AbfJJJvh (ORCPT ); Thu, 10 Oct 2019 05:51:37 -0400 Received: by mail-wm1-f65.google.com with SMTP id 7so6218517wme.1; Thu, 10 Oct 2019 02:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jC8sod3IK3MEfPEVtwNiX6u+A/D3kZVyjuptbX8nh2k=; b=nmdsPV5Mjr9w0p/bozHVlWvJgjufvIdwfAXEVF6YGmdOa8XI1UEfG3jG6G7l+2GUJ7 /XdgxIdG6jFbZZvHulVeJOumDkrzEfV8tmPOe1FN9YP8jcvflZpRgfJGRVz24fImYUuq LK85SgKS5I0ruMbfXizbcE0Y/PhPnpOOpwUhhyHgYLFppVmwjl0eW28ZBIK0y/KZmJNP wYeWi2e38bnFnTDZU9PkcwMtXPlQi3+caxjBz5zzB6AsP3LTYGcaTYcZif4OojcTpmGO /nZO2DGIVZZ95vYzfU2hEuJ61mQy2dROZcp0+7Soq6QAOx611R8Lh5TqKliZXG7SkmU0 tXNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jC8sod3IK3MEfPEVtwNiX6u+A/D3kZVyjuptbX8nh2k=; b=oQr0UDvFGYV2fkvzlkLNMgVpEOIaSjr8ushg6TN9zHy4ybHXLIi3RK50hvCQGOjRdZ n6IEi+6pnfU2tSvq7AYgy+Xg77F4kYW3MeVmAQ5/2sSdYn+VaQWqSHUHWxLwPPBOXLhc vdicwblp15b1dMGk6HA3Fl9MC6cFG5O5EcU1NrvO1k1yXgzcVxjOwn7Qt8nc3LHpkAaJ CBXq6p0pxZMwfzL6pqoO1kQ+IC/oru8SeeSWu7/S7p8TKlSg4IuxPmBs1x6bFXHAYwS/ gRkVLbIO8v5eQNKrUwyHu9tMdKh3yrVbbZ2MsmJp2OckAx3xTOoOJDHSCqnJqz1W6wNV XwtA== X-Gm-Message-State: APjAAAVmlO0CqgjeHkclUnCfjoNj5AJT/SG4YvKlaoijXWIYu2DyBCA0 Aj+P7fCmd3o+sSedk+MIpEXJBJeo X-Google-Smtp-Source: APXvYqxKLn7x0hopMV3fSEWhlTjEba4RBIu6XjvuvKFjvMKkDVqYJjzkcjmHBvgmafFOArnmsIGhRw== X-Received: by 2002:a05:600c:2185:: with SMTP id e5mr7096154wme.78.1570701094206; Thu, 10 Oct 2019 02:51:34 -0700 (PDT) Received: from localhost.localdomain ([46.114.37.24]) by smtp.googlemail.com with ESMTPSA id o4sm11678251wre.91.2019.10.10.02.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 02:51:33 -0700 (PDT) From: Gon Solo To: mchehab+samsung@kernel.org Cc: linux-media@vger.kernel.org, mchehab@infradead.org, jp@jpvw.nl, crope@iki.fi, sean@mess.org, linux-kernel@vger.kernel.org, Gon Solo Subject: [PATCH 2/4] si2157: Add option for not downloading firmware. Date: Thu, 10 Oct 2019 11:51:01 +0200 Message-Id: <20191010095103.3803-3-gonsolo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191010091848.GA2898@Limone> References: <20191010091848.GA2898@Limone> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org While at it, convert to kernel-doc format and use bits instead of bools. Signed-off-by: Gon Solo --- drivers/media/tuners/si2157.c | 6 ++++++ drivers/media/tuners/si2157.h | 33 +++++++++++++++++------------- drivers/media/tuners/si2157_priv.h | 5 +++-- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index e87040d6eca7..898e0f9f8b70 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -118,6 +118,11 @@ static int si2157_init(struct dvb_frontend *fe) goto err; } + if (dev->dont_load_firmware) { + dev_info(&client->dev, "device is buggy, skipping firmware download\n"); + goto skip_fw_download; + } + /* query chip revision */ memcpy(cmd.args, "\x02", 1); cmd.wlen = 1; @@ -440,6 +445,7 @@ static int si2157_probe(struct i2c_client *client, i2c_set_clientdata(client, dev); dev->fe = cfg->fe; dev->inversion = cfg->inversion; + dev->dont_load_firmware = cfg->dont_load_firmware; dev->if_port = cfg->if_port; dev->chiptype = (u8)id->driver_data; dev->if_frequency = 5000000; /* default value of property 0x0706 */ diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h index c22ca784f43f..ffdece3c2eaa 100644 --- a/drivers/media/tuners/si2157.h +++ b/drivers/media/tuners/si2157.h @@ -11,29 +11,34 @@ #include #include -/* - * I2C address - * 0x60 +/** + * struct si2157_config - configuration parameters for si2157 + * + * @fe: + * frontend returned by driver + * @mdev: + * media device returned by driver + * @inversion: + * spectral inversion + * @dont_load_firmware: + * Instead of uploading a new firmware, use the existing one + * @if_port: + * Port selection + * Select the RF interface to use (pins 9+11 or 12+13) + * + * Note: + * The I2C address of this demod is 0x60. */ struct si2157_config { - /* - * frontend - */ struct dvb_frontend *fe; #if defined(CONFIG_MEDIA_CONTROLLER) struct media_device *mdev; #endif - /* - * Spectral Inversion - */ - bool inversion; + unsigned int inversion:1; + unsigned int dont_load_firmware:1; - /* - * Port selection - * Select the RF interface to use (pins 9+11 or 12+13) - */ u8 if_port; }; diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index 2bda903358da..778f81b39996 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -23,8 +23,9 @@ enum si2157_pads { struct si2157_dev { struct mutex i2c_mutex; struct dvb_frontend *fe; - bool active; - bool inversion; + unsigned int active:1; + unsigned int inversion:1; + unsigned int dont_load_firmware:1; u8 chiptype; u8 if_port; u32 if_frequency; From patchwork Thu Oct 10 09:51:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gon Solo X-Patchwork-Id: 11183057 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D92B11668 for ; Thu, 10 Oct 2019 09:51:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9433218AC for ; Thu, 10 Oct 2019 09:51:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DGV3PPD2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387929AbfJJJvj (ORCPT ); Thu, 10 Oct 2019 05:51:39 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:32884 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387799AbfJJJvi (ORCPT ); Thu, 10 Oct 2019 05:51:38 -0400 Received: by mail-wm1-f67.google.com with SMTP id r17so6725397wme.0; Thu, 10 Oct 2019 02:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OG3k/fhvlc/AA6RizL9Af/sd7AzPm1RXL7y5lP2bZ+0=; b=DGV3PPD26+aekcSvDrMT3Fz0/AWM4PpSVhkB/quLmEzuMMtaIV6rLxMZpYKqNLb1O6 U2dueoibYIC40p7TCNh9BaNh2xphJ912o1kQpuv7VBKMiighybq+1wNpeAsJVWJdvPRl dv7IuP/GMp7DxgAvVc8qc6jopRMh1lo25HDr2LIc6HBgUnoas76cW0URS83DbUYKHN43 HkAaguQaMYgAkgyxlrFBUS0bhj9q651BE5pUhEq5Z73gD9gP3rhCE0d6yQNWwT38jac0 SGQxl+2Q8IL06DflDFFSvgqNOLX1Meh2yyQbW1SXN+9+LtQb/lhtnKngwGqIE46n2mXt Up3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OG3k/fhvlc/AA6RizL9Af/sd7AzPm1RXL7y5lP2bZ+0=; b=bxx6BIE/opADxy0VbXCfPJOQdmmJ3ySR2K3Hi+JHejcdoqlfYbJPHQQz28Sh4vnPhy fOsc3GrznjgZ3EZkMVdgP6WOr3sKuhOlmCg8pcpNYN6L4SS6mANLCzFKv10pdI8hhmNk pO9dvJaHfO1r2QJk4h6To9ZVEeK+bOJDSA2Zm+ydVGE0BKayYc8QoTldDCGzJHTa2TjV CbElAfSSvbnaPA0/WTOLi7S60oWupuNXeHLMRZ18ayTkZ12Bq0hTZ4NyM7oDDo+WSB9i ROsU8Hb4CQwBUJyWN9zZxPyqEgSJ23GPQbaABX54bnKIcmUZZgTAfKRuCvCEXi+kMr6q NN9g== X-Gm-Message-State: APjAAAW+qd0xZFlEkQ07YqTLYk+Y9aWH/PpSIhNWGBQuy7nsiQNZ4BSD gilhsyI/DMm/MPVbgB1MBrE= X-Google-Smtp-Source: APXvYqz7bia0tQGw1TblRvVjnoCr7hexrV8AeSR3ExiEHcejj7w9uyF3pc9zAOTdXVY/+T8yR/12ZA== X-Received: by 2002:a1c:6a05:: with SMTP id f5mr3655489wmc.121.1570701096444; Thu, 10 Oct 2019 02:51:36 -0700 (PDT) Received: from localhost.localdomain ([46.114.37.24]) by smtp.googlemail.com with ESMTPSA id o4sm11678251wre.91.2019.10.10.02.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 02:51:35 -0700 (PDT) From: Gon Solo To: mchehab+samsung@kernel.org Cc: linux-media@vger.kernel.org, mchehab@infradead.org, jp@jpvw.nl, crope@iki.fi, sean@mess.org, linux-kernel@vger.kernel.org, Gon Solo Subject: [PATCH 3/4] af9035: Make speed computation clear. Date: Thu, 10 Oct 2019 11:51:02 +0200 Message-Id: <20191010095103.3803-4-gonsolo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191010091848.GA2898@Limone> References: <20191010091848.GA2898@Limone> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Gon Solo --- drivers/media/usb/dvb-usb-v2/af9035.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 3afd18733614..51e607ea3add 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1197,6 +1197,15 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap) return ret; } +/* + * The I2C speed register is calculated with: + * I2C speed register = (1000000000 / (24.4 * 16 * I2C_speed)) + * + * The default speed register for it930x is 7, with means a + * speed of ~366 kbps + */ +#define I2C_SPEED_366K 7 + static int it930x_frontend_attach(struct dvb_usb_adapter *adap) { struct state *state = adap_to_priv(adap); @@ -1208,13 +1217,13 @@ static int it930x_frontend_attach(struct dvb_usb_adapter *adap) dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); - /* I2C master bus 2 clock speed 300k */ - ret = af9035_wr_reg(d, 0x00f6a7, 0x07); + /* I2C master bus 2 clock speed 366k */ + ret = af9035_wr_reg(d, 0x00f6a7, I2C_SPEED_366K); if (ret < 0) goto err; - /* I2C master bus 1,3 clock speed 300k */ - ret = af9035_wr_reg(d, 0x00f103, 0x07); + /* I2C master bus 1,3 clock speed 366k */ + ret = af9035_wr_reg(d, 0x00f103, I2C_SPEED_366K); if (ret < 0) goto err; From patchwork Thu Oct 10 09:51:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gon Solo X-Patchwork-Id: 11183059 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 716B41709 for ; Thu, 10 Oct 2019 09:51:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51C44218AC for ; Thu, 10 Oct 2019 09:51:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KNP5xwS0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388005AbfJJJvn (ORCPT ); Thu, 10 Oct 2019 05:51:43 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40588 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387791AbfJJJvk (ORCPT ); Thu, 10 Oct 2019 05:51:40 -0400 Received: by mail-wm1-f67.google.com with SMTP id b24so6055055wmj.5; Thu, 10 Oct 2019 02:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=srs/G6L95nqsY4WglnHua/DxIGwZ02H3rDdTeu18fMw=; b=KNP5xwS0GAhtmU7mevXpPtwvPbvcC1qhN89NeihjYgO6TjF4o1FrLARNsjko52Mmpn 3Ywfhvczfqldh7Ca4EuzqK1deE7iJy+ankan/vCXcgtldIwpryGNYzDo06eSzlcSjp+k vpV1eYwc1HHS/AzAlvw+gh1stGASP88cbeS0eTt5/W/fwLFG7eyYKqeF0D+mieQhcjZt xztiOhv/gsAJ9NvMHSNSeJHP9KVTB/O418NUA4CaYj53qi86EG3HYWVGHDkH1w9xaDrF RhgQKOTuLsgWS4nSAzX3XDAKAq4Ya2KApDqXpK98GObWb43HQOHH2gapGgt584Gt14tG PhhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=srs/G6L95nqsY4WglnHua/DxIGwZ02H3rDdTeu18fMw=; b=cMb2IgydKE6GKRs+856Hg51b/OY2ltQsoXN+PS0Ma65L1DlwxD+RQSfEAMNnQeE2qu Bia6KJTI115XNcptCdHZBKRnG/wXuGukv78JOwK9ddOx/WLe5b/+Mv76YRWG1FrT96QA jFE+oTXG+MoAieL90kdtpdKwc8aGBLNx1QRIEy1RFbIJtgVPCs4515xE5orUw9aKQ7Nw 5guCkk4aIyiuW1Iv9rlcnlXjKtM8QHjglmV0SQTsXqinb2GeYQcftdE4y1tXZ2fAEssB uIQZSv6NqgheZejKa794Tfxd88/eAHeNtwHeTF21/BNoJpNx0fspoyoe6Mpw/aSYlZTI 9hiw== X-Gm-Message-State: APjAAAWbopNUq+pKRRvJV3ENabykoOrQ6X47z8BHjkND0/KziVpzsJu8 RPLOgCjFSYe/N39yyuM3rHQ= X-Google-Smtp-Source: APXvYqxjAkeyomPfEbaWJy7L3AnKIh7SohJILppQM3Ad8XjX1kEfBfQ07OnsFrKj8jcZJLL3kd9hlQ== X-Received: by 2002:a7b:ce07:: with SMTP id m7mr7049727wmc.117.1570701097956; Thu, 10 Oct 2019 02:51:37 -0700 (PDT) Received: from localhost.localdomain ([46.114.37.24]) by smtp.googlemail.com with ESMTPSA id o4sm11678251wre.91.2019.10.10.02.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 02:51:37 -0700 (PDT) From: Gon Solo To: mchehab+samsung@kernel.org Cc: linux-media@vger.kernel.org, mchehab@infradead.org, jp@jpvw.nl, crope@iki.fi, sean@mess.org, linux-kernel@vger.kernel.org, Gon Solo Subject: [PATCH 4/4] Add support for Logilink VG0022A. Date: Thu, 10 Oct 2019 11:51:03 +0200 Message-Id: <20191010095103.3803-5-gonsolo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191010091848.GA2898@Limone> References: <20191010091848.GA2898@Limone> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This includes a hack for the device as it returns only 0xff after a new firmware is loaded. To quote Mauro: "When the [...] firmware that came with the device is replaced by a new one, any I2C data received from the tuner will be replaced by 0xff. Probably, the vendor firmware has some patch specifically designed for this device. So, we can't replace by the generic firmware. The right solution would be to extract the [...] firmware from the original driver and ask the driver to load the specifically designed firmware, but, while we don't have that, the next best solution is to just keep the original firmware at the device." Signed-off-by: Gon Solo Signed-off-by: --- drivers/media/usb/dvb-usb-v2/af9035.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 51e607ea3add..792667ee5ebc 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1619,6 +1619,24 @@ static int it930x_tuner_attach(struct dvb_usb_adapter *adap) memset(&si2157_config, 0, sizeof(si2157_config)); si2157_config.fe = adap->fe[0]; + + /* + * HACK: The Logilink VG0022A has a bug: when the si2157 + * firmware that came with the device is replaced by a new + * one, the I2C transfers to the tuner will return just 0xff. + * + * Probably, the vendor firmware has some patch specifically + * designed for this device. So, we can't replace by the + * generic firmware. The right solution would be to extract + * the si2157 firmware from the original driver and ask the + * driver to load the specifically designed firmware, but, + * while we don't have that, the next best solution is to just + * keep the original firmware at the device. + */ + if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_DEXATEK && + le16_to_cpu(d->udev->descriptor.idProduct) == 0x0100) + si2157_config.dont_load_firmware = true; + si2157_config.if_port = it930x_addresses_table[state->it930x_addresses].tuner_if_port; ret = af9035_add_i2c_dev(d, "si2157", it930x_addresses_table[state->it930x_addresses].tuner_i2c_addr, @@ -2130,6 +2148,8 @@ static const struct usb_device_id af9035_id_table[] = { &it930x_props, "ITE 9303 Generic", NULL) }, { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD310, &it930x_props, "AVerMedia TD310 DVB-T2", NULL) }, + { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x0100, + &it930x_props, "Logilink VG0022A", NULL) }, { } }; MODULE_DEVICE_TABLE(usb, af9035_id_table);