[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>
This commit is contained in:
Родитель
c9cb0820d5
Коммит
b154121c64
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче