aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tw9910.c
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2009-12-11 09:34:50 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-16 06:27:23 -0500
commit06f292e4806fcec2e7b2356c41241f5b6c4e3afb (patch)
treed3b3fc3982fb6fca0bd6db2a064a845e0314e449 /drivers/media/video/tw9910.c
parent88a67c51dfc649c18fc8828970cb4fd09d1871b5 (diff)
V4L/DVB (13654): tw9910: Tri-state pins when idle
Tri-state all pins when not streaming to save power. Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/tw9910.c')
-rw-r--r--drivers/media/video/tw9910.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 3d8a45f0eb2a..80b214efb24e 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -152,7 +152,10 @@
152 /* 1 : non-auto */ 152 /* 1 : non-auto */
153#define VSCTL 0x08 /* 1 : Vertical out ctrl by DVALID */ 153#define VSCTL 0x08 /* 1 : Vertical out ctrl by DVALID */
154 /* 0 : Vertical out ctrl by HACTIVE and DVALID */ 154 /* 0 : Vertical out ctrl by HACTIVE and DVALID */
155#define OEN 0x04 /* Output Enable together with TRI_SEL. */ 155#define OEN_TRI_SEL_MASK 0x07
156#define OEN_TRI_SEL_ALL_ON 0x00 /* Enable output for Rev0/Rev1 */
157#define OEN_TRI_SEL_ALL_OFF_r0 0x06 /* All tri-stated for Rev0 */
158#define OEN_TRI_SEL_ALL_OFF_r1 0x07 /* All tri-stated for Rev1 */
156 159
157/* OUTCTR1 */ 160/* OUTCTR1 */
158#define VSP_LO 0x00 /* 0 : VS pin output polarity is active low */ 161#define VSP_LO 0x00 /* 0 : VS pin output polarity is active low */
@@ -236,7 +239,6 @@ struct tw9910_priv {
236 239
237static const struct regval_list tw9910_default_regs[] = 240static const struct regval_list tw9910_default_regs[] =
238{ 241{
239 { OPFORM, 0x00 },
240 { OUTCTR1, VSP_LO | VSSL_VVALID | HSP_HI | HSSL_HSYNC }, 242 { OUTCTR1, VSP_LO | VSSL_VVALID | HSP_HI | HSSL_HSYNC },
241 ENDMARKER, 243 ENDMARKER,
242}; 244};
@@ -519,20 +521,35 @@ static int tw9910_s_stream(struct v4l2_subdev *sd, int enable)
519 struct i2c_client *client = sd->priv; 521 struct i2c_client *client = sd->priv;
520 struct tw9910_priv *priv = to_tw9910(client); 522 struct tw9910_priv *priv = to_tw9910(client);
521 523
522 if (!enable) 524 u8 val;
523 return 0;
524 525
525 if (!priv->scale) { 526 if (!enable) {
526 dev_err(&client->dev, "norm select error\n"); 527 switch (priv->revision) {
527 return -EPERM; 528 case 0:
528 } 529 val = OEN_TRI_SEL_ALL_OFF_r0;
530 break;
531 case 1:
532 val = OEN_TRI_SEL_ALL_OFF_r1;
533 break;
534 default:
535 dev_err(&client->dev, "un-supported revision\n");
536 return -EINVAL;
537 }
538 } else {
539 val = OEN_TRI_SEL_ALL_ON;
529 540
530 dev_dbg(&client->dev, "%s %dx%d\n", 541 if (!priv->scale) {
531 priv->scale->name, 542 dev_err(&client->dev, "norm select error\n");
532 priv->scale->width, 543 return -EPERM;
533 priv->scale->height); 544 }
534 545
535 return 0; 546 dev_dbg(&client->dev, "%s %dx%d\n",
547 priv->scale->name,
548 priv->scale->width,
549 priv->scale->height);
550 }
551
552 return tw9910_mask_set(client, OPFORM, OEN_TRI_SEL_MASK, val);
536} 553}
537 554
538static int tw9910_set_bus_param(struct soc_camera_device *icd, 555static int tw9910_set_bus_param(struct soc_camera_device *icd,