OV10635 image sensor on TX2

Thanks for your comment. It should be faster for me.

I figure out that I have to let this line

#include "t18x-common-platforms/tegra186-quill-camera-e3322-a00.dtsi"

to make it boot to OS properly.

Now my dtsi file

/*
 * Copyright (c) 2016-2017, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 */

#include "t18x-common-platforms/tegra186-quill-camera-e3322-a00.dtsi"
#include "t18x-common-platforms/tegra186-quill-camera-li-mipi-adpt-a00.dtsi"
#include "t18x-common-platforms/tegra186-quill-camera-imx274-a00.dtsi"
#include "t18x-common-platforms/tegra186-quill-camera-vivid.dtsi"

#define CAM0_RST_L	TEGRA_MAIN_GPIO(R, 5)
#define CAM0_PWDN	TEGRA_MAIN_GPIO(R, 0)
#define CAM1_RST_L	TEGRA_MAIN_GPIO(R, 1)
#define CAM1_PWDN	TEGRA_MAIN_GPIO(L, 6)

/ {
	tegra-camera-platform {
		/**
		* tpg_max_iso = <>;
		* Max iso bw for 6 streams of tpg
		* streams * nvcsi_freq * PG_bitrate / RG10 * BPP
		* 6 * 102Mhz * 32 bits/ 10 bits * 2 Bps
		* = 3916.8 MBps
		*/
		tpg_max_iso = <3916800>;
	};

	/* set camera gpio direction to output */
	gpio@2200000 {
		camera-control-output-low {
			gpio-hog;
			output-low;
			gpios = <CAM0_RST_L 0 CAM0_PWDN 0
				 CAM1_RST_L 0 CAM1_PWDN 0>;
			label = "cam0-rst", "cam0-pwdn",
				"cam1-rst", "cam1-pwdn";
		};
	};

	/* all cameras are disabled by default */
	host1x {
		vi_base: vi@15700000 {
			num-channels = <1>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				vi_port0: port@0 { /*CSI A*/
					status = "okay";
					reg = <0>;
					e3326_vi_in0: endpoint {
						status = "okay";
						csi-port = <0>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_out0>;
					};
				};
				vi_port1: port@1 {
					status = "disabled";
					vi_in1: endpoint {
						status = "disabled";
					};
				};
				vi_port2: port@2 {
					status = "disabled";
					vi_in2: endpoint {
						status = "disabled";
					};
				};
			};
		};
		csi_base: nvcsi@150c0000 {
			num-channels = <1>;
			#address-cells = <1>;
			#size-cells = <0>;
			csi_chan0: channel@0 {
				status = "okay";
				reg = <0>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					csi_chan0_port0: port@0 {
						status = "okay";
						reg = <0>;
						e3326_csi_in0: endpoint@0 {
							status = "okay";
							csi-port = <0>;
							bus-width = <4>;
							remote-endpoint = <&e3326_ov10635_out0>;
						};
					};
					csi_chan0_port1: port@1 {
						status = "okay";
						reg = <1>;
						e3326_csi_out0: endpoint@1 {
							status = "okay";
							remote-endpoint = <&e3326_vi_in0>;
						};
					};
				};
			};
			csi_chan1: channel@1 {
				status = "disabled";
				ports {
					csi_chan1_port0: port@0 {
						status = "disabled";
						csi_in1: endpoint@2 {
							status = "disabled";
						};
					};
					csi_chan1_port1: port@1 {
						status = "disabled";
						csi_out1: endpoint@3 {
							status = "disabled";
						};
					};
				};
			};
			csi_chan2: channel@2 {
				status = "disabled";
				ports {
					csi_chan2_port0: port@0 {
						status = "disabled";
						csi_in2: endpoint@4 {
							status = "disabled";
						};
					};
					csi_chan2_port1: port@1 {
						status = "disabled";
						csi_out2: endpoint@5 {
							status = "disabled";
						};
					};
				};
			};
		};
	};

	i2c@3180000 {
		e3326_cam0: ov10635_c@40 {
			status = "okay";
			compatible = "nvidia,ov10635";
			
			/* I2C device address */
			reg = <0x40>;

			/* V4L2 device node location */
			devnode = "video0";
			
			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			avdd-reg = "vana";
			iovdd-reg = "vif";
			
			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					e3326_ov10635_out0: endpoint {
						csi-port = <0>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_in0>;
					};
				};
			};
		};
		e3323_cam0: ov23850_a@10 {
			status = "disabled";
		};
		e3323_vcm0: lc898212@72 {
			status = "disabled";
		};
	};

	i2c@c240000 {
		e3323_cam1: ov23850_c@40 {
			status = "disabled";
		};
		e3323_vcm1: lc898212@72 {
			status = "disabled";
		};
	};

	tcp: tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";
		num_csi_lanes = <4>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <10>;
		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <160000>;
		isp_peak_byte_per_pixel = <5>;
		isp_bw_margin_pct = <25>;
		modules {
			cam_module0: module0 {
				status = "okay";
				badge = "e3326_left_ov10635";
				position = "rear";
				orientation = "1";
				cam_module0_drivernode0: drivernode0 {
					status = "okay";
					/* Declare PCL support driver (classically known as guid)  */
					pcl_id = "v4l2_sensor";
					/* Driver v4l2 device name */
					devname = "ov10635 1-0040";
					/* Declare the device-tree hierarchy to driver instance */
					proc-device-tree = "/proc/device-tree/i2c@3180000/ov10635_c@40";
				};
				cam_module0_drivernode1: drivernode1 {
					status = "okay";
					pcl_id = "v4l2_focuser_stub";
					proc-device-tree = "/proc/device-tree/e3326_focuser_ov10635@P5V27C/";
				};
			};
			cam_module1: module1 {
				status = "disabled";
				cam_module1_drivernode0: drivernode0 {
					status = "disabled";
				};
				cam_module1_drivernode1: drivernode1 {
					status = "disabled";
					pcl_id = "v4l2_focuser_stub";
				};
			};
			cam_module2: module2 {
				status = "disabled";
				cam_module2_drivernode0: drivernode0 {
					status = "disabled";
				};
				cam_module2_drivernode1: drivernode1 {
					status = "disabled";
					pcl_id = "v4l2_focuser_stub";
				};
			};
		};
	};
};

My image camera sensor driver:

/*
 * ov10635.c - ov10635 sensor driver
 *
 * Copyright (c) 2016, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#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 <media/tegra_v4l2_camera.h>
#include <media/camera_common.h>
#include <media/ov10635.h>

#include "ov10635_mode_tbls.h"

#define OV10635_SC_CHIP_ID_HIGH_ADDR	0x300A
#define OV10635_SC_CHIP_ID_LOW_ADDR	0x300B
#define OV10635_SC_SCCB_ID_ADDR		0x300C



/* Register definitions */
#define	OV10635_VFLIP			0x381c
#define	 OV10635_VFLIP_ON		(0x3 << 6)
#define	 OV10635_VFLIP_SUBSAMPLE	0x1
#define	OV10635_HMIRROR			0x381d
#define	 OV10635_HMIRROR_ON		0x3

/* IDs */
#define OV10635_VERSION_REG		0xa635

#define OV10635_DEFAULT_MODE		OV10635_MODE_1280x720
#define OV10635_DEFAULT_WIDTH		1280
#define OV10635_DEFAULT_HEIGHT		720
#define OV10635_DEFAULT_DATAFMT		MEDIA_BUS_FMT_UYVY8_1X16
#define OV10635_DEFAULT_CLK_FREQ	26000000

#define OV10635_DEFAULT_I2C_ADDRESS		(0x30 >> 1)

#define CAM1_RSTN 148 //219	/* TEGRA_GPIO_PBB3 */
#define CAM1_PWDN 151 //221	/* TEGRA_GPIO_PBB5 */

struct ov10635 {
	struct camera_common_power_rail	power;
	int				num_ctrls;
	bool				master;
	int				cam_sid_gpio;
	int				mcu_boot_gpio;
	int				mcu_reset_gpio;
	struct v4l2_ctrl_handler	ctrl_handler;
	struct i2c_client		*i2c_client;
	struct v4l2_subdev		*subdev;
	struct media_pad		pad;

	s32				group_hold_prev;
	bool				group_hold_en;
	struct regmap			*regmap;
	struct camera_common_data	*s_data;
	struct camera_common_pdata	*pdata;
	struct v4l2_ctrl		*ctrls[];
};

