I am debugging the max9286(4 lane,UYVY output) driver,but can not capture image

I am debugging the max9286(4 lane,UYVY output) driver,but can not capture image!

bwhen I run the command “v4l2-ctl --all”,the output is as follows:[/b]
root@tegra-ubuntu:~# v4l2-ctl --all
Driver Info (not using libv4l2):
Driver name : tegra-video
Card type : vi-output-0, ov5693 6-0048
Bus info : platform:vi:0
Driver version: 3.10.96
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: ok)
Format Video Capture:
Width/Height : 2560/1440
Pixel Format : ‘UYVY’
Field : None
Bytes per Line : 5120
Size Image : 7372800
Colorspace : sRGB
Transfer Function : Default
YCbCr Encoding : Default
Quantization : Default
Flags :
Crop: Left 0, Top 0, Width 2560, Height 1440

Camera Controls

bypass_mode (intmenu): min=0 max=1 default=0 value=0

bwhen I run the command “v4l2-compliance -d /dev/video0”,the output is as follows:[/b]

root@tegra-ubuntu:~# v4l2-compliance -d /dev/video0
Driver Info:
Driver name : tegra-video
Card type : vi-output-0, ov5693 6-0048
Bus info : platform:vi:0
Driver version: 3.10.96
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 1 Private Controls: 1
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK

b I run the command:
gst-launch-1.0 -v v4l2src device="/dev/video0" ! “video/x-raw,width=2560,height=1440,format=(string)UYVY” ! xvimagesink -e the output is as follows,but can not display the image
[/b]

root@tegra-ubuntu:~# gst-launch-1.0 -v v4l2src device="/dev/video0" ! “video/x-raw,width=2560,height=1440,format=(string)UYVY” ! xvimagesink -e
Setting pipeline to PAUSED …
libv4lconvert: warning more framesizes then I can handle!
libv4lconvert: warning more framesizes then I can handle!
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock

bThe dmesg log is as follows:[/b]

[ 32.795583] vi vi: vi_probe: ++
[ 32.804197] vi vi: initialized
[ 32.810916] vi vi: parsing node /host1x/vi
[ 32.818284] vi vi: handling endpoint /host1x/vi/ports/port@0/endpoint
[ 32.828024] vi vi: handling endpoint /host1x/vi/ports/port@1/endpoint
[ 32.837704] vi vi: handling endpoint /host1x/vi/ports/port@2/endpoint
[ 32.847311] vi vi: handling endpoint /host1x/vi/ports/port@3/endpoint
[ 32.856880] vi vi: handling endpoint /host1x/vi/ports/port@4/endpoint
[ 32.866317] vi vi: handling endpoint /host1x/vi/ports/port@5/endpoint
[ 32.875662] vi vi: parsing node /host1x/i2c@546c0000/ov5693_c@48
[ 32.884556] vi vi: handling endpoint /host1x/i2c@546c0000/ov5693_c@48/ports/port@0/endpoint
[ 32.895862] vi vi: subdev ov5693 6-0048 bound
[ 32.903143] vi vi: notify complete, all subdevs registered
[ 32.911572] vi vi: creating links for entity ov5693 6-0048
[ 32.920049] vi vi: processing endpoint /host1x/i2c@546c0000/ov5693_c@48/ports/port@0/endpoint
[ 32.931637] vi vi: skipping channel port /host1x/i2c@546c0000/ov5693_c@48:0
[ 32.941663] vi vi: creating links for channels

The driver program is as follows:

#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
#include <linux/module.h>

#include <linux/seq_file.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>

#include “max9286_mode_tbls.h”

#define MAX9286_DEFAULT_MODE MAX9286_MODE_1280X720_120FPS

#define MAX9286_DEFAULT_WIDTH 2560
#define MAX9286_DEFAULT_HEIGHT 1440
#define MAX9286_DEFAULT_DATAFMT V4L2_MBUS_FMT_UYVY8_2X8
#define MAX9286_DEFAULT_CLK_FREQ 24000000

/*********************************************************/
/max9286
/
#define ADDR_MAX9286 0x48
#define ADDR_MAX9271 0x40
#define MAX_SENSOR_NUM 4
#define ADDR_MAX9271_ALL (ADDR_MAX9271 + MAX_SENSOR_NUM + 1)

#define SENSOR_OV10635
#define ADDR_OV_SENSOR 0x30

static inline int ov10635_read_reg(struct i2c_client *client, int index, unsigned short reg, unsigned char * val)
{
unsigned char u8_buf[2] = {0};
unsigned int buf_len = 2;
int retry, timeout = 10;
unsigned char u8_val = 0;

u8_buf[0] = (reg >> 8) & 0xFF;
u8_buf[1] = reg & 0xFF;

client->addr = ADDR_OV_SENSOR + index;
for (retry = 0; retry < timeout; retry ++) {
	if (i2c_master_send(client, u8_buf, buf_len) < 0) {		
		msleep(5);
		continue;
	}

	if (i2c_master_recv(client, &u8_val, 1) != 1) {	
		msleep(5);
		continue;
	}
	break;
}

if (retry >= timeout) {
	return -1;
}

*val = u8_val;

return u8_val;

}

static inline int ov10635_write_reg(struct i2c_client *client,int index, unsigned short reg, unsigned char val)
{
unsigned char u8_buf[3] = {0};
unsigned int buf_len = 3;
int retry, timeout = 10;

u8_buf[0] = (reg >> 8) & 0xFF;
u8_buf[1] = reg & 0xFF;
u8_buf[2] = val;

client->addr = ADDR_OV_SENSOR + index;
for (retry = 0; retry < timeout; retry ++) {
	if (i2c_master_send(client, u8_buf, buf_len) < 0) {			
		msleep(5);
		continue;
	}
	break;
}

if (retry >= timeout) {		
	return -1;
}

return 0;

}

static int ov10635_check_device(struct i2c_client *client, int index)
{
return 0;
}

// OV10635_YUV8 setting
static int ov10635_initialize(struct i2c_client *client, int index)
{
return 0;
}

static int max9286_write_reg(struct i2c_client *client, u8 reg, u8 val)
{
s32 ret;

client->addr = ADDR_MAX9286;
ret = i2c_smbus_write_byte_data(client, reg, val);
if (ret < 0) {		
	return -1;
}
return 0;

}

static inline int max9286_read_reg(struct i2c_client *client, u8 reg)
{
int val;

client->addr = ADDR_MAX9286;
val = i2c_smbus_read_byte_data(client, reg);
if (val < 0) {		
	return -1;
}
return val;

}

static int max9271_write_reg(struct i2c_client *client, int index, u8 reg, u8 val)
{
s32 ret;
int retry, timeout = 10;

client->addr = ADDR_MAX9271 + index;
for (retry = 0; retry < timeout; retry ++) {
	ret = i2c_smbus_write_byte_data(client, reg, val);
	if (val < 0)
		msleep(5);
	else
		break;
}

if (retry >= timeout) {
	return -1;
}

return 0;

}

static int max9286_dump(struct i2c_client *client)
{
int ret, i;
client->addr = ADDR_MAX9286;

printk(KERN_INFO "Printing MAX9286, i2caddr: 0x%x\n", client->addr);
printk(KERN_INFO "   ");
for(i = 0; i < 0x10; i++)
{
	printk("%4x ",i);
}

for(i = 0; i <= 0x71; i++)
{
	if((i%16) == 0)
	{
		printk("\n%x: ",i/16);
	}
	ret = i2c_smbus_read_byte_data(client, i);
	printk("0x%02x ", ret);
}
printk(KERN_INFO"\n");

return 0;

}

static int max9286_hardware_init(struct i2c_client *client)
{
int i;
u8 reg, sensor_addr = 0;
unsigned int g_sensor_num = 0;
unsigned char g_sensor_is_there = 0;
//int ret = 0;

//Disable CSI Output,CSI-2 outputs on virtual channel 0,Set virtual channel according to the link number,disable CSI-2 output
max9286_write_reg(client, 0x15, 0x13);	

//Enable PRBS test
max9286_write_reg(client, 0x0E, 0x5F);
msleep(10);

//Enable Custom Reverse Channel & First Pulse Length
max9286_write_reg(client, 0x3F, 0x4F);
msleep(10);

//Reverse Channel Amplitude to mid level and transition time
max9286_write_reg(client, 0x3B, 0x1E);
msleep(10);

//Enable MAX9271 Configuration Link
max9271_write_reg(client, 0, 0x04, 0x43);
msleep(10);

//Increase serializer reverse channel input thresholds

#ifdef SENSOR_OV10635
// max9271_write_reg(client, 0, 0x08, 0x09);
max9271_write_reg(client, 0, 0x08, 0x01);
#endif

#ifdef SENSOR_AP0101
//Invert VSYNC
max9271_write_reg(client, 0, 0x08, 0x81);
#endif

msleep(10);

//Reverse Channel Amplitude level
max9286_write_reg(client, 0x3B, 0x19);
msleep(5);

max9286_write_reg(client, 0x12, 0xF3);	//YUV422,8bit,Double Data Rate, 4 data lane
msleep(5);


//Frame Sync

#ifdef SENSOR_OV10635
//Automatic Mode
// max9286_write_reg(client, 0x01, 0xE2); //单路模式,使用外同步
max9286_write_reg(client, 0x01, 0x02); //多路模式,内同步,0x01[7:6]=0b00,
msleep(2);
max9286_write_reg(client, 0x02, 0x00); //
msleep(2);
max9286_write_reg(client, 0x63, 0x00);
msleep(2);
max9286_write_reg(client, 0x64, 0x00);
msleep(2);
max9286_write_reg(client, 0x05, 0x19); //

// max9286_write_reg(client, 0x06, 0x00);
// msleep(2);
// max9286_write_reg(client, 0x07, 0x00);
// msleep(2);
// max9286_write_reg(client, 0x08, 0x26);
// msleep(2);
// max9286_write_reg(client, 0x69, 0x30);
#endif

msleep(100);

// Detect link
g_sensor_num = 0;
reg = max9286_read_reg(client, 0x49);	//检测link情况,应该检测到link2,
g_sensor_is_there = ((reg >> 4) & 0xF) | (reg & 0xF);
if (g_sensor_is_there & (0x1 << 0))
	g_sensor_num += 1;
if (g_sensor_is_there & (0x1 << 1))
	g_sensor_num += 1;
if (g_sensor_is_there & (0x1 << 2))
	g_sensor_num += 1;
if (g_sensor_is_there & (0x1 << 3))
	g_sensor_num += 1;
pr_info("max9286_mipi: sensor number = %d.\n", g_sensor_num);	//得到有效链路(接上去的摄像头)个数

if (g_sensor_num == 0) {
	pr_err("%s: no camera connected.\n", __func__);
//	return -1;
}

max9286_write_reg(client, 0x0E, 0x50);	//Disable PRBS test
msleep(2);
max9286_write_reg(client, 0x0D, 0x03);	//

// Set link order in MIPI CSI-2 output
reg = 0xE4;  //Default setting
if (g_sensor_num == 1) {			//只连接1个摄像头
	switch (g_sensor_is_there) {
		case 0x8:		//link3
			reg = 0x27;
			break;
		case 0x4:		//link2
			reg = 0xC6;
			break;
		case 0x2:		//link1
			reg = 0xE1;
			break;
		case 0x1:		//link0
		default:
			reg = 0xE4;
			break;
	}
} else if (g_sensor_num == 2) {		//连接了2个摄像头
	switch (g_sensor_is_there) {
		case 0xC:
			reg = 0x4E;
			break;
		case 0xA:
			reg = 0x72;
			break;
		case 0x9:
			reg = 0x78;
			break;
		case 0x6:
			reg = 0xD2;
			break;
		case 0x5:
			reg = 0xD8;
			break;
		case 0x3:
		default:
			reg = 0xE4;
			break;
	}
} else if (g_sensor_num == 3) {		//连接了3个摄像头
	switch (g_sensor_is_there) {
		case 0xE:
			reg = 0x93;
			break;
		case 0xD:
			reg = 0x9C;
			break;
		case 0xB:
			reg = 0xB4;
			break;
		case 0x7:
		default:
			reg = 0xE4;
			break;
	}
}

max9286_write_reg(client, 0x0B, reg);	//0x0B寄存器为link out order


reg = 0xE0 | g_sensor_is_there;
max9286_write_reg(client, 0x00, reg);	//enable all links,auto select

//Set up links

sensor_addr = ADDR_OV_SENSOR;	//ADDR_OV_SENSOR = 0x30

printk("sensor_addr = ADDR_OV_SENSOR;\n");

reg = 0;

for (i=1; i<=MAX_SENSOR_NUM; i++) {		//MAX_SENSOR_NUM=4
	if (((0x1 << (i-1)) & g_sensor_is_there) == 0) {
		continue;
	}
	
	//Enable Link control channel
	reg |= (0x11 << (i-1));
	max9286_write_reg(client, 0x0A, reg);

	//Set MAX9271 new address for link 0
	max9271_write_reg(client, 0, 0x00, (ADDR_MAX9271+ i) << 1);
	msleep(10);			

	//Set MAX9271: Double Mode, PCLK latched on Rising Edge, HS/VS encoding
	//max9271_write_reg(client, i, 0x07, 0x94);
	max9271_write_reg(client, i, 0x07, 0x84);
	msleep(10);	
//	max9271_write_reg(client, i, 0x02, 0x1F);
//	msleep(5);		
//	max9271_write_reg(client, i, 0x03, 0x00);
//	msleep(5);		
//	max9271_write_reg(client, i, 0x05, 0x01);
//	msleep(5);		
//	max9271_write_reg(client, i, 0x06, 0xA0);
//	msleep(5);			


	max9271_write_reg(client, i, 0x01, ADDR_MAX9286 << 1);
	msleep(5);	
	max9271_write_reg(client, i, 0x09, (sensor_addr + i) << 1);
	msleep(5);
	max9271_write_reg(client, i, 0x0A, sensor_addr << 1);
	msleep(5);
	max9271_write_reg(client, i, 0x0B, ADDR_MAX9271_ALL << 1);
	msleep(5);
	max9271_write_reg(client, i, 0x0C, (ADDR_MAX9271 + i) << 1);
	msleep(5);
}
max9286_write_reg(client, 0x0A, reg);
msleep(5);
max9286_write_reg(client, 0x0A, reg);
msleep(5);
//Disable Local Auto I2C ACK
max9286_write_reg(client, 0x34, 0x36);
msleep(5);
max9286_write_reg(client, 0x1A, 0x60);	//此处采用默认值,用张建军的0x74不能出图像

//Initialize Camera Sensor

#ifdef SENSOR_OV10635
printk(“g_sensor_is_there = %x\n”, g_sensor_is_there);

if (g_sensor_is_there & (0x1 << 0)) {
	printk("the 0 camera\n");
	if (ov10635_check_device(client, 1) == 0)
		ov10635_initialize(client, 0);
} else if (g_sensor_is_there & (0x1 << 1)) {
	printk("the 1 camera\n");
	if (ov10635_check_device(client, 2) == 0)
		ov10635_initialize(client, 0);
} else if (g_sensor_is_there & (0x1 << 2)) {
	printk("the 2 camera\n");
	if (ov10635_check_device(client, 3) == 0)
		ov10635_initialize(client, 0);
} else if (g_sensor_is_there & (0x1 << 3)) {
	printk("the 3 camera\n");
	if (ov10635_check_device(client, 4) == 0)
		ov10635_initialize(client, 0);
}

#endif

//Enable Local Auto I2C ACK
max9286_write_reg(client, 0x34, 0xB6);

//MAX9271: Enable Serial Links and Disable Configuration Link
max9271_write_reg(client, ADDR_MAX9271_ALL - ADDR_MAX9271, 0x04, 0x83);
msleep(100);  //Wait for more than 2 frame time

//Enable CSI output, set virtual channel according to the link number
max9286_write_reg(client, 0x15, 0x0B);
msleep(10);

max9286_dump(client);

return 0;

}

