From patchwork Thu Jan 6 22:51:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Schlabbach X-Patchwork-Id: 530418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C73FC433EF for ; Thu, 6 Jan 2022 22:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245283AbiAFWvo (ORCPT ); Thu, 6 Jan 2022 17:51:44 -0500 Received: from mout.gmx.net ([212.227.17.20]:33093 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245279AbiAFWvn (ORCPT ); Thu, 6 Jan 2022 17:51:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1641509499; bh=AL6ELuGvESOTCneu0XvbjXIp415GjO8nACjeZHMPuyI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=cOr10opSE2BMwiGZsGardZLssZLyw3yNXkEnhJpv3Q50n3AjgaZR1eOOsL6257wEa rsPHk3frSmW2ozXXsp87Y/04JFJFgCit+svkB99ndpnQ44W//2Gw0i14LUlbhORBm/ ffyMD5omYFvYOJOJ/Qt+Kj95kZTxkffB2rOwJMEQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [91.65.60.26] ([91.65.60.26]) by web-mail.gmx.net (3c-app-gmx-bap68.server.lan [172.19.172.68]) (via HTTP); Thu, 6 Jan 2022 23:51:39 +0100 MIME-Version: 1.0 Message-ID: From: Robert Schlabbach To: linux-media@vger.kernel.org Cc: mchehab@kernel.org Subject: [PATCH 2/3] media: si2157: fix bandwidth stored in dev Date: Thu, 6 Jan 2022 23:51:39 +0100 Importance: normal Sensitiv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MLb9pAIwSH8Rp6MYqchLDyfk5nxOndMhumRcbMhDQn1798H/qBtekBYlE0ZINIZG dQQIjP5XovcxiQ8eI8bhEzszGzLOqmes7v6cjuiyV36B4Y9HWmOSDcy0ZNL+gw2MWyVpSqR1d b9aVYzS Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Make digital tuning store the bandwidth in Hz in the private dev struct, rather than the hardware-specific bandwidth property code, so that the get_bandwidth() function returns the bandwidth in Hz, just as it already does when using analog tuning. Reported-by: Robert Schlabbach Signed-off-by: Robert Schlabbach --- drivers/media/tuners/si2157.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index 76dc10dd2518..b1e00b635dbf 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -446,7 +446,8 @@ static int si2157_set_params(struct dvb_frontend *fe) struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; struct si2157_cmd cmd; - u8 bandwidth, delivery_system; + u8 bw, delivery_system; + u32 bandwidth; u32 if_frequency = 5000000; dev_dbg(&client->dev, @@ -458,16 +459,22 @@ static int si2157_set_params(struct dvb_frontend *fe) goto err; } - if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 1700000) - bandwidth = 9; - else if (c->bandwidth_hz <= 6000000) - bandwidth = 6; - else if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 6100000) - bandwidth = 10; - else if (c->bandwidth_hz <= 7000000) - bandwidth = 7; - else - bandwidth = 8; + if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 1700000) { + bandwidth = 1700000; + bw = 9; + } else if (c->bandwidth_hz <= 6000000) { + bandwidth = 6000000; + bw = 6; + } else if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 6100000) { + bandwidth = 6100000; + bw = 10; + } else if (c->bandwidth_hz <= 7000000) { + bandwidth = 7000000; + bw = 7; + } else { + bandwidth = 8000000; + bw = 8; + } switch (c->delivery_system) { case SYS_ATSC: @@ -497,7 +504,7 @@ static int si2157_set_params(struct dvb_frontend *fe) } memcpy(cmd.args, "\x14\x00\x03\x07\x00\x00", 6); - cmd.args[4] = delivery_system | bandwidth; + cmd.args[4] = delivery_system | bw; if (dev->inversion) cmd.args[5] = 0x01; cmd.wlen = 6;