Re: [PATCH 2/3] media: si2157: add support for 1.7MHz and 6.1 MHz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It turns out there are actually two bugs in there:
 
+ if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 6100000)
+ bandwidth = 0x10;

The si2157 code for bandwidth 6.1MHz is _decimal_ 10, not
hexadecimal 0x10. Removing the "0x" from the above line makes
the tuner work again, even with the other bug that makes it use
the 6.1MHz setting when 6MHz is requested.

Another issue with the bandwidth setting: The si2157 code is
also stored in dev->bandwidth and returned in the get_bandwidth()
call. Now this was not well before, because the call is supposed
to return the bandwidth in Hz, not in MHz, but now it can return
9 and 10, but those do not correspond to 9 and 10MHz.

Also, the default case uses si2157 code 0x0f, which also seems
like a bad idea.

And another, unrelated issue: The delivery_system switch is
missing case DVBC_ANNEX_C, even though it should operate just as
DVBC_ANNEX_A.

I'll see if I can come up with a patch which addresses all of the
above.

Best Regards,
-Robert Schlabbach 


Gesendet: Donnerstag, 06. Januar 2022 um 16:39 Uhr
Von: "Robert Schlabbach" <Robert.Schlabbach@xxxxxxx>
An: "Mauro Carvalho Chehab" <mchehab+huawei@xxxxxxxxxx>
Cc: mauro.chehab@xxxxxxxxxx, "Antti Palosaari" <crope@xxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx
Betreff: Re: [PATCH 2/3] media: si2157: add support for 1.7MHz and 6.1 MHz

Sorry for the late test and response, but there is a BAD BUG in this patch:
 
+ 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;
else if (c->bandwidth_hz <= 7000000)
bandwidth = 0x07;
else if (c->bandwidth_hz <= 8000000)

The additions omitted the "else", which resulted in the bandwidth setting for
6MHz being overwritten with the one for 6.1MHz - and that completely breaks
6MHz channels, as the tuner then refuses to accept the tune command!

As a result, e.g. MCNS aka ClearQAM aka DVB-C Annex B no longer works after
this patch.

I don't know if the 1.7Mhz and 6.1MHz settings are even usable, if the tuner
(in my case, the Si2157-A30) then no longer accepts the tune command. Maybe
they're not suited for frequency-based tuning, but only for channel-based
tuning? That would not fit the DVB-API, I think.

And the 1.7MHz bandwidth setting currently can't do any harm, as it is always
overwritten by the 6MHz bandwidth setting, also due to an "else" missing.

Best Regards,
-Robert Schlabbach
 
 

Gesendet: Freitag, 10. Dezember 2021 um 13:59 Uhr
Von: "Mauro Carvalho Chehab" <mchehab+huawei@xxxxxxxxxx>
An: unlisted-recipients:;
Cc: linuxarm@xxxxxxxxxx, mauro.chehab@xxxxxxxxxx, "Mauro Carvalho Chehab" <mchehab+huawei@xxxxxxxxxx>, "Antti Palosaari" <crope@xxxxxx>, "Mauro Carvalho Chehab" <mchehab@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx
Betreff: [PATCH 2/3] media: si2157: add support for 1.7MHz and 6.1 MHz
Some tuners allow setting the bandwidth filter to 1.7MHz and
6.1 MHz. Add support for it upstream, as the narrower is the
bandwidth filter, the better.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 0/3] at: https://lore.kernel.org/all/cover.1639140967.git.mchehab+huawei@xxxxxxxxxx/

drivers/media/tuners/si2157.c | 4 ++++
drivers/media/tuners/si2157_priv.h | 5 +++++
2 files changed, 9 insertions(+)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index aeecb38b147f..2d3937af4f5f 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -458,8 +458,12 @@ static int si2157_set_params(struct dvb_frontend *fe)
goto err;
}

+ 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;
else if (c->bandwidth_hz <= 7000000)
bandwidth = 0x07;
else if (c->bandwidth_hz <= 8000000)
diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h
index df17a5f03561..24849c8ed398 100644
--- a/drivers/media/tuners/si2157_priv.h
+++ b/drivers/media/tuners/si2157_priv.h
@@ -66,6 +66,11 @@ struct si2157_cmd {
unsigned rlen;
};

+#define SUPPORTS_1700KHz(dev) (((dev)->part_id == SI2141) || \
+ ((dev)->part_id == SI2147) || \
+ ((dev)->part_id == SI2157) || \
+ ((dev)->part_id == SI2177))
+
/* Old firmware namespace */
#define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw"
#define SI2141_A10_FIRMWARE "dvb-tuner-si2141-a10-01.fw"
--
2.33.1
 




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux