aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorIstvan Varga <istvan_v@mailbox.hu>2011-06-04 11:03:03 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:52:36 -0400
commit5272f6b1f423d4ce636dc90f190e245897bdb045 (patch)
tree09f3a634a8cf78c5d5b9e258dc9f650e336ccd04 /drivers/media/common
parent0b4021321c0536a3368746497686ce56e5bcf3e5 (diff)
[media] xc4000: implemented power management
The following patch implements the xc4000_sleep() function. The 'no_powerdown' module parameter is now interpreted differently: - 0 uses a device-specific default - 1 disables power management like before - 2 enables power management Signed-off-by: Istvan Varga <istvan_v@mailbox.hu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/tuners/xc4000.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c
index 0afb61f8eae5..c373f4b36f5a 100644
--- a/drivers/media/common/tuners/xc4000.c
+++ b/drivers/media/common/tuners/xc4000.c
@@ -43,9 +43,11 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
43 43
44static int no_poweroff; 44static int no_poweroff;
45module_param(no_poweroff, int, 0644); 45module_param(no_poweroff, int, 0644);
46MODULE_PARM_DESC(no_poweroff, "0 (default) powers device off when not used.\n" 46MODULE_PARM_DESC(no_poweroff, "\n\t\t1: keep device energized and with tuner "
47 "\t\t1 keep device energized and with tuner ready all the times.\n" 47 "ready all the times.\n"
48 "\t\tFaster, but consumes more power and keeps the device hotter"); 48 "\t\tFaster, but consumes more power and keeps the device hotter.\n"
49 "\t\t2: powers device off when not used.\n"
50 "\t\t0 (default): use device-specific default mode.");
49 51
50#define XC4000_DEFAULT_FIRMWARE "xc4000.fw" 52#define XC4000_DEFAULT_FIRMWARE "xc4000.fw"
51 53
@@ -102,6 +104,7 @@ struct xc4000_priv {
102/* Misc Defines */ 104/* Misc Defines */
103#define MAX_TV_STANDARD 24 105#define MAX_TV_STANDARD 24
104#define XC_MAX_I2C_WRITE_LENGTH 64 106#define XC_MAX_I2C_WRITE_LENGTH 64
107#define XC_POWERED_DOWN 0x80000000U
105 108
106/* Signal Types */ 109/* Signal Types */
107#define XC_RF_MODE_AIR 0 110#define XC_RF_MODE_AIR 0
@@ -1365,8 +1368,34 @@ static int xc4000_get_status(struct dvb_frontend *fe, u32 *status)
1365 1368
1366static int xc4000_sleep(struct dvb_frontend *fe) 1369static int xc4000_sleep(struct dvb_frontend *fe)
1367{ 1370{
1368 /* FIXME: djh disable this for now... */ 1371 struct xc4000_priv *priv = fe->tuner_priv;
1369 return XC_RESULT_SUCCESS; 1372 int ret = XC_RESULT_SUCCESS;
1373
1374 dprintk(1, "%s()\n", __func__);
1375
1376 mutex_lock(&priv->lock);
1377
1378 /* Avoid firmware reload on slow devices */
1379 if ((no_poweroff == 2 ||
1380 (no_poweroff == 0 &&
1381 priv->card_type != XC4000_CARD_WINFAST_CX88)) &&
1382 (priv->cur_fw.type & BASE) != 0) {
1383 /* force reset and firmware reload */
1384 priv->cur_fw.type = XC_POWERED_DOWN;
1385
1386 if (xc_write_reg(priv, XREG_POWER_DOWN, 0)
1387 != XC_RESULT_SUCCESS) {
1388 printk(KERN_ERR
1389 "xc4000: %s() unable to shutdown tuner\n",
1390 __func__);
1391 ret = -EREMOTEIO;
1392 }
1393 xc_wait(20);
1394 }
1395
1396 mutex_unlock(&priv->lock);
1397
1398 return ret;
1370} 1399}
1371 1400
1372static int xc4000_init(struct dvb_frontend *fe) 1401static int xc4000_init(struct dvb_frontend *fe)