Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06f292e4 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (13654): tw9910: Tri-state pins when idle



Tri-state all pins when not streaming to save power.

Signed-off-by: default avatarKuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 88a67c51
Loading
Loading
Loading
Loading
+30 −13
Original line number Original line Diff line number Diff line
@@ -152,7 +152,10 @@
			 /* 1 : non-auto */
			 /* 1 : non-auto */
#define VSCTL       0x08 /* 1 : Vertical out ctrl by DVALID */
#define VSCTL       0x08 /* 1 : Vertical out ctrl by DVALID */
			 /* 0 : Vertical out ctrl by HACTIVE and DVALID */
			 /* 0 : Vertical out ctrl by HACTIVE and DVALID */
#define OEN         0x04 /* Output Enable together with TRI_SEL. */
#define OEN_TRI_SEL_MASK	0x07
#define OEN_TRI_SEL_ALL_ON	0x00 /* Enable output for Rev0/Rev1 */
#define OEN_TRI_SEL_ALL_OFF_r0	0x06 /* All tri-stated for Rev0 */
#define OEN_TRI_SEL_ALL_OFF_r1	0x07 /* All tri-stated for Rev1 */


/* OUTCTR1 */
/* OUTCTR1 */
#define VSP_LO      0x00 /* 0 : VS pin output polarity is active low */
#define VSP_LO      0x00 /* 0 : VS pin output polarity is active low */
@@ -236,7 +239,6 @@ struct tw9910_priv {


static const struct regval_list tw9910_default_regs[] =
static const struct regval_list tw9910_default_regs[] =
{
{
	{ OPFORM,  0x00 },
	{ OUTCTR1, VSP_LO | VSSL_VVALID | HSP_HI | HSSL_HSYNC },
	{ OUTCTR1, VSP_LO | VSSL_VVALID | HSP_HI | HSSL_HSYNC },
	ENDMARKER,
	ENDMARKER,
};
};
@@ -519,8 +521,22 @@ static int tw9910_s_stream(struct v4l2_subdev *sd, int enable)
	struct i2c_client *client = sd->priv;
	struct i2c_client *client = sd->priv;
	struct tw9910_priv *priv = to_tw9910(client);
	struct tw9910_priv *priv = to_tw9910(client);


	if (!enable)
	u8 val;
		return 0;

	if (!enable) {
		switch (priv->revision) {
		case 0:
			val = OEN_TRI_SEL_ALL_OFF_r0;
			break;
		case 1:
			val = OEN_TRI_SEL_ALL_OFF_r1;
			break;
		default:
			dev_err(&client->dev, "un-supported revision\n");
			return -EINVAL;
		}
	} else {
		val = OEN_TRI_SEL_ALL_ON;


		if (!priv->scale) {
		if (!priv->scale) {
			dev_err(&client->dev, "norm select error\n");
			dev_err(&client->dev, "norm select error\n");
@@ -531,8 +547,9 @@ static int tw9910_s_stream(struct v4l2_subdev *sd, int enable)
			priv->scale->name,
			priv->scale->name,
			priv->scale->width,
			priv->scale->width,
			priv->scale->height);
			priv->scale->height);
	}


	return 0;
	return tw9910_mask_set(client, OPFORM, OEN_TRI_SEL_MASK, val);
}
}


static int tw9910_set_bus_param(struct soc_camera_device *icd,
static int tw9910_set_bus_param(struct soc_camera_device *icd,