From 0ae24c08919a48946c7a91762938ef2888d9ab90 Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Tue, 13 Nov 2018 02:06:40 +0300
Subject: [PATCH 082/122] lvds: add AR0323 imager

This adds AR0323 imager support

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/media/i2c/soc_camera/ar0323.c  |  581 ++++++++++++++
 drivers/media/i2c/soc_camera/ar0323.h  | 1335 ++++++++++++++++++++++++++++++++
 drivers/media/i2c/soc_camera/ov106xx.c |   13 +-
 3 files changed, 1928 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/i2c/soc_camera/ar0323.c
 create mode 100644 drivers/media/i2c/soc_camera/ar0323.h

diff --git a/drivers/media/i2c/soc_camera/ar0323.c b/drivers/media/i2c/soc_camera/ar0323.c
new file mode 100644
index 0000000..467367b
--- /dev/null
+++ b/drivers/media/i2c/soc_camera/ar0323.c
@@ -0,0 +1,581 @@
+/*
+ * ON Semiconductor AR0323 sensor camera driver
+ *
+ * Copyright (C) 2018 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 as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/of_graph.h>
+#include <linux/videodev2.h>
+
+#include <media/soc_camera.h>
+#include <media/v4l2-common.h>
+#include <media/v4l2-ctrls.h>
+
+#include "ar0323.h"
+
+#define AR0323_I2C_ADDR		0x10
+
+#define AR0323_PID		0x3000
+#define AR0323_VERSION_REG	0x0D56
+
+#define AR0323_MEDIA_BUS_FMT	MEDIA_BUS_FMT_SGRBG12_1X12
+
+struct ar0323_priv {
+	struct v4l2_subdev		sd;
+	struct v4l2_ctrl_handler	hdl;
+	struct media_pad		pad;
+	struct v4l2_rect		rect;
+	int				init_complete;
+	u8				id[6];
+	/* serializers */
+	int				ti9x4_addr;
+	int				ti9x3_addr;
+	int				port;
+	int				gpio_resetb;
+	int				gpio_fsin;
+};
+
+static inline struct ar0323_priv *to_ar0323(const struct i2c_client *client)
+{
+	return container_of(i2c_get_clientdata(client), struct ar0323_priv, sd);
+}
+
+static int ar0323_set_regs(struct i2c_client *client,
+			  const struct ar0323_reg *regs, int nr_regs)
+{
+	int i;
+
+	for (i = 0; i < nr_regs; i++) {
+		if (regs[i].reg == AR0323_DELAY) {
+			mdelay(regs[i].val);
+			continue;
+		}
+
+		reg16_write16(client, regs[i].reg, regs[i].val);
+	}
+
+	return 0;
+}
+
+static int ar0323_s_stream(struct v4l2_subdev *sd, int enable)
+{
+	return 0;
+}
+
+static int ar0323_get_fmt(struct v4l2_subdev *sd,
+			 struct v4l2_subdev_pad_config *cfg,
+			 struct v4l2_subdev_format *format)
+{
+	struct v4l2_mbus_framefmt *mf = &format->format;
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+	struct ar0323_priv *priv = to_ar0323(client);
+
+	if (format->pad)
+		return -EINVAL;
+
+	mf->width = priv->rect.width;
+	mf->height = priv->rect.height;
+	mf->code = AR0323_MEDIA_BUS_FMT;
+	mf->colorspace = V4L2_COLORSPACE_SMPTE170M;
+	mf->field = V4L2_FIELD_NONE;
+
+	return 0;
+}
+
+static int ar0323_set_fmt(struct v4l2_subdev *sd,
+			 struct v4l2_subdev_pad_config *cfg,
+			 struct v4l2_subdev_format *format)
+{
+	struct v4l2_mbus_framefmt *mf = &format->format;
+
+	mf->code = AR0323_MEDIA_BUS_FMT;
+	mf->colorspace = V4L2_COLORSPACE_SMPTE170M;
+	mf->field = V4L2_FIELD_NONE;
+
+	if (format->which == V4L2_SUBDEV_FORMAT_TRY)
+		cfg->try_fmt = *mf;
+
+	return 0;
+}
+
+static int ar0323_enum_mbus_code(struct v4l2_subdev *sd,
+				struct v4l2_subdev_pad_config *cfg,
+				struct v4l2_subdev_mbus_code_enum *code)
+{
+	if (code->pad || code->index > 0)
+		return -EINVAL;
+
+	code->code = AR0323_MEDIA_BUS_FMT;
+
+	return 0;
+}
+
+static int ar0323_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+	struct ar0323_priv *priv = to_ar0323(client);
+
+	memcpy(edid->edid, priv->id, 6);
+
+	edid->edid[6] = 0xff;
+	edid->edid[7] = client->addr;
+	edid->edid[8] = AR0323_VERSION_REG >> 8;
+	edid->edid[9] = AR0323_VERSION_REG & 0xff;
+
+	return 0;
+}
+
+static int ar0323_set_selection(struct v4l2_subdev *sd,
+			       struct v4l2_subdev_pad_config *cfg,
+			       struct v4l2_subdev_selection *sel)
+{
+	struct v4l2_rect *rect = &sel->r;
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+	struct ar0323_priv *priv = to_ar0323(client);
+
+	if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE ||
+	    sel->target != V4L2_SEL_TGT_CROP)
+		return -EINVAL;
+
+	rect->left = ALIGN(rect->left, 2);
+	rect->top = ALIGN(rect->top, 2);
+	rect->width = ALIGN(rect->width, 2);
+	rect->height = ALIGN(rect->height, 2);
+
+	if ((rect->left + rect->width > AR0323_MAX_WIDTH) ||
+	    (rect->top + rect->height > AR0323_MAX_HEIGHT))
+		*rect = priv->rect;
+
+	priv->rect.left = rect->left;
+	priv->rect.top = rect->top;
+	priv->rect.width = rect->width;
+	priv->rect.height = rect->height;
+
+	return 0;
+}
+
+static int ar0323_get_selection(struct v4l2_subdev *sd,
+			       struct v4l2_subdev_pad_config *cfg,
+			       struct v4l2_subdev_selection *sel)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+	struct ar0323_priv *priv = to_ar0323(client);
+
+	if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE)
+		return -EINVAL;
+
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+		sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.width = AR0323_MAX_WIDTH;
+		sel->r.height = AR0323_MAX_HEIGHT;
+		return 0;
+	case V4L2_SEL_TGT_CROP_DEFAULT:
+		sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.width = AR0323_MAX_WIDTH;
+		sel->r.height = AR0323_MAX_HEIGHT;
+		return 0;
+	case V4L2_SEL_TGT_CROP:
+		sel->r = priv->rect;
+		return 0;
+	default:
+		return -EINVAL;
+	}
+}
+
+static int ar0323_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;
+}
+
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+static int ar0323_g_register(struct v4l2_subdev *sd,
+			    struct v4l2_dbg_register *reg)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+	int ret;
+	u16 val = 0;
+
+	ret = reg16_read16(client, (u16)reg->reg, &val);
+	if (ret < 0)
+		return ret;
+
+	reg->val = val;
+	reg->size = sizeof(u16);
+
+	return 0;
+}
+
+static int ar0323_s_register(struct v4l2_subdev *sd,
+			    const struct v4l2_dbg_register *reg)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+
+	return reg16_write16(client, (u16)reg->reg, (u16)reg->val);
+}
+#endif
+
+static struct v4l2_subdev_core_ops ar0323_core_ops = {
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+	.g_register = ar0323_g_register,
+	.s_register = ar0323_s_register,
+#endif
+};
+
+static int ar0323_s_ctrl(struct v4l2_ctrl *ctrl)
+{
+	struct v4l2_subdev *sd = to_sd(ctrl);
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+	struct ar0323_priv *priv = to_ar0323(client);
+	int ret = -EINVAL;
+	u16 val = 0;
+
+	if (!priv->init_complete)
+		return 0;
+
+	switch (ctrl->id) {
+	case V4L2_CID_BRIGHTNESS:
+	case V4L2_CID_CONTRAST:
+	case V4L2_CID_SATURATION:
+	case V4L2_CID_HUE:
+	case V4L2_CID_GAMMA:
+	case V4L2_CID_SHARPNESS:
+	case V4L2_CID_AUTOGAIN:
+		break;
+	case V4L2_CID_GAIN:
+		/* Digital gain */
+		ret = reg16_write16(client, 0x3308, ctrl->val);
+		break;
+	case V4L2_CID_ANALOGUE_GAIN:
+		/* Analog gain */
+		ret = reg16_write16(client, 0x3366, (ctrl->val << 8) | (ctrl->val << 4) | ctrl->val);
+		break;
+	case V4L2_CID_EXPOSURE:
+		/* T1 exposure */
+		ret = reg16_write16(client, 0x3012, ctrl->val);
+		break;
+	case V4L2_CID_HFLIP:
+		ret = reg16_read16(client, 0x3040, &val);
+		if (ctrl->val)
+			val |= (1 << 14);
+		else
+			val &= ~(1 << 14);
+		ret |= reg16_write16(client, 0x3040, val);
+		break;
+	case V4L2_CID_VFLIP:
+		ret = reg16_read16(client, 0x3040, &val);
+		if (ctrl->val)
+			val |= (1 << 15);
+		else
+			val &= ~(1 << 15);
+		ret |= reg16_write16(client, 0x3040, val);
+		break;
+	case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
+		ret = 0;
+		break;
+	}
+
+	return ret;
+}
+
+static const struct v4l2_ctrl_ops ar0323_ctrl_ops = {
+	.s_ctrl = ar0323_s_ctrl,
+};
+
+static struct v4l2_subdev_video_ops ar0323_video_ops = {
+	.s_stream	= ar0323_s_stream,
+	.g_mbus_config	= ar0323_g_mbus_config,
+};
+
+static const struct v4l2_subdev_pad_ops ar0323_subdev_pad_ops = {
+	.get_edid	= ar0323_get_edid,
+	.enum_mbus_code	= ar0323_enum_mbus_code,
+	.get_selection	= ar0323_get_selection,
+	.set_selection	= ar0323_set_selection,
+	.get_fmt	= ar0323_get_fmt,
+	.set_fmt	= ar0323_set_fmt,
+};
+
+static struct v4l2_subdev_ops ar0323_subdev_ops = {
+	.core	= &ar0323_core_ops,
+	.video	= &ar0323_video_ops,
+	.pad	= &ar0323_subdev_pad_ops,
+};
+
+static void ar0323_otp_id_read(struct i2c_client *client)
+{
+	struct ar0323_priv *priv = to_ar0323(client);
+	int i;
+	u16 val = 0;
+
+	/* read camera id from ar014x OTP memory */
+	reg16_write16(client, 0x3054, 0x400);
+	reg16_write16(client, 0x304a, 0x110);
+	usleep_range(25000, 25500); /* wait 25 ms */
+
+	for (i = 0; i < 6; i += 2) {
+		/* first 4 bytes are equal on all ar014x */
+		reg16_read16(client, 0x3800 + i + 4, &val);
+		priv->id[i]     = val >> 8;
+		priv->id[i + 1] = val & 0xff;
+	}
+}
+
+static ssize_t ar0323_otp_id_show(struct device *dev,
+				 struct device_attribute *attr, char *buf)
+{
+	struct v4l2_subdev *sd = i2c_get_clientdata(to_i2c_client(dev));
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+	struct ar0323_priv *priv = to_ar0323(client);
+
+	ar0323_otp_id_read(client);
+
+	return snprintf(buf, 32, "%02x:%02x:%02x:%02x:%02x:%02x\n",
+			priv->id[0], priv->id[1], priv->id[2], priv->id[3], priv->id[4], priv->id[5]);
+}
+
+static DEVICE_ATTR(otp_id_ar0323, S_IRUGO, ar0323_otp_id_show, NULL);
+
+static int ar0323_initialize(struct i2c_client *client)
+{
+	struct ar0323_priv *priv = to_ar0323(client);
+	u16 val = 0;
+	u16 pid = 0;
+	int ret = 0;
+//	int tmp_addr;
+
+	/* check and show model ID */
+	reg16_read16(client, AR0323_PID, &pid);
+
+	if (pid != AR0323_VERSION_REG) {
+		dev_dbg(&client->dev, "Product ID error %x\n\n\n\n", pid);
+		ret = -ENODEV;
+		goto err;
+	}
+
+#if 0
+	/* setup XCLK */
+	tmp_addr = client->addr;
+	if (priv->ti9x4_addr) {
+		/* CLK_OUT=22.5792*160*M/N/CLKDIV -> CLK_OUT=27MHz: CLKDIV=2, M=15, N=251: 22.5792*160/8*15/251=26.987MHz=CLK_OUT */
+		client->addr = priv->ti9x3_addr;			/* Serializer I2C address */
+		reg8_write(client, 0x06, 0x6f);				/* Set CLKDIV and M */
+		reg8_write(client, 0x07, 0xfb);				/* Set N */
+		reg8_write(client, 0x0e, 0x1f);				/* Set FSIN GPIO to output */
+	}
+	client->addr = tmp_addr;
+#endif
+
+	/* Program wizard registers */
+	ar0323_set_regs(client, ar0323_regs_wizard, ARRAY_SIZE(ar0323_regs_wizard));
+
+	/* Enable stream */
+	reg16_read16(client, 0x301a, &val);	// read inital reset_register value
+	val |= (1 << 2);			// Set streamOn bit
+	reg16_write16(client, 0x301a, val);	// Start Streaming
+
+	/* Read OTP IDs */
+	ar0323_otp_id_read(client);
+
+	dev_info(&client->dev, "ar0323 PID %x, res %dx%d, OTP_ID %02x:%02x:%02x:%02x:%02x:%02x\n",
+		 pid, AR0323_MAX_WIDTH, AR0323_MAX_HEIGHT, priv->id[0], priv->id[1], priv->id[2], priv->id[3], priv->id[4], priv->id[5]);
+err:
+	return ret;
+}
+
+static int ar0323_parse_dt(struct device_node *np, struct ar0323_priv *priv)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(&priv->sd);
+	int i;
+	struct device_node *endpoint = NULL, *rendpoint = NULL;
+	int tmp_addr = 0;
+
+	for (i = 0; ; i++) {
+		endpoint = of_graph_get_next_endpoint(np, endpoint);
+		if (!endpoint)
+			break;
+
+		of_node_put(endpoint);
+
+		rendpoint = of_parse_phandle(endpoint, "remote-endpoint", 0);
+		if (!rendpoint)
+			continue;
+
+		if (!of_property_read_u32(rendpoint, "ti9x3-addr", &priv->ti9x3_addr) &&
+		    !of_property_match_string(rendpoint->parent->parent, "compatible", "ti,ti9x4") &&
+		    !of_property_read_u32(rendpoint->parent->parent, "reg", &priv->ti9x4_addr) &&
+		    !kstrtouint(strrchr(rendpoint->full_name, '@') + 1, 0, &priv->port))
+			break;
+	}
+
+	if (!priv->ti9x4_addr) {
+		dev_err(&client->dev, "deserializer does not present\n");
+		return -EINVAL;
+	}
+
+	/* setup I2C translator address */
+	tmp_addr = client->addr;
+	if (priv->ti9x4_addr) {
+		client->addr = priv->ti9x4_addr;			/* Deserializer I2C address */
+
+		reg8_write(client, 0x4c, (priv->port << 4) | (1 << priv->port)); /* Select RX port number */
+		usleep_range(2000, 2500);				/* wait 2ms */
+		reg8_write(client, 0x65, tmp_addr << 1);		/* Sensor translated I2C address */
+		reg8_write(client, 0x5d, AR0323_I2C_ADDR << 1);		/* Sensor native I2C address */
+
+//		reg8_write(client, 0x6e, 0xa9);				/* GPIO0 - reset, GPIO1 - fsin ??????? */
+	}
+	client->addr = tmp_addr;
+
+	mdelay(10);
+
+	return 0;
+}
+
+static int ar0323_probe(struct i2c_client *client,
+		       const struct i2c_device_id *did)
+{
+	struct ar0323_priv *priv;
+	int ret;
+
+	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	v4l2_i2c_subdev_init(&priv->sd, client, &ar0323_subdev_ops);
+	priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
+
+	v4l2_ctrl_handler_init(&priv->hdl, 4);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_BRIGHTNESS, 0, 16, 1, 7);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_CONTRAST, 0, 16, 1, 7);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_SATURATION, 0, 7, 1, 2);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_HUE, 0, 23, 1, 12);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_GAMMA, -128, 128, 1, 0);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_SHARPNESS, 0, 10, 1, 3);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_AUTOGAIN, 0, 1, 1, 0);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_GAIN, 1, 0x7ff, 1, 0x200);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_ANALOGUE_GAIN, 1, 0xe, 1, 0xa);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_EXPOSURE, 1, 0x600, 1, 0x144);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_HFLIP, 0, 1, 1, 0);
+	v4l2_ctrl_new_std(&priv->hdl, &ar0323_ctrl_ops,
+			  V4L2_CID_VFLIP, 0, 1, 1, 0);
+	priv->sd.ctrl_handler = &priv->hdl;
+
+	ret = priv->hdl.error;
+	if (ret)
+		goto cleanup;
+
+	v4l2_ctrl_handler_setup(&priv->hdl);
+
+	priv->pad.flags = MEDIA_PAD_FL_SOURCE;
+	priv->sd.entity.flags |= MEDIA_ENT_F_CAM_SENSOR;
+	ret = media_entity_pads_init(&priv->sd.entity, 1, &priv->pad);
+	if (ret < 0)
+		goto cleanup;
+
+	ret = ar0323_parse_dt(client->dev.of_node, priv);
+	if (ret)
+		goto cleanup;
+
+	ret = ar0323_initialize(client);
+	if (ret < 0)
+		goto cleanup;
+
+	priv->rect.left = 0;
+	priv->rect.top = 0;
+	priv->rect.width = AR0323_MAX_WIDTH;
+	priv->rect.height = AR0323_MAX_HEIGHT;
+
+	ret = v4l2_async_register_subdev(&priv->sd);
+	if (ret)
+		goto cleanup;
+
+	if (device_create_file(&client->dev, &dev_attr_otp_id_ar0323) != 0) {
+		dev_err(&client->dev, "sysfs otp_id entry creation failed\n");
+		goto cleanup;
+	}
+
+	priv->init_complete = 1;
+
+	return 0;
+
+cleanup:
+	media_entity_cleanup(&priv->sd.entity);
+	v4l2_ctrl_handler_free(&priv->hdl);
+	v4l2_device_unregister_subdev(&priv->sd);
+#ifdef CONFIG_SOC_CAMERA_AR0323
+	v4l_err(client, "failed to probe @ 0x%02x (%s)\n",
+		client->addr, client->adapter->name);
+#endif
+	return ret;
+}
+
+static int ar0323_remove(struct i2c_client *client)
+{
+	struct ar0323_priv *priv = i2c_get_clientdata(client);
+
+	device_remove_file(&client->dev, &dev_attr_otp_id_ar0323);
+	v4l2_async_unregister_subdev(&priv->sd);
+	media_entity_cleanup(&priv->sd.entity);
+	v4l2_ctrl_handler_free(&priv->hdl);
+	v4l2_device_unregister_subdev(&priv->sd);
+
+	return 0;
+}
+
+#ifdef CONFIG_SOC_CAMERA_AR0323
+static const struct i2c_device_id ar0323_id[] = {
+	{ "ar0323", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, ar0323_id);
+
+static const struct of_device_id ar0323_of_ids[] = {
+	{ .compatible = "aptina,ar0323", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ar0323_of_ids);
+
+static struct i2c_driver ar0323_i2c_driver = {
+	.driver	= {
+		.name		= "ar0323",
+		.of_match_table	= ar0323_of_ids,
+	},
+	.probe		= ar0323_probe,
+	.remove		= ar0323_remove,
+	.id_table	= ar0323_id,
+};
+
+module_i2c_driver(ar0323_i2c_driver);
+
+MODULE_DESCRIPTION("SoC Camera driver for AR0323");
+MODULE_AUTHOR("Vladimir Barinov");
+MODULE_LICENSE("GPL");
+#endif
diff --git a/drivers/media/i2c/soc_camera/ar0323.h b/drivers/media/i2c/soc_camera/ar0323.h
new file mode 100644
index 0000000..0711dd8
--- /dev/null
+++ b/drivers/media/i2c/soc_camera/ar0323.h
@@ -0,0 +1,1335 @@
+/*
+ * ON Semiconductor AR0323 sensor camera wizard 1920x1080@30/BGGR/MIPI
+ *
+ * Copyright (C) 2018 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 as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+//#define AR0323_DISPLAY_PATTERN_FIXED
+//#define AR0323_DISPLAY_PATTERN_COLOR_BAR
+
+#define AR0323_MAX_WIDTH	2560
+#define AR0323_MAX_HEIGHT	1080
+
+#define AR0323_DELAY		0xffff
+
+#define AR0323_SENSOR_WIDTH	2880
+#define AR0323_SENSOR_HEIGHT	1080
+
+#define AR0323_X_START		((AR0323_SENSOR_WIDTH - AR0323_MAX_WIDTH) / 2)
+#define AR0323_Y_START		((AR0323_SENSOR_HEIGHT - AR0323_MAX_HEIGHT) / 2)
+#define AR0323_X_END		(AR0323_X_START + AR0323_MAX_WIDTH - 1)
+#define AR0323_Y_END		(AR0323_Y_START + AR0323_MAX_HEIGHT - 1)
+
+struct ar0323_reg {
+	u16	reg;
+	u16	val;
+};
+
+static const struct ar0323_reg ar0323_regs_wizard[] = {
+#if 0
+{0x301A, 0x0018}, // RESET_REGISTER
+{AR0323_DELAY, 500}, // Wait 500ms
+{0x3070, 0x0000},	//  1: Solid color test pattern,
+			//  2: Full color bar test pattern,
+			//  3: Fade to grey color bar test pattern,
+			//256: Walking 1 test pattern (12 bit)
+{0x3072, 0x0123},	// R
+{0x3074, 0x0456},	// G(GR row)
+{0x3076, 0x0abc},	// B
+{0x3078, 0x0def},	// G(GB row)
+#ifdef AR0323_DISPLAY_PATTERN_FIXED
+{0x3070, 0x0001},
+#endif
+#ifdef AR0323_DISPLAY_PATTERN_COLOR_BAR
+{0x3070, 0x0002},
+#endif
+{AR0323_DELAY, 100}, // Wait 100ms
+#endif
+
+{0x301A, 0x0059}, // RESET_REGISTER
+{0x301A, 0x0058}, // RESET_REGISTER
+{AR0323_DELAY, 200}, // Wait 200ms
+
+//continuous MIPI 12bit
+{0x3342, 0x122C}, // MIPI_F1_PDT_EDT
+{0x3346, 0x122C}, // MIPI_F2_PDT_EDT
+{0x334A, 0x122C}, // MIPI_F3_PDT_EDT
+{0x334E, 0x122C}, // MIPI_F4_PDT_EDT
+
+//PLL settings
+{0x302E, 0x0002}, // PRE_PLL_CLK_DIV
+{0x3030, 0x0052}, // PLL_MULTIPLIER
+{0x302C, 0x0001}, // VT_SYS_CLK_DIV
+{0x302A, 0x0008}, // VT_PIX_CLK_DIV
+{0x3038, 0x0004}, // OP_SYS_CLK_DIV
+{0x3036, 0x0006}, // OP_WORD_CLK_DIV
+
+//MIPI timing
+{0x31B0, 0x0059}, // FRAME_PREAMBLE
+{0x31B2, 0x003B}, // LINE_PREAMBLE
+{0x31B4, 0x31C5}, // MIPI_TIMING_0
+{0x31B6, 0x114E}, // MIPI_TIMING_1
+{0x31B8, 0x5048}, // MIPI_TIMING_2
+{0x31BA, 0x0186}, // MIPI_TIMING_3
+{0x31BC, 0x8885}, // MIPI_TIMING_4
+
+//HDR
+{0x3E00, 0x8000}, // LFM2_T1_CTRL
+{0x3082, 0x0004}, // OPERATION_MODE_CTRL
+{0x30BA, 0x1103}, // DIGITAL_CTRL
+
+//new sequencer
+{0x2512, 0x8000},
+{0x2510, 0x0712},
+{0x2510, 0x1314},
+{0x2510, 0x1518},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0x1b1d},
+{0x2510, 0x2224},
+{0x2510, 0x2628},
+{0x2510, 0xffff},
+{0x2510, 0x2a48},
+{0x2510, 0x5672},
+{0x2510, 0x7f85},
+{0x2510, 0x8991},
+{0x2510, 0xaeb3},
+{0x2510, 0xbdc4},
+{0x2510, 0xc5c8},
+{0x2510, 0xccd0},
+{0x2510, 0xd4d6},
+{0x2510, 0xd8dd},
+{0x2510, 0xdfe2},
+{0x2510, 0xe5e8},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xc003},
+{0x2510, 0xa0e0},
+{0x2510, 0x3041},
+{0x2510, 0x3042},
+{0x2510, 0x2000},
+{0x2510, 0x3048},
+{0x2510, 0x3081},
+{0x2510, 0x3084},
+{0x2510, 0x3082},
+{0x2510, 0x2003},
+{0x2510, 0x3044},
+{0x2510, 0x2000},
+{0x2510, 0xa004},
+{0x2510, 0x20ff},
+{0x2510, 0x20ff},
+{0x2510, 0x20ff},
+{0x2510, 0x20ff},
+{0x2510, 0x20ff},
+{0x2510, 0x807c},
+{0x2510, 0xa0e0},
+{0x2510, 0x3041},
+{0x2510, 0x3042},
+{0x2510, 0x2000},
+{0x2510, 0xa0c0},
+{0x2510, 0x9008},
+{0x2510, 0x8802},
+{0x2510, 0x20ff},
+{0x2510, 0x20ff},
+{0x2510, 0x20ff},
+{0x2510, 0x20ff},
+{0x2510, 0x20ff},
+{0x2510, 0x9018},
+{0x2510, 0x891a},
+{0x2510, 0x807c},
+{0x2510, 0x20ff},
+{0x2510, 0x895b},
+{0x2510, 0x20ff},
+{0x2510, 0x897b},
+{0x2510, 0x20ff},
+{0x2510, 0x897f},
+{0x2510, 0x20ff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x20ff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x20ff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x20ff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xa0c4},
+{0x2510, 0x20ff},
+{0x2510, 0x8058},
+{0x2510, 0x9039},
+{0x2510, 0x20ff},
+{0x2510, 0x907f},
+{0x2510, 0x895b},
+{0x2510, 0x2064},
+{0x2510, 0x891b},
+{0x2510, 0x2010},
+{0x2510, 0x8803},
+{0x2510, 0x7fff},
+{0x2510, 0x3088},
+{0x2510, 0x3090},
+{0x2510, 0x20ff},
+{0x2510, 0x906b},
+{0x2510, 0x2064},
+{0x2510, 0x3084},
+{0x2510, 0x2003},
+{0x2510, 0x3044},
+{0x2510, 0x2000},
+{0x2510, 0xa004},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2400},
+{0x2510, 0x2401},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2400},
+{0x2510, 0x2401},
+{0x2510, 0x2702},
+{0x2510, 0x3242},
+{0x2510, 0x2420},
+{0x2510, 0x2702},
+{0x2510, 0x2421},
+{0x2510, 0x2703},
+{0x2510, 0x3242},
+{0x2510, 0x2420},
+{0x2510, 0x2703},
+{0x2510, 0x2421},
+{0x2510, 0x2704},
+{0x2510, 0x3242},
+{0x2510, 0x2420},
+{0x2510, 0x2704},
+{0x2510, 0x2421},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2402},
+{0x2510, 0x2403},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2741},
+{0x2510, 0x2429},
+{0x2510, 0x2740},
+{0x2510, 0x242a},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2404},
+{0x2510, 0x2779},
+{0x2510, 0x242c},
+{0x2510, 0x2781},
+{0x2510, 0x242d},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2703},
+{0x2510, 0x2432},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xb800},
+{0x2510, 0x8058},
+{0x2510, 0xa005},
+{0x2510, 0x30c1},
+{0x2510, 0x3101},
+{0x2510, 0x3041},
+{0x2510, 0x3041},
+{0x2510, 0x3250},
+{0x2510, 0x3108},
+{0x2510, 0x3104},
+{0x2510, 0x3102},
+{0x2510, 0x3041},
+{0x2510, 0xf860},
+{0x2510, 0xb095},
+{0x2510, 0x3141},
+{0x2510, 0x3042},
+{0x2510, 0xb848},
+{0x2510, 0xb84c},
+{0x2510, 0x8843},
+{0x2510, 0x916f},
+{0x2510, 0x3110},
+{0x2510, 0x3042},
+{0x2510, 0xb84e},
+{0x2510, 0xf905},
+{0x2510, 0xf907},
+{0x2510, 0x3202},
+{0x2510, 0x885b},
+{0x2510, 0xa898},
+{0x2510, 0xa8d8},
+{0x2510, 0xb397},
+{0x2510, 0xf8e8},
+{0x2510, 0x80dc},
+{0x2510, 0x2206},
+{0x2510, 0xb137},
+{0x2510, 0xb808},
+{0x2510, 0xc800},
+{0x2510, 0xe809},
+{0x2510, 0xb177},
+{0x2510, 0x88df},
+{0x2510, 0xf8a8},
+{0x2510, 0xf888},
+{0x2510, 0x2203},
+{0x2510, 0xb07b},
+{0x2510, 0x2000},
+{0x2510, 0x80cc},
+{0x2510, 0x808c},
+{0x2510, 0x220b},
+{0x2510, 0xb06a},
+{0x2510, 0x88cf},
+{0x2510, 0x888f},
+{0x2510, 0x222f},
+{0x2510, 0x2771},
+{0x2510, 0x2512},
+{0x2510, 0xb04a},
+{0x2510, 0x2213},
+{0x2510, 0x2771},
+{0x2510, 0x2525},
+{0x2510, 0xb04b},
+{0x2510, 0x902f},
+{0x2510, 0xf880},
+{0x2510, 0x220e},
+{0x2510, 0x2201},
+{0x2510, 0x2201},
+{0x2510, 0x2204},
+{0x2510, 0xb043},
+{0x2510, 0x2201},
+{0x2510, 0xa8c9},
+{0x2510, 0x31c1},
+{0x2510, 0x80ac},
+{0x2510, 0x916f},
+{0x2510, 0x2112},
+{0x2510, 0x88af},
+{0x2510, 0x2440},
+{0x2510, 0xf110},
+{0x2510, 0xf804},
+{0x2510, 0x2000},
+{0x2510, 0x8088},
+{0x2510, 0xb838},
+{0x2510, 0xa8c8},
+{0x2510, 0xb04b},
+{0x2510, 0x2442},
+{0x2510, 0x3210},
+{0x2510, 0x3002},
+{0x2510, 0x220c},
+{0x2510, 0x888b},
+{0x2510, 0x2204},
+{0x2510, 0x3202},
+{0x2510, 0x2204},
+{0x2510, 0xf880},
+{0x2510, 0xb830},
+{0x2510, 0xc801},
+{0x2510, 0x30c2},
+{0x2510, 0xe80c},
+{0x2510, 0x2201},
+{0x2510, 0xb04a},
+{0x2510, 0x2229},
+{0x2510, 0x2771},
+{0x2510, 0x2513},
+{0x2510, 0x902f},
+{0x2510, 0x221f},
+{0x2510, 0x2201},
+{0x2510, 0x2204},
+{0x2510, 0xb042},
+{0x2510, 0x2201},
+{0x2510, 0xa9a1},
+{0x2510, 0x8008},
+{0x2510, 0xb093},
+{0x2510, 0x31c1},
+{0x2510, 0x916b},
+{0x2510, 0x2009},
+{0x2510, 0x8803},
+{0x2510, 0xa044},
+{0x2510, 0x3044},
+{0x2510, 0x2000},
+{0x2510, 0xa004},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xa084},
+{0x2510, 0x8078},
+{0x2510, 0x3141},
+{0x2510, 0x3041},
+{0x2510, 0x3042},
+{0x2510, 0x2000},
+{0x2510, 0x3142},
+{0x2510, 0x3041},
+{0x2510, 0x2000},
+{0x2510, 0x3110},
+{0x2510, 0x3041},
+{0x2510, 0x2000},
+{0x2510, 0x3120},
+{0x2510, 0x3041},
+{0x2510, 0x2000},
+{0x2510, 0x3144},
+{0x2510, 0x3041},
+{0x2510, 0x2000},
+{0x2510, 0x3148},
+{0x2510, 0x3041},
+{0x2510, 0x2000},
+{0x2510, 0x2206},
+{0x2510, 0x881b},
+{0x2510, 0x887b},
+{0x2510, 0x2440},
+{0x2510, 0xb095},
+{0x2510, 0xf110},
+{0x2510, 0xf804},
+{0x2510, 0xf90d},
+{0x2510, 0x3084},
+{0x2510, 0x3090},
+{0x2510, 0x3088},
+{0x2510, 0x8058},
+{0x2510, 0x3001},
+{0x2510, 0x2442},
+{0x2510, 0x3260},
+{0x2510, 0x3248},
+{0x2510, 0x3220},
+{0x2510, 0x2002},
+{0x2510, 0x8863},
+{0x2510, 0x2004},
+{0x2510, 0x8803},
+{0x2510, 0x2204},
+{0x2510, 0x30c2},
+{0x2510, 0xa9a0},
+{0x2510, 0xb094},
+{0x2510, 0x2201},
+{0x2510, 0xa0c4},
+{0x2510, 0x3044},
+{0x2510, 0x2000},
+{0x2510, 0xa004},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xb980},
+{0x2510, 0x8108},
+{0x2510, 0xa105},
+{0x2510, 0x30c1},
+{0x2510, 0x2000},
+{0x2510, 0x3101},
+{0x2510, 0x3041},
+{0x2510, 0x3250},
+{0x2510, 0x3108},
+{0x2510, 0x3104},
+{0x2510, 0x3102},
+{0x2510, 0x3041},
+{0x2510, 0xf860},
+{0x2510, 0xb095},
+{0x2510, 0x3141},
+{0x2510, 0x3042},
+{0x2510, 0xb9f8},
+{0x2510, 0xb9fc},
+{0x2510, 0x8803},
+{0x2510, 0x916f},
+{0x2510, 0x3110},
+{0x2510, 0x3042},
+{0x2510, 0xb9fe},
+{0x2510, 0xf905},
+{0x2510, 0xf907},
+{0x2510, 0x3202},
+{0x2510, 0x880b},
+{0x2510, 0xa888},
+{0x2510, 0xa8c8},
+{0x2510, 0xb397},
+{0x2510, 0xf8e8},
+{0x2510, 0x818c},
+{0x2510, 0x2206},
+{0x2510, 0xb137},
+{0x2510, 0xb9b8},
+{0x2510, 0xc801},
+{0x2510, 0xe809},
+{0x2510, 0xb177},
+{0x2510, 0x888f},
+{0x2510, 0xf8a8},
+{0x2510, 0xf888},
+{0x2510, 0x2203},
+{0x2510, 0xb07b},
+{0x2510, 0x2000},
+{0x2510, 0x2206},
+{0x2510, 0xb06a},
+{0x2510, 0x2210},
+{0x2510, 0x818c},
+{0x2510, 0x2204},
+{0x2510, 0x888f},
+{0x2510, 0x888f},
+{0x2510, 0x2215},
+{0x2510, 0xb04a},
+{0x2510, 0x2212},
+{0x2510, 0x2111},
+{0x2510, 0xb04b},
+{0x2510, 0x902f},
+{0x2510, 0xf880},
+{0x2510, 0x220e},
+{0x2510, 0x2201},
+{0x2510, 0x2204},
+{0x2510, 0xb043},
+{0x2510, 0x2201},
+{0x2510, 0xa8d9},
+{0x2510, 0x31c1},
+{0x2510, 0x80cc},
+{0x2510, 0x916f},
+{0x2510, 0x2110},
+{0x2510, 0x88cf},
+{0x2510, 0x2440},
+{0x2510, 0xf110},
+{0x2510, 0xf804},
+{0x2510, 0x2000},
+{0x2510, 0xb988},
+{0x2510, 0xa8d8},
+{0x2510, 0xb04b},
+{0x2510, 0x3002},
+{0x2510, 0x2442},
+{0x2510, 0x3210},
+{0x2510, 0x220a},
+{0x2510, 0x2204},
+{0x2510, 0x3202},
+{0x2510, 0x2204},
+{0x2510, 0xb980},
+{0x2510, 0xc800},
+{0x2510, 0x30c2},
+{0x2510, 0xe80c},
+{0x2510, 0x2201},
+{0x2510, 0xb04a},
+{0x2510, 0x221f},
+{0x2510, 0x8088},
+{0x2510, 0x220a},
+{0x2510, 0x888b},
+{0x2510, 0x902f},
+{0x2510, 0x221e},
+{0x2510, 0x2201},
+{0x2510, 0x2204},
+{0x2510, 0xb042},
+{0x2510, 0x2201},
+{0x2510, 0xa9a1},
+{0x2510, 0x8018},
+{0x2510, 0xb093},
+{0x2510, 0x31c1},
+{0x2510, 0x916b},
+{0x2510, 0x2009},
+{0x2510, 0x8803},
+{0x2510, 0x2000},
+{0x2510, 0xa004},
+{0x2510, 0xb800},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x8078},
+{0x2510, 0xa184},
+{0x2510, 0xb981},
+{0x2510, 0x3141},
+{0x2510, 0x3041},
+{0x2510, 0x3042},
+{0x2510, 0x2000},
+{0x2510, 0x3142},
+{0x2510, 0x3041},
+{0x2510, 0x2000},
+{0x2510, 0x3110},
+{0x2510, 0x3041},
+{0x2510, 0x2000},
+{0x2510, 0x3120},
+{0x2510, 0x3041},
+{0x2510, 0x2000},
+{0x2510, 0x30a0},
+{0x2510, 0x2206},
+{0x2510, 0x881b},
+{0x2510, 0x887b},
+{0x2510, 0x2282},
+{0x2510, 0xb095},
+{0x2510, 0xf110},
+{0x2510, 0xf804},
+{0x2510, 0xf90d},
+{0x2510, 0x3090},
+{0x2510, 0x3088},
+{0x2510, 0x8058},
+{0x2510, 0x2202},
+{0x2510, 0x3001},
+{0x2510, 0x3260},
+{0x2510, 0x3248},
+{0x2510, 0x2002},
+{0x2510, 0x885b},
+{0x2510, 0x2004},
+{0x2510, 0x2204},
+{0x2510, 0x8018},
+{0x2510, 0x2209},
+{0x2510, 0x881b},
+{0x2510, 0xa9a0},
+{0x2510, 0xb094},
+{0x2510, 0x2209},
+{0x2510, 0x8000},
+{0x2510, 0x2209},
+{0x2510, 0x8803},
+{0x2510, 0xa1c4},
+{0x2510, 0x3044},
+{0x2510, 0xb800},
+{0x2510, 0xa004},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x9818},
+{0x2510, 0xb800},
+{0x2510, 0x3101},
+{0x2510, 0x3041},
+{0x2510, 0x2200},
+{0x2510, 0x3102},
+{0x2510, 0x3041},
+{0x2510, 0x2200},
+{0x2510, 0x8018},
+{0x2510, 0x2002},
+{0x2510, 0x8038},
+{0x2510, 0x2205},
+{0x2510, 0x881b},
+{0x2510, 0x883b},
+{0x2510, 0x213e},
+{0x2510, 0x8018},
+{0x2510, 0x2202},
+{0x2510, 0x8000},
+{0x2510, 0x2202},
+{0x2510, 0x8803},
+{0x2510, 0x9800},
+{0x2510, 0xa004},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2440},
+{0x2510, 0xb095},
+{0x2510, 0xf110},
+{0x2510, 0xf804},
+{0x2510, 0xf90d},
+{0x2510, 0x2442},
+{0x2510, 0x3260},
+{0x2510, 0x3248},
+{0x2510, 0x3220},
+{0x2510, 0x2007},
+{0x2510, 0x2204},
+{0x2510, 0x30c2},
+{0x2510, 0xa9a0},
+{0x2510, 0xb094},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xb981},
+{0x2510, 0x3101},
+{0x2510, 0x3041},
+{0x2510, 0x3102},
+{0x2510, 0x3041},
+{0x2510, 0x8028},
+{0x2510, 0x2212},
+{0x2510, 0x880b},
+{0x2510, 0x882b},
+{0x2510, 0x2440},
+{0x2510, 0xb095},
+{0x2510, 0xf110},
+{0x2510, 0xf804},
+{0x2510, 0xf90d},
+{0x2510, 0x8008},
+{0x2510, 0x2202},
+{0x2510, 0x3001},
+{0x2510, 0x3260},
+{0x2510, 0x3248},
+{0x2510, 0x2442},
+{0x2510, 0x8823},
+{0x2510, 0x3220},
+{0x2510, 0x2007},
+{0x2510, 0x8803},
+{0x2510, 0x2204},
+{0x2510, 0x30c2},
+{0x2510, 0xa8a0},
+{0x2510, 0xb094},
+{0x2510, 0x2201},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xb800},
+{0x2510, 0x8058},
+{0x2510, 0xa005},
+{0x2510, 0x30c1},
+{0x2510, 0x3101},
+{0x2510, 0x3041},
+{0x2510, 0x3041},
+{0x2510, 0x3250},
+{0x2510, 0x3108},
+{0x2510, 0x3104},
+{0x2510, 0x3102},
+{0x2510, 0x3041},
+{0x2510, 0xf860},
+{0x2510, 0xb095},
+{0x2510, 0x3141},
+{0x2510, 0x3042},
+{0x2510, 0xb848},
+{0x2510, 0xb84c},
+{0x2510, 0x8843},
+{0x2510, 0x916f},
+{0x2510, 0x3110},
+{0x2510, 0x3042},
+{0x2510, 0xb84e},
+{0x2510, 0xf905},
+{0x2510, 0xf907},
+{0x2510, 0x3202},
+{0x2510, 0x885b},
+{0x2510, 0xa898},
+{0x2510, 0xa8d8},
+{0x2510, 0xb397},
+{0x2510, 0xf8e8},
+{0x2510, 0x80dc},
+{0x2510, 0x2206},
+{0x2510, 0xb137},
+{0x2510, 0xb808},
+{0x2510, 0xc800},
+{0x2510, 0xe809},
+{0x2510, 0xb177},
+{0x2510, 0x88df},
+{0x2510, 0xf8a8},
+{0x2510, 0xf888},
+{0x2510, 0x2203},
+{0x2510, 0xb07b},
+{0x2510, 0x2000},
+{0x2510, 0x80cc},
+{0x2510, 0x808c},
+{0x2510, 0x220b},
+{0x2510, 0xb06a},
+{0x2510, 0x88cf},
+{0x2510, 0x888f},
+{0x2510, 0x222f},
+{0x2510, 0x2771},
+{0x2510, 0x251e},
+{0x2510, 0xb04a},
+{0x2510, 0x2213},
+{0x2510, 0x2771},
+{0x2510, 0x2525},
+{0x2510, 0xb04b},
+{0x2510, 0x902f},
+{0x2510, 0xf880},
+{0x2510, 0x221e},
+{0x2510, 0x2201},
+{0x2510, 0x2204},
+{0x2510, 0xb043},
+{0x2510, 0x2201},
+{0x2510, 0xa8c9},
+{0x2510, 0x31c1},
+{0x2510, 0x80ac},
+{0x2510, 0x916f},
+{0x2510, 0x2112},
+{0x2510, 0x88af},
+{0x2510, 0x2440},
+{0x2510, 0xf110},
+{0x2510, 0xf804},
+{0x2510, 0x2000},
+{0x2510, 0x8088},
+{0x2510, 0xb838},
+{0x2510, 0xa8c8},
+{0x2510, 0xb04b},
+{0x2510, 0x2442},
+{0x2510, 0x3210},
+{0x2510, 0x3002},
+{0x2510, 0x220c},
+{0x2510, 0x888b},
+{0x2510, 0x2204},
+{0x2510, 0x3202},
+{0x2510, 0xf880},
+{0x2510, 0xb830},
+{0x2510, 0xc801},
+{0x2510, 0x30c2},
+{0x2510, 0xe80c},
+{0x2510, 0x2201},
+{0x2510, 0xb04a},
+{0x2510, 0x2229},
+{0x2510, 0x2771},
+{0x2510, 0x2513},
+{0x2510, 0x902f},
+{0x2510, 0x221f},
+{0x2510, 0x2201},
+{0x2510, 0x2204},
+{0x2510, 0xb042},
+{0x2510, 0x2201},
+{0x2510, 0xa8e1},
+{0x2510, 0x8008},
+{0x2510, 0xb093},
+{0x2510, 0x31c1},
+{0x2510, 0x916b},
+{0x2510, 0x2009},
+{0x2510, 0x8803},
+{0x2510, 0x2000},
+{0x2510, 0xa004},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2440},
+{0x2510, 0xb095},
+{0x2510, 0xf110},
+{0x2510, 0xf804},
+{0x2510, 0xf90d},
+{0x2510, 0x2442},
+{0x2510, 0x3220},
+{0x2510, 0x2002},
+{0x2510, 0x2204},
+{0x2510, 0x30c2},
+{0x2510, 0xa9a0},
+{0x2510, 0x2004},
+{0x2510, 0xb094},
+{0x2510, 0x2201},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2749},
+{0x2510, 0x2422},
+{0x2510, 0x2749},
+{0x2510, 0x2423},
+{0x2510, 0x2709},
+{0x2510, 0x2420},
+{0x2510, 0x2729},
+{0x2510, 0x2423},
+{0x2510, 0x3242},
+{0x2510, 0x2722},
+{0x2510, 0x2422},
+{0x2510, 0x2769},
+{0x2510, 0x2421},
+{0x2510, 0x2702},
+{0x2510, 0x2421},
+{0x2510, 0x3242},
+{0x2510, 0x276a},
+{0x2510, 0x2420},
+{0x2510, 0x276a},
+{0x2510, 0x2421},
+{0x2510, 0x2703},
+{0x2510, 0x2420},
+{0x2510, 0x2703},
+{0x2510, 0x2421},
+{0x2510, 0x3242},
+{0x2510, 0x276b},
+{0x2510, 0x2420},
+{0x2510, 0x276b},
+{0x2510, 0x2421},
+{0x2510, 0x2704},
+{0x2510, 0x2420},
+{0x2510, 0x2704},
+{0x2510, 0x2421},
+{0x2510, 0x3242},
+{0x2510, 0x276c},
+{0x2510, 0x2420},
+{0x2510, 0x276c},
+{0x2510, 0x2421},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2759},
+{0x2510, 0x2422},
+{0x2510, 0x2758},
+{0x2510, 0x2420},
+{0x2510, 0x2403},
+{0x2510, 0x2712},
+{0x2510, 0x3242},
+{0x2510, 0x2422},
+{0x2510, 0x271a},
+{0x2510, 0x3242},
+{0x2510, 0x2420},
+{0x2510, 0x2702},
+{0x2510, 0x2423},
+{0x2510, 0x2703},
+{0x2510, 0x3242},
+{0x2510, 0x2420},
+{0x2510, 0x2703},
+{0x2510, 0x2423},
+{0x2510, 0x2704},
+{0x2510, 0x3242},
+{0x2510, 0x2420},
+{0x2510, 0x2704},
+{0x2510, 0x2423},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xc023},
+{0x2510, 0x2402},
+{0x2510, 0x2405},
+{0x2510, 0x2789},
+{0x2510, 0x242e},
+{0x2510, 0x2788},
+{0x2510, 0x242f},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xc027},
+{0x2510, 0x2407},
+{0x2510, 0x2406},
+{0x2510, 0xc063},
+{0x2510, 0x2402},
+{0x2510, 0x2751},
+{0x2510, 0x2423},
+{0x2510, 0x2750},
+{0x2510, 0x2421},
+{0x2510, 0xc003},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xc021},
+{0x2510, 0x2400},
+{0x2510, 0x2405},
+{0x2510, 0xc062},
+{0x2510, 0x2400},
+{0x2510, 0xc063},
+{0x2510, 0x2751},
+{0x2510, 0x2423},
+{0x2510, 0x2750},
+{0x2510, 0x2421},
+{0x2510, 0xc003},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xc0e3},
+{0x2510, 0x2400},
+{0x2510, 0x27b1},
+{0x2510, 0x2425},
+{0x2510, 0xc063},
+{0x2510, 0x2420},
+{0x2510, 0x2751},
+{0x2510, 0x2423},
+{0x2510, 0x2750},
+{0x2510, 0x2421},
+{0x2510, 0xc003},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2404},
+{0x2510, 0x2779},
+{0x2510, 0x242c},
+{0x2510, 0x2781},
+{0x2510, 0x242d},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2791},
+{0x2510, 0x2430},
+{0x2510, 0x2799},
+{0x2510, 0x2428},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x2417},
+{0x2510, 0xc023},
+{0x2510, 0x2403},
+{0x2510, 0x2703},
+{0x2510, 0x3242},
+{0x2510, 0x2404},
+{0x2510, 0x240d},
+{0x2510, 0xc003},
+{0x2510, 0x2703},
+{0x2510, 0x3242},
+{0x2510, 0x2400},
+{0x2510, 0x2408},
+{0x2510, 0x2703},
+{0x2510, 0x3242},
+{0x2510, 0x2417},
+{0x2510, 0x240b},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xc022},
+{0x2510, 0x2402},
+{0x2510, 0x2405},
+{0x2510, 0x2414},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xc022},
+{0x2510, 0x2407},
+{0x2510, 0x2405},
+{0x2510, 0xc061},
+{0x2510, 0x2400},
+{0x2510, 0xc023},
+{0x2510, 0x2403},
+{0x2510, 0xc003},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xc022},
+{0x2510, 0x2404},
+{0x2510, 0x2779},
+{0x2510, 0x2433},
+{0x2510, 0x2781},
+{0x2510, 0x2436},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xc126},
+{0x2510, 0x2407},
+{0x2510, 0xc022},
+{0x2510, 0x2406},
+{0x2510, 0x2402},
+{0x2510, 0xc023},
+{0x2510, 0x2405},
+{0x2510, 0x2417},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x3244},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0x7fff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+{0x2510, 0xffff},
+
+{AR0323_DELAY, 100}, // Wait 100ms
+{0x301A, 0x0058}, // RESET_REGISTER
+
+{0x31AC, 0x140C}, // DATA_FORMAT_BITS
+{0x31D0, 0x0001}, // COMPANDING
+{0x336E, 0x01DF}, // DATAPATH_SELECT2
+{0x3238, 0x0666}, // EXPOSURE_RATIO
+#if 1
+{0x300C, 0x0A60}, // LINE_LENGTH_PCK_
+{0x300A, 0x04A0}, // FRAME_LENGTH_LINES_
+#else
+{0x300A, AR0323_SENSOR_HEIGHT + 208}, // FRAME_LENGTH_LINES_
+{0x300C, AR0323_SENSOR_WIDTH + 300}, // LINE_LENGTH_PCK_
+#endif
+
+#if 0
+//2880x1072 resolution
+{0x3004, 0x0008}, // X_ADDR_START_
+{0x3008, 0x0B47}, // X_ADDR_END_
+{0x3002, 0x010C}, // Y_ADDR_START_
+{0x3006, 0x053B}, // Y_ADDR_END_
+#else
+{0x3004, AR0323_X_START}, // X_ADDR_START_
+{0x3008, AR0323_X_END}, // X_ADDR_END_
+{0x3002, AR0323_Y_START}, // Y_ADDR_START_
+{0x3006, AR0323_Y_END}, // Y_ADDR_END_
+{0x3402, 0x0000 | AR0323_MAX_WIDTH}, // X_OUTPUT_CONTROL
+{0x3404, 0x0000 | AR0323_MAX_HEIGHT}, // Y_OUTPUT_CONTROL
+#endif
+
+{0x3534, 0xA282}, // DAC_LD_52_53
+{0x3524, 0x0FFF}, // DAC_LD_36_37
+{0x3180, 0x1001}, // DELTA_DK_CONTROL
+{0x3576, 0x1F09}, // DAC_LD_118_119
+
+{0x3548, 0x7878}, // DAC_LD_72_73
+{0x354C, 0x4141}, // DAC_LD_76_77
+{0x354E, 0x4B4B}, // DAC_LD_78_79
+{0x356E, 0x158A}, // DAC_LD_110_111
+
+//overflow},settings
+{0x3496, 0xCF0A}, // LFM_CONTROL
+{0x350E, 0x2181}, // DAC_LD_14_15
+{0x3E02, 0x0834}, // LFM2_T1_E1_A
+{0x3E04, 0x0000}, // LFM2_T1_E1_B
+{0x3E08, 0x1FFF}, // LFM2_T1_E2_A
+{0x3E14, 0x0020}, // LFM2_T1_SLOPE
+{0x3E16, 0x1F40}, // LFM2_T1_E1_THRESHOLD
+//
+{0x562A, 0x05DC}, // OCL_T1_E2_E1_SAT
+{0x563A, 0x0011}, // OCL_T1_GAIN_
+
+{0x3364, 0x068C}, // DCG_TRIM
+{0x3290, 0xD354}, // T3_BARRIER_C0
+{0x3292, 0xD354}, // T3_BARRIER_C1
+{0x3294, 0xD354}, // T3_BARRIER_C2
+{0x3296, 0xD354}, // T3_BARRIER_C3
+{0x3298, 0xD354}, // T4_BARRIER_C0
+{0x329A, 0xD354}, // T4_BARRIER_C1
+{0x329C, 0xD354}, // T4_BARRIER_C2
+{0x329E, 0xD354}, // T4_BARRIER_C3
+{0x33DA, 0x0001}, // OC_LUT_CONTROL
+{0x3D00, 0x6007}, // MEC_CTRL1
+
+{0x3040, 0xC005}, // READ_MODE
+{0x3352, 0x2000}, // MIPI_DT_VC_CONFIG
+{0x3064, 0x0180}, // SMIA_TEST
+
+{0x3D10, 0x0000}, // VIS_BOUND_X0
+{0x3D12, 0x0B40}, // VIS_BOUND_X1
+{0x3D14, 0x001E}, // VIS_BOUND_Y0
+{0x3D16, 0x045A}, // VIS_BOUND_Y1
+
+{0x3D08, 0x0000}, // DTR_BOUND_X0
+{0x3D0A, 0x0B40}, // DTR_BOUND_X1
+{0x3D0C, 0x0004}, // DTR_BOUND_Y0
+{0x3D0E, 0x000C}, // DTR_BOUND_Y1
+{AR0323_DELAY, 100}, // Wait 100ms
+
+//Pre HDR gain LG lens
+{0x3110, 0x0011}, // HDR_CONTROL0
+{0x3056, 0x0031}, // GREEN1_GAIN
+{0x3058, 0x0080}, // BLUE_GAIN
+{0x305A, 0x0070}, // RED_GAIN
+{0x305C, 0x0031}, // GREEN2_GAIN
+{0x3308, 0x0539}, // GLOBAL_GAIN2_
+{0x3D28, 0x3BD1}, // T1_STR_DEC_TH
+{0x3D2A, 0x4C2C}, // T1_END_DEC_TH
+
+//booster
+{0x352C, 0x8146}, // DAC_LD_44_45
+{0x352E, 0x1871}, // DAC_LD_46_47
+{0x3538, 0x81EA}, // DAC_LD_56_57
+
+{0x3576, 0x1F49}, // DAC_LD_118_119
+{0x3544, 0x03A1}, // DAC_LD_68_69
+
+{0x354C, 0x411E}, // DAC_LD_76_77
+//
+{0x351A, 0x7900},
+
+//Temp_sensor_read
+{0x3E94, 0x3010}, // TEMPVSENS1_SREG_TRIM0
+{0x30B8, 0x0003}, // TEMPSENS1_CTRL_REG
+{0x3F92, 0x4D00}, // TEMPVSENS1_TMG_CTRL
+{0x3F96, 0xFFFE}, //003E // TEMPVSENS1_FLAG_CTRL
+{0x3EE0, 0x0700}, //0000 // TEMPVSENS1_FLAG_CTRL_EXT
+{0x3E98, 0x4000}, // TEMPVSENS1_EN_CTRL
+
+//analog},1x
+{0x3022, 0x01}, // GROUPED_PARAMETER_HOLD_
+{0x3D34, 0x0562}, // T2_STR_DEC_TH
+{0x3D36, 0x0562}, // T2_END_DEC_TH
+{0x563A, 0x0011}, // OCL_T1_GAIN_
+{0x3E18, 0x0EEE}, // LFM2_T1_E2_GAIN_CTRL
+{0x3366, 0x1121}, // ANALOG_GAIN
+{0x3364, 700}, //2D0 // DCG_TRIM
+{0x336A, 0x0080}, // ANALOG_GAIN2
+{0x3E02, 0x09C4}, // LFM2_T1_E1_A
+{0x3022, 0x00}, // GROUPED_PARAMETER_HOLD_
+
+//updated},pink},reduction},settings
+{0x3D02, 0x6033}, // MEC_CTRL2
+{0x3534, 0xA284}, // DAC_LD_52_53
+{0x3546, 0x3601}, // DAC_LD_70_71
+{0x3518, 0x4444}, // DAC_LD_24_25
+
+{0x3494, 0x0C0C}, // LFM_TX_PATTERN_CTRL
+{0x34BC, 0x000C}, // LFM_PATTERN_CTRL
+{0x3E02, 0x09C4}, // LFM2_T1_E1_A
+
+//band},mitigation
+{0x3450, 0x00A4}, // LFM_PHASE0_PERIOD
+{0x3452, 0x004F}, // LFM_PHASE1_PERIOD
+{0x3454, 0x004F}, // LFM_PHASE2_PERIOD
+{0x3456, 0x004F}, // LFM_PHASE3_PERIOD
+{0x3458, 0x004F}, // LFM_PHASE4_PERIOD
+{0x345A, 0x004F}, // LFM_PHASE5_PERIOD
+{0x345C, 0x004F}, // LFM_PHASE6_PERIOD
+{0x345E, 0x004F}, // LFM_PHASE7_PERIOD
+{0x3460, 0x004F}, // LFM_PHASE8_PERIOD
+{0x3462, 0x004F}, // LFM_PHASE9_PERIOD
+{0x3464, 0x004F}, // LFM_PHASE10_PERIOD
+{0x3466, 0x004F}, // LFM_PHASE11_PERIOD
+{0x3468, 0x00A4}, // LFM_PHASE12_PERIOD
+{0x346A, 0x004F}, // LFM_PHASE13_PERIOD
+{0x346C, 0x004F}, // LFM_PHASE14_PERIOD
+{0x346E, 0x004F}, // LFM_PHASE15_PERIOD
+{0x3470, 0x004F}, // LFM_PHASE16_PERIOD
+{0x3472, 0x004F}, // LFM_PHASE17_PERIOD
+{0x3474, 0x004F}, // LFM_PHASE18_PERIOD
+{0x3476, 0x004F}, // LFM_PHASE19_PERIOD
+{0x3478, 0x004F}, // LFM_PHASE20_PERIOD
+{0x347A, 0x004F}, // LFM_PHASE21_PERIOD
+{0x347C, 0x004F}, // LFM_PHASE22_PERIOD
+{0x347E, 0x004F}, // LFM_PHASE23_PERIOD
+{0x3480, 0x004F}, // LFM_PHASE24_PERIOD
+{0x3482, 0x004F}, // LFM_PHASE25_PERIOD
+{0x3484, 0x00A4}, // LFM_PHASE26_PERIOD
+{0x3486, 0x004F}, // LFM_PHASE27_PERIOD
+{0x3488, 0x00A4}, // LFM_PHASE28_PERIOD
+{0x348A, 0x004F}, // LFM_PHASE29_PERIOD
+{0x348C, 0x004F}, // LFM_PHASE30_PERIOD
+{0x348E, 0x004F}, // LFM_PHASE31_PERIOD
+{0x3490, 0x004F}, // LFM_PHASE32_PERIOD
+
+{0x3496, 0xDF00}, // LFM_CONTROL
+{0x349A, 0x0001}, // LFM_TX_SHIFT_CLK_CTRL
+{0x349C, 0x0003}, // LFM_TX_DATA_CLK_CTRL
+{0x349E, 0x0002}, // LFM_TX_GOTO_LOROW_CLK_CTRL
+{0x34A0, 0x003E}, // LFM_TX_DATA_CLR_CLK_CTRL
+{0x34A2, 0x0012}, // LFM_BST_TX_CLK_CTRL
+{0x34A4, 0x003D}, // LFM_BST_TXLO_CLK_CTRL
+{0x34A6, 0x004E}, // LFM_BST_TXLOROW_EN_CLK_CTRL
+{0x34A8, 0x0044}, // LFM_AB_SHIFT_CLK_CTRL
+{0x34AA, 0x0001}, // LFM_BST_AB_CLK_CTRL
+{0x34AC, 0x0043}, // LFM_BST_ABLO_CLK_CTRL
+{0x34AE, 0x004E}, // LFM_BST_ABLOROW_EN_CLK_CTRL
+{0x34B0, 0x0002}, // LFM_DCG_DATA_CLK_CTRL
+{0x34B2, 0x003F}, // LFM_DCG_DATA_CLR_CLK_CTRL
+{0x34B4, 0x004E}, // LFM_BST_DCGLOROW_EN_CLK_CTRL
+{0x34B6, 0x0012}, // LFM_BST_DCG_CLK_CTRL
+
+{0x350E, 0x2189}, // DAC_LD_14_15
+//pixel recommended settings Feb5
+{0x352C, 0x8146}, // DAC_LD_44_45
+{0x3526, 0x9812}, // DAC_LD_38_39
+{0x3528, 0x99C0}, // DAC_LD_40_41
+{0x352E, 0x0B71}, // DAC_LD_46_47
+{0x352A, 0x0170}, // DAC_LD_42_43
+{0x3530, 0x07F0}, // DAC_LD_48_49
+{0x3514, 0xEEEE}, // DAC_LD_20_21
+{0x3578, 0xEEEE}, // DAC_LD_120_121
+{0x3518, 0x3333}, // DAC_LD_24_25
+{0x3540, 0x0033}, // DAC_LD_64_65
+{0x3542, 0x33F0}, // DAC_LD_66_67
+
+//CFPN},IMPROVEMENT
+{0x3568, 0x04BC},
+{0x356A, 0x81AA},
+{0x356E, 0x15E6},
+
+//E1-E2 Transision Noise Improvement
+{0x3E10, 0x000A}, // LFM2_T1_E2_OFFSET
+{0x3430, 0x070C}, // BST_MULTISHOT_CLK_0
+{0x3432, 0x008C}, // BST_MULTISHOT_CLK_1
+{0x37B2, 0x1F40}, // DBLC_OUT_CLIP_MAX
+
+{0x3550, 0xFF6C}, // DAC_LD_80_81
+{0x3546, 0x4201}, // DAC_LD_70_71
+
+//T2 white balance gains
+{0x30B0, 0x0880}, // DIGITAL_TEST
+{0x3300, 0x0030}, // GREEN1_GAIN2_
+{0x3302, 0x0080}, // BLUE_GAIN2_
+{0x3304, 0x0070}, // RED_GAIN2_
+{0x3306, 0x0030}, // GREEN2_GAIN2_
+{0x3056, 0x002F}, // GREEN1_GAIN
+{0x3058, 0x0080}, // BLUE_GAIN
+{0x305A, 0x0072}, // RED_GAIN
+{0x305C, 0x002F}, // GREEN2_GAIN
+
+{0x301A, 0x005C}, // RESET_REGISTER
+};
diff --git a/drivers/media/i2c/soc_camera/ov106xx.c b/drivers/media/i2c/soc_camera/ov106xx.c
index c7bd92e..906ec7e 100644
--- a/drivers/media/i2c/soc_camera/ov106xx.c
+++ b/drivers/media/i2c/soc_camera/ov106xx.c
@@ -18,6 +18,7 @@
 #include "ar0220.c"
 #include "ar0231.c"
 #include "ar0233.c"
+#include "ar0323.c"
 #include "ap0101_ar014x.c"
 #include "gw4200_ar014x.c"
 #include "ov2775.c"
@@ -34,6 +35,7 @@ static enum {
 	ID_AR0220,
 	ID_AR0231,
 	ID_AR0233,
+	ID_AR0323,
 	ID_AP0101_AR014X,
 	ID_GW4200_AR014X,
 	ID_OV2775,
@@ -95,6 +97,12 @@ static int ov106xx_probe(struct i2c_client *client,
 		goto out;
 	}
 
+	ret = ar0323_probe(client, did);
+	if (!ret) {
+		chip_id = ID_AR0323;
+		goto out;
+	}
+
 	ret = ar0231_probe(client, did);
 	if (!ret) {
 		chip_id = ID_AR0231;
@@ -167,6 +175,9 @@ static int ov106xx_remove(struct i2c_client *client)
 	case ID_AR0233:
 		ar0233_remove(client);
 		break;
+	case ID_AR0323:
+		ar0323_remove(client);
+		break;
 	case ID_AP0101_AR014X:
 		ap0101_remove(client);
 		break;
@@ -211,6 +222,6 @@ static struct i2c_driver ov106xx_i2c_driver = {
 
 module_i2c_driver(ov106xx_i2c_driver);
 
-MODULE_DESCRIPTION("SoC Camera driver for OV10635, OV490+OV10640, OV495+OV2775, AR0132/140/143/220/223, AP0101+AR014X");
+MODULE_DESCRIPTION("SoC Camera driver for OV10635, OV490+OV10640, OV495+OV2775, AR0132/140/143/220/223/323, AP0101+AR014X");
 MODULE_AUTHOR("Vladimir Barinov");
 MODULE_LICENSE("GPL");
-- 
2.7.4

