media: si2157: fix 6MHz & 6.1MHz bandwidth setting
authorRobert Schlabbach <robert_s@gmx.net>
Thu, 6 Jan 2022 22:49:47 +0000 (23:49 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 10 Jan 2022 14:56:00 +0000 (15:56 +0100)
commit95c4cd1d19e3e1d4894457a6f015e3a045bc9b06
treeb77395d00e487027ea1302d062980c4faa92fc43
parenta89eeb9937a0124e609e9355cd48cdfe35c8b8b7
media: si2157: fix 6MHz & 6.1MHz bandwidth setting

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.

Link: https://lore.kernel.org/linux-media/trinity-d0015ea1-1da5-4c7d-a75b-781fb26dc339-1641509387112@3c-app-gmx-bap68
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/tuners/si2157.c