static const struct regmap_config sensor_regmap_config = {
	.reg_bits = 16,
	.val_bits = 8,
	.cache_type = REGCACHE_RBTREE,
};

static int ov10635_g_volatile_ctrl(struct v4l2_ctrl *ctrl);
static int ov10635_s_ctrl(struct v4l2_ctrl *ctrl);

static const struct v4l2_ctrl_ops ov10635_ctrl_ops = {
	.g_volatile_ctrl = ov10635_g_volatile_ctrl,
	.s_ctrl		= ov10635_s_ctrl,
};

static struct v4l2_ctrl_config ctrl_config_list[] = {
/* Do not change the name field for the controls! */
	{
		.ops = &ov10635_ctrl_ops,
		.id = V4L2_CID_VFLIP,
		.name = "VFlip",
		.type = V4L2_CTRL_TYPE_INTEGER,
		.flags = V4L2_CTRL_FLAG_SLIDER,
		.min = 0,
		.max = 1,
		.def = 0,
		.step = 1,
	},
	{
		.ops = &ov10635_ctrl_ops,
		.id = V4L2_CID_HFLIP,
		.name = "HFlip",
		.type = V4L2_CTRL_TYPE_INTEGER,
		.flags = V4L2_CTRL_FLAG_SLIDER,
		.min = 0,
		.max = 1,
		.def = 0,
		.step = 1,
	},
};

static inline int ov10635_read_reg(struct camera_common_data *s_data,
				u16 addr, u8 *val)
{
	struct ov10635 *priv = (struct ov10635 *)s_data->priv;
	unsigned int temp_val;
	int err;

	err = regmap_read(priv->regmap, addr, &temp_val);
	if (!err)
		*val = temp_val;

	return err;
}

static int ov10635_write_reg(struct camera_common_data *s_data,
		u16 addr, u8 val)
{
	int err;
	struct ov10635 *priv = (struct ov10635 *)s_data->priv;

	err = regmap_write(priv->regmap, addr, val);
	if (err)
		pr_err("[vunguyen] %s:i2c write failed, %x = %x\n",
			__func__, addr, val);

	return err;
}

/* Read a register, alter its bits, write it back */
static int ov10635_rmw_reg(struct camera_common_data *s_data, u16 addr, u8 set, u8 unset)

{
	int err;
	u8 val = 0;

	err = ov10635_read_reg(s_data, addr, &val);
	if (err)
		pr_err("[vunguyen] %s:i2c read failed, %x = %x\n",
			__func__, addr, val);

	val |= set;
	val &= ~unset;

	err = ov10635_write_reg(s_data, addr, val);
	if (err)
		pr_err("[vunguyen] %s:i2c write failed, %x = %x\n",
			__func__, addr, val);
			
	return err;
}

static int ov10635_write_table(struct ov10635 *priv,
				const ov10635_reg table[])
{
	return regmap_util_write_table_8(priv->regmap,
					 table,
					 NULL, 0,
					 OV10635_TABLE_WAIT_MS,
					 OV10635_TABLE_END);
}

static int ov10635_reset_sensor(void)
{
	int err;
	pr_err("[vunguyen] %s !! [+]\n", __func__);

	err = gpio_request(CAM1_RSTN, "CAM0_RST");
	if (err) {
		pr_err("[vunguyen] %s %d ERROR !!!\n", __func__, __LINE__);
	}

	gpio_direction_output(CAM1_RSTN, 1);
	gpio_set_value(CAM1_RSTN, 1);
	msleep(600);

	gpio_set_value(CAM1_RSTN, 0);
	msleep(600);
	
	gpio_set_value(CAM1_RSTN, 1);

	pr_err("[vunguyen] %s [-]\n", __func__);

	return 0;
}


static int ov10635_power_on(struct camera_common_data *s_data)
{
	int err = 0;
	struct ov10635 *priv = (struct ov10635 *)s_data->priv;
	struct camera_common_power_rail *pw = &priv->power;

	dev_dbg(&priv->i2c_client->dev, "%s: power on\n", __func__);

	if (priv->pdata->power_on) {
		err = priv->pdata->power_on(pw);
		if (err)
			pr_err("%s failed.\n", __func__);
		else
			pw->state = SWITCH_ON;
		return err;
	}

	usleep_range(5350, 5360);
	pw->state = SWITCH_ON;
	return 0;
}