//
/
/
//
/
/

struct max9286_priv {
struct camera_common_power_rail power;
struct v4l2_ctrl_handler ctrl_handler;
struct i2c_client *i2c_client;
struct v4l2_subdev *subdev;
struct media_pad pad;
struct camera_common_data *s_data;
struct camera_common_pdata *pdata;
struct v4l2_mbus_framefmt mf;
u32 mbus_fmt_code;
struct v4l2_ctrl *ctrls;
};

static int max9286_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
{
struct max9286_priv *priv =container_of(ctrl->handler, struct max9286_priv, ctrl_handler);
int err = 0;

if (priv->power.state == SWITCH_OFF)
	return 0;

switch (ctrl->id) {
case V4L2_CID_EEPROM_DATA:
	
	break;
default:
		pr_err("%s: unknown ctrl id.\n", __func__);
		return -EINVAL;
}

return err;

}

static int max9286_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct max9286_priv *priv =container_of(ctrl->handler, struct max9286_priv, ctrl_handler);
int err = 0;

if (priv->power.state == SWITCH_OFF)
	return 0;

switch (ctrl->id) {
case V4L2_CID_GAIN:		
	break;
case V4L2_CID_FRAME_LENGTH:		
	break;
case V4L2_CID_COARSE_TIME:		
	break;
case V4L2_CID_COARSE_TIME_SHORT:
	
	break;
case V4L2_CID_GROUP_HOLD:
	
	break;
case V4L2_CID_EEPROM_DATA:
	if (!ctrl->string[0])
		break;	
	break;
case V4L2_CID_HDR_EN:
	break;
default:
	pr_err("%s: unknown ctrl id.\n", __func__);
	return -EINVAL;
}

return err;

}

#define MAX9286_MIN_GAIN 0
#define MAX9286_MAX_GAIN 0
#define MAX9286_DEFAULT_GAIN 0
#define MAX9286_MIN_FRAME_LENGTH 0
#define MAX9286_MAX_FRAME_LENGTH 0x7FFF
#define MAX9286_DEFAULT_FRAME_LENGTH 0xA00
#define MAX9286_MIN_EXPOSURE_COARSE 0
#define MAX9286_MAX_EXPOSURE_COARSE 0
#define MAX9286_DEFAULT_EXPOSURE_COARSE 0

