[media] xc5000: fix xc5000 suspend
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Sun, 10 Aug 2014 00:47:20 +0000 (21:47 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Thu, 21 Aug 2014 20:25:09 +0000 (15:25 -0500)
After xc5000 stops working, it waits for 5 seconds, waiting
for a new usage. Only after that it goes to low power mode.

If a suspend event happens before that, a work queue will
remain active, with causes suspend to crash.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/tuners/xc5000.c

index e135760f7d486d5bb6061fb0452bbbb5f87545af..af137046bfe5eb9a1d3738958d861b583680328b 100644 (file)
@@ -1229,6 +1229,24 @@ static int xc5000_sleep(struct dvb_frontend *fe)
        return 0;
 }
 
+static int xc5000_suspend(struct dvb_frontend *fe)
+{
+       struct xc5000_priv *priv = fe->tuner_priv;
+       int ret;
+
+       dprintk(1, "%s()\n", __func__);
+
+       cancel_delayed_work(&priv->timer_sleep);
+
+       ret = xc5000_tuner_reset(fe);
+       if (ret != 0)
+               printk(KERN_ERR
+                       "xc5000: %s() unable to shutdown tuner\n",
+                       __func__);
+
+       return 0;
+}
+
 static int xc5000_init(struct dvb_frontend *fe)
 {
        struct xc5000_priv *priv = fe->tuner_priv;
@@ -1293,6 +1311,7 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = {
        .release           = xc5000_release,
        .init              = xc5000_init,
        .sleep             = xc5000_sleep,
+       .suspend           = xc5000_suspend,
 
        .set_config        = xc5000_set_config,
        .set_params        = xc5000_set_params,