static int ov10635_power_off(struct camera_common_data *s_data)
{
	int err = 0;
	struct ov10635 *priv = (struct ov10635 *)s_data->priv;
	struct camera_common_power_rail *pw = &priv->power;

	dev_dbg(&priv->i2c_client->dev, "%s: power off\n", __func__);
	ov10635_write_table(priv, mode_table[OV10635_MODE_STOP_STREAM]);

	if (priv->pdata->power_off) {
		err = priv->pdata->power_off(pw);
		if (err)
			pr_err("%s failed.\n", __func__);
		else
			goto power_off_done;
	}

	return err;

power_off_done:
	pw->state = SWITCH_OFF;
	return 0;
}

static int ov10635_power_put(struct ov10635 *priv)
{
	return 0;
}

static int ov10635_power_get(struct ov10635 *priv)
{
	struct camera_common_power_rail *pw = &priv->power;
	const char *mclk_name;
	int err = 0;

	//mclk_name = priv->pdata->mclk_name ?
	//	    priv->pdata->mclk_name : "cam_mclk1";
	mclk_name = "default_mclk";
	pw->mclk = devm_clk_get(&priv->i2c_client->dev, mclk_name);
	if (IS_ERR(pw->mclk)) {
		dev_err(&priv->i2c_client->dev,
			"unable to get clock %s\n", mclk_name);
		return PTR_ERR(pw->mclk);
	}

	/* ananlog 2.7v */
	//pw->avdd = devm_regulator_get(&priv->i2c_client->dev, "vana");
	pw->avdd = regulator_get(NULL, "vana");
	if (IS_ERR(pw->avdd)) {
		err = PTR_ERR(pw->avdd);
		pw->avdd = NULL;
		dev_err(&priv->i2c_client->dev, "Failed to get regulator vana\n");
		return err;
	}

	/* digital 1.2v */
	//pw->dvdd = devm_regulator_get(&priv->i2c_client->dev, "vdig");
	pw->dvdd = regulator_get(NULL, "vdig");
	if (IS_ERR(pw->dvdd)) {
		err = PTR_ERR(pw->dvdd);
		pw->dvdd = NULL;
		dev_err(&priv->i2c_client->dev, "Failed to get regulator vdig\n");
		return err;
	}

	/* IO 1.8v */
	//pw->iovdd = devm_regulator_get(&priv->i2c_client->dev, "vif");
	pw->iovdd = regulator_get(NULL, "vif");
	if (IS_ERR(pw->iovdd)) {
		err = PTR_ERR(pw->iovdd);
		pw->iovdd = NULL;
		dev_err(&priv->i2c_client->dev, "Failed to get regulator vif\n");
		return err;
	}
	
	pw->state = SWITCH_OFF;
	return err;
}

static int ov10635_verify_chip_id(struct ov10635 *priv)
{
	struct i2c_client *client = priv->i2c_client;
	struct camera_common_data *s_data = priv->s_data;
	u8 chip_id_hi, chip_id_lo;
	u16 chip_id;
	int err;

	err = camera_common_s_power(priv->subdev, true);
	if (err)
		return -ENODEV;

	err = ov10635_read_reg(s_data, OV10635_SC_CHIP_ID_HIGH_ADDR,
			       &chip_id_hi);
	if (err) {
		dev_err(&client->dev, "Failed to read chip ID\n");
		return err;
	}
	err = ov10635_read_reg(s_data, OV10635_SC_CHIP_ID_LOW_ADDR,
			       &chip_id_lo);
	if (err) {
		dev_err(&client->dev, "Failed to read chip ID\n");
		return err;
	}

	chip_id = (chip_id_hi << 8) | chip_id_lo;
	if (chip_id != OV10635_VERSION_REG) {
		dev_err(&client->dev, "Read unknown chip ID 0x%04x\n", chip_id);
		return -EINVAL;
	}

	err = camera_common_s_power(priv->subdev, false);
	if (err)
		return -ENODEV;

	return 0;
}

