aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners
diff options
context:
space:
mode:
authorOlli Salonen <olli.salonen@iki.fi>2014-11-24 01:57:33 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-25 06:11:54 -0500
commit073f38494ab9bad6edf589c74a1f09c358c5068c (patch)
treeddfe039f86d1aa451a97ae017b5520a83d9f872e /drivers/media/tuners
parent251a79f8f5adfd816de4e052b5e3619a5a1d0910 (diff)
[media] si2157: Add support for Si2146-A10
The Silicon Labs Si2146 tuner seems to work with the same driver as the Si2157, but there a few exceptions. The powerup command seems to be quite a bit different. In addition there's a property 0207 that requires a different value. Thus another entry is created in the si2157_id table to support also si2146 in this driver. The datasheet is available on manufacturer's website: http://www.silabs.com/support%20documents/technicaldocs/Si2146-short.pdf Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@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.c29
-rw-r--r--drivers/media/tuners/si2157.h2
-rw-r--r--drivers/media/tuners/si2157_priv.h8
3 files changed, 29 insertions, 10 deletions
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index b086b87d0890..a8f2edb92b60 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Silicon Labs Si2147/2157/2158 silicon tuner driver 2 * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver
3 * 3 *
4 * Copyright (C) 2014 Antti Palosaari <crope@iki.fi> 4 * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
5 * 5 *
@@ -93,8 +93,13 @@ static int si2157_init(struct dvb_frontend *fe)
93 goto warm; 93 goto warm;
94 94
95 /* power up */ 95 /* power up */
96 memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15); 96 if (s->chiptype == SI2157_CHIPTYPE_SI2146) {
97 cmd.wlen = 15; 97 memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9);
98 cmd.wlen = 9;
99 } else {
100 memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15);
101 cmd.wlen = 15;
102 }
98 cmd.rlen = 1; 103 cmd.rlen = 1;
99 ret = si2157_cmd_execute(s, &cmd); 104 ret = si2157_cmd_execute(s, &cmd);
100 if (ret) 105 if (ret)
@@ -114,6 +119,7 @@ static int si2157_init(struct dvb_frontend *fe)
114 #define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0) 119 #define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0)
115 #define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0) 120 #define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0)
116 #define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0) 121 #define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0)
122 #define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0)
117 123
118 switch (chip_id) { 124 switch (chip_id) {
119 case SI2158_A20: 125 case SI2158_A20:
@@ -121,6 +127,7 @@ static int si2157_init(struct dvb_frontend *fe)
121 break; 127 break;
122 case SI2157_A30: 128 case SI2157_A30:
123 case SI2147_A30: 129 case SI2147_A30:
130 case SI2146_A10:
124 goto skip_fw_download; 131 goto skip_fw_download;
125 break; 132 break;
126 default: 133 default:
@@ -275,7 +282,10 @@ static int si2157_set_params(struct dvb_frontend *fe)
275 if (ret) 282 if (ret)
276 goto err; 283 goto err;
277 284
278 memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6); 285 if (s->chiptype == SI2157_CHIPTYPE_SI2146)
286 memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6);
287 else
288 memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6);
279 cmd.wlen = 6; 289 cmd.wlen = 6;
280 cmd.rlen = 4; 290 cmd.rlen = 4;
281 ret = si2157_cmd_execute(s, &cmd); 291 ret = si2157_cmd_execute(s, &cmd);
@@ -308,7 +318,7 @@ static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency)
308 318
309static const struct dvb_tuner_ops si2157_ops = { 319static const struct dvb_tuner_ops si2157_ops = {
310 .info = { 320 .info = {
311 .name = "Silicon Labs Si2157/Si2158", 321 .name = "Silicon Labs Si2146/2147/2157/2158",
312 .frequency_min = 110000000, 322 .frequency_min = 110000000,
313 .frequency_max = 862000000, 323 .frequency_max = 862000000,
314 }, 324 },
@@ -339,6 +349,7 @@ static int si2157_probe(struct i2c_client *client,
339 s->fe = cfg->fe; 349 s->fe = cfg->fe;
340 s->inversion = cfg->inversion; 350 s->inversion = cfg->inversion;
341 s->fw_loaded = false; 351 s->fw_loaded = false;
352 s->chiptype = (u8)id->driver_data;
342 mutex_init(&s->i2c_mutex); 353 mutex_init(&s->i2c_mutex);
343 354
344 /* check if the tuner is there */ 355 /* check if the tuner is there */
@@ -355,7 +366,10 @@ static int si2157_probe(struct i2c_client *client,
355 i2c_set_clientdata(client, s); 366 i2c_set_clientdata(client, s);
356 367
357 dev_info(&s->client->dev, 368 dev_info(&s->client->dev,
358 "Silicon Labs Si2157/Si2158 successfully attached\n"); 369 "Silicon Labs %s successfully attached\n",
370 s->chiptype == SI2157_CHIPTYPE_SI2146 ?
371 "Si2146" : "Si2147/2157/2158");
372
359 return 0; 373 return 0;
360err: 374err:
361 dev_dbg(&client->dev, "failed=%d\n", ret); 375 dev_dbg(&client->dev, "failed=%d\n", ret);
@@ -380,6 +394,7 @@ static int si2157_remove(struct i2c_client *client)
380 394
381static const struct i2c_device_id si2157_id[] = { 395static const struct i2c_device_id si2157_id[] = {
382 {"si2157", 0}, 396 {"si2157", 0},
397 {"si2146", 1},
383 {} 398 {}
384}; 399};
385MODULE_DEVICE_TABLE(i2c, si2157_id); 400MODULE_DEVICE_TABLE(i2c, si2157_id);
@@ -396,7 +411,7 @@ static struct i2c_driver si2157_driver = {
396 411
397module_i2c_driver(si2157_driver); 412module_i2c_driver(si2157_driver);
398 413
399MODULE_DESCRIPTION("Silicon Labs Si2157/Si2158 silicon tuner driver"); 414MODULE_DESCRIPTION("Silicon Labs Si2146/2147/2157/2158 silicon tuner driver");
400MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 415MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
401MODULE_LICENSE("GPL"); 416MODULE_LICENSE("GPL");
402MODULE_FIRMWARE(SI2158_A20_FIRMWARE); 417MODULE_FIRMWARE(SI2158_A20_FIRMWARE);
diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
index d3b19cadb4a1..8467d08036de 100644
--- a/drivers/media/tuners/si2157.h
+++ b/drivers/media/tuners/si2157.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Silicon Labs Si2147/2157/2158 silicon tuner driver 2 * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver
3 * 3 *
4 * Copyright (C) 2014 Antti Palosaari <crope@iki.fi> 4 * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
5 * 5 *
diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h
index e71ffafed951..c1ea82111cd5 100644
--- a/drivers/media/tuners/si2157_priv.h
+++ b/drivers/media/tuners/si2157_priv.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Silicon Labs Si2147/2157/2158 silicon tuner driver 2 * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver
3 * 3 *
4 * Copyright (C) 2014 Antti Palosaari <crope@iki.fi> 4 * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
5 * 5 *
@@ -28,9 +28,13 @@ struct si2157 {
28 bool active; 28 bool active;
29 bool fw_loaded; 29 bool fw_loaded;
30 bool inversion; 30 bool inversion;
31 u8 chiptype;
31}; 32};
32 33
33/* firmare command struct */ 34#define SI2157_CHIPTYPE_SI2157 0
35#define SI2157_CHIPTYPE_SI2146 1
36
37/* firmware command struct */
34#define SI2157_ARGLEN 30 38#define SI2157_ARGLEN 30
35struct si2157_cmd { 39struct si2157_cmd {
36 u8 args[SI2157_ARGLEN]; 40 u8 args[SI2157_ARGLEN];