All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] media: si2157: fix 6MHz & 6.1MHz bandwidth setting
@ 2022-01-06 22:49 Robert Schlabbach
  0 siblings, 0 replies; only message in thread
From: Robert Schlabbach @ 2022-01-06 22:49 UTC (permalink / raw)
  To: linux-media; +Cc: mchehab

Commit 98c65a3dac95 ("media: si2157: add support for 1.7MHz and 6.1
MHz") introduced two bugs: The 6.1MHz setting was always used for any
bandwidth less than 7MHz due to missing "else" keywords, and then the
setting was not specified as decimal 10, but as hexadecimal 0x10, which
makes the tuner refuse the tune command. In sum, it is not possible to
tune to any channels of less than 7MHz bandwidth anymore.

Add the missing "else" keywords and convert all bandwidth settings to
decimal to avoid any future decimal vs. hexadecimal confusion.

Remove the use of the undefined bandwidth setting 0x0f for bandwidths
greater than 8MHz, which is also refused by the tune command, in favour
of using the default bandwidth setting 8 for any bandwidths greater than
7MHz.

Fixes: 98c65a3dac95 ("media: si2157: add support for 1.7MHz and 6.1 MHz")
Reported-by: Robert Schlabbach <robert_s@gmx.net>
Signed-off-by: Robert Schlabbach <robert_s@gmx.net>
---
 drivers/media/tuners/si2157.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index 481c5c3b577d..76dc10dd2518 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -459,17 +459,15 @@ static int si2157_set_params(struct dvb_frontend *fe)
 	}

 	if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 1700000)
-		bandwidth = 0x09;
-	if (c->bandwidth_hz <= 6000000)
-		bandwidth = 0x06;
-	if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 6100000)
-		bandwidth = 0x10;
+		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 = 0x07;
-	else if (c->bandwidth_hz <= 8000000)
-		bandwidth = 0x08;
+		bandwidth = 7;
 	else
-		bandwidth = 0x0f;
+		bandwidth = 8;

 	switch (c->delivery_system) {
 	case SYS_ATSC:
--
2.17.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-06 22:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 22:49 [PATCH 1/3] media: si2157: fix 6MHz & 6.1MHz bandwidth setting Robert Schlabbach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.