#define MAX9286_EEPROM_STR_SIZE 0
#define MAX9286_FUSE_ID_STR_SIZE 0
#define MAX9286_OTP_STR_SIZE 0

static const struct v4l2_ctrl_ops max9286_ctrl_ops = {
.g_volatile_ctrl = max9286_g_volatile_ctrl,
.s_ctrl = max9286_s_ctrl,
};

static struct v4l2_ctrl_config ctrl_config_list = {
/* Do not change the name field for the controls! */
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_GAIN,
.name = “Gain”,
.type = V4L2_CTRL_TYPE_INTEGER,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = MAX9286_MIN_GAIN,
.max = MAX9286_MAX_GAIN,
.def = MAX9286_DEFAULT_GAIN,
.step = 1,
},
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_FRAME_LENGTH,
.name = “Frame Length”,
.type = V4L2_CTRL_TYPE_INTEGER,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = MAX9286_MIN_FRAME_LENGTH,
.max = MAX9286_MAX_FRAME_LENGTH,
.def = MAX9286_DEFAULT_FRAME_LENGTH,
.step = 1,
},
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_COARSE_TIME,
.name = “Coarse Time”,
.type = V4L2_CTRL_TYPE_INTEGER,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = MAX9286_MIN_EXPOSURE_COARSE,
.max = MAX9286_MAX_EXPOSURE_COARSE,
.def = MAX9286_DEFAULT_EXPOSURE_COARSE,
.step = 1,
},
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_COARSE_TIME_SHORT,
.name = “Coarse Time Short”,
.type = V4L2_CTRL_TYPE_INTEGER,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = MAX9286_MIN_EXPOSURE_COARSE,
.max = MAX9286_MAX_EXPOSURE_COARSE,
.def = MAX9286_DEFAULT_EXPOSURE_COARSE,
.step = 1,
},
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_GROUP_HOLD,
.name = “Group Hold”,
.type = V4L2_CTRL_TYPE_INTEGER_MENU,
.min = 0,
.max = ARRAY_SIZE(switch_ctrl_qmenu) - 1,
.menu_skip_mask = 0,
.def = 0,
.qmenu_int = switch_ctrl_qmenu,
},
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_HDR_EN,
.name = “HDR enable”,
.type = V4L2_CTRL_TYPE_INTEGER_MENU,
.min = 0,
.max = ARRAY_SIZE(switch_ctrl_qmenu) - 1,
.menu_skip_mask = 0,
.def = 0,
.qmenu_int = switch_ctrl_qmenu,
},
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_EEPROM_DATA,
.name = “EEPROM Data”,
.type = V4L2_CTRL_TYPE_STRING,
.flags = V4L2_CTRL_FLAG_VOLATILE,
.min = 0,
.max = MAX9286_EEPROM_STR_SIZE,
.step = 2,
},
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_OTP_DATA,
.name = “OTP Data”,
.type = V4L2_CTRL_TYPE_STRING,
.flags = V4L2_CTRL_FLAG_READ_ONLY,
.min = 0,
.max = MAX9286_OTP_STR_SIZE,
.step = 2,
},
{
.ops = &max9286_ctrl_ops,
.id = V4L2_CID_FUSE_ID,
.name = “Fuse ID”,
.type = V4L2_CTRL_TYPE_STRING,
.flags = V4L2_CTRL_FLAG_READ_ONLY,
.min = 0,
.max = MAX9286_FUSE_ID_STR_SIZE,
.step = 2,
},
};

static int max9286_s_stream(struct v4l2_subdev *sd, int enable)
{
return 0;
}

static int max9286_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, struct v4l2_subdev_format *format)
{
int ret;
printk(“max9286_set_fmt\n”);

if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
	ret = camera_common_try_fmt(sd, &format->format);
}
else {
	ret = camera_common_s_fmt(sd, &format->format);
}
return ret;

}

static int max9286_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, struct v4l2_subdev_format *format)
{
return camera_common_g_fmt(sd, &format->format);
}

static int max9286_g_input_status(struct v4l2_subdev *sd, u32 *status)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct camera_common_data *s_data = to_camera_common_data(client);
struct max9286_priv *priv = (struct max9286_priv *)s_data->priv;
struct camera_common_power_rail *pw = &priv->power;

*status = pw->state == SWITCH_ON;
return 0;

}

static int max9286_s_power(struct v4l2_subdev *sd, int on)
{
return 0;
}

static int max9286_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
return 0;
}

static int max9286_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
{
a->c.left = 0;
a->c.top = 0;
a->c.width = 2560;
a->c.height = 1440;
a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

return 0;

}

static int max9286_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
{
a->bounds.left = 0;
a->bounds.top = 0;
a->bounds.width = 2560;
a->bounds.height = 1440;
a->defrect = a->bounds;
a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
a->pixelaspect.numerator = 1;
a->pixelaspect.denominator = 1;

return 0;

}

static struct v4l2_subdev_video_ops max9286_subdev_video_ops = {
.s_stream = max9286_s_stream,
.s_mbus_fmt = camera_common_s_fmt,
.g_mbus_fmt = camera_common_g_fmt,
.try_mbus_fmt = camera_common_try_fmt,
.enum_mbus_fmt = camera_common_enum_fmt,
.g_mbus_config = camera_common_g_mbus_config,
.g_input_status = max9286_g_input_status,
.enum_framesizes = camera_common_enum_framesizes,
.enum_frameintervals = camera_common_enum_frameintervals,
.g_crop = max9286_g_crop,
.cropcap = max9286_cropcap,
};

static struct v4l2_subdev_core_ops max9286_subdev_core_ops = {
.g_chip_ident = max9286_g_chip_ident,
.s_power = max9286_s_power,
};

static struct v4l2_subdev_pad_ops max9286_subdev_pad_ops = {
.enum_mbus_code = camera_common_enum_mbus_code,
.set_fmt = max9286_set_fmt,
.get_fmt = max9286_get_fmt,
};

static struct v4l2_subdev_ops max9286_subdev_ops = {
.core = &max9286_subdev_core_ops,
.video = &max9286_subdev_video_ops,
.pad = &max9286_subdev_pad_ops,
};

static struct of_device_id max9286_of_match = {
{ .compatible = “nvidia,ov5693”, },
{ },
};

MODULE_DEVICE_TABLE(of, max9286_of_match);

static struct camera_common_pdata *max9286_parse_dt(struct i2c_client *client)
{
struct device_node *node = client->dev.of_node;
struct camera_common_pdata *board_priv_pdata;
const struct of_device_id *match;

int err;

if (!node)
	return NULL;

match = of_match_device(max9286_of_match, &client->dev);
if (!match) {
	dev_err(&client->dev, "Failed to find matching dt id\n");
	return NULL;
}

board_priv_pdata = devm_kzalloc(&client->dev, sizeof(*board_priv_pdata), GFP_KERNEL);
if (!board_priv_pdata)
	return NULL;

err = camera_common_parse_clocks(client, board_priv_pdata);
if (err) {
	dev_err(&client->dev, "Failed to find clocks\n");
	goto error;
}


return board_priv_pdata;

error:
devm_kfree(&client->dev, board_priv_pdata);
return NULL;
}

static int max9286_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);

dev_dbg(&client->dev, "%s:\n", __func__);
return 0;

}

static const struct v4l2_subdev_internal_ops max9286_subdev_internal_ops = {
.open = max9286_open,
};

static const struct media_entity_operations max9286_media_ops = {
.link_validate = v4l2_subdev_link_validate,
};

static void max9286_set_default_fmt(struct max9286_priv *priv)
{
struct v4l2_mbus_framefmt *mf = &priv->mf;

mf->width 		= 2560;
mf->height 		= 1440;
mf->code 		= V4L2_MBUS_FMT_UYVY8_2X8;
mf->field 		= V4L2_FIELD_NONE;
mf->colorspace 		= V4L2_COLORSPACE_SRGB;		//RGB格式吗?

}

static struct camera_common_sensor_ops max9286_common_ops = {
};

static int max9286_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct camera_common_data *common_data;
struct max9286_priv *priv;

struct device_node *node = client->dev.of_node;	
char debugfs_name[10];
int err;
int tmp_addr 	= 0x00;

mdelay(15000);
pr_info("tusimple [max9286]: probing v4l2 sensor.\n");

tmp_addr = client->addr;
printk("client->addr is 0x%x\n", client->addr);
mdelay(5000);	

if (!IS_ENABLED(CONFIG_OF) || !node)
	return -EINVAL;

pr_info("tusimple_01\n");

common_data = devm_kzalloc(&client->dev, sizeof(struct camera_common_data), GFP_KERNEL);
pr_info("tusimple_02\n");
if (!common_data)
	return -ENOMEM;

priv = devm_kzalloc(&client->dev, sizeof(struct max9286_priv) + sizeof(struct v4l2_ctrl *) * ARRAY_SIZE(ctrl_config_list), GFP_KERNEL);
pr_info("tusimple_03\n");
if (!priv)
	return -ENOMEM;

priv->pdata = max9286_parse_dt(client);

{
	printk("priv->pdata->mclk_name is %s\n", priv->pdata->mclk_name);
	printk("priv->pdata->parentclk_name is %s\n", priv->pdata->parentclk_name);
	printk("priv->pdata->pwdn_gpio is %d\n", priv->pdata->pwdn_gpio);
	printk("priv->pdata->reset_gpio is %d\n", priv->pdata->reset_gpio);
	printk("priv->pdata->af_gpio is %d\n", priv->pdata->af_gpio);
	printk("priv->pdata->use_cam_gpio is %d\n", priv->pdata->use_cam_gpio);
	printk("priv->pdata->phas_eeprom is %d\n", priv->pdata->has_eeprom);		
}

pr_info("tusimple_04\n");
if (!priv->pdata) {
	dev_err(&client->dev, "unable to get platform data\n");
	return -EFAULT;
}
pr_info("tusimple_05\n");

common_data->ops		= &max9286_common_ops;
common_data->ctrl_handler	= &priv->ctrl_handler;
common_data->i2c_client		= client;
common_data->frmfmt		= max9286_frmfmt;
common_data->colorfmt		= camera_common_find_datafmt(MAX9286_DEFAULT_DATAFMT);
common_data->power		= &priv->power;
common_data->ctrls		= priv->ctrls;
common_data->priv		= (void *)priv;
common_data->numfmts		= ARRAY_SIZE(max9286_frmfmt);
common_data->def_mode		= MAX9286_DEFAULT_MODE;
common_data->def_width		= MAX9286_DEFAULT_WIDTH;
common_data->def_height		= MAX9286_DEFAULT_HEIGHT;
common_data->fmt_width		= common_data->def_width;
common_data->fmt_height		= common_data->def_height;
common_data->def_clk_freq	= MAX9286_DEFAULT_CLK_FREQ;

priv->i2c_client 		= client;
priv->s_data			= common_data;
priv->subdev			= &common_data->subdev;
priv->subdev->dev		= &client->dev;
priv->s_data->dev		= &client->dev;


err = camera_common_parse_ports(client, common_data);	//这里面进行mipi csi lane的解析
if (err) {
	dev_err(&client->dev, "Failed to find port info\n");
	return err;
}

camera_common_create_debugfs(common_data, debugfs_name);		

v4l2_i2c_subdev_init(priv->subdev, client, &max9286_subdev_ops);

printk("v4l2_i2c_subdev_init()       \n");

printk("start write *******************************************************************************************\n");

max9286_hardware_init(client);

printk("end write *********************************************************************************************\n");



priv->subdev->internal_ops = &max9286_subdev_internal_ops;

priv->subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;

#if defined(CONFIG_MEDIA_CONTROLLER)
priv->pad.flags = MEDIA_PAD_FL_SOURCE;
priv->subdev->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
priv->subdev->entity.ops = &max9286_media_ops;

//max9286_set_default_fmt(priv);

err = media_entity_init(&priv->subdev->entity, 1, &priv->pad, 0);
if (err < 0) {
	dev_err(&client->dev, "unable to init media entity\n");
	return err;
}

