[media] mn88472: implement firmware parity check
authorBenjamin Larsson <benjamin@southpole.se>
Sun, 15 Mar 2015 22:57:51 +0000 (19:57 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 3 Apr 2015 00:52:36 +0000 (21:52 -0300)
Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/staging/media/mn88472/mn88472.c

index 6f0cac44d2731262d1847fbf8fc545b2df7a2df7..85ef4f694c8b26e9eb8149ecb9cb367df8d3fb16 100644 (file)
@@ -258,6 +258,7 @@ static int mn88472_init(struct dvb_frontend *fe)
        int ret, len, remaining;
        const struct firmware *fw = NULL;
        u8 *fw_file = MN88472_FIRMWARE;
+       unsigned int csum;
 
        dev_dbg(&client->dev, "\n");
 
@@ -303,6 +304,20 @@ static int mn88472_init(struct dvb_frontend *fe)
                }
        }
 
+       /* parity check of firmware */
+       ret = regmap_read(dev->regmap[0], 0xf8, &csum);
+       if (ret) {
+               dev_err(&client->dev,
+                               "parity reg read failed=%d\n", ret);
+               goto err;
+       }
+       if (csum & 0x10) {
+               dev_err(&client->dev,
+                               "firmware parity check failed=0x%x\n", csum);
+               goto err;
+       }
+       dev_err(&client->dev, "firmware parity check succeeded=0x%x\n", csum);
+
        ret = regmap_write(dev->regmap[0], 0xf5, 0x00);
        if (ret)
                goto firmware_release;