Commit b154121c authored by Olli Salonen's avatar Olli Salonen Committed by Mauro Carvalho Chehab

[media] si2157: Move chip initialization to si2157_init

Move chip initialization related code from si2157_set_params to
si2157_init.
Signed-off-by: default avatarOlli Salonen <olli.salonen@iki.fi>
Reviewed-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent c9cb0820
...@@ -80,12 +80,41 @@ static int si2157_cmd_execute(struct si2157 *s, struct si2157_cmd *cmd) ...@@ -80,12 +80,41 @@ static int si2157_cmd_execute(struct si2157 *s, struct si2157_cmd *cmd)
static int si2157_init(struct dvb_frontend *fe) static int si2157_init(struct dvb_frontend *fe)
{ {
struct si2157 *s = fe->tuner_priv; struct si2157 *s = fe->tuner_priv;
int ret;
struct si2157_cmd cmd;
dev_dbg(&s->client->dev, "%s:\n", __func__); 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; s->active = true;
return 0; return 0;
err:
dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
return ret;
} }
static int si2157_sleep(struct dvb_frontend *fe) static int si2157_sleep(struct dvb_frontend *fe)
...@@ -128,48 +157,8 @@ static int si2157_set_params(struct dvb_frontend *fe) ...@@ -128,48 +157,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
goto err; 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 */ /* set frequency */
cmd.args[0] = 0x41; memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8);
cmd.args[1] = 0x00;
cmd.args[2] = 0x00;
cmd.args[3] = 0x00;
cmd.args[4] = (c->frequency >> 0) & 0xff; cmd.args[4] = (c->frequency >> 0) & 0xff;
cmd.args[5] = (c->frequency >> 8) & 0xff; cmd.args[5] = (c->frequency >> 8) & 0xff;
cmd.args[6] = (c->frequency >> 16) & 0xff; cmd.args[6] = (c->frequency >> 16) & 0xff;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment