diff options
Diffstat (limited to 'drivers/media/tuners/si2157.c')
-rw-r--r-- | drivers/media/tuners/si2157.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index fcf139dfdec6..d74ae26621ca 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -244,6 +244,7 @@ static int si2157_set_params(struct dvb_frontend *fe) int ret; struct si2157_cmd cmd; u8 bandwidth, delivery_system; + u32 if_frequency = 5000000; dev_dbg(&client->dev, "delivery_system=%d frequency=%u bandwidth_hz=%u\n", @@ -266,9 +267,11 @@ static int si2157_set_params(struct dvb_frontend *fe) switch (c->delivery_system) { case SYS_ATSC: delivery_system = 0x00; + if_frequency = 3250000; break; case SYS_DVBC_ANNEX_B: delivery_system = 0x10; + if_frequency = 4000000; break; case SYS_DVBT: case SYS_DVBT2: /* it seems DVB-T and DVB-T2 both are 0x20 here */ @@ -302,6 +305,20 @@ static int si2157_set_params(struct dvb_frontend *fe) if (ret) goto err; + /* set if frequency if needed */ + if (if_frequency != dev->if_frequency) { + memcpy(cmd.args, "\x14\x00\x06\x07", 4); + cmd.args[4] = (if_frequency / 1000) & 0xff; + cmd.args[5] = ((if_frequency / 1000) >> 8) & 0xff; + cmd.wlen = 6; + cmd.rlen = 4; + ret = si2157_cmd_execute(client, &cmd); + if (ret) + goto err; + + dev->if_frequency = if_frequency; + } + /* set frequency */ memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8); cmd.args[4] = (c->frequency >> 0) & 0xff; @@ -322,14 +339,17 @@ err: static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) { - *frequency = 5000000; /* default value of property 0x0706 */ + struct i2c_client *client = fe->tuner_priv; + struct si2157_dev *dev = i2c_get_clientdata(client); + + *frequency = dev->if_frequency; return 0; } static const struct dvb_tuner_ops si2157_ops = { .info = { .name = "Silicon Labs Si2146/2147/2148/2157/2158", - .frequency_min = 110000000, + .frequency_min = 55000000, .frequency_max = 862000000, }, @@ -360,6 +380,7 @@ static int si2157_probe(struct i2c_client *client, dev->inversion = cfg->inversion; dev->fw_loaded = false; dev->chiptype = (u8)id->driver_data; + dev->if_frequency = 5000000; /* default value of property 0x0706 */ mutex_init(&dev->i2c_mutex); /* check if the tuner is there */ |