#endif

err = v4l2_async_register_subdev(priv->subdev);
printk("v4l2_async_register_subdev()       \n");
if (err)
	return err;

dev_dbg(&client->dev, "Detected max9286 IC!\n");

return 0;

}

static int max9286_remove(struct i2c_client *client)
{
struct camera_common_data *s_data = to_camera_common_data(client);
struct max9286_priv *priv = (struct max9286_priv *)s_data->priv;

v4l2_async_unregister_subdev(priv->subdev);

#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&priv->subdev->entity);
#endif

v4l2_ctrl_handler_free(&priv->ctrl_handler);
camera_common_remove_debugfs(s_data);

return 0;

}

static const struct i2c_device_id max9286_id = {
{ “ov5693”, 0},
{ }
};

MODULE_DEVICE_TABLE(i2c, max9286_id);

static struct i2c_driver max9286_i2c_driver = {
.driver = {
.name = “ov5693”,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(max9286_of_match),
},
.probe = max9286_probe,
.remove = max9286_remove,
.id_table = max9286_id,
};

module_i2c_driver(max9286_i2c_driver);

MODULE_DESCRIPTION(“Camera driver for max9286+max9271+OV490+OV10640”);
MODULE_AUTHOR(“xxxxxx@xxxxxxxx.com”);
MODULE_LICENSE(“GPL v2”);

I directly modified the tegra210-camera-e3326-a00.dtsi file,as follows:

#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>

/ {
host1x {
vi {
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
status = “okay”;
e3326_vi_in0: endpoint {
status = “okay”;
csi-port = <0>;
bus-width = <4>;
remote-endpoint = <&e3326_ov5693_out0>;
};
};
};
};

	i2c@546c0000 {
		status = "okay";
		#address-cells = <1>;
		#size-cells = <0>;
		ov5693_c@48 {
			compatible = "nvidia,ov5693";
			/* I2C device address */
			reg = <0x48>;

			/* Physical dimensions of sensor */
			physical_w = "3.674";
			physical_h = "2.738";

			/* Sensor Model */
			sensor_model ="ov5693";

			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			avdd-reg = "vana";
			iovdd-reg = "vif";

			/* Defines number of frames to be dropped by driver internally after applying */
			/* sensor crop settings. Some sensors send corrupt frames after applying */
			/* crop co-ordinates */
			post_crop_frame_drop = "0";
			
			mode0 { // OV5693_MODE_2592X1944
				mclk_khz = "24000";
				num_lanes = "4";
				tegra_sinterface = "serial_a";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "2560";
				active_h = "1440";
				pixel_t = "uyvy";
				readout_orientation = "180";
				line_length = "2688";
				inherent_gain = "1";
				mclk_multiplier = "17.0";
				pix_clk_hz = "160000000";

				min_gain_val = "1.0";
				max_gain_val = "16";
				min_hdr_ratio = "1";
				max_hdr_ratio = "64";
				min_framerate = "1.816577";
				max_framerate = "30";
				min_exp_time = "34";
				max_exp_time = "550385";
				embedded_metadata_height = "0";
			};

			mode1 { //OV5693_MODE_2592X1458
				mclk_khz = "24000";
				num_lanes = "4";
				tegra_sinterface = "serial_a";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "2560";
				active_h = "1440";
				pixel_t = "uyvy";
				readout_orientation = "180";
				line_length = "2688";
				inherent_gain = "1";
				mclk_multiplier = "17.0";
				pix_clk_hz = "160000000";

				min_gain_val = "1.0";
				max_gain_val = "16";
				min_hdr_ratio = "1";
				max_hdr_ratio = "64";
				min_framerate = "1.816577";
				max_framerate = "30";
				min_exp_time = "34";
				max_exp_time = "550385";
				embedded_metadata_height = "0";
			};

			mode2 { //OV5693_MODE_1280X720
				mclk_khz = "24000";
				num_lanes = "4";
				tegra_sinterface = "serial_a";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "2560";
				active_h = "1440";
				pixel_t = "uyvy";
				readout_orientation = "180";
				line_length = "1752";
				inherent_gain = "1";
				mclk_multiplier = "17.0";
				pix_clk_hz = "160000000";

				min_gain_val = "1.0";
				max_gain_val = "16";
				min_hdr_ratio = "1";
				max_hdr_ratio = "64";
				min_framerate = "2.787078";
				max_framerate = "120";
				min_exp_time = "22";
				max_exp_time = "358733";
				embedded_metadata_height = "0";
			};

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					e3326_ov5693_out0: endpoint {
						csi-port = <0>;
						bus-width = <4>;
						remote-endpoint = <&e3326_vi_in0>;
					};
				};
			};
		};

	};
};

tegra-camera-platform {
	compatible = "nvidia, tegra-camera-platform";
	
	modules {
		module0 {
			badge = "e3326_front_P5V27C";
			position = "rear";
			orientation = "1";
			drivernode0 {
				/* Declare PCL support driver (classically known as guid)  */
				pcl_id = "v4l2_sensor";
				/* Driver's v4l2 device name */
				devname = "ov5693 6-0048";
				/* Declare the device-tree hierarchy to driver instance */
				proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/ov5693_c@48";
			};
			drivernode1 {
				/* Declare PCL support driver (classically known as guid)  */
				pcl_id = "v4l2_focuser_stub";
			};
		};
	};
};

};

Could anyone help me ?

hello haijun,

i would like to confirm my understanding is correct. list questions as below.

  1. you were connecting several cameras to max9286, and max9286 is the input of tegra camera serial interface?
  2. had you tried test pattern generated by max9286 to confirm tegra side receive the signal correctly?
  3. had you tried v4l2-ctl to access the device instead of gst-launch?

I tried the command “v4l2-compliance -d /dev/video0”, but VIDIOC_S_FMT failed, information as follows:

root@tegra-ubuntu:~# v4l2-compliance -d /dev/video0
Driver Info:
Driver name : tegra-video
Card type : vi-output-0, ov5693 6-0048
Bus info : platform:vi:0
Driver version: 3.10.96
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

