This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: TVP5150 + VIP Issues

Part Number: AM5728
Other Parts Discussed in Thread: TVP5150, TMDSEVM572X,

Tool/software: Linux

Hello, I am using the Linux Processor SDK for AM57x v05.02.00.10

I have two questions on the work of vip + tvp5150 in the External Sync. mode and Embedded Sync. aka BT.656 mode

I connected the TVP5150 to the P9 connector of the TMDSEVM572X kit. See the diagram.

TVP connects to AM5728 as follows:

tvp5150 (yout0) <=> am5728 (vin3a_d0)

tvp5150 (yout1) <=> am5728 (vin3a_d1)

tvp5150 (yout2) <=> am5728 (vin3a_d2)

tvp5150 (yout3) <=> am5728 (vin3a_d3)

tvp5150 (yout4) <=> am5728 (vin3a_d4)

tvp5150 (yout5) <=> am5728 (vin3a_d5)

tvp5150 (yout6) <=> am5728 (vin3a_d6)

tvp5150 (yout7) <=> am5728 (vin3a_d7)

tvp5150 (avid) <=> am5728 (vin3a_de0)

tvp5150 (fid) <=> am5728 (vin3a_fld)

tvp5150 (hsync) <=> am5728 (vin3a_hsync)

tvp5150 (vsync) <=> am5728 (vin3a_vsync)

tvp5150 (pclk / sclk) <=> am5728 (vin3a_clko)

Video support config in kernel defconfig file:

CONFIG_MEDIA_SUPPORT = y

CONFIG_MEDIA_CAMERA_SUPPORT = y

CONFIG_MEDIA_CONTROLLER = y

CONFIG_VIDEO_V4L2_SUBDEV_API = y

CONFIG_V4L_PLATFORM_DRIVERS = y

CONFIG_VIDEO_TI_CAL = m

CONFIG_VIDEO_TI_VIP = m

CONFIG_V4L_MEM2MEM_DRIVERS = y

CONFIG_VIDEO_TI_VPE = m

CONFIG_VIDEO_TVP5150 = m

Situation one (for the case of external synchronization):

A1. I created the cam-tvp5150.dtso file

cam-tvp5150.dtso.tar.gz

A2. Adapted drivers:

tvp5150 for debug = 2

ti_vip.ko (vip.c): debug = 3

 vip.cvip.c

 tvp5150.c

1832.tvp5150.c
/*
 * tvp5150 - Texas Instruments TVP5150A/AM1 and TVP5151 video decoder driver
 *
 * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org)
 * This code is placed under the terms of the GNU General Public License v2
 */

#include <dt-bindings/media/tvp5150.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <media/v4l2-async.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-mc.h>

#include "tvp5150_reg.h"

#define TVP5150_H_MAX			720U
#define TVP5150_V_MAX_525_60	480U
#define TVP5150_V_MAX_OTHERS	576U
#define TVP5150_MAX_CROP_LEFT	511
#define TVP5150_MAX_CROP_TOP	127
#define TVP5150_CROP_SHIFT		2

MODULE_DESCRIPTION("Texas Instruments TVP5150A/TVP5150AM1/TVP5151 video decoder driver");
MODULE_AUTHOR("Mauro Carvalho Chehab");
MODULE_LICENSE("GPL");

//DeVdistress
#if(0)
	static int debug;
	module_param(debug, int, 0644);
	MODULE_PARM_DESC(debug, "Debug level (0-2)");
#else
	static int debug = 2;
#endif

#define dprintk0(__dev, __arg...) dev_dbg_lvl(__dev, 0, 0, __arg)

struct tvp5150 {
	struct v4l2_subdev sd;
#ifdef CONFIG_MEDIA_CONTROLLER
	struct media_pad pads[DEMOD_NUM_PADS];
	struct media_entity input_ent[TVP5150_INPUT_NUM];
	struct media_pad input_pad[TVP5150_INPUT_NUM];
#endif
	struct v4l2_ctrl_handler hdl;
	struct v4l2_rect rect;

	v4l2_std_id norm;	/* Current set standard */
	u32 input;
	u32 output;
	int enable;

	u16 dev_id;
	u16 rom_ver;

	enum v4l2_mbus_type mbus_type;
};

static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
{
	return container_of(sd, struct tvp5150, sd);
}

static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
{
	return &container_of(ctrl->handler, struct tvp5150, hdl)->sd;
}

static int tvp5150_read(struct v4l2_subdev *sd, unsigned char addr)
{
	struct i2c_client *c = v4l2_get_subdevdata(sd);
	int rc;

	rc = i2c_smbus_read_byte_data(c, addr);
	if (rc < 0) {
		dev_err(sd->dev, "i2c i/o error: rc == %d\n", rc);
		return rc;
	}

	dev_dbg_lvl(sd->dev, 2, debug, "tvp5150: read 0x%02x = %02x\n", addr, rc);

	return rc;
}

static int tvp5150_write(struct v4l2_subdev *sd, unsigned char addr,
				 unsigned char value)
{
	struct i2c_client *c = v4l2_get_subdevdata(sd);
	int rc;

	dev_dbg_lvl(sd->dev, 2, debug, "tvp5150: writing %02x %02x\n", addr, value);
	rc = i2c_smbus_write_byte_data(c, addr, value);
	if (rc < 0)
		dev_err(sd->dev, "i2c i/o error: rc == %d\n", rc);

	return rc;
}

static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init,
				const u8 end, int max_line)
{
	u8 buf[16];
	int i = 0, j, len;

	if (max_line > 16) {
		dprintk0(sd->dev, "too much data to dump\n");
		return;
	}

	for (i = init; i < end; i += max_line) {
		len = (end - i > max_line) ? max_line : end - i;

		for (j = 0; j < len; j++)
			buf[j] = tvp5150_read(sd, i + j);

		dprintk0(sd->dev, "%s reg %02x = %*ph\n", s, i, len, buf);
	}
}

static int tvp5150_log_status(struct v4l2_subdev *sd)
{
	dprintk0(sd->dev, "tvp5150: Video input source selection #1 = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VD_IN_SRC_SEL_1));
	dprintk0(sd->dev, "tvp5150: Analog channel controls = 0x%02x\n",
		tvp5150_read(sd, TVP5150_ANAL_CHL_CTL));
	dprintk0(sd->dev, "tvp5150: Operation mode controls = 0x%02x\n",
		tvp5150_read(sd, TVP5150_OP_MODE_CTL));
	dprintk0(sd->dev, "tvp5150: Miscellaneous controls = 0x%02x\n",
		tvp5150_read(sd, TVP5150_MISC_CTL));
	dprintk0(sd->dev, "tvp5150: Autoswitch mask= 0x%02x\n",
		tvp5150_read(sd, TVP5150_AUTOSW_MSK));
	dprintk0(sd->dev, "tvp5150: Color killer threshold control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_COLOR_KIL_THSH_CTL));
	dprintk0(sd->dev, "tvp5150: Luminance processing controls #1 #2 and #3 = %02x %02x %02x\n",
		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_1),
		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_2),
		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_3));
	dprintk0(sd->dev, "tvp5150: Brightness control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_BRIGHT_CTL));
	dprintk0(sd->dev, "tvp5150: Color saturation control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_SATURATION_CTL));
	dprintk0(sd->dev, "tvp5150: Hue control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_HUE_CTL));
	dprintk0(sd->dev, "tvp5150: Contrast control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_CONTRAST_CTL));
	dprintk0(sd->dev, "tvp5150: Outputs and data rates select = 0x%02x\n",
		tvp5150_read(sd, TVP5150_DATA_RATE_SEL));
	dprintk0(sd->dev, "tvp5150: Configuration shared pins = 0x%02x\n",
		tvp5150_read(sd, TVP5150_CONF_SHARED_PIN));
	dprintk0(sd->dev, "tvp5150: Active video cropping start = 0x%02x%02x\n",
		tvp5150_read(sd, TVP5150_ACT_VD_CROP_ST_MSB),
		tvp5150_read(sd, TVP5150_ACT_VD_CROP_ST_LSB));
	dprintk0(sd->dev, "tvp5150: Active video cropping stop  = 0x%02x%02x\n",
		tvp5150_read(sd, TVP5150_ACT_VD_CROP_STP_MSB),
		tvp5150_read(sd, TVP5150_ACT_VD_CROP_STP_LSB));
	dprintk0(sd->dev, "tvp5150: Genlock/RTC = 0x%02x\n",
		tvp5150_read(sd, TVP5150_GENLOCK));
	dprintk0(sd->dev, "tvp5150: Horizontal sync start = 0x%02x\n",
		tvp5150_read(sd, TVP5150_HORIZ_SYNC_START));
	dprintk0(sd->dev, "tvp5150: Vertical blanking start = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VERT_BLANKING_START));
	dprintk0(sd->dev, "tvp5150: Vertical blanking stop = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VERT_BLANKING_STOP));
	dprintk0(sd->dev, "tvp5150: Chrominance processing control #1 and #2 = %02x %02x\n",
		tvp5150_read(sd, TVP5150_CHROMA_PROC_CTL_1),
		tvp5150_read(sd, TVP5150_CHROMA_PROC_CTL_2));
	dprintk0(sd->dev, "tvp5150: Interrupt reset register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_RESET_REG_B));
	dprintk0(sd->dev, "tvp5150: Interrupt enable register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_ENABLE_REG_B));
	dprintk0(sd->dev, "tvp5150: Interrupt configuration register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INTT_CONFIG_REG_B));
	dprintk0(sd->dev, "tvp5150: Video standard = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VIDEO_STD));
	dprintk0(sd->dev, "tvp5150: Chroma gain factor: Cb=0x%02x Cr=0x%02x\n",
		tvp5150_read(sd, TVP5150_CB_GAIN_FACT),
		tvp5150_read(sd, TVP5150_CR_GAIN_FACTOR));
	dprintk0(sd->dev, "tvp5150: Macrovision on counter = 0x%02x\n",
		tvp5150_read(sd, TVP5150_MACROVISION_ON_CTR));
	dprintk0(sd->dev, "tvp5150: Macrovision off counter = 0x%02x\n",
		tvp5150_read(sd, TVP5150_MACROVISION_OFF_CTR));
	dprintk0(sd->dev, "tvp5150: ITU-R BT.656.%d timing(TVP5150AM1 only)\n",
		(tvp5150_read(sd, TVP5150_REV_SELECT) & 1) ? 3 : 4);
	dprintk0(sd->dev, "tvp5150: Device ID = %02x%02x\n",
		tvp5150_read(sd, TVP5150_MSB_DEV_ID),
		tvp5150_read(sd, TVP5150_LSB_DEV_ID));
	dprintk0(sd->dev, "tvp5150: ROM version = (hex) %02x.%02x\n",
		tvp5150_read(sd, TVP5150_ROM_MAJOR_VER),
		tvp5150_read(sd, TVP5150_ROM_MINOR_VER));
	dprintk0(sd->dev, "tvp5150: Vertical line count = 0x%02x%02x\n",
		tvp5150_read(sd, TVP5150_VERT_LN_COUNT_MSB),
		tvp5150_read(sd, TVP5150_VERT_LN_COUNT_LSB));
	dprintk0(sd->dev, "tvp5150: Interrupt status register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_STATUS_REG_B));
	dprintk0(sd->dev, "tvp5150: Interrupt active register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_ACTIVE_REG_B));
	dprintk0(sd->dev, "tvp5150: Status regs #1 to #5 = %02x %02x %02x %02x %02x\n",
		tvp5150_read(sd, TVP5150_STATUS_REG_1),
		tvp5150_read(sd, TVP5150_STATUS_REG_2),
		tvp5150_read(sd, TVP5150_STATUS_REG_3),
		tvp5150_read(sd, TVP5150_STATUS_REG_4),
		tvp5150_read(sd, TVP5150_STATUS_REG_5));

	dump_reg_range(sd, "Teletext filter 1",   TVP5150_TELETEXT_FIL1_INI,
			TVP5150_TELETEXT_FIL1_END, 8);
	dump_reg_range(sd, "Teletext filter 2",   TVP5150_TELETEXT_FIL2_INI,
			TVP5150_TELETEXT_FIL2_END, 8);

	dprintk0(sd->dev, "tvp5150: Teletext filter enable = 0x%02x\n",
		tvp5150_read(sd, TVP5150_TELETEXT_FIL_ENA));
	dprintk0(sd->dev, "tvp5150: Interrupt status register A = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_STATUS_REG_A));
	dprintk0(sd->dev, "tvp5150: Interrupt enable register A = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_ENABLE_REG_A));
	dprintk0(sd->dev, "tvp5150: Interrupt configuration = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_CONF));
	dprintk0(sd->dev, "tvp5150: VDP status register = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VDP_STATUS_REG));
	dprintk0(sd->dev, "tvp5150: FIFO word count = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FIFO_WORD_COUNT));
	dprintk0(sd->dev, "tvp5150: FIFO interrupt threshold = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FIFO_INT_THRESHOLD));
	dprintk0(sd->dev, "tvp5150: FIFO reset = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FIFO_RESET));
	dprintk0(sd->dev, "tvp5150: Line number interrupt = 0x%02x\n",
		tvp5150_read(sd, TVP5150_LINE_NUMBER_INT));
	dprintk0(sd->dev, "tvp5150: Pixel alignment register = 0x%02x%02x\n",
		tvp5150_read(sd, TVP5150_PIX_ALIGN_REG_HIGH),
		tvp5150_read(sd, TVP5150_PIX_ALIGN_REG_LOW));
	dprintk0(sd->dev, "tvp5150: FIFO output control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FIFO_OUT_CTRL));
	dprintk0(sd->dev, "tvp5150: Full field enable = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FULL_FIELD_ENA));
	dprintk0(sd->dev, "tvp5150: Full field mode register = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FULL_FIELD_MODE_REG));

	dump_reg_range(sd, "CC   data",   TVP5150_CC_DATA_INI,
			TVP5150_CC_DATA_END, 8);

	dump_reg_range(sd, "WSS  data",   TVP5150_WSS_DATA_INI,
			TVP5150_WSS_DATA_END, 8);

	dump_reg_range(sd, "VPS  data",   TVP5150_VPS_DATA_INI,
			TVP5150_VPS_DATA_END, 8);

	dump_reg_range(sd, "VITC data",   TVP5150_VITC_DATA_INI,
			TVP5150_VITC_DATA_END, 10);

	dump_reg_range(sd, "Line mode",   TVP5150_LINE_MODE_INI,
			TVP5150_LINE_MODE_END, 8);
	return 0;
}

/****************************************************************************
			Basic functions
 ****************************************************************************/

static void tvp5150_selmux(struct v4l2_subdev *sd)
{
	int opmode = 0;
	struct tvp5150 *decoder = to_tvp5150(sd);
	int input = 0;
	int val;

	/* Only tvp5150am1 and tvp5151 have signal generator support */
	if ((decoder->dev_id == 0x5150 && decoder->rom_ver == 0x0400) ||
	    (decoder->dev_id == 0x5151 && decoder->rom_ver == 0x0100)) {
		if (!decoder->enable)
			input = 8;
	}

//DeVdistress
#if(1)
	switch (decoder->input) {
	case TVP5150_COMPOSITE1:
		input |= 2;
		/* fall through */
	case TVP5150_COMPOSITE0:
		break;
	case TVP5150_SVIDEO:
	default:
		input |= 1;
		break;
	}
#endif

	dev_dbg_lvl(sd->dev, 1, debug, "Selecting video route: route input=%i, output=%i => tvp5150 input=%i, opmode=%i\n",
			decoder->input, decoder->output,
			input, opmode);

	tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode);
	tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input);

	/*
	 * Setup the FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK output signals. For
	 * S-Video we output the vertical lock (VLK) signal on FID/GLCO/VLK/HVLK
	 * and set INTREQ/GPCL/VBLK to logic 0. For composite we output the
	 * field indicator (FID) signal on FID/GLCO/VLK/HVLK and set
	 * INTREQ/GPCL/VBLK to logic 1.
	 */
	val = tvp5150_read(sd, TVP5150_MISC_CTL);
	if (val < 0) {
		dev_err(sd->dev, "%s: failed with error = %d\n", __func__, val);
		return;
	}

	if (decoder->input == TVP5150_SVIDEO)
		val = (val & ~TVP5150_MISC_CTL_GPCL) | TVP5150_MISC_CTL_HVLK;
	else
		val = (val & ~TVP5150_MISC_CTL_HVLK) | TVP5150_MISC_CTL_GPCL;
	tvp5150_write(sd, TVP5150_MISC_CTL, val);
};

struct i2c_reg_value {
	unsigned char reg;
	unsigned char value;
};

/* Default values as sugested at TVP5150AM1 datasheet */
static const struct i2c_reg_value tvp5150_init_default[] = {
	{ /* 0x00 */
		TVP5150_VD_IN_SRC_SEL_1,0x00
	},
	{ /* 0x01 */
		TVP5150_ANAL_CHL_CTL,0x15
	},
	{ /* 0x02 */
		TVP5150_OP_MODE_CTL,0x00
	},
	{ /* 0x03 */
		TVP5150_MISC_CTL,0x01
	},
	{ /* 0x06 */
		TVP5150_COLOR_KIL_THSH_CTL,0x10
	},
	{ /* 0x07 */
		TVP5150_LUMA_PROC_CTL_1,0x60
	},
	{ /* 0x08 */
		TVP5150_LUMA_PROC_CTL_2,0x00
	},
	{ /* 0x09 */
		TVP5150_BRIGHT_CTL,0x80
	},
	{ /* 0x0a */
		TVP5150_SATURATION_CTL,0x80
	},
	{ /* 0x0b */
		TVP5150_HUE_CTL,0x00
	},
	{ /* 0x0c */
		TVP5150_CONTRAST_CTL,0x80
	},
	{ /* 0x0d */
		TVP5150_DATA_RATE_SEL,0x47
	},
	{ /* 0x0e */
		TVP5150_LUMA_PROC_CTL_3,0x00
	},
	{ /* 0x0f */
		TVP5150_CONF_SHARED_PIN,0x08
	},
	{ /* 0x11 */
		TVP5150_ACT_VD_CROP_ST_MSB,0x00
	},
	{ /* 0x12 */
		TVP5150_ACT_VD_CROP_ST_LSB,0x00
	},
	{ /* 0x13 */
		TVP5150_ACT_VD_CROP_STP_MSB,0x00
	},
	{ /* 0x14 */
		TVP5150_ACT_VD_CROP_STP_LSB,0x00
	},
	{ /* 0x15 */
		TVP5150_GENLOCK,0x01
	},
	{ /* 0x16 */
		TVP5150_HORIZ_SYNC_START,0x80
	},
	{ /* 0x18 */
		TVP5150_VERT_BLANKING_START,0x00
	},
	{ /* 0x19 */
		TVP5150_VERT_BLANKING_STOP,0x00
	},
	{ /* 0x1a */
		TVP5150_CHROMA_PROC_CTL_1,0x0c
	},
	{ /* 0x1b */
		TVP5150_CHROMA_PROC_CTL_2,0x14
	},
	{ /* 0x1c */
		TVP5150_INT_RESET_REG_B,0x00
	},
	{ /* 0x1d */
		TVP5150_INT_ENABLE_REG_B,0x00
	},
	{ /* 0x1e */
		TVP5150_INTT_CONFIG_REG_B,0x00
	},
	{ /* 0x28 */
		TVP5150_VIDEO_STD,0x00
	},
	{ /* 0x2e */
		TVP5150_MACROVISION_ON_CTR,0x0f
	},
	{ /* 0x2f */
		TVP5150_MACROVISION_OFF_CTR,0x01
	},
	{ /* 0xbb */
		TVP5150_TELETEXT_FIL_ENA,0x00
	},
	{ /* 0xc0 */
		TVP5150_INT_STATUS_REG_A,0x00
	},
	{ /* 0xc1 */
		TVP5150_INT_ENABLE_REG_A,0x00
	},
	{ /* 0xc2 */
		TVP5150_INT_CONF,0x04
	},
	{ /* 0xc8 */
		TVP5150_FIFO_INT_THRESHOLD,0x80
	},
	{ /* 0xc9 */
		TVP5150_FIFO_RESET,0x00
	},
	{ /* 0xca */
		TVP5150_LINE_NUMBER_INT,0x00
	},
	{ /* 0xcb */
		TVP5150_PIX_ALIGN_REG_LOW,0x4e
	},
	{ /* 0xcc */
		TVP5150_PIX_ALIGN_REG_HIGH,0x00
	},
	{ /* 0xcd */
		TVP5150_FIFO_OUT_CTRL,0x01
	},
	{ /* 0xcf */
		TVP5150_FULL_FIELD_ENA,0x00
	},
	{ /* 0xd0 */
		TVP5150_LINE_MODE_INI,0x00
	},
	{ /* 0xfc */
		TVP5150_FULL_FIELD_MODE_REG,0x7f
	},
	{ /* end of data */
		0xff,0xff
	}
};

/* Default values as sugested at TVP5150AM1 datasheet */
static const struct i2c_reg_value tvp5150_init_enable[] = {
	{
		TVP5150_CONF_SHARED_PIN, 2
	},{	/* Automatic offset and AGC enabled */
		TVP5150_ANAL_CHL_CTL, 0x15
	},{	/* Activate YCrCb output 0x9 or 0xd ? */
		TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
				  TVP5150_MISC_CTL_INTREQ_OE |
				  TVP5150_MISC_CTL_YCBCR_OE |
#if(0) //DeVdistress
				  TVP5150_MISC_CTL_SYNC_OE |
#endif
				  TVP5150_MISC_CTL_VBLANK |
				  TVP5150_MISC_CTL_CLOCK_OE,
	},{	/* Activates video std autodetection for all standards */
		TVP5150_AUTOSW_MSK, 0x0
	},{	/* Default format: 0x47. For 4:2:2: 0x40 */
		TVP5150_DATA_RATE_SEL, 0x47
	},{
		TVP5150_CHROMA_PROC_CTL_1, 0x0c
	},{
		TVP5150_CHROMA_PROC_CTL_2, 0x54
	},{	/* Non documented, but initialized on WinTV USB2 */
		0x27, 0x20
	},{
		0xff,0xff
	}
};

struct tvp5150_vbi_type {
	unsigned int vbi_type;
	unsigned int ini_line;
	unsigned int end_line;
	unsigned int by_field :1;
};

struct i2c_vbi_ram_value {
	u16 reg;
	struct tvp5150_vbi_type type;
	unsigned char values[16];
};

/* This struct have the values for each supported VBI Standard
 * by
 tvp5150_vbi_types should follow the same order as vbi_ram_default
 * value 0 means rom position 0x10, value 1 means rom position 0x30
 * and so on. There are 16 possible locations from 0 to 15.
 */

static struct i2c_vbi_ram_value vbi_ram_default[] =
{
	/* FIXME: Current api doesn't handle all VBI types, those not
	   yet supported are placed under #if 0 */
#if 0
	[0] = {0x010, /* Teletext, SECAM, WST System A */
		{V4L2_SLICED_TELETEXT_SECAM,6,23,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26,
		  0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
#endif
	[1] = {0x030, /* Teletext, PAL, WST System B */
		{V4L2_SLICED_TELETEXT_B,6,22,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b,
		  0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
#if 0
	[2] = {0x050, /* Teletext, PAL, WST System C */
		{V4L2_SLICED_TELETEXT_PAL_C,6,22,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
		  0xa6, 0x98, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
	[3] = {0x070, /* Teletext, NTSC, WST System B */
		{V4L2_SLICED_TELETEXT_NTSC_B,10,21,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x23,
		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
	[4] = {0x090, /* Tetetext, NTSC NABTS System C */
		{V4L2_SLICED_TELETEXT_NTSC_C,10,21,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x15, 0x00 }
	},
	[5] = {0x0b0, /* Teletext, NTSC-J, NABTS System D */
		{V4L2_SLICED_TELETEXT_NTSC_D,10,21,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xa7, 0x2e, 0x20, 0x23,
		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
	[6] = {0x0d0, /* Closed Caption, PAL/SECAM */
		{V4L2_SLICED_CAPTION_625,22,22,1},
		{ 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
		  0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
	},
#endif
	[7] = {0x0f0, /* Closed Caption, NTSC */
		{V4L2_SLICED_CAPTION_525,21,21,1},
		{ 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
		  0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
	},
	[8] = {0x110, /* Wide Screen Signal, PAL/SECAM */
		{V4L2_SLICED_WSS_625,23,23,1},
		{ 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42,
		  0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 }
	},
#if 0
	[9] = {0x130, /* Wide Screen Signal, NTSC C */
		{V4L2_SLICED_WSS_525,20,20,1},
		{ 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43,
		  0x69, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00 }
	},
	[10] = {0x150, /* Vertical Interval Timecode (VITC), PAL/SECAM */
		{V4l2_SLICED_VITC_625,6,22,0},
		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
		  0xa6, 0x85, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
	},
	[11] = {0x170, /* Vertical Interval Timecode (VITC), NTSC */
		{V4l2_SLICED_VITC_525,10,20,0},
		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
		  0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
	},
#endif
	[12] = {0x190, /* Video Program System (VPS), PAL */
		{V4L2_SLICED_VPS,16,16,0},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d,
		  0xa6, 0xda, 0x0b, 0x00, 0x00, 0x00, 0x60, 0x00 }
	},
	/* 0x1d0 User programmable */
};

static int tvp5150_write_inittab(struct v4l2_subdev *sd,
				const struct i2c_reg_value *regs)
{
	while (regs->reg != 0xff) {
		tvp5150_write(sd, regs->reg, regs->value);
		regs++;
	}
	return 0;
}

static int tvp5150_vdp_init(struct v4l2_subdev *sd)
{
	unsigned int i;
	int j;

	/* Disable Full Field */
	tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0);

	/* Before programming, Line mode should be at 0xff */
	for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++)
		tvp5150_write(sd, i, 0xff);

	/* Load Ram Table */
	for (j = 0; j < ARRAY_SIZE(vbi_ram_default); j++) {
		const struct i2c_vbi_ram_value *regs = &vbi_ram_default[j];

		if (!regs->type.vbi_type)
			continue;

		tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_HIGH, regs->reg >> 8);
		tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_LOW, regs->reg);

		for (i = 0; i < 16; i++)
			tvp5150_write(sd, TVP5150_VDP_CONF_RAM_DATA, regs->values[i]);
	}
	return 0;
}

/* Fills VBI capabilities based on i2c_vbi_ram_value struct */
static int tvp5150_g_sliced_vbi_cap(struct v4l2_subdev *sd,
				struct v4l2_sliced_vbi_cap *cap)
{
	int line, i;

	dev_dbg_lvl(sd->dev, 1, debug, "g_sliced_vbi_cap\n");
	memset(cap, 0, sizeof *cap);

	for (i = 0; i < ARRAY_SIZE(vbi_ram_default); i++) {
		const struct i2c_vbi_ram_value *regs = &vbi_ram_default[i];

		if (!regs->type.vbi_type)
			continue;

		for (line = regs->type.ini_line;
		     line <= regs->type.end_line;
		     line++) {
			cap->service_lines[0][line] |= regs->type.vbi_type;
		}
		cap->service_set |= regs->type.vbi_type;
	}
	return 0;
}

/* Set vbi processing
 * type - one of tvp5150_vbi_types
 * line - line to gather data
 * fields: bit 0 field1, bit 1, field2
 * flags (default=0xf0) is a bitmask, were set means:
 *	bit 7: enable filtering null bytes on CC
 *	bit 6: send data also to FIFO
 *	bit 5: don't allow data with errors on FIFO
 *	bit 4: enable ECC when possible
 * pix_align = pix alignment:
 *	LSB = field1
 *	MSB = field2
 */
static int tvp5150_set_vbi(struct v4l2_subdev *sd,
			unsigned int type,u8 flags, int line,
			const int fields)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	v4l2_std_id std = decoder->norm;
	u8 reg;
	int i, pos = 0;

	if (std == V4L2_STD_ALL) {
		dev_err(sd->dev, "VBI can't be configured without knowing number of lines\n");
		return 0;
	} else if (std & V4L2_STD_625_50) {
		/* Don't follow NTSC Line number convension */
		line += 3;
	}

	if (line < 6 || line > 27)
		return 0;

	for (i = 0; i < ARRAY_SIZE(vbi_ram_default); i++) {
		const struct i2c_vbi_ram_value *regs =  &vbi_ram_default[i];

		if (!regs->type.vbi_type)
			continue;

		if ((type & regs->type.vbi_type) &&
		    (line >= regs->type.ini_line) &&
		    (line <= regs->type.end_line))
			break;
		pos++;
	}

	type = pos | (flags & 0xf0);
	reg = ((line - 6) << 1) + TVP5150_LINE_MODE_INI;

	if (fields & 1)
		tvp5150_write(sd, reg, type);

	if (fields & 2)
		tvp5150_write(sd, reg + 1, type);

	return type;
}

static int tvp5150_get_vbi(struct v4l2_subdev *sd, int line)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	v4l2_std_id std = decoder->norm;
	u8 reg;
	int pos, type = 0;
	int i, ret = 0;

	if (std == V4L2_STD_ALL) {
		dev_err(sd->dev, "VBI can't be configured without knowing number of lines\n");
		return 0;
	} else if (std & V4L2_STD_625_50) {
		/* Don't follow NTSC Line number convension */
		line += 3;
	}

	if (line < 6 || line > 27)
		return 0;

	reg = ((line - 6) << 1) + TVP5150_LINE_MODE_INI;

	for (i = 0; i <= 1; i++) {
		ret = tvp5150_read(sd, reg + i);
		if (ret < 0) {
			dev_err(sd->dev, "%s: failed with error = %d\n",
				 __func__, ret);
			return 0;
		}
		pos = ret & 0x0f;
		if (pos < ARRAY_SIZE(vbi_ram_default))
			type |= vbi_ram_default[pos].type.vbi_type;
	}

	return type;
}

static int tvp5150_set_std(struct v4l2_subdev *sd, v4l2_std_id std)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	int fmt = 0;

	decoder->norm = std;

	/* First tests should be against specific std */

//DeVdistress
#if(0)
	if (std == V4L2_STD_NTSC_443) {
		fmt = VIDEO_STD_NTSC_4_43_BIT;
	} else if (std == V4L2_STD_PAL_M) {
		fmt = VIDEO_STD_PAL_M_BIT;
	} else if (std == V4L2_STD_PAL_N || std == V4L2_STD_PAL_Nc) {
		fmt = VIDEO_STD_PAL_COMBINATION_N_BIT;
	} else {
		// Then, test against generic ones
		if (std & V4L2_STD_NTSC)
			fmt = VIDEO_STD_NTSC_MJ_BIT;
		else if (std & V4L2_STD_PAL)
			fmt = VIDEO_STD_PAL_BDGHIN_BIT;
		else if (std & V4L2_STD_SECAM)
			fmt = VIDEO_STD_SECAM_BIT;
	}
#else
	fmt = VIDEO_STD_PAL_BDGHIN_BIT;
#endif

	dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt);
	tvp5150_write(sd, TVP5150_VIDEO_STD, fmt);
	return 0;
}

static int tvp5150_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	if (decoder->norm == std)
		return 0;

	/* Change cropping height limits */
	if (std & V4L2_STD_525_60)
		decoder->rect.height = TVP5150_V_MAX_525_60;
	else
		decoder->rect.height = TVP5150_V_MAX_OTHERS;


	return tvp5150_set_std(sd, std);
}

static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	/* Initializes TVP5150 to its default values */
	tvp5150_write_inittab(sd, tvp5150_init_default);

	/* Initializes VDP registers */
	tvp5150_vdp_init(sd);

	/* Selects decoder input */
	tvp5150_selmux(sd);

	/* Initializes TVP5150 to stream enabled values */
	tvp5150_write_inittab(sd, tvp5150_init_enable);

	/* Initialize image preferences */
	v4l2_ctrl_handler_setup(&decoder->hdl);

	tvp5150_set_std(sd, decoder->norm);

	if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
		tvp5150_write(sd, TVP5150_DATA_RATE_SEL, 0x40);

	return 0;
};

static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl)
{
	struct v4l2_subdev *sd = to_sd(ctrl);
	struct tvp5150 *decoder = to_tvp5150(sd);

	switch (ctrl->id) {
	case V4L2_CID_BRIGHTNESS:
		tvp5150_write(sd, TVP5150_BRIGHT_CTL, ctrl->val);
		return 0;
	case V4L2_CID_CONTRAST:
		tvp5150_write(sd, TVP5150_CONTRAST_CTL, ctrl->val);
		return 0;
	case V4L2_CID_SATURATION:
		tvp5150_write(sd, TVP5150_SATURATION_CTL, ctrl->val);
		return 0;
	case V4L2_CID_HUE:
		tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val);
		break;
	case V4L2_CID_TEST_PATTERN:
		decoder->enable = ctrl->val ? false : true;
		tvp5150_selmux(sd);
		return 0;
	}
	return -EINVAL;
}

static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd)
{
	int val = tvp5150_read(sd, TVP5150_STATUS_REG_5);

	switch (val & 0x0F) {
	case 0x01:
		return V4L2_STD_NTSC;
	case 0x03:
		return V4L2_STD_PAL;
	case 0x05:
		return V4L2_STD_PAL_M;
	case 0x07:
		return V4L2_STD_PAL_N | V4L2_STD_PAL_Nc;
	case 0x09:
		return V4L2_STD_NTSC_443;
	case 0xb:
		return V4L2_STD_SECAM;
	default:
		return V4L2_STD_UNKNOWN;
	}
}

static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
		struct v4l2_subdev_pad_config *cfg,
		struct v4l2_subdev_format *format)
{
	struct v4l2_mbus_framefmt *f;
	struct tvp5150 *decoder = to_tvp5150(sd);

	//DeVdistress
#if(0)
	if (!format || (format->pad != DEMOD_PAD_VID_OUT))
		return -EINVAL;
#else
	if (!format || format->pad)
		return -EINVAL;
#endif

	f = &format->format;

	f->width = decoder->rect.width;
	f->height = decoder->rect.height / 2;

	f->code = MEDIA_BUS_FMT_UYVY8_2X8;
	f->field = V4L2_FIELD_ALTERNATE;
	f->colorspace = V4L2_COLORSPACE_SMPTE170M;

	dev_dbg_lvl(sd->dev, 1, debug, "width = %d, height = %d\n", f->width,
			f->height);

	return 0;
}

static int tvp5150_set_selection(struct v4l2_subdev *sd,
				 struct v4l2_subdev_pad_config *cfg,
				 struct v4l2_subdev_selection *sel)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	struct v4l2_rect rect = sel->r;
	v4l2_std_id std;
	int hmax;

	if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE ||
	    sel->target != V4L2_SEL_TGT_CROP)
		return -EINVAL;

	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
		__func__, rect.left, rect.top, rect.width, rect.height);

	/* tvp5150 has some special limits */
	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
	rect.width = clamp_t(unsigned int, rect.width,
			     TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left,
			     TVP5150_H_MAX - rect.left);
	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);

	/* Calculate height based on current standard */
	if (decoder->norm == V4L2_STD_ALL)
		std = tvp5150_read_std(sd);
	else
		std = decoder->norm;

	if (std & V4L2_STD_525_60)
		hmax = TVP5150_V_MAX_525_60;
	else
		hmax = TVP5150_V_MAX_OTHERS;

	rect.height = clamp_t(unsigned int, rect.height,
			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
			      hmax - rect.top);

	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
		      rect.top + rect.height - hmax);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
		      rect.left >> TVP5150_CROP_SHIFT);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
		      rect.left | (1 << TVP5150_CROP_SHIFT));
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
		      TVP5150_CROP_SHIFT);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);

	decoder->rect = rect;

	return 0;
}

static int tvp5150_get_selection(struct v4l2_subdev *sd,
				 struct v4l2_subdev_pad_config *cfg,
				 struct v4l2_subdev_selection *sel)
{
	struct tvp5150 *decoder = container_of(sd, struct tvp5150, sd);
	v4l2_std_id std;

	if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE)
		return -EINVAL;

	switch (sel->target) {
	case V4L2_SEL_TGT_CROP_BOUNDS:
	case V4L2_SEL_TGT_CROP_DEFAULT:
		sel->r.left = 0;
		sel->r.top = 0;
		sel->r.width = TVP5150_H_MAX;

		/* Calculate height based on current standard */
		if (decoder->norm == V4L2_STD_ALL)
			std = tvp5150_read_std(sd);
		else
			std = decoder->norm;
		if (std & V4L2_STD_525_60)
			sel->r.height = TVP5150_V_MAX_525_60;
		else
			sel->r.height = TVP5150_V_MAX_OTHERS;
		return 0;
	case V4L2_SEL_TGT_CROP:
		sel->r = decoder->rect;
		return 0;
	default:
		return -EINVAL;
	}
}

static int tvp5150_g_mbus_config(struct v4l2_subdev *sd,
				 struct v4l2_mbus_config *cfg)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	cfg->type = decoder->mbus_type;
	cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING
		   | V4L2_MBUS_FIELD_EVEN_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH;

	return 0;
}

/****************************************************************************
			V4L2 subdev pad ops
 ****************************************************************************/
static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
		struct v4l2_subdev_pad_config *cfg,
		struct v4l2_subdev_mbus_code_enum *code)
{
	if (code->pad || code->index)
		return -EINVAL;

	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
	return 0;
}

static int tvp5150_enum_frame_size(struct v4l2_subdev *sd,
				   struct v4l2_subdev_pad_config *cfg,
				   struct v4l2_subdev_frame_size_enum *fse)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	if (fse->index >= 8 || fse->code != MEDIA_BUS_FMT_UYVY8_2X8)
		return -EINVAL;

	fse->code = MEDIA_BUS_FMT_UYVY8_2X8;
	fse->min_width = decoder->rect.width;
	fse->max_width = decoder->rect.width;
	fse->min_height = decoder->rect.height / 2;
	fse->max_height = decoder->rect.height / 2;

	return 0;
}

/****************************************************************************
			Media entity ops
 ****************************************************************************/

#ifdef CONFIG_MEDIA_CONTROLLER
static int tvp5150_link_setup(struct media_entity *entity,
			      const struct media_pad *local,
			      const struct media_pad *remote, u32 flags)
{
	struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
	struct tvp5150 *decoder = to_tvp5150(sd);
	int i;

	for (i = 0; i < TVP5150_INPUT_NUM; i++) {
		if (remote->entity == &decoder->input_ent[i])
			break;
	}

	/* Do nothing for entities that are not input connectors */
	if (i == TVP5150_INPUT_NUM)
		return 0;

	decoder->input = i;

	tvp5150_selmux(sd);

	return 0;
}

static const struct media_entity_operations tvp5150_sd_media_ops = {
	.link_setup = tvp5150_link_setup,
};
#endif

/****************************************************************************
			I2C Command
 ****************************************************************************/

static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	int val;

	/* Enable or disable the video output signals. */
	val = tvp5150_read(sd, TVP5150_MISC_CTL);
	if (val < 0)
		return val;

	val &= ~(TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_SYNC_OE |
		 TVP5150_MISC_CTL_CLOCK_OE);

	if (enable) {
		/*
		 * Enable the YCbCr and clock outputs. In discrete sync mode
		 * (non-BT.656) additionally enable the the sync outputs.
		 */
		val |= TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_CLOCK_OE;
		if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
			val |= TVP5150_MISC_CTL_SYNC_OE;
	}

	tvp5150_write(sd, TVP5150_MISC_CTL, val);

	return 0;
}

static int tvp5150_s_routing(struct v4l2_subdev *sd,
			     u32 input, u32 output, u32 config)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	decoder->input = input;
	decoder->output = output;

	if (output == TVP5150_BLACK_SCREEN)
		decoder->enable = false;
	else
		decoder->enable = true;

	tvp5150_selmux(sd);
	return 0;
}

static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt)
{
	/* this is for capturing 36 raw vbi lines
	   if there's a way to cut off the beginning 2 vbi lines
	   with the tvp5150 then the vbi line count could be lowered
	   to 17 lines/field again, although I couldn't find a register
	   which could do that cropping */
	if (fmt->sample_format == V4L2_PIX_FMT_GREY)
		tvp5150_write(sd, TVP5150_LUMA_PROC_CTL_1, 0x70);
	if (fmt->count[0] == 18 && fmt->count[1] == 18) {
		tvp5150_write(sd, TVP5150_VERT_BLANKING_START, 0x00);
		tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, 0x01);
	}
	return 0;
}

static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
{
	int i;

	if (svbi->service_set != 0) {
		for (i = 0; i <= 23; i++) {
			svbi->service_lines[1][i] = 0;
			svbi->service_lines[0][i] =
				tvp5150_set_vbi(sd, svbi->service_lines[0][i],
						0xf0, i, 3);
		}
		/* Enables FIFO */
		tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 1);
	} else {
		/* Disables FIFO*/
		tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 0);

		/* Disable Full Field */
		tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0);

		/* Disable Line modes */
		for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++)
			tvp5150_write(sd, i, 0xff);
	}
	return 0;
}

static int tvp5150_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
{
	int i, mask = 0;

	memset(svbi->service_lines, 0, sizeof(svbi->service_lines));

	for (i = 0; i <= 23; i++) {
		svbi->service_lines[0][i] =
			tvp5150_get_vbi(sd, i);
		mask |= svbi->service_lines[0][i];
	}
	svbi->service_set = mask;
	return 0;
}

#ifdef CONFIG_VIDEO_ADV_DEBUG
static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
{
	int res;

	res = tvp5150_read(sd, reg->reg & 0xff);
	if (res < 0) {
		dev_err(sd->dev, "%s: failed with error = %d\n", __func__, res);
		return res;
	}

	reg->val = res;
	reg->size = 1;
	return 0;
}

static int tvp5150_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg)
{
	return tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff);
}
#endif

static int tvp5150_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
{
	int status = tvp5150_read(sd, 0x88);

	vt->signal = ((status & 0x04) && (status & 0x02)) ? 0xffff : 0x0;
	return 0;
}

static int tvp5150_registered(struct v4l2_subdev *sd)
{
#ifdef CONFIG_MEDIA_CONTROLLER
	struct tvp5150 *decoder = to_tvp5150(sd);
	int ret = 0;
	int i;

	for (i = 0; i < TVP5150_INPUT_NUM; i++) {
		struct media_entity *input = &decoder->input_ent[i];
		struct media_pad *pad = &decoder->input_pad[i];

		if (!input->name)
			continue;

		decoder->input_pad[i].flags = MEDIA_PAD_FL_SOURCE;

		ret = media_entity_pads_init(input, 1, pad);
		if (ret < 0)
			return ret;

		ret = media_device_register_entity(sd->v4l2_dev->mdev, input);
		if (ret < 0)
			return ret;

		ret = media_create_pad_link(input, 0, &sd->entity,
					    DEMOD_PAD_IF_INPUT, 0);
		if (ret < 0) {
			media_device_unregister_entity(input);
			return ret;
		}
	}
#endif

	return 0;
}

/* ----------------------------------------------------------------------- */

static const struct v4l2_ctrl_ops tvp5150_ctrl_ops = {
	.s_ctrl = tvp5150_s_ctrl,
};

static const struct v4l2_subdev_core_ops tvp5150_core_ops = {
	.log_status = tvp5150_log_status,
	.reset = tvp5150_reset,
#ifdef CONFIG_VIDEO_ADV_DEBUG
	.g_register = tvp5150_g_register,
	.s_register = tvp5150_s_register,
#endif
};

static const struct v4l2_subdev_tuner_ops tvp5150_tuner_ops = {
	.g_tuner = tvp5150_g_tuner,
};

static const struct v4l2_subdev_video_ops tvp5150_video_ops = {
	.s_std = tvp5150_s_std,
	.s_stream = tvp5150_s_stream,
	.s_routing = tvp5150_s_routing,
	.g_mbus_config = tvp5150_g_mbus_config,
};

static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
	.g_sliced_vbi_cap = tvp5150_g_sliced_vbi_cap,
	.g_sliced_fmt = tvp5150_g_sliced_fmt,
	.s_sliced_fmt = tvp5150_s_sliced_fmt,
	.s_raw_fmt = tvp5150_s_raw_fmt,
};

static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = {
	.enum_mbus_code = tvp5150_enum_mbus_code,
	.enum_frame_size = tvp5150_enum_frame_size,
	.set_fmt = tvp5150_fill_fmt,
	.get_fmt = tvp5150_fill_fmt,
	.get_selection = tvp5150_get_selection,
	.set_selection = tvp5150_set_selection,
};

static const struct v4l2_subdev_ops tvp5150_ops = {
	.core = &tvp5150_core_ops,
	.tuner = &tvp5150_tuner_ops,
	.video = &tvp5150_video_ops,
	.vbi = &tvp5150_vbi_ops,
	.pad = &tvp5150_pad_ops,
};

static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = {
	.registered = tvp5150_registered,
};


/****************************************************************************
			I2C Client & Driver
 ****************************************************************************/

static int tvp5150_detect_version(struct tvp5150 *core)
{
	struct v4l2_subdev *sd = &core->sd;
	struct i2c_client *c = v4l2_get_subdevdata(sd);
	unsigned int i;
	u8 regs[4];
	int res;

	/*
	 * Read consequent registers - TVP5150_MSB_DEV_ID, TVP5150_LSB_DEV_ID,
	 * TVP5150_ROM_MAJOR_VER, TVP5150_ROM_MINOR_VER
	 */
	for (i = 0; i < 4; i++) {
		res = tvp5150_read(sd, TVP5150_MSB_DEV_ID + i);
		if (res < 0)
			return res;
		regs[i] = res;
	}

	core->dev_id = (regs[0] << 8) | regs[1];
	core->rom_ver = (regs[2] << 8) | regs[3];

	dev_info(sd->dev, "tvp%04x (%u.%u) chip found @ 0x%02x (%s)\n",
		  core->dev_id, regs[2], regs[3], c->addr << 1,
		  c->adapter->name);

	if (core->dev_id == 0x5150 && core->rom_ver == 0x0321) {
		dev_info(sd->dev, "tvp5150a detected.\n");
	} else if (core->dev_id == 0x5150 && core->rom_ver == 0x0400) {
		dev_info(sd->dev, "tvp5150am1 detected.\n");

		/* ITU-T BT.656.4 timing */
		tvp5150_write(sd, TVP5150_REV_SELECT, 0);
	} else if (core->dev_id == 0x5151 && core->rom_ver == 0x0100) {
		dev_info(sd->dev, "tvp5151 detected.\n");
	} else {
		dev_info(sd->dev, "*** unknown tvp%04x chip detected.\n",
			  core->dev_id);
	}

	return 0;
}

static int tvp5150_init(struct i2c_client *c)
{
	struct gpio_desc *pdn_gpio;
	struct gpio_desc *reset_gpio;

	pdn_gpio = devm_gpiod_get_optional(&c->dev, "pdn", GPIOD_OUT_HIGH);
	if (IS_ERR(pdn_gpio))
		return PTR_ERR(pdn_gpio);

	if (pdn_gpio) {
		gpiod_set_value_cansleep(pdn_gpio, 0);
		/* Delay time between power supplies active and reset */
		msleep(20);
	}

	reset_gpio = devm_gpiod_get_optional(&c->dev, "reset", GPIOD_OUT_HIGH);
	if (IS_ERR(reset_gpio))
		return PTR_ERR(reset_gpio);

	if (reset_gpio) {
		/* RESETB pulse duration */
		ndelay(500);
		gpiod_set_value_cansleep(reset_gpio, 0);
		/* Delay time between end of reset to I2C active */
		usleep_range(200, 250);
	}

	return 0;
}

static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
{
	struct v4l2_fwnode_endpoint bus_cfg;
	struct device_node *ep;
#ifdef CONFIG_MEDIA_CONTROLLER
	struct device_node *connectors, *child;
	struct media_entity *input;
	const char *name;
	u32 input_type;
#endif
	unsigned int flags;
	int ret = 0;

	ep = of_graph_get_next_endpoint(np, NULL);
	if (!ep)
		return -EINVAL;

	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
	if (ret)
		goto err;

	flags = bus_cfg.bus.parallel.flags;

	if (bus_cfg.bus_type == V4L2_MBUS_PARALLEL &&
	    !(flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH &&
	      flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH &&
	      flags & V4L2_MBUS_FIELD_EVEN_LOW)) {
		ret = -EINVAL;
		goto err;
	}

	decoder->mbus_type = bus_cfg.bus_type;

#ifdef CONFIG_MEDIA_CONTROLLER
	connectors = of_get_child_by_name(np, "connectors");

	if (!connectors)
		goto err;

	for_each_available_child_of_node(connectors, child) {
		ret = of_property_read_u32(child, "input", &input_type);
		if (ret) {
			dev_err(decoder->sd.dev,
				 "missing type property in node %s\n",
				 child->name);
			goto err_connector;
		}

		if (input_type >= TVP5150_INPUT_NUM) {
			ret = -EINVAL;
			goto err_connector;
		}

		input = &decoder->input_ent[input_type];

		/* Each input connector can only be defined once */
		if (input->name) {
			dev_err(decoder->sd.dev,
				 "input %s with same type already exists\n",
				 input->name);
			ret = -EINVAL;
			goto err_connector;
		}

		switch (input_type) {
		case TVP5150_COMPOSITE0:
		case TVP5150_COMPOSITE1:
			input->function = MEDIA_ENT_F_CONN_COMPOSITE;
			break;
		case TVP5150_SVIDEO:
			input->function = MEDIA_ENT_F_CONN_SVIDEO;
			break;
		}

		input->flags = MEDIA_ENT_FL_CONNECTOR;

		ret = of_property_read_string(child, "label", &name);
		if (ret < 0) {
			dev_err(decoder->sd.dev,
				 "missing label property in node %s\n",
				 child->name);
			goto err_connector;
		}

		input->name = name;
	}

err_connector:
	of_node_put(connectors);
#endif
err:
	of_node_put(ep);
	return ret;
}

static const char * const tvp5150_test_patterns[2] = {
	"Disabled",
	"Black screen"
};

//DeVdistress
void tvp5150_my_set_selection(struct v4l2_subdev *sd, struct v4l2_rect *sel)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	struct v4l2_rect rect;
	v4l2_std_id std;
	int hmax;

	memcpy(&rect, sel, sizeof(rect));

	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
		__func__, rect.left, rect.top, rect.width, rect.height);

	/* tvp5150 has some special limits */
	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
	rect.width = clamp_t(unsigned int, rect.width,
			     (TVP5150_H_MAX + rect.left)- TVP5150_MAX_CROP_LEFT - rect.left,
				 (TVP5150_H_MAX + rect.left) - rect.left);
	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);

	/* Calculate height based on current standard */
	if (decoder->norm == V4L2_STD_ALL)
		std = tvp5150_read_std(sd);
	else
		std = decoder->norm;

	if (std & V4L2_STD_525_60)
		hmax = TVP5150_V_MAX_525_60 + rect.top; //было без rect.top
	else
		hmax = TVP5150_V_MAX_OTHERS + rect.top; //было без rect.top

	rect.height = clamp_t(unsigned int, rect.height,
			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
			      hmax - rect.top);

	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
		      rect.top + rect.height - hmax);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
		      rect.left >> TVP5150_CROP_SHIFT);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
		      rect.left | (1 << TVP5150_CROP_SHIFT));
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
		      TVP5150_CROP_SHIFT);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);

	//decoder->rect = rect;
}

static int tvp5150_probe(struct i2c_client *c,
			 const struct i2c_device_id *id)
{
	struct tvp5150 *core;
	struct v4l2_subdev *sd;
	struct device_node *np = c->dev.of_node;
	int res;

#if(0)//DeVdistress
	struct v4l2_rect sel;
#endif

	/* Check if the adapter supports the needed features */
	if (!i2c_check_functionality(c->adapter,
	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
		return -EIO;

	res = tvp5150_init(c);
	if (res)
		return res;

	core = devm_kzalloc(&c->dev, sizeof(*core), GFP_KERNEL);
	if (!core)
		return -ENOMEM;

	sd = &core->sd;

	if (IS_ENABLED(CONFIG_OF) && np) {
		res = tvp5150_parse_dt(core, np);
		if (res) {
			dev_err(sd->dev, "DT parsing error: %d\n", res);
			return res;
		}
	} else {
		/* Default to BT.656 embedded sync */
		core->mbus_type = V4L2_MBUS_BT656;
	}

	//DeVdistress
	#if(0)
	#else
		core->mbus_type = V4L2_MBUS_BT656;
	#endif

	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
	sd->internal_ops = &tvp5150_internal_ops;
	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;

#if defined(CONFIG_MEDIA_CONTROLLER)
	core->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
	core->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
	core->pads[DEMOD_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;

	sd->entity.function = MEDIA_ENT_F_ATV_DECODER;

	res = media_entity_pads_init(&sd->entity, DEMOD_NUM_PADS, core->pads);
	if (res < 0)
		return res;

	sd->entity.ops = &tvp5150_sd_media_ops;
#endif

	res = tvp5150_detect_version(core);
	if (res < 0)
		return res;

//DeVdistress
#if(0)
	core->norm = V4L2_STD_ALL;	// Default is autodetect
	core->input = TVP5150_COMPOSITE1;
#else
	core->norm = V4L2_STD_ALL;	// Default is autodetect
	core->input = TVP5150_COMPOSITE0;
#endif

	core->enable = true;

	v4l2_ctrl_handler_init(&core->hdl, 5);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_CONTRAST, 0, 255, 1, 128);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_SATURATION, 0, 255, 1, 128);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_HUE, -128, 127, 1, 0);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_PIXEL_RATE, 27000000,
			27000000, 1, 27000000);
	v4l2_ctrl_new_std_menu_items(&core->hdl, &tvp5150_ctrl_ops,
				     V4L2_CID_TEST_PATTERN,
				     ARRAY_SIZE(tvp5150_test_patterns),
				     0, 0, tvp5150_test_patterns);
	sd->ctrl_handler = &core->hdl;
	if (core->hdl.error) {
		res = core->hdl.error;
		goto err;
	}

	/* Default is no cropping */
	core->rect.top = 0;
	if (tvp5150_read_std(sd) & V4L2_STD_525_60)
		core->rect.height = TVP5150_V_MAX_525_60;
	else
		core->rect.height = TVP5150_V_MAX_OTHERS;
	core->rect.left = 0;
	core->rect.width = TVP5150_H_MAX;

	tvp5150_reset(sd, 0);	/* Calls v4l2_ctrl_handler_setup() */

#if(0)//DeVdistress
	sel.left   = core->rect.left   + 100;
	sel.top    = core->rect.top    + 50;
	sel.width  = core->rect.width  + 100;
	sel.height = core->rect.height + 50;
	tvp5150_my_set_selection(sd, &sel);
#endif

	res = v4l2_async_register_subdev(sd);
	if (res < 0)
		goto err;

	if (debug > 1)
		tvp5150_log_status(sd);
	return 0;

err:
	v4l2_ctrl_handler_free(&core->hdl);
	return res;
}

static int tvp5150_remove(struct i2c_client *c)
{
	struct v4l2_subdev *sd = i2c_get_clientdata(c);
	struct tvp5150 *decoder = to_tvp5150(sd);

	dev_dbg_lvl(sd->dev, 1, debug,
		"tvp5150.c: removing tvp5150 adapter on address 0x%x\n",
		c->addr << 1);

	v4l2_async_unregister_subdev(sd);
	v4l2_ctrl_handler_free(&decoder->hdl);
	return 0;
}

/* ----------------------------------------------------------------------- */

static const struct i2c_device_id tvp5150_id[] = {
	{ "tvp5150", 0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, tvp5150_id);

#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id tvp5150_of_match[] = {
	{ .compatible = "ti,tvp5150", },
	{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, tvp5150_of_match);
#endif

static struct i2c_driver tvp5150_driver = {
	.driver = {
		.of_match_table = of_match_ptr(tvp5150_of_match),
		.name	= "tvp5150",
	},
	.probe		= tvp5150_probe,
	.remove		= tvp5150_remove,
	.id_table	= tvp5150_id,
};

module_i2c_driver(tvp5150_driver);

 mux_data.h (for Uboot)5618.mux_data.h

 patch.mux_data.hpatch.mux_data.h

 patch.tvp5150.c

patch.tvp5150.c
--- tvp5150.c~original	2019-02-08 11:41:07.329365976 +0300
+++ tvp5150.c	2019-02-15 11:02:57.074649054 +0300
@@ -21,21 +21,25 @@
 
 #include "tvp5150_reg.h"
 
-#define TVP5150_H_MAX		720U
+#define TVP5150_H_MAX			720U
 #define TVP5150_V_MAX_525_60	480U
 #define TVP5150_V_MAX_OTHERS	576U
 #define TVP5150_MAX_CROP_LEFT	511
 #define TVP5150_MAX_CROP_TOP	127
-#define TVP5150_CROP_SHIFT	2
+#define TVP5150_CROP_SHIFT		2
 
 MODULE_DESCRIPTION("Texas Instruments TVP5150A/TVP5150AM1/TVP5151 video decoder driver");
 MODULE_AUTHOR("Mauro Carvalho Chehab");
 MODULE_LICENSE("GPL");
 
-
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Debug level (0-2)");
+//DeVdistress
+#if(0)
+	static int debug;
+	module_param(debug, int, 0644);
+	MODULE_PARM_DESC(debug, "Debug level (0-2)");
+#else
+	static int debug = 2;
+#endif
 
 #define dprintk0(__dev, __arg...) dev_dbg_lvl(__dev, 0, 0, __arg)
 
@@ -273,6 +277,8 @@
 			input = 8;
 	}
 
+//DeVdistress
+#if(1)
 	switch (decoder->input) {
 	case TVP5150_COMPOSITE1:
 		input |= 2;
@@ -284,6 +290,7 @@
 		input |= 1;
 		break;
 	}
+#endif
 
 	dev_dbg_lvl(sd->dev, 1, debug, "Selecting video route: route input=%i, output=%i => tvp5150 input=%i, opmode=%i\n",
 			decoder->input, decoder->output,
@@ -463,7 +470,9 @@
 		TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
 				  TVP5150_MISC_CTL_INTREQ_OE |
 				  TVP5150_MISC_CTL_YCBCR_OE |
+#if(0) //DeVdistress
 				  TVP5150_MISC_CTL_SYNC_OE |
+#endif
 				  TVP5150_MISC_CTL_VBLANK |
 				  TVP5150_MISC_CTL_CLOCK_OE,
 	},{	/* Activates video std autodetection for all standards */
@@ -745,6 +754,8 @@
 
 	/* First tests should be against specific std */
 
+//DeVdistress
+#if(0)
 	if (std == V4L2_STD_NTSC_443) {
 		fmt = VIDEO_STD_NTSC_4_43_BIT;
 	} else if (std == V4L2_STD_PAL_M) {
@@ -752,7 +763,7 @@
 	} else if (std == V4L2_STD_PAL_N || std == V4L2_STD_PAL_Nc) {
 		fmt = VIDEO_STD_PAL_COMBINATION_N_BIT;
 	} else {
-		/* Then, test against generic ones */
+		// Then, test against generic ones
 		if (std & V4L2_STD_NTSC)
 			fmt = VIDEO_STD_NTSC_MJ_BIT;
 		else if (std & V4L2_STD_PAL)
@@ -760,6 +771,9 @@
 		else if (std & V4L2_STD_SECAM)
 			fmt = VIDEO_STD_SECAM_BIT;
 	}
+#else
+	fmt = VIDEO_STD_PAL_BDGHIN_BIT;
+#endif
 
 	dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt);
 	tvp5150_write(sd, TVP5150_VIDEO_STD, fmt);
@@ -865,8 +879,14 @@
 	struct v4l2_mbus_framefmt *f;
 	struct tvp5150 *decoder = to_tvp5150(sd);
 
+	//DeVdistress
+#if(0)
 	if (!format || (format->pad != DEMOD_PAD_VID_OUT))
 		return -EINVAL;
+#else
+	if (!format || format->pad)
+		return -EINVAL;
+#endif
 
 	f = &format->format;
 
@@ -879,6 +899,7 @@
 
 	dev_dbg_lvl(sd->dev, 1, debug, "width = %d, height = %d\n", f->width,
 			f->height);
+
 	return 0;
 }
 
@@ -1456,6 +1477,57 @@
 	"Black screen"
 };
 
+//DeVdistress
+void tvp5150_my_set_selection(struct v4l2_subdev *sd, struct v4l2_rect *sel)
+{
+	struct tvp5150 *decoder = to_tvp5150(sd);
+	struct v4l2_rect rect;
+	v4l2_std_id std;
+	int hmax;
+
+	memcpy(&rect, sel, sizeof(rect));
+
+	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
+		__func__, rect.left, rect.top, rect.width, rect.height);
+
+	/* tvp5150 has some special limits */
+	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
+	rect.width = clamp_t(unsigned int, rect.width,
+			     (TVP5150_H_MAX + rect.left)- TVP5150_MAX_CROP_LEFT - rect.left,
+				 (TVP5150_H_MAX + rect.left) - rect.left);
+	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
+
+	/* Calculate height based on current standard */
+	if (decoder->norm == V4L2_STD_ALL)
+		std = tvp5150_read_std(sd);
+	else
+		std = decoder->norm;
+
+	if (std & V4L2_STD_525_60)
+		hmax = TVP5150_V_MAX_525_60 + rect.top; //было без rect.top
+	else
+		hmax = TVP5150_V_MAX_OTHERS + rect.top; //было без rect.top
+
+	rect.height = clamp_t(unsigned int, rect.height,
+			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
+			      hmax - rect.top);
+
+	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
+	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
+		      rect.top + rect.height - hmax);
+	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
+		      rect.left >> TVP5150_CROP_SHIFT);
+	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
+		      rect.left | (1 << TVP5150_CROP_SHIFT));
+	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
+		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
+		      TVP5150_CROP_SHIFT);
+	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
+		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);
+
+	//decoder->rect = rect;
+}
+
 static int tvp5150_probe(struct i2c_client *c,
 			 const struct i2c_device_id *id)
 {
@@ -1464,6 +1536,10 @@
 	struct device_node *np = c->dev.of_node;
 	int res;
 
+#if(0)//DeVdistress
+	struct v4l2_rect sel;
+#endif
+
 	/* Check if the adapter supports the needed features */
 	if (!i2c_check_functionality(c->adapter,
 	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
@@ -1490,6 +1566,12 @@
 		core->mbus_type = V4L2_MBUS_BT656;
 	}
 
+	//DeVdistress
+	#if(0)
+	#else
+		core->mbus_type = V4L2_MBUS_BT656;
+	#endif
+
 	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
 	sd->internal_ops = &tvp5150_internal_ops;
 	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
@@ -1512,8 +1594,15 @@
 	if (res < 0)
 		return res;
 
-	core->norm = V4L2_STD_ALL;	/* Default is autodetect */
+//DeVdistress
+#if(0)
+	core->norm = V4L2_STD_ALL;	// Default is autodetect
 	core->input = TVP5150_COMPOSITE1;
+#else
+	core->norm = V4L2_STD_ALL;	// Default is autodetect
+	core->input = TVP5150_COMPOSITE0;
+#endif
+
 	core->enable = true;
 
 	v4l2_ctrl_handler_init(&core->hdl, 5);
@@ -1549,6 +1638,14 @@
 
 	tvp5150_reset(sd, 0);	/* Calls v4l2_ctrl_handler_setup() */
 
+#if(0)//DeVdistress
+	sel.left   = core->rect.left   + 100;
+	sel.top    = core->rect.top    + 50;
+	sel.width  = core->rect.width  + 100;
+	sel.height = core->rect.height + 50;
+	tvp5150_my_set_selection(sd, &sel);
+#endif
+
 	res = v4l2_async_register_subdev(sd);
 	if (res < 0)
 		goto err;

 patch.vip.c

patch.vip.c
--- vip.c~original	2018-12-20 07:34:34.000000000 +0300
+++ vip.c	2019-02-12 16:37:00.370693239 +0300
@@ -39,10 +39,14 @@
 #define VIP_MODULE_NAME "vip"
 #define VIP_INPUT_NAME "Vin0"
 
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "debug level (0-8)");
-
+//DeVdistress
+#if(0)
+	static int debug;
+	module_param(debug, int, 0644);
+	MODULE_PARM_DESC(debug, "debug level (0-8)");
+#else
+	static int debug = 3;
+#endif
 /*
  * Minimum and maximum frame sizes
  */
@@ -3051,24 +3055,37 @@
 		 */
 		if (vip_is_mbuscode_rgb(port->fmt->code)) {
 			sync_type = EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444;
+			//DeVdistress
+			vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444\n", "vip_setup_parser");
 		} else {
 			switch (endpoint->bus.parallel.num_channels) {
 			case 4:
 				sync_type = EMBEDDED_SYNC_4X_MULTIPLEXED_YUV422;
+				//DeVdistress
+				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_4X_MULTIPLEXED_YUV422\n", "vip_setup_parser");
 				break;
 			case 2:
 				sync_type = EMBEDDED_SYNC_2X_MULTIPLEXED_YUV422;
+				//DeVdistress
+				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_2X_MULTIPLEXED_YUV422\n", "vip_setup_parser");
 				break;
 			case 1:
 				sync_type = EMBEDDED_SYNC_SINGLE_YUV422;
+				//DeVdistress
+				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_YUV422\n", "vip_setup_parser");
 				break;
 			default:
 				sync_type =
 				EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422;
+				//DeVdistress
+				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422\n", "vip_setup_parser");
 			}
-			if (endpoint->bus.parallel.pixmux == 0)
+			if (endpoint->bus.parallel.pixmux == 0){
 				sync_type =
 				EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422;
+				//DeVdistress
+				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422\n", "vip_setup_parser");
+			}
 		}
 
 	} else if (endpoint->bus_type == V4L2_MBUS_PARALLEL) {
@@ -3077,29 +3094,53 @@
 		switch (endpoint->bus.parallel.bus_width) {
 		case 24:
 			iface = SINGLE_24B_INTERFACE;
+			//DeVdistress
+			vip_dbg(1, dev, "%s: SINGLE_24B_INTERFACE\n", "vip_setup_parser");
 		break;
 		case 16:
 			iface = SINGLE_16B_INTERFACE;
+			//DeVdistress
+			vip_dbg(1, dev, "%s: SINGLE_16B_INTERFACE\n", "vip_setup_parser");
 		break;
 		case 8:
 		default:
 			iface = DUAL_8B_INTERFACE;
+			//DeVdistress
+			vip_dbg(1, dev, "%s: DUAL_8B_INTERFACE\n", "vip_setup_parser");
 		}
 
-		if (vip_is_mbuscode_rgb(port->fmt->code))
+		if (vip_is_mbuscode_rgb(port->fmt->code)){
 			sync_type = DISCRETE_SYNC_SINGLE_RGB_24B;
-		else
+			//DeVdistress
+			vip_dbg(1, dev, "%s: DISCRETE_SYNC_SINGLE_RGB_24B\n", "vip_setup_parser");
+		}
+		else{
 			sync_type = DISCRETE_SYNC_SINGLE_YUV422;
+			//DeVdistress
+			vip_dbg(1, dev, "%s: DISCRETE_SYNC_SINGLE_YUV422\n", "vip_setup_parser");
+		}
 
-		if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
+		if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH){
 			config0 |= VIP_HSYNC_POLARITY;
-		else if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
+			//DeVdistress
+			vip_dbg(1, dev, "%s: VIP_HSYNC_POLARITY=1\n", "vip_setup_parser");
+		}
+		else if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW){
 			config0 &= ~VIP_HSYNC_POLARITY;
+			//DeVdistress
+			vip_dbg(1, dev, "%s: VIP_HSYNC_POLARITY=0\n", "vip_setup_parser");
+		}
 
-		if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
+		if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH){
 			config0 |= VIP_VSYNC_POLARITY;
-		else if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
+			//DeVdistress
+			vip_dbg(1, dev, "%s: VIP_VSYNC_POLARITY=1\n", "vip_setup_parser");
+		}
+		else if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW){
 			config0 &= ~VIP_VSYNC_POLARITY;
+			//DeVdistress
+			vip_dbg(1, dev, "%s: VIP_VSYNC_POLARITY=0\n", "vip_setup_parser");
+		}
 
 		config0 &= ~VIP_USE_ACTVID_HSYNC_ONLY;
 		config0 |= VIP_ACTVID_POLARITY;
@@ -3113,8 +3154,13 @@
 	if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) {
 		vip_set_pclk_invert(port);
 		config0 |= VIP_PIXCLK_EDGE_POLARITY;
+		//DeVdistress
+		vip_dbg(1, dev, "%s: VIP_PIXCLK_EDGE_POLARITY=1\n", "vip_setup_parser");
+
 	} else {
 		config0 &= ~VIP_PIXCLK_EDGE_POLARITY;
+		//DeVdistress
+		vip_dbg(1, dev, "%s: VIP_PIXCLK_EDGE_POLARITY=0\n", "vip_setup_parser");
 	}
 
 	config0 |= ((sync_type & VIP_SYNC_TYPE_MASK) << VIP_SYNC_TYPE_SHFT);
@@ -3562,14 +3608,23 @@
 		port->flags |= FLAG_MULT_PORT;
 		port->num_streams_configured = 1;
 		alloc_stream(port, 0, VFL_TYPE_GRABBER);
+		//DeVdistress
+		vip_dbg(1, port, "%s: bus_type = V4L2_MBUS_PARALLEL\n", "vip_create_streams");
 	} else if (port->endpoint->bus_type == V4L2_MBUS_BT656) {
 		port->flags |= FLAG_MULT_PORT;
 		bus = &port->endpoint->bus.parallel;
+//DeVdistress
+#if(0)
 		port->num_streams_configured = bus->num_channels;
+#else
+		port->num_streams_configured = bus->num_channels = 1;
+#endif
 		for (i = 0; i < bus->num_channels; i++) {
 			if (bus->channels[i] >= 16)
 				continue;
 			alloc_stream(port, bus->channels[i], VFL_TYPE_GRABBER);
+			//DeVdistress
+			vip_dbg(1, port, "%s[channel-%u]: bus_type = V4L2_MBUS_BT656\n", "vip_create_streams", i);
 		}
 	}
 	return 0;

A3. Loaded linux:

proccess_of_loading_from_sd.log

process_of_loading_from_sd.log
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2019.02.14 15:27:27 =~=~=~=~=~=~=~=~=~=~=~=

U-Boot SPL 2018.01-00558-gca1e85e-dirty (Jan 17 2019 - 11:21:07)
DRA752-GP ES2.0
Trying to boot from MMC1
no pinctrl state for default mode
no pinctrl state for default mode


U-Boot 2018.01-00558-gca1e85e-dirty (Jan 17 2019 - 11:21:07 +0300)

CPU  : DRA752-GP ES2.0
Model: TI AM5728 BeagleBoard-X15
Board: AM572x EVM REV A.3A
DRAM:  2 GiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
part_get_info_efi: *** ERROR: Invalid GPT ***
GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
SCSI:  SATA link 0 timeout.
AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: 64bit ncq stag pm led clo only pmp pio slum part ccc apst 
scanning bus for devices...
Found 0 device(s).
Net:   
Warning: ethernet@48484000 using MAC address from ROM
eth0: ethernet@48484000
Hit any key to stop autoboot:  2  1  0 
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** Unable to read file boot.scr **
1554 bytes read in 2 ms (758.8 KiB/s)
Loaded env from uEnv.txt
Importing environment from mmc0 ...
Running uenvcmd ...
1 bytes read in 2 ms (0 Bytes/s)
Already setup.
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
4026880 bytes read in 278 ms (13.8 MiB/s)
148397 bytes read in 125 ms (1.1 MiB/s)
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8ffd8000, end 8ffff3ac ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.79-gbde58ab01e (oe-user@oe-host) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #1 SMP PREEMPT Thu Dec 20 04:51:24 UTC 2018
[    0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=30c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: TI AM5728 EVM
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000095800000, size 56 MiB
[    0.000000] OF: reserved mem: initialized node ipu2-memory@95800000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000099000000, size 64 MiB
[    0.000000] OF: reserved mem: initialized node dsp1-memory@99000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009d000000, size 32 MiB
[    0.000000] OF: reserved mem: initialized node ipu1-memory@9d000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009f000000, size 8 MiB
[    0.000000] OF: reserved mem: initialized node dsp2-memory@9f000000, compatible id shared-dma-pool
[    0.000000] cma: Reserved 24 MiB at 0x00000000fe400000
[    0.000000] OMAP4: Map 0x00000000ffd00000 to fe600000 for dram barrier
[    0.000000] DRA752 ES2.0
[    0.000000] percpu: Embedded 15 pages/cpu @eed28000 s31372 r8192 d21876 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 472640
[    0.000000] Kernel command line: console=ttyO2,115200n8 root=PARTUUID=faacbb33-02 rw rootfstype=ext4 rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 1675568K/1897472K available (8192K kernel code, 347K rwdata, 2628K rodata, 2048K init, 282K bss, 33488K reserved, 188416K cma-reserved, 1283072K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0a00000   (10208 kB)
[    0.000000]       .init : 0xc0e00000 - 0xc1000000   (2048 kB)
[    0.000000]       .data : 0xc1000000 - 0xc1056e98   ( 348 kB)
[    0.000000]        .bss : 0xc1058000 - 0xc109ebe0   ( 283 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	Tasks RCU enabled.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] OMAP clockevent source: timer1 at 32786 Hz
[    0.000000] arch_timer: cp15 timer(s) running at 6.14MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x16af5adb9, max_idle_ns: 440795202250 ns
[    0.000004] sched_clock: 56 bits at 6MHz, resolution 162ns, wraps every 4398046511023ns
[    0.000016] Switching to timer-based delay loop, resolution 162ns
[    0.000352] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 58327039986419 ns
[    0.000361] OMAP clocksource: 32k_counter at 32768 Hz
[    0.000874] Console: colour dummy device 80x30
[    0.000892] WARNING: Your 'console=ttyO2' has been replaced by 'ttyS2'
[    0.000899] This ensures that you still see kernel messages. Please
[    0.000906] update your kernel commandline.
[    0.000927] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.29 BogoMIPS (lpj=61475)
[    0.000942] pid_max: default: 32768 minimum: 301
[    0.001057] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001072] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001602] CPU: Testing write buffer coherency: ok
[    0.001639] CPU0: Spectre v2: using ICIALLU workaround
[    0.001837] /cpus/cpu@0 missing clock-frequency property
[    0.001857] /cpus/cpu@1 missing clock-frequency property
[    0.001869] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.039849] Setting up static identity map for 0x80200000 - 0x80200060
[    0.059858] Hierarchical SRCU implementation.
[    0.080049] EFI services will not be available.
[    0.099917] smp: Bringing up secondary CPUs ...
[    0.170292] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.170298] CPU1: Spectre v2: using ICIALLU workaround
[    0.170397] smp: Brought up 1 node, 2 CPUs
[    0.170409] SMP: Total of 2 processors activated (24.59 BogoMIPS).
[    0.170417] CPU: All CPU(s) started in HYP mode.
[    0.170424] CPU: Virtualization extensions available.
[    0.170958] devtmpfs: initialized
[    0.191832] random: get_random_u32 called from bucket_table_alloc+0x108/0x230 with crng_init=0
[    0.192085] VFP support v0.3: implementor 41 architecture 4 part 30 variant f rev 0
[    0.192279] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.192296] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.196048] pinctrl core: initialized pinctrl subsystem
[    0.196504] DMI not present or invalid.
[    0.196759] NET: Registered protocol family 16
[    0.197796] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.198742] omap_hwmod: l3_main_2 using broken dt data from ocp
[    0.309107] omap_hwmod: dcan1: _wait_target_disable failed
[    0.315567] omap_hwmod: dcan2: _wait_target_disable failed
[    0.408711] cpuidle: using governor ladder
[    0.408743] cpuidle: using governor menu
[    0.417458] OMAP GPIO hardware version 0.1
[    0.419477] GPIO line 113 (reset-gpios_gpio4_17) hogged as output/high
[    0.420956] GPIO line 171 (cm-camen-gpio) hogged as output/high
[    0.446728] No ATAGs?
[    0.446803] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.446818] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.447227] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[    0.447237] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[    0.447770] OMAP DMA hardware revision 0.0
[    0.457584] edma 43300000.edma: memcpy is disabled
[    0.460829] edma 43300000.edma: TI EDMA DMA engine driver
[    0.467575] omap-dma-engine 4a056000.dma-controller: OMAP DMA engine driver (LinkedList1/2/3 supported)
[    0.468901] evm_5v0: supplied by main_12v0
[    0.469321] com_3v6: supplied by evm_5v0
[    0.472417] omap-iommu 40d01000.mmu: 40d01000.mmu registered
[    0.472614] omap-iommu 40d02000.mmu: 40d02000.mmu registered
[    0.472846] omap-iommu 58882000.mmu: 58882000.mmu registered
[    0.473086] omap-iommu 55082000.mmu: 55082000.mmu registered
[    0.473451] omap-iommu 41501000.mmu: 41501000.mmu registered
[    0.473654] omap-iommu 41502000.mmu: 41502000.mmu registered
[    0.473915] iommu: Adding device 58820000.ipu to group 1
[    0.474003] iommu: Adding device 55020000.ipu to group 2
[    0.474167] iommu: Adding device 40800000.dsp to group 0
[    0.474441] iommu: Adding device 41000000.dsp to group 3
[    0.476867] palmas 0-0058: Irq flag is 0x00000008
[    0.501922] palmas 0-0058: Muxing GPIO 2d, PWM 0, LED 0
[    0.503425] SMPS12: supplied by regulator-dummy
[    0.505122] SMPS3: supplied by regulator-dummy
[    0.506783] SMPS45: supplied by regulator-dummy
[    0.508609] SMPS6: supplied by regulator-dummy
[    0.510038] SMPS7: supplied by regulator-dummy
[    0.511458] SMPS8: supplied by regulator-dummy
[    0.512751] SMPS9: supplied by regulator-dummy
[    0.513472] LDO1: supplied by regulator-dummy
[    0.521320] LDO2: supplied by regulator-dummy
[    0.531057] random: fast init done
[    0.531202] LDO3: supplied by regulator-dummy
[    0.541221] LDO4: supplied by regulator-dummy
[    0.551224] LDO5: supplied by regulator-dummy
[    0.551968] LDO6: supplied by regulator-dummy
[    0.552704] LDO7: supplied by regulator-dummy
[    0.553438] LDO8: supplied by regulator-dummy
[    0.554178] LDO9: supplied by regulator-dummy
[    0.561254] LDOLN: supplied by regulator-dummy
[    0.571280] LDOUSB: supplied by regulator-dummy
[    0.583965] omap_i2c 48070000.i2c: bus 0 rev0.12 at 400 kHz
[    0.584528] omap_i2c 48060000.i2c: bus 2 rev0.12 at 400 kHz
[    0.585152] omap_i2c 4807c000.i2c: bus 4 rev0.12 at 400 kHz
[    0.585353] media: Linux media interface: v0.10
[    0.585390] Linux video capture interface: v2.00
[    0.585467] pps_core: LinuxPPS API ver. 1 registered
[    0.585476] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.585496] PTP clock support registered
[    0.585524] EDAC MC: Ver: 3.0.0
[    0.590715] dmi: Firmware registration failed.
[    0.591117] omap-mailbox 48840000.mailbox: omap mailbox rev 0x400
[    0.591395] omap-mailbox 48842000.mailbox: omap mailbox rev 0x400
[    0.591744] Advanced Linux Sound Architecture Driver Initialized.
[    0.600783] clocksource: Switched to clocksource arch_sys_counter
[    0.608651] NET: Registered protocol family 2
[    0.609173] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.609237] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.609363] TCP: Hash tables configured (established 8192 bind 8192)
[    0.609431] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.609467] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.609589] NET: Registered protocol family 1
[    0.609878] RPC: Registered named UNIX socket transport module.
[    0.609887] RPC: Registered udp transport module.
[    0.609895] RPC: Registered tcp transport module.
[    0.609902] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.610896] hw perfevents: no interrupt-affinity property for /pmu, guessing.
[    0.611071] hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters available
[    0.612087] workingset: timestamp_bits=14 max_order=19 bucket_order=5
[    0.616120] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.616597] NFS: Registering the id_resolver key type
[    0.616628] Key type id_resolver registered
[    0.616636] Key type id_legacy registered
[    0.616677] ntfs: driver 2.1.32 [Flags: R/O].
[    0.617974] bounce: pool size: 64 pages
[    0.618022] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    0.618032] io scheduler noop registered
[    0.618041] io scheduler deadline registered
[    0.618136] io scheduler cfq registered (default)
[    0.618146] io scheduler mq-deadline registered
[    0.618155] io scheduler kyber registered
[    0.622710] pinctrl-single 4a003400.pinmux: 282 pins at pa fc003400 size 1128
[    0.626096] dra7-pcie 51000000.pcie: Linked as a consumer to phy-4a094000.pciephy.1
[    0.626462] OF: PCI: host bridge /ocp/axi@0/pcie@51000000 ranges:
[    0.626496] OF: PCI:    IO 0x20003000..0x20012fff -> 0x00000000
[    0.626518] OF: PCI:   MEM 0x20013000..0x2fffffff -> 0x20013000
[    1.626784] dra7-pcie 51000000.pcie: phy link never came up
[    1.626915] dra7-pcie 51000000.pcie: PCI host bridge to bus 0000:00
[    1.626929] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.626940] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    1.626954] pci_bus 0000:00: root bus resource [mem 0x20013000-0x2fffffff]
[    1.627267] PCI: bus0: Fast back to back transfers disabled
[    1.627355] PCI: bus1: Fast back to back transfers enabled
[    1.627392] pci 0000:00:00.0: BAR 0: assigned [mem 0x20100000-0x201fffff 64bit]
[    1.627410] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    1.627720] pcieport 0000:00:00.0: Signaling PME with IRQ 176
[    1.627844] pcieport 0000:00:00.0: AER enabled with IRQ 176
[    1.628735] pwm-backlight backlight: backlight supply power not found, using dummy regulator
[    1.631565] vdd_3v3: supplied by regen1
[    1.631827] aic_dvdd_fixed: supplied by vdd_3v3
[    1.631902] vtt_fixed: supplied by smps3
[    1.674163] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
[    1.676844] 48020000.serial: ttyS2 at MMIO 0x48020000 (irq = 45, base_baud = 3000000) is a 8250
[    2.801998] console [ttyS2] enabled
[    2.806327] 48422000.serial: ttyS7 at MMIO 0x48422000 (irq = 46, base_baud = 3000000) is a 8250
[    2.817033] omap_rng 48090000.rng: Random Number Generator ver. 20
[    2.824181] DSS: OMAP DSS rev 6.1
[    2.829209] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops)
[    2.837650] omapdss_dss 58000000.dss: bound 58040000.encoder (ops hdmi5_component_ops)
[    2.848094] panel-dpi display: display supply vcc not found, using dummy regulator
[    2.866214] brd: module loaded
[    2.874683] loop: module loaded
[    2.881004] libphy: Fixed MDIO Bus: probed
[    2.940815] davinci_mdio 48485000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    2.948511] libphy: 48485000.mdio: probed
[    2.957470] davinci_mdio 48485000.mdio: phy[1]: device 48485000.mdio:01, driver Micrel KSZ9031 Gigabit PHY
[    2.967215] davinci_mdio 48485000.mdio: phy[2]: device 48485000.mdio:02, driver Micrel KSZ9031 Gigabit PHY
[    2.977502] cpsw 48484000.ethernet: Detected MACID = fc:0f:4b:ab:69:6e
[    2.984145] cpsw 48484000.ethernet: initialized cpsw ale version 1.4
[    2.990527] cpsw 48484000.ethernet: ALE Table size 1024
[    2.995828] cpsw 48484000.ethernet: device node lookup for pps timer failed
[    3.002879] cpsw 48484000.ethernet: cpts: overflow check period 500 (jiffies)
[    3.010742] cpsw 48484000.ethernet: cpsw: Detected MACID = fc:0f:4b:ab:69:6f
[    3.018981] i2c /dev entries driver
[    3.023458] IR NEC protocol handler initialized
[    3.028009] IR RC5(x/sz) protocol handler initialized
[    3.033108] IR RC6 protocol handler initialized
[    3.037658] IR JVC protocol handler initialized
[    3.042226] IR Sony protocol handler initialized
[    3.046862] IR SANYO protocol handler initialized
[    3.051657] IR Sharp protocol handler initialized
[    3.056380] IR MCE Keyboard/mouse protocol handler initialized
[    3.062253] IR XMP protocol handler initialized
[    3.069122] gpio-fan gpio_fan: GPIO fan initialized
[    3.075255] tmp102 0-0048: initialized
[    3.083318] sdhci: Secure Digital Host Controller Interface driver
[    3.089527] sdhci: Copyright(c) Pierre Ossman
[    3.094933] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.101250] sdhci-omap 4809c000.mmc: Got CD GPIO
[    3.106052] sdhci-omap 4809c000.mmc: 4809c000.mmc supply vqmmc not found, using dummy regulator
[    3.115213] sdhci-omap 4809c000.mmc: no pinctrl state for ddr_1_8v mode
[    3.181014] mmc0: SDHCI controller on 4809c000.mmc [4809c000.mmc] using ADMA
[    3.237960] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.249830] mmc0: new high speed SDHC card at address b368
[    3.255377] mmc1: SDHCI controller on 480b4000.mmc [480b4000.mmc] using ADMA
[    3.263442] mmcblk0: mmc0:b368 USD   14.9 GiB 
[    3.270610]  mmcblk0: p1 p2
[    3.276013] sdhci-omap 480ad000.mmc: no pinctrl state for sdr104 mode
[    3.282600] sdhci-omap 480ad000.mmc: no pinctrl state for ddr50 mode
[    3.289062] sdhci-omap 480ad000.mmc: no pinctrl state for hs200_1_8v mode
[    3.350826] mmc2: SDHCI controller on 480ad000.mmc [480ad000.mmc] using PIO
[    3.362346] ledtrig-cpu: registered to indicate activity on CPUs
[    3.362758] ti-iodelay 4844a000.padconf: Set reg 0x18c Delay(a: 0 g: 120), Elements(C=0 F=2)0x29002
[    3.362766] ti-iodelay 4844a000.padconf: Set reg 0x190 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362774] ti-iodelay 4844a000.padconf: Set reg 0x194 Delay(a: 174 g: 0), Elements(C=0 F=4)0x29004
[    3.362781] ti-iodelay 4844a000.padconf: Set reg 0x1a4 Delay(a: 265 g: 360), Elements(C=0 F=13)0x2900d
[    3.362788] ti-iodelay 4844a000.padconf: Set reg 0x1a8 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362794] ti-iodelay 4844a000.padconf: Set reg 0x1ac Delay(a: 168 g: 0), Elements(C=0 F=4)0x29004
[    3.362801] ti-iodelay 4844a000.padconf: Set reg 0x1b0 Delay(a: 0 g: 120), Elements(C=0 F=2)0x29002
[    3.362807] ti-iodelay 4844a000.padconf: Set reg 0x1b4 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362814] ti-iodelay 4844a000.padconf: Set reg 0x1b8 Delay(a: 136 g: 0), Elements(C=0 F=3)0x29003
[    3.362820] ti-iodelay 4844a000.padconf: Set reg 0x1bc Delay(a: 0 g: 120), Elements(C=0 F=2)0x29002
[    3.362827] ti-iodelay 4844a000.padconf: Set reg 0x1c0 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362833] ti-iodelay 4844a000.padconf: Set reg 0x1c4 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362839] ti-iodelay 4844a000.padconf: Set reg 0x1c8 Delay(a: 287 g: 420), Elements(C=0 F=14)0x2900e
[    3.362846] ti-iodelay 4844a000.padconf: Set reg 0x1d0 Delay(a: 879 g: 0), Elements(C=1 F=10)0x2902a
[    3.362852] ti-iodelay 4844a000.padconf: Set reg 0x1d4 Delay(a: 144 g: 240), Elements(C=0 F=8)0x29008
[    3.362859] ti-iodelay 4844a000.padconf: Set reg 0x1d8 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362865] ti-iodelay 4844a000.padconf: Set reg 0x1dc Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362872] ti-iodelay 4844a000.padconf: Set reg 0x1e0 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362878] ti-iodelay 4844a000.padconf: Set reg 0x1e4 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362885] ti-iodelay 4844a000.padconf: Set reg 0x1e8 Delay(a: 34 g: 0), Elements(C=0 F=0)0x29000
[    3.362891] ti-iodelay 4844a000.padconf: Set reg 0x1ec Delay(a: 0 g: 120), Elements(C=0 F=2)0x29002
[    3.362897] ti-iodelay 4844a000.padconf: Set reg 0x1f0 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362904] ti-iodelay 4844a000.padconf: Set reg 0x1f4 Delay(a: 120 g: 0), Elements(C=0 F=3)0x29003
[    3.362910] ti-iodelay 4844a000.padconf: Set reg 0x1f8 Delay(a: 120 g: 180), Elements(C=0 F=6)0x29006
[    3.362916] ti-iodelay 4844a000.padconf: Set reg 0x1fc Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362922] ti-iodelay 4844a000.padconf: Set reg 0x200 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362928] ti-iodelay 4844a000.padconf: Set reg 0x360 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362934] ti-iodelay 4844a000.padconf: Set reg 0x364 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362941] ti-iodelay 4844a000.padconf: Set reg 0x368 Delay(a: 11 g: 0), Elements(C=0 F=0)0x29000
[    3.364240] mmc1: new DDR MMC card at address 0001
[    3.364515] mmcblk1: mmc1:0001 S10004 3.56 GiB 
[    3.377516] mmcblk1boot0: mmc1:0001 S10004 partition 1 4.00 MiB
[    3.377648] mmcblk1boot1: mmc1:0001 S10004 partition 2 4.00 MiB
[    3.377801] mmcblk1rpmb: mmc1:0001 S10004 partition 3 4.00 MiB
[    3.378455]  mmcblk1: p1 p2 p3
[    3.664444] NET: Registered protocol family 10
[    3.669480] Segment Routing with IPv6
[    3.673210] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    3.679454] NET: Registered protocol family 17
[    3.684068] Key type dns_resolver registered
[    3.688434] omap_voltage_late_init: Voltage driver support not added
[    3.694830] Power Management for TI OMAP4+ devices.
[    3.699908] Registering SWP/SWPB emulation handler
[    3.713251] dmm 4e000000.dmm: workaround for errata i878 in use
[    3.720475] dmm 4e000000.dmm: initialized all PAT entries
[    3.752312] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    3.758957] [drm] No driver support for vblank timestamp query.
[    3.767452] [drm] Enabling DMM ywrap scrolling
[    3.841498] Console: switching to colour frame buffer device 100x30
[    3.850604] omapdrm omapdrm.0: fb0: omapdrm frame buffer device
[    3.857967] [drm] Initialized omapdrm 1.0.0 20110917 for omapdrm.0 on minor 0
[    3.866219] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[    3.873372] hctosys: unable to open rtc device (rtc0)
[    3.879061] aic_dvdd_fixed: disabling
[    3.883231] ldousb: disabling
[    3.886773] ALSA device list:
[    3.889766]   No soundcards found.
[    3.916482] EXT4-fs (mmcblk0p2): warning: mounting fs with errors, running e2fsck is recommended
[    3.928354] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.936527] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    3.946570] devtmpfs: mounted
[    3.950413] Freeing unused kernel memory: 2048K
[    4.363809] systemd[1]: System time before build time, advancing clock.
[    4.426624] systemd[1]: systemd 234 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 -IDN default-hierarchy=hybrid)
[    4.448514] systemd[1]: Detected architecture arm.

Welcome to Arago 2018.10!

[    4.492304] systemd[1]: Set hostname to <am57xx-evm>.
[    4.925640] random: systemd: uninitialized urandom read (16 bytes read)
[    4.932394] systemd[1]: Reached target Swap.
[  OK  ] Reached target Swap.
[    4.961067] random: systemd: uninitialized urandom read (16 bytes read)
[    4.967960] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[    5.010962] random: systemd: uninitialized urandom read (16 bytes read)
[    5.019774] systemd[1]: Created slice User and Session Slice.
[  OK  ] Created slice User and Session Slice.
[    5.057977] systemd[1]: Listening on Process Core Dump Socket.
[  OK  ] Listening on Process Core Dump Socket.
[    5.091228] systemd[1]: Listening on udev Control Socket.
[  OK  ] Listening on udev Control Socket.
[    5.179216] systemd[1]: Created slice System Slice.
[  OK  ] Created slice System Slice.
[    5.223884] systemd[1]: Mounting Kernel Debug File System...
         Mounting Kernel Debug File System...
[  OK  ] Reached target Slices.
         Mounting Temporary Directory (/tmp)...
[  OK  ] Listening on Journal Socket.
         Starting Create list of required st…ce nodes for the current kernel...
         Starting Remount Root and Kernel File Systems...
[    5.419571] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[  OK  ] Reached target Remote File Systems.
[  OK  ] Created slice system-getty.slice.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Listening on Syslog Socket.
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Reached target Paths.
[  OK  ] Listening on Journal Socket (/dev/log).
         Mounting POSIX Message Queue File System...
[  OK  ] Created slice system-serial\x2dgetty.slice.
         Starting Load Kernel Modules...
[    5.736099] cmemk: loading out-of-tree module taints kernel.
[    5.742519] CMEMK module: reference Linux version 4.14.79
         [    5.748661] allocated heap buffer 0x40500000 of size 0x100000
Starting Journal Service...
[    5.755185] cmemk initialized
[    5.780198] cryptodev: driver 1.9 loaded.
[  OK  ] Listening on Network Service Netlink Socket.
[    5.816804] usbcore: registered new interface driver usbfs
[  OK  ] Listening on udev Kernel Socket.
[    5.823131] usbcore: registered new interface driver hub
[    5.833173] usbcore: registered new device driver usb
[    5.844072] usbcore: registered new interface driver usbserial
[  OK  ] Mounted Kernel Debug File System.
[    5.863582] usbcore: registered new interface driver ftdi_sio
[    5.869384] usbserial: USB Serial support registered for FTDI USB Serial Device
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Mounted Temporary Directory (/tmp).
[  OK  ] Started Journal Service.
[  OK  ] Started Create list of required sta…vice nodes for the current kernel.
[  OK  ] Started Remount Root and Kernel File Systems.
[  OK  ] Started Load Kernel Modules.
         Starting Apply Kernel Variables...
         Mounting Kernel Configuration File System...
         Starting Create System Users...
         Starting Rebuild Hardware Database...
         Starting Flush Journal to Persistent Storage...
[  OK  ] Mounted Kernel Configuration File System.
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Started Create System Users.
[    6.317650] systemd-journald[95]: Received request to flush runtime journal from PID 1
         Starting Create Static Device Nodes in /dev...
[  OK  ] Started Flush Journal to Persistent Storage.
[  OK  ] Started Create Static Device Nodes in /dev.
         Starting udev Kernel Device Manager...
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /var/volatile...
         Mounting /media/ram...
[  OK  ] Mounted /var/volatile.
[  OK  ] Mounted /media/ram.
         Starting Load/Save Random Seed...
[  OK  ] Reached target Local File Systems.
         Starting Rebuild Dynamic Linker Cache...
         Starting Rebuild Journal Catalog...
         Starting Create Volatile Files and Directories...
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Started udev Kernel Device Manager.
[    6.843303] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:757: group 0, block bitmap and bg descriptor inconsistent: 13510 vs 13522 free clusters
[    6.865353] JBD2: Spotted dirty metadata buffer (dev = mmcblk0p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
[  OK  ] Started Create Volatile Files and Directories.
         Starting Update UTMP about System Boot/Shutdown...
         Starting Network Time Synchronization...
[  OK  ] Started Rebuild Journal Catalog.
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Started Network Time Synchronization.
[  OK  ] Started Rebuild Dynamic Linker Cache.
[  OK  ] Reached target System Time Synchronized.
[  OK  ] Started Rebuild Hardware Database.
         Starting udev Coldplug all Devices...
         Starting Update is Completed...
[    8.782179] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:757: group 45, block bitmap and bg descriptor inconsistent: 21962 vs 21964 free clusters
[    8.812728] JBD2: Spotted dirty metadata buffer (dev = mmcblk0p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
[  OK  ] Started Update is Completed.
[  OK  ] Started udev Coldplug all Devices.
[  OK  ] Reached target System Initialization.
[  OK  ] Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
[  OK  ] Listening on dropbear.socket.
[  OK  ] Started Daily rotation of log files.
         Starting Network Service...
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Listening on RPCbind Server Activation Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
[  OK  ] Started D-Bus System Message Bus.
[   10.626405] omap-rproc 58820000.ipu: assigned reserved memory node ipu1-memory@9d000000
[   10.634693] remoteproc remoteproc0: 58820000.ipu is available
[   10.640883] omap-rproc 55020000.ipu: assigned reserved memory node ipu2-memory@95800000
[   10.649051] remoteproc remoteproc1: 55020000.ipu is available
[   10.655166] omap-rproc 40800000.dsp: assigned reserved memory node dsp1-memory@99000000
[   10.663487] remoteproc remoteproc2: 40800000.dsp is available
[   10.669712] omap-rproc 41000000.dsp: assigned reserved memory node dsp2-memory@9f000000
[   10.677971] remoteproc remoteproc3: 41000000.dsp is available
[   10.772245] at24 0-0050: 4096 byte 24c32 EEPROM, writable, 1 bytes/write
[   10.822482] palmas-rtc 48070000.i2c:tps659038@58:tps659038_rtc: rtc core: registered 48070000.i2c:tps659038@58:tps659038_rtc as rtc1
[   10.916683] tvp5150: no symbol version for module_layout
[   10.961323] rtc-ds1307 2-006f: SET TIME!
[   10.968786] rtc-ds1307 2-006f: registered as rtc0
[   11.062779] input: pixcir_tangoc as /devices/platform/44000000.ocp/4807c000.i2c/i2c-4/4-005c/input/input1
[   11.073626] tvp5150 4-005d: tvp5150 (4.0) chip found @ 0xba (OMAP I2C adapter)
[   11.090840] tvp5150 4-005d: tvp5150am1 detected.
[   11.187796] omap-des 480a5000.des: OMAP DES hw accel rev: 2.2
[   11.212003] omap-des 480a5000.des: will run requests pump with realtime priority
[   11.262028] omap_rtc 48838000.rtc: registered as rtc2
[   11.960442] remoteproc remoteproc1: powering up 55020000.ipu
[   11.966175] remoteproc remoteproc1: Booting fw image dra7-ipu2-fw.xem4, size 3747220
[   11.975159] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
[   12.025562] virtio_rpmsg_bus virtio0: rpmsg host is online
[   12.031270] remoteproc remoteproc1: registered virtio0 (type 7)
[   12.037223] remoteproc remoteproc1: remote processor 55020000.ipu is now up
[   12.046805] virtio_rpmsg_bus virtio0: creating channel rpmsg-rpc addr 0x65
[   12.054382] virtio_rpmsg_bus virtio0: creating channel rpmsg-rpc addr 0x66
[   12.168325] vpe 489d0000.vpe: loading firmware vpdma-1b8.bin
[   12.384719] SCSI subsystem initialized
[   12.461463] omap-sham 4b101000.sham: hw accel on OMAP rev 4.3
[   12.470973] vpe 489d0000.vpe: Device registered as /dev/video0
[   12.483774] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[   12.716530] [drm] Initialized pvr 1.14.3699939 20110701 for 56000000.gpu on minor 1
[   12.735882] remoteproc remoteproc3: powering up 41000000.dsp
[   12.741652] remoteproc remoteproc3: Booting fw image dra7-dsp2-fw.xe66, size 20392652
[   12.757241] omap_hwmod: mmu0_dsp2: _wait_target_disable failed
[   12.763126] omap-iommu 41501000.mmu: 41501000.mmu: version 3.0
[   12.769068] omap-iommu 41502000.mmu: 41502000.mmu: version 3.0
[   12.777012] remoteproc remoteproc0: powering up 58820000.ipu
[   12.782765] remoteproc remoteproc0: Booting fw image dra7-ipu1-fw.xem4, size 6680920
[   12.795820] omap-iommu 58882000.mmu: 58882000.mmu: version 2.1
[   12.815540] ahci 4a140000.sata: SSS flag set, parallel bus scan disabled
[   12.822859] virtio_rpmsg_bus virtio1: rpmsg host is online
[   12.822907] remoteproc remoteproc3: registered virtio1 (type 7)
[   12.822912] remoteproc remoteproc3: remote processor 41000000.dsp is now up
[   12.827022] virtio_rpmsg_bus virtio1: creating channel rpmsg-proto addr 0x3d
[   12.865583] ahci 4a140000.sata: AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl platform mode
[   12.874274] ahci 4a140000.sata: flags: 64bit ncq sntf stag pm led clo only pmp pio slum part ccc apst 
[   12.890212] virtio_rpmsg_bus virtio2: rpmsg host is online
[   12.895790] remoteproc remoteproc0: registered virtio2 (type 7)
[   12.903570] remoteproc remoteproc0: remote processor 58820000.ipu is now up
[   12.911006] scsi host0: ahci
[   12.914290] ata1: SATA max UDMA/133 mmio [mem 0x4a140000-0x4a1410ff] port 0x100 irq 82
[   12.922679] omap-aes 4b500000.aes: OMAP AES hw accel rev: 3.3
[   12.929347] omap-aes 4b500000.aes: will run requests pump with realtime priority
[   12.939519] omap-aes 4b700000.aes: OMAP AES hw accel rev: 3.3
[   12.945557] omap-aes 4b700000.aes: will run requests pump with realtime priority
[   13.021985] virtio_rpmsg_bus virtio2: creating channel rpmsg-proto addr 0x3d
[   13.113642] omap-hdmi-audio omap-hdmi-audio.0.auto: snd-soc-dummy-dai <-> 58040000.encoder mapping ok
[   13.123839] omap-hdmi-audio omap-hdmi-audio.0.auto: ASoC: no DMI vendor name!
[   13.176457] vip 48990000.vip: loading firmware vpdma-1b8.bin
[   13.210847] vip 48990000.vip: VPDMA firmware loaded
[   13.215908] vin3a: Port A: Using subdev tvp5150 4-005d for capture
[   13.222640] vin3a-0: device registered as video1
[   13.263719] ata1: SATA link down (SStatus 0 SControl 300)
[   13.292641] asoc-simple-card sound0: tlv320aic3x-hifi <-> 48468000.mcasp mapping ok
[   13.300357] asoc-simple-card sound0: ASoC: no DMI vendor name!
[   13.534192] remoteproc remoteproc2: powering up 40800000.dsp
[   13.539887] remoteproc remoteproc2: Booting fw image dra7-dsp1-fw.xe66, size 20392652
[   13.555460] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
[   13.561344] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
[   13.567267] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
[   13.597092] virtio_rpmsg_bus virtio3: rpmsg host is online
[   13.604230] remoteproc remoteproc2: registered virtio3 (type 7)
[   13.610194] remoteproc remoteproc2: remote processor 40800000.dsp is now up
[   13.656844] virtio_rpmsg_bus virtio3: creating channel rpmsg-proto addr 0x3d
[  OK  ] Started Hardware RNG Entropy Gatherer Daemon.
[  OK  ] Reached target Containers.
[   13.852205] net eth1: initializing cpsw version 1.15 (0)
[   13.875871] random: crng init done
[   13.875876] random: 7 urandom warning(s) missed due to ratelimiting
         Starting TI MultiCore Tools Daemon...
         Starting Print notice about GPLv3 packages...
         Starting uim-sysfs.service...
[  OK  ] Started Job spooling tools.
[  OK  ] Started Periodic Command Scheduler.
[  OK  ] Started System Logging Service.
[   14.073045] Micrel KSZ9031 Gigabit PHY 48485000.mdio:02: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=48485000.mdio:02, irq=POLL)
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target Timers.
[  OK  ] Started Kernel Logging Service.
         Starting RPC Bind Service...
[   14.202511] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
         Starting Avahi mDNS/DNS-SD Stack...
         Starting Login Service...
         Starting TI IPC Daemon...
[   14.289694] EXT4-fs error (device mmcblk0p2): ext4_lookup:1586: inode #524292: comm systemd: deleted inode referenced: 524316
[   14.341483] net eth0: initializing cpsw version 1.15 (0)
[   14.494566] Micrel KSZ9031 Gigabit PHY 48485000.mdio:01: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=48485000.mdio:01, irq=POLL)
[   14.556098] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  OK  ] Started Network Service.
[  OK  ] Started TI MultiCore Tools Daemon.
[  OK  ] Started RPC Bind Service.
[  OK  ] Started TI IPC Daemon.
[  OK  ] Found device /dev/ttyS2.
[   14.996264] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   15.009206] FAT-fs (mmcblk1p2): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   15.033417] FAT-fs (mmcblk1p3): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   15.141456] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  OK  ] Started uim-sysfs.service.
[   15.605408] pruss 4b200000.pruss: creating PRU cores and other child platform devices
[   15.631540] rpmsg_rpc virtio0.rpmsg-rpc.-1.101: probing service dce-callback with src 1024 dst 101
[   15.632335] rpmsg_rpc virtio0.rpmsg-rpc.-1.102: probing service rpmsg-dce with src 1025 dst 102
[   15.632919] rpmsg_rpc virtio0.rpmsg-rpc.-1.101: published functions = 4
[   15.633583] rpmsg_rpc virtio0.rpmsg-rpc.-1.102: published functions = 9
[   15.697987] NET: Registered protocol family 44
[   15.731226] pruss 4b280000.pruss: creating PRU cores and other child platform devices
[   15.749831] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[   15.762722] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 1
[   15.778027] xhci-hcd xhci-hcd.1.auto: hcc params 0x0220f04c hci version 0x100 quirks 0x02010010
[   15.809143] remoteproc remoteproc4: 4b234000.pru is available
[   15.809192] pru-rproc 4b234000.pru: PRU rproc node /ocp/pruss_soc_bus@4b226004/pruss@0/pru@34000 probed successfully
[   15.809453] remoteproc remoteproc5: 4b238000.pru is available
[   15.809508] pru-rproc 4b238000.pru: PRU rproc node /ocp/pruss_soc_bus@4b226004/pruss@0/pru@38000 probed successfully
[   15.809792] remoteproc remoteproc6: 4b2b4000.pru is available
[   15.809825] pru-rproc 4b2b4000.pru: PRU rproc node /ocp/pruss_soc_bus@4b2a6004/pruss@0/pru@34000 probed successfully
[   15.810050] remoteproc remoteproc7: 4b2b8000.pru is available
[   15.810083] pru-rproc 4b2b8000.pru: PRU rproc node /ocp/pruss_soc_bus@4b2a6004/pruss@0/pru@38000 probed successfully
[   15.814342] EXT4-fs error (device mmcblk0p2): ext4_lookup:1586: inode #524292: comm alsactl: deleted inode referenced: 524316
[   15.916379] xhci-hcd xhci-hcd.1.auto: irq 191, io mem 0x48890000
[   15.922806] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[   15.929782] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   15.937328] usb usb1: Product: xHCI Host Controller
[   15.942408] usb usb1: Manufacturer: Linux 4.14.79-gbde58ab01e xhci-hcd
[   15.949085] usb usb1: SerialNumber: xhci-hcd.1.auto
[   15.954530] hub 1-0:1.0: USB hub found
[   15.959015] hub 1-0:1.0: 1 port detected
[   15.963426] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[   15.969139] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 2
[   15.976968] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0  SuperSpeed
[   15.984288] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[   15.992617] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
[   16.002714] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   16.011450] usb usb2: Product: xHCI Host Controller
[   16.016433] usb usb2: Manufacturer: Linux 4.14.79-gbde58ab01e xhci-hcd
[   16.023114] usb usb2: SerialNumber: xhci-hcd.1.auto
[   16.028492] hub 2-0:1.0: USB hub found
[   16.032472] hub 2-0:1.0: 1 port detected
[   16.330821] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[  OK  ] Started Avahi mDNS/DNS-SD Stack.
[  OK  ] Started Login Service.
[  OK  ] Reached target Sound Card.
[  OK  ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
         Starting rc.pvr.service...
[  OK  ] Created slice system-systemd\x2dbacklight.slice.
         Starting Load/Save Screen Backlight…ightness of backl[   16.511444] usb 1-1: New USB device found, idVendor=0451, idProduct=8142
ight:backlight...
[  OK  ] Reached target Network.
         Starting Network Name Resolution...
[  OK  [   16.526154] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=1
] Started Redis In-Memory Data Store.
[   16.526162] usb 1-1: SerialNumber: 670408690392
         Starting Simple Network Management Protocol (SNMP) Daemon....
         Starting Permit User Sessions...
         Starting Lightning Fast Webserver With Light System Req[   16.560623] hub 1-1:1.0: USB hub found
uirements...
         Starting Enable and configure wl18xx blue[   16.572337] hub 1-1:1.0: 4 ports detected
tooth stack...
         Starting Wait for Network to be Configured...
[  OK  ] Started Load/Save Screen Backlight Brightness of backlight:backlight.
[  OK  ] Started Permit User Sessions.
[  OK  ] Started Serial Getty on ttyS2.
[  OK  ] Started Getty on tty1.
[  OK  ] Reached target Login Prompts.
         Starting Synchronize Sys[   16.664455] usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd
tem and HW clocks...
[   16.701218] usb 2-1: New USB device found, idVendor=0451, idProduct=8140
[   16.709921] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[   16.720386] hub 2-1:1.0: USB hub found
[   16.724942] hub 2-1:1.0: 4 ports detected
[   16.806294] EXT4-fs error (device mmcblk0p2): ext4_lookup:1586: inode #524292: comm alsactl: deleted inode referenced: 524316
[   16.875613] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
[  OK  ] Started Lightning Fast Webserver With Light System Requirements.
[  OK  ] Started Synchronize System and HW clocks.
[  OK  ] Started rc.pvr.service.
         Starting weston.service...
[  OK  ] Started Network Name Resolution.
[  OK  ] Reached target Host and Network Name Lookups.
[  OK  ] Started NFS status monitor for NFSv2/3 locking..
[  OK  ] Started weston.service.
         Starting Matrix GUI...
         Starting telnetd.service...
[  OK  ] Started telnetd.service.
         Starting start_eth0.service...
         Starting thttpd.service...
[  OK  ] Started thttpd.service.
[  OK  ] Started Matrix GUI.
[  OK  ] Started Enable and configure wl18xx bluetooth stack.
[  OK  ] Started Simple Network Management Protocol (SNMP) Daemon..
[  OK  ] Started start_eth0.service.
         Starting rng-tools.service...
[  OK  ] Started rng-tools.service.
[   18.719582] cpsw 48484000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   18.727764] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready


 _____                    _____           _         _   
|  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
|     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
|__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
              |___|                    |___|            

Arago Project http://arago-project.org am57xx-evm ttyS2

Arago 2018.10 am57xx-evm ttyS2

am57xx-evm login: [   23.452047] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:757: group 20, block bitmap and bg descriptor inconsistent: 14465 vs 14466 free clusters
[   23.518224] omap_hwmod: mmu0_dsp2: _wait_target_disable failed
[   24.158263] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
***************************************************************
***************************************************************
NOTICE: This file system contains the following GPLv3 packages:
	autoconf
	bash-dev
	bash
	binutils-dev
	binutils
	bison-dev
	bison
	cifs-utils
	cpio
	cpp-symlinks
	cpp
	dosfstools
	elfutils-dev
	elfutils
	findutils
	g++-symlinks
	g++
	gawk
	gcc-symlinks
	gcc
	gdb
	gdbc6x
	gdbserver
	gettext
	glmark2
	gstreamer1.0-libav
	gzip
	hidapi
	libasm1
	libcairo-perf-utils
	libdw1
	libelf1
	libgdbm-compat4
	libgdbm-dev
	libgdbm4
	libgettextlib
	libgettextsrc
	libgmp10
	libidn11
	libmavconn
	libmpc3
	libmpfr4
	libreadline-dev
	libreadline7
	libunistring2
	m4-dev
	m4
	make
	mavlink
	mavros-extras
	mavros-msgs
	mavros
	nettle
	parted
	python3-pycairo
	socketcan-interface
	swig-dev
	swig
	which

If you do not wish to distribute GPLv3 components please remove
the above packages prior to distribution.  This can be done using
the opkg remove command.  i.e.:
    opkg remove <package>
Where <package> is the name printed in the list above

NOTE: If the package is a dependency of another package you
      will be notified of the dependent packages.  You should
      use the --force-removal-of-dependent-packages option to
      also remove the dependent packages as well
***************************************************************
***************************************************************


 _____                    _____           _         _   
|  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
|     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
|__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
              |___|                    |___|            

Arago Project http://arago-project.org am57xx-evm ttyS2

Arago 2018.10 am57xx-evm ttyS2

am57xx-evm login: 

A4. tvp5150 detected by the system: ( Log v4l2-ctl - all -d / dev / video1 -V)

out_v4l2-ctl.log

out_v4l2-ctl.log
Driver Info (not using libv4l2):
	Driver name   : vip
	Card type     : vip
	Bus info      : platform:vip2:vin3a:stream0
	Driver version: 4.14.79
	Capabilities  : 0x85200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x05200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (camera 1: ok)
Video Standard = 0x00ffb0ff
	PAL-B/B1/G/H/I/D/D1/K
	NTSC-M/M-JP/M-KR
	SECAM-B/D/G/H/K/K1/L/Lc
Format Video Capture:
	Width/Height      : 720/288
	Pixel Format      : 'NV12'
	Field             : Alternating
	Bytes per Line    : 720
	Size Image        : 311040
	Colorspace        : SMPTE 170M
	Transfer Function : Default
	YCbCr Encoding    : Default
	Quantization      : Default
	Flags             : 
Crop Capability Video Capture:
	Bounds      : Left 0, Top 0, Width 720, Height 288
	Default     : Left 0, Top 0, Width 720, Height 288
	Pixel Aspect: 1/1
Crop Capability Video Output:
	Bounds      : Left 0, Top 0, Width 720, Height 288
	Default     : Left 0, Top 0, Width 720, Height 288
	Pixel Aspect: 1/1
Crop: Left 0, Top 0, Width 720, Height 288
Selection: crop, Left 0, Top 0, Width 720, Height 288
Selection: crop_default, Left 0, Top 0, Width 720, Height 288
Selection: crop_bounds, Left 0, Top 0, Width 720, Height 288
Selection: compose, Left 0, Top 0, Width 720, Height 288
Selection: compose_default, Left 0, Top 0, Width 720, Height 288
Selection: compose_bounds, Left 0, Top 0, Width 720, Height 288
Selection: crop, Left 0, Top 0, Width 720, Height 288
Selection: crop_default, Left 0, Top 0, Width 720, Height 288
Selection: crop_bounds, Left 0, Top 0, Width 720, Height 288
Selection: compose, Left 0, Top 0, Width 720, Height 288
Selection: compose_default, Left 0, Top 0, Width 720, Height 288
Selection: compose_bounds, Left 0, Top 0, Width 720, Height 288
Streaming Parameters Video Capture:
	Capabilities     : timeperframe
	Frames per second: 30.000 (30/1)
	Read buffers     : 4

User Controls

                     brightness (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                       contrast (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                     saturation (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                            hue (int)    : min=-128 max=127 step=1 default=0 value=0 flags=slider

Image Processing Controls

                     pixel_rate (int64)  : min=27000010 max=27000010 step=1 default=27000010 value=27000010 flags=read-only
                   test_pattern (menu)   : min=0 max=2 default=0 value=0

dmesg> dmesg_common_log.log:

 dmesg_common_log.logdmesg_common_log.log

dmesg | grep vin> dmesg_vin_log.log

 dmesg_vin_log.log

dmesg_vin_log.log
[    2.940822] davinci_mdio 48485000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    2.957266] davinci_mdio 48485000.mdio: phy[1]: device 48485000.mdio:01, driver Micrel KSZ9031 Gigabit PHY
[    2.967009] davinci_mdio 48485000.mdio: phy[2]: device 48485000.mdio:02, driver Micrel KSZ9031 Gigabit PHY
[   14.105078] vin3: vip_set_slice_path:
[   14.105087] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[   14.105460] vin4: vip_set_slice_path:
[   14.105467] vin4: vip_set_slice_path: DATA_PATH_SELECT(00000110): 80008000
[   14.154142] vin3a: can't get next endpoint: loop: 1
[   14.154148] vin3a: register async notifier for 1 subdevs
[   14.154153] vin3a: vip_async_bound
[   14.154157] vin3a: Port A: Using subdev tvp5150 4-005d for capture
[   14.184408] vin3a: subdev tvp5150 4-005d: code: 2006 idx: 0
[   14.184418] vin3a: matched fourcc: UYVY: code: 2006 idx: 0
[   14.184424] vin3a: matched fourcc: YUYV: code: 2006 idx: 1
[   14.184429] vin3a: matched fourcc: VYUY: code: 2006 idx: 2
[   14.184434] vin3a: matched fourcc: YVYU: code: 2006 idx: 3
[   14.184643] vin3a-0: device registered as video1
[   14.200263] vin3a: vip_create_streams[channel-0]: bus_type = V4L2_MBUS_BT656
[   14.200290] vin3a: vip_async_complete
[   16.304596] vin3a-0: vip_open
[   16.304618] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
[   16.304628] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[   16.304632] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[   16.304635] vin3a-0: init_stream vpdma data type: 0x27
[   16.304639] vin3a-0: vip_init_stream: stream instance 0xc0275c48ed806000
[   16.304823] vin3a-0: vip_release
[   16.304832] vin3a-0: vip_release_stream: stream instance 0x00000010ed806000
[   16.304835] vin3a: vip_release_port: port instance 0xed3356c0eda60010

dmesg | grep tvp> dmesg_tvp_log.log

 dmesg_tvp_log.log

dmesg_tvp_log.log
[   11.894158] tvp5150: no symbol version for module_layout
[   11.900147] tvp5150 4-005d: GPIO lookup for consumer pdn
[   11.900153] tvp5150 4-005d: using device tree for GPIO lookup
[   11.900164] of_get_named_gpiod_flags: can't parse 'pdn-gpios' property of node '/ocp/i2c@4807c000/tvp5150@5d[0]'
[   11.900171] of_get_named_gpiod_flags: can't parse 'pdn-gpio' property of node '/ocp/i2c@4807c000/tvp5150@5d[0]'
[   11.900178] tvp5150 4-005d: using lookup tables for GPIO lookup
[   11.900184] tvp5150 4-005d: lookup for GPIO pdn failed
[   11.900191] tvp5150 4-005d: GPIO lookup for consumer reset
[   11.900195] tvp5150 4-005d: using device tree for GPIO lookup
[   11.900202] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/i2c@4807c000/tvp5150@5d[0]'
[   11.900209] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp/i2c@4807c000/tvp5150@5d[0]'
[   11.900213] tvp5150 4-005d: using lookup tables for GPIO lookup
[   11.900218] tvp5150 4-005d: lookup for GPIO reset failed
[   11.902955] tvp5150 4-005d: tvp5150: read 0x80 = 51
[   11.910958] tvp5150 4-005d: tvp5150: read 0x81 = 50
[   11.911122] tvp5150 4-005d: tvp5150: read 0x82 = 04
[   11.911320] tvp5150 4-005d: tvp5150: read 0x83 = 00
[   11.911327] tvp5150 4-005d: tvp5150 (4.0) chip found @ 0xba (OMAP I2C adapter)
[   11.918900] tvp5150 4-005d: tvp5150am1 detected.
[   11.923594] tvp5150 4-005d: tvp5150: writing 30 00
[   11.923917] tvp5150 4-005d: tvp5150: read 0x8c = 83
[   11.923924] tvp5150 4-005d: tvp5150: writing 00 00
[   11.924030] tvp5150 4-005d: tvp5150: writing 01 15
[   11.924158] tvp5150 4-005d: tvp5150: writing 02 00
[   11.924843] tvp5150 4-005d: tvp5150: writing 03 01
[   11.928001] tvp5150 4-005d: tvp5150: writing 06 10
[   11.928130] tvp5150 4-005d: tvp5150: writing 07 60
[   11.928255] tvp5150 4-005d: tvp5150: writing 08 00
[   11.928381] tvp5150 4-005d: tvp5150: writing 09 80
[   11.928509] tvp5150 4-005d: tvp5150: writing 0a 80
[   11.928637] tvp5150 4-005d: tvp5150: writing 0b 00
[   11.928765] tvp5150 4-005d: tvp5150: writing 0c 80
[   11.928893] tvp5150 4-005d: tvp5150: writing 0d 47
[   11.929021] tvp5150 4-005d: tvp5150: writing 0e 00
[   11.929148] tvp5150 4-005d: tvp5150: writing 0f 08
[   11.929276] tvp5150 4-005d: tvp5150: writing 11 00
[   11.929404] tvp5150 4-005d: tvp5150: writing 12 00
[   11.929532] tvp5150 4-005d: tvp5150: writing 13 00
[   11.929660] tvp5150 4-005d: tvp5150: writing 14 00
[   11.929788] tvp5150 4-005d: tvp5150: writing 15 01
[   11.929916] tvp5150 4-005d: tvp5150: writing 16 80
[   11.930044] tvp5150 4-005d: tvp5150: writing 18 00
[   11.930171] tvp5150 4-005d: tvp5150: writing 19 00
[   11.930300] tvp5150 4-005d: tvp5150: writing 1a 0c
[   11.930429] tvp5150 4-005d: tvp5150: writing 1b 14
[   11.930564] tvp5150 4-005d: tvp5150: writing 1c 00
[   11.930686] tvp5150 4-005d: tvp5150: writing 1d 00
[   11.940707] tvp5150 4-005d: tvp5150: writing 1e 00
[   11.941350] tvp5150 4-005d: tvp5150: writing 28 00
[   11.941508] tvp5150 4-005d: tvp5150: writing 2e 0f
[   11.941650] tvp5150 4-005d: tvp5150: writing 2f 01
[   11.941774] tvp5150 4-005d: tvp5150: writing bb 00
[   11.941893] tvp5150 4-005d: tvp5150: writing c0 00
[   11.942004] tvp5150 4-005d: tvp5150: writing c1 00
[   11.942113] tvp5150 4-005d: tvp5150: writing c2 04
[   11.942245] tvp5150 4-005d: tvp5150: writing c8 80
[   11.942355] tvp5150 4-005d: tvp5150: writing c9 00
[   11.942464] tvp5150 4-005d: tvp5150: writing ca 00
[   11.942574] tvp5150 4-005d: tvp5150: writing cb 4e
[   11.942682] tvp5150 4-005d: tvp5150: writing cc 00
[   11.942791] tvp5150 4-005d: tvp5150: writing cd 01
[   11.942899] tvp5150 4-005d: tvp5150: writing cf 00
[   11.943008] tvp5150 4-005d: tvp5150: writing d0 00
[   11.943116] tvp5150 4-005d: tvp5150: writing fc 7f
[   11.943225] tvp5150 4-005d: tvp5150: writing cf 00
[   11.943334] tvp5150 4-005d: tvp5150: writing d0 ff
[   11.943444] tvp5150 4-005d: tvp5150: writing d1 ff
[   11.943552] tvp5150 4-005d: tvp5150: writing d2 ff
[   11.943661] tvp5150 4-005d: tvp5150: writing d3 ff
[   11.943769] tvp5150 4-005d: tvp5150: writing d4 ff
[   11.943878] tvp5150 4-005d: tvp5150: writing d5 ff
[   11.943987] tvp5150 4-005d: tvp5150: writing d6 ff
[   11.944096] tvp5150 4-005d: tvp5150: writing d7 ff
[   11.944205] tvp5150 4-005d: tvp5150: writing d8 ff
[   11.944313] tvp5150 4-005d: tvp5150: writing d9 ff
[   11.944422] tvp5150 4-005d: tvp5150: writing da ff
[   11.944531] tvp5150 4-005d: tvp5150: writing db ff
[   11.944639] tvp5150 4-005d: tvp5150: writing dc ff
[   11.944747] tvp5150 4-005d: tvp5150: writing dd ff
[   11.944856] tvp5150 4-005d: tvp5150: writing de ff
[   11.944964] tvp5150 4-005d: tvp5150: writing df ff
[   11.945073] tvp5150 4-005d: tvp5150: writing e0 ff
[   11.945181] tvp5150 4-005d: tvp5150: writing e1 ff
[   11.945292] tvp5150 4-005d: tvp5150: writing e2 ff
[   11.945401] tvp5150 4-005d: tvp5150: writing e3 ff
[   11.945509] tvp5150 4-005d: tvp5150: writing e4 ff
[   11.945617] tvp5150 4-005d: tvp5150: writing e5 ff
[   11.945726] tvp5150 4-005d: tvp5150: writing e6 ff
[   11.945835] tvp5150 4-005d: tvp5150: writing e7 ff
[   11.945943] tvp5150 4-005d: tvp5150: writing e8 ff
[   11.946051] tvp5150 4-005d: tvp5150: writing e9 ff
[   11.946160] tvp5150 4-005d: tvp5150: writing ea ff
[   11.946269] tvp5150 4-005d: tvp5150: writing eb ff
[   11.946377] tvp5150 4-005d: tvp5150: writing ec ff
[   11.946485] tvp5150 4-005d: tvp5150: writing ed ff
[   11.946594] tvp5150 4-005d: tvp5150: writing ee ff
[   11.946702] tvp5150 4-005d: tvp5150: writing ef ff
[   11.946811] tvp5150 4-005d: tvp5150: writing f0 ff
[   11.946920] tvp5150 4-005d: tvp5150: writing f1 ff
[   11.947028] tvp5150 4-005d: tvp5150: writing f2 ff
[   11.947137] tvp5150 4-005d: tvp5150: writing f3 ff
[   11.947245] tvp5150 4-005d: tvp5150: writing f4 ff
[   11.947353] tvp5150 4-005d: tvp5150: writing f5 ff
[   11.947461] tvp5150 4-005d: tvp5150: writing f6 ff
[   11.947570] tvp5150 4-005d: tvp5150: writing f7 ff
[   11.947679] tvp5150 4-005d: tvp5150: writing f8 ff
[   11.947788] tvp5150 4-005d: tvp5150: writing f9 ff
[   11.947897] tvp5150 4-005d: tvp5150: writing fa ff
[   11.948005] tvp5150 4-005d: tvp5150: writing fb ff
[   11.948121] tvp5150 4-005d: tvp5150: writing c5 00
[   11.948242] tvp5150 4-005d: tvp5150: writing c4 30
[   11.948352] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.948467] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.948576] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.948688] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.948794] tvp5150 4-005d: tvp5150: writing c3 27
[   11.948901] tvp5150 4-005d: tvp5150: writing c3 2e
[   11.949005] tvp5150 4-005d: tvp5150: writing c3 20
[   11.949232] tvp5150 4-005d: tvp5150: writing c3 2b
[   11.949347] tvp5150 4-005d: tvp5150: writing c3 a6
[   11.949472] tvp5150 4-005d: tvp5150: writing c3 72
[   11.949592] tvp5150 4-005d: tvp5150: writing c3 10
[   11.949707] tvp5150 4-005d: tvp5150: writing c3 00
[   11.949830] tvp5150 4-005d: tvp5150: writing c3 00
[   11.949949] tvp5150 4-005d: tvp5150: writing c3 00
[   11.950065] tvp5150 4-005d: tvp5150: writing c3 10
[   11.950178] tvp5150 4-005d: tvp5150: writing c3 00
[   11.950300] tvp5150 4-005d: tvp5150: writing c5 00
[   11.950425] tvp5150 4-005d: tvp5150: writing c4 f0
[   11.950540] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.950658] tvp5150 4-005d: tvp5150: writing c3 2a
[   11.950772] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.950925] tvp5150 4-005d: tvp5150: writing c3 3f
[   11.951036] tvp5150 4-005d: tvp5150: writing c3 04
[   11.951147] tvp5150 4-005d: tvp5150: writing c3 51
[   11.951259] tvp5150 4-005d: tvp5150: writing c3 6e
[   11.951369] tvp5150 4-005d: tvp5150: writing c3 02
[   11.951478] tvp5150 4-005d: tvp5150: writing c3 69
[   11.951588] tvp5150 4-005d: tvp5150: writing c3 8c
[   11.951697] tvp5150 4-005d: tvp5150: writing c3 09
[   11.951807] tvp5150 4-005d: tvp5150: writing c3 00
[   11.951923] tvp5150 4-005d: tvp5150: writing c3 00
[   11.952035] tvp5150 4-005d: tvp5150: writing c3 00
[   11.952143] tvp5150 4-005d: tvp5150: writing c3 27
[   11.952257] tvp5150 4-005d: tvp5150: writing c3 00
[   11.952371] tvp5150 4-005d: tvp5150: writing c5 01
[   11.952483] tvp5150 4-005d: tvp5150: writing c4 10
[   11.952597] tvp5150 4-005d: tvp5150: writing c3 5b
[   11.952718] tvp5150 4-005d: tvp5150: writing c3 55
[   11.952829] tvp5150 4-005d: tvp5150: writing c3 c5
[   11.952938] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.953047] tvp5150 4-005d: tvp5150: writing c3 00
[   11.953155] tvp5150 4-005d: tvp5150: writing c3 71
[   11.953264] tvp5150 4-005d: tvp5150: writing c3 6e
[   11.953372] tvp5150 4-005d: tvp5150: writing c3 42
[   11.953481] tvp5150 4-005d: tvp5150: writing c3 a6
[   11.953590] tvp5150 4-005d: tvp5150: writing c3 cd
[   11.953699] tvp5150 4-005d: tvp5150: writing c3 0f
[   11.953808] tvp5150 4-005d: tvp5150: writing c3 00
[   11.953917] tvp5150 4-005d: tvp5150: writing c3 00
[   11.954025] tvp5150 4-005d: tvp5150: writing c3 00
[   11.954134] tvp5150 4-005d: tvp5150: writing c3 3a
[   11.954243] tvp5150 4-005d: tvp5150: writing c3 00
[   11.954351] tvp5150 4-005d: tvp5150: writing c5 01
[   11.954459] tvp5150 4-005d: tvp5150: writing c4 90
[   11.954568] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.954677] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.954788] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.954898] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.955008] tvp5150 4-005d: tvp5150: writing c3 ba
[   11.955119] tvp5150 4-005d: tvp5150: writing c3 ce
[   11.955228] tvp5150 4-005d: tvp5150: writing c3 2b
[   11.955336] tvp5150 4-005d: tvp5150: writing c3 0d
[   11.955445] tvp5150 4-005d: tvp5150: writing c3 a6
[   11.955557] tvp5150 4-005d: tvp5150: writing c3 da
[   11.955666] tvp5150 4-005d: tvp5150: writing c3 0b
[   11.955776] tvp5150 4-005d: tvp5150: writing c3 00
[   11.955885] tvp5150 4-005d: tvp5150: writing c3 00
[   11.955993] tvp5150 4-005d: tvp5150: writing c3 00
[   11.956101] tvp5150 4-005d: tvp5150: writing c3 60
[   11.956216] tvp5150 4-005d: tvp5150: writing c3 00
[   11.956330] tvp5150 4-005d: Selecting video route: route input=0, output=0 => tvp5150 input=0, opmode=0
[   11.956336] tvp5150 4-005d: tvp5150: writing 02 00
[   11.956485] tvp5150 4-005d: tvp5150: writing 00 00
[   11.956819] tvp5150 4-005d: tvp5150: read 0x03 = 01
[   11.956824] tvp5150 4-005d: tvp5150: writing 03 41
[   11.956995] tvp5150 4-005d: tvp5150: writing 0f 02
[   11.957123] tvp5150 4-005d: tvp5150: writing 01 15
[   11.957250] tvp5150 4-005d: tvp5150: writing 03 6b
[   11.957378] tvp5150 4-005d: tvp5150: writing 04 00
[   11.957507] tvp5150 4-005d: tvp5150: writing 0d 47
[   11.957635] tvp5150 4-005d: tvp5150: writing 1a 0c
[   11.957762] tvp5150 4-005d: tvp5150: writing 1b 54
[   11.957892] tvp5150 4-005d: tvp5150: writing 27 20
[   11.958021] tvp5150 4-005d: tvp5150: writing 09 80
[   11.958147] tvp5150 4-005d: tvp5150: writing 0c 80
[   11.958275] tvp5150 4-005d: tvp5150: writing 0a 80
[   11.958403] tvp5150 4-005d: tvp5150: writing 0b 00
[   11.958530] tvp5150 4-005d: Set video std register to 4.
[   11.958536] tvp5150 4-005d: tvp5150: writing 28 04
[   11.958866] tvp5150 4-005d: tvp5150: read 0x00 = 00
[   11.958871] tvp5150 4-005d: tvp5150: Video input source selection #1 = 0x00
[   11.959058] tvp5150 4-005d: tvp5150: read 0x01 = 15
[   11.959063] tvp5150 4-005d: tvp5150: Analog channel controls = 0x15
[   11.959254] tvp5150 4-005d: tvp5150: read 0x02 = 00
[   11.959259] tvp5150 4-005d: tvp5150: Operation mode controls = 0x00
[   11.959446] tvp5150 4-005d: tvp5150: read 0x03 = 6b
[   11.959451] tvp5150 4-005d: tvp5150: Miscellaneous controls = 0x6b
[   11.959633] tvp5150 4-005d: tvp5150: read 0x04 = 00
[   11.959638] tvp5150 4-005d: tvp5150: Autoswitch mask= 0x00
[   11.959826] tvp5150 4-005d: tvp5150: read 0x06 = 10
[   11.959830] tvp5150 4-005d: tvp5150: Color killer threshold control = 0x10
[   11.960018] tvp5150 4-005d: tvp5150: read 0x07 = 60
[   11.960214] tvp5150 4-005d: tvp5150: read 0x08 = 00
[   11.960402] tvp5150 4-005d: tvp5150: read 0x0e = 00
[   11.960407] tvp5150 4-005d: tvp5150: Luminance processing controls #1 #2 and #3 = 60 00 00
[   11.960597] tvp5150 4-005d: tvp5150: read 0x09 = 80
[   11.960602] tvp5150 4-005d: tvp5150: Brightness control = 0x80
[   11.960887] tvp5150 4-005d: tvp5150: read 0x0a = 80
[   11.960893] tvp5150 4-005d: tvp5150: Color saturation control = 0x80
[   11.961102] tvp5150 4-005d: tvp5150: read 0x0b = 00
[   11.961107] tvp5150 4-005d: tvp5150: Hue control = 0x00
[   11.961302] tvp5150 4-005d: tvp5150: read 0x0c = 80
[   11.961307] tvp5150 4-005d: tvp5150: Contrast control = 0x80
[   11.961486] tvp5150 4-005d: tvp5150: read 0x0d = 47
[   11.961491] tvp5150 4-005d: tvp5150: Outputs and data rates select = 0x47
[   11.961679] tvp5150 4-005d: tvp5150: read 0x0f = 02
[   11.961684] tvp5150 4-005d: tvp5150: Configuration shared pins = 0x02
[   11.961877] tvp5150 4-005d: tvp5150: read 0x11 = 00
[   11.962070] tvp5150 4-005d: tvp5150: read 0x12 = 00
[   11.962075] tvp5150 4-005d: tvp5150: Active video cropping start = 0x0000
[   11.962258] tvp5150 4-005d: tvp5150: read 0x13 = 00
[   11.962453] tvp5150 4-005d: tvp5150: read 0x14 = 00
[   11.962458] tvp5150 4-005d: tvp5150: Active video cropping stop  = 0x0000
[   11.962640] tvp5150 4-005d: tvp5150: read 0x15 = 01
[   11.962646] tvp5150 4-005d: tvp5150: Genlock/RTC = 0x01
[   11.962837] tvp5150 4-005d: tvp5150: read 0x16 = 80
[   11.962842] tvp5150 4-005d: tvp5150: Horizontal sync start = 0x80
[   11.963029] tvp5150 4-005d: tvp5150: read 0x18 = 00
[   11.963034] tvp5150 4-005d: tvp5150: Vertical blanking start = 0x00
[   11.963221] tvp5150 4-005d: tvp5150: read 0x19 = 00
[   11.963226] tvp5150 4-005d: tvp5150: Vertical blanking stop = 0x00
[   11.963408] tvp5150 4-005d: tvp5150: read 0x1a = 0c
[   11.963601] tvp5150 4-005d: tvp5150: read 0x1b = 54
[   11.963606] tvp5150 4-005d: tvp5150: Chrominance processing control #1 and #2 = 0c 54
[   11.963794] tvp5150 4-005d: tvp5150: read 0x1c = 00
[   11.963799] tvp5150 4-005d: tvp5150: Interrupt reset register B = 0x00
[   11.963989] tvp5150 4-005d: tvp5150: read 0x1d = 00
[   11.963994] tvp5150 4-005d: tvp5150: Interrupt enable register B = 0x00
[   11.964181] tvp5150 4-005d: tvp5150: read 0x1e = 00
[   11.964186] tvp5150 4-005d: tvp5150: Interrupt configuration register B = 0x00
[   11.964402] tvp5150 4-005d: tvp5150: read 0x28 = 04
[   11.964407] tvp5150 4-005d: tvp5150: Video standard = 0x04
[   11.964565] tvp5150 4-005d: tvp5150: read 0x2c = 00
[   11.964753] tvp5150 4-005d: tvp5150: read 0x2d = 00
[   11.964758] tvp5150 4-005d: tvp5150: Chroma gain factor: Cb=0x00 Cr=0x00
[   11.964944] tvp5150 4-005d: tvp5150: read 0x2e = 0f
[   11.964949] tvp5150 4-005d: tvp5150: Macrovision on counter = 0x0f
[   11.965157] tvp5150 4-005d: tvp5150: read 0x2f = 01
[   11.965162] tvp5150 4-005d: tvp5150: Macrovision off counter = 0x01
[   11.965334] tvp5150 4-005d: tvp5150: read 0x30 = 00
[   11.965339] tvp5150 4-005d: tvp5150: ITU-R BT.656.4 timing(TVP5150AM1 only)
[   11.965523] tvp5150 4-005d: tvp5150: read 0x80 = 51
[   11.965722] tvp5150 4-005d: tvp5150: read 0x81 = 50
[   11.965727] tvp5150 4-005d: tvp5150: Device ID = 5150
[   11.965904] tvp5150 4-005d: tvp5150: read 0x82 = 04
[   11.966103] tvp5150 4-005d: tvp5150: read 0x83 = 00
[   11.966108] tvp5150 4-005d: tvp5150: ROM version = (hex) 04.00
[   11.966288] tvp5150 4-005d: tvp5150: read 0x84 = 02
[   11.966489] tvp5150 4-005d: tvp5150: read 0x85 = 71
[   11.966494] tvp5150 4-005d: tvp5150: Vertical line count = 0x0271
[   11.966676] tvp5150 4-005d: tvp5150: read 0x86 = da
[   11.966681] tvp5150 4-005d: tvp5150: Interrupt status register B = 0xda
[   11.966867] tvp5150 4-005d: tvp5150: read 0x87 = 00
[   11.966872] tvp5150 4-005d: tvp5150: Interrupt active register B = 0x00
[   11.967056] tvp5150 4-005d: tvp5150: read 0x88 = 76
[   11.967253] tvp5150 4-005d: tvp5150: read 0x89 = 28
[   11.967441] tvp5150 4-005d: tvp5150: read 0x8a = 1e
[   11.967633] tvp5150 4-005d: tvp5150: read 0x8b = c5
[   11.967825] tvp5150 4-005d: tvp5150: read 0x8c = 83
[   11.967831] tvp5150 4-005d: tvp5150: Status regs #1 to #5 = 76 28 1e c5 83
[   11.967986] tvp5150 4-005d: tvp5150: read 0xb1 = 00
[   11.968142] tvp5150 4-005d: tvp5150: read 0xb2 = 00
[   11.968299] tvp5150 4-005d: tvp5150: read 0xb3 = 00
[   11.968454] tvp5150 4-005d: tvp5150: read 0xb4 = 00
[   11.968460] tvp5150 4-005d: Teletext filter 1 reg b1 = 00 00 00 00
[   11.968610] tvp5150 4-005d: tvp5150: read 0xb6 = 00
[   11.968766] tvp5150 4-005d: tvp5150: read 0xb7 = 00
[   11.968922] tvp5150 4-005d: tvp5150: read 0xb8 = 00
[   11.969072] tvp5150 4-005d: tvp5150: read 0xb9 = 00
[   11.969078] tvp5150 4-005d: Teletext filter 2 reg b6 = 00 00 00 00
[   11.969228] tvp5150 4-005d: tvp5150: read 0xbb = 00
[   11.969233] tvp5150 4-005d: tvp5150: Teletext filter enable = 0x00
[   11.969386] tvp5150 4-005d: tvp5150: read 0xc0 = c0
[   11.969391] tvp5150 4-005d: tvp5150: Interrupt status register A = 0xc0
[   11.969542] tvp5150 4-005d: tvp5150: read 0xc1 = 00
[   11.969547] tvp5150 4-005d: tvp5150: Interrupt enable register A = 0x00
[   11.969702] tvp5150 4-005d: tvp5150: read 0xc2 = 04
[   11.969707] tvp5150 4-005d: tvp5150: Interrupt configuration = 0x04
[   11.969858] tvp5150 4-005d: tvp5150: read 0xc6 = 40
[   11.969863] tvp5150 4-005d: tvp5150: VDP status register = 0x40
[   11.970030] tvp5150 4-005d: tvp5150: read 0xc7 = 00
[   11.970035] tvp5150 4-005d: tvp5150: FIFO word count = 0x00
[   11.970189] tvp5150 4-005d: tvp5150: read 0xc8 = 80
[   11.970194] tvp5150 4-005d: tvp5150: FIFO interrupt threshold = 0x80
[   11.970345] tvp5150 4-005d: tvp5150: read 0xc9 = 00
[   11.970350] tvp5150 4-005d: tvp5150: FIFO reset = 0x00
[   11.970501] tvp5150 4-005d: tvp5150: read 0xca = 00
[   11.970506] tvp5150 4-005d: tvp5150: Line number interrupt = 0x00
[   11.970661] tvp5150 4-005d: tvp5150: read 0xcc = 00
[   11.970830] tvp5150 4-005d: tvp5150: read 0xcb = 4e
[   11.970836] tvp5150 4-005d: tvp5150: Pixel alignment register = 0x004e
[   11.970991] tvp5150 4-005d: tvp5150: read 0xcd = 01
[   11.970996] tvp5150 4-005d: tvp5150: FIFO output control = 0x01
[   11.971159] tvp5150 4-005d: tvp5150: read 0xcf = 00
[   11.971163] tvp5150 4-005d: tvp5150: Full field enable = 0x00
[   11.971314] tvp5150 4-005d: tvp5150: read 0xfc = 7f
[   11.971319] tvp5150 4-005d: tvp5150: Full field mode register = 0x7f
[   11.971490] tvp5150 4-005d: tvp5150: read 0x90 = 00
[   11.971646] tvp5150 4-005d: tvp5150: read 0x91 = 00
[   11.971804] tvp5150 4-005d: tvp5150: read 0x92 = 00
[   11.971809] tvp5150 4-005d: CC   data reg 90 = 00 00 00
[   11.971964] tvp5150 4-005d: tvp5150: read 0x94 = 00
[   11.972117] tvp5150 4-005d: tvp5150: read 0x95 = 00
[   11.972273] tvp5150 4-005d: tvp5150: read 0x96 = 00
[   11.972468] tvp5150 4-005d: tvp5150: read 0x97 = 00
[   11.972639] tvp5150 4-005d: tvp5150: read 0x98 = 00
[   11.972647] tvp5150 4-005d: WSS  data reg 94 = 00 00 00 00 00
[   11.973616] tvp5150 4-005d: tvp5150: read 0x9a = 00
[   11.973770] tvp5150 4-005d: tvp5150: read 0x9b = 00
[   11.973924] tvp5150 4-005d: tvp5150: read 0x9c = 00
[   11.974076] tvp5150 4-005d: tvp5150: read 0x9d = 00
[   11.974234] tvp5150 4-005d: tvp5150: read 0x9e = 00
[   11.974389] tvp5150 4-005d: tvp5150: read 0x9f = 00
[   11.974557] tvp5150 4-005d: tvp5150: read 0xa0 = 00
[   11.974712] tvp5150 4-005d: tvp5150: read 0xa1 = 00
[   11.974718] tvp5150 4-005d: VPS  data reg 9a = 00 00 00 00 00 00 00 00
[   11.974872] tvp5150 4-005d: tvp5150: read 0xa2 = 00
[   11.975033] tvp5150 4-005d: tvp5150: read 0xa3 = 00
[   11.975184] tvp5150 4-005d: tvp5150: read 0xa4 = 00
[   11.975335] tvp5150 4-005d: tvp5150: read 0xa5 = 00
[   11.975340] tvp5150 4-005d: VPS  data reg a2 = 00 00 00 00
[   11.975490] tvp5150 4-005d: tvp5150: read 0xa7 = 00
[   11.975642] tvp5150 4-005d: tvp5150: read 0xa8 = 00
[   11.975796] tvp5150 4-005d: tvp5150: read 0xa9 = 00
[   11.975947] tvp5150 4-005d: tvp5150: read 0xaa = 00
[   11.976104] tvp5150 4-005d: tvp5150: read 0xab = 00
[   11.976258] tvp5150 4-005d: tvp5150: read 0xac = 00
[   11.976409] tvp5150 4-005d: tvp5150: read 0xad = 00
[   11.976560] tvp5150 4-005d: tvp5150: read 0xae = 00
[   11.976566] tvp5150 4-005d: VITC data reg a7 = 00 00 00 00 00 00 00 00
[   11.976719] tvp5150 4-005d: tvp5150: read 0xd0 = ff
[   11.976875] tvp5150 4-005d: tvp5150: read 0xd1 = ff
[   11.977029] tvp5150 4-005d: tvp5150: read 0xd2 = ff
[   11.977183] tvp5150 4-005d: tvp5150: read 0xd3 = ff
[   11.977333] tvp5150 4-005d: tvp5150: read 0xd4 = ff
[   11.977484] tvp5150 4-005d: tvp5150: read 0xd5 = ff
[   11.977634] tvp5150 4-005d: tvp5150: read 0xd6 = ff
[   11.977786] tvp5150 4-005d: tvp5150: read 0xd7 = ff
[   11.977792] tvp5150 4-005d: Line mode reg d0 = ff ff ff ff ff ff ff ff
[   11.977946] tvp5150 4-005d: tvp5150: read 0xd8 = ff
[   11.978097] tvp5150 4-005d: tvp5150: read 0xd9 = ff
[   11.978247] tvp5150 4-005d: tvp5150: read 0xda = ff
[   11.978398] tvp5150 4-005d: tvp5150: read 0xdb = ff
[   11.978548] tvp5150 4-005d: tvp5150: read 0xdc = ff
[   11.978704] tvp5150 4-005d: tvp5150: read 0xdd = ff
[   11.978855] tvp5150 4-005d: tvp5150: read 0xde = ff
[   11.979011] tvp5150 4-005d: tvp5150: read 0xdf = ff
[   11.979016] tvp5150 4-005d: Line mode reg d8 = ff ff ff ff ff ff ff ff
[   11.979203] tvp5150 4-005d: tvp5150: read 0xe0 = ff
[   11.979354] tvp5150 4-005d: tvp5150: read 0xe1 = ff
[   11.979502] tvp5150 4-005d: tvp5150: read 0xe2 = ff
[   11.979657] tvp5150 4-005d: tvp5150: read 0xe3 = ff
[   11.979809] tvp5150 4-005d: tvp5150: read 0xe4 = ff
[   11.979970] tvp5150 4-005d: tvp5150: read 0xe5 = ff
[   11.980127] tvp5150 4-005d: tvp5150: read 0xe6 = ff
[   11.980288] tvp5150 4-005d: tvp5150: read 0xe7 = ff
[   11.980294] tvp5150 4-005d: Line mode reg e0 = ff ff ff ff ff ff ff ff
[   11.980445] tvp5150 4-005d: tvp5150: read 0xe8 = ff
[   11.980596] tvp5150 4-005d: tvp5150: read 0xe9 = ff
[   11.980764] tvp5150 4-005d: tvp5150: read 0xea = ff
[   11.981170] tvp5150 4-005d: tvp5150: read 0xeb = ff
[   11.981326] tvp5150 4-005d: tvp5150: read 0xec = ff
[   11.981477] tvp5150 4-005d: tvp5150: read 0xed = ff
[   11.981632] tvp5150 4-005d: tvp5150: read 0xee = ff
[   11.981783] tvp5150 4-005d: tvp5150: read 0xef = ff
[   11.981789] tvp5150 4-005d: Line mode reg e8 = ff ff ff ff ff ff ff ff
[   11.981944] tvp5150 4-005d: tvp5150: read 0xf0 = ff
[   11.982100] tvp5150 4-005d: tvp5150: read 0xf1 = ff
[   11.982256] tvp5150 4-005d: tvp5150: read 0xf2 = ff
[   11.982411] tvp5150 4-005d: tvp5150: read 0xf3 = ff
[   11.982561] tvp5150 4-005d: tvp5150: read 0xf4 = ff
[   11.982716] tvp5150 4-005d: tvp5150: read 0xf5 = ff
[   11.982867] tvp5150 4-005d: tvp5150: read 0xf6 = ff
[   11.983022] tvp5150 4-005d: tvp5150: read 0xf7 = ff
[   11.983028] tvp5150 4-005d: Line mode reg f0 = ff ff ff ff ff ff ff ff
[   11.983183] tvp5150 4-005d: tvp5150: read 0xf8 = ff
[   11.983334] tvp5150 4-005d: tvp5150: read 0xf9 = ff
[   11.983490] tvp5150 4-005d: tvp5150: read 0xfa = ff
[   11.983495] tvp5150 4-005d: Line mode reg f8 = ff ff ff
[   14.154157] vin3a: Port A: Using subdev tvp5150 4-005d for capture
[   14.184408] vin3a: subdev tvp5150 4-005d: code: 2006 idx: 0
[   16.304613] tvp5150 4-005d: width = 720, height = 288

A5. Recorded video:

 yavta -c10 -fYUYV -Fout_test.yuv -s720x288 / dev / video1

log_after_yavta.log

dmesg_log_after_yavta.log
root@am57xx-evm:~# yavta -c10 -fUYVY -Fout_test.yuv -s720x288 /dev/video1
Device /dev/video1 opened.
Device `vip' on `platform:vip2:vin3a:stream0' is a video output (without mplanes) device.
Video format set: UYVY (59565955) 720x288 (stride 1440) field none buffer size 414720
Video format: UYVY (59565955) 720x288 (stride 1440) field none buffer size 414720
8 buffers requested.
length: 414720 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xb6e26000.
length: 414720 offset: 417792 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0xb6dc0000.
length: 414720 offset: 835584 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0xb6d5a000.
length: 414720 offset: 1253376 timestamp type/source: mono/EoF
Buffer 3/0 mapped at address 0xb6cf4000.
length: 414720 offset: 1671168 timestamp type/source: mono/EoF
Buffer 4/0 mapped at address 0xb6c8e000.
length: 414720 offset: 2088960 timestamp type/source: mono/EoF
Buffer 5/0 mapped at address 0xb6c28000.
length: 414720 offset: 2506752 timestamp type/source: mono/EoF
Buffer 6/0 mapped at address 0xb6bc2000.
length: 414720 offset: 2924544 timestamp type/source: mono/EoF
Buffer 7/0 mapped at address 0xb6b5c000.
^C
root@am57xx-evm:~# dmesg
[  328.311529] vin3a-0: vip_open
[  328.311554] tvp5150 4-005d: width = 720, height = 288
[  328.311562] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
[  328.311574] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.311582] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.311587] vin3a-0: init_stream vpdma data type: 0x27
[  328.311595] vin3a-0: vip_init_stream: stream instance 0xc0bb2874ed237000
[  328.312180] vin3a-0: s_fmt input fourcc:UYVY size: 720x288 bpl:0 img_size:0
[  328.312188] vin3a-0: try_fmt fourcc:UYVY size: 720x288
[  328.312197] vin3a-0: try_fmt loop:0 fourcc:UYVY size: 720x288
[  328.312203] vin3a-0: try_fmt loop:0 found new larger: 720x288
[  328.312209] vin3a-0: try_fmt loop:0 found at least larger: 720x288
[  328.312214] vin3a-0: try_fmt loop:0 found new best: 720x288
[  328.312220] vin3a-0: try_fmt loop:0 found direct match: 720x288
[  328.312227] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.312233] vin3a-0: s_fmt try_fmt fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.312240] vin3a-0: s_fmt fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.312246] vin3a-0: s_fmt pix_to_mbus mbus_code: 2006 size: 720x288
[  328.312254] tvp5150 4-005d: width = 720, height = 288
[  328.312261] vin3a-0: s_fmt subdev fmt mbus_code: 2006 size: 720x288
[  328.312266] vin3a-0: s_fmt vpdma data type: 0x27
[  328.312490] vin3a-0: g_fmt fourcc:UYVY code: 2006 size: 720x288 bpl:1440 img_size:414720
[  328.312496] vin3a-0: g_fmt vpdma data type: 0x27
[  328.312706] vin3a-0: get 8 buffer(s) of size 414720 each.
[  328.319513] vin3: vip_set_slice_path:
[  328.319523] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[  328.319528] vin3: vip_set_slice_path:
[  328.319534] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[  328.319811] vin3: vip_setup_parser: EMBEDDED_SYNC_SINGLE_YUV422
[  328.319816] vin3: vip_setup_parser: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422
[  328.319821] vin3: vip_setup_parser: VIP_PIXCLK_EDGE_POLARITY=0
[  328.320119] tvp5150 4-005d: tvp5150: read 0x03 = 6b
[  328.320128] tvp5150 4-005d: tvp5150: writing 03 6b
[  328.320290] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:0
[  328.321418] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:1
[  347.591677] vin3a-0: vip_release
[  347.591688] vin3a-0: vip_stop_streaming:
[  347.591697] vin3: vip_set_slice_path:
[  347.591705] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[  347.591710] vin3: vip_set_slice_path:
[  347.591717] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[  347.592014] tvp5150 4-005d: tvp5150: read 0x03 = 6b
[  347.592023] tvp5150 4-005d: tvp5150: writing 03 62
[  347.592211] vin3a-0: Clear channel no: 38
[  347.592797] vin3a-0: vip_release_stream: stream instance 0x00000008ed237000
[  347.592804] vin3a: vip_release_port: port instance 0xeda3fe40ed208810
root@am57xx-evm:~# 

-------------------------------------------------------------------------------------------------
root@am57xx-evm:~# yavta -c10 -fYUYV -Fout_test.yuv -s720x288 /dev/video1
Device /dev/video1 opened.
Device `vip' on `platform:vip2:vin3a:stream0' is a video output (without mplanes) device.
Video format set: YUYV (56595559) 720x288 (stride 1440) field none buffer size 414720
Video format: YUYV (56595559) 720x288 (stride 1440) field none buffer size 414720
8 buffers requested.
length: 414720 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xb6ddb000.
length: 414720 offset: 417792 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0xb6d75000.
length: 414720 offset: 835584 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0xb6d0f000.
length: 414720 offset: 1253376 timestamp type/source: mono/EoF
Buffer 3/0 mapped at address 0xb6ca9000.
length: 414720 offset: 1671168 timestamp type/source: mono/EoF
Buffer 4/0 mapped at address 0xb6c43000.
length: 414720 offset: 2088960 timestamp type/source: mono/EoF
Buffer 5/0 mapped at address 0xb6bdd000.
length: 414720 offset: 2506752 timestamp type/source: mono/EoF
Buffer 6/0 mapped at address 0xb6b77000.
length: 414720 offset: 2924544 timestamp type/source: mono/EoF
Buffer 7/0 mapped at address 0xb6b11000.
^C
root@am57xx-evm:~# dmesg
[  489.396883] vin3a-0: vip_open
[  489.396908] tvp5150 4-005d: width = 720, height = 288
[  489.396917] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
[  489.396929] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  489.396936] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  489.396942] vin3a-0: init_stream vpdma data type: 0x27
[  489.396950] vin3a-0: vip_init_stream: stream instance 0xc0bb2874ed237000
[  489.397122] vin3a-0: s_fmt input fourcc:YUYV size: 720x288 bpl:0 img_size:0
[  489.397129] vin3a-0: try_fmt fourcc:YUYV size: 720x288
[  489.397138] vin3a-0: try_fmt loop:0 fourcc:YUYV size: 720x288
[  489.397145] vin3a-0: try_fmt loop:0 found new larger: 720x288
[  489.397152] vin3a-0: try_fmt loop:0 found at least larger: 720x288
[  489.397159] vin3a-0: try_fmt loop:0 found new best: 720x288
[  489.397167] vin3a-0: try_fmt loop:0 found direct match: 720x288
[  489.397174] vin3a: calc_format_size: fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
[  489.397182] vin3a-0: s_fmt try_fmt fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
[  489.397190] vin3a-0: s_fmt fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
[  489.397196] vin3a-0: s_fmt pix_to_mbus mbus_code: 2006 size: 720x288
[  489.397205] tvp5150 4-005d: width = 720, height = 288
[  489.397211] vin3a-0: s_fmt subdev fmt mbus_code: 2006 size: 720x288
[  489.397217] vin3a-0: s_fmt vpdma data type: 0x07
[  489.397284] vin3a-0: g_fmt fourcc:YUYV code: 2006 size: 720x288 bpl:1440 img_size:414720
[  489.397289] vin3a-0: g_fmt vpdma data type: 0x07
[  489.397347] vin3a-0: get 8 buffer(s) of size 414720 each.
[  489.401221] vin3: vip_set_slice_path:
[  489.401231] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[  489.401238] vin3: vip_set_slice_path:
[  489.401246] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[  489.401523] vin3: vip_setup_parser: EMBEDDED_SYNC_SINGLE_YUV422
[  489.401532] vin3: vip_setup_parser: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422
[  489.401537] vin3: vip_setup_parser: VIP_PIXCLK_EDGE_POLARITY=0
[  489.401777] tvp5150 4-005d: tvp5150: read 0x03 = 62
[  489.401788] tvp5150 4-005d: tvp5150: writing 03 6b
[  489.401930] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:0
[  489.403063] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:1
[  494.081846] vin3a-0: vip_release
[  494.081858] vin3a-0: vip_stop_streaming:
[  494.081868] vin3: vip_set_slice_path:
[  494.081877] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[  494.081882] vin3: vip_set_slice_path:
[  494.081888] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[  494.082126] tvp5150 4-005d: tvp5150: read 0x03 = 6b
[  494.082134] tvp5150 4-005d: tvp5150: writing 03 62
[  494.082297] vin3a-0: Clear channel no: 38
[  494.082863] vin3a-0: vip_release_stream: stream instance 0x00000008ed237000
[  494.082871] vin3a: vip_release_port: port instance 0xeda133c0ed208810




out_test.yuv.tar.gzout_test.yuv.tar.gz

A6. Displayed image using gstreamer:

gst-launch-1.0 v4l2src device = / dev / video1 io-mode = 4! 'video / x-raw, format = (string) YUY2, width = (int) 720, height = (int) 288'! waylandsink use-drm = true

after_gst-launch-1.0.logafter_gst-launch-1.0.log

gst-launch-1.0.log

gst-launch-1.0.log
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
handling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:09.098645294
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

A7. The work of yavta and gstreamer led to the following result

Picture:

The first question. How can I eliminate the image shift, ie remove the black bars on the left and on the top?

<=====================================================================================>

Situation two (for the case of Embedded Sync. aka BT.656):

B1. I created another cam-tvp5150.dtso file

cam-tvp5150.dtso.tar.gz

B2. Adapted drivers:

tvp5150 for debug = 2

ti_vip.ko (vip.c): debug = 3

 vip.cvip.c

 Slightly changed tvp5150.c

1832.tvp5150.c
/*
 * tvp5150 - Texas Instruments TVP5150A/AM1 and TVP5151 video decoder driver
 *
 * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org)
 * This code is placed under the terms of the GNU General Public License v2
 */

#include <dt-bindings/media/tvp5150.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <media/v4l2-async.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-mc.h>

#include "tvp5150_reg.h"

#define TVP5150_H_MAX			720U
#define TVP5150_V_MAX_525_60	480U
#define TVP5150_V_MAX_OTHERS	576U
#define TVP5150_MAX_CROP_LEFT	511
#define TVP5150_MAX_CROP_TOP	127
#define TVP5150_CROP_SHIFT		2

MODULE_DESCRIPTION("Texas Instruments TVP5150A/TVP5150AM1/TVP5151 video decoder driver");
MODULE_AUTHOR("Mauro Carvalho Chehab");
MODULE_LICENSE("GPL");

//DeVdistress
#if(0)
	static int debug;
	module_param(debug, int, 0644);
	MODULE_PARM_DESC(debug, "Debug level (0-2)");
#else
	static int debug = 2;
#endif

#define dprintk0(__dev, __arg...) dev_dbg_lvl(__dev, 0, 0, __arg)

struct tvp5150 {
	struct v4l2_subdev sd;
#ifdef CONFIG_MEDIA_CONTROLLER
	struct media_pad pads[DEMOD_NUM_PADS];
	struct media_entity input_ent[TVP5150_INPUT_NUM];
	struct media_pad input_pad[TVP5150_INPUT_NUM];
#endif
	struct v4l2_ctrl_handler hdl;
	struct v4l2_rect rect;

	v4l2_std_id norm;	/* Current set standard */
	u32 input;
	u32 output;
	int enable;

	u16 dev_id;
	u16 rom_ver;

	enum v4l2_mbus_type mbus_type;
};

static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
{
	return container_of(sd, struct tvp5150, sd);
}

static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
{
	return &container_of(ctrl->handler, struct tvp5150, hdl)->sd;
}

static int tvp5150_read(struct v4l2_subdev *sd, unsigned char addr)
{
	struct i2c_client *c = v4l2_get_subdevdata(sd);
	int rc;

	rc = i2c_smbus_read_byte_data(c, addr);
	if (rc < 0) {
		dev_err(sd->dev, "i2c i/o error: rc == %d\n", rc);
		return rc;
	}

	dev_dbg_lvl(sd->dev, 2, debug, "tvp5150: read 0x%02x = %02x\n", addr, rc);

	return rc;
}

static int tvp5150_write(struct v4l2_subdev *sd, unsigned char addr,
				 unsigned char value)
{
	struct i2c_client *c = v4l2_get_subdevdata(sd);
	int rc;

	dev_dbg_lvl(sd->dev, 2, debug, "tvp5150: writing %02x %02x\n", addr, value);
	rc = i2c_smbus_write_byte_data(c, addr, value);
	if (rc < 0)
		dev_err(sd->dev, "i2c i/o error: rc == %d\n", rc);

	return rc;
}

static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init,
				const u8 end, int max_line)
{
	u8 buf[16];
	int i = 0, j, len;

	if (max_line > 16) {
		dprintk0(sd->dev, "too much data to dump\n");
		return;
	}

	for (i = init; i < end; i += max_line) {
		len = (end - i > max_line) ? max_line : end - i;

		for (j = 0; j < len; j++)
			buf[j] = tvp5150_read(sd, i + j);

		dprintk0(sd->dev, "%s reg %02x = %*ph\n", s, i, len, buf);
	}
}

static int tvp5150_log_status(struct v4l2_subdev *sd)
{
	dprintk0(sd->dev, "tvp5150: Video input source selection #1 = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VD_IN_SRC_SEL_1));
	dprintk0(sd->dev, "tvp5150: Analog channel controls = 0x%02x\n",
		tvp5150_read(sd, TVP5150_ANAL_CHL_CTL));
	dprintk0(sd->dev, "tvp5150: Operation mode controls = 0x%02x\n",
		tvp5150_read(sd, TVP5150_OP_MODE_CTL));
	dprintk0(sd->dev, "tvp5150: Miscellaneous controls = 0x%02x\n",
		tvp5150_read(sd, TVP5150_MISC_CTL));
	dprintk0(sd->dev, "tvp5150: Autoswitch mask= 0x%02x\n",
		tvp5150_read(sd, TVP5150_AUTOSW_MSK));
	dprintk0(sd->dev, "tvp5150: Color killer threshold control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_COLOR_KIL_THSH_CTL));
	dprintk0(sd->dev, "tvp5150: Luminance processing controls #1 #2 and #3 = %02x %02x %02x\n",
		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_1),
		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_2),
		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_3));
	dprintk0(sd->dev, "tvp5150: Brightness control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_BRIGHT_CTL));
	dprintk0(sd->dev, "tvp5150: Color saturation control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_SATURATION_CTL));
	dprintk0(sd->dev, "tvp5150: Hue control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_HUE_CTL));
	dprintk0(sd->dev, "tvp5150: Contrast control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_CONTRAST_CTL));
	dprintk0(sd->dev, "tvp5150: Outputs and data rates select = 0x%02x\n",
		tvp5150_read(sd, TVP5150_DATA_RATE_SEL));
	dprintk0(sd->dev, "tvp5150: Configuration shared pins = 0x%02x\n",
		tvp5150_read(sd, TVP5150_CONF_SHARED_PIN));
	dprintk0(sd->dev, "tvp5150: Active video cropping start = 0x%02x%02x\n",
		tvp5150_read(sd, TVP5150_ACT_VD_CROP_ST_MSB),
		tvp5150_read(sd, TVP5150_ACT_VD_CROP_ST_LSB));
	dprintk0(sd->dev, "tvp5150: Active video cropping stop  = 0x%02x%02x\n",
		tvp5150_read(sd, TVP5150_ACT_VD_CROP_STP_MSB),
		tvp5150_read(sd, TVP5150_ACT_VD_CROP_STP_LSB));
	dprintk0(sd->dev, "tvp5150: Genlock/RTC = 0x%02x\n",
		tvp5150_read(sd, TVP5150_GENLOCK));
	dprintk0(sd->dev, "tvp5150: Horizontal sync start = 0x%02x\n",
		tvp5150_read(sd, TVP5150_HORIZ_SYNC_START));
	dprintk0(sd->dev, "tvp5150: Vertical blanking start = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VERT_BLANKING_START));
	dprintk0(sd->dev, "tvp5150: Vertical blanking stop = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VERT_BLANKING_STOP));
	dprintk0(sd->dev, "tvp5150: Chrominance processing control #1 and #2 = %02x %02x\n",
		tvp5150_read(sd, TVP5150_CHROMA_PROC_CTL_1),
		tvp5150_read(sd, TVP5150_CHROMA_PROC_CTL_2));
	dprintk0(sd->dev, "tvp5150: Interrupt reset register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_RESET_REG_B));
	dprintk0(sd->dev, "tvp5150: Interrupt enable register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_ENABLE_REG_B));
	dprintk0(sd->dev, "tvp5150: Interrupt configuration register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INTT_CONFIG_REG_B));
	dprintk0(sd->dev, "tvp5150: Video standard = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VIDEO_STD));
	dprintk0(sd->dev, "tvp5150: Chroma gain factor: Cb=0x%02x Cr=0x%02x\n",
		tvp5150_read(sd, TVP5150_CB_GAIN_FACT),
		tvp5150_read(sd, TVP5150_CR_GAIN_FACTOR));
	dprintk0(sd->dev, "tvp5150: Macrovision on counter = 0x%02x\n",
		tvp5150_read(sd, TVP5150_MACROVISION_ON_CTR));
	dprintk0(sd->dev, "tvp5150: Macrovision off counter = 0x%02x\n",
		tvp5150_read(sd, TVP5150_MACROVISION_OFF_CTR));
	dprintk0(sd->dev, "tvp5150: ITU-R BT.656.%d timing(TVP5150AM1 only)\n",
		(tvp5150_read(sd, TVP5150_REV_SELECT) & 1) ? 3 : 4);
	dprintk0(sd->dev, "tvp5150: Device ID = %02x%02x\n",
		tvp5150_read(sd, TVP5150_MSB_DEV_ID),
		tvp5150_read(sd, TVP5150_LSB_DEV_ID));
	dprintk0(sd->dev, "tvp5150: ROM version = (hex) %02x.%02x\n",
		tvp5150_read(sd, TVP5150_ROM_MAJOR_VER),
		tvp5150_read(sd, TVP5150_ROM_MINOR_VER));
	dprintk0(sd->dev, "tvp5150: Vertical line count = 0x%02x%02x\n",
		tvp5150_read(sd, TVP5150_VERT_LN_COUNT_MSB),
		tvp5150_read(sd, TVP5150_VERT_LN_COUNT_LSB));
	dprintk0(sd->dev, "tvp5150: Interrupt status register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_STATUS_REG_B));
	dprintk0(sd->dev, "tvp5150: Interrupt active register B = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_ACTIVE_REG_B));
	dprintk0(sd->dev, "tvp5150: Status regs #1 to #5 = %02x %02x %02x %02x %02x\n",
		tvp5150_read(sd, TVP5150_STATUS_REG_1),
		tvp5150_read(sd, TVP5150_STATUS_REG_2),
		tvp5150_read(sd, TVP5150_STATUS_REG_3),
		tvp5150_read(sd, TVP5150_STATUS_REG_4),
		tvp5150_read(sd, TVP5150_STATUS_REG_5));

	dump_reg_range(sd, "Teletext filter 1",   TVP5150_TELETEXT_FIL1_INI,
			TVP5150_TELETEXT_FIL1_END, 8);
	dump_reg_range(sd, "Teletext filter 2",   TVP5150_TELETEXT_FIL2_INI,
			TVP5150_TELETEXT_FIL2_END, 8);

	dprintk0(sd->dev, "tvp5150: Teletext filter enable = 0x%02x\n",
		tvp5150_read(sd, TVP5150_TELETEXT_FIL_ENA));
	dprintk0(sd->dev, "tvp5150: Interrupt status register A = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_STATUS_REG_A));
	dprintk0(sd->dev, "tvp5150: Interrupt enable register A = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_ENABLE_REG_A));
	dprintk0(sd->dev, "tvp5150: Interrupt configuration = 0x%02x\n",
		tvp5150_read(sd, TVP5150_INT_CONF));
	dprintk0(sd->dev, "tvp5150: VDP status register = 0x%02x\n",
		tvp5150_read(sd, TVP5150_VDP_STATUS_REG));
	dprintk0(sd->dev, "tvp5150: FIFO word count = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FIFO_WORD_COUNT));
	dprintk0(sd->dev, "tvp5150: FIFO interrupt threshold = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FIFO_INT_THRESHOLD));
	dprintk0(sd->dev, "tvp5150: FIFO reset = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FIFO_RESET));
	dprintk0(sd->dev, "tvp5150: Line number interrupt = 0x%02x\n",
		tvp5150_read(sd, TVP5150_LINE_NUMBER_INT));
	dprintk0(sd->dev, "tvp5150: Pixel alignment register = 0x%02x%02x\n",
		tvp5150_read(sd, TVP5150_PIX_ALIGN_REG_HIGH),
		tvp5150_read(sd, TVP5150_PIX_ALIGN_REG_LOW));
	dprintk0(sd->dev, "tvp5150: FIFO output control = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FIFO_OUT_CTRL));
	dprintk0(sd->dev, "tvp5150: Full field enable = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FULL_FIELD_ENA));
	dprintk0(sd->dev, "tvp5150: Full field mode register = 0x%02x\n",
		tvp5150_read(sd, TVP5150_FULL_FIELD_MODE_REG));

	dump_reg_range(sd, "CC   data",   TVP5150_CC_DATA_INI,
			TVP5150_CC_DATA_END, 8);

	dump_reg_range(sd, "WSS  data",   TVP5150_WSS_DATA_INI,
			TVP5150_WSS_DATA_END, 8);

	dump_reg_range(sd, "VPS  data",   TVP5150_VPS_DATA_INI,
			TVP5150_VPS_DATA_END, 8);

	dump_reg_range(sd, "VITC data",   TVP5150_VITC_DATA_INI,
			TVP5150_VITC_DATA_END, 10);

	dump_reg_range(sd, "Line mode",   TVP5150_LINE_MODE_INI,
			TVP5150_LINE_MODE_END, 8);
	return 0;
}

/****************************************************************************
			Basic functions
 ****************************************************************************/

static void tvp5150_selmux(struct v4l2_subdev *sd)
{
	int opmode = 0;
	struct tvp5150 *decoder = to_tvp5150(sd);
	int input = 0;
	int val;

	/* Only tvp5150am1 and tvp5151 have signal generator support */
	if ((decoder->dev_id == 0x5150 && decoder->rom_ver == 0x0400) ||
	    (decoder->dev_id == 0x5151 && decoder->rom_ver == 0x0100)) {
		if (!decoder->enable)
			input = 8;
	}

//DeVdistress
#if(1)
	switch (decoder->input) {
	case TVP5150_COMPOSITE1:
		input |= 2;
		/* fall through */
	case TVP5150_COMPOSITE0:
		break;
	case TVP5150_SVIDEO:
	default:
		input |= 1;
		break;
	}
#endif

	dev_dbg_lvl(sd->dev, 1, debug, "Selecting video route: route input=%i, output=%i => tvp5150 input=%i, opmode=%i\n",
			decoder->input, decoder->output,
			input, opmode);

	tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode);
	tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input);

	/*
	 * Setup the FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK output signals. For
	 * S-Video we output the vertical lock (VLK) signal on FID/GLCO/VLK/HVLK
	 * and set INTREQ/GPCL/VBLK to logic 0. For composite we output the
	 * field indicator (FID) signal on FID/GLCO/VLK/HVLK and set
	 * INTREQ/GPCL/VBLK to logic 1.
	 */
	val = tvp5150_read(sd, TVP5150_MISC_CTL);
	if (val < 0) {
		dev_err(sd->dev, "%s: failed with error = %d\n", __func__, val);
		return;
	}

	if (decoder->input == TVP5150_SVIDEO)
		val = (val & ~TVP5150_MISC_CTL_GPCL) | TVP5150_MISC_CTL_HVLK;
	else
		val = (val & ~TVP5150_MISC_CTL_HVLK) | TVP5150_MISC_CTL_GPCL;
	tvp5150_write(sd, TVP5150_MISC_CTL, val);
};

struct i2c_reg_value {
	unsigned char reg;
	unsigned char value;
};

/* Default values as sugested at TVP5150AM1 datasheet */
static const struct i2c_reg_value tvp5150_init_default[] = {
	{ /* 0x00 */
		TVP5150_VD_IN_SRC_SEL_1,0x00
	},
	{ /* 0x01 */
		TVP5150_ANAL_CHL_CTL,0x15
	},
	{ /* 0x02 */
		TVP5150_OP_MODE_CTL,0x00
	},
	{ /* 0x03 */
		TVP5150_MISC_CTL,0x01
	},
	{ /* 0x06 */
		TVP5150_COLOR_KIL_THSH_CTL,0x10
	},
	{ /* 0x07 */
		TVP5150_LUMA_PROC_CTL_1,0x60
	},
	{ /* 0x08 */
		TVP5150_LUMA_PROC_CTL_2,0x00
	},
	{ /* 0x09 */
		TVP5150_BRIGHT_CTL,0x80
	},
	{ /* 0x0a */
		TVP5150_SATURATION_CTL,0x80
	},
	{ /* 0x0b */
		TVP5150_HUE_CTL,0x00
	},
	{ /* 0x0c */
		TVP5150_CONTRAST_CTL,0x80
	},
	{ /* 0x0d */
		TVP5150_DATA_RATE_SEL,0x47
	},
	{ /* 0x0e */
		TVP5150_LUMA_PROC_CTL_3,0x00
	},
	{ /* 0x0f */
		TVP5150_CONF_SHARED_PIN,0x08
	},
	{ /* 0x11 */
		TVP5150_ACT_VD_CROP_ST_MSB,0x00
	},
	{ /* 0x12 */
		TVP5150_ACT_VD_CROP_ST_LSB,0x00
	},
	{ /* 0x13 */
		TVP5150_ACT_VD_CROP_STP_MSB,0x00
	},
	{ /* 0x14 */
		TVP5150_ACT_VD_CROP_STP_LSB,0x00
	},
	{ /* 0x15 */
		TVP5150_GENLOCK,0x01
	},
	{ /* 0x16 */
		TVP5150_HORIZ_SYNC_START,0x80
	},
	{ /* 0x18 */
		TVP5150_VERT_BLANKING_START,0x00
	},
	{ /* 0x19 */
		TVP5150_VERT_BLANKING_STOP,0x00
	},
	{ /* 0x1a */
		TVP5150_CHROMA_PROC_CTL_1,0x0c
	},
	{ /* 0x1b */
		TVP5150_CHROMA_PROC_CTL_2,0x14
	},
	{ /* 0x1c */
		TVP5150_INT_RESET_REG_B,0x00
	},
	{ /* 0x1d */
		TVP5150_INT_ENABLE_REG_B,0x00
	},
	{ /* 0x1e */
		TVP5150_INTT_CONFIG_REG_B,0x00
	},
	{ /* 0x28 */
		TVP5150_VIDEO_STD,0x00
	},
	{ /* 0x2e */
		TVP5150_MACROVISION_ON_CTR,0x0f
	},
	{ /* 0x2f */
		TVP5150_MACROVISION_OFF_CTR,0x01
	},
	{ /* 0xbb */
		TVP5150_TELETEXT_FIL_ENA,0x00
	},
	{ /* 0xc0 */
		TVP5150_INT_STATUS_REG_A,0x00
	},
	{ /* 0xc1 */
		TVP5150_INT_ENABLE_REG_A,0x00
	},
	{ /* 0xc2 */
		TVP5150_INT_CONF,0x04
	},
	{ /* 0xc8 */
		TVP5150_FIFO_INT_THRESHOLD,0x80
	},
	{ /* 0xc9 */
		TVP5150_FIFO_RESET,0x00
	},
	{ /* 0xca */
		TVP5150_LINE_NUMBER_INT,0x00
	},
	{ /* 0xcb */
		TVP5150_PIX_ALIGN_REG_LOW,0x4e
	},
	{ /* 0xcc */
		TVP5150_PIX_ALIGN_REG_HIGH,0x00
	},
	{ /* 0xcd */
		TVP5150_FIFO_OUT_CTRL,0x01
	},
	{ /* 0xcf */
		TVP5150_FULL_FIELD_ENA,0x00
	},
	{ /* 0xd0 */
		TVP5150_LINE_MODE_INI,0x00
	},
	{ /* 0xfc */
		TVP5150_FULL_FIELD_MODE_REG,0x7f
	},
	{ /* end of data */
		0xff,0xff
	}
};

/* Default values as sugested at TVP5150AM1 datasheet */
static const struct i2c_reg_value tvp5150_init_enable[] = {
	{
		TVP5150_CONF_SHARED_PIN, 2
	},{	/* Automatic offset and AGC enabled */
		TVP5150_ANAL_CHL_CTL, 0x15
	},{	/* Activate YCrCb output 0x9 or 0xd ? */
		TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
				  TVP5150_MISC_CTL_INTREQ_OE |
				  TVP5150_MISC_CTL_YCBCR_OE |
#if(0) //DeVdistress
				  TVP5150_MISC_CTL_SYNC_OE |
#endif
				  TVP5150_MISC_CTL_VBLANK |
				  TVP5150_MISC_CTL_CLOCK_OE,
	},{	/* Activates video std autodetection for all standards */
		TVP5150_AUTOSW_MSK, 0x0
	},{	/* Default format: 0x47. For 4:2:2: 0x40 */
		TVP5150_DATA_RATE_SEL, 0x47
	},{
		TVP5150_CHROMA_PROC_CTL_1, 0x0c
	},{
		TVP5150_CHROMA_PROC_CTL_2, 0x54
	},{	/* Non documented, but initialized on WinTV USB2 */
		0x27, 0x20
	},{
		0xff,0xff
	}
};

struct tvp5150_vbi_type {
	unsigned int vbi_type;
	unsigned int ini_line;
	unsigned int end_line;
	unsigned int by_field :1;
};

struct i2c_vbi_ram_value {
	u16 reg;
	struct tvp5150_vbi_type type;
	unsigned char values[16];
};

/* This struct have the values for each supported VBI Standard
 * by
 tvp5150_vbi_types should follow the same order as vbi_ram_default
 * value 0 means rom position 0x10, value 1 means rom position 0x30
 * and so on. There are 16 possible locations from 0 to 15.
 */

static struct i2c_vbi_ram_value vbi_ram_default[] =
{
	/* FIXME: Current api doesn't handle all VBI types, those not
	   yet supported are placed under #if 0 */
#if 0
	[0] = {0x010, /* Teletext, SECAM, WST System A */
		{V4L2_SLICED_TELETEXT_SECAM,6,23,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26,
		  0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
#endif
	[1] = {0x030, /* Teletext, PAL, WST System B */
		{V4L2_SLICED_TELETEXT_B,6,22,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b,
		  0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
#if 0
	[2] = {0x050, /* Teletext, PAL, WST System C */
		{V4L2_SLICED_TELETEXT_PAL_C,6,22,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
		  0xa6, 0x98, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
	[3] = {0x070, /* Teletext, NTSC, WST System B */
		{V4L2_SLICED_TELETEXT_NTSC_B,10,21,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x23,
		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
	[4] = {0x090, /* Tetetext, NTSC NABTS System C */
		{V4L2_SLICED_TELETEXT_NTSC_C,10,21,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x15, 0x00 }
	},
	[5] = {0x0b0, /* Teletext, NTSC-J, NABTS System D */
		{V4L2_SLICED_TELETEXT_NTSC_D,10,21,1},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xa7, 0x2e, 0x20, 0x23,
		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
	},
	[6] = {0x0d0, /* Closed Caption, PAL/SECAM */
		{V4L2_SLICED_CAPTION_625,22,22,1},
		{ 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
		  0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
	},
#endif
	[7] = {0x0f0, /* Closed Caption, NTSC */
		{V4L2_SLICED_CAPTION_525,21,21,1},
		{ 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
		  0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
	},
	[8] = {0x110, /* Wide Screen Signal, PAL/SECAM */
		{V4L2_SLICED_WSS_625,23,23,1},
		{ 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42,
		  0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 }
	},
#if 0
	[9] = {0x130, /* Wide Screen Signal, NTSC C */
		{V4L2_SLICED_WSS_525,20,20,1},
		{ 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43,
		  0x69, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00 }
	},
	[10] = {0x150, /* Vertical Interval Timecode (VITC), PAL/SECAM */
		{V4l2_SLICED_VITC_625,6,22,0},
		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
		  0xa6, 0x85, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
	},
	[11] = {0x170, /* Vertical Interval Timecode (VITC), NTSC */
		{V4l2_SLICED_VITC_525,10,20,0},
		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
		  0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
	},
#endif
	[12] = {0x190, /* Video Program System (VPS), PAL */
		{V4L2_SLICED_VPS,16,16,0},
		{ 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d,
		  0xa6, 0xda, 0x0b, 0x00, 0x00, 0x00, 0x60, 0x00 }
	},
	/* 0x1d0 User programmable */
};

static int tvp5150_write_inittab(struct v4l2_subdev *sd,
				const struct i2c_reg_value *regs)
{
	while (regs->reg != 0xff) {
		tvp5150_write(sd, regs->reg, regs->value);
		regs++;
	}
	return 0;
}

static int tvp5150_vdp_init(struct v4l2_subdev *sd)
{
	unsigned int i;
	int j;

	/* Disable Full Field */
	tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0);

	/* Before programming, Line mode should be at 0xff */
	for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++)
		tvp5150_write(sd, i, 0xff);

	/* Load Ram Table */
	for (j = 0; j < ARRAY_SIZE(vbi_ram_default); j++) {
		const struct i2c_vbi_ram_value *regs = &vbi_ram_default[j];

		if (!regs->type.vbi_type)
			continue;

		tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_HIGH, regs->reg >> 8);
		tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_LOW, regs->reg);

		for (i = 0; i < 16; i++)
			tvp5150_write(sd, TVP5150_VDP_CONF_RAM_DATA, regs->values[i]);
	}
	return 0;
}

/* Fills VBI capabilities based on i2c_vbi_ram_value struct */
static int tvp5150_g_sliced_vbi_cap(struct v4l2_subdev *sd,
				struct v4l2_sliced_vbi_cap *cap)
{
	int line, i;

	dev_dbg_lvl(sd->dev, 1, debug, "g_sliced_vbi_cap\n");
	memset(cap, 0, sizeof *cap);

	for (i = 0; i < ARRAY_SIZE(vbi_ram_default); i++) {
		const struct i2c_vbi_ram_value *regs = &vbi_ram_default[i];

		if (!regs->type.vbi_type)
			continue;

		for (line = regs->type.ini_line;
		     line <= regs->type.end_line;
		     line++) {
			cap->service_lines[0][line] |= regs->type.vbi_type;
		}
		cap->service_set |= regs->type.vbi_type;
	}
	return 0;
}

/* Set vbi processing
 * type - one of tvp5150_vbi_types
 * line - line to gather data
 * fields: bit 0 field1, bit 1, field2
 * flags (default=0xf0) is a bitmask, were set means:
 *	bit 7: enable filtering null bytes on CC
 *	bit 6: send data also to FIFO
 *	bit 5: don't allow data with errors on FIFO
 *	bit 4: enable ECC when possible
 * pix_align = pix alignment:
 *	LSB = field1
 *	MSB = field2
 */
static int tvp5150_set_vbi(struct v4l2_subdev *sd,
			unsigned int type,u8 flags, int line,
			const int fields)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	v4l2_std_id std = decoder->norm;
	u8 reg;
	int i, pos = 0;

	if (std == V4L2_STD_ALL) {
		dev_err(sd->dev, "VBI can't be configured without knowing number of lines\n");
		return 0;
	} else if (std & V4L2_STD_625_50) {
		/* Don't follow NTSC Line number convension */
		line += 3;
	}

	if (line < 6 || line > 27)
		return 0;

	for (i = 0; i < ARRAY_SIZE(vbi_ram_default); i++) {
		const struct i2c_vbi_ram_value *regs =  &vbi_ram_default[i];

		if (!regs->type.vbi_type)
			continue;

		if ((type & regs->type.vbi_type) &&
		    (line >= regs->type.ini_line) &&
		    (line <= regs->type.end_line))
			break;
		pos++;
	}

	type = pos | (flags & 0xf0);
	reg = ((line - 6) << 1) + TVP5150_LINE_MODE_INI;

	if (fields & 1)
		tvp5150_write(sd, reg, type);

	if (fields & 2)
		tvp5150_write(sd, reg + 1, type);

	return type;
}

static int tvp5150_get_vbi(struct v4l2_subdev *sd, int line)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	v4l2_std_id std = decoder->norm;
	u8 reg;
	int pos, type = 0;
	int i, ret = 0;

	if (std == V4L2_STD_ALL) {
		dev_err(sd->dev, "VBI can't be configured without knowing number of lines\n");
		return 0;
	} else if (std & V4L2_STD_625_50) {
		/* Don't follow NTSC Line number convension */
		line += 3;
	}

	if (line < 6 || line > 27)
		return 0;

	reg = ((line - 6) << 1) + TVP5150_LINE_MODE_INI;

	for (i = 0; i <= 1; i++) {
		ret = tvp5150_read(sd, reg + i);
		if (ret < 0) {
			dev_err(sd->dev, "%s: failed with error = %d\n",
				 __func__, ret);
			return 0;
		}
		pos = ret & 0x0f;
		if (pos < ARRAY_SIZE(vbi_ram_default))
			type |= vbi_ram_default[pos].type.vbi_type;
	}

	return type;
}

static int tvp5150_set_std(struct v4l2_subdev *sd, v4l2_std_id std)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	int fmt = 0;

	decoder->norm = std;

	/* First tests should be against specific std */

//DeVdistress
#if(0)
	if (std == V4L2_STD_NTSC_443) {
		fmt = VIDEO_STD_NTSC_4_43_BIT;
	} else if (std == V4L2_STD_PAL_M) {
		fmt = VIDEO_STD_PAL_M_BIT;
	} else if (std == V4L2_STD_PAL_N || std == V4L2_STD_PAL_Nc) {
		fmt = VIDEO_STD_PAL_COMBINATION_N_BIT;
	} else {
		// Then, test against generic ones
		if (std & V4L2_STD_NTSC)
			fmt = VIDEO_STD_NTSC_MJ_BIT;
		else if (std & V4L2_STD_PAL)
			fmt = VIDEO_STD_PAL_BDGHIN_BIT;
		else if (std & V4L2_STD_SECAM)
			fmt = VIDEO_STD_SECAM_BIT;
	}
#else
	fmt = VIDEO_STD_PAL_BDGHIN_BIT;
#endif

	dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt);
	tvp5150_write(sd, TVP5150_VIDEO_STD, fmt);
	return 0;
}

static int tvp5150_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	if (decoder->norm == std)
		return 0;

	/* Change cropping height limits */
	if (std & V4L2_STD_525_60)
		decoder->rect.height = TVP5150_V_MAX_525_60;
	else
		decoder->rect.height = TVP5150_V_MAX_OTHERS;


	return tvp5150_set_std(sd, std);
}

static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	/* Initializes TVP5150 to its default values */
	tvp5150_write_inittab(sd, tvp5150_init_default);

	/* Initializes VDP registers */
	tvp5150_vdp_init(sd);

	/* Selects decoder input */
	tvp5150_selmux(sd);

	/* Initializes TVP5150 to stream enabled values */
	tvp5150_write_inittab(sd, tvp5150_init_enable);

	/* Initialize image preferences */
	v4l2_ctrl_handler_setup(&decoder->hdl);

	tvp5150_set_std(sd, decoder->norm);

	if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
		tvp5150_write(sd, TVP5150_DATA_RATE_SEL, 0x40);

	return 0;
};

static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl)
{
	struct v4l2_subdev *sd = to_sd(ctrl);
	struct tvp5150 *decoder = to_tvp5150(sd);

	switch (ctrl->id) {
	case V4L2_CID_BRIGHTNESS:
		tvp5150_write(sd, TVP5150_BRIGHT_CTL, ctrl->val);
		return 0;
	case V4L2_CID_CONTRAST:
		tvp5150_write(sd, TVP5150_CONTRAST_CTL, ctrl->val);
		return 0;
	case V4L2_CID_SATURATION:
		tvp5150_write(sd, TVP5150_SATURATION_CTL, ctrl->val);
		return 0;
	case V4L2_CID_HUE:
		tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val);
		break;
	case V4L2_CID_TEST_PATTERN:
		decoder->enable = ctrl->val ? false : true;
		tvp5150_selmux(sd);
		return 0;
	}
	return -EINVAL;
}

static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd)
{
	int val = tvp5150_read(sd, TVP5150_STATUS_REG_5);

	switch (val & 0x0F) {
	case 0x01:
		return V4L2_STD_NTSC;
	case 0x03:
		return V4L2_STD_PAL;
	case 0x05:
		return V4L2_STD_PAL_M;
	case 0x07:
		return V4L2_STD_PAL_N | V4L2_STD_PAL_Nc;
	case 0x09:
		return V4L2_STD_NTSC_443;
	case 0xb:
		return V4L2_STD_SECAM;
	default:
		return V4L2_STD_UNKNOWN;
	}
}

static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
		struct v4l2_subdev_pad_config *cfg,
		struct v4l2_subdev_format *format)
{
	struct v4l2_mbus_framefmt *f;
	struct tvp5150 *decoder = to_tvp5150(sd);

	//DeVdistress
#if(0)
	if (!format || (format->pad != DEMOD_PAD_VID_OUT))
		return -EINVAL;
#else
	if (!format || format->pad)
		return -EINVAL;
#endif

	f = &format->format;

	f->width = decoder->rect.width;
	f->height = decoder->rect.height / 2;

	f->code = MEDIA_BUS_FMT_UYVY8_2X8;
	f->field = V4L2_FIELD_ALTERNATE;
	f->colorspace = V4L2_COLORSPACE_SMPTE170M;

	dev_dbg_lvl(sd->dev, 1, debug, "width = %d, height = %d\n", f->width,
			f->height);

	return 0;
}

static int tvp5150_set_selection(struct v4l2_subdev *sd,
				 struct v4l2_subdev_pad_config *cfg,
				 struct v4l2_subdev_selection *sel)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	struct v4l2_rect rect = sel->r;
	v4l2_std_id std;
	int hmax;

	if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE ||
	    sel->target != V4L2_SEL_TGT_CROP)
		return -EINVAL;

	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
		__func__, rect.left, rect.top, rect.width, rect.height);

	/* tvp5150 has some special limits */
	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
	rect.width = clamp_t(unsigned int, rect.width,
			     TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left,
			     TVP5150_H_MAX - rect.left);
	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);

	/* Calculate height based on current standard */
	if (decoder->norm == V4L2_STD_ALL)
		std = tvp5150_read_std(sd);
	else
		std = decoder->norm;

	if (std & V4L2_STD_525_60)
		hmax = TVP5150_V_MAX_525_60;
	else
		hmax = TVP5150_V_MAX_OTHERS;

	rect.height = clamp_t(unsigned int, rect.height,
			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
			      hmax - rect.top);

	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
		      rect.top + rect.height - hmax);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
		      rect.left >> TVP5150_CROP_SHIFT);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
		      rect.left | (1 << TVP5150_CROP_SHIFT));
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
		      TVP5150_CROP_SHIFT);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);

	decoder->rect = rect;

	return 0;
}

static int tvp5150_get_selection(struct v4l2_subdev *sd,
				 struct v4l2_subdev_pad_config *cfg,
				 struct v4l2_subdev_selection *sel)
{
	struct tvp5150 *decoder = container_of(sd, struct tvp5150, sd);
	v4l2_std_id std;

	if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE)
		return -EINVAL;

	switch (sel->target) {
	case V4L2_SEL_TGT_CROP_BOUNDS:
	case V4L2_SEL_TGT_CROP_DEFAULT:
		sel->r.left = 0;
		sel->r.top = 0;
		sel->r.width = TVP5150_H_MAX;

		/* Calculate height based on current standard */
		if (decoder->norm == V4L2_STD_ALL)
			std = tvp5150_read_std(sd);
		else
			std = decoder->norm;
		if (std & V4L2_STD_525_60)
			sel->r.height = TVP5150_V_MAX_525_60;
		else
			sel->r.height = TVP5150_V_MAX_OTHERS;
		return 0;
	case V4L2_SEL_TGT_CROP:
		sel->r = decoder->rect;
		return 0;
	default:
		return -EINVAL;
	}
}

static int tvp5150_g_mbus_config(struct v4l2_subdev *sd,
				 struct v4l2_mbus_config *cfg)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	cfg->type = decoder->mbus_type;
	cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING
		   | V4L2_MBUS_FIELD_EVEN_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH;

	return 0;
}

/****************************************************************************
			V4L2 subdev pad ops
 ****************************************************************************/
static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
		struct v4l2_subdev_pad_config *cfg,
		struct v4l2_subdev_mbus_code_enum *code)
{
	if (code->pad || code->index)
		return -EINVAL;

	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
	return 0;
}

static int tvp5150_enum_frame_size(struct v4l2_subdev *sd,
				   struct v4l2_subdev_pad_config *cfg,
				   struct v4l2_subdev_frame_size_enum *fse)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	if (fse->index >= 8 || fse->code != MEDIA_BUS_FMT_UYVY8_2X8)
		return -EINVAL;

	fse->code = MEDIA_BUS_FMT_UYVY8_2X8;
	fse->min_width = decoder->rect.width;
	fse->max_width = decoder->rect.width;
	fse->min_height = decoder->rect.height / 2;
	fse->max_height = decoder->rect.height / 2;

	return 0;
}

/****************************************************************************
			Media entity ops
 ****************************************************************************/

#ifdef CONFIG_MEDIA_CONTROLLER
static int tvp5150_link_setup(struct media_entity *entity,
			      const struct media_pad *local,
			      const struct media_pad *remote, u32 flags)
{
	struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
	struct tvp5150 *decoder = to_tvp5150(sd);
	int i;

	for (i = 0; i < TVP5150_INPUT_NUM; i++) {
		if (remote->entity == &decoder->input_ent[i])
			break;
	}

	/* Do nothing for entities that are not input connectors */
	if (i == TVP5150_INPUT_NUM)
		return 0;

	decoder->input = i;

	tvp5150_selmux(sd);

	return 0;
}

static const struct media_entity_operations tvp5150_sd_media_ops = {
	.link_setup = tvp5150_link_setup,
};
#endif

/****************************************************************************
			I2C Command
 ****************************************************************************/

static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	int val;

	/* Enable or disable the video output signals. */
	val = tvp5150_read(sd, TVP5150_MISC_CTL);
	if (val < 0)
		return val;

	val &= ~(TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_SYNC_OE |
		 TVP5150_MISC_CTL_CLOCK_OE);

	if (enable) {
		/*
		 * Enable the YCbCr and clock outputs. In discrete sync mode
		 * (non-BT.656) additionally enable the the sync outputs.
		 */
		val |= TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_CLOCK_OE;
		if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
			val |= TVP5150_MISC_CTL_SYNC_OE;
	}

	tvp5150_write(sd, TVP5150_MISC_CTL, val);

	return 0;
}

static int tvp5150_s_routing(struct v4l2_subdev *sd,
			     u32 input, u32 output, u32 config)
{
	struct tvp5150 *decoder = to_tvp5150(sd);

	decoder->input = input;
	decoder->output = output;

	if (output == TVP5150_BLACK_SCREEN)
		decoder->enable = false;
	else
		decoder->enable = true;

	tvp5150_selmux(sd);
	return 0;
}

static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt)
{
	/* this is for capturing 36 raw vbi lines
	   if there's a way to cut off the beginning 2 vbi lines
	   with the tvp5150 then the vbi line count could be lowered
	   to 17 lines/field again, although I couldn't find a register
	   which could do that cropping */
	if (fmt->sample_format == V4L2_PIX_FMT_GREY)
		tvp5150_write(sd, TVP5150_LUMA_PROC_CTL_1, 0x70);
	if (fmt->count[0] == 18 && fmt->count[1] == 18) {
		tvp5150_write(sd, TVP5150_VERT_BLANKING_START, 0x00);
		tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, 0x01);
	}
	return 0;
}

static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
{
	int i;

	if (svbi->service_set != 0) {
		for (i = 0; i <= 23; i++) {
			svbi->service_lines[1][i] = 0;
			svbi->service_lines[0][i] =
				tvp5150_set_vbi(sd, svbi->service_lines[0][i],
						0xf0, i, 3);
		}
		/* Enables FIFO */
		tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 1);
	} else {
		/* Disables FIFO*/
		tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 0);

		/* Disable Full Field */
		tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0);

		/* Disable Line modes */
		for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++)
			tvp5150_write(sd, i, 0xff);
	}
	return 0;
}

static int tvp5150_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
{
	int i, mask = 0;

	memset(svbi->service_lines, 0, sizeof(svbi->service_lines));

	for (i = 0; i <= 23; i++) {
		svbi->service_lines[0][i] =
			tvp5150_get_vbi(sd, i);
		mask |= svbi->service_lines[0][i];
	}
	svbi->service_set = mask;
	return 0;
}

#ifdef CONFIG_VIDEO_ADV_DEBUG
static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
{
	int res;

	res = tvp5150_read(sd, reg->reg & 0xff);
	if (res < 0) {
		dev_err(sd->dev, "%s: failed with error = %d\n", __func__, res);
		return res;
	}

	reg->val = res;
	reg->size = 1;
	return 0;
}

static int tvp5150_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg)
{
	return tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff);
}
#endif

static int tvp5150_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
{
	int status = tvp5150_read(sd, 0x88);

	vt->signal = ((status & 0x04) && (status & 0x02)) ? 0xffff : 0x0;
	return 0;
}

static int tvp5150_registered(struct v4l2_subdev *sd)
{
#ifdef CONFIG_MEDIA_CONTROLLER
	struct tvp5150 *decoder = to_tvp5150(sd);
	int ret = 0;
	int i;

	for (i = 0; i < TVP5150_INPUT_NUM; i++) {
		struct media_entity *input = &decoder->input_ent[i];
		struct media_pad *pad = &decoder->input_pad[i];

		if (!input->name)
			continue;

		decoder->input_pad[i].flags = MEDIA_PAD_FL_SOURCE;

		ret = media_entity_pads_init(input, 1, pad);
		if (ret < 0)
			return ret;

		ret = media_device_register_entity(sd->v4l2_dev->mdev, input);
		if (ret < 0)
			return ret;

		ret = media_create_pad_link(input, 0, &sd->entity,
					    DEMOD_PAD_IF_INPUT, 0);
		if (ret < 0) {
			media_device_unregister_entity(input);
			return ret;
		}
	}
#endif

	return 0;
}

/* ----------------------------------------------------------------------- */

static const struct v4l2_ctrl_ops tvp5150_ctrl_ops = {
	.s_ctrl = tvp5150_s_ctrl,
};

static const struct v4l2_subdev_core_ops tvp5150_core_ops = {
	.log_status = tvp5150_log_status,
	.reset = tvp5150_reset,
#ifdef CONFIG_VIDEO_ADV_DEBUG
	.g_register = tvp5150_g_register,
	.s_register = tvp5150_s_register,
#endif
};

static const struct v4l2_subdev_tuner_ops tvp5150_tuner_ops = {
	.g_tuner = tvp5150_g_tuner,
};

static const struct v4l2_subdev_video_ops tvp5150_video_ops = {
	.s_std = tvp5150_s_std,
	.s_stream = tvp5150_s_stream,
	.s_routing = tvp5150_s_routing,
	.g_mbus_config = tvp5150_g_mbus_config,
};

static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
	.g_sliced_vbi_cap = tvp5150_g_sliced_vbi_cap,
	.g_sliced_fmt = tvp5150_g_sliced_fmt,
	.s_sliced_fmt = tvp5150_s_sliced_fmt,
	.s_raw_fmt = tvp5150_s_raw_fmt,
};

static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = {
	.enum_mbus_code = tvp5150_enum_mbus_code,
	.enum_frame_size = tvp5150_enum_frame_size,
	.set_fmt = tvp5150_fill_fmt,
	.get_fmt = tvp5150_fill_fmt,
	.get_selection = tvp5150_get_selection,
	.set_selection = tvp5150_set_selection,
};

static const struct v4l2_subdev_ops tvp5150_ops = {
	.core = &tvp5150_core_ops,
	.tuner = &tvp5150_tuner_ops,
	.video = &tvp5150_video_ops,
	.vbi = &tvp5150_vbi_ops,
	.pad = &tvp5150_pad_ops,
};

static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = {
	.registered = tvp5150_registered,
};


/****************************************************************************
			I2C Client & Driver
 ****************************************************************************/

static int tvp5150_detect_version(struct tvp5150 *core)
{
	struct v4l2_subdev *sd = &core->sd;
	struct i2c_client *c = v4l2_get_subdevdata(sd);
	unsigned int i;
	u8 regs[4];
	int res;

	/*
	 * Read consequent registers - TVP5150_MSB_DEV_ID, TVP5150_LSB_DEV_ID,
	 * TVP5150_ROM_MAJOR_VER, TVP5150_ROM_MINOR_VER
	 */
	for (i = 0; i < 4; i++) {
		res = tvp5150_read(sd, TVP5150_MSB_DEV_ID + i);
		if (res < 0)
			return res;
		regs[i] = res;
	}

	core->dev_id = (regs[0] << 8) | regs[1];
	core->rom_ver = (regs[2] << 8) | regs[3];

	dev_info(sd->dev, "tvp%04x (%u.%u) chip found @ 0x%02x (%s)\n",
		  core->dev_id, regs[2], regs[3], c->addr << 1,
		  c->adapter->name);

	if (core->dev_id == 0x5150 && core->rom_ver == 0x0321) {
		dev_info(sd->dev, "tvp5150a detected.\n");
	} else if (core->dev_id == 0x5150 && core->rom_ver == 0x0400) {
		dev_info(sd->dev, "tvp5150am1 detected.\n");

		/* ITU-T BT.656.4 timing */
		tvp5150_write(sd, TVP5150_REV_SELECT, 0);
	} else if (core->dev_id == 0x5151 && core->rom_ver == 0x0100) {
		dev_info(sd->dev, "tvp5151 detected.\n");
	} else {
		dev_info(sd->dev, "*** unknown tvp%04x chip detected.\n",
			  core->dev_id);
	}

	return 0;
}

static int tvp5150_init(struct i2c_client *c)
{
	struct gpio_desc *pdn_gpio;
	struct gpio_desc *reset_gpio;

	pdn_gpio = devm_gpiod_get_optional(&c->dev, "pdn", GPIOD_OUT_HIGH);
	if (IS_ERR(pdn_gpio))
		return PTR_ERR(pdn_gpio);

	if (pdn_gpio) {
		gpiod_set_value_cansleep(pdn_gpio, 0);
		/* Delay time between power supplies active and reset */
		msleep(20);
	}

	reset_gpio = devm_gpiod_get_optional(&c->dev, "reset", GPIOD_OUT_HIGH);
	if (IS_ERR(reset_gpio))
		return PTR_ERR(reset_gpio);

	if (reset_gpio) {
		/* RESETB pulse duration */
		ndelay(500);
		gpiod_set_value_cansleep(reset_gpio, 0);
		/* Delay time between end of reset to I2C active */
		usleep_range(200, 250);
	}

	return 0;
}

static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
{
	struct v4l2_fwnode_endpoint bus_cfg;
	struct device_node *ep;
#ifdef CONFIG_MEDIA_CONTROLLER
	struct device_node *connectors, *child;
	struct media_entity *input;
	const char *name;
	u32 input_type;
#endif
	unsigned int flags;
	int ret = 0;

	ep = of_graph_get_next_endpoint(np, NULL);
	if (!ep)
		return -EINVAL;

	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
	if (ret)
		goto err;

	flags = bus_cfg.bus.parallel.flags;

	if (bus_cfg.bus_type == V4L2_MBUS_PARALLEL &&
	    !(flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH &&
	      flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH &&
	      flags & V4L2_MBUS_FIELD_EVEN_LOW)) {
		ret = -EINVAL;
		goto err;
	}

	decoder->mbus_type = bus_cfg.bus_type;

#ifdef CONFIG_MEDIA_CONTROLLER
	connectors = of_get_child_by_name(np, "connectors");

	if (!connectors)
		goto err;

	for_each_available_child_of_node(connectors, child) {
		ret = of_property_read_u32(child, "input", &input_type);
		if (ret) {
			dev_err(decoder->sd.dev,
				 "missing type property in node %s\n",
				 child->name);
			goto err_connector;
		}

		if (input_type >= TVP5150_INPUT_NUM) {
			ret = -EINVAL;
			goto err_connector;
		}

		input = &decoder->input_ent[input_type];

		/* Each input connector can only be defined once */
		if (input->name) {
			dev_err(decoder->sd.dev,
				 "input %s with same type already exists\n",
				 input->name);
			ret = -EINVAL;
			goto err_connector;
		}

		switch (input_type) {
		case TVP5150_COMPOSITE0:
		case TVP5150_COMPOSITE1:
			input->function = MEDIA_ENT_F_CONN_COMPOSITE;
			break;
		case TVP5150_SVIDEO:
			input->function = MEDIA_ENT_F_CONN_SVIDEO;
			break;
		}

		input->flags = MEDIA_ENT_FL_CONNECTOR;

		ret = of_property_read_string(child, "label", &name);
		if (ret < 0) {
			dev_err(decoder->sd.dev,
				 "missing label property in node %s\n",
				 child->name);
			goto err_connector;
		}

		input->name = name;
	}

err_connector:
	of_node_put(connectors);
#endif
err:
	of_node_put(ep);
	return ret;
}

static const char * const tvp5150_test_patterns[2] = {
	"Disabled",
	"Black screen"
};

//DeVdistress
void tvp5150_my_set_selection(struct v4l2_subdev *sd, struct v4l2_rect *sel)
{
	struct tvp5150 *decoder = to_tvp5150(sd);
	struct v4l2_rect rect;
	v4l2_std_id std;
	int hmax;

	memcpy(&rect, sel, sizeof(rect));

	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
		__func__, rect.left, rect.top, rect.width, rect.height);

	/* tvp5150 has some special limits */
	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
	rect.width = clamp_t(unsigned int, rect.width,
			     (TVP5150_H_MAX + rect.left)- TVP5150_MAX_CROP_LEFT - rect.left,
				 (TVP5150_H_MAX + rect.left) - rect.left);
	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);

	/* Calculate height based on current standard */
	if (decoder->norm == V4L2_STD_ALL)
		std = tvp5150_read_std(sd);
	else
		std = decoder->norm;

	if (std & V4L2_STD_525_60)
		hmax = TVP5150_V_MAX_525_60 + rect.top; //было без rect.top
	else
		hmax = TVP5150_V_MAX_OTHERS + rect.top; //было без rect.top

	rect.height = clamp_t(unsigned int, rect.height,
			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
			      hmax - rect.top);

	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
		      rect.top + rect.height - hmax);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
		      rect.left >> TVP5150_CROP_SHIFT);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
		      rect.left | (1 << TVP5150_CROP_SHIFT));
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
		      TVP5150_CROP_SHIFT);
	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);

	//decoder->rect = rect;
}

static int tvp5150_probe(struct i2c_client *c,
			 const struct i2c_device_id *id)
{
	struct tvp5150 *core;
	struct v4l2_subdev *sd;
	struct device_node *np = c->dev.of_node;
	int res;

#if(0)//DeVdistress
	struct v4l2_rect sel;
#endif

	/* Check if the adapter supports the needed features */
	if (!i2c_check_functionality(c->adapter,
	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
		return -EIO;

	res = tvp5150_init(c);
	if (res)
		return res;

	core = devm_kzalloc(&c->dev, sizeof(*core), GFP_KERNEL);
	if (!core)
		return -ENOMEM;

	sd = &core->sd;

	if (IS_ENABLED(CONFIG_OF) && np) {
		res = tvp5150_parse_dt(core, np);
		if (res) {
			dev_err(sd->dev, "DT parsing error: %d\n", res);
			return res;
		}
	} else {
		/* Default to BT.656 embedded sync */
		core->mbus_type = V4L2_MBUS_BT656;
	}

	//DeVdistress
	#if(0)
	#else
		core->mbus_type = V4L2_MBUS_BT656;
	#endif

	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
	sd->internal_ops = &tvp5150_internal_ops;
	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;

#if defined(CONFIG_MEDIA_CONTROLLER)
	core->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
	core->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
	core->pads[DEMOD_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;

	sd->entity.function = MEDIA_ENT_F_ATV_DECODER;

	res = media_entity_pads_init(&sd->entity, DEMOD_NUM_PADS, core->pads);
	if (res < 0)
		return res;

	sd->entity.ops = &tvp5150_sd_media_ops;
#endif

	res = tvp5150_detect_version(core);
	if (res < 0)
		return res;

//DeVdistress
#if(0)
	core->norm = V4L2_STD_ALL;	// Default is autodetect
	core->input = TVP5150_COMPOSITE1;
#else
	core->norm = V4L2_STD_ALL;	// Default is autodetect
	core->input = TVP5150_COMPOSITE0;
#endif

	core->enable = true;

	v4l2_ctrl_handler_init(&core->hdl, 5);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_CONTRAST, 0, 255, 1, 128);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_SATURATION, 0, 255, 1, 128);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_HUE, -128, 127, 1, 0);
	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
			V4L2_CID_PIXEL_RATE, 27000000,
			27000000, 1, 27000000);
	v4l2_ctrl_new_std_menu_items(&core->hdl, &tvp5150_ctrl_ops,
				     V4L2_CID_TEST_PATTERN,
				     ARRAY_SIZE(tvp5150_test_patterns),
				     0, 0, tvp5150_test_patterns);
	sd->ctrl_handler = &core->hdl;
	if (core->hdl.error) {
		res = core->hdl.error;
		goto err;
	}

	/* Default is no cropping */
	core->rect.top = 0;
	if (tvp5150_read_std(sd) & V4L2_STD_525_60)
		core->rect.height = TVP5150_V_MAX_525_60;
	else
		core->rect.height = TVP5150_V_MAX_OTHERS;
	core->rect.left = 0;
	core->rect.width = TVP5150_H_MAX;

	tvp5150_reset(sd, 0);	/* Calls v4l2_ctrl_handler_setup() */

#if(0)//DeVdistress
	sel.left   = core->rect.left   + 100;
	sel.top    = core->rect.top    + 50;
	sel.width  = core->rect.width  + 100;
	sel.height = core->rect.height + 50;
	tvp5150_my_set_selection(sd, &sel);
#endif

	res = v4l2_async_register_subdev(sd);
	if (res < 0)
		goto err;

	if (debug > 1)
		tvp5150_log_status(sd);
	return 0;

err:
	v4l2_ctrl_handler_free(&core->hdl);
	return res;
}

static int tvp5150_remove(struct i2c_client *c)
{
	struct v4l2_subdev *sd = i2c_get_clientdata(c);
	struct tvp5150 *decoder = to_tvp5150(sd);

	dev_dbg_lvl(sd->dev, 1, debug,
		"tvp5150.c: removing tvp5150 adapter on address 0x%x\n",
		c->addr << 1);

	v4l2_async_unregister_subdev(sd);
	v4l2_ctrl_handler_free(&decoder->hdl);
	return 0;
}

/* ----------------------------------------------------------------------- */

static const struct i2c_device_id tvp5150_id[] = {
	{ "tvp5150", 0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, tvp5150_id);

#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id tvp5150_of_match[] = {
	{ .compatible = "ti,tvp5150", },
	{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, tvp5150_of_match);
#endif

static struct i2c_driver tvp5150_driver = {
	.driver = {
		.of_match_table = of_match_ptr(tvp5150_of_match),
		.name	= "tvp5150",
	},
	.probe		= tvp5150_probe,
	.remove		= tvp5150_remove,
	.id_table	= tvp5150_id,
};

module_i2c_driver(tvp5150_driver);

 mux_data.h (for Uboot)5618.mux_data.h

 patch.mux_data.hpatch.mux_data.h

 patch.tvp5150.c

patch.tvp5150.c
--- tvp5150.c~original	2019-02-08 11:41:07.329365976 +0300
+++ tvp5150.c	2019-02-15 11:02:57.074649054 +0300
@@ -21,21 +21,25 @@
 
 #include "tvp5150_reg.h"
 
-#define TVP5150_H_MAX		720U
+#define TVP5150_H_MAX			720U
 #define TVP5150_V_MAX_525_60	480U
 #define TVP5150_V_MAX_OTHERS	576U
 #define TVP5150_MAX_CROP_LEFT	511
 #define TVP5150_MAX_CROP_TOP	127
-#define TVP5150_CROP_SHIFT	2
+#define TVP5150_CROP_SHIFT		2
 
 MODULE_DESCRIPTION("Texas Instruments TVP5150A/TVP5150AM1/TVP5151 video decoder driver");
 MODULE_AUTHOR("Mauro Carvalho Chehab");
 MODULE_LICENSE("GPL");
 
-
-static int debug;
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Debug level (0-2)");
+//DeVdistress
+#if(0)
+	static int debug;
+	module_param(debug, int, 0644);
+	MODULE_PARM_DESC(debug, "Debug level (0-2)");
+#else
+	static int debug = 2;
+#endif
 
 #define dprintk0(__dev, __arg...) dev_dbg_lvl(__dev, 0, 0, __arg)
 
@@ -273,6 +277,8 @@
 			input = 8;
 	}
 
+//DeVdistress
+#if(1)
 	switch (decoder->input) {
 	case TVP5150_COMPOSITE1:
 		input |= 2;
@@ -284,6 +290,7 @@
 		input |= 1;
 		break;
 	}
+#endif
 
 	dev_dbg_lvl(sd->dev, 1, debug, "Selecting video route: route input=%i, output=%i => tvp5150 input=%i, opmode=%i\n",
 			decoder->input, decoder->output,
@@ -463,7 +470,9 @@
 		TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
 				  TVP5150_MISC_CTL_INTREQ_OE |
 				  TVP5150_MISC_CTL_YCBCR_OE |
+#if(0) //DeVdistress
 				  TVP5150_MISC_CTL_SYNC_OE |
+#endif
 				  TVP5150_MISC_CTL_VBLANK |
 				  TVP5150_MISC_CTL_CLOCK_OE,
 	},{	/* Activates video std autodetection for all standards */
@@ -745,6 +754,8 @@
 
 	/* First tests should be against specific std */
 
+//DeVdistress
+#if(0)
 	if (std == V4L2_STD_NTSC_443) {
 		fmt = VIDEO_STD_NTSC_4_43_BIT;
 	} else if (std == V4L2_STD_PAL_M) {
@@ -752,7 +763,7 @@
 	} else if (std == V4L2_STD_PAL_N || std == V4L2_STD_PAL_Nc) {
 		fmt = VIDEO_STD_PAL_COMBINATION_N_BIT;
 	} else {
-		/* Then, test against generic ones */
+		// Then, test against generic ones
 		if (std & V4L2_STD_NTSC)
 			fmt = VIDEO_STD_NTSC_MJ_BIT;
 		else if (std & V4L2_STD_PAL)
@@ -760,6 +771,9 @@
 		else if (std & V4L2_STD_SECAM)
 			fmt = VIDEO_STD_SECAM_BIT;
 	}
+#else
+	fmt = VIDEO_STD_PAL_BDGHIN_BIT;
+#endif
 
 	dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt);
 	tvp5150_write(sd, TVP5150_VIDEO_STD, fmt);
@@ -865,8 +879,14 @@
 	struct v4l2_mbus_framefmt *f;
 	struct tvp5150 *decoder = to_tvp5150(sd);
 
+	//DeVdistress
+#if(0)
 	if (!format || (format->pad != DEMOD_PAD_VID_OUT))
 		return -EINVAL;
+#else
+	if (!format || format->pad)
+		return -EINVAL;
+#endif
 
 	f = &format->format;
 
@@ -879,6 +899,7 @@
 
 	dev_dbg_lvl(sd->dev, 1, debug, "width = %d, height = %d\n", f->width,
 			f->height);
+
 	return 0;
 }
 
@@ -1456,6 +1477,57 @@
 	"Black screen"
 };
 
+//DeVdistress
+void tvp5150_my_set_selection(struct v4l2_subdev *sd, struct v4l2_rect *sel)
+{
+	struct tvp5150 *decoder = to_tvp5150(sd);
+	struct v4l2_rect rect;
+	v4l2_std_id std;
+	int hmax;
+
+	memcpy(&rect, sel, sizeof(rect));
+
+	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
+		__func__, rect.left, rect.top, rect.width, rect.height);
+
+	/* tvp5150 has some special limits */
+	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
+	rect.width = clamp_t(unsigned int, rect.width,
+			     (TVP5150_H_MAX + rect.left)- TVP5150_MAX_CROP_LEFT - rect.left,
+				 (TVP5150_H_MAX + rect.left) - rect.left);
+	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
+
+	/* Calculate height based on current standard */
+	if (decoder->norm == V4L2_STD_ALL)
+		std = tvp5150_read_std(sd);
+	else
+		std = decoder->norm;
+
+	if (std & V4L2_STD_525_60)
+		hmax = TVP5150_V_MAX_525_60 + rect.top; //было без rect.top
+	else
+		hmax = TVP5150_V_MAX_OTHERS + rect.top; //было без rect.top
+
+	rect.height = clamp_t(unsigned int, rect.height,
+			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
+			      hmax - rect.top);
+
+	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
+	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
+		      rect.top + rect.height - hmax);
+	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
+		      rect.left >> TVP5150_CROP_SHIFT);
+	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
+		      rect.left | (1 << TVP5150_CROP_SHIFT));
+	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
+		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
+		      TVP5150_CROP_SHIFT);
+	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
+		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);
+
+	//decoder->rect = rect;
+}
+
 static int tvp5150_probe(struct i2c_client *c,
 			 const struct i2c_device_id *id)
 {
@@ -1464,6 +1536,10 @@
 	struct device_node *np = c->dev.of_node;
 	int res;
 
+#if(0)//DeVdistress
+	struct v4l2_rect sel;
+#endif
+
 	/* Check if the adapter supports the needed features */
 	if (!i2c_check_functionality(c->adapter,
 	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
@@ -1490,6 +1566,12 @@
 		core->mbus_type = V4L2_MBUS_BT656;
 	}
 
+	//DeVdistress
+	#if(0)
+	#else
+		core->mbus_type = V4L2_MBUS_BT656;
+	#endif
+
 	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
 	sd->internal_ops = &tvp5150_internal_ops;
 	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
@@ -1512,8 +1594,15 @@
 	if (res < 0)
 		return res;
 
-	core->norm = V4L2_STD_ALL;	/* Default is autodetect */
+//DeVdistress
+#if(0)
+	core->norm = V4L2_STD_ALL;	// Default is autodetect
 	core->input = TVP5150_COMPOSITE1;
+#else
+	core->norm = V4L2_STD_ALL;	// Default is autodetect
+	core->input = TVP5150_COMPOSITE0;
+#endif
+
 	core->enable = true;
 
 	v4l2_ctrl_handler_init(&core->hdl, 5);
@@ -1549,6 +1638,14 @@
 
 	tvp5150_reset(sd, 0);	/* Calls v4l2_ctrl_handler_setup() */
 
+#if(0)//DeVdistress
+	sel.left   = core->rect.left   + 100;
+	sel.top    = core->rect.top    + 50;
+	sel.width  = core->rect.width  + 100;
+	sel.height = core->rect.height + 50;
+	tvp5150_my_set_selection(sd, &sel);
+#endif
+
 	res = v4l2_async_register_subdev(sd);
 	if (res < 0)
 		goto err;

 patch.vip.cvip.c

B3. Loaded linux:

proccess_of_loading_from_sd.log

process_of_loading_from_sd.log
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2019.02.14 15:27:27 =~=~=~=~=~=~=~=~=~=~=~=

U-Boot SPL 2018.01-00558-gca1e85e-dirty (Jan 17 2019 - 11:21:07)
DRA752-GP ES2.0
Trying to boot from MMC1
no pinctrl state for default mode
no pinctrl state for default mode


U-Boot 2018.01-00558-gca1e85e-dirty (Jan 17 2019 - 11:21:07 +0300)

CPU  : DRA752-GP ES2.0
Model: TI AM5728 BeagleBoard-X15
Board: AM572x EVM REV A.3A
DRAM:  2 GiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
part_get_info_efi: *** ERROR: Invalid GPT ***
GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
SCSI:  SATA link 0 timeout.
AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: 64bit ncq stag pm led clo only pmp pio slum part ccc apst 
scanning bus for devices...
Found 0 device(s).
Net:   
Warning: ethernet@48484000 using MAC address from ROM
eth0: ethernet@48484000
Hit any key to stop autoboot:  2  1  0 
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** Unable to read file boot.scr **
1554 bytes read in 2 ms (758.8 KiB/s)
Loaded env from uEnv.txt
Importing environment from mmc0 ...
Running uenvcmd ...
1 bytes read in 2 ms (0 Bytes/s)
Already setup.
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
4026880 bytes read in 278 ms (13.8 MiB/s)
148397 bytes read in 125 ms (1.1 MiB/s)
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8ffd8000, end 8ffff3ac ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.79-gbde58ab01e (oe-user@oe-host) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #1 SMP PREEMPT Thu Dec 20 04:51:24 UTC 2018
[    0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=30c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: TI AM5728 EVM
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000095800000, size 56 MiB
[    0.000000] OF: reserved mem: initialized node ipu2-memory@95800000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000099000000, size 64 MiB
[    0.000000] OF: reserved mem: initialized node dsp1-memory@99000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009d000000, size 32 MiB
[    0.000000] OF: reserved mem: initialized node ipu1-memory@9d000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009f000000, size 8 MiB
[    0.000000] OF: reserved mem: initialized node dsp2-memory@9f000000, compatible id shared-dma-pool
[    0.000000] cma: Reserved 24 MiB at 0x00000000fe400000
[    0.000000] OMAP4: Map 0x00000000ffd00000 to fe600000 for dram barrier
[    0.000000] DRA752 ES2.0
[    0.000000] percpu: Embedded 15 pages/cpu @eed28000 s31372 r8192 d21876 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 472640
[    0.000000] Kernel command line: console=ttyO2,115200n8 root=PARTUUID=faacbb33-02 rw rootfstype=ext4 rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 1675568K/1897472K available (8192K kernel code, 347K rwdata, 2628K rodata, 2048K init, 282K bss, 33488K reserved, 188416K cma-reserved, 1283072K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0a00000   (10208 kB)
[    0.000000]       .init : 0xc0e00000 - 0xc1000000   (2048 kB)
[    0.000000]       .data : 0xc1000000 - 0xc1056e98   ( 348 kB)
[    0.000000]        .bss : 0xc1058000 - 0xc109ebe0   ( 283 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	Tasks RCU enabled.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] OMAP clockevent source: timer1 at 32786 Hz
[    0.000000] arch_timer: cp15 timer(s) running at 6.14MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x16af5adb9, max_idle_ns: 440795202250 ns
[    0.000004] sched_clock: 56 bits at 6MHz, resolution 162ns, wraps every 4398046511023ns
[    0.000016] Switching to timer-based delay loop, resolution 162ns
[    0.000352] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 58327039986419 ns
[    0.000361] OMAP clocksource: 32k_counter at 32768 Hz
[    0.000874] Console: colour dummy device 80x30
[    0.000892] WARNING: Your 'console=ttyO2' has been replaced by 'ttyS2'
[    0.000899] This ensures that you still see kernel messages. Please
[    0.000906] update your kernel commandline.
[    0.000927] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.29 BogoMIPS (lpj=61475)
[    0.000942] pid_max: default: 32768 minimum: 301
[    0.001057] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001072] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001602] CPU: Testing write buffer coherency: ok
[    0.001639] CPU0: Spectre v2: using ICIALLU workaround
[    0.001837] /cpus/cpu@0 missing clock-frequency property
[    0.001857] /cpus/cpu@1 missing clock-frequency property
[    0.001869] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.039849] Setting up static identity map for 0x80200000 - 0x80200060
[    0.059858] Hierarchical SRCU implementation.
[    0.080049] EFI services will not be available.
[    0.099917] smp: Bringing up secondary CPUs ...
[    0.170292] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.170298] CPU1: Spectre v2: using ICIALLU workaround
[    0.170397] smp: Brought up 1 node, 2 CPUs
[    0.170409] SMP: Total of 2 processors activated (24.59 BogoMIPS).
[    0.170417] CPU: All CPU(s) started in HYP mode.
[    0.170424] CPU: Virtualization extensions available.
[    0.170958] devtmpfs: initialized
[    0.191832] random: get_random_u32 called from bucket_table_alloc+0x108/0x230 with crng_init=0
[    0.192085] VFP support v0.3: implementor 41 architecture 4 part 30 variant f rev 0
[    0.192279] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.192296] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.196048] pinctrl core: initialized pinctrl subsystem
[    0.196504] DMI not present or invalid.
[    0.196759] NET: Registered protocol family 16
[    0.197796] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.198742] omap_hwmod: l3_main_2 using broken dt data from ocp
[    0.309107] omap_hwmod: dcan1: _wait_target_disable failed
[    0.315567] omap_hwmod: dcan2: _wait_target_disable failed
[    0.408711] cpuidle: using governor ladder
[    0.408743] cpuidle: using governor menu
[    0.417458] OMAP GPIO hardware version 0.1
[    0.419477] GPIO line 113 (reset-gpios_gpio4_17) hogged as output/high
[    0.420956] GPIO line 171 (cm-camen-gpio) hogged as output/high
[    0.446728] No ATAGs?
[    0.446803] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.446818] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.447227] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[    0.447237] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[    0.447770] OMAP DMA hardware revision 0.0
[    0.457584] edma 43300000.edma: memcpy is disabled
[    0.460829] edma 43300000.edma: TI EDMA DMA engine driver
[    0.467575] omap-dma-engine 4a056000.dma-controller: OMAP DMA engine driver (LinkedList1/2/3 supported)
[    0.468901] evm_5v0: supplied by main_12v0
[    0.469321] com_3v6: supplied by evm_5v0
[    0.472417] omap-iommu 40d01000.mmu: 40d01000.mmu registered
[    0.472614] omap-iommu 40d02000.mmu: 40d02000.mmu registered
[    0.472846] omap-iommu 58882000.mmu: 58882000.mmu registered
[    0.473086] omap-iommu 55082000.mmu: 55082000.mmu registered
[    0.473451] omap-iommu 41501000.mmu: 41501000.mmu registered
[    0.473654] omap-iommu 41502000.mmu: 41502000.mmu registered
[    0.473915] iommu: Adding device 58820000.ipu to group 1
[    0.474003] iommu: Adding device 55020000.ipu to group 2
[    0.474167] iommu: Adding device 40800000.dsp to group 0
[    0.474441] iommu: Adding device 41000000.dsp to group 3
[    0.476867] palmas 0-0058: Irq flag is 0x00000008
[    0.501922] palmas 0-0058: Muxing GPIO 2d, PWM 0, LED 0
[    0.503425] SMPS12: supplied by regulator-dummy
[    0.505122] SMPS3: supplied by regulator-dummy
[    0.506783] SMPS45: supplied by regulator-dummy
[    0.508609] SMPS6: supplied by regulator-dummy
[    0.510038] SMPS7: supplied by regulator-dummy
[    0.511458] SMPS8: supplied by regulator-dummy
[    0.512751] SMPS9: supplied by regulator-dummy
[    0.513472] LDO1: supplied by regulator-dummy
[    0.521320] LDO2: supplied by regulator-dummy
[    0.531057] random: fast init done
[    0.531202] LDO3: supplied by regulator-dummy
[    0.541221] LDO4: supplied by regulator-dummy
[    0.551224] LDO5: supplied by regulator-dummy
[    0.551968] LDO6: supplied by regulator-dummy
[    0.552704] LDO7: supplied by regulator-dummy
[    0.553438] LDO8: supplied by regulator-dummy
[    0.554178] LDO9: supplied by regulator-dummy
[    0.561254] LDOLN: supplied by regulator-dummy
[    0.571280] LDOUSB: supplied by regulator-dummy
[    0.583965] omap_i2c 48070000.i2c: bus 0 rev0.12 at 400 kHz
[    0.584528] omap_i2c 48060000.i2c: bus 2 rev0.12 at 400 kHz
[    0.585152] omap_i2c 4807c000.i2c: bus 4 rev0.12 at 400 kHz
[    0.585353] media: Linux media interface: v0.10
[    0.585390] Linux video capture interface: v2.00
[    0.585467] pps_core: LinuxPPS API ver. 1 registered
[    0.585476] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.585496] PTP clock support registered
[    0.585524] EDAC MC: Ver: 3.0.0
[    0.590715] dmi: Firmware registration failed.
[    0.591117] omap-mailbox 48840000.mailbox: omap mailbox rev 0x400
[    0.591395] omap-mailbox 48842000.mailbox: omap mailbox rev 0x400
[    0.591744] Advanced Linux Sound Architecture Driver Initialized.
[    0.600783] clocksource: Switched to clocksource arch_sys_counter
[    0.608651] NET: Registered protocol family 2
[    0.609173] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.609237] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.609363] TCP: Hash tables configured (established 8192 bind 8192)
[    0.609431] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.609467] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.609589] NET: Registered protocol family 1
[    0.609878] RPC: Registered named UNIX socket transport module.
[    0.609887] RPC: Registered udp transport module.
[    0.609895] RPC: Registered tcp transport module.
[    0.609902] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.610896] hw perfevents: no interrupt-affinity property for /pmu, guessing.
[    0.611071] hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters available
[    0.612087] workingset: timestamp_bits=14 max_order=19 bucket_order=5
[    0.616120] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.616597] NFS: Registering the id_resolver key type
[    0.616628] Key type id_resolver registered
[    0.616636] Key type id_legacy registered
[    0.616677] ntfs: driver 2.1.32 [Flags: R/O].
[    0.617974] bounce: pool size: 64 pages
[    0.618022] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    0.618032] io scheduler noop registered
[    0.618041] io scheduler deadline registered
[    0.618136] io scheduler cfq registered (default)
[    0.618146] io scheduler mq-deadline registered
[    0.618155] io scheduler kyber registered
[    0.622710] pinctrl-single 4a003400.pinmux: 282 pins at pa fc003400 size 1128
[    0.626096] dra7-pcie 51000000.pcie: Linked as a consumer to phy-4a094000.pciephy.1
[    0.626462] OF: PCI: host bridge /ocp/axi@0/pcie@51000000 ranges:
[    0.626496] OF: PCI:    IO 0x20003000..0x20012fff -> 0x00000000
[    0.626518] OF: PCI:   MEM 0x20013000..0x2fffffff -> 0x20013000
[    1.626784] dra7-pcie 51000000.pcie: phy link never came up
[    1.626915] dra7-pcie 51000000.pcie: PCI host bridge to bus 0000:00
[    1.626929] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.626940] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    1.626954] pci_bus 0000:00: root bus resource [mem 0x20013000-0x2fffffff]
[    1.627267] PCI: bus0: Fast back to back transfers disabled
[    1.627355] PCI: bus1: Fast back to back transfers enabled
[    1.627392] pci 0000:00:00.0: BAR 0: assigned [mem 0x20100000-0x201fffff 64bit]
[    1.627410] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    1.627720] pcieport 0000:00:00.0: Signaling PME with IRQ 176
[    1.627844] pcieport 0000:00:00.0: AER enabled with IRQ 176
[    1.628735] pwm-backlight backlight: backlight supply power not found, using dummy regulator
[    1.631565] vdd_3v3: supplied by regen1
[    1.631827] aic_dvdd_fixed: supplied by vdd_3v3
[    1.631902] vtt_fixed: supplied by smps3
[    1.674163] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
[    1.676844] 48020000.serial: ttyS2 at MMIO 0x48020000 (irq = 45, base_baud = 3000000) is a 8250
[    2.801998] console [ttyS2] enabled
[    2.806327] 48422000.serial: ttyS7 at MMIO 0x48422000 (irq = 46, base_baud = 3000000) is a 8250
[    2.817033] omap_rng 48090000.rng: Random Number Generator ver. 20
[    2.824181] DSS: OMAP DSS rev 6.1
[    2.829209] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops)
[    2.837650] omapdss_dss 58000000.dss: bound 58040000.encoder (ops hdmi5_component_ops)
[    2.848094] panel-dpi display: display supply vcc not found, using dummy regulator
[    2.866214] brd: module loaded
[    2.874683] loop: module loaded
[    2.881004] libphy: Fixed MDIO Bus: probed
[    2.940815] davinci_mdio 48485000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    2.948511] libphy: 48485000.mdio: probed
[    2.957470] davinci_mdio 48485000.mdio: phy[1]: device 48485000.mdio:01, driver Micrel KSZ9031 Gigabit PHY
[    2.967215] davinci_mdio 48485000.mdio: phy[2]: device 48485000.mdio:02, driver Micrel KSZ9031 Gigabit PHY
[    2.977502] cpsw 48484000.ethernet: Detected MACID = fc:0f:4b:ab:69:6e
[    2.984145] cpsw 48484000.ethernet: initialized cpsw ale version 1.4
[    2.990527] cpsw 48484000.ethernet: ALE Table size 1024
[    2.995828] cpsw 48484000.ethernet: device node lookup for pps timer failed
[    3.002879] cpsw 48484000.ethernet: cpts: overflow check period 500 (jiffies)
[    3.010742] cpsw 48484000.ethernet: cpsw: Detected MACID = fc:0f:4b:ab:69:6f
[    3.018981] i2c /dev entries driver
[    3.023458] IR NEC protocol handler initialized
[    3.028009] IR RC5(x/sz) protocol handler initialized
[    3.033108] IR RC6 protocol handler initialized
[    3.037658] IR JVC protocol handler initialized
[    3.042226] IR Sony protocol handler initialized
[    3.046862] IR SANYO protocol handler initialized
[    3.051657] IR Sharp protocol handler initialized
[    3.056380] IR MCE Keyboard/mouse protocol handler initialized
[    3.062253] IR XMP protocol handler initialized
[    3.069122] gpio-fan gpio_fan: GPIO fan initialized
[    3.075255] tmp102 0-0048: initialized
[    3.083318] sdhci: Secure Digital Host Controller Interface driver
[    3.089527] sdhci: Copyright(c) Pierre Ossman
[    3.094933] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.101250] sdhci-omap 4809c000.mmc: Got CD GPIO
[    3.106052] sdhci-omap 4809c000.mmc: 4809c000.mmc supply vqmmc not found, using dummy regulator
[    3.115213] sdhci-omap 4809c000.mmc: no pinctrl state for ddr_1_8v mode
[    3.181014] mmc0: SDHCI controller on 4809c000.mmc [4809c000.mmc] using ADMA
[    3.237960] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.249830] mmc0: new high speed SDHC card at address b368
[    3.255377] mmc1: SDHCI controller on 480b4000.mmc [480b4000.mmc] using ADMA
[    3.263442] mmcblk0: mmc0:b368 USD   14.9 GiB 
[    3.270610]  mmcblk0: p1 p2
[    3.276013] sdhci-omap 480ad000.mmc: no pinctrl state for sdr104 mode
[    3.282600] sdhci-omap 480ad000.mmc: no pinctrl state for ddr50 mode
[    3.289062] sdhci-omap 480ad000.mmc: no pinctrl state for hs200_1_8v mode
[    3.350826] mmc2: SDHCI controller on 480ad000.mmc [480ad000.mmc] using PIO
[    3.362346] ledtrig-cpu: registered to indicate activity on CPUs
[    3.362758] ti-iodelay 4844a000.padconf: Set reg 0x18c Delay(a: 0 g: 120), Elements(C=0 F=2)0x29002
[    3.362766] ti-iodelay 4844a000.padconf: Set reg 0x190 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362774] ti-iodelay 4844a000.padconf: Set reg 0x194 Delay(a: 174 g: 0), Elements(C=0 F=4)0x29004
[    3.362781] ti-iodelay 4844a000.padconf: Set reg 0x1a4 Delay(a: 265 g: 360), Elements(C=0 F=13)0x2900d
[    3.362788] ti-iodelay 4844a000.padconf: Set reg 0x1a8 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362794] ti-iodelay 4844a000.padconf: Set reg 0x1ac Delay(a: 168 g: 0), Elements(C=0 F=4)0x29004
[    3.362801] ti-iodelay 4844a000.padconf: Set reg 0x1b0 Delay(a: 0 g: 120), Elements(C=0 F=2)0x29002
[    3.362807] ti-iodelay 4844a000.padconf: Set reg 0x1b4 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362814] ti-iodelay 4844a000.padconf: Set reg 0x1b8 Delay(a: 136 g: 0), Elements(C=0 F=3)0x29003
[    3.362820] ti-iodelay 4844a000.padconf: Set reg 0x1bc Delay(a: 0 g: 120), Elements(C=0 F=2)0x29002
[    3.362827] ti-iodelay 4844a000.padconf: Set reg 0x1c0 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362833] ti-iodelay 4844a000.padconf: Set reg 0x1c4 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362839] ti-iodelay 4844a000.padconf: Set reg 0x1c8 Delay(a: 287 g: 420), Elements(C=0 F=14)0x2900e
[    3.362846] ti-iodelay 4844a000.padconf: Set reg 0x1d0 Delay(a: 879 g: 0), Elements(C=1 F=10)0x2902a
[    3.362852] ti-iodelay 4844a000.padconf: Set reg 0x1d4 Delay(a: 144 g: 240), Elements(C=0 F=8)0x29008
[    3.362859] ti-iodelay 4844a000.padconf: Set reg 0x1d8 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362865] ti-iodelay 4844a000.padconf: Set reg 0x1dc Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362872] ti-iodelay 4844a000.padconf: Set reg 0x1e0 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362878] ti-iodelay 4844a000.padconf: Set reg 0x1e4 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362885] ti-iodelay 4844a000.padconf: Set reg 0x1e8 Delay(a: 34 g: 0), Elements(C=0 F=0)0x29000
[    3.362891] ti-iodelay 4844a000.padconf: Set reg 0x1ec Delay(a: 0 g: 120), Elements(C=0 F=2)0x29002
[    3.362897] ti-iodelay 4844a000.padconf: Set reg 0x1f0 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362904] ti-iodelay 4844a000.padconf: Set reg 0x1f4 Delay(a: 120 g: 0), Elements(C=0 F=3)0x29003
[    3.362910] ti-iodelay 4844a000.padconf: Set reg 0x1f8 Delay(a: 120 g: 180), Elements(C=0 F=6)0x29006
[    3.362916] ti-iodelay 4844a000.padconf: Set reg 0x1fc Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362922] ti-iodelay 4844a000.padconf: Set reg 0x200 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362928] ti-iodelay 4844a000.padconf: Set reg 0x360 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362934] ti-iodelay 4844a000.padconf: Set reg 0x364 Delay(a: 0 g: 0), Elements(C=0 F=0)0x29000
[    3.362941] ti-iodelay 4844a000.padconf: Set reg 0x368 Delay(a: 11 g: 0), Elements(C=0 F=0)0x29000
[    3.364240] mmc1: new DDR MMC card at address 0001
[    3.364515] mmcblk1: mmc1:0001 S10004 3.56 GiB 
[    3.377516] mmcblk1boot0: mmc1:0001 S10004 partition 1 4.00 MiB
[    3.377648] mmcblk1boot1: mmc1:0001 S10004 partition 2 4.00 MiB
[    3.377801] mmcblk1rpmb: mmc1:0001 S10004 partition 3 4.00 MiB
[    3.378455]  mmcblk1: p1 p2 p3
[    3.664444] NET: Registered protocol family 10
[    3.669480] Segment Routing with IPv6
[    3.673210] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    3.679454] NET: Registered protocol family 17
[    3.684068] Key type dns_resolver registered
[    3.688434] omap_voltage_late_init: Voltage driver support not added
[    3.694830] Power Management for TI OMAP4+ devices.
[    3.699908] Registering SWP/SWPB emulation handler
[    3.713251] dmm 4e000000.dmm: workaround for errata i878 in use
[    3.720475] dmm 4e000000.dmm: initialized all PAT entries
[    3.752312] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    3.758957] [drm] No driver support for vblank timestamp query.
[    3.767452] [drm] Enabling DMM ywrap scrolling
[    3.841498] Console: switching to colour frame buffer device 100x30
[    3.850604] omapdrm omapdrm.0: fb0: omapdrm frame buffer device
[    3.857967] [drm] Initialized omapdrm 1.0.0 20110917 for omapdrm.0 on minor 0
[    3.866219] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[    3.873372] hctosys: unable to open rtc device (rtc0)
[    3.879061] aic_dvdd_fixed: disabling
[    3.883231] ldousb: disabling
[    3.886773] ALSA device list:
[    3.889766]   No soundcards found.
[    3.916482] EXT4-fs (mmcblk0p2): warning: mounting fs with errors, running e2fsck is recommended
[    3.928354] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.936527] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    3.946570] devtmpfs: mounted
[    3.950413] Freeing unused kernel memory: 2048K
[    4.363809] systemd[1]: System time before build time, advancing clock.
[    4.426624] systemd[1]: systemd 234 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 -IDN default-hierarchy=hybrid)
[    4.448514] systemd[1]: Detected architecture arm.

Welcome to Arago 2018.10!

[    4.492304] systemd[1]: Set hostname to <am57xx-evm>.
[    4.925640] random: systemd: uninitialized urandom read (16 bytes read)
[    4.932394] systemd[1]: Reached target Swap.
[  OK  ] Reached target Swap.
[    4.961067] random: systemd: uninitialized urandom read (16 bytes read)
[    4.967960] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[    5.010962] random: systemd: uninitialized urandom read (16 bytes read)
[    5.019774] systemd[1]: Created slice User and Session Slice.
[  OK  ] Created slice User and Session Slice.
[    5.057977] systemd[1]: Listening on Process Core Dump Socket.
[  OK  ] Listening on Process Core Dump Socket.
[    5.091228] systemd[1]: Listening on udev Control Socket.
[  OK  ] Listening on udev Control Socket.
[    5.179216] systemd[1]: Created slice System Slice.
[  OK  ] Created slice System Slice.
[    5.223884] systemd[1]: Mounting Kernel Debug File System...
         Mounting Kernel Debug File System...
[  OK  ] Reached target Slices.
         Mounting Temporary Directory (/tmp)...
[  OK  ] Listening on Journal Socket.
         Starting Create list of required st…ce nodes for the current kernel...
         Starting Remount Root and Kernel File Systems...
[    5.419571] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[  OK  ] Reached target Remote File Systems.
[  OK  ] Created slice system-getty.slice.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Listening on Syslog Socket.
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Reached target Paths.
[  OK  ] Listening on Journal Socket (/dev/log).
         Mounting POSIX Message Queue File System...
[  OK  ] Created slice system-serial\x2dgetty.slice.
         Starting Load Kernel Modules...
[    5.736099] cmemk: loading out-of-tree module taints kernel.
[    5.742519] CMEMK module: reference Linux version 4.14.79
         [    5.748661] allocated heap buffer 0x40500000 of size 0x100000
Starting Journal Service...
[    5.755185] cmemk initialized
[    5.780198] cryptodev: driver 1.9 loaded.
[  OK  ] Listening on Network Service Netlink Socket.
[    5.816804] usbcore: registered new interface driver usbfs
[  OK  ] Listening on udev Kernel Socket.
[    5.823131] usbcore: registered new interface driver hub
[    5.833173] usbcore: registered new device driver usb
[    5.844072] usbcore: registered new interface driver usbserial
[  OK  ] Mounted Kernel Debug File System.
[    5.863582] usbcore: registered new interface driver ftdi_sio
[    5.869384] usbserial: USB Serial support registered for FTDI USB Serial Device
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Mounted Temporary Directory (/tmp).
[  OK  ] Started Journal Service.
[  OK  ] Started Create list of required sta…vice nodes for the current kernel.
[  OK  ] Started Remount Root and Kernel File Systems.
[  OK  ] Started Load Kernel Modules.
         Starting Apply Kernel Variables...
         Mounting Kernel Configuration File System...
         Starting Create System Users...
         Starting Rebuild Hardware Database...
         Starting Flush Journal to Persistent Storage...
[  OK  ] Mounted Kernel Configuration File System.
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Started Create System Users.
[    6.317650] systemd-journald[95]: Received request to flush runtime journal from PID 1
         Starting Create Static Device Nodes in /dev...
[  OK  ] Started Flush Journal to Persistent Storage.
[  OK  ] Started Create Static Device Nodes in /dev.
         Starting udev Kernel Device Manager...
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /var/volatile...
         Mounting /media/ram...
[  OK  ] Mounted /var/volatile.
[  OK  ] Mounted /media/ram.
         Starting Load/Save Random Seed...
[  OK  ] Reached target Local File Systems.
         Starting Rebuild Dynamic Linker Cache...
         Starting Rebuild Journal Catalog...
         Starting Create Volatile Files and Directories...
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Started udev Kernel Device Manager.
[    6.843303] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:757: group 0, block bitmap and bg descriptor inconsistent: 13510 vs 13522 free clusters
[    6.865353] JBD2: Spotted dirty metadata buffer (dev = mmcblk0p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
[  OK  ] Started Create Volatile Files and Directories.
         Starting Update UTMP about System Boot/Shutdown...
         Starting Network Time Synchronization...
[  OK  ] Started Rebuild Journal Catalog.
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Started Network Time Synchronization.
[  OK  ] Started Rebuild Dynamic Linker Cache.
[  OK  ] Reached target System Time Synchronized.
[  OK  ] Started Rebuild Hardware Database.
         Starting udev Coldplug all Devices...
         Starting Update is Completed...
[    8.782179] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:757: group 45, block bitmap and bg descriptor inconsistent: 21962 vs 21964 free clusters
[    8.812728] JBD2: Spotted dirty metadata buffer (dev = mmcblk0p2, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
[  OK  ] Started Update is Completed.
[  OK  ] Started udev Coldplug all Devices.
[  OK  ] Reached target System Initialization.
[  OK  ] Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
[  OK  ] Listening on dropbear.socket.
[  OK  ] Started Daily rotation of log files.
         Starting Network Service...
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Listening on RPCbind Server Activation Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
[  OK  ] Started D-Bus System Message Bus.
[   10.626405] omap-rproc 58820000.ipu: assigned reserved memory node ipu1-memory@9d000000
[   10.634693] remoteproc remoteproc0: 58820000.ipu is available
[   10.640883] omap-rproc 55020000.ipu: assigned reserved memory node ipu2-memory@95800000
[   10.649051] remoteproc remoteproc1: 55020000.ipu is available
[   10.655166] omap-rproc 40800000.dsp: assigned reserved memory node dsp1-memory@99000000
[   10.663487] remoteproc remoteproc2: 40800000.dsp is available
[   10.669712] omap-rproc 41000000.dsp: assigned reserved memory node dsp2-memory@9f000000
[   10.677971] remoteproc remoteproc3: 41000000.dsp is available
[   10.772245] at24 0-0050: 4096 byte 24c32 EEPROM, writable, 1 bytes/write
[   10.822482] palmas-rtc 48070000.i2c:tps659038@58:tps659038_rtc: rtc core: registered 48070000.i2c:tps659038@58:tps659038_rtc as rtc1
[   10.916683] tvp5150: no symbol version for module_layout
[   10.961323] rtc-ds1307 2-006f: SET TIME!
[   10.968786] rtc-ds1307 2-006f: registered as rtc0
[   11.062779] input: pixcir_tangoc as /devices/platform/44000000.ocp/4807c000.i2c/i2c-4/4-005c/input/input1
[   11.073626] tvp5150 4-005d: tvp5150 (4.0) chip found @ 0xba (OMAP I2C adapter)
[   11.090840] tvp5150 4-005d: tvp5150am1 detected.
[   11.187796] omap-des 480a5000.des: OMAP DES hw accel rev: 2.2
[   11.212003] omap-des 480a5000.des: will run requests pump with realtime priority
[   11.262028] omap_rtc 48838000.rtc: registered as rtc2
[   11.960442] remoteproc remoteproc1: powering up 55020000.ipu
[   11.966175] remoteproc remoteproc1: Booting fw image dra7-ipu2-fw.xem4, size 3747220
[   11.975159] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
[   12.025562] virtio_rpmsg_bus virtio0: rpmsg host is online
[   12.031270] remoteproc remoteproc1: registered virtio0 (type 7)
[   12.037223] remoteproc remoteproc1: remote processor 55020000.ipu is now up
[   12.046805] virtio_rpmsg_bus virtio0: creating channel rpmsg-rpc addr 0x65
[   12.054382] virtio_rpmsg_bus virtio0: creating channel rpmsg-rpc addr 0x66
[   12.168325] vpe 489d0000.vpe: loading firmware vpdma-1b8.bin
[   12.384719] SCSI subsystem initialized
[   12.461463] omap-sham 4b101000.sham: hw accel on OMAP rev 4.3
[   12.470973] vpe 489d0000.vpe: Device registered as /dev/video0
[   12.483774] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[   12.716530] [drm] Initialized pvr 1.14.3699939 20110701 for 56000000.gpu on minor 1
[   12.735882] remoteproc remoteproc3: powering up 41000000.dsp
[   12.741652] remoteproc remoteproc3: Booting fw image dra7-dsp2-fw.xe66, size 20392652
[   12.757241] omap_hwmod: mmu0_dsp2: _wait_target_disable failed
[   12.763126] omap-iommu 41501000.mmu: 41501000.mmu: version 3.0
[   12.769068] omap-iommu 41502000.mmu: 41502000.mmu: version 3.0
[   12.777012] remoteproc remoteproc0: powering up 58820000.ipu
[   12.782765] remoteproc remoteproc0: Booting fw image dra7-ipu1-fw.xem4, size 6680920
[   12.795820] omap-iommu 58882000.mmu: 58882000.mmu: version 2.1
[   12.815540] ahci 4a140000.sata: SSS flag set, parallel bus scan disabled
[   12.822859] virtio_rpmsg_bus virtio1: rpmsg host is online
[   12.822907] remoteproc remoteproc3: registered virtio1 (type 7)
[   12.822912] remoteproc remoteproc3: remote processor 41000000.dsp is now up
[   12.827022] virtio_rpmsg_bus virtio1: creating channel rpmsg-proto addr 0x3d
[   12.865583] ahci 4a140000.sata: AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl platform mode
[   12.874274] ahci 4a140000.sata: flags: 64bit ncq sntf stag pm led clo only pmp pio slum part ccc apst 
[   12.890212] virtio_rpmsg_bus virtio2: rpmsg host is online
[   12.895790] remoteproc remoteproc0: registered virtio2 (type 7)
[   12.903570] remoteproc remoteproc0: remote processor 58820000.ipu is now up
[   12.911006] scsi host0: ahci
[   12.914290] ata1: SATA max UDMA/133 mmio [mem 0x4a140000-0x4a1410ff] port 0x100 irq 82
[   12.922679] omap-aes 4b500000.aes: OMAP AES hw accel rev: 3.3
[   12.929347] omap-aes 4b500000.aes: will run requests pump with realtime priority
[   12.939519] omap-aes 4b700000.aes: OMAP AES hw accel rev: 3.3
[   12.945557] omap-aes 4b700000.aes: will run requests pump with realtime priority
[   13.021985] virtio_rpmsg_bus virtio2: creating channel rpmsg-proto addr 0x3d
[   13.113642] omap-hdmi-audio omap-hdmi-audio.0.auto: snd-soc-dummy-dai <-> 58040000.encoder mapping ok
[   13.123839] omap-hdmi-audio omap-hdmi-audio.0.auto: ASoC: no DMI vendor name!
[   13.176457] vip 48990000.vip: loading firmware vpdma-1b8.bin
[   13.210847] vip 48990000.vip: VPDMA firmware loaded
[   13.215908] vin3a: Port A: Using subdev tvp5150 4-005d for capture
[   13.222640] vin3a-0: device registered as video1
[   13.263719] ata1: SATA link down (SStatus 0 SControl 300)
[   13.292641] asoc-simple-card sound0: tlv320aic3x-hifi <-> 48468000.mcasp mapping ok
[   13.300357] asoc-simple-card sound0: ASoC: no DMI vendor name!
[   13.534192] remoteproc remoteproc2: powering up 40800000.dsp
[   13.539887] remoteproc remoteproc2: Booting fw image dra7-dsp1-fw.xe66, size 20392652
[   13.555460] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
[   13.561344] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
[   13.567267] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
[   13.597092] virtio_rpmsg_bus virtio3: rpmsg host is online
[   13.604230] remoteproc remoteproc2: registered virtio3 (type 7)
[   13.610194] remoteproc remoteproc2: remote processor 40800000.dsp is now up
[   13.656844] virtio_rpmsg_bus virtio3: creating channel rpmsg-proto addr 0x3d
[  OK  ] Started Hardware RNG Entropy Gatherer Daemon.
[  OK  ] Reached target Containers.
[   13.852205] net eth1: initializing cpsw version 1.15 (0)
[   13.875871] random: crng init done
[   13.875876] random: 7 urandom warning(s) missed due to ratelimiting
         Starting TI MultiCore Tools Daemon...
         Starting Print notice about GPLv3 packages...
         Starting uim-sysfs.service...
[  OK  ] Started Job spooling tools.
[  OK  ] Started Periodic Command Scheduler.
[  OK  ] Started System Logging Service.
[   14.073045] Micrel KSZ9031 Gigabit PHY 48485000.mdio:02: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=48485000.mdio:02, irq=POLL)
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target Timers.
[  OK  ] Started Kernel Logging Service.
         Starting RPC Bind Service...
[   14.202511] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
         Starting Avahi mDNS/DNS-SD Stack...
         Starting Login Service...
         Starting TI IPC Daemon...
[   14.289694] EXT4-fs error (device mmcblk0p2): ext4_lookup:1586: inode #524292: comm systemd: deleted inode referenced: 524316
[   14.341483] net eth0: initializing cpsw version 1.15 (0)
[   14.494566] Micrel KSZ9031 Gigabit PHY 48485000.mdio:01: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=48485000.mdio:01, irq=POLL)
[   14.556098] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  OK  ] Started Network Service.
[  OK  ] Started TI MultiCore Tools Daemon.
[  OK  ] Started RPC Bind Service.
[  OK  ] Started TI IPC Daemon.
[  OK  ] Found device /dev/ttyS2.
[   14.996264] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   15.009206] FAT-fs (mmcblk1p2): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   15.033417] FAT-fs (mmcblk1p3): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   15.141456] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  OK  ] Started uim-sysfs.service.
[   15.605408] pruss 4b200000.pruss: creating PRU cores and other child platform devices
[   15.631540] rpmsg_rpc virtio0.rpmsg-rpc.-1.101: probing service dce-callback with src 1024 dst 101
[   15.632335] rpmsg_rpc virtio0.rpmsg-rpc.-1.102: probing service rpmsg-dce with src 1025 dst 102
[   15.632919] rpmsg_rpc virtio0.rpmsg-rpc.-1.101: published functions = 4
[   15.633583] rpmsg_rpc virtio0.rpmsg-rpc.-1.102: published functions = 9
[   15.697987] NET: Registered protocol family 44
[   15.731226] pruss 4b280000.pruss: creating PRU cores and other child platform devices
[   15.749831] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[   15.762722] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 1
[   15.778027] xhci-hcd xhci-hcd.1.auto: hcc params 0x0220f04c hci version 0x100 quirks 0x02010010
[   15.809143] remoteproc remoteproc4: 4b234000.pru is available
[   15.809192] pru-rproc 4b234000.pru: PRU rproc node /ocp/pruss_soc_bus@4b226004/pruss@0/pru@34000 probed successfully
[   15.809453] remoteproc remoteproc5: 4b238000.pru is available
[   15.809508] pru-rproc 4b238000.pru: PRU rproc node /ocp/pruss_soc_bus@4b226004/pruss@0/pru@38000 probed successfully
[   15.809792] remoteproc remoteproc6: 4b2b4000.pru is available
[   15.809825] pru-rproc 4b2b4000.pru: PRU rproc node /ocp/pruss_soc_bus@4b2a6004/pruss@0/pru@34000 probed successfully
[   15.810050] remoteproc remoteproc7: 4b2b8000.pru is available
[   15.810083] pru-rproc 4b2b8000.pru: PRU rproc node /ocp/pruss_soc_bus@4b2a6004/pruss@0/pru@38000 probed successfully
[   15.814342] EXT4-fs error (device mmcblk0p2): ext4_lookup:1586: inode #524292: comm alsactl: deleted inode referenced: 524316
[   15.916379] xhci-hcd xhci-hcd.1.auto: irq 191, io mem 0x48890000
[   15.922806] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[   15.929782] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   15.937328] usb usb1: Product: xHCI Host Controller
[   15.942408] usb usb1: Manufacturer: Linux 4.14.79-gbde58ab01e xhci-hcd
[   15.949085] usb usb1: SerialNumber: xhci-hcd.1.auto
[   15.954530] hub 1-0:1.0: USB hub found
[   15.959015] hub 1-0:1.0: 1 port detected
[   15.963426] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[   15.969139] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 2
[   15.976968] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0  SuperSpeed
[   15.984288] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[   15.992617] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
[   16.002714] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   16.011450] usb usb2: Product: xHCI Host Controller
[   16.016433] usb usb2: Manufacturer: Linux 4.14.79-gbde58ab01e xhci-hcd
[   16.023114] usb usb2: SerialNumber: xhci-hcd.1.auto
[   16.028492] hub 2-0:1.0: USB hub found
[   16.032472] hub 2-0:1.0: 1 port detected
[   16.330821] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[  OK  ] Started Avahi mDNS/DNS-SD Stack.
[  OK  ] Started Login Service.
[  OK  ] Reached target Sound Card.
[  OK  ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
         Starting rc.pvr.service...
[  OK  ] Created slice system-systemd\x2dbacklight.slice.
         Starting Load/Save Screen Backlight…ightness of backl[   16.511444] usb 1-1: New USB device found, idVendor=0451, idProduct=8142
ight:backlight...
[  OK  ] Reached target Network.
         Starting Network Name Resolution...
[  OK  [   16.526154] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=1
] Started Redis In-Memory Data Store.
[   16.526162] usb 1-1: SerialNumber: 670408690392
         Starting Simple Network Management Protocol (SNMP) Daemon....
         Starting Permit User Sessions...
         Starting Lightning Fast Webserver With Light System Req[   16.560623] hub 1-1:1.0: USB hub found
uirements...
         Starting Enable and configure wl18xx blue[   16.572337] hub 1-1:1.0: 4 ports detected
tooth stack...
         Starting Wait for Network to be Configured...
[  OK  ] Started Load/Save Screen Backlight Brightness of backlight:backlight.
[  OK  ] Started Permit User Sessions.
[  OK  ] Started Serial Getty on ttyS2.
[  OK  ] Started Getty on tty1.
[  OK  ] Reached target Login Prompts.
         Starting Synchronize Sys[   16.664455] usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd
tem and HW clocks...
[   16.701218] usb 2-1: New USB device found, idVendor=0451, idProduct=8140
[   16.709921] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[   16.720386] hub 2-1:1.0: USB hub found
[   16.724942] hub 2-1:1.0: 4 ports detected
[   16.806294] EXT4-fs error (device mmcblk0p2): ext4_lookup:1586: inode #524292: comm alsactl: deleted inode referenced: 524316
[   16.875613] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
[  OK  ] Started Lightning Fast Webserver With Light System Requirements.
[  OK  ] Started Synchronize System and HW clocks.
[  OK  ] Started rc.pvr.service.
         Starting weston.service...
[  OK  ] Started Network Name Resolution.
[  OK  ] Reached target Host and Network Name Lookups.
[  OK  ] Started NFS status monitor for NFSv2/3 locking..
[  OK  ] Started weston.service.
         Starting Matrix GUI...
         Starting telnetd.service...
[  OK  ] Started telnetd.service.
         Starting start_eth0.service...
         Starting thttpd.service...
[  OK  ] Started thttpd.service.
[  OK  ] Started Matrix GUI.
[  OK  ] Started Enable and configure wl18xx bluetooth stack.
[  OK  ] Started Simple Network Management Protocol (SNMP) Daemon..
[  OK  ] Started start_eth0.service.
         Starting rng-tools.service...
[  OK  ] Started rng-tools.service.
[   18.719582] cpsw 48484000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   18.727764] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready


 _____                    _____           _         _   
|  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
|     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
|__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
              |___|                    |___|            

Arago Project http://arago-project.org am57xx-evm ttyS2

Arago 2018.10 am57xx-evm ttyS2

am57xx-evm login: [   23.452047] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:757: group 20, block bitmap and bg descriptor inconsistent: 14465 vs 14466 free clusters
[   23.518224] omap_hwmod: mmu0_dsp2: _wait_target_disable failed
[   24.158263] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
***************************************************************
***************************************************************
NOTICE: This file system contains the following GPLv3 packages:
	autoconf
	bash-dev
	bash
	binutils-dev
	binutils
	bison-dev
	bison
	cifs-utils
	cpio
	cpp-symlinks
	cpp
	dosfstools
	elfutils-dev
	elfutils
	findutils
	g++-symlinks
	g++
	gawk
	gcc-symlinks
	gcc
	gdb
	gdbc6x
	gdbserver
	gettext
	glmark2
	gstreamer1.0-libav
	gzip
	hidapi
	libasm1
	libcairo-perf-utils
	libdw1
	libelf1
	libgdbm-compat4
	libgdbm-dev
	libgdbm4
	libgettextlib
	libgettextsrc
	libgmp10
	libidn11
	libmavconn
	libmpc3
	libmpfr4
	libreadline-dev
	libreadline7
	libunistring2
	m4-dev
	m4
	make
	mavlink
	mavros-extras
	mavros-msgs
	mavros
	nettle
	parted
	python3-pycairo
	socketcan-interface
	swig-dev
	swig
	which

If you do not wish to distribute GPLv3 components please remove
the above packages prior to distribution.  This can be done using
the opkg remove command.  i.e.:
    opkg remove <package>
Where <package> is the name printed in the list above

NOTE: If the package is a dependency of another package you
      will be notified of the dependent packages.  You should
      use the --force-removal-of-dependent-packages option to
      also remove the dependent packages as well
***************************************************************
***************************************************************


 _____                    _____           _         _   
|  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
|     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
|__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
              |___|                    |___|            

Arago Project http://arago-project.org am57xx-evm ttyS2

Arago 2018.10 am57xx-evm ttyS2

am57xx-evm login: 

B4. tvp5150 detected by the system: ( Log v4l2-ctl - all -d / dev / video1 -V )

out_v4l2-ctl.log

log_after_v4l2-ctl.log
root@am57xx-evm:~# v4l2-ctl --all -d /dev/video1 -V
Driver Info (not using libv4l2):
	Driver name   : vip
	Card type     : vip
	Bus info      : platform:vip2:vin3a:stream0
	Driver version: 4.14.79
	Capabilities  : 0x85200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x05200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (camera 1: ok)
Video Standard = 0x00ffb0ff
	PAL-B/B1/G/H/I/D/D1/K
	NTSC-M/M-JP/M-KR
	SECAM-B/D/G/H/K/K1/L/Lc
Format Video Capture:
	Width/Height      : 720/288
	Pixel Format      : 'UYVY'
	Field             : Alternating
	Bytes per Line    : 1440
	Size Image        : 414720
	Colorspace        : SMPTE 170M
	Transfer Function : Default
	YCbCr Encoding    : Default
	Quantization      : Default
	Flags             : 
Crop Capability Video Capture:
	Bounds      : Left 0, Top 0, Width 720, Height 288
	Default     : Left 0, Top 0, Width 720, Height 288
	Pixel Aspect: 1/1
Crop Capability Video Output:
	Bounds      : Left 0, Top 0, Width 720, Height 288
	Default     : Left 0, Top 0, Width 720, Height 288
	Pixel Aspect: 1/1
Crop: Left 0, Top 0, Width 720, Height 288
Selection: crop, Left 0, Top 0, Width 720, Height 288
Selection: crop_default, Left 0, Top 0, Width 720, Height 288
Selection: crop_bounds, Left 0, Top 0, Width 720, Height 288
Selection: compose, Left 0, Top 0, Width 720, Height 288
Selection: compose_default, Left 0, Top 0, Width 720, Height 288
Selection: compose_bounds, Left 0, Top 0, Width 720, Height 288
Selection: crop, Left 0, Top 0, Width 720, Height 288
Selection: crop_default, Left 0, Top 0, Width 720, Height 288
Selection: crop_bounds, Left 0, Top 0, Width 720, Height 288
Selection: compose, Left 0, Top 0, Width 720, Height 288
Selection: compose_default, Left 0, Top 0, Width 720, Height 288
Selection: compose_bounds, Left 0, Top 0, Width 720, Height 288
Streaming Parameters Video Capture:
	Capabilities     : timeperframe
	Frames per second: 30.000 (30/1)
	Read buffers     : 4

User Controls

                     brightness (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                       contrast (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                     saturation (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                            hue (int)    : min=-128 max=127 step=1 default=0 value=0 flags=slider

Image Processing Controls

                     pixel_rate (int64)  : min=27000010 max=27000010 step=1 default=27000010 value=27000010 flags=read-only
                   test_pattern (menu)   : min=0 max=2 default=0 value=0
root@am57xx-evm:~# dmesg
[  334.039504] vin3a-0: vip_open
[  334.039528] tvp5150 4-005d: width = 720, height = 288
[  334.039537] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
[  334.039550] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  334.039557] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  334.039562] vin3a-0: init_stream vpdma data type: 0x27
[  334.039570] vin3a-0: vip_init_stream: stream instance 0xc0bb2874ed052000
[  334.045430] vin3a-0: g_std: 0xffb0ff
[  334.045532] vin3a-0: g_fmt fourcc:UYVY code: 2006 size: 720x288 bpl:1440 img_size:414720
[  334.045538] vin3a-0: g_fmt vpdma data type: 0x27
[  334.046388] vin3a-0: vip_release
[  334.046400] vin3a-0: vip_release_stream: stream instance 0x00000008ed052000
[  334.046477] vin3a: vip_release_port: port instance 0xedfe7540ed9cd010
root@am57xx-evm:~#

dmesg> dmesg_common_log.log:

 dmesg_common_log.logdmesg_common_log.log

dmesg | grep vin> dmesg_vin_log.log

 dmesg_vin_log.log

dmesg_vin_log.log
[    2.940822] davinci_mdio 48485000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    2.957266] davinci_mdio 48485000.mdio: phy[1]: device 48485000.mdio:01, driver Micrel KSZ9031 Gigabit PHY
[    2.967009] davinci_mdio 48485000.mdio: phy[2]: device 48485000.mdio:02, driver Micrel KSZ9031 Gigabit PHY
[   14.105078] vin3: vip_set_slice_path:
[   14.105087] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[   14.105460] vin4: vip_set_slice_path:
[   14.105467] vin4: vip_set_slice_path: DATA_PATH_SELECT(00000110): 80008000
[   14.154142] vin3a: can't get next endpoint: loop: 1
[   14.154148] vin3a: register async notifier for 1 subdevs
[   14.154153] vin3a: vip_async_bound
[   14.154157] vin3a: Port A: Using subdev tvp5150 4-005d for capture
[   14.184408] vin3a: subdev tvp5150 4-005d: code: 2006 idx: 0
[   14.184418] vin3a: matched fourcc: UYVY: code: 2006 idx: 0
[   14.184424] vin3a: matched fourcc: YUYV: code: 2006 idx: 1
[   14.184429] vin3a: matched fourcc: VYUY: code: 2006 idx: 2
[   14.184434] vin3a: matched fourcc: YVYU: code: 2006 idx: 3
[   14.184643] vin3a-0: device registered as video1
[   14.200263] vin3a: vip_create_streams[channel-0]: bus_type = V4L2_MBUS_BT656
[   14.200290] vin3a: vip_async_complete
[   16.304596] vin3a-0: vip_open
[   16.304618] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
[   16.304628] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[   16.304632] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[   16.304635] vin3a-0: init_stream vpdma data type: 0x27
[   16.304639] vin3a-0: vip_init_stream: stream instance 0xc0275c48ed806000
[   16.304823] vin3a-0: vip_release
[   16.304832] vin3a-0: vip_release_stream: stream instance 0x00000010ed806000
[   16.304835] vin3a: vip_release_port: port instance 0xed3356c0eda60010

dmesg | grep tvp> dmesg_tvp_log.log

 dmesg_tvp_log.log

dmesg_tvp_log.log
[   11.894158] tvp5150: no symbol version for module_layout
[   11.900147] tvp5150 4-005d: GPIO lookup for consumer pdn
[   11.900153] tvp5150 4-005d: using device tree for GPIO lookup
[   11.900164] of_get_named_gpiod_flags: can't parse 'pdn-gpios' property of node '/ocp/i2c@4807c000/tvp5150@5d[0]'
[   11.900171] of_get_named_gpiod_flags: can't parse 'pdn-gpio' property of node '/ocp/i2c@4807c000/tvp5150@5d[0]'
[   11.900178] tvp5150 4-005d: using lookup tables for GPIO lookup
[   11.900184] tvp5150 4-005d: lookup for GPIO pdn failed
[   11.900191] tvp5150 4-005d: GPIO lookup for consumer reset
[   11.900195] tvp5150 4-005d: using device tree for GPIO lookup
[   11.900202] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/i2c@4807c000/tvp5150@5d[0]'
[   11.900209] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp/i2c@4807c000/tvp5150@5d[0]'
[   11.900213] tvp5150 4-005d: using lookup tables for GPIO lookup
[   11.900218] tvp5150 4-005d: lookup for GPIO reset failed
[   11.902955] tvp5150 4-005d: tvp5150: read 0x80 = 51
[   11.910958] tvp5150 4-005d: tvp5150: read 0x81 = 50
[   11.911122] tvp5150 4-005d: tvp5150: read 0x82 = 04
[   11.911320] tvp5150 4-005d: tvp5150: read 0x83 = 00
[   11.911327] tvp5150 4-005d: tvp5150 (4.0) chip found @ 0xba (OMAP I2C adapter)
[   11.918900] tvp5150 4-005d: tvp5150am1 detected.
[   11.923594] tvp5150 4-005d: tvp5150: writing 30 00
[   11.923917] tvp5150 4-005d: tvp5150: read 0x8c = 83
[   11.923924] tvp5150 4-005d: tvp5150: writing 00 00
[   11.924030] tvp5150 4-005d: tvp5150: writing 01 15
[   11.924158] tvp5150 4-005d: tvp5150: writing 02 00
[   11.924843] tvp5150 4-005d: tvp5150: writing 03 01
[   11.928001] tvp5150 4-005d: tvp5150: writing 06 10
[   11.928130] tvp5150 4-005d: tvp5150: writing 07 60
[   11.928255] tvp5150 4-005d: tvp5150: writing 08 00
[   11.928381] tvp5150 4-005d: tvp5150: writing 09 80
[   11.928509] tvp5150 4-005d: tvp5150: writing 0a 80
[   11.928637] tvp5150 4-005d: tvp5150: writing 0b 00
[   11.928765] tvp5150 4-005d: tvp5150: writing 0c 80
[   11.928893] tvp5150 4-005d: tvp5150: writing 0d 47
[   11.929021] tvp5150 4-005d: tvp5150: writing 0e 00
[   11.929148] tvp5150 4-005d: tvp5150: writing 0f 08
[   11.929276] tvp5150 4-005d: tvp5150: writing 11 00
[   11.929404] tvp5150 4-005d: tvp5150: writing 12 00
[   11.929532] tvp5150 4-005d: tvp5150: writing 13 00
[   11.929660] tvp5150 4-005d: tvp5150: writing 14 00
[   11.929788] tvp5150 4-005d: tvp5150: writing 15 01
[   11.929916] tvp5150 4-005d: tvp5150: writing 16 80
[   11.930044] tvp5150 4-005d: tvp5150: writing 18 00
[   11.930171] tvp5150 4-005d: tvp5150: writing 19 00
[   11.930300] tvp5150 4-005d: tvp5150: writing 1a 0c
[   11.930429] tvp5150 4-005d: tvp5150: writing 1b 14
[   11.930564] tvp5150 4-005d: tvp5150: writing 1c 00
[   11.930686] tvp5150 4-005d: tvp5150: writing 1d 00
[   11.940707] tvp5150 4-005d: tvp5150: writing 1e 00
[   11.941350] tvp5150 4-005d: tvp5150: writing 28 00
[   11.941508] tvp5150 4-005d: tvp5150: writing 2e 0f
[   11.941650] tvp5150 4-005d: tvp5150: writing 2f 01
[   11.941774] tvp5150 4-005d: tvp5150: writing bb 00
[   11.941893] tvp5150 4-005d: tvp5150: writing c0 00
[   11.942004] tvp5150 4-005d: tvp5150: writing c1 00
[   11.942113] tvp5150 4-005d: tvp5150: writing c2 04
[   11.942245] tvp5150 4-005d: tvp5150: writing c8 80
[   11.942355] tvp5150 4-005d: tvp5150: writing c9 00
[   11.942464] tvp5150 4-005d: tvp5150: writing ca 00
[   11.942574] tvp5150 4-005d: tvp5150: writing cb 4e
[   11.942682] tvp5150 4-005d: tvp5150: writing cc 00
[   11.942791] tvp5150 4-005d: tvp5150: writing cd 01
[   11.942899] tvp5150 4-005d: tvp5150: writing cf 00
[   11.943008] tvp5150 4-005d: tvp5150: writing d0 00
[   11.943116] tvp5150 4-005d: tvp5150: writing fc 7f
[   11.943225] tvp5150 4-005d: tvp5150: writing cf 00
[   11.943334] tvp5150 4-005d: tvp5150: writing d0 ff
[   11.943444] tvp5150 4-005d: tvp5150: writing d1 ff
[   11.943552] tvp5150 4-005d: tvp5150: writing d2 ff
[   11.943661] tvp5150 4-005d: tvp5150: writing d3 ff
[   11.943769] tvp5150 4-005d: tvp5150: writing d4 ff
[   11.943878] tvp5150 4-005d: tvp5150: writing d5 ff
[   11.943987] tvp5150 4-005d: tvp5150: writing d6 ff
[   11.944096] tvp5150 4-005d: tvp5150: writing d7 ff
[   11.944205] tvp5150 4-005d: tvp5150: writing d8 ff
[   11.944313] tvp5150 4-005d: tvp5150: writing d9 ff
[   11.944422] tvp5150 4-005d: tvp5150: writing da ff
[   11.944531] tvp5150 4-005d: tvp5150: writing db ff
[   11.944639] tvp5150 4-005d: tvp5150: writing dc ff
[   11.944747] tvp5150 4-005d: tvp5150: writing dd ff
[   11.944856] tvp5150 4-005d: tvp5150: writing de ff
[   11.944964] tvp5150 4-005d: tvp5150: writing df ff
[   11.945073] tvp5150 4-005d: tvp5150: writing e0 ff
[   11.945181] tvp5150 4-005d: tvp5150: writing e1 ff
[   11.945292] tvp5150 4-005d: tvp5150: writing e2 ff
[   11.945401] tvp5150 4-005d: tvp5150: writing e3 ff
[   11.945509] tvp5150 4-005d: tvp5150: writing e4 ff
[   11.945617] tvp5150 4-005d: tvp5150: writing e5 ff
[   11.945726] tvp5150 4-005d: tvp5150: writing e6 ff
[   11.945835] tvp5150 4-005d: tvp5150: writing e7 ff
[   11.945943] tvp5150 4-005d: tvp5150: writing e8 ff
[   11.946051] tvp5150 4-005d: tvp5150: writing e9 ff
[   11.946160] tvp5150 4-005d: tvp5150: writing ea ff
[   11.946269] tvp5150 4-005d: tvp5150: writing eb ff
[   11.946377] tvp5150 4-005d: tvp5150: writing ec ff
[   11.946485] tvp5150 4-005d: tvp5150: writing ed ff
[   11.946594] tvp5150 4-005d: tvp5150: writing ee ff
[   11.946702] tvp5150 4-005d: tvp5150: writing ef ff
[   11.946811] tvp5150 4-005d: tvp5150: writing f0 ff
[   11.946920] tvp5150 4-005d: tvp5150: writing f1 ff
[   11.947028] tvp5150 4-005d: tvp5150: writing f2 ff
[   11.947137] tvp5150 4-005d: tvp5150: writing f3 ff
[   11.947245] tvp5150 4-005d: tvp5150: writing f4 ff
[   11.947353] tvp5150 4-005d: tvp5150: writing f5 ff
[   11.947461] tvp5150 4-005d: tvp5150: writing f6 ff
[   11.947570] tvp5150 4-005d: tvp5150: writing f7 ff
[   11.947679] tvp5150 4-005d: tvp5150: writing f8 ff
[   11.947788] tvp5150 4-005d: tvp5150: writing f9 ff
[   11.947897] tvp5150 4-005d: tvp5150: writing fa ff
[   11.948005] tvp5150 4-005d: tvp5150: writing fb ff
[   11.948121] tvp5150 4-005d: tvp5150: writing c5 00
[   11.948242] tvp5150 4-005d: tvp5150: writing c4 30
[   11.948352] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.948467] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.948576] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.948688] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.948794] tvp5150 4-005d: tvp5150: writing c3 27
[   11.948901] tvp5150 4-005d: tvp5150: writing c3 2e
[   11.949005] tvp5150 4-005d: tvp5150: writing c3 20
[   11.949232] tvp5150 4-005d: tvp5150: writing c3 2b
[   11.949347] tvp5150 4-005d: tvp5150: writing c3 a6
[   11.949472] tvp5150 4-005d: tvp5150: writing c3 72
[   11.949592] tvp5150 4-005d: tvp5150: writing c3 10
[   11.949707] tvp5150 4-005d: tvp5150: writing c3 00
[   11.949830] tvp5150 4-005d: tvp5150: writing c3 00
[   11.949949] tvp5150 4-005d: tvp5150: writing c3 00
[   11.950065] tvp5150 4-005d: tvp5150: writing c3 10
[   11.950178] tvp5150 4-005d: tvp5150: writing c3 00
[   11.950300] tvp5150 4-005d: tvp5150: writing c5 00
[   11.950425] tvp5150 4-005d: tvp5150: writing c4 f0
[   11.950540] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.950658] tvp5150 4-005d: tvp5150: writing c3 2a
[   11.950772] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.950925] tvp5150 4-005d: tvp5150: writing c3 3f
[   11.951036] tvp5150 4-005d: tvp5150: writing c3 04
[   11.951147] tvp5150 4-005d: tvp5150: writing c3 51
[   11.951259] tvp5150 4-005d: tvp5150: writing c3 6e
[   11.951369] tvp5150 4-005d: tvp5150: writing c3 02
[   11.951478] tvp5150 4-005d: tvp5150: writing c3 69
[   11.951588] tvp5150 4-005d: tvp5150: writing c3 8c
[   11.951697] tvp5150 4-005d: tvp5150: writing c3 09
[   11.951807] tvp5150 4-005d: tvp5150: writing c3 00
[   11.951923] tvp5150 4-005d: tvp5150: writing c3 00
[   11.952035] tvp5150 4-005d: tvp5150: writing c3 00
[   11.952143] tvp5150 4-005d: tvp5150: writing c3 27
[   11.952257] tvp5150 4-005d: tvp5150: writing c3 00
[   11.952371] tvp5150 4-005d: tvp5150: writing c5 01
[   11.952483] tvp5150 4-005d: tvp5150: writing c4 10
[   11.952597] tvp5150 4-005d: tvp5150: writing c3 5b
[   11.952718] tvp5150 4-005d: tvp5150: writing c3 55
[   11.952829] tvp5150 4-005d: tvp5150: writing c3 c5
[   11.952938] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.953047] tvp5150 4-005d: tvp5150: writing c3 00
[   11.953155] tvp5150 4-005d: tvp5150: writing c3 71
[   11.953264] tvp5150 4-005d: tvp5150: writing c3 6e
[   11.953372] tvp5150 4-005d: tvp5150: writing c3 42
[   11.953481] tvp5150 4-005d: tvp5150: writing c3 a6
[   11.953590] tvp5150 4-005d: tvp5150: writing c3 cd
[   11.953699] tvp5150 4-005d: tvp5150: writing c3 0f
[   11.953808] tvp5150 4-005d: tvp5150: writing c3 00
[   11.953917] tvp5150 4-005d: tvp5150: writing c3 00
[   11.954025] tvp5150 4-005d: tvp5150: writing c3 00
[   11.954134] tvp5150 4-005d: tvp5150: writing c3 3a
[   11.954243] tvp5150 4-005d: tvp5150: writing c3 00
[   11.954351] tvp5150 4-005d: tvp5150: writing c5 01
[   11.954459] tvp5150 4-005d: tvp5150: writing c4 90
[   11.954568] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.954677] tvp5150 4-005d: tvp5150: writing c3 aa
[   11.954788] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.954898] tvp5150 4-005d: tvp5150: writing c3 ff
[   11.955008] tvp5150 4-005d: tvp5150: writing c3 ba
[   11.955119] tvp5150 4-005d: tvp5150: writing c3 ce
[   11.955228] tvp5150 4-005d: tvp5150: writing c3 2b
[   11.955336] tvp5150 4-005d: tvp5150: writing c3 0d
[   11.955445] tvp5150 4-005d: tvp5150: writing c3 a6
[   11.955557] tvp5150 4-005d: tvp5150: writing c3 da
[   11.955666] tvp5150 4-005d: tvp5150: writing c3 0b
[   11.955776] tvp5150 4-005d: tvp5150: writing c3 00
[   11.955885] tvp5150 4-005d: tvp5150: writing c3 00
[   11.955993] tvp5150 4-005d: tvp5150: writing c3 00
[   11.956101] tvp5150 4-005d: tvp5150: writing c3 60
[   11.956216] tvp5150 4-005d: tvp5150: writing c3 00
[   11.956330] tvp5150 4-005d: Selecting video route: route input=0, output=0 => tvp5150 input=0, opmode=0
[   11.956336] tvp5150 4-005d: tvp5150: writing 02 00
[   11.956485] tvp5150 4-005d: tvp5150: writing 00 00
[   11.956819] tvp5150 4-005d: tvp5150: read 0x03 = 01
[   11.956824] tvp5150 4-005d: tvp5150: writing 03 41
[   11.956995] tvp5150 4-005d: tvp5150: writing 0f 02
[   11.957123] tvp5150 4-005d: tvp5150: writing 01 15
[   11.957250] tvp5150 4-005d: tvp5150: writing 03 6b
[   11.957378] tvp5150 4-005d: tvp5150: writing 04 00
[   11.957507] tvp5150 4-005d: tvp5150: writing 0d 47
[   11.957635] tvp5150 4-005d: tvp5150: writing 1a 0c
[   11.957762] tvp5150 4-005d: tvp5150: writing 1b 54
[   11.957892] tvp5150 4-005d: tvp5150: writing 27 20
[   11.958021] tvp5150 4-005d: tvp5150: writing 09 80
[   11.958147] tvp5150 4-005d: tvp5150: writing 0c 80
[   11.958275] tvp5150 4-005d: tvp5150: writing 0a 80
[   11.958403] tvp5150 4-005d: tvp5150: writing 0b 00
[   11.958530] tvp5150 4-005d: Set video std register to 4.
[   11.958536] tvp5150 4-005d: tvp5150: writing 28 04
[   11.958866] tvp5150 4-005d: tvp5150: read 0x00 = 00
[   11.958871] tvp5150 4-005d: tvp5150: Video input source selection #1 = 0x00
[   11.959058] tvp5150 4-005d: tvp5150: read 0x01 = 15
[   11.959063] tvp5150 4-005d: tvp5150: Analog channel controls = 0x15
[   11.959254] tvp5150 4-005d: tvp5150: read 0x02 = 00
[   11.959259] tvp5150 4-005d: tvp5150: Operation mode controls = 0x00
[   11.959446] tvp5150 4-005d: tvp5150: read 0x03 = 6b
[   11.959451] tvp5150 4-005d: tvp5150: Miscellaneous controls = 0x6b
[   11.959633] tvp5150 4-005d: tvp5150: read 0x04 = 00
[   11.959638] tvp5150 4-005d: tvp5150: Autoswitch mask= 0x00
[   11.959826] tvp5150 4-005d: tvp5150: read 0x06 = 10
[   11.959830] tvp5150 4-005d: tvp5150: Color killer threshold control = 0x10
[   11.960018] tvp5150 4-005d: tvp5150: read 0x07 = 60
[   11.960214] tvp5150 4-005d: tvp5150: read 0x08 = 00
[   11.960402] tvp5150 4-005d: tvp5150: read 0x0e = 00
[   11.960407] tvp5150 4-005d: tvp5150: Luminance processing controls #1 #2 and #3 = 60 00 00
[   11.960597] tvp5150 4-005d: tvp5150: read 0x09 = 80
[   11.960602] tvp5150 4-005d: tvp5150: Brightness control = 0x80
[   11.960887] tvp5150 4-005d: tvp5150: read 0x0a = 80
[   11.960893] tvp5150 4-005d: tvp5150: Color saturation control = 0x80
[   11.961102] tvp5150 4-005d: tvp5150: read 0x0b = 00
[   11.961107] tvp5150 4-005d: tvp5150: Hue control = 0x00
[   11.961302] tvp5150 4-005d: tvp5150: read 0x0c = 80
[   11.961307] tvp5150 4-005d: tvp5150: Contrast control = 0x80
[   11.961486] tvp5150 4-005d: tvp5150: read 0x0d = 47
[   11.961491] tvp5150 4-005d: tvp5150: Outputs and data rates select = 0x47
[   11.961679] tvp5150 4-005d: tvp5150: read 0x0f = 02
[   11.961684] tvp5150 4-005d: tvp5150: Configuration shared pins = 0x02
[   11.961877] tvp5150 4-005d: tvp5150: read 0x11 = 00
[   11.962070] tvp5150 4-005d: tvp5150: read 0x12 = 00
[   11.962075] tvp5150 4-005d: tvp5150: Active video cropping start = 0x0000
[   11.962258] tvp5150 4-005d: tvp5150: read 0x13 = 00
[   11.962453] tvp5150 4-005d: tvp5150: read 0x14 = 00
[   11.962458] tvp5150 4-005d: tvp5150: Active video cropping stop  = 0x0000
[   11.962640] tvp5150 4-005d: tvp5150: read 0x15 = 01
[   11.962646] tvp5150 4-005d: tvp5150: Genlock/RTC = 0x01
[   11.962837] tvp5150 4-005d: tvp5150: read 0x16 = 80
[   11.962842] tvp5150 4-005d: tvp5150: Horizontal sync start = 0x80
[   11.963029] tvp5150 4-005d: tvp5150: read 0x18 = 00
[   11.963034] tvp5150 4-005d: tvp5150: Vertical blanking start = 0x00
[   11.963221] tvp5150 4-005d: tvp5150: read 0x19 = 00
[   11.963226] tvp5150 4-005d: tvp5150: Vertical blanking stop = 0x00
[   11.963408] tvp5150 4-005d: tvp5150: read 0x1a = 0c
[   11.963601] tvp5150 4-005d: tvp5150: read 0x1b = 54
[   11.963606] tvp5150 4-005d: tvp5150: Chrominance processing control #1 and #2 = 0c 54
[   11.963794] tvp5150 4-005d: tvp5150: read 0x1c = 00
[   11.963799] tvp5150 4-005d: tvp5150: Interrupt reset register B = 0x00
[   11.963989] tvp5150 4-005d: tvp5150: read 0x1d = 00
[   11.963994] tvp5150 4-005d: tvp5150: Interrupt enable register B = 0x00
[   11.964181] tvp5150 4-005d: tvp5150: read 0x1e = 00
[   11.964186] tvp5150 4-005d: tvp5150: Interrupt configuration register B = 0x00
[   11.964402] tvp5150 4-005d: tvp5150: read 0x28 = 04
[   11.964407] tvp5150 4-005d: tvp5150: Video standard = 0x04
[   11.964565] tvp5150 4-005d: tvp5150: read 0x2c = 00
[   11.964753] tvp5150 4-005d: tvp5150: read 0x2d = 00
[   11.964758] tvp5150 4-005d: tvp5150: Chroma gain factor: Cb=0x00 Cr=0x00
[   11.964944] tvp5150 4-005d: tvp5150: read 0x2e = 0f
[   11.964949] tvp5150 4-005d: tvp5150: Macrovision on counter = 0x0f
[   11.965157] tvp5150 4-005d: tvp5150: read 0x2f = 01
[   11.965162] tvp5150 4-005d: tvp5150: Macrovision off counter = 0x01
[   11.965334] tvp5150 4-005d: tvp5150: read 0x30 = 00
[   11.965339] tvp5150 4-005d: tvp5150: ITU-R BT.656.4 timing(TVP5150AM1 only)
[   11.965523] tvp5150 4-005d: tvp5150: read 0x80 = 51
[   11.965722] tvp5150 4-005d: tvp5150: read 0x81 = 50
[   11.965727] tvp5150 4-005d: tvp5150: Device ID = 5150
[   11.965904] tvp5150 4-005d: tvp5150: read 0x82 = 04
[   11.966103] tvp5150 4-005d: tvp5150: read 0x83 = 00
[   11.966108] tvp5150 4-005d: tvp5150: ROM version = (hex) 04.00
[   11.966288] tvp5150 4-005d: tvp5150: read 0x84 = 02
[   11.966489] tvp5150 4-005d: tvp5150: read 0x85 = 71
[   11.966494] tvp5150 4-005d: tvp5150: Vertical line count = 0x0271
[   11.966676] tvp5150 4-005d: tvp5150: read 0x86 = da
[   11.966681] tvp5150 4-005d: tvp5150: Interrupt status register B = 0xda
[   11.966867] tvp5150 4-005d: tvp5150: read 0x87 = 00
[   11.966872] tvp5150 4-005d: tvp5150: Interrupt active register B = 0x00
[   11.967056] tvp5150 4-005d: tvp5150: read 0x88 = 76
[   11.967253] tvp5150 4-005d: tvp5150: read 0x89 = 28
[   11.967441] tvp5150 4-005d: tvp5150: read 0x8a = 1e
[   11.967633] tvp5150 4-005d: tvp5150: read 0x8b = c5
[   11.967825] tvp5150 4-005d: tvp5150: read 0x8c = 83
[   11.967831] tvp5150 4-005d: tvp5150: Status regs #1 to #5 = 76 28 1e c5 83
[   11.967986] tvp5150 4-005d: tvp5150: read 0xb1 = 00
[   11.968142] tvp5150 4-005d: tvp5150: read 0xb2 = 00
[   11.968299] tvp5150 4-005d: tvp5150: read 0xb3 = 00
[   11.968454] tvp5150 4-005d: tvp5150: read 0xb4 = 00
[   11.968460] tvp5150 4-005d: Teletext filter 1 reg b1 = 00 00 00 00
[   11.968610] tvp5150 4-005d: tvp5150: read 0xb6 = 00
[   11.968766] tvp5150 4-005d: tvp5150: read 0xb7 = 00
[   11.968922] tvp5150 4-005d: tvp5150: read 0xb8 = 00
[   11.969072] tvp5150 4-005d: tvp5150: read 0xb9 = 00
[   11.969078] tvp5150 4-005d: Teletext filter 2 reg b6 = 00 00 00 00
[   11.969228] tvp5150 4-005d: tvp5150: read 0xbb = 00
[   11.969233] tvp5150 4-005d: tvp5150: Teletext filter enable = 0x00
[   11.969386] tvp5150 4-005d: tvp5150: read 0xc0 = c0
[   11.969391] tvp5150 4-005d: tvp5150: Interrupt status register A = 0xc0
[   11.969542] tvp5150 4-005d: tvp5150: read 0xc1 = 00
[   11.969547] tvp5150 4-005d: tvp5150: Interrupt enable register A = 0x00
[   11.969702] tvp5150 4-005d: tvp5150: read 0xc2 = 04
[   11.969707] tvp5150 4-005d: tvp5150: Interrupt configuration = 0x04
[   11.969858] tvp5150 4-005d: tvp5150: read 0xc6 = 40
[   11.969863] tvp5150 4-005d: tvp5150: VDP status register = 0x40
[   11.970030] tvp5150 4-005d: tvp5150: read 0xc7 = 00
[   11.970035] tvp5150 4-005d: tvp5150: FIFO word count = 0x00
[   11.970189] tvp5150 4-005d: tvp5150: read 0xc8 = 80
[   11.970194] tvp5150 4-005d: tvp5150: FIFO interrupt threshold = 0x80
[   11.970345] tvp5150 4-005d: tvp5150: read 0xc9 = 00
[   11.970350] tvp5150 4-005d: tvp5150: FIFO reset = 0x00
[   11.970501] tvp5150 4-005d: tvp5150: read 0xca = 00
[   11.970506] tvp5150 4-005d: tvp5150: Line number interrupt = 0x00
[   11.970661] tvp5150 4-005d: tvp5150: read 0xcc = 00
[   11.970830] tvp5150 4-005d: tvp5150: read 0xcb = 4e
[   11.970836] tvp5150 4-005d: tvp5150: Pixel alignment register = 0x004e
[   11.970991] tvp5150 4-005d: tvp5150: read 0xcd = 01
[   11.970996] tvp5150 4-005d: tvp5150: FIFO output control = 0x01
[   11.971159] tvp5150 4-005d: tvp5150: read 0xcf = 00
[   11.971163] tvp5150 4-005d: tvp5150: Full field enable = 0x00
[   11.971314] tvp5150 4-005d: tvp5150: read 0xfc = 7f
[   11.971319] tvp5150 4-005d: tvp5150: Full field mode register = 0x7f
[   11.971490] tvp5150 4-005d: tvp5150: read 0x90 = 00
[   11.971646] tvp5150 4-005d: tvp5150: read 0x91 = 00
[   11.971804] tvp5150 4-005d: tvp5150: read 0x92 = 00
[   11.971809] tvp5150 4-005d: CC   data reg 90 = 00 00 00
[   11.971964] tvp5150 4-005d: tvp5150: read 0x94 = 00
[   11.972117] tvp5150 4-005d: tvp5150: read 0x95 = 00
[   11.972273] tvp5150 4-005d: tvp5150: read 0x96 = 00
[   11.972468] tvp5150 4-005d: tvp5150: read 0x97 = 00
[   11.972639] tvp5150 4-005d: tvp5150: read 0x98 = 00
[   11.972647] tvp5150 4-005d: WSS  data reg 94 = 00 00 00 00 00
[   11.973616] tvp5150 4-005d: tvp5150: read 0x9a = 00
[   11.973770] tvp5150 4-005d: tvp5150: read 0x9b = 00
[   11.973924] tvp5150 4-005d: tvp5150: read 0x9c = 00
[   11.974076] tvp5150 4-005d: tvp5150: read 0x9d = 00
[   11.974234] tvp5150 4-005d: tvp5150: read 0x9e = 00
[   11.974389] tvp5150 4-005d: tvp5150: read 0x9f = 00
[   11.974557] tvp5150 4-005d: tvp5150: read 0xa0 = 00
[   11.974712] tvp5150 4-005d: tvp5150: read 0xa1 = 00
[   11.974718] tvp5150 4-005d: VPS  data reg 9a = 00 00 00 00 00 00 00 00
[   11.974872] tvp5150 4-005d: tvp5150: read 0xa2 = 00
[   11.975033] tvp5150 4-005d: tvp5150: read 0xa3 = 00
[   11.975184] tvp5150 4-005d: tvp5150: read 0xa4 = 00
[   11.975335] tvp5150 4-005d: tvp5150: read 0xa5 = 00
[   11.975340] tvp5150 4-005d: VPS  data reg a2 = 00 00 00 00
[   11.975490] tvp5150 4-005d: tvp5150: read 0xa7 = 00
[   11.975642] tvp5150 4-005d: tvp5150: read 0xa8 = 00
[   11.975796] tvp5150 4-005d: tvp5150: read 0xa9 = 00
[   11.975947] tvp5150 4-005d: tvp5150: read 0xaa = 00
[   11.976104] tvp5150 4-005d: tvp5150: read 0xab = 00
[   11.976258] tvp5150 4-005d: tvp5150: read 0xac = 00
[   11.976409] tvp5150 4-005d: tvp5150: read 0xad = 00
[   11.976560] tvp5150 4-005d: tvp5150: read 0xae = 00
[   11.976566] tvp5150 4-005d: VITC data reg a7 = 00 00 00 00 00 00 00 00
[   11.976719] tvp5150 4-005d: tvp5150: read 0xd0 = ff
[   11.976875] tvp5150 4-005d: tvp5150: read 0xd1 = ff
[   11.977029] tvp5150 4-005d: tvp5150: read 0xd2 = ff
[   11.977183] tvp5150 4-005d: tvp5150: read 0xd3 = ff
[   11.977333] tvp5150 4-005d: tvp5150: read 0xd4 = ff
[   11.977484] tvp5150 4-005d: tvp5150: read 0xd5 = ff
[   11.977634] tvp5150 4-005d: tvp5150: read 0xd6 = ff
[   11.977786] tvp5150 4-005d: tvp5150: read 0xd7 = ff
[   11.977792] tvp5150 4-005d: Line mode reg d0 = ff ff ff ff ff ff ff ff
[   11.977946] tvp5150 4-005d: tvp5150: read 0xd8 = ff
[   11.978097] tvp5150 4-005d: tvp5150: read 0xd9 = ff
[   11.978247] tvp5150 4-005d: tvp5150: read 0xda = ff
[   11.978398] tvp5150 4-005d: tvp5150: read 0xdb = ff
[   11.978548] tvp5150 4-005d: tvp5150: read 0xdc = ff
[   11.978704] tvp5150 4-005d: tvp5150: read 0xdd = ff
[   11.978855] tvp5150 4-005d: tvp5150: read 0xde = ff
[   11.979011] tvp5150 4-005d: tvp5150: read 0xdf = ff
[   11.979016] tvp5150 4-005d: Line mode reg d8 = ff ff ff ff ff ff ff ff
[   11.979203] tvp5150 4-005d: tvp5150: read 0xe0 = ff
[   11.979354] tvp5150 4-005d: tvp5150: read 0xe1 = ff
[   11.979502] tvp5150 4-005d: tvp5150: read 0xe2 = ff
[   11.979657] tvp5150 4-005d: tvp5150: read 0xe3 = ff
[   11.979809] tvp5150 4-005d: tvp5150: read 0xe4 = ff
[   11.979970] tvp5150 4-005d: tvp5150: read 0xe5 = ff
[   11.980127] tvp5150 4-005d: tvp5150: read 0xe6 = ff
[   11.980288] tvp5150 4-005d: tvp5150: read 0xe7 = ff
[   11.980294] tvp5150 4-005d: Line mode reg e0 = ff ff ff ff ff ff ff ff
[   11.980445] tvp5150 4-005d: tvp5150: read 0xe8 = ff
[   11.980596] tvp5150 4-005d: tvp5150: read 0xe9 = ff
[   11.980764] tvp5150 4-005d: tvp5150: read 0xea = ff
[   11.981170] tvp5150 4-005d: tvp5150: read 0xeb = ff
[   11.981326] tvp5150 4-005d: tvp5150: read 0xec = ff
[   11.981477] tvp5150 4-005d: tvp5150: read 0xed = ff
[   11.981632] tvp5150 4-005d: tvp5150: read 0xee = ff
[   11.981783] tvp5150 4-005d: tvp5150: read 0xef = ff
[   11.981789] tvp5150 4-005d: Line mode reg e8 = ff ff ff ff ff ff ff ff
[   11.981944] tvp5150 4-005d: tvp5150: read 0xf0 = ff
[   11.982100] tvp5150 4-005d: tvp5150: read 0xf1 = ff
[   11.982256] tvp5150 4-005d: tvp5150: read 0xf2 = ff
[   11.982411] tvp5150 4-005d: tvp5150: read 0xf3 = ff
[   11.982561] tvp5150 4-005d: tvp5150: read 0xf4 = ff
[   11.982716] tvp5150 4-005d: tvp5150: read 0xf5 = ff
[   11.982867] tvp5150 4-005d: tvp5150: read 0xf6 = ff
[   11.983022] tvp5150 4-005d: tvp5150: read 0xf7 = ff
[   11.983028] tvp5150 4-005d: Line mode reg f0 = ff ff ff ff ff ff ff ff
[   11.983183] tvp5150 4-005d: tvp5150: read 0xf8 = ff
[   11.983334] tvp5150 4-005d: tvp5150: read 0xf9 = ff
[   11.983490] tvp5150 4-005d: tvp5150: read 0xfa = ff
[   11.983495] tvp5150 4-005d: Line mode reg f8 = ff ff ff
[   14.154157] vin3a: Port A: Using subdev tvp5150 4-005d for capture
[   14.184408] vin3a: subdev tvp5150 4-005d: code: 2006 idx: 0
[   16.304613] tvp5150 4-005d: width = 720, height = 288

B5. Yavta does not work:

 dmesg_log_after_yavta.log

dmesg_log_after_yavta.log
root@am57xx-evm:~# yavta -c10 -fUYVY -Fout_test.yuv -s720x288 /dev/video1
Device /dev/video1 opened.
Device `vip' on `platform:vip2:vin3a:stream0' is a video output (without mplanes) device.
Video format set: UYVY (59565955) 720x288 (stride 1440) field none buffer size 414720
Video format: UYVY (59565955) 720x288 (stride 1440) field none buffer size 414720
8 buffers requested.
length: 414720 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xb6e26000.
length: 414720 offset: 417792 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0xb6dc0000.
length: 414720 offset: 835584 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0xb6d5a000.
length: 414720 offset: 1253376 timestamp type/source: mono/EoF
Buffer 3/0 mapped at address 0xb6cf4000.
length: 414720 offset: 1671168 timestamp type/source: mono/EoF
Buffer 4/0 mapped at address 0xb6c8e000.
length: 414720 offset: 2088960 timestamp type/source: mono/EoF
Buffer 5/0 mapped at address 0xb6c28000.
length: 414720 offset: 2506752 timestamp type/source: mono/EoF
Buffer 6/0 mapped at address 0xb6bc2000.
length: 414720 offset: 2924544 timestamp type/source: mono/EoF
Buffer 7/0 mapped at address 0xb6b5c000.
^C
root@am57xx-evm:~# dmesg
[  328.311529] vin3a-0: vip_open
[  328.311554] tvp5150 4-005d: width = 720, height = 288
[  328.311562] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
[  328.311574] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.311582] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.311587] vin3a-0: init_stream vpdma data type: 0x27
[  328.311595] vin3a-0: vip_init_stream: stream instance 0xc0bb2874ed237000
[  328.312180] vin3a-0: s_fmt input fourcc:UYVY size: 720x288 bpl:0 img_size:0
[  328.312188] vin3a-0: try_fmt fourcc:UYVY size: 720x288
[  328.312197] vin3a-0: try_fmt loop:0 fourcc:UYVY size: 720x288
[  328.312203] vin3a-0: try_fmt loop:0 found new larger: 720x288
[  328.312209] vin3a-0: try_fmt loop:0 found at least larger: 720x288
[  328.312214] vin3a-0: try_fmt loop:0 found new best: 720x288
[  328.312220] vin3a-0: try_fmt loop:0 found direct match: 720x288
[  328.312227] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.312233] vin3a-0: s_fmt try_fmt fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.312240] vin3a-0: s_fmt fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  328.312246] vin3a-0: s_fmt pix_to_mbus mbus_code: 2006 size: 720x288
[  328.312254] tvp5150 4-005d: width = 720, height = 288
[  328.312261] vin3a-0: s_fmt subdev fmt mbus_code: 2006 size: 720x288
[  328.312266] vin3a-0: s_fmt vpdma data type: 0x27
[  328.312490] vin3a-0: g_fmt fourcc:UYVY code: 2006 size: 720x288 bpl:1440 img_size:414720
[  328.312496] vin3a-0: g_fmt vpdma data type: 0x27
[  328.312706] vin3a-0: get 8 buffer(s) of size 414720 each.
[  328.319513] vin3: vip_set_slice_path:
[  328.319523] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[  328.319528] vin3: vip_set_slice_path:
[  328.319534] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[  328.319811] vin3: vip_setup_parser: EMBEDDED_SYNC_SINGLE_YUV422
[  328.319816] vin3: vip_setup_parser: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422
[  328.319821] vin3: vip_setup_parser: VIP_PIXCLK_EDGE_POLARITY=0
[  328.320119] tvp5150 4-005d: tvp5150: read 0x03 = 6b
[  328.320128] tvp5150 4-005d: tvp5150: writing 03 6b
[  328.320290] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:0
[  328.321418] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:1
[  347.591677] vin3a-0: vip_release
[  347.591688] vin3a-0: vip_stop_streaming:
[  347.591697] vin3: vip_set_slice_path:
[  347.591705] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[  347.591710] vin3: vip_set_slice_path:
[  347.591717] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[  347.592014] tvp5150 4-005d: tvp5150: read 0x03 = 6b
[  347.592023] tvp5150 4-005d: tvp5150: writing 03 62
[  347.592211] vin3a-0: Clear channel no: 38
[  347.592797] vin3a-0: vip_release_stream: stream instance 0x00000008ed237000
[  347.592804] vin3a: vip_release_port: port instance 0xeda3fe40ed208810
root@am57xx-evm:~# 

-------------------------------------------------------------------------------------------------
root@am57xx-evm:~# yavta -c10 -fYUYV -Fout_test.yuv -s720x288 /dev/video1
Device /dev/video1 opened.
Device `vip' on `platform:vip2:vin3a:stream0' is a video output (without mplanes) device.
Video format set: YUYV (56595559) 720x288 (stride 1440) field none buffer size 414720
Video format: YUYV (56595559) 720x288 (stride 1440) field none buffer size 414720
8 buffers requested.
length: 414720 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xb6ddb000.
length: 414720 offset: 417792 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0xb6d75000.
length: 414720 offset: 835584 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0xb6d0f000.
length: 414720 offset: 1253376 timestamp type/source: mono/EoF
Buffer 3/0 mapped at address 0xb6ca9000.
length: 414720 offset: 1671168 timestamp type/source: mono/EoF
Buffer 4/0 mapped at address 0xb6c43000.
length: 414720 offset: 2088960 timestamp type/source: mono/EoF
Buffer 5/0 mapped at address 0xb6bdd000.
length: 414720 offset: 2506752 timestamp type/source: mono/EoF
Buffer 6/0 mapped at address 0xb6b77000.
length: 414720 offset: 2924544 timestamp type/source: mono/EoF
Buffer 7/0 mapped at address 0xb6b11000.
^C
root@am57xx-evm:~# dmesg
[  489.396883] vin3a-0: vip_open
[  489.396908] tvp5150 4-005d: width = 720, height = 288
[  489.396917] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
[  489.396929] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  489.396936] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
[  489.396942] vin3a-0: init_stream vpdma data type: 0x27
[  489.396950] vin3a-0: vip_init_stream: stream instance 0xc0bb2874ed237000
[  489.397122] vin3a-0: s_fmt input fourcc:YUYV size: 720x288 bpl:0 img_size:0
[  489.397129] vin3a-0: try_fmt fourcc:YUYV size: 720x288
[  489.397138] vin3a-0: try_fmt loop:0 fourcc:YUYV size: 720x288
[  489.397145] vin3a-0: try_fmt loop:0 found new larger: 720x288
[  489.397152] vin3a-0: try_fmt loop:0 found at least larger: 720x288
[  489.397159] vin3a-0: try_fmt loop:0 found new best: 720x288
[  489.397167] vin3a-0: try_fmt loop:0 found direct match: 720x288
[  489.397174] vin3a: calc_format_size: fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
[  489.397182] vin3a-0: s_fmt try_fmt fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
[  489.397190] vin3a-0: s_fmt fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
[  489.397196] vin3a-0: s_fmt pix_to_mbus mbus_code: 2006 size: 720x288
[  489.397205] tvp5150 4-005d: width = 720, height = 288
[  489.397211] vin3a-0: s_fmt subdev fmt mbus_code: 2006 size: 720x288
[  489.397217] vin3a-0: s_fmt vpdma data type: 0x07
[  489.397284] vin3a-0: g_fmt fourcc:YUYV code: 2006 size: 720x288 bpl:1440 img_size:414720
[  489.397289] vin3a-0: g_fmt vpdma data type: 0x07
[  489.397347] vin3a-0: get 8 buffer(s) of size 414720 each.
[  489.401221] vin3: vip_set_slice_path:
[  489.401231] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[  489.401238] vin3: vip_set_slice_path:
[  489.401246] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[  489.401523] vin3: vip_setup_parser: EMBEDDED_SYNC_SINGLE_YUV422
[  489.401532] vin3: vip_setup_parser: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422
[  489.401537] vin3: vip_setup_parser: VIP_PIXCLK_EDGE_POLARITY=0
[  489.401777] tvp5150 4-005d: tvp5150: read 0x03 = 62
[  489.401788] tvp5150 4-005d: tvp5150: writing 03 6b
[  489.401930] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:0
[  489.403063] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:1
[  494.081846] vin3a-0: vip_release
[  494.081858] vin3a-0: vip_stop_streaming:
[  494.081868] vin3: vip_set_slice_path:
[  494.081877] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[  494.081882] vin3: vip_set_slice_path:
[  494.081888] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[  494.082126] tvp5150 4-005d: tvp5150: read 0x03 = 6b
[  494.082134] tvp5150 4-005d: tvp5150: writing 03 62
[  494.082297] vin3a-0: Clear channel no: 38
[  494.082863] vin3a-0: vip_release_stream: stream instance 0x00000008ed237000
[  494.082871] vin3a: vip_release_port: port instance 0xeda133c0ed208810




B6. No image using gstreamer:

gst-launch-1.0 v4l2src device = / dev / video1 io-mode = 4! 'video / x-raw, format = (string) YUY2, width = (int) 720, height = (int) 288'! waylandsink use-drm = true

dmesg_log_after_gstreamer.logdmesg_log_after_gstreamer.log

 

B7. yavta and gstreamer don't work equally

B8. When running yavta or gstreamer, there are no interrupts (cat / proc / interrupts | grep vi)

log_interrupts.log

log_interrupts.log
102:          0          0      CBAR 352 Level     vin3
103:          0          0      CBAR 393 Level     vin4

The second questionHow to display an video for BT.656?

<=====================================================================================>

Many respected experts from TI. Please help me, because I am in a deadlock.

  • Hello,

    Butko Oleg43 said:
    The first question. How can I eliminate the image shift, ie remove the black bars on the left and on the top?

    Is this interlaced or it is progressive?

    Have you tried to add vpe element in the pipeline?

    Butko Oleg43 said:
    When running yavta or gstreamer, there are no interrupts (cat / proc / interrupts | grep vi)

    Please refer this guide :

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components_Kernel_Drivers.html#vip

    "Why I am not seeing any interrupt generated from the sensor?"

    In additional please refer the below txts in kernel documentation folder:

    video-interfaces.txt and tvp5150.txt

    Hope this helps.


    Best regards,

    Margarita

  • Margarita Gashova said:

    Is this interlaced or it is progressive?

    Hello Margarita, Video is interlaced. The script that I gave above, I made specifically for simplification.

    Margarita Gashova said:

    Have you tried to add vpe element in the pipeline?

     And of course I used VPE and VPE does not solve my problem.

    Below I attach the log and the resulting image:
      gst-launch-1.0 v4l2src device = / dev / video1 io-mode = 4! 'video / x-raw, format = (string) NV12, width = (int) 720, height = (int) 288'! vpe num-input-buffers = 8! 'video / x-raw, format = (string) NV12, width = (int) 720, height = (int) 576'! queue! waylandsink use-drm = true

    gst-launch-1.0_with_vpe.log

    Margarita Gashova said:

    Please refer this guide :

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components_Kernel_Drivers.html#vip

    From this link I started a month ago, I didn’t find a solution to my problem.

    PS.Why I am not seeing any interrupt generated from the sensor?

    Not getting any interrupts usually means the module is not receiving/detecting video data. To proceed with debugging, probe the pclk, vysnc and hsync signal at the connector. If they look as what you are expecting, then verify the pinmux.

    I checked pclk using an oscilloscope, pclk works correctly
    vsync and hsync signal is not used in bt.656

    8308.mux_data.h2806.patch.mux_data.h  In these files for bt.656 mode, I do not see an error. Because for external sync mode, this file is working.

    Margarita Gashova said:

    In additional please refer the below txts in kernel documentation folder:

    video-interfaces.txt and tvp5150.txt

    I have studied these files (

    ti-vpe.txt
    Texas Instruments DRA7x VIDEO PROCESSING ENGINE (VPE)
    ------------------------------------------------------
    
    The Video Processing Engine (VPE) is a key component for image post
    processing applications. VPE consist of a single memory to memory
    path which can perform chroma up/down sampling, deinterlacing,
    scaling and color space conversion.
    
    Required properties:
    - compatible: must be "ti,vpe"
    - reg:	physical base address and length of the registers set for the 8
    	memory regions required;
    - reg-names: name associated with the memory regions described is <reg>;
    - interrupts: should contain IRQ line for VPE;
    
    Example:
    	vpe {
    		compatible = "ti,vpe";
    		ti,hwmods = "vpe";
    		clocks = <&dpll_core_h23x2_ck>;
    		clock-names = "fck";
    		reg =	<0x489d0000 0x120>,
    			<0x489d0300 0x20>,
    			<0x489d0400 0x20>,
    			<0x489d0500 0x20>,
    			<0x489d0600 0x3c>,
    			<0x489d0700 0x80>,
    			<0x489d5700 0x18>,
    			<0x489dd000 0x400>;
    		reg-names =	"vpe_top",
    				"vpe_chr_us0",
    				"vpe_chr_us1",
    				"vpe_chr_us2",
    				"vpe_dei",
    				"sc",
    				"csc",
    				"vpdma";
    		interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>;
    		#address-cells = <1>;
    		#size-cells = <0>;
    	};
    
    ti-vip.txt
    Texas Instruments DRA7x VIDEO INPUT PORT (VIP)
    ----------------------------------------------
    
    The Video Input Port (VIP) is a key component for image capture
    applications. The capture module provides the system interface and the
    processing capability to connect parallel image-sensor as well as
    BT.656/1120 capable encoder chip.
    
    Required properties:
    - compatible: must be "ti,vip1", "ti,vip2" or "ti,vip3".
    - reg:	VIP top level, parser, colorspace converter, scaler for slice 0 and 1
    	and vpdma memory address space;
    - reg-names: vip, parser0, csc0, sc0, parser1, csc1, sc1 and vpdma registers;
    - interrupts: should contain IRQ line for VIP;
    - syscon-pol: phandle to the device control module;
    
    VIP supports 2 slices. Each slice can handle up to 2 camera port nodes.
    Each port nodes should contain a 'port' child node with child 'endpoint'
    node. Please refer to the bindings defined in
    Documentation/devicetree/bindings/media/video-interfaces.txt.
    
    Example:
    	vip1: vip@0x48970000 {
    		compatible = "ti,vip1";
    		reg = <0x48970000 0x114>,
    		      <0x48975500 0xD8>,
    		      <0x48975700 0x18>,
    		      <0x48975800 0x80>,
    		      <0x48975a00 0xD8>,
    		      <0x48975c00 0x18>,
    		      <0x48975d00 0x80>,
    		      <0x4897d000 0x400>;
    		reg-names = "vip",
    			    "parser0",
    			    "csc0",
    			    "sc0",
    			    "parser1",
    			    "csc1",
    			    "sc1",
    			    "vpdma";
    		ti,hwmods = "vip1";
    		interrupts = <GIC_SPI 351 IRQ_TYPE_LEVEL_HIGH>,
    			     <GIC_SPI 392 IRQ_TYPE_LEVEL_HIGH>;
    		/* CTRL_CORE_SMA_SW_1 */
    		syscon-pol = <&scm_conf 0x534>;
    		#address-cells = <1>;
    		#size-cells = <0>;
    		status = "disabled";
    		vin1a: port@0 {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			reg = <0>;
    			status = "disabled";
    			endpoint@0 {
    				slave-mode;
    				remote-endpoint = <&camera1>;
    			};
    		};
    		vin2a: port@1 {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			reg = <1>;
    			status = "disabled";
    		};
    		vin1b: port@2 {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			reg = <2>;
    			status = "disabled";
    		};
    		vin2b: port@3 {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			reg = <3>;
    			status = "disabled";
    		};
    	};
    
    	i2c5: i2c@4807c000 {
    		ov10633@37 {
    			compatible = "ovti,ov10633";
    			reg = <0x37>;
    
    			mux-gpios = <&pcf_hdmi 3 GPIO_ACTIVE_LOW>;
    			port {
    				camera1: endpoint {
    					remote-endpoint = <&vin1a>;
    					hsync-active = <1>;
    					vsync-active = <1>;
    					pclk-sample = <0>;
    				};
    			};
    		};
    	};
    
    video-interfaces.txt
    Common bindings for video receiver and transmitter interfaces
    
    General concept
    ---------------
    
    Video data pipelines usually consist of external devices, e.g. camera sensors,
    controlled over an I2C, SPI or UART bus, and SoC internal IP blocks, including
    video DMA engines and video data processors.
    
    SoC internal blocks are described by DT nodes, placed similarly to other SoC
    blocks.  External devices are represented as child nodes of their respective
    bus controller nodes, e.g. I2C.
    
    Data interfaces on all video devices are described by their child 'port' nodes.
    Configuration of a port depends on other devices participating in the data
    transfer and is described by 'endpoint' subnodes.
    
    device {
    	...
    	ports {
    		#address-cells = <1>;
    		#size-cells = <0>;
    
    		port@0 {
    			...
    			endpoint@0 { ... };
    			endpoint@1 { ... };
    		};
    		port@1 { ... };
    	};
    };
    
    If a port can be configured to work with more than one remote device on the same
    bus, an 'endpoint' child node must be provided for each of them.  If more than
    one port is present in a device node or there is more than one endpoint at a
    port, or port node needs to be associated with a selected hardware interface,
    a common scheme using '#address-cells', '#size-cells' and 'reg' properties is
    used.
    
    All 'port' nodes can be grouped under optional 'ports' node, which allows to
    specify #address-cells, #size-cells properties independently for the 'port'
    and 'endpoint' nodes and any child device nodes a device might have.
    
    Two 'endpoint' nodes are linked with each other through their 'remote-endpoint'
    phandles.  An endpoint subnode of a device contains all properties needed for
    configuration of this device for data exchange with other device.  In most
    cases properties at the peer 'endpoint' nodes will be identical, however they
    might need to be different when there is any signal modifications on the bus
    between two devices, e.g. there are logic signal inverters on the lines.
    
    It is allowed for multiple endpoints at a port to be active simultaneously,
    where supported by a device.  For example, in case where a data interface of
    a device is partitioned into multiple data busses, e.g. 16-bit input port
    divided into two separate ITU-R BT.656 8-bit busses.  In such case bus-width
    and data-shift properties can be used to assign physical data lines to each
    endpoint node (logical bus).
    
    
    Required properties
    -------------------
    
    If there is more than one 'port' or more than one 'endpoint' node or 'reg'
    property is present in port and/or endpoint nodes the following properties
    are required in a relevant parent node:
    
     - #address-cells : number of cells required to define port/endpoint
    		    identifier, should be 1.
     - #size-cells    : should be zero.
    
    Optional endpoint properties
    ----------------------------
    
    - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
    - slave-mode: a boolean property indicating that the link is run in slave mode.
      The default when this property is not specified is master mode. In the slave
      mode horizontal and vertical synchronization signals are provided to the
      slave device (data source) by the master device (data sink). In the master
      mode the data source device is also the source of the synchronization signals.
    - bus-type: data bus type. Possible values are:
      0 - autodetect based on other properties (MIPI CSI-2 D-PHY, parallel or Bt656)
      1 - MIPI CSI-2 C-PHY
      2 - MIPI CSI1
      3 - CCP2
    - bus-width: number of data lines actively used, valid for the parallel busses.
    - data-shift: on the parallel data busses, if bus-width is used to specify the
      number of data lines, data-shift can be used to specify which data lines are
      used, e.g. "bus-width=<8>; data-shift=<2>;" means, that lines 9:2 are used.
    - hsync-active: active state of the HSYNC signal, 0/1 for LOW/HIGH respectively.
    - vsync-active: active state of the VSYNC signal, 0/1 for LOW/HIGH respectively.
      Note, that if HSYNC and VSYNC polarities are not specified, embedded
      synchronization may be required, where supported.
    - data-active: similar to HSYNC and VSYNC, specifies data line polarity.
    - field-even-active: field signal level during the even field data transmission.
    - num-channels: for time multiplexed multi channel video signal, this property
      specifies number of channels multiplexed.
    - pclk-sample: sample data on rising (1) or falling (0) edge of the pixel clock
      signal.
    - sync-on-green-active: active state of Sync-on-green (SoG) signal, 0/1 for
      LOW/HIGH respectively.
    - data-lanes: an array of physical data lane indexes. Position of an entry
      determines the logical lane number, while the value of an entry indicates
      physical lane, e.g. for 2-lane MIPI CSI-2 bus we could have
      "data-lanes = <1 2>;", assuming the clock lane is on hardware lane 0.
      This property is valid for serial busses only (e.g. MIPI CSI-2).
    - clock-lanes: an array of physical clock lane indexes. Position of an entry
      determines the logical lane number, while the value of an entry indicates
      physical lane, e.g. for a MIPI CSI-2 bus we could have "clock-lanes = <0>;",
      which places the clock lane on hardware lane 0. This property is valid for
      serial busses only (e.g. MIPI CSI-2). Note that for the MIPI CSI-2 bus this
      array contains only one entry.
    - clock-noncontinuous: a boolean property to allow MIPI CSI-2 non-continuous
      clock mode.
    - link-frequencies: Allowed data bus frequencies. For MIPI CSI-2, for
      instance, this is the actual frequency of the bus, not bits per clock per
      lane value. An array of 64-bit unsigned integers.
    - lane-polarities: an array of polarities of the lanes starting from the clock
      lane and followed by the data lanes in the same order as in data-lanes.
      Valid values are 0 (normal) and 1 (inverted). The length of the array
      should be the combined length of data-lanes and clock-lanes properties.
      If the lane-polarities property is omitted, the value must be interpreted
      as 0 (normal). This property is valid for serial busses only.
    - strobe: Whether the clock signal is used as clock (0) or strobe (1). Used
      with CCP2, for instance.
    
    Example
    -------
    
    The example snippet below describes two data pipelines.  ov772x and imx074 are
    camera sensors with a parallel and serial (MIPI CSI-2) video bus respectively.
    Both sensors are on the I2C control bus corresponding to the i2c0 controller
    node.  ov772x sensor is linked directly to the ceu0 video host interface.
    imx074 is linked to ceu0 through the MIPI CSI-2 receiver (csi2). ceu0 has a
    (single) DMA engine writing captured data to memory.  ceu0 node has a single
    'port' node which may indicate that at any time only one of the following data
    pipelines can be active: ov772x -> ceu0 or imx074 -> csi2 -> ceu0.
    
    	ceu0: ceu@0xfe910000 {
    		compatible = "renesas,sh-mobile-ceu";
    		reg = <0xfe910000 0xa0>;
    		interrupts = <0x880>;
    
    		mclk: master_clock {
    			compatible = "renesas,ceu-clock";
    			#clock-cells = <1>;
    			clock-frequency = <50000000>;	/* Max clock frequency */
    			clock-output-names = "mclk";
    		};
    
    		port {
    			#address-cells = <1>;
    			#size-cells = <0>;
    
    			/* Parallel bus endpoint */
    			ceu0_1: endpoint@1 {
    				reg = <1>;		/* Local endpoint # */
    				remote = <&ov772x_1_1>;	/* Remote phandle */
    				bus-width = <8>;	/* Used data lines */
    				data-shift = <2>;	/* Lines 9:2 are used */
    
    				/* If hsync-active/vsync-active are missing,
    				   embedded BT.656 sync is used */
    				hsync-active = <0>;	/* Active low */
    				vsync-active = <0>;	/* Active low */
    				data-active = <1>;	/* Active high */
    				pclk-sample = <1>;	/* Rising */
    			};
    
    			/* MIPI CSI-2 bus endpoint */
    			ceu0_0: endpoint@0 {
    				reg = <0>;
    				remote = <&csi2_2>;
    			};
    		};
    	};
    
    	i2c0: i2c@0xfff20000 {
    		...
    		ov772x_1: camera@0x21 {
    			compatible = "ovti,ov772x";
    			reg = <0x21>;
    			vddio-supply = <&regulator1>;
    			vddcore-supply = <&regulator2>;
    
    			clock-frequency = <20000000>;
    			clocks = <&mclk 0>;
    			clock-names = "xclk";
    
    			port {
    				/* With 1 endpoint per port no need for addresses. */
    				ov772x_1_1: endpoint {
    					bus-width = <8>;
    					remote-endpoint = <&ceu0_1>;
    					hsync-active = <1>;
    					vsync-active = <0>; /* Who came up with an
    							       inverter here ?... */
    					data-active = <1>;
    					pclk-sample = <1>;
    				};
    			};
    		};
    
    		imx074: camera@0x1a {
    			compatible = "sony,imx074";
    			reg = <0x1a>;
    			vddio-supply = <&regulator1>;
    			vddcore-supply = <&regulator2>;
    
    			clock-frequency = <30000000>;	/* Shared clock with ov772x_1 */
    			clocks = <&mclk 0>;
    			clock-names = "sysclk";		/* Assuming this is the
    							   name in the datasheet */
    			port {
    				imx074_1: endpoint {
    					clock-lanes = <0>;
    					data-lanes = <1 2>;
    					remote-endpoint = <&csi2_1>;
    				};
    			};
    		};
    	};
    
    	csi2: csi2@0xffc90000 {
    		compatible = "renesas,sh-mobile-csi2";
    		reg = <0xffc90000 0x1000>;
    		interrupts = <0x17a0>;
    		#address-cells = <1>;
    		#size-cells = <0>;
    
    		port@1 {
    			compatible = "renesas,csi2c";	/* One of CSI2I and CSI2C. */
    			reg = <1>;			/* CSI-2 PHY #1 of 2: PHY_S,
    							   PHY_M has port address 0,
    							   is unused. */
    			csi2_1: endpoint {
    				clock-lanes = <0>;
    				data-lanes = <2 1>;
    				remote-endpoint = <&imx074_1>;
    			};
    		};
    		port@2 {
    			reg = <2>;			/* port 2: link to the CEU */
    
    			csi2_2: endpoint {
    				remote-endpoint = <&ceu0_0>;
    			};
    		};
    	};
    
    tvp5150.txt
    * Texas Instruments TVP5150 and TVP5151 video decoders
    
    The TVP5150 and TVP5151 are video decoders that convert baseband NTSC and PAL
    (and also SECAM in the TVP5151 case) video signals to either 8-bit 4:2:2 YUV
    with discrete syncs or 8-bit ITU-R BT.656 with embedded syncs output formats.
    
    Required Properties:
    - compatible: value must be "ti,tvp5150"
    - reg: I2C slave address
    
    Optional Properties:
    - pdn-gpios: phandle for the GPIO connected to the PDN pin, if any.
    - reset-gpios: phandle for the GPIO connected to the RESETB pin, if any.
    
    The device node must contain one 'port' child node for its digital output
    video port, in accordance with the video interface bindings defined in
    Documentation/devicetree/bindings/media/video-interfaces.txt.
    
    Required Endpoint Properties for parallel synchronization:
    
    - hsync-active: active state of the HSYNC signal. Must be <1> (HIGH).
    - vsync-active: active state of the VSYNC signal. Must be <1> (HIGH).
    - field-even-active: field signal level during the even field data
      transmission. Must be <0>.
    
    If none of hsync-active, vsync-active and field-even-active is specified,
    the endpoint is assumed to use embedded BT.656 synchronization.
    
    Example:
    
    &i2c2 {
    	...
    	tvp5150@5c {
    		compatible = "ti,tvp5150";
    		reg = <0x5c>;
    		pdn-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>;
    		reset-gpios = <&gpio6 7 GPIO_ACTIVE_LOW>;
    
    		port {
    			tvp5150_1: endpoint {
    				remote-endpoint = <&ccdc_ep>;
    			};
    		};
    	};
    };
    
     ) before writing the cam-tvp5150.dtso file. In my opinion, cam-tvp5150_ex_sync.dtso.tar.gz and cam-tvp5150_bt656.dtso.tar.gz written correctly for both synchronization cases.

    What else can I try?

  • Hello,

    I will recommend you to write the captured video in a file and check if the black strip is coming from display or camera itslef is streaming the content with black strip.
    You could do this by replacing waylandsink with filesink location=<path and file name> .

    BR
    Margarita
  • Margarita Gashova said:
    I will recommend you to write the captured video in a file and check if the black strip is coming from display or camera itslef is streaming the content with black strip.
    You could do this by replacing waylandsink with filesink location=<path and file name> .

    Margarita, you probably did not notice that in the first message I attached a file recorded with the help of the yavta.

    yavta -c10 -fYUYV -Fout_test.yuv -s720x288 / dev / video1

    4628.out_test.yuv.tar.gz

    If you play this file, then black strip is also visible on it.

    To play it on pc I used: ffplay -f rawvideo -pix_fmt yuyv422 -video_size 720x288 -framerate 25 -i out_test.yuv

    But for reliability, I will record using gsremer.

    gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=10 io-mode=4 ! 'video/x-raw,format=(string)NV12, width=(int)720, height=(int)288' ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)NV12, width=(int)720, height=(int)576' ! queue ! filesink location=out_gst_test

    out_gst_test.tar.gz

    All videos show black strip.

    This means the black strip does not come from the display, but I know for sure that the camera that broadcasts analog video to me is also ok. Maybe problems in vip or tvp5150 drivers?

    Margarita Gashova said:
    black strip is coming from display

    what does this mean?

  • What is the input interface that you are using? Is it discrete/separate sync interface?
    In that case, it is possible that VIP might be capturing blanking data, that should be trimmed off. Can you please check approximately how many the number of lines/pixels present?

    Rgds,
    Brijesh
  • Brijesh Jadav said:
    Is it discrete/separate sync interface?

    I use discrete sync.
    If I'm not mistaken, then bt.470

    Brijesh Jadav said:
    Can you please check approximately how many the number of lines/pixels present?

    If we take the image proportions. Image resolution 720x576. 41 black dots on top, 141 to the left.
    720-41х576-141 <=> 679x435.
    Is this answer appropriate?

  • Hi,

    It is very near to the blanking portion for NTSC/PAL resolution.
    In discrete sync capture, VIP capture entire frame including blanking portion. Which is why you are seeing these black stripes.
    You could either removed them in the code or can remove in the VIP itself. VIP parser has some trim register, you could use them to remove this blanking portion..

    Rgds,
    Brijesh
  • Brijesh Jadav said:
    in the VIP itself. VIP parser has some trim register, you could use them to remove this blanking portion..

    Can this be done in 0317.vip.c?

    static int vip_set_crop_parser(struct vip_port *port)
    {
    	struct vip_dev *dev = port->dev;
    	struct vip_parser_data *parser = dev->parser;
    	u32 hcrop = 0, vcrop = 0;
    	u32 width = port->mbus_framefmt.width;
    
    	if (port->fmt->vpdma_fmt[0] == &vpdma_raw_fmts[VPDMA_DATA_FMT_RAW8]) {
    		/*
    		 * Special case since we are faking a YUV422 16bit format
    		 * to have the vpdma perform the needed byte swap
    		 * we need to adjust the pixel width accordingly
    		 * otherwise the parser will attempt to collect more pixels
    		 * then available and the vpdma transfer will exceed the
    		 * allocated frame buffer.
    		 */
    		width >>= 1;
    		vip_dbg(1, port, "%s: 8 bit raw detected, adjusting width to %d\n",
    			__func__, width);
    	}
    
    	/*
    	 * Set Parser Crop parameters to source size otherwise
    	 * scaler and colorspace converter will yield garbage.
    	 */
    	hcrop = VIP_ACT_BYPASS;
    	insert_field(&hcrop, 0, VIP_ACT_SKIP_NUMPIX_MASK,
    		     VIP_ACT_SKIP_NUMPIX_SHFT);
    	insert_field(&hcrop, width,
    		     VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
    	reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);
    
    	insert_field(&vcrop, 0, VIP_ACT_SKIP_NUMLINES_MASK,
    		     VIP_ACT_SKIP_NUMLINES_SHFT);
    	insert_field(&vcrop, port->mbus_framefmt.height,
    		     VIP_ACT_USE_NUMLINES_MASK, VIP_ACT_USE_NUMLINES_SHFT);
    	reg_write(parser, VIP_PARSER_CROP_V_PORT(port->port_id), vcrop);
    
    	return 0;
    }

    In this function?

    Please give an example and documentation.

  • Well, i don't have example, but you could the position and size in vip_set_crop_parser function.

    insert_field(&hcrop, 0, VIP_ACT_SKIP_NUMPIX_MASK,
    VIP_ACT_SKIP_NUMPIX_SHFT);
    insert_field(&vcrop, 0, VIP_ACT_SKIP_NUMLINES_MASK,
    VIP_ACT_SKIP_NUMLINES_SHFT);

    to

    insert_field(&hcrop, 138, VIP_ACT_SKIP_NUMPIX_MASK,
    VIP_ACT_SKIP_NUMPIX_SHFT);
    insert_field(&vcrop, 20, VIP_ACT_SKIP_NUMLINES_MASK,
    VIP_ACT_SKIP_NUMLINES_SHFT);

    Rgds,
    Brijesh
  • Brijesh Jadav said:
    insert_field(&hcrop, 138, VIP_ACT_SKIP_NUMPIX_MASK,
    VIP_ACT_SKIP_NUMPIX_SHFT);
    insert_field(&vcrop, 20, VIP_ACT_SKIP_NUMLINES_MASK,
    VIP_ACT_SKIP_NUMLINES_SHFT);

    I understood, I will try now.

  • Brijesh Yadav, thank you so much.

    Your way works.

    I still have two questions.
    1. How to completely remove the black bars on the left and right?
    2. Returning to the first post. Why does not work video reception in bt.656 mode?

  • Hi,

    Are you sure that the black bars are not present in the original video? If the horizontal line size is 720, then there should not be any black bars, so looks like it is coming from the original video itself.

    Regarding BT656, what issue are you facing? Does it capture or it doesnot at all?
    For BT656, there is only one config change, sync type should be changed to embedded sync, essentially below code should be executed.

    if (vip_is_mbuscode_rgb(port->fmt->code)) {
    sync_type = EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444;
    //DeVdistress
    vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444\n", "vip_setup_parser");
    }

    After this, you need to make sure decoder TVP is outputting in embedded sync format.

    Regards,
    Brijesh
  • The issue with black stripes is not the highest priority now, it can be resolved last.

    I wrote about the bt.656 mode earlier.

    Butko Oleg43 said:

    B4. tvp5150 detected by the system: ( Log v4l2-ctl - all -d / dev / video1 -V )

    out_v4l2-ctl.log

    dmesg> dmesg_common_log.log:

     dmesg_common_log.log

    dmesg | grep vin> dmesg_vin_log.log

     dmesg_vin_log.log

    dmesg | grep tvp> dmesg_tvp_log.log

     dmesg_tvp_log.log

    Butko Oleg43 said:

    B8. When running yavta or gstreamer, there are no interrupts (cat / proc / interrupts | grep vi)

    log_interrupts.log

    The second questionHow to display an video for BT.656?

    If look at the launch log yavta. 

    4213.dmesg_log_after_yavta.log
    root@am57xx-evm:~# yavta -c10 -fUYVY -Fout_test.yuv -s720x288 /dev/video1
    Device /dev/video1 opened.
    Device `vip' on `platform:vip2:vin3a:stream0' is a video output (without mplanes) device.
    Video format set: UYVY (59565955) 720x288 (stride 1440) field none buffer size 414720
    Video format: UYVY (59565955) 720x288 (stride 1440) field none buffer size 414720
    8 buffers requested.
    length: 414720 offset: 0 timestamp type/source: mono/EoF
    Buffer 0/0 mapped at address 0xb6e26000.
    length: 414720 offset: 417792 timestamp type/source: mono/EoF
    Buffer 1/0 mapped at address 0xb6dc0000.
    length: 414720 offset: 835584 timestamp type/source: mono/EoF
    Buffer 2/0 mapped at address 0xb6d5a000.
    length: 414720 offset: 1253376 timestamp type/source: mono/EoF
    Buffer 3/0 mapped at address 0xb6cf4000.
    length: 414720 offset: 1671168 timestamp type/source: mono/EoF
    Buffer 4/0 mapped at address 0xb6c8e000.
    length: 414720 offset: 2088960 timestamp type/source: mono/EoF
    Buffer 5/0 mapped at address 0xb6c28000.
    length: 414720 offset: 2506752 timestamp type/source: mono/EoF
    Buffer 6/0 mapped at address 0xb6bc2000.
    length: 414720 offset: 2924544 timestamp type/source: mono/EoF
    Buffer 7/0 mapped at address 0xb6b5c000.
    ^C
    root@am57xx-evm:~# dmesg
    [  328.311529] vin3a-0: vip_open
    [  328.311554] tvp5150 4-005d: width = 720, height = 288
    [  328.311562] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
    [  328.311574] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
    [  328.311582] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
    [  328.311587] vin3a-0: init_stream vpdma data type: 0x27
    [  328.311595] vin3a-0: vip_init_stream: stream instance 0xc0bb2874ed237000
    [  328.312180] vin3a-0: s_fmt input fourcc:UYVY size: 720x288 bpl:0 img_size:0
    [  328.312188] vin3a-0: try_fmt fourcc:UYVY size: 720x288
    [  328.312197] vin3a-0: try_fmt loop:0 fourcc:UYVY size: 720x288
    [  328.312203] vin3a-0: try_fmt loop:0 found new larger: 720x288
    [  328.312209] vin3a-0: try_fmt loop:0 found at least larger: 720x288
    [  328.312214] vin3a-0: try_fmt loop:0 found new best: 720x288
    [  328.312220] vin3a-0: try_fmt loop:0 found direct match: 720x288
    [  328.312227] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
    [  328.312233] vin3a-0: s_fmt try_fmt fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
    [  328.312240] vin3a-0: s_fmt fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
    [  328.312246] vin3a-0: s_fmt pix_to_mbus mbus_code: 2006 size: 720x288
    [  328.312254] tvp5150 4-005d: width = 720, height = 288
    [  328.312261] vin3a-0: s_fmt subdev fmt mbus_code: 2006 size: 720x288
    [  328.312266] vin3a-0: s_fmt vpdma data type: 0x27
    [  328.312490] vin3a-0: g_fmt fourcc:UYVY code: 2006 size: 720x288 bpl:1440 img_size:414720
    [  328.312496] vin3a-0: g_fmt vpdma data type: 0x27
    [  328.312706] vin3a-0: get 8 buffer(s) of size 414720 each.
    [  328.319513] vin3: vip_set_slice_path:
    [  328.319523] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
    [  328.319528] vin3: vip_set_slice_path:
    [  328.319534] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
    [  328.319811] vin3: vip_setup_parser: EMBEDDED_SYNC_SINGLE_YUV422
    [  328.319816] vin3: vip_setup_parser: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422
    [  328.319821] vin3: vip_setup_parser: VIP_PIXCLK_EDGE_POLARITY=0
    [  328.320119] tvp5150 4-005d: tvp5150: read 0x03 = 6b
    [  328.320128] tvp5150 4-005d: tvp5150: writing 03 6b
    [  328.320290] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:0
    [  328.321418] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:1
    [  347.591677] vin3a-0: vip_release
    [  347.591688] vin3a-0: vip_stop_streaming:
    [  347.591697] vin3: vip_set_slice_path:
    [  347.591705] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
    [  347.591710] vin3: vip_set_slice_path:
    [  347.591717] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
    [  347.592014] tvp5150 4-005d: tvp5150: read 0x03 = 6b
    [  347.592023] tvp5150 4-005d: tvp5150: writing 03 62
    [  347.592211] vin3a-0: Clear channel no: 38
    [  347.592797] vin3a-0: vip_release_stream: stream instance 0x00000008ed237000
    [  347.592804] vin3a: vip_release_port: port instance 0xeda3fe40ed208810
    root@am57xx-evm:~# 
    
    -------------------------------------------------------------------------------------------------
    root@am57xx-evm:~# yavta -c10 -fYUYV -Fout_test.yuv -s720x288 /dev/video1
    Device /dev/video1 opened.
    Device `vip' on `platform:vip2:vin3a:stream0' is a video output (without mplanes) device.
    Video format set: YUYV (56595559) 720x288 (stride 1440) field none buffer size 414720
    Video format: YUYV (56595559) 720x288 (stride 1440) field none buffer size 414720
    8 buffers requested.
    length: 414720 offset: 0 timestamp type/source: mono/EoF
    Buffer 0/0 mapped at address 0xb6ddb000.
    length: 414720 offset: 417792 timestamp type/source: mono/EoF
    Buffer 1/0 mapped at address 0xb6d75000.
    length: 414720 offset: 835584 timestamp type/source: mono/EoF
    Buffer 2/0 mapped at address 0xb6d0f000.
    length: 414720 offset: 1253376 timestamp type/source: mono/EoF
    Buffer 3/0 mapped at address 0xb6ca9000.
    length: 414720 offset: 1671168 timestamp type/source: mono/EoF
    Buffer 4/0 mapped at address 0xb6c43000.
    length: 414720 offset: 2088960 timestamp type/source: mono/EoF
    Buffer 5/0 mapped at address 0xb6bdd000.
    length: 414720 offset: 2506752 timestamp type/source: mono/EoF
    Buffer 6/0 mapped at address 0xb6b77000.
    length: 414720 offset: 2924544 timestamp type/source: mono/EoF
    Buffer 7/0 mapped at address 0xb6b11000.
    ^C
    root@am57xx-evm:~# dmesg
    [  489.396883] vin3a-0: vip_open
    [  489.396908] tvp5150 4-005d: width = 720, height = 288
    [  489.396917] vin3a: vip_init_port: g_mbus_fmt subdev mbus_code: 2006 fourcc:UYVY size: 720x288
    [  489.396929] vin3a: calc_format_size: fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
    [  489.396936] vin3a-0: init_stream fourcc:UYVY size: 720x288 bpl:1440 img_size:414720
    [  489.396942] vin3a-0: init_stream vpdma data type: 0x27
    [  489.396950] vin3a-0: vip_init_stream: stream instance 0xc0bb2874ed237000
    [  489.397122] vin3a-0: s_fmt input fourcc:YUYV size: 720x288 bpl:0 img_size:0
    [  489.397129] vin3a-0: try_fmt fourcc:YUYV size: 720x288
    [  489.397138] vin3a-0: try_fmt loop:0 fourcc:YUYV size: 720x288
    [  489.397145] vin3a-0: try_fmt loop:0 found new larger: 720x288
    [  489.397152] vin3a-0: try_fmt loop:0 found at least larger: 720x288
    [  489.397159] vin3a-0: try_fmt loop:0 found new best: 720x288
    [  489.397167] vin3a-0: try_fmt loop:0 found direct match: 720x288
    [  489.397174] vin3a: calc_format_size: fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
    [  489.397182] vin3a-0: s_fmt try_fmt fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
    [  489.397190] vin3a-0: s_fmt fourcc:YUYV size: 720x288 bpl:1440 img_size:414720
    [  489.397196] vin3a-0: s_fmt pix_to_mbus mbus_code: 2006 size: 720x288
    [  489.397205] tvp5150 4-005d: width = 720, height = 288
    [  489.397211] vin3a-0: s_fmt subdev fmt mbus_code: 2006 size: 720x288
    [  489.397217] vin3a-0: s_fmt vpdma data type: 0x07
    [  489.397284] vin3a-0: g_fmt fourcc:YUYV code: 2006 size: 720x288 bpl:1440 img_size:414720
    [  489.397289] vin3a-0: g_fmt vpdma data type: 0x07
    [  489.397347] vin3a-0: get 8 buffer(s) of size 414720 each.
    [  489.401221] vin3: vip_set_slice_path:
    [  489.401231] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
    [  489.401238] vin3: vip_set_slice_path:
    [  489.401246] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
    [  489.401523] vin3: vip_setup_parser: EMBEDDED_SYNC_SINGLE_YUV422
    [  489.401532] vin3: vip_setup_parser: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422
    [  489.401537] vin3: vip_setup_parser: VIP_PIXCLK_EDGE_POLARITY=0
    [  489.401777] tvp5150 4-005d: tvp5150: read 0x03 = 62
    [  489.401788] tvp5150 4-005d: tvp5150: writing 03 6b
    [  489.401930] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:0
    [  489.403063] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:1
    [  494.081846] vin3a-0: vip_release
    [  494.081858] vin3a-0: vip_stop_streaming:
    [  494.081868] vin3: vip_set_slice_path:
    [  494.081877] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
    [  494.081882] vin3: vip_set_slice_path:
    [  494.081888] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
    [  494.082126] tvp5150 4-005d: tvp5150: read 0x03 = 6b
    [  494.082134] tvp5150 4-005d: tvp5150: writing 03 62
    [  494.082297] vin3a-0: Clear channel no: 38
    [  494.082863] vin3a-0: vip_release_stream: stream instance 0x00000008ed237000
    [  494.082871] vin3a: vip_release_port: port instance 0xeda133c0ed208810
    
    
    
    
    

    That can be seen:

    ...
    [  328.319811] vin3: vip_setup_parser: EMBEDDED_SYNC_SINGLE_YUV422
    [  328.319816] vin3: vip_setup_parser: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422
    ...
    [  489.401523] vin3: vip_setup_parser: EMBEDDED_SYNC_SINGLE_YUV422
    [  489.401532] vin3: vip_setup_parser: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422
    ...

    But interruptions do not increase

    cat / proc / interrupts | grep vi

    102:          0          0      CBAR 352 Level     vin3
    103:          0          0      CBAR 393 Level     vin4

  • Hi Oleg,

    But i see in the log that you are using Line multiplexed output, 'EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422'.
    TVP5150 does not output in line multiplexed mode.. could you please recheck and make sure that only sync mode is set to 'EMBEDDED_SYNC_SINGLE_YUV422'..?

    Regards,
    Brijesh
  • Brijesh Jadav said:
    TVP5150 does not output in line multiplexed mode..

    I did not think about it.
    In the transition from PSDK04.03.00.05 to PSDK05.02.00.10. I found that tvp5150 is seen as video1, video2, video3, video4.

    Ie with the same technical settings in dts:
    v4l2-ctl --list-device

    psdk4:
      / dev / video1


    psdk5:
    / dev / video1
    / dev / video2
    / dev / video3
    / dev / video4

    To fix this, I did this in vip.c (only for psdk5):

    static int vip_create_streams(struct vip_port *port,
    			      struct v4l2_subdev *subdev)
    {
    	struct v4l2_fwnode_bus_parallel *bus;
    	int i;
    
    	for (i = 0; i < VIP_CAP_STREAMS_PER_PORT; i++)
    		free_stream(port->cap_streams[i]);
    
    	if (get_subdev_active_format(port, subdev))
    		return -ENODEV;
    
    	port->subdev = subdev;
    
    	if (port->endpoint->bus_type == V4L2_MBUS_PARALLEL) {
    		port->flags |= FLAG_MULT_PORT;
    		port->num_streams_configured = 1;
    		alloc_stream(port, 0, VFL_TYPE_GRABBER);
    		//DeVdistress
    		vip_dbg(1, port, "%s: bus_type = V4L2_MBUS_PARALLEL\n", "vip_create_streams");
    	} else if (port->endpoint->bus_type == V4L2_MBUS_BT656) {
    		port->flags |= FLAG_MULT_PORT;
    		bus = &port->endpoint->bus.parallel;
    //DeVdistress
    #if(0)
    		port->num_streams_configured = bus->num_channels;
    #else
    		port->num_streams_configured = bus->num_channels = 1;
    #endif
    		for (i = 0; i < bus->num_channels; i++) {
    			if (bus->channels[i] >= 16)
    				continue;
    			alloc_stream(port, bus->channels[i], VFL_TYPE_GRABBER);
    			//DeVdistress
    			vip_dbg(1, port, "%s[channel-%u]: bus_type = V4L2_MBUS_BT656\n", "vip_create_streams", i);
    		}
    	}
    	return 0;
    }

    My dts files PSDK4:

    #include "am57xx-evm-reva3.dts"
    #include <dt-bindings/pinctrl/dra.h>
    
    &dra7_pmx_core {
        vin3a_pins_default: vin3a_pins_default {
    	pinctrl-single,pins = <
    	    DRA7XX_CORE_IOPAD(0x3460, MUX_MODE15)	/* N7: gpmc_a8.vin3a_hsync0 */
    	    DRA7XX_CORE_IOPAD(0x3464, MUX_MODE15)	/* R4: gpmc_a9.vin3a_vsync0 */
    	    DRA7XX_CORE_IOPAD(0x346C, MUX_MODE15)	/* P9: gpmc_a11.vin3a_fld0  */
    	    DRA7XX_CORE_IOPAD(0x3468, MUX_MODE15)	/* N9: gpmc_a10.vin3a_de0   */
    	    DRA7XX_CORE_IOPAD(0x34BC, MUX_MODE2 | PIN_INPUT)	/* P1: gpmc_cs3.vin3a_clk0  */
    
    	    DRA7XX_CORE_IOPAD(0x3400, MUX_MODE2 | PIN_INPUT)	/* M6: gpmc_ad0.vin3a_d0 */
    	    DRA7XX_CORE_IOPAD(0x3404, MUX_MODE2 | PIN_INPUT)	/* M2: gpmc_ad1.vin3a_d1 */
    	    DRA7XX_CORE_IOPAD(0x3408, MUX_MODE2 | PIN_INPUT)	/* L5: gpmc_ad2.vin3a_d2 */
    	    DRA7XX_CORE_IOPAD(0x340C, MUX_MODE2 | PIN_INPUT)	/* M1: gpmc_ad3.vin3a_d3 */
    	    DRA7XX_CORE_IOPAD(0x3410, MUX_MODE2 | PIN_INPUT)	/* L6: gpmc_ad4.vin3a_d4 */
    	    DRA7XX_CORE_IOPAD(0x3414, MUX_MODE2 | PIN_INPUT)	/* L4: gpmc_ad5.vin3a_d5 */
    	    DRA7XX_CORE_IOPAD(0x3418, MUX_MODE2 | PIN_INPUT)	/* L3: gpmc_ad6.vin3a_d6 */
    	    DRA7XX_CORE_IOPAD(0x341C, MUX_MODE2 | PIN_INPUT)	/* L2: gpmc_ad7.vin3a_d7 */
    	>;
        };
    };
    
    &i2c5 {
    	tvp5150: tvp5150@5d {
    		compatible = "ti,tvp5150";
    		reg = <0x5d>;
    		//pdn-gpios = <&gpio5 11 GPIO_ACTIVE_LOW>; 
    		//reset-gpios = <&gpio4 17 GPIO_ACTIVE_LOW>;
    		
    		port {
    			tvp5150_1: endpoint {
    				remote-endpoint = <&vin3a>;
    				channels = <0>;
    			};
    		};
    	};
    };
    
    &gpio6 {
    	p11 {
    		gpio-hog;
    		gpios = <11 GPIO_ACTIVE_LOW>;
    		output-high;
    		line-name = "cm-camen-gpio";
    	};
    };
    
    &gpio4 {
    	p17 {
    		gpio-hog;
    		gpios = <17 GPIO_ACTIVE_HIGH>;
    		output-high;
    		line-name = "reset-gpios_gpio4_17";
    	};
    };
    
    &vin3a {
    	status = "okay";
    	pinctrl-name = "default";
    	pinctrl-0 = <&vin3a_pins_default>;
    	
    	endpoint {
    		slave-mode;
    		remote-endpoint = <&tvp5150_1>;
    		bus_width = <8>;
    	};
    };
    
    &vip2 {
        status = "okay";
    };

    My dts files PSDK5:

    /dts-v1/;
    /plugin/;
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/pinctrl/dra.h>
    
    &dra7_pmx_core {
        vin3a_pins_default: vin3a_pins_default {
    	pinctrl-single,pins = <
    	    DRA7XX_CORE_IOPAD(0x3460, MUX_MODE15)	/* N7: gpmc_a8.vin3a_hsync0 */
    	    DRA7XX_CORE_IOPAD(0x3464, MUX_MODE15)	/* R4: gpmc_a9.vin3a_vsync0 */
    	    DRA7XX_CORE_IOPAD(0x346C, MUX_MODE15)	/* P9: gpmc_a11.vin3a_fld0  */
    	    DRA7XX_CORE_IOPAD(0x3468, MUX_MODE15)	/* N9: gpmc_a10.vin3a_de0   */
    	    DRA7XX_CORE_IOPAD(0x34BC, MUX_MODE2 | PIN_INPUT)	/* P1: gpmc_cs3.vin3a_clk0  */
    
    	    DRA7XX_CORE_IOPAD(0x3400, MUX_MODE2 | PIN_INPUT)	/* M6: gpmc_ad0.vin3a_d0 */
    	    DRA7XX_CORE_IOPAD(0x3404, MUX_MODE2 | PIN_INPUT)	/* M2: gpmc_ad1.vin3a_d1 */
    	    DRA7XX_CORE_IOPAD(0x3408, MUX_MODE2 | PIN_INPUT)	/* L5: gpmc_ad2.vin3a_d2 */
    	    DRA7XX_CORE_IOPAD(0x340C, MUX_MODE2 | PIN_INPUT)	/* M1: gpmc_ad3.vin3a_d3 */
    	    DRA7XX_CORE_IOPAD(0x3410, MUX_MODE2 | PIN_INPUT)	/* L6: gpmc_ad4.vin3a_d4 */
    	    DRA7XX_CORE_IOPAD(0x3414, MUX_MODE2 | PIN_INPUT)	/* L4: gpmc_ad5.vin3a_d5 */
    	    DRA7XX_CORE_IOPAD(0x3418, MUX_MODE2 | PIN_INPUT)	/* L3: gpmc_ad6.vin3a_d6 */
    	    DRA7XX_CORE_IOPAD(0x341C, MUX_MODE2 | PIN_INPUT)	/* L2: gpmc_ad7.vin3a_d7 */
    	>;
        };
    };
    
    &i2c5 {
    	tvp5150: tvp5150@5d {
    		compatible = "ti,tvp5150";
    		reg = <0x5d>;
    		//pdn-gpios = <&gpio5 11 GPIO_ACTIVE_LOW>; 
    		//reset-gpios = <&gpio4 17 GPIO_ACTIVE_LOW>;
    		
    		port {
    			tvp5150_1: endpoint {
    				remote-endpoint = <&vin3a>;
    				channels = <0>;
    			};
    		};
    	};
    };
    
    &gpio6 {
    	p11 {
    		gpio-hog;
    		gpios = <11 GPIO_ACTIVE_LOW>;
    		output-high;
    		line-name = "cm-camen-gpio";
    	};
    };
    
    &gpio4 {
    	p17 {
    		gpio-hog;
    		gpios = <17 GPIO_ACTIVE_HIGH>;
    		output-high;
    		line-name = "reset-gpios_gpio4_17";
    	};
    };
    
    &vip2 {
        status = "okay";
    };
    
    &vin3a {
    	status = "okay";
    	pinctrl-0 = <&vin3a_pins_default>;
    	
    	endpoint {
    		slave-mode;
    		remote-endpoint = <&tvp5150_1>;
    		bus_width = <8>;
    	};
    };

    PS. tvp5150 in BT.656 mode does not work on psdk4 and psdk5

    Maybe the new kernel ( Linux am57xx-evm 4.14.79-gbde58ab01e #1 SMP PREEMPT Thu Dec 20 04:51:24 UTC 2018 armv7l GNU/Linux ) has new undocumented features for dts files?

    Can I do a clean experiment, remove my changes and show log after v4l2-ctl --list-device?

  • After adding a new insert in vip.c:
    static int vip_setup_parser(struct vip_port *port)
    {
    	struct vip_dev *dev = port->dev;
    	struct vip_parser_data *parser = dev->parser;
    	struct v4l2_fwnode_endpoint *endpoint = port->endpoint;
    	int iface, sync_type;
    	u32 flags = 0, config0;
    
    	/* Reset the port */
    	vip_reset_parser(port, true);
    	usleep_range(200, 250);
    	vip_reset_parser(port, false);
    
    	config0 = reg_read(parser, VIP_PARSER_PORT(port->port_id));
    
    	if (endpoint->bus_type == V4L2_MBUS_BT656) {
    		flags = endpoint->bus.parallel.flags;
    		iface = DUAL_8B_INTERFACE;
    
    		/*
    		 * Ideally, this should come from subdev
    		 * port->fmt can be anything once CSC is enabled
    		 */
    		if (vip_is_mbuscode_rgb(port->fmt->code)) {
    			sync_type = EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444\n", "vip_setup_parser");
    		} else {
    			switch (endpoint->bus.parallel.num_channels) {
    			case 4:
    				sync_type = EMBEDDED_SYNC_4X_MULTIPLEXED_YUV422;
    				//DeVdistress
    				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_4X_MULTIPLEXED_YUV422\n", "vip_setup_parser");
    				break;
    			case 2:
    				sync_type = EMBEDDED_SYNC_2X_MULTIPLEXED_YUV422;
    				//DeVdistress
    				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_2X_MULTIPLEXED_YUV422\n", "vip_setup_parser");
    				break;
    			case 1:
    				sync_type = EMBEDDED_SYNC_SINGLE_YUV422;
    				//DeVdistress
    				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_YUV422\n", "vip_setup_parser");
    				break;
    			default:
    				sync_type =
    				EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422;
    				//DeVdistress
    				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422!\n", "vip_setup_parser");
    			}
    //DeVdistress
    #if(0)
    			if (endpoint->bus.parallel.pixmux == 0){
    				sync_type =
    				EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422;
    				//DeVdistress
    				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422\n", "vip_setup_parser");
    			}
    #endif
    		}
    
    	} else if (endpoint->bus_type == V4L2_MBUS_PARALLEL) {
    		flags = endpoint->bus.parallel.flags;
    
    		switch (endpoint->bus.parallel.bus_width) {
    		case 24:
    			iface = SINGLE_24B_INTERFACE;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: SINGLE_24B_INTERFACE\n", "vip_setup_parser");
    		break;
    		case 16:
    			iface = SINGLE_16B_INTERFACE;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: SINGLE_16B_INTERFACE\n", "vip_setup_parser");
    		break;
    		case 8:
    		default:
    			iface = DUAL_8B_INTERFACE;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: DUAL_8B_INTERFACE\n", "vip_setup_parser");
    		}
    
    		if (vip_is_mbuscode_rgb(port->fmt->code)){
    			sync_type = DISCRETE_SYNC_SINGLE_RGB_24B;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: DISCRETE_SYNC_SINGLE_RGB_24B\n", "vip_setup_parser");
    		}
    		else{
    			sync_type = DISCRETE_SYNC_SINGLE_YUV422;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: DISCRETE_SYNC_SINGLE_YUV422\n", "vip_setup_parser");
    		}
    
    		if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH){
    			config0 |= VIP_HSYNC_POLARITY;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: VIP_HSYNC_POLARITY=1\n", "vip_setup_parser");
    		}
    		else if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW){
    			config0 &= ~VIP_HSYNC_POLARITY;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: VIP_HSYNC_POLARITY=0\n", "vip_setup_parser");
    		}
    
    		if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH){
    			config0 |= VIP_VSYNC_POLARITY;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: VIP_VSYNC_POLARITY=1\n", "vip_setup_parser");
    		}
    		else if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW){
    			config0 &= ~VIP_VSYNC_POLARITY;
    			//DeVdistress
    			vip_dbg(1, dev, "%s: VIP_VSYNC_POLARITY=0\n", "vip_setup_parser");
    		}
    
    		config0 &= ~VIP_USE_ACTVID_HSYNC_ONLY;
    		config0 |= VIP_ACTVID_POLARITY;
    		config0 |= VIP_DISCRETE_BASIC_MODE;
    
    	} else {
    		vip_err(port, "Device doesn't support CSI2");
    		return -EINVAL;
    	}
    
    	if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) {
    		vip_set_pclk_invert(port);
    		config0 |= VIP_PIXCLK_EDGE_POLARITY;
    		//DeVdistress
    		vip_dbg(1, dev, "%s: VIP_PIXCLK_EDGE_POLARITY=1\n", "vip_setup_parser");
    
    	} else {
    		config0 &= ~VIP_PIXCLK_EDGE_POLARITY;
    		//DeVdistress
    		vip_dbg(1, dev, "%s: VIP_PIXCLK_EDGE_POLARITY=0\n", "vip_setup_parser");
    	}
    
    	config0 |= ((sync_type & VIP_SYNC_TYPE_MASK) << VIP_SYNC_TYPE_SHFT);
    
    	reg_write(parser, VIP_PARSER_PORT(port->port_id), config0);
    
    	vip_set_data_interface(port, iface);
    	vip_set_crop_parser(port);
    
    	return 0;
    }

    There was a picture:

    gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)288' ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)576' ! queue ! waylandsink use-drm=true

    Maybe these patches can  someone help ( for  tvp5150.c and vip.c files in bt.656 mode )

    1616.patch.tvp5150.c
    --- tvp5150.c~original	2019-02-08 11:41:07.329365976 +0300
    +++ tvp5150.c	2019-02-20 16:11:36.742456723 +0300
    @@ -32,10 +32,14 @@
     MODULE_AUTHOR("Mauro Carvalho Chehab");
     MODULE_LICENSE("GPL");
     
    -
    -static int debug;
    -module_param(debug, int, 0644);
    -MODULE_PARM_DESC(debug, "Debug level (0-2)");
    +//DeVdistress
    +#if(0)
    +	static int debug;
    +	module_param(debug, int, 0644);
    +	MODULE_PARM_DESC(debug, "Debug level (0-2)");
    +#else
    +	static int debug = 2;
    +#endif
     
     #define dprintk0(__dev, __arg...) dev_dbg_lvl(__dev, 0, 0, __arg)
     
    @@ -273,6 +277,8 @@
     			input = 8;
     	}
     
    +//DeVdistress
    +#if(1)
     	switch (decoder->input) {
     	case TVP5150_COMPOSITE1:
     		input |= 2;
    @@ -284,6 +290,7 @@
     		input |= 1;
     		break;
     	}
    +#endif
     
     	dev_dbg_lvl(sd->dev, 1, debug, "Selecting video route: route input=%i, output=%i => tvp5150 input=%i, opmode=%i\n",
     			decoder->input, decoder->output,
    @@ -463,7 +470,9 @@
     		TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
     				  TVP5150_MISC_CTL_INTREQ_OE |
     				  TVP5150_MISC_CTL_YCBCR_OE |
    +#if(0) //DeVdistress
     				  TVP5150_MISC_CTL_SYNC_OE |
    +#endif
     				  TVP5150_MISC_CTL_VBLANK |
     				  TVP5150_MISC_CTL_CLOCK_OE,
     	},{	/* Activates video std autodetection for all standards */
    @@ -745,6 +754,8 @@
     
     	/* First tests should be against specific std */
     
    +//DeVdistress
    +#if(0)
     	if (std == V4L2_STD_NTSC_443) {
     		fmt = VIDEO_STD_NTSC_4_43_BIT;
     	} else if (std == V4L2_STD_PAL_M) {
    @@ -752,7 +763,7 @@
     	} else if (std == V4L2_STD_PAL_N || std == V4L2_STD_PAL_Nc) {
     		fmt = VIDEO_STD_PAL_COMBINATION_N_BIT;
     	} else {
    -		/* Then, test against generic ones */
    +		// Then, test against generic ones
     		if (std & V4L2_STD_NTSC)
     			fmt = VIDEO_STD_NTSC_MJ_BIT;
     		else if (std & V4L2_STD_PAL)
    @@ -760,6 +771,9 @@
     		else if (std & V4L2_STD_SECAM)
     			fmt = VIDEO_STD_SECAM_BIT;
     	}
    +#else
    +	fmt = VIDEO_STD_PAL_BDGHIN_BIT;
    +#endif
     
     	dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt);
     	tvp5150_write(sd, TVP5150_VIDEO_STD, fmt);
    @@ -865,8 +879,14 @@
     	struct v4l2_mbus_framefmt *f;
     	struct tvp5150 *decoder = to_tvp5150(sd);
     
    +	//DeVdistress
    +#if(0)
     	if (!format || (format->pad != DEMOD_PAD_VID_OUT))
     		return -EINVAL;
    +#else
    +	if (!format || format->pad)
    +		return -EINVAL;
    +#endif
     
     	f = &format->format;
     
    @@ -879,6 +899,7 @@
     
     	dev_dbg_lvl(sd->dev, 1, debug, "width = %d, height = %d\n", f->width,
     			f->height);
    +
     	return 0;
     }
     
    @@ -1456,6 +1477,57 @@
     	"Black screen"
     };
     
    +//DeVdistress
    +void tvp5150_my_set_selection(struct v4l2_subdev *sd, struct v4l2_rect *sel)
    +{
    +	struct tvp5150 *decoder = to_tvp5150(sd);
    +	struct v4l2_rect rect;
    +	v4l2_std_id std;
    +	int hmax;
    +
    +	memcpy(&rect, sel, sizeof(rect));
    +
    +	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
    +		__func__, rect.left, rect.top, rect.width, rect.height);
    +
    +	/* tvp5150 has some special limits */
    +	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
    +	rect.width = clamp_t(unsigned int, rect.width,
    +			     (TVP5150_H_MAX + rect.left)- TVP5150_MAX_CROP_LEFT - rect.left,
    +				 (TVP5150_H_MAX + rect.left) - rect.left);
    +	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
    +
    +	/* Calculate height based on current standard */
    +	if (decoder->norm == V4L2_STD_ALL)
    +		std = tvp5150_read_std(sd);
    +	else
    +		std = decoder->norm;
    +
    +	if (std & V4L2_STD_525_60)
    +		hmax = TVP5150_V_MAX_525_60 + rect.top; //было без rect.top
    +	else
    +		hmax = TVP5150_V_MAX_OTHERS + rect.top; //было без rect.top
    +
    +	rect.height = clamp_t(unsigned int, rect.height,
    +			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
    +			      hmax - rect.top);
    +
    +	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
    +	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
    +		      rect.top + rect.height - hmax);
    +	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
    +		      rect.left >> TVP5150_CROP_SHIFT);
    +	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
    +		      rect.left | (1 << TVP5150_CROP_SHIFT));
    +	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
    +		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
    +		      TVP5150_CROP_SHIFT);
    +	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
    +		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);
    +
    +	//decoder->rect = rect;
    +}
    +
     static int tvp5150_probe(struct i2c_client *c,
     			 const struct i2c_device_id *id)
     {
    @@ -1464,6 +1536,10 @@
     	struct device_node *np = c->dev.of_node;
     	int res;
     
    +#if(0)//DeVdistress
    +	struct v4l2_rect sel;
    +#endif
    +
     	/* Check if the adapter supports the needed features */
     	if (!i2c_check_functionality(c->adapter,
     	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
    @@ -1490,6 +1566,12 @@
     		core->mbus_type = V4L2_MBUS_BT656;
     	}
     
    +	//DeVdistress
    +	#if(0)
    +	#else
    +		core->mbus_type = V4L2_MBUS_BT656;
    +	#endif
    +
     	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
     	sd->internal_ops = &tvp5150_internal_ops;
     	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
    @@ -1512,8 +1594,15 @@
     	if (res < 0)
     		return res;
     
    -	core->norm = V4L2_STD_ALL;	/* Default is autodetect */
    +//DeVdistress
    +#if(0)
    +	core->norm = V4L2_STD_ALL;	// Default is autodetect
     	core->input = TVP5150_COMPOSITE1;
    +#else
    +	core->norm = V4L2_STD_ALL;	// Default is autodetect
    +	core->input = TVP5150_COMPOSITE0;
    +#endif
    +
     	core->enable = true;
     
     	v4l2_ctrl_handler_init(&core->hdl, 5);
    @@ -1549,6 +1638,14 @@
     
     	tvp5150_reset(sd, 0);	/* Calls v4l2_ctrl_handler_setup() */
     
    +#if(0)//DeVdistress
    +	sel.left   = core->rect.left   + 100;
    +	sel.top    = core->rect.top    + 50;
    +	sel.width  = core->rect.width  + 100;
    +	sel.height = core->rect.height + 50;
    +	tvp5150_my_set_selection(sd, &sel);
    +#endif
    +
     	res = v4l2_async_register_subdev(sd);
     	if (res < 0)
     		goto err;
    
    7485.patch.vip.c
    --- vip.c~original	2018-12-20 07:34:34.000000000 +0300
    +++ vip.c	2019-02-20 16:34:48.362489403 +0300
    @@ -39,10 +39,20 @@
     #define VIP_MODULE_NAME "vip"
     #define VIP_INPUT_NAME "Vin0"
     
    -static int debug;
    -module_param(debug, int, 0644);
    -MODULE_PARM_DESC(debug, "debug level (0-8)");
    -
    +//DeVdistress
    +//In discrete sync capture, VIP capture entire frame including blanking portion. Which is why you are seeing these black stripes.
    +//You could either removed them in the code or can remove in the VIP itself. VIP parser has some trim register, you could use them to remove this blanking portion..
    +#define H_CROP_DOT		(0) //(135) // for bt.470 must be 135
    +#define V_CROP_DOT		(0) //(21)  // for bt.470 must be 21
    +
    +//DeVdistress
    +#if(0)
    +	static int debug;
    +	module_param(debug, int, 0644);
    +	MODULE_PARM_DESC(debug, "debug level (0-8)");
    +#else
    +	static int debug = 3;
    +#endif
     /*
      * Minimum and maximum frame sizes
      */
    @@ -3011,13 +3021,13 @@
     	 * scaler and colorspace converter will yield garbage.
     	 */
     	hcrop = VIP_ACT_BYPASS;
    -	insert_field(&hcrop, 0, VIP_ACT_SKIP_NUMPIX_MASK,
    +	insert_field(&hcrop, H_CROP_DOT, VIP_ACT_SKIP_NUMPIX_MASK,
     		     VIP_ACT_SKIP_NUMPIX_SHFT);
     	insert_field(&hcrop, width,
     		     VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
     	reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);
     
    -	insert_field(&vcrop, 0, VIP_ACT_SKIP_NUMLINES_MASK,
    +	insert_field(&vcrop, V_CROP_DOT, VIP_ACT_SKIP_NUMLINES_MASK,
     		     VIP_ACT_SKIP_NUMLINES_SHFT);
     	insert_field(&vcrop, port->mbus_framefmt.height,
     		     VIP_ACT_USE_NUMLINES_MASK, VIP_ACT_USE_NUMLINES_SHFT);
    @@ -3051,24 +3061,40 @@
     		 */
     		if (vip_is_mbuscode_rgb(port->fmt->code)) {
     			sync_type = EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444;
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444\n", "vip_setup_parser");
     		} else {
     			switch (endpoint->bus.parallel.num_channels) {
     			case 4:
     				sync_type = EMBEDDED_SYNC_4X_MULTIPLEXED_YUV422;
    +				//DeVdistress
    +				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_4X_MULTIPLEXED_YUV422\n", "vip_setup_parser");
     				break;
     			case 2:
     				sync_type = EMBEDDED_SYNC_2X_MULTIPLEXED_YUV422;
    +				//DeVdistress
    +				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_2X_MULTIPLEXED_YUV422\n", "vip_setup_parser");
     				break;
     			case 1:
     				sync_type = EMBEDDED_SYNC_SINGLE_YUV422;
    +				//DeVdistress
    +				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_YUV422\n", "vip_setup_parser");
     				break;
     			default:
     				sync_type =
     				EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422;
    +				//DeVdistress
    +				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422!\n", "vip_setup_parser");
     			}
    -			if (endpoint->bus.parallel.pixmux == 0)
    +//DeVdistress
    +#if(0)
    +			if (endpoint->bus.parallel.pixmux == 0){
     				sync_type =
     				EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422;
    +				//DeVdistress
    +				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422\n", "vip_setup_parser");
    +			}
    +#endif
     		}
     
     	} else if (endpoint->bus_type == V4L2_MBUS_PARALLEL) {
    @@ -3077,29 +3103,53 @@
     		switch (endpoint->bus.parallel.bus_width) {
     		case 24:
     			iface = SINGLE_24B_INTERFACE;
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: SINGLE_24B_INTERFACE\n", "vip_setup_parser");
     		break;
     		case 16:
     			iface = SINGLE_16B_INTERFACE;
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: SINGLE_16B_INTERFACE\n", "vip_setup_parser");
     		break;
     		case 8:
     		default:
     			iface = DUAL_8B_INTERFACE;
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: DUAL_8B_INTERFACE\n", "vip_setup_parser");
     		}
     
    -		if (vip_is_mbuscode_rgb(port->fmt->code))
    +		if (vip_is_mbuscode_rgb(port->fmt->code)){
     			sync_type = DISCRETE_SYNC_SINGLE_RGB_24B;
    -		else
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: DISCRETE_SYNC_SINGLE_RGB_24B\n", "vip_setup_parser");
    +		}
    +		else{
     			sync_type = DISCRETE_SYNC_SINGLE_YUV422;
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: DISCRETE_SYNC_SINGLE_YUV422\n", "vip_setup_parser");
    +		}
     
    -		if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
    +		if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH){
     			config0 |= VIP_HSYNC_POLARITY;
    -		else if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: VIP_HSYNC_POLARITY=1\n", "vip_setup_parser");
    +		}
    +		else if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW){
     			config0 &= ~VIP_HSYNC_POLARITY;
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: VIP_HSYNC_POLARITY=0\n", "vip_setup_parser");
    +		}
     
    -		if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
    +		if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH){
     			config0 |= VIP_VSYNC_POLARITY;
    -		else if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: VIP_VSYNC_POLARITY=1\n", "vip_setup_parser");
    +		}
    +		else if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW){
     			config0 &= ~VIP_VSYNC_POLARITY;
    +			//DeVdistress
    +			vip_dbg(1, dev, "%s: VIP_VSYNC_POLARITY=0\n", "vip_setup_parser");
    +		}
     
     		config0 &= ~VIP_USE_ACTVID_HSYNC_ONLY;
     		config0 |= VIP_ACTVID_POLARITY;
    @@ -3113,8 +3163,13 @@
     	if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) {
     		vip_set_pclk_invert(port);
     		config0 |= VIP_PIXCLK_EDGE_POLARITY;
    +		//DeVdistress
    +		vip_dbg(1, dev, "%s: VIP_PIXCLK_EDGE_POLARITY=1\n", "vip_setup_parser");
    +
     	} else {
     		config0 &= ~VIP_PIXCLK_EDGE_POLARITY;
    +		//DeVdistress
    +		vip_dbg(1, dev, "%s: VIP_PIXCLK_EDGE_POLARITY=0\n", "vip_setup_parser");
     	}
     
     	config0 |= ((sync_type & VIP_SYNC_TYPE_MASK) << VIP_SYNC_TYPE_SHFT);
    @@ -3562,14 +3617,23 @@
     		port->flags |= FLAG_MULT_PORT;
     		port->num_streams_configured = 1;
     		alloc_stream(port, 0, VFL_TYPE_GRABBER);
    +		//DeVdistress
    +		vip_dbg(1, port, "%s: bus_type = V4L2_MBUS_PARALLEL\n", "vip_create_streams");
     	} else if (port->endpoint->bus_type == V4L2_MBUS_BT656) {
     		port->flags |= FLAG_MULT_PORT;
     		bus = &port->endpoint->bus.parallel;
    +//DeVdistress
    +#if(0)
     		port->num_streams_configured = bus->num_channels;
    +#else
    +		port->num_streams_configured = bus->num_channels = 1;
    +#endif
     		for (i = 0; i < bus->num_channels; i++) {
     			if (bus->channels[i] >= 16)
     				continue;
     			alloc_stream(port, bus->channels[i], VFL_TYPE_GRABBER);
    +			//DeVdistress
    +			vip_dbg(1, port, "%s[channel-%u]: bus_type = V4L2_MBUS_BT656\n", "vip_create_streams", i);
     		}
     	}
     	return 0;
    

    Many thanks to Brijesh Jadav.

    The last question remains. 

    How to remove the black strips on the left and right using (vip.c + tvp5150.c)?

  • May be it is coming from the input itself. have you tried connecting the source to actual display?

    Rgds,
    Brijesh
  • Brijesh Jadav said:
    May be it is coming from the input itself. have you tried connecting the source to actual display?

    I took another, proven camera. The resulting picture is the same.

    I can send oscillograms of the original analog signal but they are exactly standard PAL.
    Could it be to reduce the resolution of the picture using tvp5150 or vip drivers?

  • Hi Oleg,

    But you see full image, 720x576 PAL image, correct ? Which means the black stripes are part of the 720 width itself.
    VIP does not really change any size parameters or update the pixels.. It just captures as it gets the image from the outside..
    What i was asking, can you connect this camera directly to TV and see if there is any black stripes? Please note you need to enable full screen mode to view full image on TV. Otherwise, TV also does some over-scanning.

    Rgds,
    Brijesh
  • I was told that in PAL video 702 data points and 18 black points will always be there.

    Brijesh Jadav said:
    VIP does not really change any size parameters or update the pixels

    What is the best way to cut black stripes without using CPU time?

    I can reduce the resolution using tvp5150 (Active Video (Avid) Cropping). If the tvp5150.c driver declare a lower resolution of 700x574 for vip. Will vip work with 700x574 resolution?

    Maybe there is an easier way to cut black lines like vpe?

  • Hi Oleg,

    Yes, If you reduce the resolution in TVP, VIP will still be able to capture. VIP is just simple port, it capture as it receives data from the sensor.. it does not know the input resolutions..
    The other way, you could further crop the input in the VIP itself.. Move startx to few more pixels and accordingly reduce the width also in the crop parameters.


    Rgds,
    Brijesh
  • Brijesh Jadav said:
    Hi Oleg,
    Move startx to few more pixels and accordingly reduce the width also in the crop parameters.

    Maybe you have some example?

    This problem can be solved with the help of gstreamer?

    I could not change the resolution using tvp5150 (gstreamer gives an error when starting up)

    I tried to use the plugin for gsreamer (videocrop)

    gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)288' ! videocrop bottom=2 right=24 ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)576' ! queue  ! waylandsink use-drm=true

    Got two problems!
    1. CPU load 50%. This is normal?

    2. right= must be a multiple of 8 (right = 18 leads to a black screen). Why should right be a multiple of 8?

  • Hi,

    I meant to change here


    insert_field(&hcrop, 138, VIP_ACT_SKIP_NUMPIX_MASK,
    VIP_ACT_SKIP_NUMPIX_SHFT);
    insert_field(&vcrop, 20, VIP_ACT_SKIP_NUMLINES_MASK,
    VIP_ACT_SKIP_NUMLINES_SHFT);

    Change hCrop to further mode and accordingly reduce the width in the USE_NUMLINES..

    Rgds,
    Brijesh
  • Brijesh Jadav said:
    I meant to change here


    insert_field(&hcrop, 138, VIP_ACT_SKIP_NUMPIX_MASK,
    VIP_ACT_SKIP_NUMPIX_SHFT);
    insert_field(&vcrop, 20, VIP_ACT_SKIP_NUMLINES_MASK,
    VIP_ACT_SKIP_NUMLINES_SHFT);

    Change hCrop to further mode

    This was clear to me.

    Brijesh Jadav said:
    accordingly reduce the width in the USE_NUMLINES.

    Gee whiz. Ie, it's enough for me to do this.

    insert_field(&hcrop, width - 20, VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);

    For the case of reducing the width by 20 pixels.

    Did I understand correctly?

    If yes. Then on Monday I'll try it and write about the result.

  • Yes, that correct, increase start offset and reduce width..

    Rgds,
    Brijesh
  • #define     MY_USE_BT656
    
    #if defined(MY_USE_BT656) #define H_CROP_DOT (10) #define V_CROP_DOT (1) #else #define H_CROP_DOT (135) #define V_CROP_DOT (21) #endif static int vip_set_crop_parser(struct vip_port *port) { struct vip_dev *dev = port->dev; struct vip_parser_data *parser = dev->parser; u32 hcrop = 0, vcrop = 0, width = 0; if (port->mbus_framefmt.width > 700) { port->mbus_framefmt.width -= 2*H_CROP_DOT; port->mbus_framefmt.height -= 2*V_CROP_DOT; printk("DeVdistress: width=%u, height=%u\n", port->mbus_framefmt.width, port->mbus_framefmt.height); } width = port->mbus_framefmt.width; if (port->fmt->vpdma_fmt[0] == &vpdma_raw_fmts[VPDMA_DATA_FMT_RAW8]) { /* * Special case since we are faking a YUV422 16bit format * to have the vpdma perform the needed byte swap * we need to adjust the pixel width accordingly * otherwise the parser will attempt to collect more pixels * then available and the vpdma transfer will exceed the * allocated frame buffer. */ width >>= 1; vip_dbg(1, port, "%s: 8 bit raw detected, adjusting width to %d\n", __func__, width); } /* * Set Parser Crop parameters to source size otherwise * scaler and colorspace converter will yield garbage. */ hcrop = VIP_ACT_BYPASS; insert_field(&hcrop, H_CROP_DOT, VIP_ACT_SKIP_NUMPIX_MASK, VIP_ACT_SKIP_NUMPIX_SHFT); insert_field(&hcrop, width, VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT); reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop); insert_field(&vcrop, V_CROP_DOT, VIP_ACT_SKIP_NUMLINES_MASK, VIP_ACT_SKIP_NUMLINES_SHFT); insert_field(&vcrop, port->mbus_framefmt.height, VIP_ACT_USE_NUMLINES_MASK, VIP_ACT_USE_NUMLINES_SHFT); reg_write(parser, VIP_PARSER_CROP_V_PORT(port->port_id), vcrop); return 0; }

    The resulting image:

    root@am57xx-evm:~# gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)288' ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)576' ! queue ! waylandsink use-drm=true

    root@am57xx-evm:~# dmesg | grep DeVdistress
    [ 62.482536] DeVdistress: width=700, height=286

    And I was expecting such a picture:

    gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)288' ! videocrop bottom=2 right=24 ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)576' ! queue  ! waylandsink use-drm=true

    What have I done wrong?

  • Hi Oleg,


    With the 720 output frame width, you were getting two black bars the horizontal edge..
    So we just need to change the horizontal size and start position. With the new changes, horizontal size will no longer be 720 pixels..

    Can you try

    hcrop = VIP_ACT_BYPASS;
    insert_field(&hcrop, 138, VIP_ACT_SKIP_NUMPIX_MASK,
    VIP_ACT_SKIP_NUMPIX_SHFT);
    insert_field(&hcrop, 720,
    VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
    reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);

    If this does not work, Increase start and reduce width

    hcrop = VIP_ACT_BYPASS;
    insert_field(&hcrop, 142, VIP_ACT_SKIP_NUMPIX_MASK,
    VIP_ACT_SKIP_NUMPIX_SHFT);
    insert_field(&hcrop, 718,
    VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
    reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);

    Rgds,
    Brijesh
  • static int vip_set_crop_parser(struct vip_port *port)
    {
    	struct vip_dev *dev = port->dev;
    	struct vip_parser_data *parser = dev->parser;
    	u32 hcrop = 0, vcrop = 0, width = 0;
    
    //	if (port->mbus_framefmt.width > 700)
    //	{
    //		port->mbus_framefmt.width -= 2*H_CROP_DOT;
    //		port->mbus_framefmt.height -= 2*V_CROP_DOT;
    //		printk("DeVdistress: width=%u, height=%u\n", port->mbus_framefmt.width, port->mbus_framefmt.height);
    //	}
    
    	width = port->mbus_framefmt.width;
    
    	if (port->fmt->vpdma_fmt[0] == &vpdma_raw_fmts[VPDMA_DATA_FMT_RAW8]) {
    		/*
    		 * Special case since we are faking a YUV422 16bit format
    		 * to have the vpdma perform the needed byte swap
    		 * we need to adjust the pixel width accordingly
    		 * otherwise the parser will attempt to collect more pixels
    		 * then available and the vpdma transfer will exceed the
    		 * allocated frame buffer.
    		 */
    		width >>= 1;
    		vip_dbg(1, port, "%s: 8 bit raw detected, adjusting width to %d\n",
    			__func__, width);
    	}
    
    	/*
    	 * Set Parser Crop parameters to source size otherwise
    	 * scaler and colorspace converter will yield garbage.
    	 */
    	hcrop = VIP_ACT_BYPASS;
    //	insert_field(&hcrop, H_CROP_DOT, VIP_ACT_SKIP_NUMPIX_MASK,
    //		     VIP_ACT_SKIP_NUMPIX_SHFT);
    //	insert_field(&hcrop, width,
    //		     VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
    //	reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);
    	insert_field(&hcrop, 142, VIP_ACT_SKIP_NUMPIX_MASK,
    	VIP_ACT_SKIP_NUMPIX_SHFT);
    	insert_field(&hcrop, 718,
    	VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
    	reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);
    
    	insert_field(&vcrop, 0/*V_CROP_DOT*/, VIP_ACT_SKIP_NUMLINES_MASK,
    		     VIP_ACT_SKIP_NUMLINES_SHFT);
    	insert_field(&vcrop, port->mbus_framefmt.height,
    		     VIP_ACT_USE_NUMLINES_MASK, VIP_ACT_USE_NUMLINES_SHFT);
    	reg_write(parser, VIP_PARSER_CROP_V_PORT(port->port_id), vcrop);
    
    	return 0;
    }

    vip is working in BT.656 mode, so it makes no sense to make a shift by 138. This is evident from the result.

    What is the proposal yet?

  • oh ok.

    then just offset as 2 and width as 720-2..
    if it does not work , offset=4 and width=720-4.. and so on..

    Rgds,
    Brijesh
  • Brijesh Jadav said:
    then just offset as 2

    Why 2, correctly 20. Let's forget about the shift for now. With shifting me everything is clear. I do not understand how to change the width of the window.

    Obviously, changing the width field does not change the width of the window.

    I deliberately changed the width to 500. But the window did not change the size, it just didn’t initialize the field and changed the color to green.

    static int vip_set_crop_parser(struct vip_port *port)
    {
    	struct vip_dev *dev = port->dev;
    	struct vip_parser_data *parser = dev->parser;
    	u32 hcrop = 0, vcrop = 0, width = 0;
    
    //	if (port->mbus_framefmt.width > 700)
    //	{
    //		port->mbus_framefmt.width -= 2*H_CROP_DOT;
    //		port->mbus_framefmt.height -= 2*V_CROP_DOT;
    //		printk("DeVdistress: width=%u, height=%u\n", port->mbus_framefmt.width, port->mbus_framefmt.height);
    //	}
    
    	width = port->mbus_framefmt.width;
    
    	if (port->fmt->vpdma_fmt[0] == &vpdma_raw_fmts[VPDMA_DATA_FMT_RAW8]) {
    		/*
    		 * Special case since we are faking a YUV422 16bit format
    		 * to have the vpdma perform the needed byte swap
    		 * we need to adjust the pixel width accordingly
    		 * otherwise the parser will attempt to collect more pixels
    		 * then available and the vpdma transfer will exceed the
    		 * allocated frame buffer.
    		 */
    		width >>= 1;
    		vip_dbg(1, port, "%s: 8 bit raw detected, adjusting width to %d\n",
    			__func__, width);
    	}
    
    	/*
    	 * Set Parser Crop parameters to source size otherwise
    	 * scaler and colorspace converter will yield garbage.
    	 */
    	hcrop = VIP_ACT_BYPASS;
    //	insert_field(&hcrop, H_CROP_DOT, VIP_ACT_SKIP_NUMPIX_MASK,
    //		     VIP_ACT_SKIP_NUMPIX_SHFT);
    //	insert_field(&hcrop, width,
    //		     VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
    //	reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);
    	insert_field(&hcrop, 0, VIP_ACT_SKIP_NUMPIX_MASK,
    	VIP_ACT_SKIP_NUMPIX_SHFT);
    	insert_field(&hcrop, 500,
    	VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
    	reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);
    
    	insert_field(&vcrop, 0/*V_CROP_DOT*/, VIP_ACT_SKIP_NUMLINES_MASK,
    		     VIP_ACT_SKIP_NUMLINES_SHFT);
    	insert_field(&vcrop, port->mbus_framefmt.height,
    		     VIP_ACT_USE_NUMLINES_MASK, VIP_ACT_USE_NUMLINES_SHFT);
    	reg_write(parser, VIP_PARSER_CROP_V_PORT(port->port_id), vcrop);
    
    	return 0;
    }

    root@am57xx-evm:~# gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)288' ! vpe num-input-buffers=8 ! 'video/x-raw,format=(string)YUY2, width=(int)720, height=(int)576' ! queue ! waylandsink use-drm=true

    Probably still need to fix the extension in tvp5150.c?

  • Well i will not be able to help much in gstreamer. can help in VIP..

    Rgds,
    Brijesh
  • Brijesh Jadav said:
    Well i will not be able to help much in gstreamer. can help in VIP..

    This question is not to gstreamer.
    For example, yavta works in a similar way.

    yavta -c10 -fYUYV -Fout_test.yuv -s500x288 /dev/video1

    From the side PC:

    ffplay -f rawvideo -pix_fmt yuyv422 ideo_size 720x288 -framerate 25 -i out_test.yuv


    This is a question for the whole bunch v4l2 + vip + tvp5150.

    It is not clear to me how to properly make 700x286 from the 720x288 resolution, and to do this so that the entire v4l2 system works correctly.

    Brijesh Jadav thank you very much for helping with the VIP.
    Can you tell me where to turn for help?

  • I think the problem is, VIP trimmer is enabled to trim off those black bars, by reducing the horizontal size, but the output still assumes width as 720. So the line offset between two lines is 720*2, though the actual number of pixels are less than 720. For the remaining pixels, the value is 0 and that's why it is shown as green.
    May be you want to change dma output size also to what VIP is configured to output, ie USE_NUMPIX field..

    Rgds,
    Brijesh
  • It seems I almost succeeded! Tomorrow I will write about the result!

  • Problem solved.
    Key solution in tvp5150.c:

    #define TVP5150_H_MAX (720U - 24U).

    A macro change must be a multiple of 8 otherwise it does not work.

    root@am57xx-evm:~# v4l2-ctl -d /dev/video1 -V
    Format Video Capture:
    Width/Height : 696/286
    Pixel Format : 'UYVY'
    Field : Alternating
    Bytes per Line : 1392
    Size Image : 398112
    Colorspace : SMPTE 170M
    Transfer Function : Default
    YCbCr Encoding : Default
    Quantization : Default

    To help others:

    5444.vip.c

    3835.tvp5150.c
    /*
     * tvp5150 - Texas Instruments TVP5150A/AM1 and TVP5151 video decoder driver
     *
     * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org)
     * This code is placed under the terms of the GNU General Public License v2
     */
    
    #include <dt-bindings/media/tvp5150.h>
    #include <linux/i2c.h>
    #include <linux/slab.h>
    #include <linux/videodev2.h>
    #include <linux/delay.h>
    #include <linux/gpio/consumer.h>
    #include <linux/module.h>
    #include <linux/of_graph.h>
    #include <media/v4l2-async.h>
    #include <media/v4l2-device.h>
    #include <media/v4l2-ctrls.h>
    #include <media/v4l2-fwnode.h>
    #include <media/v4l2-mc.h>
    
    #include "tvp5150_reg.h"
    
    #define TVP5150_H_MAX			(720U - 24U)
    #define TVP5150_V_MAX_525_60	480U
    #define TVP5150_V_MAX_OTHERS	(576U - 4U)
    #define TVP5150_MAX_CROP_LEFT	511
    #define TVP5150_MAX_CROP_TOP	127
    #define TVP5150_CROP_SHIFT		2
    
    MODULE_DESCRIPTION("Texas Instruments TVP5150A/TVP5150AM1/TVP5151 video decoder driver");
    MODULE_AUTHOR("Mauro Carvalho Chehab");
    MODULE_LICENSE("GPL");
    
    //DeVdistress
    #ifndef MY_USE_BT656
    	#define MY_USE_BT656
    #endif
    
    //DeVdistress
    #if(1)
    	static int debug;
    	module_param(debug, int, 0644);
    	MODULE_PARM_DESC(debug, "Debug level (0-2)");
    #else
    	static int debug = 2;
    #endif
    
    #define dprintk0(__dev, __arg...) dev_dbg_lvl(__dev, 0, 0, __arg)
    
    struct tvp5150 {
    	struct v4l2_subdev sd;
    #ifdef CONFIG_MEDIA_CONTROLLER
    	struct media_pad pads[DEMOD_NUM_PADS];
    	struct media_entity input_ent[TVP5150_INPUT_NUM];
    	struct media_pad input_pad[TVP5150_INPUT_NUM];
    #endif
    	struct v4l2_ctrl_handler hdl;
    	struct v4l2_rect rect;
    
    	v4l2_std_id norm;	/* Current set standard */
    	u32 input;
    	u32 output;
    	int enable;
    
    	u16 dev_id;
    	u16 rom_ver;
    
    	enum v4l2_mbus_type mbus_type;
    };
    
    static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
    {
    	return container_of(sd, struct tvp5150, sd);
    }
    
    static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
    {
    	return &container_of(ctrl->handler, struct tvp5150, hdl)->sd;
    }
    
    static int tvp5150_read(struct v4l2_subdev *sd, unsigned char addr)
    {
    	struct i2c_client *c = v4l2_get_subdevdata(sd);
    	int rc;
    
    	rc = i2c_smbus_read_byte_data(c, addr);
    	if (rc < 0) {
    		dev_err(sd->dev, "i2c i/o error: rc == %d\n", rc);
    		return rc;
    	}
    
    	dev_dbg_lvl(sd->dev, 2, debug, "tvp5150: read 0x%02x = %02x\n", addr, rc);
    
    	return rc;
    }
    
    static int tvp5150_write(struct v4l2_subdev *sd, unsigned char addr,
    				 unsigned char value)
    {
    	struct i2c_client *c = v4l2_get_subdevdata(sd);
    	int rc;
    
    	dev_dbg_lvl(sd->dev, 2, debug, "tvp5150: writing %02x %02x\n", addr, value);
    	rc = i2c_smbus_write_byte_data(c, addr, value);
    	if (rc < 0)
    		dev_err(sd->dev, "i2c i/o error: rc == %d\n", rc);
    
    	return rc;
    }
    
    static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init,
    				const u8 end, int max_line)
    {
    	u8 buf[16];
    	int i = 0, j, len;
    
    	if (max_line > 16) {
    		dprintk0(sd->dev, "too much data to dump\n");
    		return;
    	}
    
    	for (i = init; i < end; i += max_line) {
    		len = (end - i > max_line) ? max_line : end - i;
    
    		for (j = 0; j < len; j++)
    			buf[j] = tvp5150_read(sd, i + j);
    
    		dprintk0(sd->dev, "%s reg %02x = %*ph\n", s, i, len, buf);
    	}
    }
    
    static int tvp5150_log_status(struct v4l2_subdev *sd)
    {
    	dprintk0(sd->dev, "tvp5150: Video input source selection #1 = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_VD_IN_SRC_SEL_1));
    	dprintk0(sd->dev, "tvp5150: Analog channel controls = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_ANAL_CHL_CTL));
    	dprintk0(sd->dev, "tvp5150: Operation mode controls = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_OP_MODE_CTL));
    	dprintk0(sd->dev, "tvp5150: Miscellaneous controls = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_MISC_CTL));
    	dprintk0(sd->dev, "tvp5150: Autoswitch mask= 0x%02x\n",
    		tvp5150_read(sd, TVP5150_AUTOSW_MSK));
    	dprintk0(sd->dev, "tvp5150: Color killer threshold control = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_COLOR_KIL_THSH_CTL));
    	dprintk0(sd->dev, "tvp5150: Luminance processing controls #1 #2 and #3 = %02x %02x %02x\n",
    		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_1),
    		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_2),
    		tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_3));
    	dprintk0(sd->dev, "tvp5150: Brightness control = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_BRIGHT_CTL));
    	dprintk0(sd->dev, "tvp5150: Color saturation control = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_SATURATION_CTL));
    	dprintk0(sd->dev, "tvp5150: Hue control = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_HUE_CTL));
    	dprintk0(sd->dev, "tvp5150: Contrast control = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_CONTRAST_CTL));
    	dprintk0(sd->dev, "tvp5150: Outputs and data rates select = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_DATA_RATE_SEL));
    	dprintk0(sd->dev, "tvp5150: Configuration shared pins = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_CONF_SHARED_PIN));
    	dprintk0(sd->dev, "tvp5150: Active video cropping start = 0x%02x%02x\n",
    		tvp5150_read(sd, TVP5150_ACT_VD_CROP_ST_MSB),
    		tvp5150_read(sd, TVP5150_ACT_VD_CROP_ST_LSB));
    	dprintk0(sd->dev, "tvp5150: Active video cropping stop  = 0x%02x%02x\n",
    		tvp5150_read(sd, TVP5150_ACT_VD_CROP_STP_MSB),
    		tvp5150_read(sd, TVP5150_ACT_VD_CROP_STP_LSB));
    	dprintk0(sd->dev, "tvp5150: Genlock/RTC = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_GENLOCK));
    	dprintk0(sd->dev, "tvp5150: Horizontal sync start = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_HORIZ_SYNC_START));
    	dprintk0(sd->dev, "tvp5150: Vertical blanking start = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_VERT_BLANKING_START));
    	dprintk0(sd->dev, "tvp5150: Vertical blanking stop = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_VERT_BLANKING_STOP));
    	dprintk0(sd->dev, "tvp5150: Chrominance processing control #1 and #2 = %02x %02x\n",
    		tvp5150_read(sd, TVP5150_CHROMA_PROC_CTL_1),
    		tvp5150_read(sd, TVP5150_CHROMA_PROC_CTL_2));
    	dprintk0(sd->dev, "tvp5150: Interrupt reset register B = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_INT_RESET_REG_B));
    	dprintk0(sd->dev, "tvp5150: Interrupt enable register B = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_INT_ENABLE_REG_B));
    	dprintk0(sd->dev, "tvp5150: Interrupt configuration register B = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_INTT_CONFIG_REG_B));
    	dprintk0(sd->dev, "tvp5150: Video standard = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_VIDEO_STD));
    	dprintk0(sd->dev, "tvp5150: Chroma gain factor: Cb=0x%02x Cr=0x%02x\n",
    		tvp5150_read(sd, TVP5150_CB_GAIN_FACT),
    		tvp5150_read(sd, TVP5150_CR_GAIN_FACTOR));
    	dprintk0(sd->dev, "tvp5150: Macrovision on counter = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_MACROVISION_ON_CTR));
    	dprintk0(sd->dev, "tvp5150: Macrovision off counter = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_MACROVISION_OFF_CTR));
    	dprintk0(sd->dev, "tvp5150: ITU-R BT.656.%d timing(TVP5150AM1 only)\n",
    		(tvp5150_read(sd, TVP5150_REV_SELECT) & 1) ? 3 : 4);
    	dprintk0(sd->dev, "tvp5150: Device ID = %02x%02x\n",
    		tvp5150_read(sd, TVP5150_MSB_DEV_ID),
    		tvp5150_read(sd, TVP5150_LSB_DEV_ID));
    	dprintk0(sd->dev, "tvp5150: ROM version = (hex) %02x.%02x\n",
    		tvp5150_read(sd, TVP5150_ROM_MAJOR_VER),
    		tvp5150_read(sd, TVP5150_ROM_MINOR_VER));
    	dprintk0(sd->dev, "tvp5150: Vertical line count = 0x%02x%02x\n",
    		tvp5150_read(sd, TVP5150_VERT_LN_COUNT_MSB),
    		tvp5150_read(sd, TVP5150_VERT_LN_COUNT_LSB));
    	dprintk0(sd->dev, "tvp5150: Interrupt status register B = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_INT_STATUS_REG_B));
    	dprintk0(sd->dev, "tvp5150: Interrupt active register B = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_INT_ACTIVE_REG_B));
    	dprintk0(sd->dev, "tvp5150: Status regs #1 to #5 = %02x %02x %02x %02x %02x\n",
    		tvp5150_read(sd, TVP5150_STATUS_REG_1),
    		tvp5150_read(sd, TVP5150_STATUS_REG_2),
    		tvp5150_read(sd, TVP5150_STATUS_REG_3),
    		tvp5150_read(sd, TVP5150_STATUS_REG_4),
    		tvp5150_read(sd, TVP5150_STATUS_REG_5));
    
    	dump_reg_range(sd, "Teletext filter 1",   TVP5150_TELETEXT_FIL1_INI,
    			TVP5150_TELETEXT_FIL1_END, 8);
    	dump_reg_range(sd, "Teletext filter 2",   TVP5150_TELETEXT_FIL2_INI,
    			TVP5150_TELETEXT_FIL2_END, 8);
    
    	dprintk0(sd->dev, "tvp5150: Teletext filter enable = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_TELETEXT_FIL_ENA));
    	dprintk0(sd->dev, "tvp5150: Interrupt status register A = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_INT_STATUS_REG_A));
    	dprintk0(sd->dev, "tvp5150: Interrupt enable register A = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_INT_ENABLE_REG_A));
    	dprintk0(sd->dev, "tvp5150: Interrupt configuration = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_INT_CONF));
    	dprintk0(sd->dev, "tvp5150: VDP status register = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_VDP_STATUS_REG));
    	dprintk0(sd->dev, "tvp5150: FIFO word count = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_FIFO_WORD_COUNT));
    	dprintk0(sd->dev, "tvp5150: FIFO interrupt threshold = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_FIFO_INT_THRESHOLD));
    	dprintk0(sd->dev, "tvp5150: FIFO reset = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_FIFO_RESET));
    	dprintk0(sd->dev, "tvp5150: Line number interrupt = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_LINE_NUMBER_INT));
    	dprintk0(sd->dev, "tvp5150: Pixel alignment register = 0x%02x%02x\n",
    		tvp5150_read(sd, TVP5150_PIX_ALIGN_REG_HIGH),
    		tvp5150_read(sd, TVP5150_PIX_ALIGN_REG_LOW));
    	dprintk0(sd->dev, "tvp5150: FIFO output control = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_FIFO_OUT_CTRL));
    	dprintk0(sd->dev, "tvp5150: Full field enable = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_FULL_FIELD_ENA));
    	dprintk0(sd->dev, "tvp5150: Full field mode register = 0x%02x\n",
    		tvp5150_read(sd, TVP5150_FULL_FIELD_MODE_REG));
    
    	dump_reg_range(sd, "CC   data",   TVP5150_CC_DATA_INI,
    			TVP5150_CC_DATA_END, 8);
    
    	dump_reg_range(sd, "WSS  data",   TVP5150_WSS_DATA_INI,
    			TVP5150_WSS_DATA_END, 8);
    
    	dump_reg_range(sd, "VPS  data",   TVP5150_VPS_DATA_INI,
    			TVP5150_VPS_DATA_END, 8);
    
    	dump_reg_range(sd, "VITC data",   TVP5150_VITC_DATA_INI,
    			TVP5150_VITC_DATA_END, 10);
    
    	dump_reg_range(sd, "Line mode",   TVP5150_LINE_MODE_INI,
    			TVP5150_LINE_MODE_END, 8);
    	return 0;
    }
    
    /****************************************************************************
    			Basic functions
     ****************************************************************************/
    
    static void tvp5150_selmux(struct v4l2_subdev *sd)
    {
    	int opmode = 0;
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	int input = 0;
    	int val;
    
    	/* Only tvp5150am1 and tvp5151 have signal generator support */
    	if ((decoder->dev_id == 0x5150 && decoder->rom_ver == 0x0400) ||
    	    (decoder->dev_id == 0x5151 && decoder->rom_ver == 0x0100)) {
    		if (!decoder->enable)
    			input = 8;
    	}
    
    //DeVdistress
    #if(1)
    	switch (decoder->input) {
    	case TVP5150_COMPOSITE1:
    		input |= 2;
    		/* fall through */
    	case TVP5150_COMPOSITE0:
    		break;
    	case TVP5150_SVIDEO:
    	default:
    		input |= 1;
    		break;
    	}
    #endif
    
    	dev_dbg_lvl(sd->dev, 1, debug, "Selecting video route: route input=%i, output=%i => tvp5150 input=%i, opmode=%i\n",
    			decoder->input, decoder->output,
    			input, opmode);
    
    	tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode);
    	tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input);
    
    	/*
    	 * Setup the FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK output signals. For
    	 * S-Video we output the vertical lock (VLK) signal on FID/GLCO/VLK/HVLK
    	 * and set INTREQ/GPCL/VBLK to logic 0. For composite we output the
    	 * field indicator (FID) signal on FID/GLCO/VLK/HVLK and set
    	 * INTREQ/GPCL/VBLK to logic 1.
    	 */
    	val = tvp5150_read(sd, TVP5150_MISC_CTL);
    	if (val < 0) {
    		dev_err(sd->dev, "%s: failed with error = %d\n", __func__, val);
    		return;
    	}
    
    	if (decoder->input == TVP5150_SVIDEO)
    		val = (val & ~TVP5150_MISC_CTL_GPCL) | TVP5150_MISC_CTL_HVLK;
    	else
    		val = (val & ~TVP5150_MISC_CTL_HVLK) | TVP5150_MISC_CTL_GPCL;
    	tvp5150_write(sd, TVP5150_MISC_CTL, val);
    };
    
    struct i2c_reg_value {
    	unsigned char reg;
    	unsigned char value;
    };
    
    /* Default values as sugested at TVP5150AM1 datasheet */
    static const struct i2c_reg_value tvp5150_init_default[] = {
    	{ /* 0x00 */
    		TVP5150_VD_IN_SRC_SEL_1,0x00
    	},
    	{ /* 0x01 */
    		TVP5150_ANAL_CHL_CTL,0x15
    	},
    	{ /* 0x02 */
    		TVP5150_OP_MODE_CTL,0x00
    	},
    	{ /* 0x03 */
    		TVP5150_MISC_CTL,0x01
    	},
    	{ /* 0x06 */
    		TVP5150_COLOR_KIL_THSH_CTL,0x10
    	},
    	{ /* 0x07 */
    		TVP5150_LUMA_PROC_CTL_1,0x60
    	},
    	{ /* 0x08 */
    		TVP5150_LUMA_PROC_CTL_2,0x00
    	},
    	{ /* 0x09 */
    		TVP5150_BRIGHT_CTL,0x80
    	},
    	{ /* 0x0a */
    		TVP5150_SATURATION_CTL,0x80
    	},
    	{ /* 0x0b */
    		TVP5150_HUE_CTL,0x00
    	},
    	{ /* 0x0c */
    		TVP5150_CONTRAST_CTL,0x80
    	},
    	{ /* 0x0d */
    		TVP5150_DATA_RATE_SEL,0x47
    	},
    	{ /* 0x0e */
    		TVP5150_LUMA_PROC_CTL_3,0x00
    	},
    	{ /* 0x0f */
    		TVP5150_CONF_SHARED_PIN,0x08
    	},
    	{ /* 0x11 */
    		TVP5150_ACT_VD_CROP_ST_MSB,0x00
    	},
    	{ /* 0x12 */
    		TVP5150_ACT_VD_CROP_ST_LSB,0x00
    	},
    	{ /* 0x13 */
    		TVP5150_ACT_VD_CROP_STP_MSB,0x00
    	},
    	{ /* 0x14 */
    		TVP5150_ACT_VD_CROP_STP_LSB,0x00
    	},
    	{ /* 0x15 */
    		TVP5150_GENLOCK,0x01
    	},
    	{ /* 0x16 */
    		TVP5150_HORIZ_SYNC_START,0x80
    	},
    	{ /* 0x18 */
    		TVP5150_VERT_BLANKING_START,0x00
    	},
    	{ /* 0x19 */
    		TVP5150_VERT_BLANKING_STOP,0x00
    	},
    	{ /* 0x1a */
    		TVP5150_CHROMA_PROC_CTL_1,0x0c
    	},
    	{ /* 0x1b */
    		TVP5150_CHROMA_PROC_CTL_2,0x14
    	},
    	{ /* 0x1c */
    		TVP5150_INT_RESET_REG_B,0x00
    	},
    	{ /* 0x1d */
    		TVP5150_INT_ENABLE_REG_B,0x00
    	},
    	{ /* 0x1e */
    		TVP5150_INTT_CONFIG_REG_B,0x00
    	},
    	{ /* 0x28 */
    		TVP5150_VIDEO_STD,0x00
    	},
    	{ /* 0x2e */
    		TVP5150_MACROVISION_ON_CTR,0x0f
    	},
    	{ /* 0x2f */
    		TVP5150_MACROVISION_OFF_CTR,0x01
    	},
    	{ /* 0xbb */
    		TVP5150_TELETEXT_FIL_ENA,0x00
    	},
    	{ /* 0xc0 */
    		TVP5150_INT_STATUS_REG_A,0x00
    	},
    	{ /* 0xc1 */
    		TVP5150_INT_ENABLE_REG_A,0x00
    	},
    	{ /* 0xc2 */
    		TVP5150_INT_CONF,0x04
    	},
    	{ /* 0xc8 */
    		TVP5150_FIFO_INT_THRESHOLD,0x80
    	},
    	{ /* 0xc9 */
    		TVP5150_FIFO_RESET,0x00
    	},
    	{ /* 0xca */
    		TVP5150_LINE_NUMBER_INT,0x00
    	},
    	{ /* 0xcb */
    		TVP5150_PIX_ALIGN_REG_LOW,0x4e
    	},
    	{ /* 0xcc */
    		TVP5150_PIX_ALIGN_REG_HIGH,0x00
    	},
    	{ /* 0xcd */
    		TVP5150_FIFO_OUT_CTRL,0x01
    	},
    	{ /* 0xcf */
    		TVP5150_FULL_FIELD_ENA,0x00
    	},
    	{ /* 0xd0 */
    		TVP5150_LINE_MODE_INI,0x00
    	},
    	{ /* 0xfc */
    		TVP5150_FULL_FIELD_MODE_REG,0x7f
    	},
    	{ /* end of data */
    		0xff,0xff
    	}
    };
    
    /* Default values as sugested at TVP5150AM1 datasheet */
    static const struct i2c_reg_value tvp5150_init_enable[] = {
    	{
    		TVP5150_CONF_SHARED_PIN, 2
    	},{	/* Automatic offset and AGC enabled */
    		TVP5150_ANAL_CHL_CTL, 0x15
    	},{	/* Activate YCrCb output 0x9 or 0xd ? */
    		TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
    				  TVP5150_MISC_CTL_INTREQ_OE |
    				  TVP5150_MISC_CTL_YCBCR_OE |
    #if(0) //DeVdistress
    				  TVP5150_MISC_CTL_SYNC_OE |
    #endif
    				  TVP5150_MISC_CTL_VBLANK |
    				  TVP5150_MISC_CTL_CLOCK_OE,
    	},{	/* Activates video std autodetection for all standards */
    		TVP5150_AUTOSW_MSK, 0x0
    	},{	/* Default format: 0x47. For 4:2:2: 0x40 */
    		TVP5150_DATA_RATE_SEL, 0x47
    	},{
    		TVP5150_CHROMA_PROC_CTL_1, 0x0c
    	},{
    		TVP5150_CHROMA_PROC_CTL_2, 0x54
    	},{	/* Non documented, but initialized on WinTV USB2 */
    		0x27, 0x20
    	},{
    		0xff,0xff
    	}
    };
    
    struct tvp5150_vbi_type {
    	unsigned int vbi_type;
    	unsigned int ini_line;
    	unsigned int end_line;
    	unsigned int by_field :1;
    };
    
    struct i2c_vbi_ram_value {
    	u16 reg;
    	struct tvp5150_vbi_type type;
    	unsigned char values[16];
    };
    
    /* This struct have the values for each supported VBI Standard
     * by
     tvp5150_vbi_types should follow the same order as vbi_ram_default
     * value 0 means rom position 0x10, value 1 means rom position 0x30
     * and so on. There are 16 possible locations from 0 to 15.
     */
    
    static struct i2c_vbi_ram_value vbi_ram_default[] =
    {
    	/* FIXME: Current api doesn't handle all VBI types, those not
    	   yet supported are placed under #if 0 */
    #if 0
    	[0] = {0x010, /* Teletext, SECAM, WST System A */
    		{V4L2_SLICED_TELETEXT_SECAM,6,23,1},
    		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26,
    		  0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 }
    	},
    #endif
    	[1] = {0x030, /* Teletext, PAL, WST System B */
    		{V4L2_SLICED_TELETEXT_B,6,22,1},
    		{ 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b,
    		  0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 }
    	},
    #if 0
    	[2] = {0x050, /* Teletext, PAL, WST System C */
    		{V4L2_SLICED_TELETEXT_PAL_C,6,22,1},
    		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
    		  0xa6, 0x98, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
    	},
    	[3] = {0x070, /* Teletext, NTSC, WST System B */
    		{V4L2_SLICED_TELETEXT_NTSC_B,10,21,1},
    		{ 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x23,
    		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
    	},
    	[4] = {0x090, /* Tetetext, NTSC NABTS System C */
    		{V4L2_SLICED_TELETEXT_NTSC_C,10,21,1},
    		{ 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
    		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x15, 0x00 }
    	},
    	[5] = {0x0b0, /* Teletext, NTSC-J, NABTS System D */
    		{V4L2_SLICED_TELETEXT_NTSC_D,10,21,1},
    		{ 0xaa, 0xaa, 0xff, 0xff, 0xa7, 0x2e, 0x20, 0x23,
    		  0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
    	},
    	[6] = {0x0d0, /* Closed Caption, PAL/SECAM */
    		{V4L2_SLICED_CAPTION_625,22,22,1},
    		{ 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
    		  0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
    	},
    #endif
    	[7] = {0x0f0, /* Closed Caption, NTSC */
    		{V4L2_SLICED_CAPTION_525,21,21,1},
    		{ 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
    		  0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
    	},
    	[8] = {0x110, /* Wide Screen Signal, PAL/SECAM */
    		{V4L2_SLICED_WSS_625,23,23,1},
    		{ 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42,
    		  0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 }
    	},
    #if 0
    	[9] = {0x130, /* Wide Screen Signal, NTSC C */
    		{V4L2_SLICED_WSS_525,20,20,1},
    		{ 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43,
    		  0x69, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00 }
    	},
    	[10] = {0x150, /* Vertical Interval Timecode (VITC), PAL/SECAM */
    		{V4l2_SLICED_VITC_625,6,22,0},
    		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
    		  0xa6, 0x85, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
    	},
    	[11] = {0x170, /* Vertical Interval Timecode (VITC), NTSC */
    		{V4l2_SLICED_VITC_525,10,20,0},
    		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
    		  0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
    	},
    #endif
    	[12] = {0x190, /* Video Program System (VPS), PAL */
    		{V4L2_SLICED_VPS,16,16,0},
    		{ 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d,
    		  0xa6, 0xda, 0x0b, 0x00, 0x00, 0x00, 0x60, 0x00 }
    	},
    	/* 0x1d0 User programmable */
    };
    
    static int tvp5150_write_inittab(struct v4l2_subdev *sd,
    				const struct i2c_reg_value *regs)
    {
    	while (regs->reg != 0xff) {
    		tvp5150_write(sd, regs->reg, regs->value);
    		regs++;
    	}
    	return 0;
    }
    
    static int tvp5150_vdp_init(struct v4l2_subdev *sd)
    {
    	unsigned int i;
    	int j;
    
    	/* Disable Full Field */
    	tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0);
    
    	/* Before programming, Line mode should be at 0xff */
    	for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++)
    		tvp5150_write(sd, i, 0xff);
    
    	/* Load Ram Table */
    	for (j = 0; j < ARRAY_SIZE(vbi_ram_default); j++) {
    		const struct i2c_vbi_ram_value *regs = &vbi_ram_default[j];
    
    		if (!regs->type.vbi_type)
    			continue;
    
    		tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_HIGH, regs->reg >> 8);
    		tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_LOW, regs->reg);
    
    		for (i = 0; i < 16; i++)
    			tvp5150_write(sd, TVP5150_VDP_CONF_RAM_DATA, regs->values[i]);
    	}
    	return 0;
    }
    
    /* Fills VBI capabilities based on i2c_vbi_ram_value struct */
    static int tvp5150_g_sliced_vbi_cap(struct v4l2_subdev *sd,
    				struct v4l2_sliced_vbi_cap *cap)
    {
    	int line, i;
    
    	dev_dbg_lvl(sd->dev, 1, debug, "g_sliced_vbi_cap\n");
    	memset(cap, 0, sizeof *cap);
    
    	for (i = 0; i < ARRAY_SIZE(vbi_ram_default); i++) {
    		const struct i2c_vbi_ram_value *regs = &vbi_ram_default[i];
    
    		if (!regs->type.vbi_type)
    			continue;
    
    		for (line = regs->type.ini_line;
    		     line <= regs->type.end_line;
    		     line++) {
    			cap->service_lines[0][line] |= regs->type.vbi_type;
    		}
    		cap->service_set |= regs->type.vbi_type;
    	}
    	return 0;
    }
    
    /* Set vbi processing
     * type - one of tvp5150_vbi_types
     * line - line to gather data
     * fields: bit 0 field1, bit 1, field2
     * flags (default=0xf0) is a bitmask, were set means:
     *	bit 7: enable filtering null bytes on CC
     *	bit 6: send data also to FIFO
     *	bit 5: don't allow data with errors on FIFO
     *	bit 4: enable ECC when possible
     * pix_align = pix alignment:
     *	LSB = field1
     *	MSB = field2
     */
    static int tvp5150_set_vbi(struct v4l2_subdev *sd,
    			unsigned int type,u8 flags, int line,
    			const int fields)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	v4l2_std_id std = decoder->norm;
    	u8 reg;
    	int i, pos = 0;
    
    	if (std == V4L2_STD_ALL) {
    		dev_err(sd->dev, "VBI can't be configured without knowing number of lines\n");
    		return 0;
    	} else if (std & V4L2_STD_625_50) {
    		/* Don't follow NTSC Line number convension */
    		line += 3;
    	}
    
    	if (line < 6 || line > 27)
    		return 0;
    
    	for (i = 0; i < ARRAY_SIZE(vbi_ram_default); i++) {
    		const struct i2c_vbi_ram_value *regs =  &vbi_ram_default[i];
    
    		if (!regs->type.vbi_type)
    			continue;
    
    		if ((type & regs->type.vbi_type) &&
    		    (line >= regs->type.ini_line) &&
    		    (line <= regs->type.end_line))
    			break;
    		pos++;
    	}
    
    	type = pos | (flags & 0xf0);
    	reg = ((line - 6) << 1) + TVP5150_LINE_MODE_INI;
    
    	if (fields & 1)
    		tvp5150_write(sd, reg, type);
    
    	if (fields & 2)
    		tvp5150_write(sd, reg + 1, type);
    
    	return type;
    }
    
    static int tvp5150_get_vbi(struct v4l2_subdev *sd, int line)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	v4l2_std_id std = decoder->norm;
    	u8 reg;
    	int pos, type = 0;
    	int i, ret = 0;
    
    	if (std == V4L2_STD_ALL) {
    		dev_err(sd->dev, "VBI can't be configured without knowing number of lines\n");
    		return 0;
    	} else if (std & V4L2_STD_625_50) {
    		/* Don't follow NTSC Line number convension */
    		line += 3;
    	}
    
    	if (line < 6 || line > 27)
    		return 0;
    
    	reg = ((line - 6) << 1) + TVP5150_LINE_MODE_INI;
    
    	for (i = 0; i <= 1; i++) {
    		ret = tvp5150_read(sd, reg + i);
    		if (ret < 0) {
    			dev_err(sd->dev, "%s: failed with error = %d\n",
    				 __func__, ret);
    			return 0;
    		}
    		pos = ret & 0x0f;
    		if (pos < ARRAY_SIZE(vbi_ram_default))
    			type |= vbi_ram_default[pos].type.vbi_type;
    	}
    
    	return type;
    }
    
    static int tvp5150_set_std(struct v4l2_subdev *sd, v4l2_std_id std)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	int fmt = 0;
    
    	decoder->norm = std;
    
    	/* First tests should be against specific std */
    
    //DeVdistress
    #if(0)
    	if (std == V4L2_STD_NTSC_443) {
    		fmt = VIDEO_STD_NTSC_4_43_BIT;
    	} else if (std == V4L2_STD_PAL_M) {
    		fmt = VIDEO_STD_PAL_M_BIT;
    	} else if (std == V4L2_STD_PAL_N || std == V4L2_STD_PAL_Nc) {
    		fmt = VIDEO_STD_PAL_COMBINATION_N_BIT;
    	} else {
    		// Then, test against generic ones
    		if (std & V4L2_STD_NTSC)
    			fmt = VIDEO_STD_NTSC_MJ_BIT;
    		else if (std & V4L2_STD_PAL)
    			fmt = VIDEO_STD_PAL_BDGHIN_BIT;
    		else if (std & V4L2_STD_SECAM)
    			fmt = VIDEO_STD_SECAM_BIT;
    	}
    #else
    	fmt = VIDEO_STD_PAL_BDGHIN_BIT;
    #endif
    
    	dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt);
    	tvp5150_write(sd, TVP5150_VIDEO_STD, fmt);
    	return 0;
    }
    
    static int tvp5150_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    
    	if (decoder->norm == std)
    		return 0;
    
    	/* Change cropping height limits */
    	if (std & V4L2_STD_525_60)
    		decoder->rect.height = TVP5150_V_MAX_525_60;
    	else
    		decoder->rect.height = TVP5150_V_MAX_OTHERS;
    
    
    	return tvp5150_set_std(sd, std);
    }
    
    static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    
    	/* Initializes TVP5150 to its default values */
    	tvp5150_write_inittab(sd, tvp5150_init_default);
    
    	/* Initializes VDP registers */
    	tvp5150_vdp_init(sd);
    
    	/* Selects decoder input */
    	tvp5150_selmux(sd);
    
    	/* Initializes TVP5150 to stream enabled values */
    	tvp5150_write_inittab(sd, tvp5150_init_enable);
    
    	/* Initialize image preferences */
    	v4l2_ctrl_handler_setup(&decoder->hdl);
    
    	tvp5150_set_std(sd, decoder->norm);
    
    	if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
    		tvp5150_write(sd, TVP5150_DATA_RATE_SEL, 0x40);
    
    	return 0;
    };
    
    static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl)
    {
    	struct v4l2_subdev *sd = to_sd(ctrl);
    	struct tvp5150 *decoder = to_tvp5150(sd);
    
    	switch (ctrl->id) {
    	case V4L2_CID_BRIGHTNESS:
    		tvp5150_write(sd, TVP5150_BRIGHT_CTL, ctrl->val);
    		return 0;
    	case V4L2_CID_CONTRAST:
    		tvp5150_write(sd, TVP5150_CONTRAST_CTL, ctrl->val);
    		return 0;
    	case V4L2_CID_SATURATION:
    		tvp5150_write(sd, TVP5150_SATURATION_CTL, ctrl->val);
    		return 0;
    	case V4L2_CID_HUE:
    		tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val);
    		break;
    	case V4L2_CID_TEST_PATTERN:
    		decoder->enable = ctrl->val ? false : true;
    		tvp5150_selmux(sd);
    		return 0;
    	}
    	return -EINVAL;
    }
    
    static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd)
    {
    	int val = tvp5150_read(sd, TVP5150_STATUS_REG_5);
    
    	switch (val & 0x0F) {
    	case 0x01:
    		return V4L2_STD_NTSC;
    	case 0x03:
    		return V4L2_STD_PAL;
    	case 0x05:
    		return V4L2_STD_PAL_M;
    	case 0x07:
    		return V4L2_STD_PAL_N | V4L2_STD_PAL_Nc;
    	case 0x09:
    		return V4L2_STD_NTSC_443;
    	case 0xb:
    		return V4L2_STD_SECAM;
    	default:
    		return V4L2_STD_UNKNOWN;
    	}
    }
    
    static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
    		struct v4l2_subdev_pad_config *cfg,
    		struct v4l2_subdev_format *format)
    {
    	struct v4l2_mbus_framefmt *f;
    	struct tvp5150 *decoder = to_tvp5150(sd);
    
    	//DeVdistress
    #if(0)
    	if (!format || (format->pad != DEMOD_PAD_VID_OUT))
    		return -EINVAL;
    #else
    	if (!format || format->pad)
    		return -EINVAL;
    #endif
    
    	f = &format->format;
    
    	//DeVdistress
    #if(1)
    	f->width  = decoder->rect.width;
    #else
    	f->width  = 700;
    #endif
    
    	f->height = decoder->rect.height / 2;
    
    	f->code = MEDIA_BUS_FMT_UYVY8_2X8;
    	f->field = V4L2_FIELD_ALTERNATE;
    	f->colorspace = V4L2_COLORSPACE_SMPTE170M;
    
    	dev_dbg_lvl(sd->dev, 1, debug, "width = %d, height = %d\n", f->width,
    			f->height);
    
    	return 0;
    }
    
    static int tvp5150_set_selection(struct v4l2_subdev *sd,
    				 struct v4l2_subdev_pad_config *cfg,
    				 struct v4l2_subdev_selection *sel)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	struct v4l2_rect rect = sel->r;
    	v4l2_std_id std;
    	int hmax;
    
    	if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE ||
    	    sel->target != V4L2_SEL_TGT_CROP)
    		return -EINVAL;
    
    	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
    		__func__, rect.left, rect.top, rect.width, rect.height);
    
    	/* tvp5150 has some special limits */
    	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
    	rect.width = clamp_t(unsigned int, rect.width,
    			     TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left,
    			     TVP5150_H_MAX - rect.left);
    	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
    
    	/* Calculate height based on current standard */
    	if (decoder->norm == V4L2_STD_ALL)
    		std = tvp5150_read_std(sd);
    	else
    		std = decoder->norm;
    
    	if (std & V4L2_STD_525_60)
    		hmax = TVP5150_V_MAX_525_60;
    	else
    		hmax = TVP5150_V_MAX_OTHERS;
    
    	rect.height = clamp_t(unsigned int, rect.height,
    			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
    			      hmax - rect.top);
    
    	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
    	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
    		      rect.top + rect.height - hmax);
    	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
    		      rect.left >> TVP5150_CROP_SHIFT);
    	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
    		      rect.left | (1 << TVP5150_CROP_SHIFT));
    	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
    		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
    		      TVP5150_CROP_SHIFT);
    	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
    		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);
    
    	decoder->rect = rect;
    
    	return 0;
    }
    
    static int tvp5150_get_selection(struct v4l2_subdev *sd,
    				 struct v4l2_subdev_pad_config *cfg,
    				 struct v4l2_subdev_selection *sel)
    {
    	struct tvp5150 *decoder = container_of(sd, struct tvp5150, sd);
    	v4l2_std_id std;
    
    	if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE)
    		return -EINVAL;
    
    	switch (sel->target) {
    	case V4L2_SEL_TGT_CROP_BOUNDS:
    	case V4L2_SEL_TGT_CROP_DEFAULT:
    		sel->r.left = 0;
    		sel->r.top = 0;
    		sel->r.width = TVP5150_H_MAX;
    
    		/* Calculate height based on current standard */
    		if (decoder->norm == V4L2_STD_ALL)
    			std = tvp5150_read_std(sd);
    		else
    			std = decoder->norm;
    		if (std & V4L2_STD_525_60)
    			sel->r.height = TVP5150_V_MAX_525_60;
    		else
    			sel->r.height = TVP5150_V_MAX_OTHERS;
    		return 0;
    	case V4L2_SEL_TGT_CROP:
    		sel->r = decoder->rect;
    		return 0;
    	default:
    		return -EINVAL;
    	}
    }
    
    static int tvp5150_g_mbus_config(struct v4l2_subdev *sd,
    				 struct v4l2_mbus_config *cfg)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    
    	cfg->type = decoder->mbus_type;
    	cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING
    		   | V4L2_MBUS_FIELD_EVEN_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH;
    
    	return 0;
    }
    
    /****************************************************************************
    			V4L2 subdev pad ops
     ****************************************************************************/
    static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
    		struct v4l2_subdev_pad_config *cfg,
    		struct v4l2_subdev_mbus_code_enum *code)
    {
    	if (code->pad || code->index)
    		return -EINVAL;
    
    	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
    	return 0;
    }
    
    static int tvp5150_enum_frame_size(struct v4l2_subdev *sd,
    				   struct v4l2_subdev_pad_config *cfg,
    				   struct v4l2_subdev_frame_size_enum *fse)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    
    	if (fse->index >= 8 || fse->code != MEDIA_BUS_FMT_UYVY8_2X8)
    		return -EINVAL;
    
    	fse->code = MEDIA_BUS_FMT_UYVY8_2X8;
    	//DeVdistress
    #if(1)
    	fse->min_width = decoder->rect.width;
    	fse->max_width = decoder->rect.width;
    #else
    	fse->min_width = 700;
    	fse->max_width = 700;
    #endif
    
    	fse->min_height = decoder->rect.height / 2;
    	fse->max_height = decoder->rect.height / 2;
    
    	return 0;
    }
    
    /****************************************************************************
    			Media entity ops
     ****************************************************************************/
    
    #ifdef CONFIG_MEDIA_CONTROLLER
    static int tvp5150_link_setup(struct media_entity *entity,
    			      const struct media_pad *local,
    			      const struct media_pad *remote, u32 flags)
    {
    	struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	int i;
    
    	for (i = 0; i < TVP5150_INPUT_NUM; i++) {
    		if (remote->entity == &decoder->input_ent[i])
    			break;
    	}
    
    	/* Do nothing for entities that are not input connectors */
    	if (i == TVP5150_INPUT_NUM)
    		return 0;
    
    	decoder->input = i;
    
    	tvp5150_selmux(sd);
    
    	return 0;
    }
    
    static const struct media_entity_operations tvp5150_sd_media_ops = {
    	.link_setup = tvp5150_link_setup,
    };
    #endif
    
    /****************************************************************************
    			I2C Command
     ****************************************************************************/
    
    static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	int val;
    
    	/* Enable or disable the video output signals. */
    	val = tvp5150_read(sd, TVP5150_MISC_CTL);
    	if (val < 0)
    		return val;
    
    	val &= ~(TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_SYNC_OE |
    		 TVP5150_MISC_CTL_CLOCK_OE);
    
    	if (enable) {
    		/*
    		 * Enable the YCbCr and clock outputs. In discrete sync mode
    		 * (non-BT.656) additionally enable the the sync outputs.
    		 */
    		val |= TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_CLOCK_OE;
    		if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
    			val |= TVP5150_MISC_CTL_SYNC_OE;
    	}
    
    	tvp5150_write(sd, TVP5150_MISC_CTL, val);
    
    	return 0;
    }
    
    static int tvp5150_s_routing(struct v4l2_subdev *sd,
    			     u32 input, u32 output, u32 config)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    
    	decoder->input = input;
    	decoder->output = output;
    
    	if (output == TVP5150_BLACK_SCREEN)
    		decoder->enable = false;
    	else
    		decoder->enable = true;
    
    	tvp5150_selmux(sd);
    	return 0;
    }
    
    static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt)
    {
    	/* this is for capturing 36 raw vbi lines
    	   if there's a way to cut off the beginning 2 vbi lines
    	   with the tvp5150 then the vbi line count could be lowered
    	   to 17 lines/field again, although I couldn't find a register
    	   which could do that cropping */
    	if (fmt->sample_format == V4L2_PIX_FMT_GREY)
    		tvp5150_write(sd, TVP5150_LUMA_PROC_CTL_1, 0x70);
    	if (fmt->count[0] == 18 && fmt->count[1] == 18) {
    		tvp5150_write(sd, TVP5150_VERT_BLANKING_START, 0x00);
    		tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, 0x01);
    	}
    	return 0;
    }
    
    static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
    {
    	int i;
    
    	if (svbi->service_set != 0) {
    		for (i = 0; i <= 23; i++) {
    			svbi->service_lines[1][i] = 0;
    			svbi->service_lines[0][i] =
    				tvp5150_set_vbi(sd, svbi->service_lines[0][i],
    						0xf0, i, 3);
    		}
    		/* Enables FIFO */
    		tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 1);
    	} else {
    		/* Disables FIFO*/
    		tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 0);
    
    		/* Disable Full Field */
    		tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0);
    
    		/* Disable Line modes */
    		for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++)
    			tvp5150_write(sd, i, 0xff);
    	}
    	return 0;
    }
    
    static int tvp5150_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
    {
    	int i, mask = 0;
    
    	memset(svbi->service_lines, 0, sizeof(svbi->service_lines));
    
    	for (i = 0; i <= 23; i++) {
    		svbi->service_lines[0][i] =
    			tvp5150_get_vbi(sd, i);
    		mask |= svbi->service_lines[0][i];
    	}
    	svbi->service_set = mask;
    	return 0;
    }
    
    #ifdef CONFIG_VIDEO_ADV_DEBUG
    static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
    {
    	int res;
    
    	res = tvp5150_read(sd, reg->reg & 0xff);
    	if (res < 0) {
    		dev_err(sd->dev, "%s: failed with error = %d\n", __func__, res);
    		return res;
    	}
    
    	reg->val = res;
    	reg->size = 1;
    	return 0;
    }
    
    static int tvp5150_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg)
    {
    	return tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff);
    }
    #endif
    
    static int tvp5150_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
    {
    	int status = tvp5150_read(sd, 0x88);
    
    	vt->signal = ((status & 0x04) && (status & 0x02)) ? 0xffff : 0x0;
    	return 0;
    }
    
    static int tvp5150_registered(struct v4l2_subdev *sd)
    {
    #ifdef CONFIG_MEDIA_CONTROLLER
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	int ret = 0;
    	int i;
    
    	for (i = 0; i < TVP5150_INPUT_NUM; i++) {
    		struct media_entity *input = &decoder->input_ent[i];
    		struct media_pad *pad = &decoder->input_pad[i];
    
    		if (!input->name)
    			continue;
    
    		decoder->input_pad[i].flags = MEDIA_PAD_FL_SOURCE;
    
    		ret = media_entity_pads_init(input, 1, pad);
    		if (ret < 0)
    			return ret;
    
    		ret = media_device_register_entity(sd->v4l2_dev->mdev, input);
    		if (ret < 0)
    			return ret;
    
    		ret = media_create_pad_link(input, 0, &sd->entity,
    					    DEMOD_PAD_IF_INPUT, 0);
    		if (ret < 0) {
    			media_device_unregister_entity(input);
    			return ret;
    		}
    	}
    #endif
    
    	return 0;
    }
    
    /* ----------------------------------------------------------------------- */
    
    static const struct v4l2_ctrl_ops tvp5150_ctrl_ops = {
    	.s_ctrl = tvp5150_s_ctrl,
    };
    
    static const struct v4l2_subdev_core_ops tvp5150_core_ops = {
    	.log_status = tvp5150_log_status,
    	.reset = tvp5150_reset,
    #ifdef CONFIG_VIDEO_ADV_DEBUG
    	.g_register = tvp5150_g_register,
    	.s_register = tvp5150_s_register,
    #endif
    };
    
    static const struct v4l2_subdev_tuner_ops tvp5150_tuner_ops = {
    	.g_tuner = tvp5150_g_tuner,
    };
    
    static const struct v4l2_subdev_video_ops tvp5150_video_ops = {
    	.s_std = tvp5150_s_std,
    	.s_stream = tvp5150_s_stream,
    	.s_routing = tvp5150_s_routing,
    	.g_mbus_config = tvp5150_g_mbus_config,
    };
    
    static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
    	.g_sliced_vbi_cap = tvp5150_g_sliced_vbi_cap,
    	.g_sliced_fmt = tvp5150_g_sliced_fmt,
    	.s_sliced_fmt = tvp5150_s_sliced_fmt,
    	.s_raw_fmt = tvp5150_s_raw_fmt,
    };
    
    static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = {
    	.enum_mbus_code = tvp5150_enum_mbus_code,
    	.enum_frame_size = tvp5150_enum_frame_size,
    	.set_fmt = tvp5150_fill_fmt,
    	.get_fmt = tvp5150_fill_fmt,
    	.get_selection = tvp5150_get_selection,
    	.set_selection = tvp5150_set_selection,
    };
    
    static const struct v4l2_subdev_ops tvp5150_ops = {
    	.core = &tvp5150_core_ops,
    	.tuner = &tvp5150_tuner_ops,
    	.video = &tvp5150_video_ops,
    	.vbi = &tvp5150_vbi_ops,
    	.pad = &tvp5150_pad_ops,
    };
    
    static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = {
    	.registered = tvp5150_registered,
    };
    
    
    /****************************************************************************
    			I2C Client & Driver
     ****************************************************************************/
    
    static int tvp5150_detect_version(struct tvp5150 *core)
    {
    	struct v4l2_subdev *sd = &core->sd;
    	struct i2c_client *c = v4l2_get_subdevdata(sd);
    	unsigned int i;
    	u8 regs[4];
    	int res;
    
    	/*
    	 * Read consequent registers - TVP5150_MSB_DEV_ID, TVP5150_LSB_DEV_ID,
    	 * TVP5150_ROM_MAJOR_VER, TVP5150_ROM_MINOR_VER
    	 */
    	for (i = 0; i < 4; i++) {
    		res = tvp5150_read(sd, TVP5150_MSB_DEV_ID + i);
    		if (res < 0)
    			return res;
    		regs[i] = res;
    	}
    
    	core->dev_id = (regs[0] << 8) | regs[1];
    	core->rom_ver = (regs[2] << 8) | regs[3];
    
    	dev_info(sd->dev, "tvp%04x (%u.%u) chip found @ 0x%02x (%s)\n",
    		  core->dev_id, regs[2], regs[3], c->addr << 1,
    		  c->adapter->name);
    
    	if (core->dev_id == 0x5150 && core->rom_ver == 0x0321) {
    		dev_info(sd->dev, "tvp5150a detected.\n");
    	} else if (core->dev_id == 0x5150 && core->rom_ver == 0x0400) {
    		dev_info(sd->dev, "tvp5150am1 detected.\n");
    
    		/* ITU-T BT.656.4 timing */
    		tvp5150_write(sd, TVP5150_REV_SELECT, 0);
    	} else if (core->dev_id == 0x5151 && core->rom_ver == 0x0100) {
    		dev_info(sd->dev, "tvp5151 detected.\n");
    	} else {
    		dev_info(sd->dev, "*** unknown tvp%04x chip detected.\n",
    			  core->dev_id);
    	}
    
    	return 0;
    }
    
    static int tvp5150_init(struct i2c_client *c)
    {
    	struct gpio_desc *pdn_gpio;
    	struct gpio_desc *reset_gpio;
    
    	pdn_gpio = devm_gpiod_get_optional(&c->dev, "pdn", GPIOD_OUT_HIGH);
    	if (IS_ERR(pdn_gpio))
    		return PTR_ERR(pdn_gpio);
    
    	if (pdn_gpio) {
    		gpiod_set_value_cansleep(pdn_gpio, 0);
    		/* Delay time between power supplies active and reset */
    		msleep(20);
    	}
    
    	reset_gpio = devm_gpiod_get_optional(&c->dev, "reset", GPIOD_OUT_HIGH);
    	if (IS_ERR(reset_gpio))
    		return PTR_ERR(reset_gpio);
    
    	if (reset_gpio) {
    		/* RESETB pulse duration */
    		ndelay(500);
    		gpiod_set_value_cansleep(reset_gpio, 0);
    		/* Delay time between end of reset to I2C active */
    		usleep_range(200, 250);
    	}
    
    	return 0;
    }
    
    static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
    {
    	struct v4l2_fwnode_endpoint bus_cfg;
    	struct device_node *ep;
    #ifdef CONFIG_MEDIA_CONTROLLER
    	struct device_node *connectors, *child;
    	struct media_entity *input;
    	const char *name;
    	u32 input_type;
    #endif
    	unsigned int flags;
    	int ret = 0;
    
    	ep = of_graph_get_next_endpoint(np, NULL);
    	if (!ep)
    		return -EINVAL;
    
    	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
    	if (ret)
    		goto err;
    
    	flags = bus_cfg.bus.parallel.flags;
    
    	if (bus_cfg.bus_type == V4L2_MBUS_PARALLEL &&
    	    !(flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH &&
    	      flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH &&
    	      flags & V4L2_MBUS_FIELD_EVEN_LOW)) {
    		ret = -EINVAL;
    		goto err;
    	}
    
    	decoder->mbus_type = bus_cfg.bus_type;
    
    #ifdef CONFIG_MEDIA_CONTROLLER
    	connectors = of_get_child_by_name(np, "connectors");
    
    	if (!connectors)
    		goto err;
    
    	for_each_available_child_of_node(connectors, child) {
    		ret = of_property_read_u32(child, "input", &input_type);
    		if (ret) {
    			dev_err(decoder->sd.dev,
    				 "missing type property in node %s\n",
    				 child->name);
    			goto err_connector;
    		}
    
    		if (input_type >= TVP5150_INPUT_NUM) {
    			ret = -EINVAL;
    			goto err_connector;
    		}
    
    		input = &decoder->input_ent[input_type];
    
    		/* Each input connector can only be defined once */
    		if (input->name) {
    			dev_err(decoder->sd.dev,
    				 "input %s with same type already exists\n",
    				 input->name);
    			ret = -EINVAL;
    			goto err_connector;
    		}
    
    		switch (input_type) {
    		case TVP5150_COMPOSITE0:
    		case TVP5150_COMPOSITE1:
    			input->function = MEDIA_ENT_F_CONN_COMPOSITE;
    			break;
    		case TVP5150_SVIDEO:
    			input->function = MEDIA_ENT_F_CONN_SVIDEO;
    			break;
    		}
    
    		input->flags = MEDIA_ENT_FL_CONNECTOR;
    
    		ret = of_property_read_string(child, "label", &name);
    		if (ret < 0) {
    			dev_err(decoder->sd.dev,
    				 "missing label property in node %s\n",
    				 child->name);
    			goto err_connector;
    		}
    
    		input->name = name;
    	}
    
    err_connector:
    	of_node_put(connectors);
    #endif
    err:
    	of_node_put(ep);
    	return ret;
    }
    
    static const char * const tvp5150_test_patterns[2] = {
    	"Disabled",
    	"Black screen"
    };
    
    //DeVdistress
    #if(0)
    void tvp5150_my_set_selection(struct v4l2_subdev *sd, struct v4l2_rect *sel)
    {
    	struct tvp5150 *decoder = to_tvp5150(sd);
    	struct v4l2_rect rect;
    	v4l2_std_id std;
    	int hmax;
    
    	memcpy(&rect, sel, sizeof(rect));
    
    	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
    		__func__, rect.left, rect.top, rect.width, rect.height);
    
    	/* tvp5150 has some special limits */
    	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
    	rect.width = clamp_t(unsigned int, rect.width,
    			     (TVP5150_H_MAX + rect.left)- TVP5150_MAX_CROP_LEFT - rect.left,
    				 (TVP5150_H_MAX + rect.left) - rect.left);
    	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
    
    	/* Calculate height based on current standard */
    	if (decoder->norm == V4L2_STD_ALL)
    		std = tvp5150_read_std(sd);
    	else
    		std = decoder->norm;
    
    	if (std & V4L2_STD_525_60)
    		hmax = TVP5150_V_MAX_525_60 + rect.top; //было без rect.top
    	else
    		hmax = TVP5150_V_MAX_OTHERS + rect.top; //было без rect.top
    
    	rect.height = clamp_t(unsigned int, rect.height,
    			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
    			      hmax - rect.top);
    
    	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
    	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
    		      rect.top + rect.height - hmax);
    	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
    		      rect.left >> TVP5150_CROP_SHIFT);
    	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
    		      rect.left | (1 << TVP5150_CROP_SHIFT));
    	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
    		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
    		      TVP5150_CROP_SHIFT);
    	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
    		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);
    
    	decoder->rect = rect;
    }
    #endif
    
    static int tvp5150_probe(struct i2c_client *c,
    			 const struct i2c_device_id *id)
    {
    	struct tvp5150 *core;
    	struct v4l2_subdev *sd;
    	struct device_node *np = c->dev.of_node;
    	int res;
    
    #if(0)//DeVdistress
    	struct v4l2_rect sel;
    #endif
    
    	/* Check if the adapter supports the needed features */
    	if (!i2c_check_functionality(c->adapter,
    	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
    		return -EIO;
    
    	res = tvp5150_init(c);
    	if (res)
    		return res;
    
    	core = devm_kzalloc(&c->dev, sizeof(*core), GFP_KERNEL);
    	if (!core)
    		return -ENOMEM;
    
    	sd = &core->sd;
    
    	if (IS_ENABLED(CONFIG_OF) && np) {
    		res = tvp5150_parse_dt(core, np);
    		if (res) {
    			dev_err(sd->dev, "DT parsing error: %d\n", res);
    			return res;
    		}
    	} else {
    		/* Default to BT.656 embedded sync */
    		core->mbus_type = V4L2_MBUS_BT656;
    	}
    
    	//DeVdistress
    	#if defined(MY_USE_BT656)
    		core->mbus_type = V4L2_MBUS_BT656;
    	#endif
    
    	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
    	sd->internal_ops = &tvp5150_internal_ops;
    	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
    
    #if defined(CONFIG_MEDIA_CONTROLLER)
    	core->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
    	core->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
    	core->pads[DEMOD_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
    
    	sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
    
    	res = media_entity_pads_init(&sd->entity, DEMOD_NUM_PADS, core->pads);
    	if (res < 0)
    		return res;
    
    	sd->entity.ops = &tvp5150_sd_media_ops;
    #endif
    
    	res = tvp5150_detect_version(core);
    	if (res < 0)
    		return res;
    
    //DeVdistress
    #if(0)
    	core->norm = V4L2_STD_ALL;	// Default is autodetect
    	core->input = TVP5150_COMPOSITE1;
    #else
    	core->norm = V4L2_STD_ALL;	// Default is autodetect
    	core->input = TVP5150_COMPOSITE0;
    #endif
    
    	core->enable = true;
    
    	v4l2_ctrl_handler_init(&core->hdl, 5);
    	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
    			V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
    	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
    			V4L2_CID_CONTRAST, 0, 255, 1, 128);
    	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
    			V4L2_CID_SATURATION, 0, 255, 1, 128);
    	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
    			V4L2_CID_HUE, -128, 127, 1, 0);
    	v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
    			V4L2_CID_PIXEL_RATE, 27000000,
    			27000000, 1, 27000000);
    	v4l2_ctrl_new_std_menu_items(&core->hdl, &tvp5150_ctrl_ops,
    				     V4L2_CID_TEST_PATTERN,
    				     ARRAY_SIZE(tvp5150_test_patterns),
    				     0, 0, tvp5150_test_patterns);
    	sd->ctrl_handler = &core->hdl;
    	if (core->hdl.error) {
    		res = core->hdl.error;
    		goto err;
    	}
    
    	/* Default is no cropping */
    	core->rect.top = 0;
    
    	// DeVdistress
    #if(0)
    	if (tvp5150_read_std(sd) & V4L2_STD_525_60)
    		core->rect.height = TVP5150_V_MAX_525_60;
    	else
    		core->rect.height = TVP5150_V_MAX_OTHERS;
    #else
    	core->rect.height = TVP5150_V_MAX_OTHERS;
    #endif
    
    	core->rect.left = 0;
    	core->rect.width = TVP5150_H_MAX;
    
    #if(0)//DeVdistress
    	sel.left   = core->rect.left;
    	sel.top    = core->rect.top;
    	sel.width  = core->rect.width;
    	sel.height = core->rect.height;
    	tvp5150_my_set_selection(sd, &sel);
    #endif
    
    	tvp5150_reset(sd, 0);	/* Calls v4l2_ctrl_handler_setup() */
    
    	res = v4l2_async_register_subdev(sd);
    	if (res < 0)
    		goto err;
    
    	if (debug > 1)
    		tvp5150_log_status(sd);
    	return 0;
    
    err:
    	v4l2_ctrl_handler_free(&core->hdl);
    	return res;
    }
    
    static int tvp5150_remove(struct i2c_client *c)
    {
    	struct v4l2_subdev *sd = i2c_get_clientdata(c);
    	struct tvp5150 *decoder = to_tvp5150(sd);
    
    	dev_dbg_lvl(sd->dev, 1, debug,
    		"tvp5150.c: removing tvp5150 adapter on address 0x%x\n",
    		c->addr << 1);
    
    	v4l2_async_unregister_subdev(sd);
    	v4l2_ctrl_handler_free(&decoder->hdl);
    	return 0;
    }
    
    /* ----------------------------------------------------------------------- */
    
    static const struct i2c_device_id tvp5150_id[] = {
    	{ "tvp5150", 0 },
    	{ }
    };
    MODULE_DEVICE_TABLE(i2c, tvp5150_id);
    
    #if IS_ENABLED(CONFIG_OF)
    static const struct of_device_id tvp5150_of_match[] = {
    	{ .compatible = "ti,tvp5150", },
    	{ /* sentinel */ },
    };
    MODULE_DEVICE_TABLE(of, tvp5150_of_match);
    #endif
    
    static struct i2c_driver tvp5150_driver = {
    	.driver = {
    		.of_match_table = of_match_ptr(tvp5150_of_match),
    		.name	= "tvp5150",
    	},
    	.probe		= tvp5150_probe,
    	.remove		= tvp5150_remove,
    	.id_table	= tvp5150_id,
    };
    
    module_i2c_driver(tvp5150_driver);
    

    3343.patch.vip.c
    --- vip.c~original	2018-12-20 07:34:34.000000000 +0300
    +++ vip.c	2019-02-27 11:27:30.885787219 +0300
    @@ -39,10 +39,30 @@
     #define VIP_MODULE_NAME "vip"
     #define VIP_INPUT_NAME "Vin0"
     
    -static int debug;
    -module_param(debug, int, 0644);
    -MODULE_PARM_DESC(debug, "debug level (0-8)");
    -
    +//DeVdistress
    +#ifndef MY_USE_BT656
    +	#define MY_USE_BT656
    +#endif
    +
    +// DeVdistress
    +// In discrete sync capture, VIP capture entire frame including blanking portion. Which is why you are seeing these black stripes.
    +// You could either removed them in the code or can remove in the VIP itself. VIP parser has some trim register, you could use them to remove this blanking portion..
    +#if defined(MY_USE_BT656)
    +	#define H_CROP_DOT		(12)  // (10)
    +	#define V_CROP_DOT		(1)
    +#else
    +	#define H_CROP_DOT		(135) // vip must discard blanking portion by 135 points horizontally
    +	#define V_CROP_DOT		(21)  // vip must discard blanking portion by 21 points vertically
    +#endif
    +
    +//DeVdistress
    +#if(1)
    +	static int debug;
    +	module_param(debug, int, 0644);
    +	MODULE_PARM_DESC(debug, "debug level (0-8)");
    +#else
    +	static int debug = 3;
    +#endif
     /*
      * Minimum and maximum frame sizes
      */
    @@ -2938,6 +2958,7 @@
     
     	/* Properly calculate the sizeimage and bytesperline values. */
     	v4l2_fill_pix_format(&f.fmt.pix, mbus_fmt);
    +
     	f.fmt.pix.pixelformat = fmt->fourcc;
     	ret = vip_calc_format_size(port, fmt, &f);
     	if (ret)
    @@ -2989,8 +3010,19 @@
     {
     	struct vip_dev *dev = port->dev;
     	struct vip_parser_data *parser = dev->parser;
    -	u32 hcrop = 0, vcrop = 0;
    -	u32 width = port->mbus_framefmt.width;
    +	u32 hcrop = 0, vcrop = 0, width = 0;
    +
    +	//DeVdistress
    +#if(0)
    +	if (port->mbus_framefmt.width > (720 - (2*H_CROP_DOT)))
    +	{
    +		port->mbus_framefmt.width -= 2*H_CROP_DOT;
    +		port->mbus_framefmt.height -= 2*V_CROP_DOT;
    +		printk("DeVdistress: width=%u, height=%u\n", port->mbus_framefmt.width, port->mbus_framefmt.height);
    +	}
    +#endif
    +
    +	width = port->mbus_framefmt.width;
     
     	if (port->fmt->vpdma_fmt[0] == &vpdma_raw_fmts[VPDMA_DATA_FMT_RAW8]) {
     		/*
    @@ -3011,13 +3043,13 @@
     	 * scaler and colorspace converter will yield garbage.
     	 */
     	hcrop = VIP_ACT_BYPASS;
    -	insert_field(&hcrop, 0, VIP_ACT_SKIP_NUMPIX_MASK,
    +	insert_field(&hcrop, H_CROP_DOT, VIP_ACT_SKIP_NUMPIX_MASK,
     		     VIP_ACT_SKIP_NUMPIX_SHFT);
     	insert_field(&hcrop, width,
     		     VIP_ACT_USE_NUMPIX_MASK, VIP_ACT_USE_NUMPIX_SHFT);
     	reg_write(parser, VIP_PARSER_CROP_H_PORT(port->port_id), hcrop);
     
    -	insert_field(&vcrop, 0, VIP_ACT_SKIP_NUMLINES_MASK,
    +	insert_field(&vcrop, V_CROP_DOT, VIP_ACT_SKIP_NUMLINES_MASK,
     		     VIP_ACT_SKIP_NUMLINES_SHFT);
     	insert_field(&vcrop, port->mbus_framefmt.height,
     		     VIP_ACT_USE_NUMLINES_MASK, VIP_ACT_USE_NUMLINES_SHFT);
    @@ -3051,24 +3083,40 @@
     		 */
     		if (vip_is_mbuscode_rgb(port->fmt->code)) {
     			sync_type = EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444;
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_RGB_OR_YUV444\n", "vip_setup_parser");
     		} else {
     			switch (endpoint->bus.parallel.num_channels) {
     			case 4:
     				sync_type = EMBEDDED_SYNC_4X_MULTIPLEXED_YUV422;
    +				//DeVdistress
    +				//vip_dbg(1, dev, "%s: EMBEDDED_SYNC_4X_MULTIPLEXED_YUV422\n", "vip_setup_parser");
     				break;
     			case 2:
     				sync_type = EMBEDDED_SYNC_2X_MULTIPLEXED_YUV422;
    +				//DeVdistress
    +				//vip_dbg(1, dev, "%s: EMBEDDED_SYNC_2X_MULTIPLEXED_YUV422\n", "vip_setup_parser");
     				break;
     			case 1:
     				sync_type = EMBEDDED_SYNC_SINGLE_YUV422;
    +				//DeVdistress
    +				//vip_dbg(1, dev, "%s: EMBEDDED_SYNC_SINGLE_YUV422\n", "vip_setup_parser");
     				break;
     			default:
     				sync_type =
     				EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422;
    +				//DeVdistress
    +				//vip_dbg(1, dev, "%s: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422!\n", "vip_setup_parser");
     			}
    -			if (endpoint->bus.parallel.pixmux == 0)
    +//DeVdistress
    +#if(0)
    +			if (endpoint->bus.parallel.pixmux == 0){
     				sync_type =
     				EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422;
    +				//DeVdistress
    +				vip_dbg(1, dev, "%s: EMBEDDED_SYNC_LINE_MULTIPLEXED_YUV422\n", "vip_setup_parser");
    +			}
    +#endif
     		}
     
     	} else if (endpoint->bus_type == V4L2_MBUS_PARALLEL) {
    @@ -3077,29 +3125,53 @@
     		switch (endpoint->bus.parallel.bus_width) {
     		case 24:
     			iface = SINGLE_24B_INTERFACE;
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: SINGLE_24B_INTERFACE\n", "vip_setup_parser");
     		break;
     		case 16:
     			iface = SINGLE_16B_INTERFACE;
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: SINGLE_16B_INTERFACE\n", "vip_setup_parser");
     		break;
     		case 8:
     		default:
     			iface = DUAL_8B_INTERFACE;
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: DUAL_8B_INTERFACE\n", "vip_setup_parser");
     		}
     
    -		if (vip_is_mbuscode_rgb(port->fmt->code))
    +		if (vip_is_mbuscode_rgb(port->fmt->code)){
     			sync_type = DISCRETE_SYNC_SINGLE_RGB_24B;
    -		else
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: DISCRETE_SYNC_SINGLE_RGB_24B\n", "vip_setup_parser");
    +		}
    +		else{
     			sync_type = DISCRETE_SYNC_SINGLE_YUV422;
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: DISCRETE_SYNC_SINGLE_YUV422\n", "vip_setup_parser");
    +		}
     
    -		if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
    +		if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH){
     			config0 |= VIP_HSYNC_POLARITY;
    -		else if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: VIP_HSYNC_POLARITY=1\n", "vip_setup_parser");
    +		}
    +		else if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW){
     			config0 &= ~VIP_HSYNC_POLARITY;
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: VIP_HSYNC_POLARITY=0\n", "vip_setup_parser");
    +		}
     
    -		if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
    +		if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH){
     			config0 |= VIP_VSYNC_POLARITY;
    -		else if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: VIP_VSYNC_POLARITY=1\n", "vip_setup_parser");
    +		}
    +		else if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW){
     			config0 &= ~VIP_VSYNC_POLARITY;
    +			//DeVdistress
    +			//vip_dbg(1, dev, "%s: VIP_VSYNC_POLARITY=0\n", "vip_setup_parser");
    +		}
     
     		config0 &= ~VIP_USE_ACTVID_HSYNC_ONLY;
     		config0 |= VIP_ACTVID_POLARITY;
    @@ -3113,8 +3185,13 @@
     	if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) {
     		vip_set_pclk_invert(port);
     		config0 |= VIP_PIXCLK_EDGE_POLARITY;
    +		//DeVdistress
    +		//vip_dbg(1, dev, "%s: VIP_PIXCLK_EDGE_POLARITY=1\n", "vip_setup_parser");
    +
     	} else {
     		config0 &= ~VIP_PIXCLK_EDGE_POLARITY;
    +		//DeVdistress
    +		//vip_dbg(1, dev, "%s: VIP_PIXCLK_EDGE_POLARITY=0\n", "vip_setup_parser");
     	}
     
     	config0 |= ((sync_type & VIP_SYNC_TYPE_MASK) << VIP_SYNC_TYPE_SHFT);
    @@ -3562,14 +3639,23 @@
     		port->flags |= FLAG_MULT_PORT;
     		port->num_streams_configured = 1;
     		alloc_stream(port, 0, VFL_TYPE_GRABBER);
    +		//DeVdistress
    +		//vip_dbg(1, port, "%s: bus_type = V4L2_MBUS_PARALLEL\n", "vip_create_streams");
     	} else if (port->endpoint->bus_type == V4L2_MBUS_BT656) {
     		port->flags |= FLAG_MULT_PORT;
     		bus = &port->endpoint->bus.parallel;
    +//DeVdistress
    +#if(0)
     		port->num_streams_configured = bus->num_channels;
    +#else
    +		port->num_streams_configured = bus->num_channels = 1;
    +#endif
     		for (i = 0; i < bus->num_channels; i++) {
     			if (bus->channels[i] >= 16)
     				continue;
     			alloc_stream(port, bus->channels[i], VFL_TYPE_GRABBER);
    +			//DeVdistress
    +			//vip_dbg(1, port, "%s[channel-%u]: bus_type = V4L2_MBUS_BT656\n", "vip_create_streams", i);
     		}
     	}
     	return 0;
    
    1781.patch.tvp5150.c
    --- tvp5150.c~original	2019-02-08 11:41:07.329365976 +0300
    +++ tvp5150.c	2019-02-27 10:55:12.909741708 +0300
    @@ -21,21 +21,30 @@
     
     #include "tvp5150_reg.h"
     
    -#define TVP5150_H_MAX		720U
    +#define TVP5150_H_MAX			(720U - 24U)
     #define TVP5150_V_MAX_525_60	480U
    -#define TVP5150_V_MAX_OTHERS	576U
    +#define TVP5150_V_MAX_OTHERS	(576U - 4U)
     #define TVP5150_MAX_CROP_LEFT	511
     #define TVP5150_MAX_CROP_TOP	127
    -#define TVP5150_CROP_SHIFT	2
    +#define TVP5150_CROP_SHIFT		2
     
     MODULE_DESCRIPTION("Texas Instruments TVP5150A/TVP5150AM1/TVP5151 video decoder driver");
     MODULE_AUTHOR("Mauro Carvalho Chehab");
     MODULE_LICENSE("GPL");
     
    +//DeVdistress
    +#ifndef MY_USE_BT656
    +	#define MY_USE_BT656
    +#endif
     
    -static int debug;
    -module_param(debug, int, 0644);
    -MODULE_PARM_DESC(debug, "Debug level (0-2)");
    +//DeVdistress
    +#if(1)
    +	static int debug;
    +	module_param(debug, int, 0644);
    +	MODULE_PARM_DESC(debug, "Debug level (0-2)");
    +#else
    +	static int debug = 2;
    +#endif
     
     #define dprintk0(__dev, __arg...) dev_dbg_lvl(__dev, 0, 0, __arg)
     
    @@ -273,6 +282,8 @@
     			input = 8;
     	}
     
    +//DeVdistress
    +#if(1)
     	switch (decoder->input) {
     	case TVP5150_COMPOSITE1:
     		input |= 2;
    @@ -284,6 +295,7 @@
     		input |= 1;
     		break;
     	}
    +#endif
     
     	dev_dbg_lvl(sd->dev, 1, debug, "Selecting video route: route input=%i, output=%i => tvp5150 input=%i, opmode=%i\n",
     			decoder->input, decoder->output,
    @@ -463,7 +475,9 @@
     		TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
     				  TVP5150_MISC_CTL_INTREQ_OE |
     				  TVP5150_MISC_CTL_YCBCR_OE |
    +#if(0) //DeVdistress
     				  TVP5150_MISC_CTL_SYNC_OE |
    +#endif
     				  TVP5150_MISC_CTL_VBLANK |
     				  TVP5150_MISC_CTL_CLOCK_OE,
     	},{	/* Activates video std autodetection for all standards */
    @@ -745,6 +759,8 @@
     
     	/* First tests should be against specific std */
     
    +//DeVdistress
    +#if(0)
     	if (std == V4L2_STD_NTSC_443) {
     		fmt = VIDEO_STD_NTSC_4_43_BIT;
     	} else if (std == V4L2_STD_PAL_M) {
    @@ -752,7 +768,7 @@
     	} else if (std == V4L2_STD_PAL_N || std == V4L2_STD_PAL_Nc) {
     		fmt = VIDEO_STD_PAL_COMBINATION_N_BIT;
     	} else {
    -		/* Then, test against generic ones */
    +		// Then, test against generic ones
     		if (std & V4L2_STD_NTSC)
     			fmt = VIDEO_STD_NTSC_MJ_BIT;
     		else if (std & V4L2_STD_PAL)
    @@ -760,6 +776,9 @@
     		else if (std & V4L2_STD_SECAM)
     			fmt = VIDEO_STD_SECAM_BIT;
     	}
    +#else
    +	fmt = VIDEO_STD_PAL_BDGHIN_BIT;
    +#endif
     
     	dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt);
     	tvp5150_write(sd, TVP5150_VIDEO_STD, fmt);
    @@ -865,12 +884,24 @@
     	struct v4l2_mbus_framefmt *f;
     	struct tvp5150 *decoder = to_tvp5150(sd);
     
    +	//DeVdistress
    +#if(0)
     	if (!format || (format->pad != DEMOD_PAD_VID_OUT))
     		return -EINVAL;
    +#else
    +	if (!format || format->pad)
    +		return -EINVAL;
    +#endif
     
     	f = &format->format;
     
    -	f->width = decoder->rect.width;
    +	//DeVdistress
    +#if(1)
    +	f->width  = decoder->rect.width;
    +#else
    +	f->width  = 700;
    +#endif
    +
     	f->height = decoder->rect.height / 2;
     
     	f->code = MEDIA_BUS_FMT_UYVY8_2X8;
    @@ -879,6 +910,7 @@
     
     	dev_dbg_lvl(sd->dev, 1, debug, "width = %d, height = %d\n", f->width,
     			f->height);
    +
     	return 0;
     }
     
    @@ -1009,8 +1041,15 @@
     		return -EINVAL;
     
     	fse->code = MEDIA_BUS_FMT_UYVY8_2X8;
    +	//DeVdistress
    +#if(1)
     	fse->min_width = decoder->rect.width;
     	fse->max_width = decoder->rect.width;
    +#else
    +	fse->min_width = 700;
    +	fse->max_width = 700;
    +#endif
    +
     	fse->min_height = decoder->rect.height / 2;
     	fse->max_height = decoder->rect.height / 2;
     
    @@ -1456,6 +1495,59 @@
     	"Black screen"
     };
     
    +//DeVdistress
    +#if(0)
    +void tvp5150_my_set_selection(struct v4l2_subdev *sd, struct v4l2_rect *sel)
    +{
    +	struct tvp5150 *decoder = to_tvp5150(sd);
    +	struct v4l2_rect rect;
    +	v4l2_std_id std;
    +	int hmax;
    +
    +	memcpy(&rect, sel, sizeof(rect));
    +
    +	dev_dbg_lvl(sd->dev, 1, debug, "%s left=%d, top=%d, width=%d, height=%d\n",
    +		__func__, rect.left, rect.top, rect.width, rect.height);
    +
    +	/* tvp5150 has some special limits */
    +	rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
    +	rect.width = clamp_t(unsigned int, rect.width,
    +			     (TVP5150_H_MAX + rect.left)- TVP5150_MAX_CROP_LEFT - rect.left,
    +				 (TVP5150_H_MAX + rect.left) - rect.left);
    +	rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
    +
    +	/* Calculate height based on current standard */
    +	if (decoder->norm == V4L2_STD_ALL)
    +		std = tvp5150_read_std(sd);
    +	else
    +		std = decoder->norm;
    +
    +	if (std & V4L2_STD_525_60)
    +		hmax = TVP5150_V_MAX_525_60 + rect.top; //было без rect.top
    +	else
    +		hmax = TVP5150_V_MAX_OTHERS + rect.top; //было без rect.top
    +
    +	rect.height = clamp_t(unsigned int, rect.height,
    +			      hmax - TVP5150_MAX_CROP_TOP - rect.top,
    +			      hmax - rect.top);
    +
    +	tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
    +	tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
    +		      rect.top + rect.height - hmax);
    +	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB,
    +		      rect.left >> TVP5150_CROP_SHIFT);
    +	tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB,
    +		      rect.left | (1 << TVP5150_CROP_SHIFT));
    +	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB,
    +		      (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
    +		      TVP5150_CROP_SHIFT);
    +	tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB,
    +		      rect.left + rect.width - TVP5150_MAX_CROP_LEFT);
    +
    +	decoder->rect = rect;
    +}
    +#endif
    +
     static int tvp5150_probe(struct i2c_client *c,
     			 const struct i2c_device_id *id)
     {
    @@ -1464,6 +1556,10 @@
     	struct device_node *np = c->dev.of_node;
     	int res;
     
    +#if(0)//DeVdistress
    +	struct v4l2_rect sel;
    +#endif
    +
     	/* Check if the adapter supports the needed features */
     	if (!i2c_check_functionality(c->adapter,
     	     I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
    @@ -1490,6 +1586,11 @@
     		core->mbus_type = V4L2_MBUS_BT656;
     	}
     
    +	//DeVdistress
    +	#if defined(MY_USE_BT656)
    +		core->mbus_type = V4L2_MBUS_BT656;
    +	#endif
    +
     	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
     	sd->internal_ops = &tvp5150_internal_ops;
     	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
    @@ -1512,8 +1613,15 @@
     	if (res < 0)
     		return res;
     
    -	core->norm = V4L2_STD_ALL;	/* Default is autodetect */
    +//DeVdistress
    +#if(0)
    +	core->norm = V4L2_STD_ALL;	// Default is autodetect
     	core->input = TVP5150_COMPOSITE1;
    +#else
    +	core->norm = V4L2_STD_ALL;	// Default is autodetect
    +	core->input = TVP5150_COMPOSITE0;
    +#endif
    +
     	core->enable = true;
     
     	v4l2_ctrl_handler_init(&core->hdl, 5);
    @@ -1540,13 +1648,28 @@
     
     	/* Default is no cropping */
     	core->rect.top = 0;
    +
    +	// DeVdistress
    +#if(0)
     	if (tvp5150_read_std(sd) & V4L2_STD_525_60)
     		core->rect.height = TVP5150_V_MAX_525_60;
     	else
     		core->rect.height = TVP5150_V_MAX_OTHERS;
    +#else
    +	core->rect.height = TVP5150_V_MAX_OTHERS;
    +#endif
    +
     	core->rect.left = 0;
     	core->rect.width = TVP5150_H_MAX;
     
    +#if(0)//DeVdistress
    +	sel.left   = core->rect.left;
    +	sel.top    = core->rect.top;
    +	sel.width  = core->rect.width;
    +	sel.height = core->rect.height;
    +	tvp5150_my_set_selection(sd, &sel);
    +#endif
    +
     	tvp5150_reset(sd, 0);	/* Calls v4l2_ctrl_handler_setup() */
     
     	res = v4l2_async_register_subdev(sd);
    

    Special thanks to Margarita Gashova and Brijesh Jadav.

  • Hello,

    I am glad that this issue is solved.
    Thank you for sharing the solution.
    Please verify the thread.
    Thank you Brijesh !

    BR
    Margarita