static int ov10635_s_stream(struct v4l2_subdev *sd, int enable)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct camera_common_data *s_data = to_camera_common_data(client);
	int err;
	
	err =  ov10635_write_reg(s_data, 0x0100, enable);
	if (err)
		goto exit;

	return 0;
exit:
	dev_dbg(&client->dev, "%s: error setting stream\n", __func__);
	return err;
}

static int ov10635_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 ov10635 *priv = (struct ov10635 *)s_data->priv;
	struct camera_common_power_rail *pw = &priv->power;

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

static struct v4l2_subdev_video_ops ov10635_subdev_video_ops = {
	.s_stream	= ov10635_s_stream,
	.g_mbus_config	= camera_common_g_mbus_config,
	.g_input_status = ov10635_g_input_status,
};

static struct v4l2_subdev_core_ops ov10635_subdev_core_ops = {
	.s_power	= camera_common_s_power,
};

static int ov10635_get_fmt(struct v4l2_subdev *sd,
		struct v4l2_subdev_pad_config *cfg,
		struct v4l2_subdev_format *format)
{
	return camera_common_g_fmt(sd, &format->format);
}

static int ov10635_set_fmt(struct v4l2_subdev *sd,
		struct v4l2_subdev_pad_config *cfg,
		struct v4l2_subdev_format *format)
{
	int ret;

	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 struct v4l2_subdev_pad_ops ov10635_subdev_pad_ops = {
	.set_fmt = ov10635_set_fmt,
	.get_fmt = ov10635_get_fmt,
	.enum_mbus_code = camera_common_enum_mbus_code,
	.enum_frame_size	= camera_common_enum_framesizes,
	.enum_frame_interval	= camera_common_enum_frameintervals,
};

static struct v4l2_subdev_ops ov10635_subdev_ops = {
	.core	= &ov10635_subdev_core_ops,
	.video	= &ov10635_subdev_video_ops,
	.pad	= &ov10635_subdev_pad_ops,
};

static struct of_device_id ov10635_of_match[] = {
	{ .compatible = "nvidia,ov10635", },
	{ },
};

static struct camera_common_sensor_ops ov10635_common_ops = {
	.power_on = ov10635_power_on,
	.power_off = ov10635_power_off,
	.write_reg = ov10635_write_reg,
	.read_reg = ov10635_read_reg,
};

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

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

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

	return err;
}

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

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

	switch (ctrl->id) {
	case V4L2_CID_VFLIP:
		if (ctrl->val)
			return ov10635_rmw_reg(priv->s_data, OV10635_VFLIP, OV10635_VFLIP_ON, 0);
		else
			return ov10635_rmw_reg(priv->s_data, OV10635_VFLIP, 0, OV10635_VFLIP_ON);
		break;
	case V4L2_CID_HFLIP:
		if (ctrl->val)
			return ov10635_rmw_reg(priv->s_data, OV10635_HMIRROR, OV10635_HMIRROR_ON, 0);
		else
			return ov10635_rmw_reg(priv->s_data, OV10635_HMIRROR, 0, OV10635_HMIRROR_ON);
		break;
	default:
		pr_err("%s: unknown ctrl id.\n", __func__);
		return -EINVAL;
	}

	return err;
}

static int ov10635_ctrls_init(struct ov10635 *priv)
{
	struct i2c_client *client = priv->i2c_client;
	struct v4l2_ctrl *ctrl;
	int num_ctrls;
	int err;
	int i;

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

	num_ctrls = ARRAY_SIZE(ctrl_config_list);
	v4l2_ctrl_handler_init(&priv->ctrl_handler, num_ctrls);

	for (i = 0; i < num_ctrls; i++) {
		ctrl = v4l2_ctrl_new_custom(&priv->ctrl_handler,
			&ctrl_config_list[i], NULL);
		if (ctrl == NULL) {
			dev_err(&client->dev, "Failed to init %s ctrl\n",
				ctrl_config_list[i].name);
			continue;
		}

		if (ctrl_config_list[i].type == V4L2_CTRL_TYPE_STRING &&
			ctrl_config_list[i].flags & V4L2_CTRL_FLAG_READ_ONLY) {
			ctrl->p_new.p_char = devm_kzalloc(&client->dev,
				ctrl_config_list[i].max + 1, GFP_KERNEL);
		}
		priv->ctrls[i] = ctrl;
	}

	priv->num_ctrls = num_ctrls;
	priv->subdev->ctrl_handler = &priv->ctrl_handler;
	if (priv->ctrl_handler.error) {
		dev_err(&client->dev, "Error %d adding controls\n",
			priv->ctrl_handler.error);
		err = priv->ctrl_handler.error;
		goto error;
	}

	err = v4l2_ctrl_handler_setup(&priv->ctrl_handler);
	if (err) {
		dev_err(&client->dev,
			"Error %d setting default controls\n", err);
		goto error;
	}

	return 0;

error:
	v4l2_ctrl_handler_free(&priv->ctrl_handler);
	return err;
}

