]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] si2168: avoid firmware loading if it has been loaded previously
authorOlli Salonen <olli.salonen@iki.fi>
Mon, 25 Aug 2014 18:07:04 +0000 (15:07 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Sun, 21 Sep 2014 19:42:39 +0000 (16:42 -0300)
Add a variable to keep track if firmware is loaded or not and skip parts of the
initialization if fw is already loaded. Resume from sleep with a different
command compared to initial power up and run command 85 after resume command.
This behaviour is observed when using manufacturer provided binary-only si2168
driver for TechnoTrend CT2-4400.

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>
drivers/media/dvb-frontends/si2168.c
drivers/media/dvb-frontends/si2168_priv.h

index 55a4212aea750c739ea5b075c25110fbd52e2f34..a0797fd95129cc8d05d9f9241e8cb70d28f1a0a6 100644 (file)
@@ -363,6 +363,7 @@ static int si2168_init(struct dvb_frontend *fe)
 
        dev_dbg(&s->client->dev, "\n");
 
+       /* initialize */
        memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13);
        cmd.wlen = 13;
        cmd.rlen = 0;
@@ -370,6 +371,26 @@ static int si2168_init(struct dvb_frontend *fe)
        if (ret)
                goto err;
 
+       if (s->fw_loaded) {
+               /* resume */
+               memcpy(cmd.args, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8);
+               cmd.wlen = 8;
+               cmd.rlen = 1;
+               ret = si2168_cmd_execute(s, &cmd);
+               if (ret)
+                       goto err;
+
+               memcpy(cmd.args, "\x85", 1);
+               cmd.wlen = 1;
+               cmd.rlen = 1;
+               ret = si2168_cmd_execute(s, &cmd);
+               if (ret)
+                       goto err;
+
+               goto warm;
+       }
+
+       /* power up */
        memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8);
        cmd.wlen = 8;
        cmd.rlen = 1;
@@ -466,9 +487,6 @@ static int si2168_init(struct dvb_frontend *fe)
        if (ret)
                goto err;
 
-       dev_info(&s->client->dev, "found a '%s' in warm state\n",
-                       si2168_ops.info.name);
-
        /* set ts mode */
        memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
        cmd.args[4] |= s->ts_mode;
@@ -478,6 +496,12 @@ static int si2168_init(struct dvb_frontend *fe)
        if (ret)
                goto err;
 
+       s->fw_loaded = true;
+
+warm:
+       dev_info(&s->client->dev, "found a '%s' in warm state\n",
+                       si2168_ops.info.name);
+
        s->active = true;
 
        return 0;
@@ -645,6 +669,7 @@ static int si2168_probe(struct i2c_client *client,
        *config->i2c_adapter = s->adapter;
        *config->fe = &s->fe;
        s->ts_mode = config->ts_mode;
+       s->fw_loaded = false;
 
        i2c_set_clientdata(client, s);
 
index 0f832844b831796ae29a13b046f15437b5d5c505..e13983ed4be1a077e3b04b896c46870e8aad7a60 100644 (file)
@@ -36,6 +36,7 @@ struct si2168 {
        fe_delivery_system_t delivery_system;
        fe_status_t fe_status;
        bool active;
+       bool fw_loaded;
        u8 ts_mode;
 };