[media] dvb-frontend: add core support for tuner suspend/resume
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Sun, 10 Aug 2014 00:47:19 +0000 (21:47 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Thu, 21 Aug 2014 20:25:09 +0000 (15:25 -0500)
While several tuners have some sort of suspend/resume
implementation, this is currently mangled with an optional
.sleep callback that it is also used to put the device on
low power mode.

Not all drivers implement it, as returning the driver from
low power may require to re-load the firmware, with takes
some time. Also, some drivers may delay it.

So, the more coherent is to add two new optional callbacks
that will let the tuners to directy implement suspend and
resume callbacks if they need.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/dvb-core/dvb_frontend.c
drivers/media/dvb-core/dvb_frontend.h
drivers/media/v4l2-core/tuner-core.c

index c2a6a0a858130b4db284ca845134656afcffc2f0..a5810391af614cee414ea412d82290419b1ba5d9 100644 (file)
@@ -2550,7 +2550,9 @@ int dvb_frontend_suspend(struct dvb_frontend *fe)
        dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
                        fe->id);
 
-       if (fe->ops.tuner_ops.sleep)
+       if (fe->ops.tuner_ops.suspend)
+               ret = fe->ops.tuner_ops.suspend(fe);
+       else if (fe->ops.tuner_ops.sleep)
                ret = fe->ops.tuner_ops.sleep(fe);
 
        if (fe->ops.sleep)
@@ -2572,7 +2574,9 @@ int dvb_frontend_resume(struct dvb_frontend *fe)
        if (fe->ops.init)
                ret = fe->ops.init(fe);
 
-       if (fe->ops.tuner_ops.init)
+       if (fe->ops.tuner_ops.resume)
+               ret = fe->ops.tuner_ops.resume(fe);
+       else if (fe->ops.tuner_ops.init)
                ret = fe->ops.tuner_ops.init(fe);
 
        fe->exit = DVB_FE_NO_EXIT;
index d398de4b6ef468cb7639ed8ce649ea0c4869291c..816269e5f7068b639a852651f4ad16817aea80a1 100644 (file)
@@ -201,6 +201,8 @@ struct dvb_tuner_ops {
        int (*release)(struct dvb_frontend *fe);
        int (*init)(struct dvb_frontend *fe);
        int (*sleep)(struct dvb_frontend *fe);
+       int (*suspend)(struct dvb_frontend *fe);
+       int (*resume)(struct dvb_frontend *fe);
 
        /** This is for simple PLLs - set all parameters in one go. */
        int (*set_params)(struct dvb_frontend *fe);
index 06c18ba16fa0427cc71fff76f08c140f55b05384..1770232007372f942a85bacfcfbbe86d58cc22bb 100644 (file)
@@ -1260,7 +1260,9 @@ static int tuner_suspend(struct device *dev)
 
        tuner_dbg("suspend\n");
 
-       if (!t->standby && analog_ops->standby)
+       if (t->fe.ops.tuner_ops.suspend)
+               t->fe.ops.tuner_ops.suspend(&t->fe);
+       else if (!t->standby && analog_ops->standby)
                analog_ops->standby(&t->fe);
 
        return 0;
@@ -1273,7 +1275,9 @@ static int tuner_resume(struct device *dev)
 
        tuner_dbg("resume\n");
 
-       if (!t->standby)
+       if (t->fe.ops.tuner_ops.resume)
+               t->fe.ops.tuner_ops.resume(&t->fe);
+       else if (!t->standby)
                if (set_mode(t, t->mode) == 0)
                        set_freq(t, 0);
 
This page took 0.028749 seconds and 5 git commands to generate.