MODULE_DEVICE_TABLE(of, ov10635_of_match);

static struct camera_common_pdata *ov10635_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 gpio;
	int err;
	struct camera_common_pdata *ret = NULL;

	if (!node)
		return NULL;

	match = of_match_device(ov10635_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;
	}

	gpio = of_get_named_gpio(node, "pwdn-gpios", 0);
	if (gpio < 0) {
		if (gpio == -EPROBE_DEFER) {
			ret = ERR_PTR(-EPROBE_DEFER);
			goto error;
		}
		dev_err(&client->dev, "pwdn gpios not in DT\n");
		goto error;
	}
	board_priv_pdata->pwdn_gpio = (unsigned int)gpio;

	gpio = of_get_named_gpio(node, "reset-gpios", 0);
	if (gpio < 0) {
		/* reset-gpio is not absolutely needed */
		if (gpio == -EPROBE_DEFER) {
			ret = ERR_PTR(-EPROBE_DEFER);
			goto error;
		}
		dev_dbg(&client->dev, "reset gpios not in DT\n");
		gpio = 0;
	}
	board_priv_pdata->reset_gpio = (unsigned int)gpio;

	board_priv_pdata->use_cam_gpio =
		of_property_read_bool(node, "cam,use-cam-gpio");

	err = of_property_read_string(node, "avdd-reg",
			&board_priv_pdata->regulators.avdd);
	if (err) {
		dev_err(&client->dev, "avdd-reg not in DT\n");
		goto error;
	}
	err = of_property_read_string(node, "iovdd-reg",
			&board_priv_pdata->regulators.iovdd);
	if (err) {
		dev_err(&client->dev, "iovdd-reg not in DT\n");
		goto error;
	}

	board_priv_pdata->has_eeprom =
		of_property_read_bool(node, "has-eeprom");
	board_priv_pdata->v_flip= of_property_read_bool(node, "vertical-flip");
	board_priv_pdata->h_mirror = of_property_read_bool(node,
							 "horizontal-mirror");
	return board_priv_pdata;

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

static int ov10635_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 ov10635_subdev_internal_ops = {
	.open = ov10635_open,
};

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

