Skip to content

Commit 9658105

Browse files
robert-scmchehab
authored andcommitted
media: si2157: fix bandwidth stored in dev
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. Link: https://lore.kernel.org/linux-media/trinity-931c0e68-88af-46cc-91a1-986754798a4f-1641509499366@3c-app-gmx-bap68 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>
1 parent 95c4cd1 commit 9658105

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

drivers/media/tuners/si2157.c

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
446446
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
447447
int ret;
448448
struct si2157_cmd cmd;
449-
u8 bandwidth, delivery_system;
449+
u8 bw, delivery_system;
450+
u32 bandwidth;
450451
u32 if_frequency = 5000000;
451452

452453
dev_dbg(&client->dev,
@@ -458,16 +459,22 @@ static int si2157_set_params(struct dvb_frontend *fe)
458459
goto err;
459460
}
460461

461-
if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 1700000)
462-
bandwidth = 9;
463-
else if (c->bandwidth_hz <= 6000000)
464-
bandwidth = 6;
465-
else if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 6100000)
466-
bandwidth = 10;
467-
else if (c->bandwidth_hz <= 7000000)
468-
bandwidth = 7;
469-
else
470-
bandwidth = 8;
462+
if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 1700000) {
463+
bandwidth = 1700000;
464+
bw = 9;
465+
} else if (c->bandwidth_hz <= 6000000) {
466+
bandwidth = 6000000;
467+
bw = 6;
468+
} else if (SUPPORTS_1700KHz(dev) && c->bandwidth_hz <= 6100000) {
469+
bandwidth = 6100000;
470+
bw = 10;
471+
} else if (c->bandwidth_hz <= 7000000) {
472+
bandwidth = 7000000;
473+
bw = 7;
474+
} else {
475+
bandwidth = 8000000;
476+
bw = 8;
477+
}
471478

472479
switch (c->delivery_system) {
473480
case SYS_ATSC:
@@ -497,7 +504,7 @@ static int si2157_set_params(struct dvb_frontend *fe)
497504
}
498505

499506
memcpy(cmd.args, "\x14\x00\x03\x07\x00\x00", 6);
500-
cmd.args[4] = delivery_system | bandwidth;
507+
cmd.args[4] = delivery_system | bw;
501508
if (dev->inversion)
502509
cmd.args[5] = 0x01;
503510
cmd.wlen = 6;

0 commit comments

Comments
 (0)