V4L/DVB (11790): xc5000: restore sleep routine

Bring back the code that puts the xc5000 to sleep.  For the Pinnacle 801e
this results in power consumption at idle dropping from 325ma to 124ma.

If there are *actually* any devices that don't work in this configuration,
they should set dvb_frontend.ops.tuner_ops.sleep to NULL (per mkrufky's
suggestion)

Also, had to make sure we were making sure the firmware was loaded in the
digital version of set_params, or else we end up get i2c errors if the
device is asleep

Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Devin Heitmueller 2008-11-16 20:41:07 -03:00 committed by Mauro Carvalho Chehab
parent 7988fc216d
commit 8e4c67972e

View file

@ -191,6 +191,7 @@ static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
{"FM Radio-INPUT1", 0x0208, 0x9002}
};
static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe);
static int xc5000_is_firmware_loaded(struct dvb_frontend *fe);
static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val);
static int xc5000_TunerReset(struct dvb_frontend *fe);
@ -365,15 +366,6 @@ static int xc_SetTVStandard(struct xc5000_priv *priv,
return ret;
}
static int xc_shutdown(struct xc5000_priv *priv)
{
return XC_RESULT_SUCCESS;
/* Fixme: cannot bring tuner back alive once shutdown
* without reloading the driver modules.
* return xc_write_reg(priv, XREG_POWER_DOWN, 0);
*/
}
static int xc_SetSignalSource(struct xc5000_priv *priv, u16 rf_mode)
{
dprintk(1, "%s(%d) Source = %s\n", __func__, rf_mode,
@ -617,6 +609,9 @@ static int xc5000_set_params(struct dvb_frontend *fe,
struct xc5000_priv *priv = fe->tuner_priv;
int ret;
if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS)
xc_load_fw_and_init_tuner(fe);
dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency);
switch (params->u.vsb.modulation) {
@ -694,8 +689,6 @@ static int xc5000_is_firmware_loaded(struct dvb_frontend *fe)
return ret;
}
static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe);
static int xc5000_set_analog_params(struct dvb_frontend *fe,
struct analog_parameters *params)
{
@ -849,13 +842,7 @@ static int xc5000_sleep(struct dvb_frontend *fe)
dprintk(1, "%s()\n", __func__);
/* On Pinnacle PCTV HD 800i, the tuner cannot be reinitialized
* once shutdown without reloading the driver. Maybe I am not
* doing something right.
*
*/
ret = xc_shutdown(priv);
ret = xc_write_reg(priv, XREG_POWER_DOWN, 0);
if (ret != XC_RESULT_SUCCESS) {
printk(KERN_ERR
"xc5000: %s() unable to shutdown tuner\n",