diff options
author | Olli Salonen <olli.salonen@iki.fi> | 2015-02-28 10:25:23 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-03-03 08:35:08 -0500 |
commit | c28aebe178a403f0e8632a283bc4d683b0c93e83 (patch) | |
tree | 5d3c58db7643e552dcf54546c44aa99cc23d12f0 /drivers/media/tuners | |
parent | 95f22c5aaed3415ff4a2df6a1ff76b3127123430 (diff) |
[media] si2157: IF frequency for ATSC and QAM
For supporting ATSC and QAM modes the driver should use a smaller IF frequency than 5 MHz.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/tuners')
-rw-r--r-- | drivers/media/tuners/si2157.c | 23 | ||||
-rw-r--r-- | drivers/media/tuners/si2157_priv.h | 1 |
2 files changed, 23 insertions, 1 deletions
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index fcf139dfdec6..d8309b9de21e 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) | |||
244 | int ret; | 244 | int ret; |
245 | struct si2157_cmd cmd; | 245 | struct si2157_cmd cmd; |
246 | u8 bandwidth, delivery_system; | 246 | u8 bandwidth, delivery_system; |
247 | u32 if_frequency = 5000000; | ||
247 | 248 | ||
248 | dev_dbg(&client->dev, | 249 | dev_dbg(&client->dev, |
249 | "delivery_system=%d frequency=%u bandwidth_hz=%u\n", | 250 | "delivery_system=%d frequency=%u bandwidth_hz=%u\n", |
@@ -266,9 +267,11 @@ static int si2157_set_params(struct dvb_frontend *fe) | |||
266 | switch (c->delivery_system) { | 267 | switch (c->delivery_system) { |
267 | case SYS_ATSC: | 268 | case SYS_ATSC: |
268 | delivery_system = 0x00; | 269 | delivery_system = 0x00; |
270 | if_frequency = 3250000; | ||
269 | break; | 271 | break; |
270 | case SYS_DVBC_ANNEX_B: | 272 | case SYS_DVBC_ANNEX_B: |
271 | delivery_system = 0x10; | 273 | delivery_system = 0x10; |
274 | if_frequency = 4000000; | ||
272 | break; | 275 | break; |
273 | case SYS_DVBT: | 276 | case SYS_DVBT: |
274 | case SYS_DVBT2: /* it seems DVB-T and DVB-T2 both are 0x20 here */ | 277 | 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) | |||
302 | if (ret) | 305 | if (ret) |
303 | goto err; | 306 | goto err; |
304 | 307 | ||
308 | /* set if frequency if needed */ | ||
309 | if (if_frequency != dev->if_frequency) { | ||
310 | memcpy(cmd.args, "\x14\x00\x06\x07", 4); | ||
311 | cmd.args[4] = (if_frequency / 1000) & 0xff; | ||
312 | cmd.args[5] = ((if_frequency / 1000) >> 8) & 0xff; | ||
313 | cmd.wlen = 6; | ||
314 | cmd.rlen = 4; | ||
315 | ret = si2157_cmd_execute(client, &cmd); | ||
316 | if (ret) | ||
317 | goto err; | ||
318 | |||
319 | dev->if_frequency = if_frequency; | ||
320 | } | ||
321 | |||
305 | /* set frequency */ | 322 | /* set frequency */ |
306 | memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8); | 323 | memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8); |
307 | cmd.args[4] = (c->frequency >> 0) & 0xff; | 324 | cmd.args[4] = (c->frequency >> 0) & 0xff; |
@@ -322,7 +339,10 @@ err: | |||
322 | 339 | ||
323 | static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) | 340 | static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) |
324 | { | 341 | { |
325 | *frequency = 5000000; /* default value of property 0x0706 */ | 342 | struct i2c_client *client = fe->tuner_priv; |
343 | struct si2157_dev *dev = i2c_get_clientdata(client); | ||
344 | |||
345 | *frequency = dev->if_frequency; | ||
326 | return 0; | 346 | return 0; |
327 | } | 347 | } |
328 | 348 | ||
@@ -360,6 +380,7 @@ static int si2157_probe(struct i2c_client *client, | |||
360 | dev->inversion = cfg->inversion; | 380 | dev->inversion = cfg->inversion; |
361 | dev->fw_loaded = false; | 381 | dev->fw_loaded = false; |
362 | dev->chiptype = (u8)id->driver_data; | 382 | dev->chiptype = (u8)id->driver_data; |
383 | dev->if_frequency = 5000000; /* default value of property 0x0706 */ | ||
363 | mutex_init(&dev->i2c_mutex); | 384 | mutex_init(&dev->i2c_mutex); |
364 | 385 | ||
365 | /* check if the tuner is there */ | 386 | /* check if the tuner is there */ |
diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index 7aa53bce5593..cd8fa5b25304 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h | |||
@@ -28,6 +28,7 @@ struct si2157_dev { | |||
28 | bool fw_loaded; | 28 | bool fw_loaded; |
29 | bool inversion; | 29 | bool inversion; |
30 | u8 chiptype; | 30 | u8 chiptype; |
31 | u32 if_frequency; | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | #define SI2157_CHIPTYPE_SI2157 0 | 34 | #define SI2157_CHIPTYPE_SI2157 0 |