Control ioctls:
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
	test VIDIOC_QUERYCTRL: OK
	test VIDIOC_G/S_CTRL: OK
	test VIDIOC_G/S/TRY_EXT_CTRLS: OK
	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
	test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
	Standard Controls: 1 Private Controls: 10

Format ioctls:
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
	test VIDIOC_G/S_PARM: OK (Not Supported)
	test VIDIOC_G_FBUF: OK (Not Supported)
	test VIDIOC_G_FMT: OK
	fail: v4l2-test-formats.cpp(662): Video Capture is valid, but no TRY_FMT was implemented
	test VIDIOC_TRY_FMT: FAIL
	warn: v4l2-test-formats.cpp(933): S_FMT cannot handle an invalid pixelformat.
	warn: v4l2-test-formats.cpp(934): This may or may not be a problem. For more information see:
	warn: v4l2-test-formats.cpp(935): http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html
	fail: v4l2-test-formats.cpp(947): S_FMT cannot handle an invalid format
	test VIDIOC_S_FMT: FAIL
	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
	test Cropping: OK (Not Supported)
	test Composing: OK (Not Supported)
	fail: v4l2-test-formats.cpp(1406): doioctl(node, VIDIOC_S_FMT, &fmt)
	fail: v4l2-test-formats.cpp(1503): doioctl(node, VIDIOC_S_FMT, &fmt)
	test Scaling: FAIL

Codec ioctls:
	test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
	test VIDIOC_G_ENC_INDEX: OK (Not Supported)
	test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
	test VIDIOC_EXPBUF: OK

Test input 0:

Total: 42, Succeeded: 39, Failed: 3, Warnings: 3

Ok,at last I can see the right image of max9286!But the resolution of max9286 is 5120720.I want to change it to 25601440!

It seems you’re referring the MM API use case to implement your post processing now.

https://devtalk.nvidia.com/default/topic/979052/jetson-tx1/question-about-the-yuv-camera-driver-of-tx1/post/5044232/#5044232

If still met issue, please back to update in above thread.

Thanks

OK,I have solved the problem!

Hi Haijun,

Can you elaborate on your solution to this problem? I’m having a similar issue … I can get good YUV frame capture using yavta or v4l2-ctl, but the gstreamer pipeline won’t launch. I see the same compliance test errors you saw. Did you have to resolve those?

Modify the files: camera_common.c and core.c!

Hi Haijun,

For camera_common.c, i have modify as following.

static const struct camera_common_colorfmt camera_common_color_fmts = {
{
V4L2_MBUS_FMT_SRGGB12_1X12,
V4L2_COLORSPACE_SRGB,
V4L2_PIX_FMT_SRGGB12,
},
{
V4L2_MBUS_FMT_SRGGB10_1X10,
V4L2_COLORSPACE_SRGB,
V4L2_PIX_FMT_SRGGB10,
},
{
V4L2_MBUS_FMT_SRGGB8_1X8,
V4L2_COLORSPACE_SRGB,
V4L2_PIX_FMT_SRGGB8,
},
{
V4L2_MBUS_FMT_UYVY8_2X8,
V4L2_COLORSPACE_SRGB,
V4L2_PIX_FMT_UYVY,
},

};

if (mf->code != V4L2_MBUS_FMT_SRGGB8_1X8 &&
	mf->code != V4L2_MBUS_FMT_SRGGB10_1X10[b]&&mf->code != V4L2_MBUS_FMT_UYVY8_2X8[/b]) {
	mf->code = V4L2_MBUS_FMT_SRGGB10_1X10;
	err = -EINVAL;
}

But for core.c , i donot kown how to modify, can you share me your patch, thanks.

Tomorrow I will tell you how to modify the core.c file.Right Now I cannot get a computer.

Hi Haijun,

Thanks,Hope for your reply.

my QQ IS 350848246

你可以对比一下你的core.c,这是我的core.c,其他部分没有任何改动!

