aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-12-09 06:47:18 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-21 04:31:49 -0500
commitb4b2de386bbb6589d81596999d4a924928dc119b (patch)
treef0b4c84f0ad7420d5e90a83074f1b6e191e0a2c8
parentaff808e813fc2d311137754165cf53d4ee6ddcc2 (diff)
[media] v4l: tvp5150: Fix comment regarding output pin muxing
The FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK pins are muxed differently depending on whether the input is an S-Video or composite signal. The comment that explains the logic doesn't reflect the code. It appears that the comment is incorrect, as disabling the output data bus in composite mode makes no sense. Update the comment to match the code. While at it define macros for the MISC_CTL register bits, the code is too confusing with numerical values. Cc: stable@vger.kernel.org # For Kernel 4.5 and upper Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/i2c/tvp5150.c24
-rw-r--r--drivers/media/i2c/tvp5150_reg.h9
2 files changed, 26 insertions, 7 deletions
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index a30bfcb4eec6..8852fa8c957b 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -291,8 +291,12 @@ static void tvp5150_selmux(struct v4l2_subdev *sd)
291 tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode); 291 tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode);
292 tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input); 292 tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input);
293 293
294 /* Svideo should enable YCrCb output and disable GPCL output 294 /*
295 * For Composite and TV, it should be the reverse 295 * Setup the FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK output signals. For
296 * S-Video we output the vertical lock (VLK) signal on FID/GLCO/VLK/HVLK
297 * and set INTREQ/GPCL/VBLK to logic 0. For composite we output the
298 * field indicator (FID) signal on FID/GLCO/VLK/HVLK and set
299 * INTREQ/GPCL/VBLK to logic 1.
296 */ 300 */
297 val = tvp5150_read(sd, TVP5150_MISC_CTL); 301 val = tvp5150_read(sd, TVP5150_MISC_CTL);
298 if (val < 0) { 302 if (val < 0) {
@@ -301,9 +305,9 @@ static void tvp5150_selmux(struct v4l2_subdev *sd)
301 } 305 }
302 306
303 if (decoder->input == TVP5150_SVIDEO) 307 if (decoder->input == TVP5150_SVIDEO)
304 val = (val & ~0x40) | 0x10; 308 val = (val & ~TVP5150_MISC_CTL_GPCL) | TVP5150_MISC_CTL_HVLK;
305 else 309 else
306 val = (val & ~0x10) | 0x40; 310 val = (val & ~TVP5150_MISC_CTL_HVLK) | TVP5150_MISC_CTL_GPCL;
307 tvp5150_write(sd, TVP5150_MISC_CTL, val); 311 tvp5150_write(sd, TVP5150_MISC_CTL, val);
308}; 312};
309 313
@@ -455,7 +459,12 @@ static const struct i2c_reg_value tvp5150_init_enable[] = {
455 },{ /* Automatic offset and AGC enabled */ 459 },{ /* Automatic offset and AGC enabled */
456 TVP5150_ANAL_CHL_CTL, 0x15 460 TVP5150_ANAL_CHL_CTL, 0x15
457 },{ /* Activate YCrCb output 0x9 or 0xd ? */ 461 },{ /* Activate YCrCb output 0x9 or 0xd ? */
458 TVP5150_MISC_CTL, 0x6f 462 TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
463 TVP5150_MISC_CTL_INTREQ_OE |
464 TVP5150_MISC_CTL_YCBCR_OE |
465 TVP5150_MISC_CTL_SYNC_OE |
466 TVP5150_MISC_CTL_VBLANK |
467 TVP5150_MISC_CTL_CLOCK_OE,
459 },{ /* Activates video std autodetection for all standards */ 468 },{ /* Activates video std autodetection for all standards */
460 TVP5150_AUTOSW_MSK, 0x0 469 TVP5150_AUTOSW_MSK, 0x0
461 },{ /* Default format: 0x47. For 4:2:2: 0x40 */ 470 },{ /* Default format: 0x47. For 4:2:2: 0x40 */
@@ -1050,11 +1059,12 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable)
1050{ 1059{
1051 struct tvp5150 *decoder = to_tvp5150(sd); 1060 struct tvp5150 *decoder = to_tvp5150(sd);
1052 /* Output format: 8-bit ITU-R BT.656 with embedded syncs */ 1061 /* Output format: 8-bit ITU-R BT.656 with embedded syncs */
1053 int val = 0x09; 1062 int val = TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_CLOCK_OE;
1054 1063
1055 /* Output format: 8-bit 4:2:2 YUV with discrete sync */ 1064 /* Output format: 8-bit 4:2:2 YUV with discrete sync */
1056 if (decoder->mbus_type == V4L2_MBUS_PARALLEL) 1065 if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
1057 val = 0x0d; 1066 val = TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_SYNC_OE
1067 | TVP5150_MISC_CTL_CLOCK_OE;
1058 1068
1059 /* Initializes TVP5150 to its default values */ 1069 /* Initializes TVP5150 to its default values */
1060 /* # set PCLK (27MHz) */ 1070 /* # set PCLK (27MHz) */
diff --git a/drivers/media/i2c/tvp5150_reg.h b/drivers/media/i2c/tvp5150_reg.h
index 25a994944918..30a48c28d05a 100644
--- a/drivers/media/i2c/tvp5150_reg.h
+++ b/drivers/media/i2c/tvp5150_reg.h
@@ -9,6 +9,15 @@
9#define TVP5150_ANAL_CHL_CTL 0x01 /* Analog channel controls */ 9#define TVP5150_ANAL_CHL_CTL 0x01 /* Analog channel controls */
10#define TVP5150_OP_MODE_CTL 0x02 /* Operation mode controls */ 10#define TVP5150_OP_MODE_CTL 0x02 /* Operation mode controls */
11#define TVP5150_MISC_CTL 0x03 /* Miscellaneous controls */ 11#define TVP5150_MISC_CTL 0x03 /* Miscellaneous controls */
12#define TVP5150_MISC_CTL_VBLK_GPCL BIT(7)
13#define TVP5150_MISC_CTL_GPCL BIT(6)
14#define TVP5150_MISC_CTL_INTREQ_OE BIT(5)
15#define TVP5150_MISC_CTL_HVLK BIT(4)
16#define TVP5150_MISC_CTL_YCBCR_OE BIT(3)
17#define TVP5150_MISC_CTL_SYNC_OE BIT(2)
18#define TVP5150_MISC_CTL_VBLANK BIT(1)
19#define TVP5150_MISC_CTL_CLOCK_OE BIT(0)
20
12#define TVP5150_AUTOSW_MSK 0x04 /* Autoswitch mask: TVP5150A / TVP5150AM */ 21#define TVP5150_AUTOSW_MSK 0x04 /* Autoswitch mask: TVP5150A / TVP5150AM */
13 22
14/* Reserved 05h */ 23/* Reserved 05h */