static int ov10635_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
{
	struct camera_common_data *common_data;
	struct ov10635 *priv;
	char dev_name[10];
	int err;

	pr_info("[OV10635]: probing v4l2 sensor.\n");
	pr_err("[VuNguyen] %s %d\n", __func__, __LINE__);

	common_data = devm_kzalloc(&client->dev,
			    sizeof(struct camera_common_data), GFP_KERNEL);

	priv = devm_kzalloc(&client->dev,
			sizeof(struct ov10635) + sizeof(struct v4l2_ctrl *) *
			ARRAY_SIZE(ctrl_config_list),
			GFP_KERNEL);
	if (!priv) {
		dev_err(&client->dev, "unable to allocate memory!\n");
		return -ENOMEM;
	}
	pr_err("[VuNguyen] %s %d\n", __func__, __LINE__);
	priv->regmap = devm_regmap_init_i2c(client, &sensor_regmap_config);
	if (IS_ERR(priv->regmap)) {
		dev_err(&client->dev,
			"regmap init failed: %ld\n", PTR_ERR(priv->regmap));
		return -ENODEV;
	}
	pr_err("[VuNguyen] %s %d\n", __func__, __LINE__);
	
	priv->pdata = ov10635_parse_dt(client);
	if (PTR_ERR(priv->pdata) == -EPROBE_DEFER)
		return -EPROBE_DEFER;
	if (!priv->pdata) {
		dev_err(&client->dev, "unable to get platform data\n");
		return -EFAULT;
	}

	common_data->ops		= &ov10635_common_ops;
	common_data->ctrl_handler	= &priv->ctrl_handler;
	common_data->i2c_client		= client;
	common_data->frmfmt		= ov10635_frmfmt;
	common_data->colorfmt		= camera_common_find_datafmt(
					  OV10635_DEFAULT_DATAFMT);
	common_data->power		= &priv->power;
	common_data->ctrls		= priv->ctrls;
	common_data->priv		= (void *)priv;
	common_data->numctrls		= ARRAY_SIZE(ctrl_config_list);
	common_data->numfmts		= ARRAY_SIZE(ov10635_frmfmt);
	common_data->def_mode		= OV10635_DEFAULT_MODE;
	common_data->def_width		= OV10635_DEFAULT_WIDTH;
	common_data->def_height		= OV10635_DEFAULT_HEIGHT;
	common_data->def_clk_freq	= OV10635_DEFAULT_CLK_FREQ;
	common_data->fmt_width		= common_data->def_width;
	common_data->fmt_height		= common_data->def_height;

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

	err = ov10635_power_get(priv);
	if (err)
		return err;

	/*
	 * If our device tree node is given MCU GPIOs, then we are expected to
	 * reset the MCU.
	 */
	if (gpio_is_valid(priv->mcu_boot_gpio) &&
	    gpio_is_valid(priv->mcu_reset_gpio)) {
		dev_info(&client->dev, "Resetting MCU\n");
		gpio_set_value(priv->mcu_boot_gpio, 0);
		gpio_set_value(priv->mcu_reset_gpio, 0);
		msleep_range(1);
		gpio_set_value(priv->mcu_reset_gpio, 1);
	}
	pr_err("[VuNguyen] %s %d\n", __func__, __LINE__);
	err = camera_common_parse_ports(client, common_data);
	if (err) {
		dev_err(&client->dev, "Failed to find port info\n");
		return err;
	}
	sprintf(dev_name, "ov10635_%c", common_data->csi_port + 'a');
	dev_dbg(&client->dev, "%s: name %s\n", __func__, dev_name);
	camera_common_create_debugfs(common_data, dev_name);
	pr_err("[VuNguyen] %s %d\n", __func__, __LINE__);
	ov10635_reset_sensor();

	v4l2_i2c_subdev_init(&common_data->subdev, client,
			     &ov10635_subdev_ops);

	err = ov10635_ctrls_init(priv);
	if (err)
		return err;

	err = ov10635_verify_chip_id(priv);
	if (err)
		return err;
	
	/*Write default registers*/	
	err = ov10635_write_table(priv, mode_table[OV10635_MODE_1280x720]);
	if (err)
		return err;
		
	pr_err("[VuNguyen] %s %d\n", __func__, __LINE__);
	priv->subdev->internal_ops = &ov10635_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 = &ov10635_media_ops;
	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
	pr_err("[VuNguyen] %s %d\n", __func__, __LINE__);
	err = v4l2_async_register_subdev(priv->subdev);
	if (err)
		return err;

	dev_info(&client->dev, "Detected OV10635 sensor\n");

	return 0;
}

static int
ov10635_remove(struct i2c_client *client)
{
	struct camera_common_data *s_data = to_camera_common_data(client);
	struct ov10635 *priv = (struct ov10635 *)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);
	ov10635_power_put(priv);
	camera_common_remove_debugfs(s_data);

	return 0;
}

static const struct i2c_device_id ov10635_id[] = {
	{ "ov10635", 0 },
	{ }
};

MODULE_DEVICE_TABLE(i2c, ov10635_id);

static struct i2c_driver ov10635_i2c_driver = {
	.driver = {
		.name = "ov10635",
		.owner = THIS_MODULE,
		.of_match_table = of_match_ptr(ov10635_of_match),
	},
	.probe = ov10635_probe,
	.remove = ov10635_remove,
	.id_table = ov10635_id,
};

module_i2c_driver(ov10635_i2c_driver);

MODULE_DESCRIPTION("SoC Camera driver for Omnivison OV10635");
MODULE_AUTHOR("NVIDIA Corporation");
MODULE_LICENSE("GPL v2");

But look like it can not invoke “ov10635_probe” function.