diff mbox

[2/5] soc-camera: tw9910: Add output signal control

Message ID ufx9nkfmj.wl%morimoto.kuninori@renesas.com (mailing list archive)
State RFC
Headers show

Commit Message

Kuninori Morimoto Oct. 13, 2009, 5:49 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 5152d56..8bda689 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -152,7 +152,8 @@ 
 			 /* 1 : non-auto */
 #define VSCTL       0x08 /* 1 : Vertical out ctrl by DVALID */
 			 /* 0 : Vertical out ctrl by HACTIVE and DVALID */
-#define OEN         0x04 /* Output Enable together with TRI_SEL. */
+#define OEN         0x00 /* Enable output */
+#define EN_TRI_SEL  0x04 /* TRI_SEL output */
 
 /* OUTCTR1 */
 #define VSP_LO      0x00 /* 0 : VS pin output polarity is active low */
@@ -236,7 +237,6 @@  struct tw9910_priv {
 
 static const struct regval_list tw9910_default_regs[] =
 {
-	{ OPFORM,  0x00 },
 	{ OUTCTR1, VSP_LO | VSSL_VVALID | HSP_HI | HSSL_HSYNC },
 	ENDMARKER,
 };
@@ -513,19 +513,32 @@  static int tw9910_s_stream(struct v4l2_subdev *sd, int enable)
 {
 	struct i2c_client *client = sd->priv;
 	struct tw9910_priv *priv = to_tw9910(client);
+	u8 val;
 
-	if (!enable)
+	if (!enable) {
+		switch (priv->rev) {
+		case 0:
+			val = EN_TRI_SEL | 0x2;
+			break;
+		case 1:
+			val = EN_TRI_SEL | 0x3;
+			break;
+		}
 		return 0;
+	} else {
 
-	if (!priv->scale) {
-		dev_err(&client->dev, "norm select error\n");
-		return -EPERM;
+		if (!priv->scale) {
+			dev_err(&client->dev, "norm select error\n");
+			return -EPERM;
+		}
+
+		dev_dbg(&client->dev, "%s %dx%d\n",
+			priv->scale->name,
+			priv->scale->width,
+			priv->scale->height);
 	}
 
-	dev_dbg(&client->dev, "%s %dx%d\n",
-		 priv->scale->name,
-		 priv->scale->width,
-		 priv->scale->height);
+	tw9910_mask_set(client, OPFORM, 0x7, val);
 
 	return 0;
 }