summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorOlli Salonen <olli.salonen@iki.fi>2014-07-13 10:52:19 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-14 21:07:06 -0300
commitb154121c6470b927794ff7ed17355aedfaa073ca (patch)
tree8d7728071557a33c86ef36b8c5c85da8263b80dc /drivers/media
parentc9cb0820d5d756f2fac550213e664cc0be511349 (diff)
[media] si2157: Move chip initialization to si2157_init
Move chip initialization related code from si2157_set_params to si2157_init. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/tuners/si2157.c71
1 files changed, 30 insertions, 41 deletions
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index a4908ee81ab9..a92570f944ea 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -80,12 +80,41 @@ err:
static int si2157_init(struct dvb_frontend *fe)
{
struct si2157 *s = fe->tuner_priv;
+ int ret;
+ struct si2157_cmd cmd;
dev_dbg(&s->client->dev, "%s:\n", __func__);
+ /* configure? */
+ memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15);
+ cmd.wlen = 15;
+ cmd.rlen = 1;
+ ret = si2157_cmd_execute(s, &cmd);
+ if (ret)
+ goto err;
+
+ /* query chip revision */
+ memcpy(cmd.args, "\x02", 1);
+ cmd.wlen = 1;
+ cmd.rlen = 13;
+ ret = si2157_cmd_execute(s, &cmd);
+ if (ret)
+ goto err;
+
+ /* reboot the tuner with new firmware? */
+ memcpy(cmd.args, "\x01\x01", 2);
+ cmd.wlen = 2;
+ cmd.rlen = 1;
+ ret = si2157_cmd_execute(s, &cmd);
+ if (ret)
+ goto err;
+
s->active = true;
return 0;
+err:
+ dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
+ return ret;
}
static int si2157_sleep(struct dvb_frontend *fe)
@@ -128,48 +157,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
goto err;
}
- /* configure? */
- cmd.args[0] = 0xc0;
- cmd.args[1] = 0x00;
- cmd.args[2] = 0x0c;
- cmd.args[3] = 0x00;
- cmd.args[4] = 0x00;
- cmd.args[5] = 0x01;
- cmd.args[6] = 0x01;
- cmd.args[7] = 0x01;
- cmd.args[8] = 0x01;
- cmd.args[9] = 0x01;
- cmd.args[10] = 0x01;
- cmd.args[11] = 0x02;
- cmd.args[12] = 0x00;
- cmd.args[13] = 0x00;
- cmd.args[14] = 0x01;
- cmd.wlen = 15;
- cmd.rlen = 1;
- ret = si2157_cmd_execute(s, &cmd);
- if (ret)
- goto err;
-
- cmd.args[0] = 0x02;
- cmd.wlen = 1;
- cmd.rlen = 13;
- ret = si2157_cmd_execute(s, &cmd);
- if (ret)
- goto err;
-
- cmd.args[0] = 0x01;
- cmd.args[1] = 0x01;
- cmd.wlen = 2;
- cmd.rlen = 1;
- ret = si2157_cmd_execute(s, &cmd);
- if (ret)
- goto err;
-
/* set frequency */
- cmd.args[0] = 0x41;
- cmd.args[1] = 0x00;
- cmd.args[2] = 0x00;
- cmd.args[3] = 0x00;
+ memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8);
cmd.args[4] = (c->frequency >> 0) & 0xff;
cmd.args[5] = (c->frequency >> 8) & 0xff;
cmd.args[6] = (c->frequency >> 16) & 0xff;