From 5f7f9577f2f3351884af70de000812ddbd88b066 Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Fri, 14 Jul 2017 22:01:00 +0300 Subject: add ov5642, fix DVP in VIN - add ov5642 driver - fix parallel interfacein VIN - enable CMOS cameras on Kingfisher --- .../0031-media-i2c-Add-ov5647-sensor.patch | 952 +++++++++ .../0032-media-i2c-Add-ov5642-sensor.patch | 2173 ++++++++++++++++++++ ...-media-soc-camera-fix-parallel-i-f-in-VIN.patch | 69 + .../0040-arm64-dts-renesas-add-ADAS-boards.patch | 199 +- .../0060-media-i2c-Add-ov5647-sensor.patch | 952 --------- .../recipes-kernel/linux/linux-renesas/ulcb.cfg | 1 + 6 files changed, 3375 insertions(+), 971 deletions(-) create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0031-media-i2c-Add-ov5647-sensor.patch create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0032-media-i2c-Add-ov5642-sensor.patch create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0033-media-soc-camera-fix-parallel-i-f-in-VIN.patch delete mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0060-media-i2c-Add-ov5647-sensor.patch (limited to 'meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas') diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0031-media-i2c-Add-ov5647-sensor.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0031-media-i2c-Add-ov5647-sensor.patch new file mode 100644 index 0000000..1cd366c --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0031-media-i2c-Add-ov5647-sensor.patch @@ -0,0 +1,952 @@ +From 8b97232e3ecbb4ee38bda454915e62914ef52fcc Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov +Date: Thu, 1 Jun 2017 19:59:56 +0300 +Subject: [PATCH] media: i2c: Add ov5647 sensor + +Add ov5647 camera sensor driver + +Signed-off-by: Vladimir Barinov +--- + drivers/media/i2c/soc_camera/Kconfig | 6 + + drivers/media/i2c/soc_camera/Makefile | 1 + + drivers/media/i2c/soc_camera/ov5647.c | 649 ++++++++++++++++++++++++++++++++++ + drivers/media/i2c/soc_camera/ov5647.h | 242 +++++++++++++ + 4 files changed, 898 insertions(+) + create mode 100644 drivers/media/i2c/soc_camera/ov5647.c + create mode 100644 drivers/media/i2c/soc_camera/ov5647.h + +diff --git a/drivers/media/i2c/soc_camera/Kconfig b/drivers/media/i2c/soc_camera/Kconfig +index e1c65ca..c272aeb 100644 +--- a/drivers/media/i2c/soc_camera/Kconfig ++++ b/drivers/media/i2c/soc_camera/Kconfig +@@ -97,6 +97,12 @@ config SOC_CAMERA_OV5642 + help + This is a V4L2 camera driver for the OmniVision OV5642 sensor + ++config SOC_CAMERA_OV5647 ++ tristate "ov5647 camera support" ++ depends on SOC_CAMERA && I2C ++ help ++ This is a V4L2 camera driver for the OmniVision OV5647 sensor ++ + config SOC_CAMERA_OV6650 + tristate "ov6650 sensor support" + depends on SOC_CAMERA && I2C +diff --git a/drivers/media/i2c/soc_camera/Makefile b/drivers/media/i2c/soc_camera/Makefile +index 8e24d5d..a67fff8 100644 +--- a/drivers/media/i2c/soc_camera/Makefile ++++ b/drivers/media/i2c/soc_camera/Makefile +@@ -13,6 +13,7 @@ obj-$(CONFIG_SOC_CAMERA_OV495_OV2775) += ov495_ov2775.o + obj-$(CONFIG_SOC_CAMERA_OV106XX) += ov106xx.o + obj-$(CONFIG_SOC_CAMERA_OV2640) += ov2640.o + obj-$(CONFIG_SOC_CAMERA_OV5642) += ov5642.o ++obj-$(CONFIG_SOC_CAMERA_OV5647) += ov5647.o + obj-$(CONFIG_SOC_CAMERA_OV6650) += ov6650.o + obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o + obj-$(CONFIG_SOC_CAMERA_OV9640) += ov9640.o +diff --git a/drivers/media/i2c/soc_camera/ov5647.c b/drivers/media/i2c/soc_camera/ov5647.c +new file mode 100644 +index 0000000..caccf39 +--- /dev/null ++++ b/drivers/media/i2c/soc_camera/ov5647.c +@@ -0,0 +1,649 @@ ++/* ++ * V4L2 driver for OmniVision OV5647 cameras. ++ * ++ * Based on Samsung S5K6AAFX SXGA 1/6" 1.3M CMOS Image Sensor driver ++ * Copyright (C) 2011 Sylwester Nawrocki ++ * ++ * Based on Omnivision OV7670 Camera Driver ++ * Copyright (C) 2006-7 Jonathan Corbet ++ * ++ * Copyright (C) 2016, Synopsys, Inc. ++ * ++ * Copyright (C) 2017 Cogent Embedded, Inc ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "ov5647.h" ++ ++static bool debug = true; ++module_param(debug, bool, 0644); ++MODULE_PARM_DESC(debug, "Debug level (0-1)"); ++ ++#define OV5647_I2C_ADDR 0x6c ++#define SENSOR_NAME "ov5647" ++ ++#define OV5647_REG_CHIPID_H 0x300A ++#define OV5647_REG_CHIPID_L 0x300B ++ ++#define REG_TERM 0xfffe ++#define VAL_TERM 0xfe ++#define REG_DLY 0xffff ++ ++/*define the voltage level of control signal*/ ++#define CSI_STBY_ON 1 ++#define CSI_STBY_OFF 0 ++#define CSI_RST_ON 0 ++#define CSI_RST_OFF 1 ++#define CSI_PWR_ON 1 ++#define CSI_PWR_OFF 0 ++#define CSI_AF_PWR_ON 1 ++#define CSI_AF_PWR_OFF 0 ++ ++#define OV5647_ROW_START 0x01 ++#define OV5647_ROW_START_MIN 0 ++#define OV5647_ROW_START_MAX 2004 ++#define OV5647_ROW_START_DEF 54 ++ ++#define OV5647_COLUMN_START 0x02 ++#define OV5647_COLUMN_START_MIN 0 ++#define OV5647_COLUMN_START_MAX 2750 ++#define OV5647_COLUMN_START_DEF 16 ++ ++#define OV5647_WINDOW_HEIGHT 0x03 ++#define OV5647_WINDOW_HEIGHT_MIN 2 ++#define OV5647_WINDOW_HEIGHT_MAX 2006 ++#define OV5647_WINDOW_HEIGHT_DEF 1944 ++ ++#define OV5647_WINDOW_WIDTH 0x04 ++#define OV5647_WINDOW_WIDTH_MIN 2 ++#define OV5647_WINDOW_WIDTH_MAX 2752 ++#define OV5647_WINDOW_WIDTH_DEF 2592 ++ ++enum power_seq_cmd { ++ CSI_SUBDEV_PWR_OFF = 0x00, ++ CSI_SUBDEV_PWR_ON = 0x01, ++}; ++ ++struct sensor_format_struct { ++ __u8 *desc; ++ u32 mbus_code; ++ enum v4l2_colorspace colorspace; ++ struct regval_list *regs; ++ int regs_size; ++ int bpp; ++}; ++ ++struct cfg_array { ++ struct regval_list *regs; ++ int size; ++}; ++ ++struct sensor_win_size { ++ int width; ++ int height; ++ unsigned int hoffset; ++ unsigned int voffset; ++ unsigned int hts; ++ unsigned int vts; ++ unsigned int pclk; ++ unsigned int mipi_bps; ++ unsigned int fps_fixed; ++ unsigned int bin_factor; ++ unsigned int intg_min; ++ unsigned int intg_max; ++ void *regs; ++ int regs_size; ++ int (*set_size)(struct v4l2_subdev *subdev); ++}; ++ ++struct ov5647 { ++ struct device *dev; ++ struct v4l2_subdev subdev; ++ struct media_pad pad; ++ struct mutex lock; ++ struct v4l2_mbus_framefmt format; ++ struct sensor_format_struct *fmt; ++ unsigned int width; ++ unsigned int height; ++ unsigned int capture_mode; ++ int hue; ++ struct v4l2_fract tpf; ++ struct sensor_win_size *current_wins; ++}; ++ ++static inline struct ov5647 *to_state(struct v4l2_subdev *subdev) ++{ ++ return container_of(subdev, struct ov5647, subdev); ++} ++ ++static struct sensor_format_struct sensor_formats[] = { ++ { ++ .mbus_code = OV5647_CODE, ++ .colorspace = V4L2_COLORSPACE_JPEG, ++ }, ++}; ++#define N_FMTS ARRAY_SIZE(sensor_formats) ++ ++static int ov5647_write(struct v4l2_subdev *sd, uint16_t reg, uint8_t val) ++{ ++ int ret; ++ unsigned char data[3] = { reg >> 8, reg & 0xff, val}; ++ struct i2c_client *client = v4l2_get_subdevdata(sd); ++ ++ ret = i2c_master_send(client, data, 3); ++ if (ret < 3) { ++ printk( "%s: i2c write error, reg: %x, %d\n", ++ __func__, reg, ret); ++ return ret < 0 ? ret : -EIO; ++ } ++ ++ return 0; ++} ++ ++static int ov5647_read(struct v4l2_subdev *sd, uint16_t reg, uint8_t *val) ++{ ++ int ret; ++ unsigned char data_w[2] = { reg >> 8, reg & 0xff }; ++ struct i2c_client *client = v4l2_get_subdevdata(sd); ++ ++ ++ ret = i2c_master_send(client, data_w, 2); ++ ++ if (ret < 2) { ++ printk("%s: i2c read error, reg: %x\n", ++ __func__, reg); ++ return ret < 0 ? ret : -EIO; ++ } ++ ++ ret = i2c_master_recv(client, val, 1); ++ ++ if (ret < 1) { ++ printk("%s: i2c read error, reg: %x\n", ++ __func__, reg); ++ return ret < 0 ? ret : -EIO; ++ } ++ ++ return 0; ++} ++ ++static int ov5647_write_array(struct v4l2_subdev *subdev, ++ struct regval_list *regs, int array_size) ++{ ++ int i = 0; ++ int ret = 0; ++ ++ if (!regs) ++ return -EINVAL; ++ ++ while (i < array_size) { ++ if (regs->addr == REG_DLY) ++ mdelay(regs->data); ++ else ++ ret = ov5647_write(subdev, regs->addr, regs->data); ++ ++ if (ret == -EIO) ++ return ret; ++ ++ i++; ++ regs++; ++ } ++ return 0; ++} ++ ++static void ov5647_set_virtual_channel(struct v4l2_subdev *subdev, int channel) ++{ ++#if 0 ++ u8 channel_id; ++ ++ ov5647_read(subdev, 0x4814, &channel_id); ++// channel_id = 0x1e; //override ++ ++ channel_id &= ~(3 << 6); ++ channel_id |= (channel << 6); ++ printk("0x4814 = 0x%02x\n", channel_id); ++ ov5647_write(subdev, 0x4814, channel_id); ++ ov5647_write(subdev, 0x4801, 0x8f); ++#endif ++} ++ ++void ov5647_stream_on(struct v4l2_subdev *subdev) ++{ ++ ov5647_write(subdev, 0x4202, 0x00); ++ ov5647_write(subdev, 0x300D, 0x00); ++} ++ ++void ov5647_stream_off(struct v4l2_subdev *subdev) ++{ ++ ov5647_write(subdev, 0x4202, 0x0f); ++ ov5647_write(subdev, 0x300D, 0x01); ++} ++ ++static int sensor_s_sw_stby(struct v4l2_subdev *subdev, int on_off) ++{ ++ int ret; ++ unsigned char rdval; ++ ++ ret = ov5647_read(subdev, 0x0100, &rdval); ++ if (ret != 0) ++ return ret; ++ ++ if (on_off == CSI_STBY_ON) ++ ret = ov5647_write(subdev, 0x0100, rdval&0xfe); ++ else ++ ret = ov5647_write(subdev, 0x0100, rdval|0x01); ++ ++ return ret; ++} ++ ++static int __sensor_init(struct v4l2_subdev *subdev) ++{ ++ int ret; ++ unsigned char rdval; ++ ++ ret = ov5647_read(subdev, 0x0100, &rdval); ++ if (ret != 0) ++ return ret; ++ ++ ov5647_write(subdev, 0x4800, 0x25); ++ ov5647_stream_off(subdev); ++ ++ ov5647_write(subdev, 0x100, 0); ++ /* reset */ ++ ov5647_write(subdev, 0x103, 1); ++ ov5647_write(subdev, 0x103, 1); ++ ov5647_write(subdev, 0x103, 1); ++ mdelay(10); ++ ++ ret = ov5647_write_array(subdev, ov5647_recommend_settings, ++ ARRAY_SIZE(ov5647_recommend_settings)); ++#if 1 ++ ret = ov5647_write_array(subdev, ov5647_snap_settings, ++ ARRAY_SIZE(ov5647_snap_settings)); ++#else ++ ret = ov5647_write_array(subdev, ov5647_prev_settings, ++ ARRAY_SIZE(ov5647_prev_settings)); ++#endif ++ ov5647_set_virtual_channel(subdev, 0); ++ ++ ov5647_write(subdev, 0x0100, 0x01); ++ ++ ov5647_write(subdev, 0x04800, 0x04); ++ ov5647_stream_on(subdev); ++ msleep(30); ++ ++ return 0; ++} ++ ++static int sensor_power(struct v4l2_subdev *subdev, int on) ++{ ++ int ret = 0; ++ struct ov5647 *ov5647 = to_state(subdev); ++ ++ mutex_lock(&ov5647->lock); ++ ++ switch (on) { ++ case CSI_SUBDEV_PWR_OFF: ++ ret = sensor_s_sw_stby(subdev, CSI_STBY_ON); ++ if (ret < 0) ++ printk("soft stby failed!\n"); ++ break; ++ case CSI_SUBDEV_PWR_ON: ++ ret = __sensor_init(subdev); ++ if (ret < 0) { ++ v4l2_err(subdev, "Camera not available, check power\n"); ++ break; ++ } ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ mutex_unlock(&ov5647->lock); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_VIDEO_ADV_DEBUG ++static int sensor_get_register(struct v4l2_subdev *subdev, ++ struct v4l2_dbg_register *reg) ++{ ++ u8 val = 0; ++ int ret; ++ ++ ret = ov5647_read(subdev, (u16)reg->reg, &val); ++ if (ret < 0) ++ return ret; ++ ++ reg->val = val; ++ reg->size = sizeof(u8); ++ ++ return ret; ++} ++ ++static int sensor_set_register(struct v4l2_subdev *subdev, ++ const struct v4l2_dbg_register *reg) ++{ ++ ov5647_write(subdev, (u16)reg->reg, (u8)reg->val); ++ ++ return 0; ++} ++#endif ++ ++static const struct v4l2_subdev_core_ops sensor_core_ops = { ++ .s_power = sensor_power, ++#ifdef CONFIG_VIDEO_ADV_DEBUG ++ .g_register = sensor_get_register, ++ .s_register = sensor_set_register, ++#endif ++}; ++ ++static int sensor_s_stream(struct v4l2_subdev *sd, int enable) ++{ ++ if (enable) ++ ov5647_stream_on(sd); ++ else ++ ov5647_stream_off(sd); ++ ++ return 0; ++} ++ ++static int sensor_enum_fmt(struct v4l2_subdev *sd, ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_mbus_code_enum *code) ++{ ++ if (code->pad || code->index >= N_FMTS) ++ return -EINVAL; ++ ++ code->code = OV5647_CODE; ++ ++ return 0; ++} ++ ++static int sensor_try_fmt_internal(struct v4l2_subdev *subdev, ++ struct v4l2_mbus_framefmt *fmt, ++ struct sensor_format_struct **ret_fmt, ++ struct sensor_win_size **ret_wsize) ++{ ++ int index; ++ ++ for (index = 0; index < N_FMTS; index++) ++ if (sensor_formats[index].mbus_code == fmt->code) ++ break; ++ ++ if (index >= N_FMTS) ++ return -EINVAL; ++ ++ if (ret_fmt != NULL) ++ *ret_fmt = sensor_formats + index; ++ ++ fmt->field = V4L2_FIELD_NONE; ++ ++ return 0; ++} ++ ++static int sensor_s_fmt(struct v4l2_subdev *subdev, ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_format *fmt) ++{ ++ int ret; ++ struct sensor_format_struct *sensor_fmt; ++ struct sensor_win_size *wsize = NULL; ++ struct ov5647 *info = to_state(subdev); ++ ++ ret = sensor_try_fmt_internal(subdev, &fmt->format, ++ &sensor_fmt, &wsize); ++ if (ret) ++ return ret; ++ ++ info->fmt = sensor_fmt; ++ info->width = OV5647_WIDTH; ++ info->height = OV5647_HEIGHT; ++ ++ return 0; ++} ++ ++static int sensor_g_fmt(struct v4l2_subdev *sd, ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_format *format) ++{ ++ struct ov5647 *info = to_state(sd); ++ struct v4l2_mbus_framefmt *mf = &format->format; ++ ++ if (format->pad != 0) ++ return -EINVAL; ++ ++ mf->width = OV5647_WIDTH; ++ mf->height = OV5647_HEIGHT; ++ mf->code = OV5647_CODE; ++ mf->colorspace = info->fmt->colorspace; ++ mf->field = V4L2_FIELD_NONE; ++ ++ return 0; ++} ++ ++static int sensor_s_parm(struct v4l2_subdev *subdev, ++ struct v4l2_streamparm *parms) ++{ ++ struct v4l2_captureparm *cp = &parms->parm.capture; ++ struct ov5647 *info = to_state(subdev); ++ ++ if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; ++ ++ if (info->tpf.numerator == 0) ++ return -EINVAL; ++ ++ info->capture_mode = cp->capturemode; ++ ++ return 0; ++} ++ ++static int sensor_g_parm(struct v4l2_subdev *subdev, ++ struct v4l2_streamparm *parms) ++{ ++ struct v4l2_captureparm *cp = &parms->parm.capture; ++ struct ov5647 *info = to_state(subdev); ++ ++ if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; ++ ++ memset(cp, 0, sizeof(struct v4l2_captureparm)); ++ cp->capability = V4L2_CAP_TIMEPERFRAME; ++ cp->capturemode = info->capture_mode; ++ ++ return 0; ++} ++ ++static int sensor_g_mbus_config(struct v4l2_subdev *sd, ++ struct v4l2_mbus_config *cfg) ++{ ++ cfg->flags = V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_CHANNEL_0 | ++ V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; ++ cfg->type = V4L2_MBUS_CSI2; ++ ++ return 0; ++} ++ ++static const struct v4l2_subdev_pad_ops sensor_pad_ops = { ++ .enum_mbus_code = sensor_enum_fmt, ++ .set_fmt = sensor_s_fmt, ++ .get_fmt = sensor_g_fmt, ++}; ++ ++static const struct v4l2_subdev_video_ops sensor_video_ops = { ++ .s_stream = sensor_s_stream, ++ .s_parm = sensor_s_parm, ++ .g_parm = sensor_g_parm, ++ .g_mbus_config = sensor_g_mbus_config, ++}; ++ ++static const struct v4l2_subdev_ops subdev_ops = { ++ .core = &sensor_core_ops, ++ .video = &sensor_video_ops, ++ .pad = &sensor_pad_ops, ++}; ++ ++static int ov5647_detect(struct v4l2_subdev *sd) ++{ ++ struct i2c_client *client = v4l2_get_subdevdata(sd); ++ unsigned char id_h, id_l; ++ int ret; ++ ++ ret = sensor_power(sd, 1); ++ if (ret < 0) ++ return ret; ++ ++ ret = ov5647_read(sd, OV5647_REG_CHIPID_H, &id_h); ++ if (ret < 0) ++ return ret; ++ ret = ov5647_read(sd, OV5647_REG_CHIPID_L, &id_l); ++ if (ret < 0) ++ return ret; ++ ++ if ((id_h != 0x56) || (id_l != 0x47)) { ++ v4l2_info(sd, "Invalid device ID: %02x%02x\n", id_h, id_l); ++ return -ENODEV; ++ } ++ ++ v4l2_info(sd, "OV5647 detected at address 0x%02x\n", client->addr); ++ ++ ret = sensor_power(sd, 0); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int ov5647_registered(struct v4l2_subdev *subdev) ++{ ++ return 0; ++} ++ ++static int ov5647_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh) ++{ ++ struct v4l2_mbus_framefmt *format = ++ v4l2_subdev_get_try_format(subdev, fh->pad, 0); ++ struct v4l2_rect *crop = ++ v4l2_subdev_get_try_crop(subdev, fh->pad, 0); ++ ++ crop->left = 0; ++ crop->top = 0; ++ crop->width = OV5647_WIDTH; ++ crop->height = OV5647_HEIGHT; ++ ++ format->code = OV5647_CODE; ++ ++ format->width = OV5647_WIDTH; ++ format->height = OV5647_HEIGHT; ++ format->field = V4L2_FIELD_NONE; ++ format->colorspace = sensor_formats[0].colorspace; ++ ++ return sensor_power(subdev, 1); ++} ++ ++static int ov5647_close(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh) ++{ ++ return sensor_power(subdev, 0); ++} ++ ++static const struct v4l2_subdev_internal_ops ov5647_subdev_internal_ops = { ++ .registered = ov5647_registered, ++ .open = ov5647_open, ++ .close = ov5647_close, ++}; ++ ++static int ov5647_probe(struct i2c_client *client, ++ const struct i2c_device_id *id) ++{ ++ struct device *dev = &client->dev; ++ struct ov5647 *sensor; ++ int ret = 0; ++ struct v4l2_subdev *sd; ++ ++ sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); ++ if (sensor == NULL) ++ return -ENOMEM; ++ ++ mutex_init(&sensor->lock); ++ sensor->dev = dev; ++ sensor->fmt = &sensor_formats[0]; ++ sensor->width = OV5647_WIDTH; ++ sensor->height = OV5647_HEIGHT; ++ ++ sd = &sensor->subdev; ++ v4l2_i2c_subdev_init(sd, client, &subdev_ops); ++ sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ++ ++ ret = ov5647_detect(sd); ++ if (ret < 0) { ++ v4l2_err(sd, "OV5647 not found!\n"); ++ goto out; ++ } ++ ++ sensor->pad.flags = MEDIA_PAD_FL_SOURCE; ++ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; ++ ret = media_entity_pads_init(&sd->entity, 1, &sensor->pad); ++ if (ret < 0) ++ return ret; ++ ++ ret = v4l2_async_register_subdev(sd); ++ if (ret < 0) ++ media_entity_cleanup(&sd->entity); ++ ++out: ++ return ret; ++} ++ ++static int ov5647_remove(struct i2c_client *client) ++{ ++ struct v4l2_subdev *subdev = i2c_get_clientdata(client); ++ struct ov5647 *ov5647 = to_state(subdev); ++ ++ v4l2_async_unregister_subdev(&ov5647->subdev); ++ media_entity_cleanup(&ov5647->subdev.entity); ++ v4l2_device_unregister_subdev(subdev); ++ ++ return 0; ++} ++ ++static const struct i2c_device_id ov5647_id[] = { ++ { "ov5647", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, ov5647_id); ++ ++#if IS_ENABLED(CONFIG_OF) ++static const struct of_device_id ov5647_of_match[] = { ++ { .compatible = "ovti,ov5647" }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, ov5647_of_match); ++#endif ++ ++static struct i2c_driver ov5647_driver = { ++ .driver = { ++ .of_match_table = of_match_ptr(ov5647_of_match), ++ .owner = THIS_MODULE, ++ .name = "ov5647", ++ }, ++ .probe = ov5647_probe, ++ .remove = ov5647_remove, ++ .id_table = ov5647_id, ++}; ++module_i2c_driver(ov5647_driver); ++ ++MODULE_AUTHOR("Ramiro Oliveira "); ++MODULE_DESCRIPTION("A low-level driver for OmniVision ov5647 sensors"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/media/i2c/soc_camera/ov5647.h b/drivers/media/i2c/soc_camera/ov5647.h +new file mode 100644 +index 0000000..f854da8 +--- /dev/null ++++ b/drivers/media/i2c/soc_camera/ov5647.h +@@ -0,0 +1,242 @@ ++/* ++ * Copyright (c) 2012, The Linux Foundation. All rights reserved. ++ * Copyright (C) 2017 Cogent Embedded, Inc ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 and ++ * only version 2 as published by the Free Software Foundation. ++ * ++ * 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. ++ */ ++ ++//#define TEST_PATTERN ++ ++#define OV5647_WIDTH 2592 ++#define OV5647_HEIGHT 1944 ++ ++#define OV5647_CODE MEDIA_BUS_FMT_SBGGR8_1X8 ++//#define OV5647_CODE MEDIA_BUS_FMT_YUYV8_2X8 ++ ++struct regval_list { ++ uint16_t addr; ++ uint8_t data; ++}; ++ ++enum ov5647_test_mode_t { ++ TEST_OFF, ++ TEST_1, ++ TEST_2, ++ TEST_3 ++}; ++ ++struct regval_list ov5647_prev_settings[] = { ++ /*1280*960 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps ++ for back to preview*/ ++ {0x3035, 0x21}, ++ {0x3036, 0x37}, ++ {0x3821, 0x07}, ++ {0x3820, 0x41}, ++ {0x3612, 0x09}, ++ {0x3618, 0x00}, ++ {0x380c, 0x07}, ++ {0x380d, 0x68}, ++ {0x380e, 0x03}, ++ {0x380f, 0xd8}, ++ {0x3814, 0x31}, ++ {0x3815, 0x31}, ++ {0x3709, 0x52}, ++ {0x3808, 0x05}, // 1280 ++ {0x3809, 0x00}, ++ {0x380a, 0x03}, // 960 ++ {0x380b, 0xc0}, ++ {0x3800, 0x00}, ++ {0x3801, 0x18}, ++ {0x3802, 0x00}, ++ {0x3803, 0x0e}, ++ {0x3804, 0x0a}, ++ {0x3805, 0x27}, ++ {0x3806, 0x07}, ++ {0x3807, 0x95}, ++ {0x4004, 0x02}, ++}; ++struct regval_list ov5647_snap_settings[] = { ++ /*2608*1952 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps*/ ++ {0x3035, 0x21}, ++ {0x3036, 0x4f}, ++ {0x3821, 0x06}, ++ {0x3820, 0x00}, ++ {0x3612, 0x0b}, ++ {0x3618, 0x04}, ++ {0x380c, 0x0a}, ++ {0x380d, 0x8c}, ++ {0x380e, 0x07}, ++ {0x380f, 0xb0}, ++ {0x3814, 0x11}, ++ {0x3815, 0x11}, ++ {0x3709, 0x12}, ++#if 0 ++ {0x3808, 0x0a}, ++ {0x3809, 0x30}, ++ {0x380a, 0x07}, ++ {0x380b, 0xa0}, ++#else ++ {0x3808, OV5647_WIDTH >> 8}, ++ {0x3809, OV5647_WIDTH & 0xff}, ++ {0x380a, OV5647_HEIGHT >> 8}, ++ {0x380b, OV5647_HEIGHT & 0xff}, ++#endif ++ {0x3800, 0x00}, ++ {0x3801, 0x04}, ++ {0x3802, 0x00}, ++ {0x3803, 0x00}, ++ {0x3804, 0x0a}, ++ {0x3805, 0x3b}, ++ {0x3806, 0x07}, ++ {0x3807, 0xa3}, ++ {0x4004, 0x04}, ++}; ++struct regval_list ov5647_recommend_settings[] = { ++#ifdef TEST_PATTERN ++ {0x503d, 0x80}, ++#endif ++#if 0 ++ {0x4814, 0x1e}, ++ {0x4801, 0x8f}, ++#endif ++ {0x3035, 0x11}, ++ {0x303c, 0x11}, ++ {0x370c, 0x03}, ++ {0x5000, 0x06}, ++ {0x5003, 0x08}, ++ {0x5a00, 0x08}, ++ {0x3000, 0xff}, ++ {0x3001, 0xff}, ++ {0x3002, 0xff}, ++ {0x301d, 0xf0}, ++ {0x3a18, 0x00}, ++ {0x3a19, 0xf8}, ++ {0x3c01, 0x80}, ++ {0x3b07, 0x0c}, ++ {0x3708, 0x64}, ++ {0x3630, 0x2e}, ++ {0x3632, 0xe2}, ++ {0x3633, 0x23}, ++ {0x3634, 0x44}, ++ {0x3620, 0x64}, ++ {0x3621, 0xe0}, ++ {0x3600, 0x37}, ++ {0x3704, 0xa0}, ++ {0x3703, 0x5a}, ++ {0x3715, 0x78}, ++ {0x3717, 0x01}, ++ {0x3731, 0x02}, ++ {0x370b, 0x60}, ++ {0x3705, 0x1a}, ++ {0x3f05, 0x02}, ++ {0x3f06, 0x10}, ++ {0x3f01, 0x0a}, ++ {0x3a08, 0x01}, ++ {0x3a0f, 0x58}, ++ {0x3a10, 0x50}, ++ {0x3a1b, 0x58}, ++ {0x3a1e, 0x50}, ++ {0x3a11, 0x60}, ++ {0x3a1f, 0x28}, ++ {0x4001, 0x02}, ++ {0x4000, 0x09}, ++ {0x3000, 0x00}, ++ {0x3001, 0x00}, ++ {0x3002, 0x00}, ++ {0x3017, 0xe0}, ++ {0x301c, 0xfc}, ++ {0x3636, 0x06}, ++ {0x3016, 0x08}, ++ {0x3827, 0xec}, ++ {0x3018, 0x44}, ++ {0x3035, 0x21}, ++ {0x3106, 0xf5}, ++ {0x3034, 0x18}, ++ {0x301c, 0xf8}, ++ /*lens setting*/ ++ {0x5000, 0x86}, ++ {0x5800, 0x11}, ++ {0x5801, 0x0c}, ++ {0x5802, 0x0a}, ++ {0x5803, 0x0b}, ++ {0x5804, 0x0d}, ++ {0x5805, 0x13}, ++ {0x5806, 0x09}, ++ {0x5807, 0x05}, ++ {0x5808, 0x03}, ++ {0x5809, 0x03}, ++ {0x580a, 0x06}, ++ {0x580b, 0x08}, ++ {0x580c, 0x05}, ++ {0x580d, 0x01}, ++ {0x580e, 0x00}, ++ {0x580f, 0x00}, ++ {0x5810, 0x02}, ++ {0x5811, 0x06}, ++ {0x5812, 0x05}, ++ {0x5813, 0x01}, ++ {0x5814, 0x00}, ++ {0x5815, 0x00}, ++ {0x5816, 0x02}, ++ {0x5817, 0x06}, ++ {0x5818, 0x09}, ++ {0x5819, 0x05}, ++ {0x581a, 0x04}, ++ {0x581b, 0x04}, ++ {0x581c, 0x06}, ++ {0x581d, 0x09}, ++ {0x581e, 0x11}, ++ {0x581f, 0x0c}, ++ {0x5820, 0x0b}, ++ {0x5821, 0x0b}, ++ {0x5822, 0x0d}, ++ {0x5823, 0x13}, ++ {0x5824, 0x22}, ++ {0x5825, 0x26}, ++ {0x5826, 0x26}, ++ {0x5827, 0x24}, ++ {0x5828, 0x24}, ++ {0x5829, 0x24}, ++ {0x582a, 0x22}, ++ {0x582b, 0x20}, ++ {0x582c, 0x22}, ++ {0x582d, 0x26}, ++ {0x582e, 0x22}, ++ {0x582f, 0x22}, ++ {0x5830, 0x42}, ++ {0x5831, 0x22}, ++ {0x5832, 0x02}, ++ {0x5833, 0x24}, ++ {0x5834, 0x22}, ++ {0x5835, 0x22}, ++ {0x5836, 0x22}, ++ {0x5837, 0x26}, ++ {0x5838, 0x42}, ++ {0x5839, 0x26}, ++ {0x583a, 0x06}, ++ {0x583b, 0x26}, ++ {0x583c, 0x24}, ++ {0x583d, 0xce}, ++ /* manual AWB,manual AE,close Lenc,open WBC*/ ++ {0x3503, 0x03}, /*manual AE*/ ++ {0x3501, 0x10}, ++ {0x3502, 0x80}, ++ {0x350a, 0x00}, ++ {0x350b, 0x7f}, ++ {0x5001, 0x01}, /*manual AWB*/ ++ {0x5180, 0x08}, ++ {0x5186, 0x04}, ++ {0x5187, 0x00}, ++ {0x5188, 0x04}, ++ {0x5189, 0x00}, ++ {0x518a, 0x04}, ++ {0x518b, 0x00}, ++ {0x5000, 0x06}, /*No lenc,WBC on*/ ++}; +-- +1.9.1 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0032-media-i2c-Add-ov5642-sensor.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0032-media-i2c-Add-ov5642-sensor.patch new file mode 100644 index 0000000..99183fa --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0032-media-i2c-Add-ov5642-sensor.patch @@ -0,0 +1,2173 @@ +From 79ff5931fa2dede0a4c2e22e7a83c2edddcc6c20 Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov +Date: Sun, 11 Jun 2017 00:50:59 +0300 +Subject: [PATCH] media: i2c: ov5642 sensor + +Add ov5642 camera sensor driver update + +Signed-off-by: Vladimir Barinov +--- + drivers/media/i2c/soc_camera/ov5642.c | 708 +++++----------------------- + drivers/media/i2c/soc_camera/ov5642.h | 592 ++++++++++++++++++++++++ + drivers/media/i2c/soc_camera/ov5642_720p.h | 711 +++++++++++++++++++++++++++++ + 3 files changed, 1418 insertions(+), 593 deletions(-) + create mode 100644 drivers/media/i2c/soc_camera/ov5642.h + create mode 100644 drivers/media/i2c/soc_camera/ov5642_720p.h + +diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c +index bab9ac0..b58859e 100644 +--- a/drivers/media/i2c/soc_camera/ov5642.c ++++ b/drivers/media/i2c/soc_camera/ov5642.c +@@ -22,584 +22,16 @@ + #include + #include + #include ++#include ++#include ++#include + + #include + #include + #include + +-/* OV5642 registers */ +-#define REG_CHIP_ID_HIGH 0x300a +-#define REG_CHIP_ID_LOW 0x300b +- +-#define REG_WINDOW_START_X_HIGH 0x3800 +-#define REG_WINDOW_START_X_LOW 0x3801 +-#define REG_WINDOW_START_Y_HIGH 0x3802 +-#define REG_WINDOW_START_Y_LOW 0x3803 +-#define REG_WINDOW_WIDTH_HIGH 0x3804 +-#define REG_WINDOW_WIDTH_LOW 0x3805 +-#define REG_WINDOW_HEIGHT_HIGH 0x3806 +-#define REG_WINDOW_HEIGHT_LOW 0x3807 +-#define REG_OUT_WIDTH_HIGH 0x3808 +-#define REG_OUT_WIDTH_LOW 0x3809 +-#define REG_OUT_HEIGHT_HIGH 0x380a +-#define REG_OUT_HEIGHT_LOW 0x380b +-#define REG_OUT_TOTAL_WIDTH_HIGH 0x380c +-#define REG_OUT_TOTAL_WIDTH_LOW 0x380d +-#define REG_OUT_TOTAL_HEIGHT_HIGH 0x380e +-#define REG_OUT_TOTAL_HEIGHT_LOW 0x380f +-#define REG_OUTPUT_FORMAT 0x4300 +-#define REG_ISP_CTRL_01 0x5001 +-#define REG_AVG_WINDOW_END_X_HIGH 0x5682 +-#define REG_AVG_WINDOW_END_X_LOW 0x5683 +-#define REG_AVG_WINDOW_END_Y_HIGH 0x5686 +-#define REG_AVG_WINDOW_END_Y_LOW 0x5687 +- +-/* active pixel array size */ +-#define OV5642_SENSOR_SIZE_X 2592 +-#define OV5642_SENSOR_SIZE_Y 1944 +- +-/* +- * About OV5642 resolution, cropping and binning: +- * This sensor supports it all, at least in the feature description. +- * Unfortunately, no combination of appropriate registers settings could make +- * the chip work the intended way. As it works with predefined register lists, +- * some undocumented registers are presumably changed there to achieve their +- * goals. +- * This driver currently only works for resolutions up to 720 lines with a +- * 1:1 scale. Hopefully these restrictions will be removed in the future. +- */ +-#define OV5642_MAX_WIDTH OV5642_SENSOR_SIZE_X +-#define OV5642_MAX_HEIGHT 720 +- +-/* default sizes */ +-#define OV5642_DEFAULT_WIDTH 1280 +-#define OV5642_DEFAULT_HEIGHT OV5642_MAX_HEIGHT +- +-/* minimum extra blanking */ +-#define BLANKING_EXTRA_WIDTH 500 +-#define BLANKING_EXTRA_HEIGHT 20 +- +-/* +- * the sensor's autoexposure is buggy when setting total_height low. +- * It tries to expose longer than 1 frame period without taking care of it +- * and this leads to weird output. So we set 1000 lines as minimum. +- */ +-#define BLANKING_MIN_HEIGHT 1000 +- +-struct regval_list { +- u16 reg_num; +- u8 value; +-}; +- +-static struct regval_list ov5642_default_regs_init[] = { +- { 0x3103, 0x93 }, +- { 0x3008, 0x82 }, +- { 0x3017, 0x7f }, +- { 0x3018, 0xfc }, +- { 0x3810, 0xc2 }, +- { 0x3615, 0xf0 }, +- { 0x3000, 0x0 }, +- { 0x3001, 0x0 }, +- { 0x3002, 0x0 }, +- { 0x3003, 0x0 }, +- { 0x3004, 0xff }, +- { 0x3030, 0x2b }, +- { 0x3011, 0x8 }, +- { 0x3010, 0x10 }, +- { 0x3604, 0x60 }, +- { 0x3622, 0x60 }, +- { 0x3621, 0x9 }, +- { 0x3709, 0x0 }, +- { 0x4000, 0x21 }, +- { 0x401d, 0x22 }, +- { 0x3600, 0x54 }, +- { 0x3605, 0x4 }, +- { 0x3606, 0x3f }, +- { 0x3c01, 0x80 }, +- { 0x300d, 0x22 }, +- { 0x3623, 0x22 }, +- { 0x5000, 0x4f }, +- { 0x5020, 0x4 }, +- { 0x5181, 0x79 }, +- { 0x5182, 0x0 }, +- { 0x5185, 0x22 }, +- { 0x5197, 0x1 }, +- { 0x5500, 0xa }, +- { 0x5504, 0x0 }, +- { 0x5505, 0x7f }, +- { 0x5080, 0x8 }, +- { 0x300e, 0x18 }, +- { 0x4610, 0x0 }, +- { 0x471d, 0x5 }, +- { 0x4708, 0x6 }, +- { 0x370c, 0xa0 }, +- { 0x5687, 0x94 }, +- { 0x501f, 0x0 }, +- { 0x5000, 0x4f }, +- { 0x5001, 0xcf }, +- { 0x4300, 0x30 }, +- { 0x4300, 0x30 }, +- { 0x460b, 0x35 }, +- { 0x471d, 0x0 }, +- { 0x3002, 0xc }, +- { 0x3002, 0x0 }, +- { 0x4713, 0x3 }, +- { 0x471c, 0x50 }, +- { 0x4721, 0x2 }, +- { 0x4402, 0x90 }, +- { 0x460c, 0x22 }, +- { 0x3815, 0x44 }, +- { 0x3503, 0x7 }, +- { 0x3501, 0x73 }, +- { 0x3502, 0x80 }, +- { 0x350b, 0x0 }, +- { 0x3818, 0xc8 }, +- { 0x3824, 0x11 }, +- { 0x3a00, 0x78 }, +- { 0x3a1a, 0x4 }, +- { 0x3a13, 0x30 }, +- { 0x3a18, 0x0 }, +- { 0x3a19, 0x7c }, +- { 0x3a08, 0x12 }, +- { 0x3a09, 0xc0 }, +- { 0x3a0a, 0xf }, +- { 0x3a0b, 0xa0 }, +- { 0x350c, 0x7 }, +- { 0x350d, 0xd0 }, +- { 0x3a0d, 0x8 }, +- { 0x3a0e, 0x6 }, +- { 0x3500, 0x0 }, +- { 0x3501, 0x0 }, +- { 0x3502, 0x0 }, +- { 0x350a, 0x0 }, +- { 0x350b, 0x0 }, +- { 0x3503, 0x0 }, +- { 0x3a0f, 0x3c }, +- { 0x3a10, 0x32 }, +- { 0x3a1b, 0x3c }, +- { 0x3a1e, 0x32 }, +- { 0x3a11, 0x80 }, +- { 0x3a1f, 0x20 }, +- { 0x3030, 0x2b }, +- { 0x3a02, 0x0 }, +- { 0x3a03, 0x7d }, +- { 0x3a04, 0x0 }, +- { 0x3a14, 0x0 }, +- { 0x3a15, 0x7d }, +- { 0x3a16, 0x0 }, +- { 0x3a00, 0x78 }, +- { 0x3a08, 0x9 }, +- { 0x3a09, 0x60 }, +- { 0x3a0a, 0x7 }, +- { 0x3a0b, 0xd0 }, +- { 0x3a0d, 0x10 }, +- { 0x3a0e, 0xd }, +- { 0x4407, 0x4 }, +- { 0x5193, 0x70 }, +- { 0x589b, 0x0 }, +- { 0x589a, 0xc0 }, +- { 0x401e, 0x20 }, +- { 0x4001, 0x42 }, +- { 0x401c, 0x6 }, +- { 0x3825, 0xac }, +- { 0x3827, 0xc }, +- { 0x528a, 0x1 }, +- { 0x528b, 0x4 }, +- { 0x528c, 0x8 }, +- { 0x528d, 0x10 }, +- { 0x528e, 0x20 }, +- { 0x528f, 0x28 }, +- { 0x5290, 0x30 }, +- { 0x5292, 0x0 }, +- { 0x5293, 0x1 }, +- { 0x5294, 0x0 }, +- { 0x5295, 0x4 }, +- { 0x5296, 0x0 }, +- { 0x5297, 0x8 }, +- { 0x5298, 0x0 }, +- { 0x5299, 0x10 }, +- { 0x529a, 0x0 }, +- { 0x529b, 0x20 }, +- { 0x529c, 0x0 }, +- { 0x529d, 0x28 }, +- { 0x529e, 0x0 }, +- { 0x529f, 0x30 }, +- { 0x5282, 0x0 }, +- { 0x5300, 0x0 }, +- { 0x5301, 0x20 }, +- { 0x5302, 0x0 }, +- { 0x5303, 0x7c }, +- { 0x530c, 0x0 }, +- { 0x530d, 0xc }, +- { 0x530e, 0x20 }, +- { 0x530f, 0x80 }, +- { 0x5310, 0x20 }, +- { 0x5311, 0x80 }, +- { 0x5308, 0x20 }, +- { 0x5309, 0x40 }, +- { 0x5304, 0x0 }, +- { 0x5305, 0x30 }, +- { 0x5306, 0x0 }, +- { 0x5307, 0x80 }, +- { 0x5314, 0x8 }, +- { 0x5315, 0x20 }, +- { 0x5319, 0x30 }, +- { 0x5316, 0x10 }, +- { 0x5317, 0x0 }, +- { 0x5318, 0x2 }, +- { 0x5380, 0x1 }, +- { 0x5381, 0x0 }, +- { 0x5382, 0x0 }, +- { 0x5383, 0x4e }, +- { 0x5384, 0x0 }, +- { 0x5385, 0xf }, +- { 0x5386, 0x0 }, +- { 0x5387, 0x0 }, +- { 0x5388, 0x1 }, +- { 0x5389, 0x15 }, +- { 0x538a, 0x0 }, +- { 0x538b, 0x31 }, +- { 0x538c, 0x0 }, +- { 0x538d, 0x0 }, +- { 0x538e, 0x0 }, +- { 0x538f, 0xf }, +- { 0x5390, 0x0 }, +- { 0x5391, 0xab }, +- { 0x5392, 0x0 }, +- { 0x5393, 0xa2 }, +- { 0x5394, 0x8 }, +- { 0x5480, 0x14 }, +- { 0x5481, 0x21 }, +- { 0x5482, 0x36 }, +- { 0x5483, 0x57 }, +- { 0x5484, 0x65 }, +- { 0x5485, 0x71 }, +- { 0x5486, 0x7d }, +- { 0x5487, 0x87 }, +- { 0x5488, 0x91 }, +- { 0x5489, 0x9a }, +- { 0x548a, 0xaa }, +- { 0x548b, 0xb8 }, +- { 0x548c, 0xcd }, +- { 0x548d, 0xdd }, +- { 0x548e, 0xea }, +- { 0x548f, 0x1d }, +- { 0x5490, 0x5 }, +- { 0x5491, 0x0 }, +- { 0x5492, 0x4 }, +- { 0x5493, 0x20 }, +- { 0x5494, 0x3 }, +- { 0x5495, 0x60 }, +- { 0x5496, 0x2 }, +- { 0x5497, 0xb8 }, +- { 0x5498, 0x2 }, +- { 0x5499, 0x86 }, +- { 0x549a, 0x2 }, +- { 0x549b, 0x5b }, +- { 0x549c, 0x2 }, +- { 0x549d, 0x3b }, +- { 0x549e, 0x2 }, +- { 0x549f, 0x1c }, +- { 0x54a0, 0x2 }, +- { 0x54a1, 0x4 }, +- { 0x54a2, 0x1 }, +- { 0x54a3, 0xed }, +- { 0x54a4, 0x1 }, +- { 0x54a5, 0xc5 }, +- { 0x54a6, 0x1 }, +- { 0x54a7, 0xa5 }, +- { 0x54a8, 0x1 }, +- { 0x54a9, 0x6c }, +- { 0x54aa, 0x1 }, +- { 0x54ab, 0x41 }, +- { 0x54ac, 0x1 }, +- { 0x54ad, 0x20 }, +- { 0x54ae, 0x0 }, +- { 0x54af, 0x16 }, +- { 0x54b0, 0x1 }, +- { 0x54b1, 0x20 }, +- { 0x54b2, 0x0 }, +- { 0x54b3, 0x10 }, +- { 0x54b4, 0x0 }, +- { 0x54b5, 0xf0 }, +- { 0x54b6, 0x0 }, +- { 0x54b7, 0xdf }, +- { 0x5402, 0x3f }, +- { 0x5403, 0x0 }, +- { 0x3406, 0x0 }, +- { 0x5180, 0xff }, +- { 0x5181, 0x52 }, +- { 0x5182, 0x11 }, +- { 0x5183, 0x14 }, +- { 0x5184, 0x25 }, +- { 0x5185, 0x24 }, +- { 0x5186, 0x6 }, +- { 0x5187, 0x8 }, +- { 0x5188, 0x8 }, +- { 0x5189, 0x7c }, +- { 0x518a, 0x60 }, +- { 0x518b, 0xb2 }, +- { 0x518c, 0xb2 }, +- { 0x518d, 0x44 }, +- { 0x518e, 0x3d }, +- { 0x518f, 0x58 }, +- { 0x5190, 0x46 }, +- { 0x5191, 0xf8 }, +- { 0x5192, 0x4 }, +- { 0x5193, 0x70 }, +- { 0x5194, 0xf0 }, +- { 0x5195, 0xf0 }, +- { 0x5196, 0x3 }, +- { 0x5197, 0x1 }, +- { 0x5198, 0x4 }, +- { 0x5199, 0x12 }, +- { 0x519a, 0x4 }, +- { 0x519b, 0x0 }, +- { 0x519c, 0x6 }, +- { 0x519d, 0x82 }, +- { 0x519e, 0x0 }, +- { 0x5025, 0x80 }, +- { 0x3a0f, 0x38 }, +- { 0x3a10, 0x30 }, +- { 0x3a1b, 0x3a }, +- { 0x3a1e, 0x2e }, +- { 0x3a11, 0x60 }, +- { 0x3a1f, 0x10 }, +- { 0x5688, 0xa6 }, +- { 0x5689, 0x6a }, +- { 0x568a, 0xea }, +- { 0x568b, 0xae }, +- { 0x568c, 0xa6 }, +- { 0x568d, 0x6a }, +- { 0x568e, 0x62 }, +- { 0x568f, 0x26 }, +- { 0x5583, 0x40 }, +- { 0x5584, 0x40 }, +- { 0x5580, 0x2 }, +- { 0x5000, 0xcf }, +- { 0x5800, 0x27 }, +- { 0x5801, 0x19 }, +- { 0x5802, 0x12 }, +- { 0x5803, 0xf }, +- { 0x5804, 0x10 }, +- { 0x5805, 0x15 }, +- { 0x5806, 0x1e }, +- { 0x5807, 0x2f }, +- { 0x5808, 0x15 }, +- { 0x5809, 0xd }, +- { 0x580a, 0xa }, +- { 0x580b, 0x9 }, +- { 0x580c, 0xa }, +- { 0x580d, 0xc }, +- { 0x580e, 0x12 }, +- { 0x580f, 0x19 }, +- { 0x5810, 0xb }, +- { 0x5811, 0x7 }, +- { 0x5812, 0x4 }, +- { 0x5813, 0x3 }, +- { 0x5814, 0x3 }, +- { 0x5815, 0x6 }, +- { 0x5816, 0xa }, +- { 0x5817, 0xf }, +- { 0x5818, 0xa }, +- { 0x5819, 0x5 }, +- { 0x581a, 0x1 }, +- { 0x581b, 0x0 }, +- { 0x581c, 0x0 }, +- { 0x581d, 0x3 }, +- { 0x581e, 0x8 }, +- { 0x581f, 0xc }, +- { 0x5820, 0xa }, +- { 0x5821, 0x5 }, +- { 0x5822, 0x1 }, +- { 0x5823, 0x0 }, +- { 0x5824, 0x0 }, +- { 0x5825, 0x3 }, +- { 0x5826, 0x8 }, +- { 0x5827, 0xc }, +- { 0x5828, 0xe }, +- { 0x5829, 0x8 }, +- { 0x582a, 0x6 }, +- { 0x582b, 0x4 }, +- { 0x582c, 0x5 }, +- { 0x582d, 0x7 }, +- { 0x582e, 0xb }, +- { 0x582f, 0x12 }, +- { 0x5830, 0x18 }, +- { 0x5831, 0x10 }, +- { 0x5832, 0xc }, +- { 0x5833, 0xa }, +- { 0x5834, 0xb }, +- { 0x5835, 0xe }, +- { 0x5836, 0x15 }, +- { 0x5837, 0x19 }, +- { 0x5838, 0x32 }, +- { 0x5839, 0x1f }, +- { 0x583a, 0x18 }, +- { 0x583b, 0x16 }, +- { 0x583c, 0x17 }, +- { 0x583d, 0x1e }, +- { 0x583e, 0x26 }, +- { 0x583f, 0x53 }, +- { 0x5840, 0x10 }, +- { 0x5841, 0xf }, +- { 0x5842, 0xd }, +- { 0x5843, 0xc }, +- { 0x5844, 0xe }, +- { 0x5845, 0x9 }, +- { 0x5846, 0x11 }, +- { 0x5847, 0x10 }, +- { 0x5848, 0x10 }, +- { 0x5849, 0x10 }, +- { 0x584a, 0x10 }, +- { 0x584b, 0xe }, +- { 0x584c, 0x10 }, +- { 0x584d, 0x10 }, +- { 0x584e, 0x11 }, +- { 0x584f, 0x10 }, +- { 0x5850, 0xf }, +- { 0x5851, 0xc }, +- { 0x5852, 0xf }, +- { 0x5853, 0x10 }, +- { 0x5854, 0x10 }, +- { 0x5855, 0xf }, +- { 0x5856, 0xe }, +- { 0x5857, 0xb }, +- { 0x5858, 0x10 }, +- { 0x5859, 0xd }, +- { 0x585a, 0xd }, +- { 0x585b, 0xc }, +- { 0x585c, 0xc }, +- { 0x585d, 0xc }, +- { 0x585e, 0xb }, +- { 0x585f, 0xc }, +- { 0x5860, 0xc }, +- { 0x5861, 0xc }, +- { 0x5862, 0xd }, +- { 0x5863, 0x8 }, +- { 0x5864, 0x11 }, +- { 0x5865, 0x18 }, +- { 0x5866, 0x18 }, +- { 0x5867, 0x19 }, +- { 0x5868, 0x17 }, +- { 0x5869, 0x19 }, +- { 0x586a, 0x16 }, +- { 0x586b, 0x13 }, +- { 0x586c, 0x13 }, +- { 0x586d, 0x12 }, +- { 0x586e, 0x13 }, +- { 0x586f, 0x16 }, +- { 0x5870, 0x14 }, +- { 0x5871, 0x12 }, +- { 0x5872, 0x10 }, +- { 0x5873, 0x11 }, +- { 0x5874, 0x11 }, +- { 0x5875, 0x16 }, +- { 0x5876, 0x14 }, +- { 0x5877, 0x11 }, +- { 0x5878, 0x10 }, +- { 0x5879, 0xf }, +- { 0x587a, 0x10 }, +- { 0x587b, 0x14 }, +- { 0x587c, 0x13 }, +- { 0x587d, 0x12 }, +- { 0x587e, 0x11 }, +- { 0x587f, 0x11 }, +- { 0x5880, 0x12 }, +- { 0x5881, 0x15 }, +- { 0x5882, 0x14 }, +- { 0x5883, 0x15 }, +- { 0x5884, 0x15 }, +- { 0x5885, 0x15 }, +- { 0x5886, 0x13 }, +- { 0x5887, 0x17 }, +- { 0x3710, 0x10 }, +- { 0x3632, 0x51 }, +- { 0x3702, 0x10 }, +- { 0x3703, 0xb2 }, +- { 0x3704, 0x18 }, +- { 0x370b, 0x40 }, +- { 0x370d, 0x3 }, +- { 0x3631, 0x1 }, +- { 0x3632, 0x52 }, +- { 0x3606, 0x24 }, +- { 0x3620, 0x96 }, +- { 0x5785, 0x7 }, +- { 0x3a13, 0x30 }, +- { 0x3600, 0x52 }, +- { 0x3604, 0x48 }, +- { 0x3606, 0x1b }, +- { 0x370d, 0xb }, +- { 0x370f, 0xc0 }, +- { 0x3709, 0x1 }, +- { 0x3823, 0x0 }, +- { 0x5007, 0x0 }, +- { 0x5009, 0x0 }, +- { 0x5011, 0x0 }, +- { 0x5013, 0x0 }, +- { 0x519e, 0x0 }, +- { 0x5086, 0x0 }, +- { 0x5087, 0x0 }, +- { 0x5088, 0x0 }, +- { 0x5089, 0x0 }, +- { 0x302b, 0x0 }, +- { 0x3503, 0x7 }, +- { 0x3011, 0x8 }, +- { 0x350c, 0x2 }, +- { 0x350d, 0xe4 }, +- { 0x3621, 0xc9 }, +- { 0x370a, 0x81 }, +- { 0xffff, 0xff }, +-}; +- +-static struct regval_list ov5642_default_regs_finalise[] = { +- { 0x3810, 0xc2 }, +- { 0x3818, 0xc9 }, +- { 0x381c, 0x10 }, +- { 0x381d, 0xa0 }, +- { 0x381e, 0x5 }, +- { 0x381f, 0xb0 }, +- { 0x3820, 0x0 }, +- { 0x3821, 0x0 }, +- { 0x3824, 0x11 }, +- { 0x3a08, 0x1b }, +- { 0x3a09, 0xc0 }, +- { 0x3a0a, 0x17 }, +- { 0x3a0b, 0x20 }, +- { 0x3a0d, 0x2 }, +- { 0x3a0e, 0x1 }, +- { 0x401c, 0x4 }, +- { 0x5682, 0x5 }, +- { 0x5683, 0x0 }, +- { 0x5686, 0x2 }, +- { 0x5687, 0xcc }, +- { 0x5001, 0x4f }, +- { 0x589b, 0x6 }, +- { 0x589a, 0xc5 }, +- { 0x3503, 0x0 }, +- { 0x460c, 0x20 }, +- { 0x460b, 0x37 }, +- { 0x471c, 0xd0 }, +- { 0x471d, 0x5 }, +- { 0x3815, 0x1 }, +- { 0x3818, 0xc1 }, +- { 0x501f, 0x0 }, +- { 0x5002, 0xe0 }, +- { 0x4300, 0x32 }, /* UYVY */ +- { 0x3002, 0x1c }, +- { 0x4800, 0x14 }, +- { 0x4801, 0xf }, +- { 0x3007, 0x3b }, +- { 0x300e, 0x4 }, +- { 0x4803, 0x50 }, +- { 0x3815, 0x1 }, +- { 0x4713, 0x2 }, +- { 0x4842, 0x1 }, +- { 0x300f, 0xe }, +- { 0x3003, 0x3 }, +- { 0x3003, 0x1 }, +- { 0xffff, 0xff }, +-}; ++#define USE_PREDEF ++#include "ov5642.h" + + struct ov5642_datafmt { + u32 code; +@@ -608,6 +40,7 @@ struct ov5642_datafmt { + + struct ov5642 { + struct v4l2_subdev subdev; ++ struct media_pad pad; + const struct ov5642_datafmt *fmt; + struct v4l2_rect crop_rect; + struct v4l2_clk *clk; +@@ -615,10 +48,14 @@ struct ov5642 { + /* blanking information */ + int total_width; + int total_height; ++ ++ struct soc_camera_subdev_desc ssdd_dt; ++ struct gpio_desc *resetb_gpio; ++ struct gpio_desc *pwdn_gpio; + }; + + static const struct ov5642_datafmt ov5642_colour_fmts[] = { +- {MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}, ++ {MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}, + }; + + static struct ov5642 *to_ov5642(const struct i2c_client *client) +@@ -676,10 +113,7 @@ static int reg_write(struct i2c_client *client, u16 reg, u8 val) + return 0; + } + +-/* +- * convenience function to write 16 bit register values that are split up +- * into two consecutive high and low parts +- */ ++#if 0 + static int reg_write16(struct i2c_client *client, u16 reg, u16 val16) + { + int ret; +@@ -689,6 +123,7 @@ static int reg_write16(struct i2c_client *client, u16 reg, u16 val16) + return ret; + return reg_write(client, reg + 1, val16 & 0x00ff); + } ++#endif + + #ifdef CONFIG_VIDEO_ADV_DEBUG + static int ov5642_get_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) +@@ -733,6 +168,7 @@ static int ov5642_write_array(struct i2c_client *client, + return 0; + } + ++#ifndef USE_PREDEF + static int ov5642_set_resolution(struct v4l2_subdev *sd) + { + struct i2c_client *client = v4l2_get_subdevdata(sd); +@@ -785,6 +221,7 @@ static int ov5642_set_resolution(struct v4l2_subdev *sd) + + return ret; + } ++#endif + + static int ov5642_set_fmt(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, +@@ -866,15 +303,15 @@ static int ov5642_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) + priv->total_height = max_t(int, rect.height + + BLANKING_EXTRA_HEIGHT, + BLANKING_MIN_HEIGHT); +- priv->crop_rect.width = rect.width; +- priv->crop_rect.height = rect.height; +- ++#ifdef USE_PREDEF ++ ret = ov5642_write_array(client, OV5642_720P_30FPS); ++#else + ret = ov5642_write_array(client, ov5642_default_regs_init); + if (!ret) + ret = ov5642_set_resolution(sd); + if (!ret) + ret = ov5642_write_array(client, ov5642_default_regs_finalise); +- ++#endif + return ret; + } + +@@ -909,10 +346,10 @@ static int ov5642_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) + static int ov5642_g_mbus_config(struct v4l2_subdev *sd, + struct v4l2_mbus_config *cfg) + { +- cfg->type = V4L2_MBUS_CSI2; +- cfg->flags = V4L2_MBUS_CSI2_2_LANE | V4L2_MBUS_CSI2_CHANNEL_0 | +- V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; +- ++ cfg->type = V4L2_MBUS_PARALLEL; ++ cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | ++ V4L2_MBUS_HSYNC_ACTIVE_LOW | V4L2_MBUS_VSYNC_ACTIVE_HIGH | ++ V4L2_MBUS_DATA_ACTIVE_HIGH; + return 0; + } + +@@ -930,12 +367,15 @@ static int ov5642_s_power(struct v4l2_subdev *sd, int on) + if (ret < 0) + return ret; + ++#ifdef USE_PREDEF ++ ret = ov5642_write_array(client, OV5642_720P_30FPS); ++#else + ret = ov5642_write_array(client, ov5642_default_regs_init); + if (!ret) + ret = ov5642_set_resolution(sd); + if (!ret) + ret = ov5642_write_array(client, ov5642_default_regs_finalise); +- ++#endif + return ret; + } + +@@ -966,6 +406,63 @@ static struct v4l2_subdev_ops ov5642_subdev_ops = { + .pad = &ov5642_subdev_pad_ops, + }; + ++/* OF probe functions */ ++static int ov5642_hw_power(struct device *dev, int on) ++{ ++ struct i2c_client *client = to_i2c_client(dev); ++ struct ov5642 *priv = to_ov5642(client); ++ ++ dev_dbg(&client->dev, "%s: %s the camera\n", ++ __func__, on ? "ENABLE" : "DISABLE"); ++ ++ if (priv->pwdn_gpio) ++ gpiod_direction_output(priv->pwdn_gpio, !on); ++ ++ return 0; ++} ++ ++static int ov5642_hw_reset(struct device *dev) ++{ ++ struct i2c_client *client = to_i2c_client(dev); ++ struct ov5642 *priv = to_ov5642(client); ++ ++ if (priv->resetb_gpio) { ++ /* Active the resetb pin to perform a reset pulse */ ++ gpiod_direction_output(priv->resetb_gpio, 1); ++ usleep_range(3000, 5000); ++ gpiod_direction_output(priv->resetb_gpio, 0); ++ } ++ ++ return 0; ++} ++ ++static int ov5642_probe_dt(struct i2c_client *client, ++ struct ov5642 *priv) ++{ ++ /* Request the reset GPIO deasserted */ ++ priv->resetb_gpio = devm_gpiod_get_optional(&client->dev, "resetb", ++ GPIOD_OUT_LOW); ++ if (!priv->resetb_gpio) ++ dev_dbg(&client->dev, "resetb gpio is not assigned!\n"); ++ else if (IS_ERR(priv->resetb_gpio)) ++ return PTR_ERR(priv->resetb_gpio); ++ ++ /* Request the power down GPIO asserted */ ++ priv->pwdn_gpio = devm_gpiod_get_optional(&client->dev, "pwdn", ++ GPIOD_OUT_HIGH); ++ if (!priv->pwdn_gpio) ++ dev_dbg(&client->dev, "pwdn gpio is not assigned!\n"); ++ else if (IS_ERR(priv->pwdn_gpio)) ++ return PTR_ERR(priv->pwdn_gpio); ++ ++ /* Initialize the soc_camera_subdev_desc */ ++ priv->ssdd_dt.power = ov5642_hw_power; ++ priv->ssdd_dt.reset = ov5642_hw_reset; ++ client->dev.platform_data = &priv->ssdd_dt; ++ ++ return 0; ++} ++ + static int ov5642_video_probe(struct i2c_client *client) + { + struct v4l2_subdev *subdev = i2c_get_clientdata(client); +@@ -1008,19 +505,23 @@ static int ov5642_probe(struct i2c_client *client, + const struct i2c_device_id *did) + { + struct ov5642 *priv; ++ struct v4l2_subdev *sd; + struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); + int ret; + +- if (!ssdd) { +- dev_err(&client->dev, "OV5642: missing platform data!\n"); +- return -EINVAL; +- } +- + priv = devm_kzalloc(&client->dev, sizeof(struct ov5642), GFP_KERNEL); + if (!priv) + return -ENOMEM; + ++ if (!ssdd) { ++ ret = ov5642_probe_dt(client, priv); ++ if (ret) ++ return ret; ++ } ++ ++ sd = &priv->subdev; + v4l2_i2c_subdev_init(&priv->subdev, client, &ov5642_subdev_ops); ++ priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; + + priv->fmt = &ov5642_colour_fmts[0]; + +@@ -1036,8 +537,20 @@ static int ov5642_probe(struct i2c_client *client, + return PTR_ERR(priv->clk); + + ret = ov5642_video_probe(client); +- if (ret < 0) ++ if (ret < 0) { + v4l2_clk_put(priv->clk); ++ return ret; ++ } ++ ++ priv->pad.flags = MEDIA_PAD_FL_SOURCE; ++ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; ++ ret = media_entity_pads_init(&sd->entity, 1, &priv->pad); ++ if (ret < 0) ++ return ret; ++ ++ ret = v4l2_async_register_subdev(sd); ++ if (ret < 0) ++ media_entity_cleanup(&sd->entity); + + return ret; + } +@@ -1060,8 +573,17 @@ static const struct i2c_device_id ov5642_id[] = { + }; + MODULE_DEVICE_TABLE(i2c, ov5642_id); + ++#if IS_ENABLED(CONFIG_OF) ++static const struct of_device_id ov5642_of_match[] = { ++ { .compatible = "ovti,ov5642" }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, ov5642_of_match); ++#endif ++ + static struct i2c_driver ov5642_i2c_driver = { + .driver = { ++ .of_match_table = of_match_ptr(ov5642_of_match), + .name = "ov5642", + }, + .probe = ov5642_probe, +diff --git a/drivers/media/i2c/soc_camera/ov5642.h b/drivers/media/i2c/soc_camera/ov5642.h +new file mode 100644 +index 0000000..ac47a16 +--- /dev/null ++++ b/drivers/media/i2c/soc_camera/ov5642.h +@@ -0,0 +1,592 @@ ++#ifndef _OV5642_H_ ++#define _OV5642_H_ ++ ++ ++/* OV5642 registers */ ++#define REG_CHIP_ID_HIGH 0x300a ++#define REG_CHIP_ID_LOW 0x300b ++ ++#define REG_WINDOW_START_X_HIGH 0x3800 ++#define REG_WINDOW_START_X_LOW 0x3801 ++#define REG_WINDOW_START_Y_HIGH 0x3802 ++#define REG_WINDOW_START_Y_LOW 0x3803 ++#define REG_WINDOW_WIDTH_HIGH 0x3804 ++#define REG_WINDOW_WIDTH_LOW 0x3805 ++#define REG_WINDOW_HEIGHT_HIGH 0x3806 ++#define REG_WINDOW_HEIGHT_LOW 0x3807 ++#define REG_OUT_WIDTH_HIGH 0x3808 ++#define REG_OUT_WIDTH_LOW 0x3809 ++#define REG_OUT_HEIGHT_HIGH 0x380a ++#define REG_OUT_HEIGHT_LOW 0x380b ++#define REG_OUT_TOTAL_WIDTH_HIGH 0x380c ++#define REG_OUT_TOTAL_WIDTH_LOW 0x380d ++#define REG_OUT_TOTAL_HEIGHT_HIGH 0x380e ++#define REG_OUT_TOTAL_HEIGHT_LOW 0x380f ++#define REG_OUTPUT_FORMAT 0x4300 ++#define REG_ISP_CTRL_00 0x5000 ++#define REG_ISP_CTRL_01 0x5001 ++#define REG_AVG_WINDOW_START_X_HIGH 0x5680 ++#define REG_AVG_WINDOW_START_X_LOW 0x5681 ++#define REG_AVG_WINDOW_END_X_HIGH 0x5682 ++#define REG_AVG_WINDOW_END_X_LOW 0x5683 ++#define REG_AVG_WINDOW_START_Y_HIGH 0x5684 ++#define REG_AVG_WINDOW_START_Y_LOW 0x5685 ++#define REG_AVG_WINDOW_END_Y_HIGH 0x5686 ++#define REG_AVG_WINDOW_END_Y_LOW 0x5687 ++ ++/* active pixel array size */ ++#define OV5642_SENSOR_SIZE_X 2592 ++#define OV5642_SENSOR_SIZE_Y 1944 ++ ++/* ++ * About OV5642 resolution, cropping and binning: ++ * This sensor supports it all, at least in the feature description. ++ * Unfortunately, no combination of appropriate registers settings could make ++ * the chip work the intended way. As it works with predefined register lists, ++ * some undocumented registers are presumably changed there to achieve their ++ * goals. ++ * This driver currently only works for resolutions up to 720 lines with a ++ * 1:1 scale. Hopefully these restrictions will be removed in the future. ++ */ ++#define OV5642_MAX_WIDTH OV5642_SENSOR_SIZE_X ++#define OV5642_MAX_HEIGHT 720 ++ ++/* default sizes */ ++#define OV5642_DEFAULT_WIDTH 1280 ++#define OV5642_DEFAULT_HEIGHT OV5642_MAX_HEIGHT ++ ++/* minimum extra blanking */ ++#define BLANKING_EXTRA_WIDTH 500 ++#define BLANKING_EXTRA_HEIGHT 20 ++ ++/* ++ * the sensor's autoexposure is buggy when setting total_height low. ++ * It tries to expose longer than 1 frame period without taking care of it ++ * and this leads to weird output. So we set 1000 lines as minimum. ++ */ ++#define BLANKING_MIN_HEIGHT 1000 ++ ++struct regval_list { ++ u16 reg_num; ++ u8 value; ++}; ++ ++#ifdef USE_PREDEF ++ #include "ov5642_720p.h" ++#endif ++ ++#ifndef USE_PREDEF ++ ++static struct regval_list ov5642_default_regs_init[] = { ++ { 0x3103, 0x93 }, ++ { 0x3008, 0x82 }, ++ { 0x3017, 0x7f }, ++ { 0x3018, 0xfc }, ++ { 0x3810, 0xc2 }, ++ { 0x3615, 0xf0 }, ++ { 0x3000, 0x0 }, ++ { 0x3001, 0x0 }, ++ { 0x3002, 0x0 }, ++ { 0x3003, 0x0 }, ++ { 0x3004, 0xff }, ++ { 0x3030, 0x2b }, ++ { 0x3011, 0x8 }, ++ { 0x3010, 0x10 }, ++ { 0x3604, 0x60 }, ++ { 0x3622, 0x60 }, ++ { 0x3621, 0x9 }, ++ { 0x3709, 0x0 }, ++ { 0x4000, 0x21 }, ++ { 0x401d, 0x22 }, ++ { 0x3600, 0x54 }, ++ { 0x3605, 0x4 }, ++ { 0x3606, 0x3f }, ++ { 0x3c01, 0x80 }, ++ { 0x300d, 0x22 }, ++ { 0x3623, 0x22 }, ++ { 0x5000, 0x4f }, ++ { 0x5020, 0x4 }, ++ { 0x5181, 0x79 }, ++ { 0x5182, 0x0 }, ++ { 0x5185, 0x22 }, ++ { 0x5197, 0x1 }, ++ { 0x5500, 0xa }, ++ { 0x5504, 0x0 }, ++ { 0x5505, 0x7f }, ++ { 0x5080, 0x8 }, ++ { 0x300e, 0x18 }, ++ { 0x4610, 0x0 }, ++ { 0x471d, 0x5 }, ++ { 0x4708, 0x6 }, ++ { 0x370c, 0xa0 }, ++ { 0x5687, 0x94 }, ++ { 0x501f, 0x0 }, ++ { 0x5000, 0x4f }, ++ { 0x5001, 0xcf }, ++ { 0x4300, 0x30 }, ++ { 0x4300, 0x30 }, ++ { 0x460b, 0x35 }, ++ { 0x471d, 0x0 }, ++ { 0x3002, 0xc }, ++ { 0x3002, 0x0 }, ++ { 0x4713, 0x3 }, ++ { 0x471c, 0x50 }, ++ { 0x4721, 0x2 }, ++ { 0x4402, 0x90 }, ++ { 0x460c, 0x22 }, ++ { 0x3815, 0x44 }, ++ { 0x3503, 0x7 }, ++ { 0x3501, 0x73 }, ++ { 0x3502, 0x80 }, ++ { 0x350b, 0x0 }, ++ { 0x3818, 0xc8 }, ++ { 0x3824, 0x11 }, ++ { 0x3a00, 0x78 }, ++ { 0x3a1a, 0x4 }, ++ { 0x3a13, 0x30 }, ++ { 0x3a18, 0x0 }, ++ { 0x3a19, 0x7c }, ++ { 0x3a08, 0x12 }, ++ { 0x3a09, 0xc0 }, ++ { 0x3a0a, 0xf }, ++ { 0x3a0b, 0xa0 }, ++ { 0x350c, 0x7 }, ++ { 0x350d, 0xd0 }, ++ { 0x3a0d, 0x8 }, ++ { 0x3a0e, 0x6 }, ++ { 0x3500, 0x0 }, ++ { 0x3501, 0x0 }, ++ { 0x3502, 0x0 }, ++ { 0x350a, 0x0 }, ++ { 0x350b, 0x0 }, ++ { 0x3503, 0x0 }, ++ { 0x3a0f, 0x3c }, ++ { 0x3a10, 0x32 }, ++ { 0x3a1b, 0x3c }, ++ { 0x3a1e, 0x32 }, ++ { 0x3a11, 0x80 }, ++ { 0x3a1f, 0x20 }, ++ { 0x3030, 0x2b }, ++ { 0x3a02, 0x0 }, ++ { 0x3a03, 0x7d }, ++ { 0x3a04, 0x0 }, ++ { 0x3a14, 0x0 }, ++ { 0x3a15, 0x7d }, ++ { 0x3a16, 0x0 }, ++ { 0x3a00, 0x78 }, ++ { 0x3a08, 0x9 }, ++ { 0x3a09, 0x60 }, ++ { 0x3a0a, 0x7 }, ++ { 0x3a0b, 0xd0 }, ++ { 0x3a0d, 0x10 }, ++ { 0x3a0e, 0xd }, ++ { 0x4407, 0x4 }, ++ { 0x5193, 0x70 }, ++ { 0x589b, 0x0 }, ++ { 0x589a, 0xc0 }, ++ { 0x401e, 0x20 }, ++ { 0x4001, 0x42 }, ++ { 0x401c, 0x6 }, ++ { 0x3825, 0xac }, ++ { 0x3827, 0xc }, ++ { 0x528a, 0x1 }, ++ { 0x528b, 0x4 }, ++ { 0x528c, 0x8 }, ++ { 0x528d, 0x10 }, ++ { 0x528e, 0x20 }, ++ { 0x528f, 0x28 }, ++ { 0x5290, 0x30 }, ++ { 0x5292, 0x0 }, ++ { 0x5293, 0x1 }, ++ { 0x5294, 0x0 }, ++ { 0x5295, 0x4 }, ++ { 0x5296, 0x0 }, ++ { 0x5297, 0x8 }, ++ { 0x5298, 0x0 }, ++ { 0x5299, 0x10 }, ++ { 0x529a, 0x0 }, ++ { 0x529b, 0x20 }, ++ { 0x529c, 0x0 }, ++ { 0x529d, 0x28 }, ++ { 0x529e, 0x0 }, ++ { 0x529f, 0x30 }, ++ { 0x5282, 0x0 }, ++ { 0x5300, 0x0 }, ++ { 0x5301, 0x20 }, ++ { 0x5302, 0x0 }, ++ { 0x5303, 0x7c }, ++ { 0x530c, 0x0 }, ++ { 0x530d, 0xc }, ++ { 0x530e, 0x20 }, ++ { 0x530f, 0x80 }, ++ { 0x5310, 0x20 }, ++ { 0x5311, 0x80 }, ++ { 0x5308, 0x20 }, ++ { 0x5309, 0x40 }, ++ { 0x5304, 0x0 }, ++ { 0x5305, 0x30 }, ++ { 0x5306, 0x0 }, ++ { 0x5307, 0x80 }, ++ { 0x5314, 0x8 }, ++ { 0x5315, 0x20 }, ++ { 0x5319, 0x30 }, ++ { 0x5316, 0x10 }, ++ { 0x5317, 0x0 }, ++ { 0x5318, 0x2 }, ++ { 0x5380, 0x1 }, ++ { 0x5381, 0x0 }, ++ { 0x5382, 0x0 }, ++ { 0x5383, 0x4e }, ++ { 0x5384, 0x0 }, ++ { 0x5385, 0xf }, ++ { 0x5386, 0x0 }, ++ { 0x5387, 0x0 }, ++ { 0x5388, 0x1 }, ++ { 0x5389, 0x15 }, ++ { 0x538a, 0x0 }, ++ { 0x538b, 0x31 }, ++ { 0x538c, 0x0 }, ++ { 0x538d, 0x0 }, ++ { 0x538e, 0x0 }, ++ { 0x538f, 0xf }, ++ { 0x5390, 0x0 }, ++ { 0x5391, 0xab }, ++ { 0x5392, 0x0 }, ++ { 0x5393, 0xa2 }, ++ { 0x5394, 0x8 }, ++ { 0x5480, 0x14 }, ++ { 0x5481, 0x21 }, ++ { 0x5482, 0x36 }, ++ { 0x5483, 0x57 }, ++ { 0x5484, 0x65 }, ++ { 0x5485, 0x71 }, ++ { 0x5486, 0x7d }, ++ { 0x5487, 0x87 }, ++ { 0x5488, 0x91 }, ++ { 0x5489, 0x9a }, ++ { 0x548a, 0xaa }, ++ { 0x548b, 0xb8 }, ++ { 0x548c, 0xcd }, ++ { 0x548d, 0xdd }, ++ { 0x548e, 0xea }, ++ { 0x548f, 0x1d }, ++ { 0x5490, 0x5 }, ++ { 0x5491, 0x0 }, ++ { 0x5492, 0x4 }, ++ { 0x5493, 0x20 }, ++ { 0x5494, 0x3 }, ++ { 0x5495, 0x60 }, ++ { 0x5496, 0x2 }, ++ { 0x5497, 0xb8 }, ++ { 0x5498, 0x2 }, ++ { 0x5499, 0x86 }, ++ { 0x549a, 0x2 }, ++ { 0x549b, 0x5b }, ++ { 0x549c, 0x2 }, ++ { 0x549d, 0x3b }, ++ { 0x549e, 0x2 }, ++ { 0x549f, 0x1c }, ++ { 0x54a0, 0x2 }, ++ { 0x54a1, 0x4 }, ++ { 0x54a2, 0x1 }, ++ { 0x54a3, 0xed }, ++ { 0x54a4, 0x1 }, ++ { 0x54a5, 0xc5 }, ++ { 0x54a6, 0x1 }, ++ { 0x54a7, 0xa5 }, ++ { 0x54a8, 0x1 }, ++ { 0x54a9, 0x6c }, ++ { 0x54aa, 0x1 }, ++ { 0x54ab, 0x41 }, ++ { 0x54ac, 0x1 }, ++ { 0x54ad, 0x20 }, ++ { 0x54ae, 0x0 }, ++ { 0x54af, 0x16 }, ++ { 0x54b0, 0x1 }, ++ { 0x54b1, 0x20 }, ++ { 0x54b2, 0x0 }, ++ { 0x54b3, 0x10 }, ++ { 0x54b4, 0x0 }, ++ { 0x54b5, 0xf0 }, ++ { 0x54b6, 0x0 }, ++ { 0x54b7, 0xdf }, ++ { 0x5402, 0x3f }, ++ { 0x5403, 0x0 }, ++ { 0x3406, 0x0 }, ++ { 0x5180, 0xff }, ++ { 0x5181, 0x52 }, ++ { 0x5182, 0x11 }, ++ { 0x5183, 0x14 }, ++ { 0x5184, 0x25 }, ++ { 0x5185, 0x24 }, ++ { 0x5186, 0x6 }, ++ { 0x5187, 0x8 }, ++ { 0x5188, 0x8 }, ++ { 0x5189, 0x7c }, ++ { 0x518a, 0x60 }, ++ { 0x518b, 0xb2 }, ++ { 0x518c, 0xb2 }, ++ { 0x518d, 0x44 }, ++ { 0x518e, 0x3d }, ++ { 0x518f, 0x58 }, ++ { 0x5190, 0x46 }, ++ { 0x5191, 0xf8 }, ++ { 0x5192, 0x4 }, ++ { 0x5193, 0x70 }, ++ { 0x5194, 0xf0 }, ++ { 0x5195, 0xf0 }, ++ { 0x5196, 0x3 }, ++ { 0x5197, 0x1 }, ++ { 0x5198, 0x4 }, ++ { 0x5199, 0x12 }, ++ { 0x519a, 0x4 }, ++ { 0x519b, 0x0 }, ++ { 0x519c, 0x6 }, ++ { 0x519d, 0x82 }, ++ { 0x519e, 0x0 }, ++ { 0x5025, 0x80 }, ++ { 0x3a0f, 0x38 }, ++ { 0x3a10, 0x30 }, ++ { 0x3a1b, 0x3a }, ++ { 0x3a1e, 0x2e }, ++ { 0x3a11, 0x60 }, ++ { 0x3a1f, 0x10 }, ++ { 0x5688, 0xa6 }, ++ { 0x5689, 0x6a }, ++ { 0x568a, 0xea }, ++ { 0x568b, 0xae }, ++ { 0x568c, 0xa6 }, ++ { 0x568d, 0x6a }, ++ { 0x568e, 0x62 }, ++ { 0x568f, 0x26 }, ++ { 0x5583, 0x40 }, ++ { 0x5584, 0x40 }, ++ { 0x5580, 0x2 }, ++ { 0x5000, 0xcf }, ++ { 0x5800, 0x27 }, ++ { 0x5801, 0x19 }, ++ { 0x5802, 0x12 }, ++ { 0x5803, 0xf }, ++ { 0x5804, 0x10 }, ++ { 0x5805, 0x15 }, ++ { 0x5806, 0x1e }, ++ { 0x5807, 0x2f }, ++ { 0x5808, 0x15 }, ++ { 0x5809, 0xd }, ++ { 0x580a, 0xa }, ++ { 0x580b, 0x9 }, ++ { 0x580c, 0xa }, ++ { 0x580d, 0xc }, ++ { 0x580e, 0x12 }, ++ { 0x580f, 0x19 }, ++ { 0x5810, 0xb }, ++ { 0x5811, 0x7 }, ++ { 0x5812, 0x4 }, ++ { 0x5813, 0x3 }, ++ { 0x5814, 0x3 }, ++ { 0x5815, 0x6 }, ++ { 0x5816, 0xa }, ++ { 0x5817, 0xf }, ++ { 0x5818, 0xa }, ++ { 0x5819, 0x5 }, ++ { 0x581a, 0x1 }, ++ { 0x581b, 0x0 }, ++ { 0x581c, 0x0 }, ++ { 0x581d, 0x3 }, ++ { 0x581e, 0x8 }, ++ { 0x581f, 0xc }, ++ { 0x5820, 0xa }, ++ { 0x5821, 0x5 }, ++ { 0x5822, 0x1 }, ++ { 0x5823, 0x0 }, ++ { 0x5824, 0x0 }, ++ { 0x5825, 0x3 }, ++ { 0x5826, 0x8 }, ++ { 0x5827, 0xc }, ++ { 0x5828, 0xe }, ++ { 0x5829, 0x8 }, ++ { 0x582a, 0x6 }, ++ { 0x582b, 0x4 }, ++ { 0x582c, 0x5 }, ++ { 0x582d, 0x7 }, ++ { 0x582e, 0xb }, ++ { 0x582f, 0x12 }, ++ { 0x5830, 0x18 }, ++ { 0x5831, 0x10 }, ++ { 0x5832, 0xc }, ++ { 0x5833, 0xa }, ++ { 0x5834, 0xb }, ++ { 0x5835, 0xe }, ++ { 0x5836, 0x15 }, ++ { 0x5837, 0x19 }, ++ { 0x5838, 0x32 }, ++ { 0x5839, 0x1f }, ++ { 0x583a, 0x18 }, ++ { 0x583b, 0x16 }, ++ { 0x583c, 0x17 }, ++ { 0x583d, 0x1e }, ++ { 0x583e, 0x26 }, ++ { 0x583f, 0x53 }, ++ { 0x5840, 0x10 }, ++ { 0x5841, 0xf }, ++ { 0x5842, 0xd }, ++ { 0x5843, 0xc }, ++ { 0x5844, 0xe }, ++ { 0x5845, 0x9 }, ++ { 0x5846, 0x11 }, ++ { 0x5847, 0x10 }, ++ { 0x5848, 0x10 }, ++ { 0x5849, 0x10 }, ++ { 0x584a, 0x10 }, ++ { 0x584b, 0xe }, ++ { 0x584c, 0x10 }, ++ { 0x584d, 0x10 }, ++ { 0x584e, 0x11 }, ++ { 0x584f, 0x10 }, ++ { 0x5850, 0xf }, ++ { 0x5851, 0xc }, ++ { 0x5852, 0xf }, ++ { 0x5853, 0x10 }, ++ { 0x5854, 0x10 }, ++ { 0x5855, 0xf }, ++ { 0x5856, 0xe }, ++ { 0x5857, 0xb }, ++ { 0x5858, 0x10 }, ++ { 0x5859, 0xd }, ++ { 0x585a, 0xd }, ++ { 0x585b, 0xc }, ++ { 0x585c, 0xc }, ++ { 0x585d, 0xc }, ++ { 0x585e, 0xb }, ++ { 0x585f, 0xc }, ++ { 0x5860, 0xc }, ++ { 0x5861, 0xc }, ++ { 0x5862, 0xd }, ++ { 0x5863, 0x8 }, ++ { 0x5864, 0x11 }, ++ { 0x5865, 0x18 }, ++ { 0x5866, 0x18 }, ++ { 0x5867, 0x19 }, ++ { 0x5868, 0x17 }, ++ { 0x5869, 0x19 }, ++ { 0x586a, 0x16 }, ++ { 0x586b, 0x13 }, ++ { 0x586c, 0x13 }, ++ { 0x586d, 0x12 }, ++ { 0x586e, 0x13 }, ++ { 0x586f, 0x16 }, ++ { 0x5870, 0x14 }, ++ { 0x5871, 0x12 }, ++ { 0x5872, 0x10 }, ++ { 0x5873, 0x11 }, ++ { 0x5874, 0x11 }, ++ { 0x5875, 0x16 }, ++ { 0x5876, 0x14 }, ++ { 0x5877, 0x11 }, ++ { 0x5878, 0x10 }, ++ { 0x5879, 0xf }, ++ { 0x587a, 0x10 }, ++ { 0x587b, 0x14 }, ++ { 0x587c, 0x13 }, ++ { 0x587d, 0x12 }, ++ { 0x587e, 0x11 }, ++ { 0x587f, 0x11 }, ++ { 0x5880, 0x12 }, ++ { 0x5881, 0x15 }, ++ { 0x5882, 0x14 }, ++ { 0x5883, 0x15 }, ++ { 0x5884, 0x15 }, ++ { 0x5885, 0x15 }, ++ { 0x5886, 0x13 }, ++ { 0x5887, 0x17 }, ++ { 0x3710, 0x10 }, ++ { 0x3632, 0x51 }, ++ { 0x3702, 0x10 }, ++ { 0x3703, 0xb2 }, ++ { 0x3704, 0x18 }, ++ { 0x370b, 0x40 }, ++ { 0x370d, 0x3 }, ++ { 0x3631, 0x1 }, ++ { 0x3632, 0x52 }, ++ { 0x3606, 0x24 }, ++ { 0x3620, 0x96 }, ++ { 0x5785, 0x7 }, ++ { 0x3a13, 0x30 }, ++ { 0x3600, 0x52 }, ++ { 0x3604, 0x48 }, ++ { 0x3606, 0x1b }, ++ { 0x370d, 0xb }, ++ { 0x370f, 0xc0 }, ++ { 0x3709, 0x1 }, ++ { 0x3823, 0x0 }, ++ { 0x5007, 0x0 }, ++ { 0x5009, 0x0 }, ++ { 0x5011, 0x0 }, ++ { 0x5013, 0x0 }, ++ { 0x519e, 0x0 }, ++ { 0x5086, 0x0 }, ++ { 0x5087, 0x0 }, ++ { 0x5088, 0x0 }, ++ { 0x5089, 0x0 }, ++ { 0x302b, 0x0 }, ++ { 0x3503, 0x7 }, ++ { 0x3011, 0x8 }, ++ { 0x350c, 0x2 }, ++ { 0x350d, 0xe4 }, ++ { 0x3621, 0xc9 }, ++ { 0x370a, 0x81 }, ++ { 0xffff, 0xff }, ++}; ++ ++static struct regval_list ov5642_default_regs_finalise[] = { ++ { 0x3810, 0xc2 }, ++ { 0x3818, 0xc9 }, ++ { 0x381c, 0x10 }, ++ { 0x381d, 0xa0 }, ++ { 0x381e, 0x5 }, ++ { 0x381f, 0xb0 }, ++ { 0x3820, 0x0 }, ++ { 0x3821, 0x0 }, ++ { 0x3824, 0x11 }, ++ { 0x3a08, 0x1b }, ++ { 0x3a09, 0xc0 }, ++ { 0x3a0a, 0x17 }, ++ { 0x3a0b, 0x20 }, ++ { 0x3a0d, 0x2 }, ++ { 0x3a0e, 0x1 }, ++ { 0x401c, 0x4 }, ++ { 0x5682, 0x5 }, ++ { 0x5683, 0x0 }, ++ { 0x5686, 0x2 }, ++ { 0x5687, 0xcc }, ++ { 0x5001, 0x4f }, ++ { 0x589b, 0x6 }, ++ { 0x589a, 0xc5 }, ++ { 0x3503, 0x0 }, ++ { 0x460c, 0x20 }, ++ { 0x460b, 0x37 }, ++ { 0x471c, 0xd0 }, ++ { 0x471d, 0x5 }, ++ { 0x3815, 0x1 }, ++ { 0x3818, 0xc1 }, ++ { 0x501f, 0x0 }, ++ { 0x5002, 0xe0 }, ++ { 0x4300, 0x32 }, /* UYVY */ ++ { 0x3002, 0x1c }, ++ { 0x4800, 0x14 }, ++ { 0x4801, 0xf }, ++ { 0x3007, 0x3b }, ++ { 0x300e, 0x4 }, ++ { 0x4803, 0x50 }, ++ { 0x3815, 0x1 }, ++ { 0x4713, 0x2 }, ++ { 0x4842, 0x1 }, ++ { 0x300f, 0xe }, ++ { 0x3003, 0x3 }, ++ { 0x3003, 0x1 }, ++ { 0xffff, 0xff }, ++}; ++ ++#endif ++ ++#endif /* _OV5642_H_ */ +diff --git a/drivers/media/i2c/soc_camera/ov5642_720p.h b/drivers/media/i2c/soc_camera/ov5642_720p.h +new file mode 100644 +index 0000000..d5a52e3 +--- /dev/null ++++ b/drivers/media/i2c/soc_camera/ov5642_720p.h +@@ -0,0 +1,711 @@ ++/* Settings array from ++ * From 5e8e49e226b29c144ddf482afe7d3ad659c9897f Mon Sep 17 00:00:00 2001 ++ * From: Kazuya Nishimura ++ * Date: Mon, 20 Oct 2014 15:12:56 +0900 ++ * Subject: [PATCH] Enabled VIN driver for MMB ++ */ ++ ++/* 720p 30fps @ 1280x720 */ ++/* for the setting , 24MHz Mlck input and 90MHz Plck output */ ++/* refer to OV5642.c */ ++ ++static struct regval_list OV5642_720P_30FPS[] = ++{ ++ {0x3103, 0x93}, ++ {0x3008, 0x82}, ++ {0x3017, 0x7f}, ++ {0x3018, 0xfc}, ++ /* drive capability 4x */ ++ { 0x302c, (3 << 5) | 0x02 }, ++ {0x3810, 0xc2}, ++ {0x3615, 0xf0}, ++ {0x3000, 0x00}, ++ {0x3001, 0x00}, ++ {0x3002, 0x00}, ++ {0x3003, 0x00}, ++ {0x3000, 0xf8}, ++ {0x3001, 0x48}, ++ {0x3002, 0x5c}, ++ {0x3003, 0x02}, ++ {0x3004, 0x07}, ++ {0x3005, 0xb7}, ++ {0x3006, 0x43}, ++ {0x3007, 0x37}, ++ {0x3011, 0x0f}, //PLL CONTROL 02 : Bit[5:0] PLL DIVP divider ++ {0x3010, 0x10}, //PLL CONTROL 01 : Bit[7:4] PLL DIVS, Bit[3:0] PLL DIVM (MIPI divider ratio) ++ //29-30fps ++ {0x460c, 0x22}, ++ {0x3815, 0x04}, ++ {0x370d, 0x06}, ++ {0x370c, 0xa0}, ++ {0x3602, 0xfc}, ++ {0x3612, 0xff}, ++ {0x3634, 0xc0}, ++ {0x3613, 0x00}, ++ {0x3605, 0x7c}, ++ {0x3621, 0x09}, ++ {0x3622, 0x00}, ++ {0x3604, 0x40}, ++ {0x3603, 0xa7}, ++ {0x3603, 0x27}, ++ {0x4000, 0x21}, ++ {0x401d, 0x02}, ++ {0x3600, 0x54}, ++ {0x3605, 0x04}, ++ {0x3606, 0x3f}, ++ {0x3c01, 0x80}, ++ {REG_ISP_CTRL_00, 0x4f}, ++ {0x4300, 0x32}, /* YUV422: UYVY... */ ++ {0x5020, 0x04}, ++ {0x5181, 0x79}, ++ {0x5182, 0x00}, ++ {0x5185, 0x22}, ++ {0x5197, 0x01}, ++ {REG_ISP_CTRL_01, 0xff}, ++ {0x5500, 0x0a}, ++ {0x5504, 0x00}, ++ {0x5505, 0x7f}, ++ {0x5080, 0x08}, ++ {0x300e, 0x18}, ++ {0x4610, 0x00}, ++ {0x471d, 0x05}, ++ {0x4708, 0x06}, ++ /* POLARITY CTRL 00 ++ * [0] VSYNC - act low ++ * [1] HREF - act low ++ * [2] gate PCLK under HREF - no ++ * [3] gate PCLK under VSYNK - no ++ * [5] PCLK - falling edge ++ */ ++ {0x4740, 0x20}, ++ {0x3710, 0x10}, ++ {0x3632, 0x41}, ++ {0x3702, 0x40}, ++ {0x3620, 0x37}, ++ {0x3631, 0x01}, ++ {REG_OUT_WIDTH_HIGH, 0x02}, // TIMING DVPHO Bit[3:0] DVP output horizontal width high byte ++ {REG_OUT_WIDTH_LOW, 0x80}, // TIMING DVPHO Bit[7:0] DVP output horizontal width low byte ++ // 0x280 => 640 ++ {REG_OUT_HEIGHT_HIGH, 0x01}, // TIMING DVPVO Bit[3:0] DVP output vertical height high byte ++ {REG_OUT_HEIGHT_LOW, 0xe0}, // TIMING DVPVO Bit[7:0] DVP output vertical height low byte ++ // 0x1e0 => 480 ++ {REG_OUT_TOTAL_HEIGHT_HIGH, 0x07}, // TIMING VTS Bit[3:0] Total vertical size high byte [11:8] ++ {REG_OUT_TOTAL_HEIGHT_LOW, 0xd0}, // TIMING VTS Bit[7:0] Total vertical size low byte [7:0] ++ // 0x7d0 => 2000 ++ {0x501f, 0x00}, ++ {REG_ISP_CTRL_00, 0x4f}, ++ {REG_OUTPUT_FORMAT, 0x32}, //UYVY ++ {0x3503, 0x07}, ++ {0x3501, 0x73}, ++ {0x3502, 0x80}, ++ {0x350b, 0x00}, ++ {0x3503, 0x07}, ++ {0x3824, 0x11}, ++ {0x3501, 0x1e}, ++ {0x3502, 0x80}, ++ {0x350b, 0x7f}, ++ {REG_OUT_TOTAL_WIDTH_HIGH, 0x0c}, ++ {REG_OUT_TOTAL_WIDTH_LOW, 0x80}, ++ {REG_OUT_TOTAL_HEIGHT_HIGH, 0x03}, // TIMING VTS Bit[3:0] Total vertical size high byte [11:8] ++ {REG_OUT_TOTAL_HEIGHT_LOW, 0xe8}, // TIMING VTS Bit[7:0] Total vertical size low byte [7:0] ++ // 0x3e8 => 1000 ++ {0x3a0d, 0x04}, ++ {0x3a0e, 0x03}, ++ {0x3818, 0xc1}, ++ {0x3705, 0xdb}, ++ {0x370a, 0x81}, ++ {REG_WINDOW_START_X_LOW, 0x80}, ++ {0x3621, 0xc7}, ++ {REG_WINDOW_START_X_LOW, 0x50}, ++ {REG_WINDOW_START_Y_LOW, 0x08}, ++ {0x3827, 0x08}, ++ {0x3810, 0xc0}, ++ {REG_WINDOW_WIDTH_HIGH, 0x05}, ++ {REG_WINDOW_WIDTH_LOW, 0x00}, ++ {REG_AVG_WINDOW_END_X_HIGH, 0x05}, ++ {REG_AVG_WINDOW_END_X_LOW, 0x00}, ++ {REG_WINDOW_HEIGHT_HIGH, 0x03}, ++ {REG_WINDOW_HEIGHT_LOW, 0xc0}, ++ {REG_AVG_WINDOW_END_Y_HIGH, 0x03}, ++ {REG_AVG_WINDOW_END_Y_LOW, 0xc0}, ++ {0x3a00, 0x78}, ++ {0x3a1a, 0x04}, ++ {0x3a13, 0x30}, ++ {0x3a18, 0x00}, ++ {0x3a19, 0x7c}, ++ {0x3a08, 0x12}, ++ {0x3a09, 0xc0}, ++ {0x3a0a, 0x0f}, ++ {0x3a0b, 0xa0}, ++ {0x3004, 0xff}, ++ {0x350c, 0x07}, ++ {0x350d, 0xd0}, ++ {0x3500, 0x00}, ++ {0x3501, 0x00}, ++ {0x3502, 0x00}, ++ {0x350a, 0x00}, ++ {0x350b, 0x00}, ++ {0x3503, 0x00}, ++ {0x528a, 0x02}, ++ {0x528b, 0x04}, ++ {0x528c, 0x08}, ++ {0x528d, 0x08}, ++ {0x528e, 0x08}, ++ {0x528f, 0x10}, ++ {0x5290, 0x10}, ++ {0x5292, 0x00}, ++ {0x5293, 0x02}, ++ {0x5294, 0x00}, ++ {0x5295, 0x02}, ++ {0x5296, 0x00}, ++ {0x5297, 0x02}, ++ {0x5298, 0x00}, ++ {0x5299, 0x02}, ++ {0x529a, 0x00}, ++ {0x529b, 0x02}, ++ {0x529c, 0x00}, ++ {0x529d, 0x02}, ++ {0x529e, 0x00}, ++ {0x529f, 0x02}, ++ {0x3a0f, 0x3c}, ++ {0x3a10, 0x30}, ++ {0x3a1b, 0x3c}, ++ {0x3a1e, 0x30}, ++ {0x3a11, 0x70}, ++ {0x3a1f, 0x10}, ++ {0x3030, 0x0b}, ++ {0x3a02, 0x00}, ++ {0x3a03, 0x7d}, ++ {0x3a04, 0x00}, ++ {0x3a14, 0x00}, ++ {0x3a15, 0x7d}, ++ {0x3a16, 0x00}, ++ {0x3a00, 0x78}, ++ {0x3a08, 0x09}, ++ {0x3a09, 0x60}, ++ {0x3a0a, 0x07}, ++ {0x3a0b, 0xd0}, ++ {0x3a0d, 0x08}, ++ {0x3a0e, 0x06}, ++ {0x5193, 0x70}, ++ {0x3620, 0x57}, ++ {0x3703, 0x98}, ++ {0x3704, 0x1c}, ++ {0x589b, 0x04}, ++ {0x589a, 0xc5}, ++ {0x528a, 0x00}, ++ {0x528b, 0x02}, ++ {0x528c, 0x08}, ++ {0x528d, 0x10}, ++ {0x528e, 0x20}, ++ {0x528f, 0x28}, ++ {0x5290, 0x30}, ++ {0x5292, 0x00}, ++ {0x5293, 0x00}, ++ {0x5294, 0x00}, ++ {0x5295, 0x02}, ++ {0x5296, 0x00}, ++ {0x5297, 0x08}, ++ {0x5298, 0x00}, ++ {0x5299, 0x10}, ++ {0x529a, 0x00}, ++ {0x529b, 0x20}, ++ {0x529c, 0x00}, ++ {0x529d, 0x28}, ++ {0x529e, 0x00}, ++ {0x529f, 0x30}, ++ {0x5282, 0x00}, ++ {0x5300, 0x00}, ++ {0x5301, 0x20}, ++ {0x5302, 0x00}, ++ {0x5303, 0x7c}, ++ {0x530c, 0x00}, ++ {0x530d, 0x0c}, ++ {0x530e, 0x20}, ++ {0x530f, 0x80}, ++ {0x5310, 0x20}, ++ {0x5311, 0x80}, ++ {0x5308, 0x20}, ++ {0x5309, 0x40}, ++ {0x5304, 0x00}, ++ {0x5305, 0x30}, ++ {0x5306, 0x00}, ++ {0x5307, 0x80}, ++ {0x5314, 0x08}, ++ {0x5315, 0x20}, ++ {0x5319, 0x30}, ++ {0x5316, 0x10}, ++ {0x5317, 0x08}, ++ {0x5318, 0x02}, ++ {0x5380, 0x01}, ++ {0x5381, 0x00}, ++ {0x5382, 0x00}, ++ {0x5383, 0x4e}, ++ {0x5384, 0x00}, ++ {0x5385, 0x0f}, ++ {0x5386, 0x00}, ++ {0x5387, 0x00}, ++ {0x5388, 0x01}, ++ {0x5389, 0x15}, ++ {0x538a, 0x00}, ++ {0x538b, 0x31}, ++ {0x538c, 0x00}, ++ {0x538d, 0x00}, ++ {0x538e, 0x00}, ++ {0x538f, 0x0f}, ++ {0x5390, 0x00}, ++ {0x5391, 0xab}, ++ {0x5392, 0x00}, ++ {0x5393, 0xa2}, ++ {0x5394, 0x08}, ++ {0x5480, 0x14}, ++ {0x5481, 0x21}, ++ {0x5482, 0x36}, ++ {0x5483, 0x57}, ++ {0x5484, 0x65}, ++ {0x5485, 0x71}, ++ {0x5486, 0x7d}, ++ {0x5487, 0x87}, ++ {0x5488, 0x91}, ++ {0x5489, 0x9a}, ++ {0x548a, 0xaa}, ++ {0x548b, 0xb8}, ++ {0x548c, 0xcd}, ++ {0x548d, 0xdd}, ++ {0x548e, 0xea}, ++ {0x548f, 0x10}, ++ {0x5490, 0x05}, ++ {0x5491, 0x00}, ++ {0x5492, 0x04}, ++ {0x5493, 0x20}, ++ {0x5494, 0x03}, ++ {0x5495, 0x60}, ++ {0x5496, 0x02}, ++ {0x5497, 0xb8}, ++ {0x5498, 0x02}, ++ {0x5499, 0x86}, ++ {0x549a, 0x02}, ++ {0x549b, 0x5b}, ++ {0x549c, 0x02}, ++ {0x549d, 0x3b}, ++ {0x549e, 0x02}, ++ {0x549f, 0x1c}, ++ {0x54a0, 0x02}, ++ {0x54a1, 0x04}, ++ {0x54a2, 0x01}, ++ {0x54a3, 0xed}, ++ {0x54a4, 0x01}, ++ {0x54a5, 0xc5}, ++ {0x54a6, 0x01}, ++ {0x54a7, 0xa5}, ++ {0x54a8, 0x01}, ++ {0x54a9, 0x6c}, ++ {0x54aa, 0x01}, ++ {0x54ab, 0x41}, ++ {0x54ac, 0x01}, ++ {0x54ad, 0x20}, ++ {0x54ae, 0x00}, ++ {0x54af, 0x16}, ++ {0x3406, 0x00}, ++ {0x5192, 0x04}, ++ {0x5191, 0xf8}, ++ {0x5193, 0x70}, ++ {0x5194, 0xf0}, ++ {0x5195, 0xf0}, ++ {0x518d, 0x3d}, ++ {0x518f, 0x54}, ++ {0x518e, 0x3d}, ++ {0x5190, 0x54}, ++ {0x518b, 0xc0}, ++ {0x518c, 0xbd}, ++ {0x5187, 0x18}, ++ {0x5188, 0x18}, ++ {0x5189, 0x6e}, ++ {0x518a, 0x68}, ++ {0x5186, 0x1c}, ++ {0x5181, 0x50}, ++ {0x5184, 0x25}, ++ {0x5182, 0x11}, ++ {0x5183, 0x14}, ++ {0x5184, 0x25}, ++ {0x5185, 0x24}, ++ {0x5025, 0x82}, ++ {0x3a0f, 0x7e}, ++ {0x3a10, 0x72}, ++ {0x3a1b, 0x80}, ++ {0x3a1e, 0x70}, ++ {0x3a11, 0xd0}, ++ {0x3a1f, 0x40}, ++ {0x5583, 0x40}, ++ {0x5584, 0x40}, ++ {0x5580, 0x02}, ++ {0x3633, 0x07}, ++ {0x3702, 0x10}, ++ {0x3703, 0xb2}, ++ {0x3704, 0x18}, ++ {0x370b, 0x40}, ++ {0x370d, 0x02}, ++ {0x3620, 0x52}, ++ {0x3c00, 0x04}, ++ ++ {REG_ISP_CTRL_01, 0xFF}, ++ {0x5583, 0x50}, ++ {0x5584, 0x50}, ++ {0x5580, 0x02}, ++ {0x3c01, 0x80}, ++ {0x3c00, 0x04}, ++ {0x5800, 0x27}, ++ {0x5801, 0x22}, ++ {0x5802, 0x1b}, ++ {0x5803, 0x17}, ++ {0x5804, 0x16}, ++ {0x5805, 0x18}, ++ {0x5806, 0x20}, ++ {0x5807, 0x20}, ++ {0x5808, 0x1b}, ++ {0x5809, 0x15}, ++ {0x580a, 0x0f}, ++ {0x580b, 0x0d}, ++ {0x580c, 0x0d}, ++ {0x580d, 0x0e}, ++ {0x580e, 0x11}, ++ {0x580f, 0x18}, ++ {0x5810, 0x10}, ++ {0x5811, 0x0d}, ++ {0x5812, 0x08}, ++ {0x5813, 0x05}, ++ {0x5814, 0x04}, ++ {0x5815, 0x06}, ++ {0x5816, 0x09}, ++ {0x5817, 0x0e}, ++ {0x5818, 0x0d}, ++ {0x5819, 0x09}, ++ {0x581a, 0x03}, ++ {0x581b, 0x00}, ++ {0x581c, 0x00}, ++ {0x581d, 0x01}, ++ {0x581e, 0x05}, ++ {0x581f, 0x0b}, ++ {0x5820, 0x0d}, ++ {0x5821, 0x09}, ++ {0x5822, 0x03}, ++ {0x5823, 0x00}, ++ {0x5824, 0x00}, ++ {0x5825, 0x01}, ++ {0x5826, 0x05}, ++ {0x5827, 0x0b}, ++ {0x5828, 0x10}, ++ {0x5829, 0x0c}, ++ {0x582a, 0x08}, ++ {0x582b, 0x04}, ++ {0x582c, 0x03}, ++ {0x582d, 0x05}, ++ {0x582e, 0x09}, ++ {0x582f, 0x0e}, ++ {0x5830, 0x1b}, ++ {0x5831, 0x14}, ++ {0x5832, 0x0f}, ++ {0x5833, 0x0c}, ++ {0x5834, 0x0c}, ++ {0x5835, 0x0d}, ++ {0x5836, 0x10}, ++ {0x5837, 0x19}, ++ {0x5838, 0x25}, ++ {0x5839, 0x23}, ++ {0x583a, 0x1a}, ++ {0x583b, 0x16}, ++ {0x583c, 0x15}, ++ {0x583d, 0x18}, ++ {0x583e, 0x1f}, ++ {0x583f, 0x25}, ++ {0x5840, 0x10}, ++ {0x5841, 0x0e}, ++ {0x5842, 0x0e}, ++ {0x5843, 0x0e}, ++ {0x5844, 0x0f}, ++ {0x5845, 0x0a}, ++ {0x5846, 0x08}, ++ {0x5847, 0x0f}, ++ {0x5848, 0x0f}, ++ {0x5849, 0x0f}, ++ {0x584a, 0x0c}, ++ {0x584b, 0x0f}, ++ {0x584c, 0x09}, ++ {0x584d, 0x10}, ++ {0x584e, 0x11}, ++ {0x584f, 0x10}, ++ {0x5850, 0x0f}, ++ {0x5851, 0x0e}, ++ {0x5852, 0x08}, ++ {0x5853, 0x10}, ++ {0x5854, 0x10}, ++ {0x5855, 0x10}, ++ {0x5856, 0x0e}, ++ {0x5857, 0x0e}, ++ {0x5858, 0x0a}, ++ {0x5859, 0x0e}, ++ {0x585a, 0x0e}, ++ {0x585b, 0x0e}, ++ {0x585c, 0x0e}, ++ {0x585d, 0x0d}, ++ {0x585e, 0x08}, ++ {0x585f, 0x0b}, ++ {0x5860, 0x0a}, ++ {0x5861, 0x0a}, ++ {0x5862, 0x09}, ++ {0x5863, 0x0d}, ++ {0x5864, 0x13}, ++ {0x5865, 0x0e}, ++ {0x5866, 0x10}, ++ {0x5867, 0x10}, ++ {0x5868, 0x0e}, ++ {0x5869, 0x11}, ++ {0x586a, 0x12}, ++ {0x586b, 0x10}, ++ {0x586c, 0x10}, ++ {0x586d, 0x10}, ++ {0x586e, 0x10}, ++ {0x586f, 0x11}, ++ {0x5870, 0x15}, ++ {0x5871, 0x10}, ++ {0x5872, 0x10}, ++ {0x5873, 0x10}, ++ {0x5874, 0x11}, ++ {0x5875, 0x11}, ++ {0x5876, 0x14}, ++ {0x5877, 0x0f}, ++ {0x5878, 0x10}, ++ {0x5879, 0x10}, ++ {0x587a, 0x10}, ++ {0x587b, 0x11}, ++ {0x587c, 0x12}, ++ {0x587d, 0x0f}, ++ {0x587e, 0x0f}, ++ {0x587f, 0x10}, ++ {0x5880, 0x10}, ++ {0x5881, 0x0f}, ++ {0x5882, 0x12}, ++ {0x5883, 0x0e}, ++ {0x5884, 0x10}, ++ {0x5885, 0x10}, ++ {0x5886, 0x0e}, ++ {0x5887, 0x0e}, ++ {0x5180, 0xff}, ++ {0x5181, 0x52}, ++ {0x5182, 0x11}, ++ {0x5183, 0x14}, ++ {0x5184, 0x25}, ++ {0x5185, 0x24}, ++ {0x5186, 0x14}, ++ {0x5187, 0x14}, ++ {0x5188, 0x14}, ++ {0x5189, 0x6c}, ++ {0x518a, 0x60}, ++ {0x518b, 0xbd}, ++ {0x518c, 0x9c}, ++ {0x518d, 0x3d}, ++ {0x518e, 0x34}, ++ {0x518f, 0x57}, ++ {0x5190, 0x4a}, ++ {0x5191, 0xf8}, ++ {0x5192, 0x04}, ++ {0x5193, 0x70}, ++ {0x5194, 0xf0}, ++ {0x5195, 0xf0}, ++ {0x5196, 0x03}, ++ {0x5197, 0x01}, ++ {0x5198, 0x04}, ++ {0x5199, 0x00}, ++ {0x519a, 0x04}, ++ {0x519b, 0x35}, ++ {0x519c, 0x08}, ++ {0x519d, 0xb8}, ++ {0x519e, 0xa0}, ++ {0x528a, 0x00}, ++ {0x528b, 0x01}, ++ {0x528c, 0x04}, ++ {0x528d, 0x08}, ++ {0x528e, 0x10}, ++ {0x528f, 0x20}, ++ {0x5290, 0x30}, ++ {0x5292, 0x00}, ++ {0x5293, 0x00}, ++ {0x5294, 0x00}, ++ {0x5295, 0x01}, ++ {0x5296, 0x00}, ++ {0x5297, 0x04}, ++ {0x5298, 0x00}, ++ {0x5299, 0x08}, ++ {0x529a, 0x00}, ++ {0x529b, 0x10}, ++ {0x529c, 0x00}, ++ {0x529d, 0x20}, ++ {0x529e, 0x00}, ++ {0x529f, 0x30}, ++ {0x5282, 0x00}, ++ {0x5300, 0x00}, ++ {0x5301, 0x20}, ++ {0x5302, 0x00}, ++ {0x5303, 0x7c}, ++ {0x530c, 0x00}, ++ {0x530d, 0x10}, ++ {0x530e, 0x20}, ++ {0x530f, 0x80}, ++ {0x5310, 0x20}, ++ {0x5311, 0x80}, ++ {0x5308, 0x20}, ++ {0x5309, 0x40}, ++ {0x5304, 0x00}, ++ {0x5305, 0x30}, ++ {0x5306, 0x00}, ++ {0x5307, 0x80}, ++ {0x5314, 0x08}, ++ {0x5315, 0x20}, ++ {0x5319, 0x30}, ++ {0x5316, 0x10}, ++ {0x5317, 0x00}, ++ {0x5318, 0x02}, ++ {0x5380, 0x01}, ++ {0x5381, 0x00}, ++ {0x5382, 0x00}, ++ {0x5383, 0x1f}, ++ {0x5384, 0x00}, ++ {0x5385, 0x06}, ++ {0x5386, 0x00}, ++ {0x5387, 0x00}, ++ {0x5388, 0x00}, ++ {0x5389, 0xE1}, ++ {0x538A, 0x00}, ++ {0x538B, 0x2B}, ++ {0x538C, 0x00}, ++ {0x538D, 0x00}, ++ {0x538E, 0x00}, ++ {0x538F, 0x10}, ++ {0x5390, 0x00}, ++ {0x5391, 0xB3}, ++ {0x5392, 0x00}, ++ {0x5393, 0xA6}, ++ {0x5394, 0x08}, ++ {0x5480, 0x14}, ++ {0x5481, 0x21}, ++ {0x5482, 0x36}, ++ {0x5483, 0x57}, ++ {0x5484, 0x65}, ++ {0x5485, 0x71}, ++ {0x5486, 0x7D}, ++ {0x5487, 0x87}, ++ {0x5488, 0x91}, ++ {0x5489, 0x9A}, ++ {0x548A, 0xAA}, ++ {0x548B, 0xB8}, ++ {0x548C, 0xCD}, ++ {0x548D, 0xDD}, ++ {0x548E, 0xEA}, ++ {0x548F, 0x1d}, ++ {0x5490, 0x05}, ++ {0x5491, 0x00}, ++ {0x5492, 0x04}, ++ {0x5493, 0x20}, ++ {0x5494, 0x03}, ++ {0x5495, 0x60}, ++ {0x5496, 0x02}, ++ {0x5497, 0xB8}, ++ {0x5498, 0x02}, ++ {0x5499, 0x86}, ++ {0x549A, 0x02}, ++ {0x549B, 0x5B}, ++ {0x549C, 0x02}, ++ {0x549D, 0x3B}, ++ {0x549E, 0x02}, ++ {0x549F, 0x1C}, ++ {0x54A0, 0x02}, ++ {0x54A1, 0x04}, ++ {0x54A2, 0x01}, ++ {0x54A3, 0xED}, ++ {0x54A4, 0x01}, ++ {0x54A5, 0xC5}, ++ {0x54A6, 0x01}, ++ {0x54A7, 0xA5}, ++ {0x54A8, 0x01}, ++ {0x54A9, 0x6C}, ++ {0x54AA, 0x01}, ++ {0x54AB, 0x41}, ++ {0x54AC, 0x01}, ++ {0x54AD, 0x20}, ++ {0x54AE, 0x00}, ++ {0x54AF, 0x16}, ++ {0x54B0, 0x01}, ++ {0x54B1, 0x20}, ++ {0x54B2, 0x00}, ++ {0x54B3, 0x10}, ++ {0x54B4, 0x00}, ++ {0x54B5, 0xf0}, ++ {0x54B6, 0x00}, ++ {0x54B7, 0xDF}, ++ {0x5402, 0x3f}, ++ {0x5403, 0x00}, ++ {0x5500, 0x10}, ++ {0x5502, 0x00}, ++ {0x5503, 0x06}, ++ {0x5504, 0x00}, ++ {0x5505, 0x7f}, ++ {0x5025, 0x80}, ++ {0x3a0f, 0x48}, //0x30 ++ {0x3a10, 0x38}, //0x28 ++ {0x3a1b, 0x50}, //0x30 ++ {0x3a1e, 0x30}, //0x28 ++ {0x3a11, 0x71}, //0x61 ++ {0x3a1f, 0x10}, ++ {0x5688, 0xfd}, ++ {0x5689, 0xdf}, ++ {0x568a, 0xfe}, ++ {0x568b, 0xef}, ++ {0x568c, 0xfe}, ++ {0x568d, 0xef}, ++ {0x568e, 0xaa}, ++ {0x568f, 0xaa}, ++ ++ {REG_WINDOW_START_X_HIGH, 0x1 }, ++ {REG_WINDOW_START_X_LOW, 0x50}, ++ //0x150 = 336 ++ {REG_WINDOW_START_Y_HIGH, 0x0 }, ++ {REG_WINDOW_START_Y_LOW, 0x8 }, ++ //0x8 = 8 ++ {REG_WINDOW_WIDTH_HIGH, 0x5 }, ++ {REG_WINDOW_WIDTH_LOW, 0x0 }, ++ //0x500 = 1280 ++ {REG_WINDOW_HEIGHT_HIGH, 0x3 }, ++ {REG_WINDOW_HEIGHT_LOW, 0xc0}, ++ //0x3c0 = 960 ++ {REG_OUT_WIDTH_HIGH, 0x5 }, // TIMING DVPHO Bit[3:0] DVP output horizontal width high byte ++ {REG_OUT_WIDTH_LOW, 0x00}, // TIMING DVPHO Bit[7:0] DVP output horizontal width low byte ++ // 0x500 => 1280 ++ {REG_OUT_HEIGHT_HIGH, 0x2 }, // TIMING DVPVO Bit[3:0] DVP output vertical height high byte ++// {REG_OUT_HEIGHT_LOW, 0xd0}, // TIMING DVPVO Bit[7:0] DVP output vertical height low byte ++ // 0x2d0 => 720 ++ {REG_OUT_HEIGHT_LOW, 0xd5}, // TIMING DVPVO Bit[7:0] DVP output vertical height low byte ++ // 0x2d5 => 725 ++ {REG_OUT_TOTAL_WIDTH_HIGH, 0xc }, // TIMING HTS Bit[3:0] Total horizontal size high byte [11:8] ++ {REG_OUT_TOTAL_WIDTH_LOW, 0x80}, // TIMING HTS Bit[7:0] Total horizontal size low byte [7:0] ++ // 0xc80 => 3200 ++ {REG_OUT_TOTAL_HEIGHT_HIGH, 0x3 }, // TIMING VTS Bit[3:0] Total vertical size high byte [11:8] ++ {REG_OUT_TOTAL_HEIGHT_LOW, 0xe8}, // TIMING VTS Bit[7:0] Total vertical size low byte [7:0] ++ // 0x3e8 => 1000 ++ {REG_ISP_CTRL_01, 0x7f}, ++ {REG_AVG_WINDOW_START_X_HIGH, 0x0 }, ++ {REG_AVG_WINDOW_START_X_LOW, 0x0 }, ++ {REG_AVG_WINDOW_END_X_HIGH, 0x5 }, ++ {REG_AVG_WINDOW_END_X_LOW, 0x0 }, ++ {REG_AVG_WINDOW_START_Y_HIGH, 0x0 }, ++ {REG_AVG_WINDOW_START_Y_LOW, 0x0 }, ++ {REG_AVG_WINDOW_END_Y_HIGH, 0x3 }, ++ //{REG_AVG_WINDOW_END_Y_LOW, 0xc0}, ++ {REG_AVG_WINDOW_END_Y_LOW, 0xc0}, ++ {0x3815, 0x02}, ++ {0x3503, 0x00}, ++ //{0x4730, 0x01}, ++ {0x4730, 0x00}, ++ {REG_OUTPUT_FORMAT, 0x32}, ++ ++ {0xffff, 0xff}, ++}; +-- +1.9.1 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0033-media-soc-camera-fix-parallel-i-f-in-VIN.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0033-media-soc-camera-fix-parallel-i-f-in-VIN.patch new file mode 100644 index 0000000..c56049a --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0033-media-soc-camera-fix-parallel-i-f-in-VIN.patch @@ -0,0 +1,69 @@ +From 112395ed601c67a6ba935cec0107335e966888dc Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov +Date: Fri, 14 Jul 2017 21:55:20 +0300 +Subject: [PATCH] media: soc_camera: fix parallel i/f in VIN + +This fixes parallel interface in VIN + +Signed-off-by: Vladimir Barinov +--- + drivers/media/platform/soc_camera/rcar_vin.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c +index f5c2528..a9cb72d 100644 +--- a/drivers/media/platform/soc_camera/rcar_vin.c ++++ b/drivers/media/platform/soc_camera/rcar_vin.c +@@ -149,6 +149,9 @@ + /* Video n Data Mode Register 2 bits */ + #define VNDMR2_VPS (1 << 30) + #define VNDMR2_HPS (1 << 29) ++#define VNDMR2_CES (1 << 28) ++#define VNDMR2_DES (1 << 27) ++#define VNDMR2_CHS (1 << 23) + #define VNDMR2_FTEV (1 << 17) + #define VNDMR2_VLV(n) ((n & 0xf) << 12) + +@@ -1850,10 +1853,15 @@ static int rcar_vin_set_bus_param(struct soc_camera_device *icd) + val = VNDMR2_FTEV; + else + val = VNDMR2_FTEV | VNDMR2_VLV(1); ++ + if (!(common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) + val |= VNDMR2_VPS; + if (!(common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) + val |= VNDMR2_HPS; ++ ++ val |= VNDMR2_CES; ++ dev_dbg(icd->parent, "VNDMR2=0x%x\n", val); ++ + iowrite32(val, priv->base + VNDMR2_REG); + + ret = rcar_vin_set_rect(icd); +@@ -2937,8 +2945,8 @@ static int rcar_vin_probe(struct platform_device *pdev) + priv->max_height = 2048; + } + +- if (priv->chip == RCAR_H3 || priv->chip == RCAR_M3 || +- priv->chip == RCAR_V3M) { ++ if ((priv->chip == RCAR_H3 || priv->chip == RCAR_M3 || ++ priv->chip == RCAR_V3M) && !of_property_read_string(np, "csi,select", &str)) { + u32 ifmd = 0; + bool match_flag = false; + const struct vin_gen3_ifmd *gen3_ifmd_table = NULL; +@@ -2973,12 +2981,6 @@ static int rcar_vin_probe(struct platform_device *pdev) + else + priv->index = RCAR_VIN_CH_NONE; + +- ret = of_property_read_string(np, "csi,select", &str); +- if (ret) { +- dev_err(&pdev->dev, "could not parse csi,select\n"); +- return ret; +- } +- + if (strcmp(str, "csi40") == 0) + priv->csi_ch = RCAR_CSI40; + else if (strcmp(str, "csi20") == 0) +-- +1.9.1 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0040-arm64-dts-renesas-add-ADAS-boards.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0040-arm64-dts-renesas-add-ADAS-boards.patch index 10ab159..a408c52 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0040-arm64-dts-renesas-add-ADAS-boards.patch +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0040-arm64-dts-renesas-add-ADAS-boards.patch @@ -23,27 +23,28 @@ Signed-off-by: Vladimir Barinov .../dts/renesas/r8a7795-es1-h3ulcb-had-alfa.dts | 22 + .../dts/renesas/r8a7795-es1-h3ulcb-had-beta.dts | 23 + .../boot/dts/renesas/r8a7795-es1-h3ulcb-had.dtsi | 225 +++ - .../boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts | 427 +++++ - .../boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts | 1659 ++++++++++++++++++ + .../boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts | 451 +++++ + .../boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts | 1673 ++++++++++++++++++ .../boot/dts/renesas/r8a7795-es1-h3ulcb-vb.dts | 1787 ++++++++++++++++++++ .../boot/dts/renesas/r8a7795-es1-h3ulcb-view.dts | 546 ++++++ .../dts/renesas/r8a7795-es1-salvator-x-view.dts | 552 ++++++ .../boot/dts/renesas/r8a7795-h3ulcb-had-alfa.dts | 22 + .../boot/dts/renesas/r8a7795-h3ulcb-had-beta.dts | 23 + .../arm64/boot/dts/renesas/r8a7795-h3ulcb-had.dtsi | 219 +++ - .../boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts | 427 +++++ - arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts | 1655 ++++++++++++++++++ + .../boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts | 451 +++++ + arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts | 1669 ++++++++++++++++++ arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-vb.dts | 1787 ++++++++++++++++++++ .../arm64/boot/dts/renesas/r8a7795-h3ulcb-view.dts | 546 ++++++ .../boot/dts/renesas/r8a7795-salvator-x-view.dts | 552 ++++++ - .../boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts | 427 +++++ - arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts | 1242 ++++++++++++++ + .../boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts | 451 +++++ + arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts | 1256 ++++++++++++++ .../arm64/boot/dts/renesas/r8a7796-m3ulcb-view.dts | 287 ++++ .../boot/dts/renesas/r8a7796-salvator-x-view.dts | 318 ++++ + arch/arm64/boot/dts/renesas/ulcb-kf-cmos.dtsi | 75 + arch/arm64/boot/dts/renesas/ulcb-kf-rpi.dtsi | 75 + arch/arm64/boot/dts/renesas/ulcb-kf-sd3.dtsi | 33 + arch/arm64/boot/dts/renesas/ulcb-vb-cn12.dtsi | 515 ++++++ - 24 files changed, 13383 insertions(+) + 25 files changed, 13572 insertions(+) create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-had-alfa.dts create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-had-beta.dts create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-had.dtsi @@ -64,6 +65,7 @@ Signed-off-by: Vladimir Barinov create mode 100644 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts create mode 100644 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-view.dts create mode 100644 arch/arm64/boot/dts/renesas/r8a7796-salvator-x-view.dts + create mode 100644 arch/arm64/boot/dts/renesas/ulcb-kf-cmos.dtsi create mode 100644 arch/arm64/boot/dts/renesas/ulcb-kf-rpi.dtsi create mode 100644 arch/arm64/boot/dts/renesas/ulcb-kf-sd3.dtsi create mode 100644 arch/arm64/boot/dts/renesas/ulcb-vb-cn12.dtsi @@ -382,10 +384,10 @@ index 0000000..d50ff7a +}; diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts new file mode 100644 -index 0000000..9b76ca9 +index 0000000..f0e5ecc --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts -@@ -0,0 +1,439 @@ +@@ -0,0 +1,451 @@ +/* + * Device Tree Source for the H3ULCB Kingfisher V1 board on r8a7795 ES1.x + * @@ -746,6 +748,18 @@ index 0000000..9b76ca9 + output-high; + line-name = "Video-A A1"; + }; ++ cmos_pwdn { ++ gpio-hog; ++ gpios = <8 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS PWDN"; ++ }; ++ cmos_rst { ++ gpio-hog; ++ gpios = <9 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS RST"; ++ }; + /* pin 12 - CAM_CLK */ + rpi_cam_io_1 { + gpio-hog; @@ -827,10 +841,10 @@ index 0000000..9b76ca9 +}; diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts new file mode 100644 -index 0000000..90be9f8 +index 0000000..549659b --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts -@@ -0,0 +1,1659 @@ +@@ -0,0 +1,1673 @@ +/* + * Device Tree Source for the H3ULCB Kingfisher board on r8a7795 ES1.x + * @@ -1346,6 +1360,18 @@ index 0000000..90be9f8 + interrupt-parent = <&gpio7>; + interrupts = <3 IRQ_TYPE_EDGE_FALLING>; + ++ cmos_pwdn { ++ gpio-hog; ++ gpios = <8 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS PWDN"; ++ }; ++ cmos_rst { ++ gpio-hog; ++ gpios = <9 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS RST"; ++ }; + /* pin 12 - CAM_CLK */ + rpi_cam_io_1 { + gpio-hog; @@ -2490,6 +2516,8 @@ index 0000000..90be9f8 +//#include "ulcb-kf-rpi.dtsi" +/* uncomment to enable CN47: SD on SDHI3 */ +//#include "ulcb-kf-sd3.dtsi" ++/* uncomment to override CN29 (CMOS camera) on VIN5 */ ++//#include "ulcb-kf-cmos.dtsi" diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-vb.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-vb.dts new file mode 100644 index 0000000..0e6ea57 @@ -5677,10 +5705,10 @@ index 0000000..4a00426 +}; diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts new file mode 100644 -index 0000000..7bcd87d +index 0000000..afa71bd --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts -@@ -0,0 +1,439 @@ +@@ -0,0 +1,451 @@ +/* + * Device Tree Source for the H3ULCB Kingfisher V1 board + * @@ -6041,6 +6069,18 @@ index 0000000..7bcd87d + output-high; + line-name = "Video-A A1"; + }; ++ cmos_pwdn { ++ gpio-hog; ++ gpios = <8 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS PWDN"; ++ }; ++ cmos_rst { ++ gpio-hog; ++ gpios = <9 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS RST"; ++ }; + /* pin 12 - CAM_CLK */ + rpi_cam_io_1 { + gpio-hog; @@ -6122,10 +6162,10 @@ index 0000000..7bcd87d +}; diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts new file mode 100644 -index 0000000..e3a5f03 +index 0000000..58c5dcb --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts -@@ -0,0 +1,1655 @@ +@@ -0,0 +1,1669 @@ +/* + * Device Tree Source for the H3ULCB Kingfisher board on r8a7795 + * @@ -6641,6 +6681,18 @@ index 0000000..e3a5f03 + interrupt-parent = <&gpio7>; + interrupts = <3 IRQ_TYPE_EDGE_FALLING>; + ++ cmos_pwdn { ++ gpio-hog; ++ gpios = <8 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS PWDN"; ++ }; ++ cmos_rst { ++ gpio-hog; ++ gpios = <9 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS RST"; ++ }; + /* pin 12 - CAM_CLK */ + rpi_cam_io_1 { + gpio-hog; @@ -7781,6 +7833,8 @@ index 0000000..e3a5f03 +//#include "ulcb-kf-rpi.dtsi" +/* uncomment to enable CN47: SD on SDHI3 */ +//#include "ulcb-kf-sd3.dtsi" ++/* uncomment to override CN29 (CMOS camera) on VIN5 */ ++//#include "ulcb-kf-cmos.dtsi" diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-vb.dts b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-vb.dts new file mode 100644 index 0000000..a26689c @@ -10686,10 +10740,10 @@ index 0000000..fb12a39f3 +}; diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts new file mode 100644 -index 0000000..e3b1ec3 +index 0000000..63cf414 --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts -@@ -0,0 +1,439 @@ +@@ -0,0 +1,451 @@ +/* + * Device Tree Source for the M3ULCB Kingfisher V1 board + * @@ -11050,6 +11104,18 @@ index 0000000..e3b1ec3 + output-high; + line-name = "Video-A A1"; + }; ++ cmos_pwdn { ++ gpio-hog; ++ gpios = <8 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS PWDN"; ++ }; ++ cmos_rst { ++ gpio-hog; ++ gpios = <9 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS RST"; ++ }; + /* pin 12 - CAM_CLK */ + rpi_cam_io_1 { + gpio-hog; @@ -11131,10 +11197,10 @@ index 0000000..e3b1ec3 +}; diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts new file mode 100644 -index 0000000..5199531 +index 0000000..1e4b32a --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts -@@ -0,0 +1,1242 @@ +@@ -0,0 +1,1256 @@ +/* + * Device Tree Source for the M3ULCB Kingfisher board on r8a7796 + * @@ -11650,6 +11716,18 @@ index 0000000..5199531 + interrupt-parent = <&gpio7>; + interrupts = <3 IRQ_TYPE_EDGE_FALLING>; + ++ cmos_pwdn { ++ gpio-hog; ++ gpios = <8 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS PWDN"; ++ }; ++ cmos_rst { ++ gpio-hog; ++ gpios = <9 GPIO_ACTIVE_HIGH>; ++ output-high; ++ line-name = "CMOS RST"; ++ }; + /* pin 12 - CAM_CLK */ + rpi_cam_io_1 { + gpio-hog; @@ -12377,6 +12455,8 @@ index 0000000..5199531 + +/* uncomment to enable CN47: SD on SDHI3 */ +//#include "ulcb-kf-sd3.dtsi" ++/* CN29: (CMOS camera) on VIN5 */ ++#include "ulcb-kf-cmos.dtsi" diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-view.dts b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-view.dts new file mode 100644 index 0000000..1ac0041 @@ -12994,6 +13074,87 @@ index 0000000..cc6866c + pinctrl-names = "default"; + status = "okay"; +}; +diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf-cmos.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf-cmos.dtsi +new file mode 100644 +index 0000000..2145f5e +--- /dev/null ++++ b/arch/arm64/boot/dts/renesas/ulcb-kf-cmos.dtsi +@@ -0,0 +1,75 @@ ++/* ++ * Device Tree Source for the H3ULCB Kingfisher board: ++ * this adding conflicting resource on VIN5 for CMOS camera ++ * ++ * Copyright (C) 2017 Renesas Electronics Corp. ++ * Copyright (C) 2017 Cogent Embedded, Inc. ++ * ++ * This file is licensed under the terms of the GNU General Public License ++ * version 2. This program is licensed "as is" without any warranty of any ++ * kind, whether express or implied. ++ */ ++ ++/ { ++ camera_clk: camera_clk { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <24000000>; ++ clock-output-names = "mclk"; ++ }; ++}; ++ ++&pfc { ++ vin5_pins: vin5 { ++ groups = "vin5_data8", "vin5_sync", "vin5_clk"; ++ function = "vin5"; ++ }; ++}; ++ ++&i2cswitch4 { ++ i2c@5 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <5>; ++ ++ cmos_camera: ov5642@3c { ++ compatible = "ovti,ov5642"; ++ reg = <0x3c>; ++ clocks = <&camera_clk>; ++ clock-names = "mclk"; ++ ++ port@0 { ++ cmos_camera_in: endpoint { ++ remote-endpoint = <&vin5ep0>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&vin5 { ++ pinctrl-0 = <&vin5_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ vin5ep0: endpoint@0 { ++ /delete-property/csi,select; ++ /delete-property/virtual,channel; ++ /delete-property/data-lanes; ++ bus-width = <8>; ++ /* #HSYNC, #VSYNC */ ++ vsync-active = <1>; ++ hsync-active = <0>; ++ remote-endpoint = <&cmos_camera_in>; ++ }; ++ }; ++ port@1 { ++ /delete-node/endpoint; ++ }; ++ }; ++}; diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf-rpi.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf-rpi.dtsi new file mode 100644 index 0000000..d3b4ece diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0060-media-i2c-Add-ov5647-sensor.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0060-media-i2c-Add-ov5647-sensor.patch deleted file mode 100644 index 1cd366c..0000000 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0060-media-i2c-Add-ov5647-sensor.patch +++ /dev/null @@ -1,952 +0,0 @@ -From 8b97232e3ecbb4ee38bda454915e62914ef52fcc Mon Sep 17 00:00:00 2001 -From: Vladimir Barinov -Date: Thu, 1 Jun 2017 19:59:56 +0300 -Subject: [PATCH] media: i2c: Add ov5647 sensor - -Add ov5647 camera sensor driver - -Signed-off-by: Vladimir Barinov ---- - drivers/media/i2c/soc_camera/Kconfig | 6 + - drivers/media/i2c/soc_camera/Makefile | 1 + - drivers/media/i2c/soc_camera/ov5647.c | 649 ++++++++++++++++++++++++++++++++++ - drivers/media/i2c/soc_camera/ov5647.h | 242 +++++++++++++ - 4 files changed, 898 insertions(+) - create mode 100644 drivers/media/i2c/soc_camera/ov5647.c - create mode 100644 drivers/media/i2c/soc_camera/ov5647.h - -diff --git a/drivers/media/i2c/soc_camera/Kconfig b/drivers/media/i2c/soc_camera/Kconfig -index e1c65ca..c272aeb 100644 ---- a/drivers/media/i2c/soc_camera/Kconfig -+++ b/drivers/media/i2c/soc_camera/Kconfig -@@ -97,6 +97,12 @@ config SOC_CAMERA_OV5642 - help - This is a V4L2 camera driver for the OmniVision OV5642 sensor - -+config SOC_CAMERA_OV5647 -+ tristate "ov5647 camera support" -+ depends on SOC_CAMERA && I2C -+ help -+ This is a V4L2 camera driver for the OmniVision OV5647 sensor -+ - config SOC_CAMERA_OV6650 - tristate "ov6650 sensor support" - depends on SOC_CAMERA && I2C -diff --git a/drivers/media/i2c/soc_camera/Makefile b/drivers/media/i2c/soc_camera/Makefile -index 8e24d5d..a67fff8 100644 ---- a/drivers/media/i2c/soc_camera/Makefile -+++ b/drivers/media/i2c/soc_camera/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_SOC_CAMERA_OV495_OV2775) += ov495_ov2775.o - obj-$(CONFIG_SOC_CAMERA_OV106XX) += ov106xx.o - obj-$(CONFIG_SOC_CAMERA_OV2640) += ov2640.o - obj-$(CONFIG_SOC_CAMERA_OV5642) += ov5642.o -+obj-$(CONFIG_SOC_CAMERA_OV5647) += ov5647.o - obj-$(CONFIG_SOC_CAMERA_OV6650) += ov6650.o - obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o - obj-$(CONFIG_SOC_CAMERA_OV9640) += ov9640.o -diff --git a/drivers/media/i2c/soc_camera/ov5647.c b/drivers/media/i2c/soc_camera/ov5647.c -new file mode 100644 -index 0000000..caccf39 ---- /dev/null -+++ b/drivers/media/i2c/soc_camera/ov5647.c -@@ -0,0 +1,649 @@ -+/* -+ * V4L2 driver for OmniVision OV5647 cameras. -+ * -+ * Based on Samsung S5K6AAFX SXGA 1/6" 1.3M CMOS Image Sensor driver -+ * Copyright (C) 2011 Sylwester Nawrocki -+ * -+ * Based on Omnivision OV7670 Camera Driver -+ * Copyright (C) 2006-7 Jonathan Corbet -+ * -+ * Copyright (C) 2016, Synopsys, Inc. -+ * -+ * Copyright (C) 2017 Cogent Embedded, Inc -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "ov5647.h" -+ -+static bool debug = true; -+module_param(debug, bool, 0644); -+MODULE_PARM_DESC(debug, "Debug level (0-1)"); -+ -+#define OV5647_I2C_ADDR 0x6c -+#define SENSOR_NAME "ov5647" -+ -+#define OV5647_REG_CHIPID_H 0x300A -+#define OV5647_REG_CHIPID_L 0x300B -+ -+#define REG_TERM 0xfffe -+#define VAL_TERM 0xfe -+#define REG_DLY 0xffff -+ -+/*define the voltage level of control signal*/ -+#define CSI_STBY_ON 1 -+#define CSI_STBY_OFF 0 -+#define CSI_RST_ON 0 -+#define CSI_RST_OFF 1 -+#define CSI_PWR_ON 1 -+#define CSI_PWR_OFF 0 -+#define CSI_AF_PWR_ON 1 -+#define CSI_AF_PWR_OFF 0 -+ -+#define OV5647_ROW_START 0x01 -+#define OV5647_ROW_START_MIN 0 -+#define OV5647_ROW_START_MAX 2004 -+#define OV5647_ROW_START_DEF 54 -+ -+#define OV5647_COLUMN_START 0x02 -+#define OV5647_COLUMN_START_MIN 0 -+#define OV5647_COLUMN_START_MAX 2750 -+#define OV5647_COLUMN_START_DEF 16 -+ -+#define OV5647_WINDOW_HEIGHT 0x03 -+#define OV5647_WINDOW_HEIGHT_MIN 2 -+#define OV5647_WINDOW_HEIGHT_MAX 2006 -+#define OV5647_WINDOW_HEIGHT_DEF 1944 -+ -+#define OV5647_WINDOW_WIDTH 0x04 -+#define OV5647_WINDOW_WIDTH_MIN 2 -+#define OV5647_WINDOW_WIDTH_MAX 2752 -+#define OV5647_WINDOW_WIDTH_DEF 2592 -+ -+enum power_seq_cmd { -+ CSI_SUBDEV_PWR_OFF = 0x00, -+ CSI_SUBDEV_PWR_ON = 0x01, -+}; -+ -+struct sensor_format_struct { -+ __u8 *desc; -+ u32 mbus_code; -+ enum v4l2_colorspace colorspace; -+ struct regval_list *regs; -+ int regs_size; -+ int bpp; -+}; -+ -+struct cfg_array { -+ struct regval_list *regs; -+ int size; -+}; -+ -+struct sensor_win_size { -+ int width; -+ int height; -+ unsigned int hoffset; -+ unsigned int voffset; -+ unsigned int hts; -+ unsigned int vts; -+ unsigned int pclk; -+ unsigned int mipi_bps; -+ unsigned int fps_fixed; -+ unsigned int bin_factor; -+ unsigned int intg_min; -+ unsigned int intg_max; -+ void *regs; -+ int regs_size; -+ int (*set_size)(struct v4l2_subdev *subdev); -+}; -+ -+struct ov5647 { -+ struct device *dev; -+ struct v4l2_subdev subdev; -+ struct media_pad pad; -+ struct mutex lock; -+ struct v4l2_mbus_framefmt format; -+ struct sensor_format_struct *fmt; -+ unsigned int width; -+ unsigned int height; -+ unsigned int capture_mode; -+ int hue; -+ struct v4l2_fract tpf; -+ struct sensor_win_size *current_wins; -+}; -+ -+static inline struct ov5647 *to_state(struct v4l2_subdev *subdev) -+{ -+ return container_of(subdev, struct ov5647, subdev); -+} -+ -+static struct sensor_format_struct sensor_formats[] = { -+ { -+ .mbus_code = OV5647_CODE, -+ .colorspace = V4L2_COLORSPACE_JPEG, -+ }, -+}; -+#define N_FMTS ARRAY_SIZE(sensor_formats) -+ -+static int ov5647_write(struct v4l2_subdev *sd, uint16_t reg, uint8_t val) -+{ -+ int ret; -+ unsigned char data[3] = { reg >> 8, reg & 0xff, val}; -+ struct i2c_client *client = v4l2_get_subdevdata(sd); -+ -+ ret = i2c_master_send(client, data, 3); -+ if (ret < 3) { -+ printk( "%s: i2c write error, reg: %x, %d\n", -+ __func__, reg, ret); -+ return ret < 0 ? ret : -EIO; -+ } -+ -+ return 0; -+} -+ -+static int ov5647_read(struct v4l2_subdev *sd, uint16_t reg, uint8_t *val) -+{ -+ int ret; -+ unsigned char data_w[2] = { reg >> 8, reg & 0xff }; -+ struct i2c_client *client = v4l2_get_subdevdata(sd); -+ -+ -+ ret = i2c_master_send(client, data_w, 2); -+ -+ if (ret < 2) { -+ printk("%s: i2c read error, reg: %x\n", -+ __func__, reg); -+ return ret < 0 ? ret : -EIO; -+ } -+ -+ ret = i2c_master_recv(client, val, 1); -+ -+ if (ret < 1) { -+ printk("%s: i2c read error, reg: %x\n", -+ __func__, reg); -+ return ret < 0 ? ret : -EIO; -+ } -+ -+ return 0; -+} -+ -+static int ov5647_write_array(struct v4l2_subdev *subdev, -+ struct regval_list *regs, int array_size) -+{ -+ int i = 0; -+ int ret = 0; -+ -+ if (!regs) -+ return -EINVAL; -+ -+ while (i < array_size) { -+ if (regs->addr == REG_DLY) -+ mdelay(regs->data); -+ else -+ ret = ov5647_write(subdev, regs->addr, regs->data); -+ -+ if (ret == -EIO) -+ return ret; -+ -+ i++; -+ regs++; -+ } -+ return 0; -+} -+ -+static void ov5647_set_virtual_channel(struct v4l2_subdev *subdev, int channel) -+{ -+#if 0 -+ u8 channel_id; -+ -+ ov5647_read(subdev, 0x4814, &channel_id); -+// channel_id = 0x1e; //override -+ -+ channel_id &= ~(3 << 6); -+ channel_id |= (channel << 6); -+ printk("0x4814 = 0x%02x\n", channel_id); -+ ov5647_write(subdev, 0x4814, channel_id); -+ ov5647_write(subdev, 0x4801, 0x8f); -+#endif -+} -+ -+void ov5647_stream_on(struct v4l2_subdev *subdev) -+{ -+ ov5647_write(subdev, 0x4202, 0x00); -+ ov5647_write(subdev, 0x300D, 0x00); -+} -+ -+void ov5647_stream_off(struct v4l2_subdev *subdev) -+{ -+ ov5647_write(subdev, 0x4202, 0x0f); -+ ov5647_write(subdev, 0x300D, 0x01); -+} -+ -+static int sensor_s_sw_stby(struct v4l2_subdev *subdev, int on_off) -+{ -+ int ret; -+ unsigned char rdval; -+ -+ ret = ov5647_read(subdev, 0x0100, &rdval); -+ if (ret != 0) -+ return ret; -+ -+ if (on_off == CSI_STBY_ON) -+ ret = ov5647_write(subdev, 0x0100, rdval&0xfe); -+ else -+ ret = ov5647_write(subdev, 0x0100, rdval|0x01); -+ -+ return ret; -+} -+ -+static int __sensor_init(struct v4l2_subdev *subdev) -+{ -+ int ret; -+ unsigned char rdval; -+ -+ ret = ov5647_read(subdev, 0x0100, &rdval); -+ if (ret != 0) -+ return ret; -+ -+ ov5647_write(subdev, 0x4800, 0x25); -+ ov5647_stream_off(subdev); -+ -+ ov5647_write(subdev, 0x100, 0); -+ /* reset */ -+ ov5647_write(subdev, 0x103, 1); -+ ov5647_write(subdev, 0x103, 1); -+ ov5647_write(subdev, 0x103, 1); -+ mdelay(10); -+ -+ ret = ov5647_write_array(subdev, ov5647_recommend_settings, -+ ARRAY_SIZE(ov5647_recommend_settings)); -+#if 1 -+ ret = ov5647_write_array(subdev, ov5647_snap_settings, -+ ARRAY_SIZE(ov5647_snap_settings)); -+#else -+ ret = ov5647_write_array(subdev, ov5647_prev_settings, -+ ARRAY_SIZE(ov5647_prev_settings)); -+#endif -+ ov5647_set_virtual_channel(subdev, 0); -+ -+ ov5647_write(subdev, 0x0100, 0x01); -+ -+ ov5647_write(subdev, 0x04800, 0x04); -+ ov5647_stream_on(subdev); -+ msleep(30); -+ -+ return 0; -+} -+ -+static int sensor_power(struct v4l2_subdev *subdev, int on) -+{ -+ int ret = 0; -+ struct ov5647 *ov5647 = to_state(subdev); -+ -+ mutex_lock(&ov5647->lock); -+ -+ switch (on) { -+ case CSI_SUBDEV_PWR_OFF: -+ ret = sensor_s_sw_stby(subdev, CSI_STBY_ON); -+ if (ret < 0) -+ printk("soft stby failed!\n"); -+ break; -+ case CSI_SUBDEV_PWR_ON: -+ ret = __sensor_init(subdev); -+ if (ret < 0) { -+ v4l2_err(subdev, "Camera not available, check power\n"); -+ break; -+ } -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ mutex_unlock(&ov5647->lock); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_VIDEO_ADV_DEBUG -+static int sensor_get_register(struct v4l2_subdev *subdev, -+ struct v4l2_dbg_register *reg) -+{ -+ u8 val = 0; -+ int ret; -+ -+ ret = ov5647_read(subdev, (u16)reg->reg, &val); -+ if (ret < 0) -+ return ret; -+ -+ reg->val = val; -+ reg->size = sizeof(u8); -+ -+ return ret; -+} -+ -+static int sensor_set_register(struct v4l2_subdev *subdev, -+ const struct v4l2_dbg_register *reg) -+{ -+ ov5647_write(subdev, (u16)reg->reg, (u8)reg->val); -+ -+ return 0; -+} -+#endif -+ -+static const struct v4l2_subdev_core_ops sensor_core_ops = { -+ .s_power = sensor_power, -+#ifdef CONFIG_VIDEO_ADV_DEBUG -+ .g_register = sensor_get_register, -+ .s_register = sensor_set_register, -+#endif -+}; -+ -+static int sensor_s_stream(struct v4l2_subdev *sd, int enable) -+{ -+ if (enable) -+ ov5647_stream_on(sd); -+ else -+ ov5647_stream_off(sd); -+ -+ return 0; -+} -+ -+static int sensor_enum_fmt(struct v4l2_subdev *sd, -+ struct v4l2_subdev_pad_config *cfg, -+ struct v4l2_subdev_mbus_code_enum *code) -+{ -+ if (code->pad || code->index >= N_FMTS) -+ return -EINVAL; -+ -+ code->code = OV5647_CODE; -+ -+ return 0; -+} -+ -+static int sensor_try_fmt_internal(struct v4l2_subdev *subdev, -+ struct v4l2_mbus_framefmt *fmt, -+ struct sensor_format_struct **ret_fmt, -+ struct sensor_win_size **ret_wsize) -+{ -+ int index; -+ -+ for (index = 0; index < N_FMTS; index++) -+ if (sensor_formats[index].mbus_code == fmt->code) -+ break; -+ -+ if (index >= N_FMTS) -+ return -EINVAL; -+ -+ if (ret_fmt != NULL) -+ *ret_fmt = sensor_formats + index; -+ -+ fmt->field = V4L2_FIELD_NONE; -+ -+ return 0; -+} -+ -+static int sensor_s_fmt(struct v4l2_subdev *subdev, -+ struct v4l2_subdev_pad_config *cfg, -+ struct v4l2_subdev_format *fmt) -+{ -+ int ret; -+ struct sensor_format_struct *sensor_fmt; -+ struct sensor_win_size *wsize = NULL; -+ struct ov5647 *info = to_state(subdev); -+ -+ ret = sensor_try_fmt_internal(subdev, &fmt->format, -+ &sensor_fmt, &wsize); -+ if (ret) -+ return ret; -+ -+ info->fmt = sensor_fmt; -+ info->width = OV5647_WIDTH; -+ info->height = OV5647_HEIGHT; -+ -+ return 0; -+} -+ -+static int sensor_g_fmt(struct v4l2_subdev *sd, -+ struct v4l2_subdev_pad_config *cfg, -+ struct v4l2_subdev_format *format) -+{ -+ struct ov5647 *info = to_state(sd); -+ struct v4l2_mbus_framefmt *mf = &format->format; -+ -+ if (format->pad != 0) -+ return -EINVAL; -+ -+ mf->width = OV5647_WIDTH; -+ mf->height = OV5647_HEIGHT; -+ mf->code = OV5647_CODE; -+ mf->colorspace = info->fmt->colorspace; -+ mf->field = V4L2_FIELD_NONE; -+ -+ return 0; -+} -+ -+static int sensor_s_parm(struct v4l2_subdev *subdev, -+ struct v4l2_streamparm *parms) -+{ -+ struct v4l2_captureparm *cp = &parms->parm.capture; -+ struct ov5647 *info = to_state(subdev); -+ -+ if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ if (info->tpf.numerator == 0) -+ return -EINVAL; -+ -+ info->capture_mode = cp->capturemode; -+ -+ return 0; -+} -+ -+static int sensor_g_parm(struct v4l2_subdev *subdev, -+ struct v4l2_streamparm *parms) -+{ -+ struct v4l2_captureparm *cp = &parms->parm.capture; -+ struct ov5647 *info = to_state(subdev); -+ -+ if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ memset(cp, 0, sizeof(struct v4l2_captureparm)); -+ cp->capability = V4L2_CAP_TIMEPERFRAME; -+ cp->capturemode = info->capture_mode; -+ -+ return 0; -+} -+ -+static int sensor_g_mbus_config(struct v4l2_subdev *sd, -+ struct v4l2_mbus_config *cfg) -+{ -+ cfg->flags = V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_CHANNEL_0 | -+ V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; -+ cfg->type = V4L2_MBUS_CSI2; -+ -+ return 0; -+} -+ -+static const struct v4l2_subdev_pad_ops sensor_pad_ops = { -+ .enum_mbus_code = sensor_enum_fmt, -+ .set_fmt = sensor_s_fmt, -+ .get_fmt = sensor_g_fmt, -+}; -+ -+static const struct v4l2_subdev_video_ops sensor_video_ops = { -+ .s_stream = sensor_s_stream, -+ .s_parm = sensor_s_parm, -+ .g_parm = sensor_g_parm, -+ .g_mbus_config = sensor_g_mbus_config, -+}; -+ -+static const struct v4l2_subdev_ops subdev_ops = { -+ .core = &sensor_core_ops, -+ .video = &sensor_video_ops, -+ .pad = &sensor_pad_ops, -+}; -+ -+static int ov5647_detect(struct v4l2_subdev *sd) -+{ -+ struct i2c_client *client = v4l2_get_subdevdata(sd); -+ unsigned char id_h, id_l; -+ int ret; -+ -+ ret = sensor_power(sd, 1); -+ if (ret < 0) -+ return ret; -+ -+ ret = ov5647_read(sd, OV5647_REG_CHIPID_H, &id_h); -+ if (ret < 0) -+ return ret; -+ ret = ov5647_read(sd, OV5647_REG_CHIPID_L, &id_l); -+ if (ret < 0) -+ return ret; -+ -+ if ((id_h != 0x56) || (id_l != 0x47)) { -+ v4l2_info(sd, "Invalid device ID: %02x%02x\n", id_h, id_l); -+ return -ENODEV; -+ } -+ -+ v4l2_info(sd, "OV5647 detected at address 0x%02x\n", client->addr); -+ -+ ret = sensor_power(sd, 0); -+ if (ret < 0) -+ return ret; -+ -+ return 0; -+} -+ -+static int ov5647_registered(struct v4l2_subdev *subdev) -+{ -+ return 0; -+} -+ -+static int ov5647_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh) -+{ -+ struct v4l2_mbus_framefmt *format = -+ v4l2_subdev_get_try_format(subdev, fh->pad, 0); -+ struct v4l2_rect *crop = -+ v4l2_subdev_get_try_crop(subdev, fh->pad, 0); -+ -+ crop->left = 0; -+ crop->top = 0; -+ crop->width = OV5647_WIDTH; -+ crop->height = OV5647_HEIGHT; -+ -+ format->code = OV5647_CODE; -+ -+ format->width = OV5647_WIDTH; -+ format->height = OV5647_HEIGHT; -+ format->field = V4L2_FIELD_NONE; -+ format->colorspace = sensor_formats[0].colorspace; -+ -+ return sensor_power(subdev, 1); -+} -+ -+static int ov5647_close(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh) -+{ -+ return sensor_power(subdev, 0); -+} -+ -+static const struct v4l2_subdev_internal_ops ov5647_subdev_internal_ops = { -+ .registered = ov5647_registered, -+ .open = ov5647_open, -+ .close = ov5647_close, -+}; -+ -+static int ov5647_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct device *dev = &client->dev; -+ struct ov5647 *sensor; -+ int ret = 0; -+ struct v4l2_subdev *sd; -+ -+ sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); -+ if (sensor == NULL) -+ return -ENOMEM; -+ -+ mutex_init(&sensor->lock); -+ sensor->dev = dev; -+ sensor->fmt = &sensor_formats[0]; -+ sensor->width = OV5647_WIDTH; -+ sensor->height = OV5647_HEIGHT; -+ -+ sd = &sensor->subdev; -+ v4l2_i2c_subdev_init(sd, client, &subdev_ops); -+ sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; -+ -+ ret = ov5647_detect(sd); -+ if (ret < 0) { -+ v4l2_err(sd, "OV5647 not found!\n"); -+ goto out; -+ } -+ -+ sensor->pad.flags = MEDIA_PAD_FL_SOURCE; -+ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; -+ ret = media_entity_pads_init(&sd->entity, 1, &sensor->pad); -+ if (ret < 0) -+ return ret; -+ -+ ret = v4l2_async_register_subdev(sd); -+ if (ret < 0) -+ media_entity_cleanup(&sd->entity); -+ -+out: -+ return ret; -+} -+ -+static int ov5647_remove(struct i2c_client *client) -+{ -+ struct v4l2_subdev *subdev = i2c_get_clientdata(client); -+ struct ov5647 *ov5647 = to_state(subdev); -+ -+ v4l2_async_unregister_subdev(&ov5647->subdev); -+ media_entity_cleanup(&ov5647->subdev.entity); -+ v4l2_device_unregister_subdev(subdev); -+ -+ return 0; -+} -+ -+static const struct i2c_device_id ov5647_id[] = { -+ { "ov5647", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, ov5647_id); -+ -+#if IS_ENABLED(CONFIG_OF) -+static const struct of_device_id ov5647_of_match[] = { -+ { .compatible = "ovti,ov5647" }, -+ { /* sentinel */ }, -+}; -+MODULE_DEVICE_TABLE(of, ov5647_of_match); -+#endif -+ -+static struct i2c_driver ov5647_driver = { -+ .driver = { -+ .of_match_table = of_match_ptr(ov5647_of_match), -+ .owner = THIS_MODULE, -+ .name = "ov5647", -+ }, -+ .probe = ov5647_probe, -+ .remove = ov5647_remove, -+ .id_table = ov5647_id, -+}; -+module_i2c_driver(ov5647_driver); -+ -+MODULE_AUTHOR("Ramiro Oliveira "); -+MODULE_DESCRIPTION("A low-level driver for OmniVision ov5647 sensors"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/media/i2c/soc_camera/ov5647.h b/drivers/media/i2c/soc_camera/ov5647.h -new file mode 100644 -index 0000000..f854da8 ---- /dev/null -+++ b/drivers/media/i2c/soc_camera/ov5647.h -@@ -0,0 +1,242 @@ -+/* -+ * Copyright (c) 2012, The Linux Foundation. All rights reserved. -+ * Copyright (C) 2017 Cogent Embedded, Inc -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only version 2 as published by the Free Software Foundation. -+ * -+ * 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. -+ */ -+ -+//#define TEST_PATTERN -+ -+#define OV5647_WIDTH 2592 -+#define OV5647_HEIGHT 1944 -+ -+#define OV5647_CODE MEDIA_BUS_FMT_SBGGR8_1X8 -+//#define OV5647_CODE MEDIA_BUS_FMT_YUYV8_2X8 -+ -+struct regval_list { -+ uint16_t addr; -+ uint8_t data; -+}; -+ -+enum ov5647_test_mode_t { -+ TEST_OFF, -+ TEST_1, -+ TEST_2, -+ TEST_3 -+}; -+ -+struct regval_list ov5647_prev_settings[] = { -+ /*1280*960 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps -+ for back to preview*/ -+ {0x3035, 0x21}, -+ {0x3036, 0x37}, -+ {0x3821, 0x07}, -+ {0x3820, 0x41}, -+ {0x3612, 0x09}, -+ {0x3618, 0x00}, -+ {0x380c, 0x07}, -+ {0x380d, 0x68}, -+ {0x380e, 0x03}, -+ {0x380f, 0xd8}, -+ {0x3814, 0x31}, -+ {0x3815, 0x31}, -+ {0x3709, 0x52}, -+ {0x3808, 0x05}, // 1280 -+ {0x3809, 0x00}, -+ {0x380a, 0x03}, // 960 -+ {0x380b, 0xc0}, -+ {0x3800, 0x00}, -+ {0x3801, 0x18}, -+ {0x3802, 0x00}, -+ {0x3803, 0x0e}, -+ {0x3804, 0x0a}, -+ {0x3805, 0x27}, -+ {0x3806, 0x07}, -+ {0x3807, 0x95}, -+ {0x4004, 0x02}, -+}; -+struct regval_list ov5647_snap_settings[] = { -+ /*2608*1952 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps*/ -+ {0x3035, 0x21}, -+ {0x3036, 0x4f}, -+ {0x3821, 0x06}, -+ {0x3820, 0x00}, -+ {0x3612, 0x0b}, -+ {0x3618, 0x04}, -+ {0x380c, 0x0a}, -+ {0x380d, 0x8c}, -+ {0x380e, 0x07}, -+ {0x380f, 0xb0}, -+ {0x3814, 0x11}, -+ {0x3815, 0x11}, -+ {0x3709, 0x12}, -+#if 0 -+ {0x3808, 0x0a}, -+ {0x3809, 0x30}, -+ {0x380a, 0x07}, -+ {0x380b, 0xa0}, -+#else -+ {0x3808, OV5647_WIDTH >> 8}, -+ {0x3809, OV5647_WIDTH & 0xff}, -+ {0x380a, OV5647_HEIGHT >> 8}, -+ {0x380b, OV5647_HEIGHT & 0xff}, -+#endif -+ {0x3800, 0x00}, -+ {0x3801, 0x04}, -+ {0x3802, 0x00}, -+ {0x3803, 0x00}, -+ {0x3804, 0x0a}, -+ {0x3805, 0x3b}, -+ {0x3806, 0x07}, -+ {0x3807, 0xa3}, -+ {0x4004, 0x04}, -+}; -+struct regval_list ov5647_recommend_settings[] = { -+#ifdef TEST_PATTERN -+ {0x503d, 0x80}, -+#endif -+#if 0 -+ {0x4814, 0x1e}, -+ {0x4801, 0x8f}, -+#endif -+ {0x3035, 0x11}, -+ {0x303c, 0x11}, -+ {0x370c, 0x03}, -+ {0x5000, 0x06}, -+ {0x5003, 0x08}, -+ {0x5a00, 0x08}, -+ {0x3000, 0xff}, -+ {0x3001, 0xff}, -+ {0x3002, 0xff}, -+ {0x301d, 0xf0}, -+ {0x3a18, 0x00}, -+ {0x3a19, 0xf8}, -+ {0x3c01, 0x80}, -+ {0x3b07, 0x0c}, -+ {0x3708, 0x64}, -+ {0x3630, 0x2e}, -+ {0x3632, 0xe2}, -+ {0x3633, 0x23}, -+ {0x3634, 0x44}, -+ {0x3620, 0x64}, -+ {0x3621, 0xe0}, -+ {0x3600, 0x37}, -+ {0x3704, 0xa0}, -+ {0x3703, 0x5a}, -+ {0x3715, 0x78}, -+ {0x3717, 0x01}, -+ {0x3731, 0x02}, -+ {0x370b, 0x60}, -+ {0x3705, 0x1a}, -+ {0x3f05, 0x02}, -+ {0x3f06, 0x10}, -+ {0x3f01, 0x0a}, -+ {0x3a08, 0x01}, -+ {0x3a0f, 0x58}, -+ {0x3a10, 0x50}, -+ {0x3a1b, 0x58}, -+ {0x3a1e, 0x50}, -+ {0x3a11, 0x60}, -+ {0x3a1f, 0x28}, -+ {0x4001, 0x02}, -+ {0x4000, 0x09}, -+ {0x3000, 0x00}, -+ {0x3001, 0x00}, -+ {0x3002, 0x00}, -+ {0x3017, 0xe0}, -+ {0x301c, 0xfc}, -+ {0x3636, 0x06}, -+ {0x3016, 0x08}, -+ {0x3827, 0xec}, -+ {0x3018, 0x44}, -+ {0x3035, 0x21}, -+ {0x3106, 0xf5}, -+ {0x3034, 0x18}, -+ {0x301c, 0xf8}, -+ /*lens setting*/ -+ {0x5000, 0x86}, -+ {0x5800, 0x11}, -+ {0x5801, 0x0c}, -+ {0x5802, 0x0a}, -+ {0x5803, 0x0b}, -+ {0x5804, 0x0d}, -+ {0x5805, 0x13}, -+ {0x5806, 0x09}, -+ {0x5807, 0x05}, -+ {0x5808, 0x03}, -+ {0x5809, 0x03}, -+ {0x580a, 0x06}, -+ {0x580b, 0x08}, -+ {0x580c, 0x05}, -+ {0x580d, 0x01}, -+ {0x580e, 0x00}, -+ {0x580f, 0x00}, -+ {0x5810, 0x02}, -+ {0x5811, 0x06}, -+ {0x5812, 0x05}, -+ {0x5813, 0x01}, -+ {0x5814, 0x00}, -+ {0x5815, 0x00}, -+ {0x5816, 0x02}, -+ {0x5817, 0x06}, -+ {0x5818, 0x09}, -+ {0x5819, 0x05}, -+ {0x581a, 0x04}, -+ {0x581b, 0x04}, -+ {0x581c, 0x06}, -+ {0x581d, 0x09}, -+ {0x581e, 0x11}, -+ {0x581f, 0x0c}, -+ {0x5820, 0x0b}, -+ {0x5821, 0x0b}, -+ {0x5822, 0x0d}, -+ {0x5823, 0x13}, -+ {0x5824, 0x22}, -+ {0x5825, 0x26}, -+ {0x5826, 0x26}, -+ {0x5827, 0x24}, -+ {0x5828, 0x24}, -+ {0x5829, 0x24}, -+ {0x582a, 0x22}, -+ {0x582b, 0x20}, -+ {0x582c, 0x22}, -+ {0x582d, 0x26}, -+ {0x582e, 0x22}, -+ {0x582f, 0x22}, -+ {0x5830, 0x42}, -+ {0x5831, 0x22}, -+ {0x5832, 0x02}, -+ {0x5833, 0x24}, -+ {0x5834, 0x22}, -+ {0x5835, 0x22}, -+ {0x5836, 0x22}, -+ {0x5837, 0x26}, -+ {0x5838, 0x42}, -+ {0x5839, 0x26}, -+ {0x583a, 0x06}, -+ {0x583b, 0x26}, -+ {0x583c, 0x24}, -+ {0x583d, 0xce}, -+ /* manual AWB,manual AE,close Lenc,open WBC*/ -+ {0x3503, 0x03}, /*manual AE*/ -+ {0x3501, 0x10}, -+ {0x3502, 0x80}, -+ {0x350a, 0x00}, -+ {0x350b, 0x7f}, -+ {0x5001, 0x01}, /*manual AWB*/ -+ {0x5180, 0x08}, -+ {0x5186, 0x04}, -+ {0x5187, 0x00}, -+ {0x5188, 0x04}, -+ {0x5189, 0x00}, -+ {0x518a, 0x04}, -+ {0x518b, 0x00}, -+ {0x5000, 0x06}, /*No lenc,WBC on*/ -+}; --- -1.9.1 - diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg index d579aeb..0b3a4bd 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg @@ -31,6 +31,7 @@ CONFIG_SOC_CAMERA_TI964_TI9X3=y CONFIG_SOC_CAMERA_TI954_TI9X3=y CONFIG_SOC_CAMERA_OV106XX=y CONFIG_SOC_CAMERA_OV5647=y +CONFIG_SOC_CAMERA_OV5642=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_PLATFORM=y CONFIG_USB_XHCI_RCAR=y -- cgit 1.2.3-korg