static const struct tegra_video_format tegra_video_formats = {
/* RAW 6: TODO */

/* RAW 7: TODO */

/* RAW 8 */
{
	TEGRA_VF_RAW8,
	8,
	MEDIA_BUS_FMT_SRGGB8_1X8,
	1,
	TEGRA_IMAGE_FORMAT_T_L8,
	TEGRA_IMAGE_DT_RAW8,
	V4L2_PIX_FMT_SRGGB8,
	"RGRG.. GBGB..",
},
{
	TEGRA_VF_RAW8,
	8,
	MEDIA_BUS_FMT_SGRBG8_1X8,
	1,
	TEGRA_IMAGE_FORMAT_T_L8,
	TEGRA_IMAGE_DT_RAW8,
	V4L2_PIX_FMT_SGRBG8,
	"GRGR.. BGBG..",
},
{
	TEGRA_VF_RAW8,
	8,
	MEDIA_BUS_FMT_SGBRG8_1X8,
	1,
	TEGRA_IMAGE_FORMAT_T_L8,
	TEGRA_IMAGE_DT_RAW8,
	V4L2_PIX_FMT_SGBRG8,
	"GBGB.. RGRG..",
},
{
	TEGRA_VF_RAW8,
	8,
	MEDIA_BUS_FMT_SBGGR8_1X8,
	1,
	TEGRA_IMAGE_FORMAT_T_L8,
	TEGRA_IMAGE_DT_RAW8,
	V4L2_PIX_FMT_SBGGR8,
	"BGBG.. GRGR..",
},

/* RAW 10 */
{
	TEGRA_VF_RAW10,
	10,
	MEDIA_BUS_FMT_SRGGB10_1X10,
	2,
	TEGRA_IMAGE_FORMAT_T_R16_I,
	TEGRA_IMAGE_DT_RAW10,
	V4L2_PIX_FMT_SRGGB10,
	"RGRG.. GBGB..",
},
{
	TEGRA_VF_RAW10,
	10,
	MEDIA_BUS_FMT_SGRBG10_1X10,
	2,
	TEGRA_IMAGE_FORMAT_T_R16_I,
	TEGRA_IMAGE_DT_RAW10,
	V4L2_PIX_FMT_SGRBG10,
	"GRGR.. BGBG..",
},
{
	TEGRA_VF_RAW10,
	10,
	MEDIA_BUS_FMT_SGBRG10_1X10,
	2,
	TEGRA_IMAGE_FORMAT_T_R16_I,
	TEGRA_IMAGE_DT_RAW10,
	V4L2_PIX_FMT_SGBRG10,
	"GBGB.. RGRG..",
},
{
	TEGRA_VF_RAW10,
	10,
	MEDIA_BUS_FMT_SBGGR10_1X10,
	2,
	TEGRA_IMAGE_FORMAT_T_R16_I,
	TEGRA_IMAGE_DT_RAW10,
	V4L2_PIX_FMT_SBGGR10,
	"BGBG.. GRGR..",
},

/* RAW 12 */
{
	TEGRA_VF_RAW12,
	12,
	MEDIA_BUS_FMT_SRGGB12_1X12,
	2,
	TEGRA_IMAGE_FORMAT_T_R16_I,
	TEGRA_IMAGE_DT_RAW12,
	V4L2_PIX_FMT_SRGGB12,
	"RGRG.. GBGB..",
},
{
	TEGRA_VF_RAW12,
	12,
	MEDIA_BUS_FMT_SGRBG12_1X12,
	2,
	TEGRA_IMAGE_FORMAT_T_R16_I,
	TEGRA_IMAGE_DT_RAW12,
	V4L2_PIX_FMT_SGRBG12,
	"GRGR.. BGBG..",
},
{
	TEGRA_VF_RAW12,
	12,
	MEDIA_BUS_FMT_SGBRG12_1X12,
	2,
	TEGRA_IMAGE_FORMAT_T_R16_I,
	TEGRA_IMAGE_DT_RAW12,
	V4L2_PIX_FMT_SGBRG12,
	"GBGB.. RGRG..",
},
{
	TEGRA_VF_RAW12,
	12,
	MEDIA_BUS_FMT_SBGGR12_1X12,
	2,
	TEGRA_IMAGE_FORMAT_T_R16_I,
	TEGRA_IMAGE_DT_RAW12,
	V4L2_PIX_FMT_SBGGR12,
	"BGBG.. GRGR..",
},

/* RGB888 */
{
	TEGRA_VF_RGB888,
	24,
	MEDIA_BUS_FMT_RGB888_1X24,
	4,
	TEGRA_IMAGE_FORMAT_T_A8R8G8B8,
	TEGRA_IMAGE_DT_RGB888,
	V4L2_PIX_FMT_ABGR32,
	"BGRA-8-8-8-8",
},
{
	TEGRA_VF_RGB888,
	24,
	MEDIA_BUS_FMT_RGB888_1X32_PADHI,
	4,
	TEGRA_IMAGE_FORMAT_T_A8B8G8R8,
	TEGRA_IMAGE_DT_RGB888,
	V4L2_PIX_FMT_RGB32,
	"RGB-8-8-8-8",
},
/* YUV422 */
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_YUYV8_2X8,
	2,
	TEGRA_IMAGE_FORMAT_T_U8_Y8__V8_Y8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_UYVY,
	"YUV 4:2:2",
},
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_UYVY8_1X16,
	2,
	TEGRA_IMAGE_FORMAT_T_U8_Y8__V8_Y8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_UYVY,
	"YUV 4:2:2",
},
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_VYUY8_2X8,
	2,
	TEGRA_IMAGE_FORMAT_T_T_V8_Y8__U8_Y8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_VYUY,
	"YUV 4:2:2",
},
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_YUYV8_2X8,
	2,
	TEGRA_IMAGE_FORMAT_T_Y8_U8__Y8_V8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_YUYV,
	"YUV 4:2:2",
},
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_YVYU8_2X8,
	2,
	TEGRA_IMAGE_FORMAT_T_Y8_V8__Y8_U8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_YVYU,
	"YUV 4:2:2",
},

/* YUV422 */
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_UYVY8_1X16,
	2,
	TEGRA_IMAGE_FORMAT_T_U8_Y8__V8_Y8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_UYVY,
},
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_UYVY8_2X8,
	2,
	TEGRA_IMAGE_FORMAT_T_U8_Y8__V8_Y8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_UYVY,
},
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_VYUY8_2X8,
	2,
	TEGRA_IMAGE_FORMAT_T_T_V8_Y8__U8_Y8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_VYUY,
},
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_YUYV8_2X8,
	2,
	TEGRA_IMAGE_FORMAT_T_Y8_U8__Y8_V8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_YUYV,
},
{
	TEGRA_VF_YUV422,
	16,
	MEDIA_BUS_FMT_YVYU8_2X8,
	2,
	TEGRA_IMAGE_FORMAT_T_Y8_V8__Y8_U8,
	TEGRA_IMAGE_DT_YUV422_8,
	V4L2_PIX_FMT_YVYU,
},

};

Hi haijun,

I also used MAX9288 as deserialize and MAX9271 as serialize.
I can communicate with MAX9288 by I2c as well and I already confirmed by reading identifier of MAX9288.
But I have no way to read/write any I2C command with MAX9271 and OV10635.
Could you please share how to communicate with MAX9271 and OV10635.

I always received message like this when I try to read any register
On MAX9271

tegra-i2c 3180000.i2c: no acknowledge from address 0x40

On OV10635

tegra-i2c 3180000.i2c: no acknowledge from address 0x30

Thanks

你是中国人吗?用中文吧,你得到的message说明i2c通信有问题,没有应答!

对于你需要访问max9271和OV10635的事情,可以参考NXP的那个代码:https://community.nxp.com/docs/DOC-328548?ru=259451&sr=stream
这个也许还有问题,到时候可以再探讨!

Hi haijun,

I’m not Chinese. I tried almost same as your reference however still can not read any data from MAX9271 and OV10635.

I have also tried “i2cdetect” tool to detect if there is any device on bus. And I can detect only MAX9288 at address 0x48, MAX9271 and OV10635 can not be detected with “i2cdetect” tool.

I checked MAX9288 datasheet but still dont know how to detect if MAX9271 link is up/down.

May we need set some configuration on MAX9288 to wake up MAX9271?

Thanks and Best Regards,