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

Commit 0f3559ef authored by Martin Dauskardt's avatar Martin Dauskardt Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (10216): saa7127: fix broken S-Video with saa7129



Register 0x2d has to be set differently in the saa7129 compared to the
saa7127. This was not done correctly, so S-Video was broken in certain
circumstances.

This fixes a regression introduced in 2.6.28.

Signed-off-by: default avatarMartin Dauskardt <martin.dauskardt@gmx.de>
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9c17e2ea
Loading
Loading
Loading
Loading
+30 −22
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ static const struct i2c_reg_value saa7127_init_config_common[] = {
	{ SAA7127_REG_COPYGEN_0, 			0x77 },
	{ SAA7127_REG_COPYGEN_1, 			0x41 },
	{ SAA7127_REG_COPYGEN_2, 			0x00 },	/* Macrovision enable/disable */
	{ SAA7127_REG_OUTPUT_PORT_CONTROL, 		0x9e },
	{ SAA7127_REG_OUTPUT_PORT_CONTROL, 		0xbf },
	{ SAA7127_REG_GAIN_LUMINANCE_RGB, 		0x00 },
	{ SAA7127_REG_GAIN_COLORDIFF_RGB, 		0x00 },
	{ SAA7127_REG_INPUT_PORT_CONTROL_1, 		0x80 },	/* for color bars */
@@ -488,11 +488,17 @@ static int saa7127_set_output_type(struct v4l2_subdev *sd, int output)
		break;

	case SAA7127_OUTPUT_TYPE_COMPOSITE:
		if (state->ident == V4L2_IDENT_SAA7129)
			state->reg_2d = 0x20;	/* CVBS only */
		else
			state->reg_2d = 0x08;	/* 00001000 CVBS only, RGB DAC's off (high impedance mode) */
		state->reg_3a = 0x13;	/* by default switch YUV to RGB-matrix on */
		break;

	case SAA7127_OUTPUT_TYPE_SVIDEO:
		if (state->ident == V4L2_IDENT_SAA7129)
			state->reg_2d = 0x18;	/* Y + C */
		else
			state->reg_2d = 0xff;   /*11111111  croma -> R, luma -> CVBS + G + B */
		state->reg_3a = 0x13;	/* by default switch YUV to RGB-matrix on */
		break;
@@ -508,6 +514,9 @@ static int saa7127_set_output_type(struct v4l2_subdev *sd, int output)
		break;

	case SAA7127_OUTPUT_TYPE_BOTH:
		if (state->ident == V4L2_IDENT_SAA7129)
			state->reg_2d = 0x38;
		else
			state->reg_2d = 0xbf;
		state->reg_3a = 0x13;	/* by default switch YUV to RGB-matrix on */
		break;
@@ -731,24 +740,6 @@ static int saa7127_probe(struct i2c_client *client,
		return -ENODEV;
	}

	/* Configure Encoder */

	v4l2_dbg(1, debug, sd, "Configuring encoder\n");
	saa7127_write_inittab(sd, saa7127_init_config_common);
	saa7127_set_std(sd, V4L2_STD_NTSC);
	saa7127_set_output_type(sd, SAA7127_OUTPUT_TYPE_BOTH);
	saa7127_set_vps(sd, &vbi);
	saa7127_set_wss(sd, &vbi);
	saa7127_set_cc(sd, &vbi);
	saa7127_set_xds(sd, &vbi);
	if (test_image == 1)
		/* The Encoder has an internal Colorbar generator */
		/* This can be used for debugging */
		saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_TEST_IMAGE);
	else
		saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_NORMAL);
	saa7127_set_video_enable(sd, 1);

	if (id->driver_data) {	/* Chip type is already known */
		state->ident = id->driver_data;
	} else {		/* Needs detection */
@@ -770,6 +761,23 @@ static int saa7127_probe(struct i2c_client *client,

	v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name,
			client->addr << 1, client->adapter->name);

	v4l2_dbg(1, debug, sd, "Configuring encoder\n");
	saa7127_write_inittab(sd, saa7127_init_config_common);
	saa7127_set_std(sd, V4L2_STD_NTSC);
	saa7127_set_output_type(sd, SAA7127_OUTPUT_TYPE_BOTH);
	saa7127_set_vps(sd, &vbi);
	saa7127_set_wss(sd, &vbi);
	saa7127_set_cc(sd, &vbi);
	saa7127_set_xds(sd, &vbi);
	if (test_image == 1)
		/* The Encoder has an internal Colorbar generator */
		/* This can be used for debugging */
		saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_TEST_IMAGE);
	else
		saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_NORMAL);
	saa7127_set_video_enable(sd, 1);

	if (state->ident == V4L2_IDENT_SAA7129)
		saa7127_write_inittab(sd, saa7129_init_config_extra);
	return 0;