]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
media: platform: tegra: update ov5693 driver.
authorFrank Chen <frankc@nvidia.com>
Thu, 3 Oct 2013 02:10:01 +0000 (19:10 -0700)
committerXiaohui Tao <xtao@nvidia.com>
Wed, 16 Oct 2013 18:06:52 +0000 (11:06 -0700)
Update the ov5693 driver to reflect changes made during
tegranote development on serperate branch.

Fixing the following issues:
- Sluggish preview
- Pink preview in video mode

Bug 1373309
Bug 1367317

Change-Id: Ic0de85a6b783678cebfc328e38cf84c30e6bf316
Signed-off-by: Frank Chen <frankc@nvidia.com>
Signed-off-by: David Wang <davidw@nvidia.com>
Reviewed-on: http://git-master/r/298692
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
drivers/media/platform/tegra/ov5693.c
include/media/ov5693.h

index 3e64faa91fd15ce1b24af97bce3781d42d1b4e99..671ce0d04f85eb74743b41a84e69afc50ddb580d 100644 (file)
@@ -45,6 +45,7 @@
 #define OV5693_LENS_FOCAL_LENGTH       6120    /* _INT2FLOAT_DIVISOR */
 #define OV5693_LENS_VIEW_ANGLE_H       60000   /* _INT2FLOAT_DIVISOR */
 #define OV5693_LENS_VIEW_ANGLE_V       60000   /* _INT2FLOAT_DIVISOR */
+#define OV5693_OTP_BUF_SIZE            16
 
 static struct nvc_gpio_init ov5693_gpio[] = {
        { OV5693_GPIO_TYPE_PWRDN, GPIOF_OUT_INIT_LOW, "pwrdn", false, true, },
@@ -70,6 +71,7 @@ struct ov5693_info {
        struct nvc_fuseid fuseid;
        struct regmap *regmap;
        struct regulator *ext_vcm_vdd;
+       struct ov5693_cal_data cal;
 };
 
 struct ov5693_reg {
@@ -143,37 +145,1032 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x30a0, 0xd2},
        {0x30a2, 0x01},
        {0x30b2, 0x00},
-       {0x30b3, 0x68},
+       {0x30b3, 0x64},
+       {0x30b4, 0x03},
+       {0x30b5, 0x04},
+       {0x30b6, 0x01},
+       {0x3104, 0x21},
+       {0x3106, 0x00},
+       {0x3406, 0x01},
+       {0x3500, 0x00},
+       {0x3501, 0x7b},
+       {0x3502, 0x00},
+       {0x3503, 0x07},
+       {0x3504, 0x00},
+       {0x3505, 0x00},
+       {0x3506, 0x00},
+       {0x3507, 0x02},
+       {0x3508, 0x00},
+       {0x3509, 0x10},
+       {0x350a, 0x00},
+       {0x350b, 0x40},
+       {0x3601, 0x0a},
+       {0x3602, 0x18},
+       {0x3612, 0x80},
+       {0x3620, 0x54},
+       {0x3621, 0xc7},
+       {0x3622, 0x0f},
+       {0x3625, 0x10},
+       {0x3630, 0x55},
+       {0x3631, 0xf4},
+       {0x3632, 0x00},
+       {0x3633, 0x34},
+       {0x3634, 0x02},
+       {0x364d, 0x0d},
+       {0x364f, 0xdd},
+       {0x3660, 0x04},
+       {0x3662, 0x10},
+       {0x3663, 0xf1},
+       {0x3665, 0x00},
+       {0x3666, 0x20},
+       {0x3667, 0x00},
+       {0x366a, 0x80},
+       {0x3680, 0xe0},
+       {0x3681, 0x00},
+       {0x3700, 0x42},
+       {0x3701, 0x14},
+       {0x3702, 0xa0},
+       {0x3703, 0xd8},
+       {0x3704, 0x78},
+       {0x3705, 0x02},
+       {0x3708, 0xe2},
+       {0x3709, 0xc3},
+       {0x370a, 0x00},
+       {0x370b, 0x20},
+       {0x370c, 0x0c},
+       {0x370d, 0x11},
+       {0x370e, 0x00},
+       {0x370f, 0x40},
+       {0x3710, 0x00},
+       {0x371a, 0x1c},
+       {0x371b, 0x05},
+       {0x371c, 0x01},
+       {0x371e, 0xa1},
+       {0x371f, 0x0c},
+       {0x3721, 0x00},
+       {0x3726, 0x00},
+       {0x372a, 0x01},
+       {0x3730, 0x10},
+       {0x3738, 0x22},
+       {0x3739, 0xe5},
+       {0x373a, 0x50},
+       {0x373b, 0x02},
+       {0x373c, 0x41},
+       {0x373f, 0x02},
+       {0x3740, 0x42},
+       {0x3741, 0x02},
+       {0x3742, 0x18},
+       {0x3743, 0x01},
+       {0x3744, 0x02},
+       {0x3747, 0x10},
+       {0x374c, 0x04},
+       {0x3751, 0xf0},
+       {0x3752, 0x00},
+       {0x3753, 0x00},
+       {0x3754, 0xc0},
+       {0x3755, 0x00},
+       {0x3756, 0x1a},
+       {0x3758, 0x00},
+       {0x3759, 0x0f},
+       {0x376b, 0x44},
+       {0x375c, 0x04},
+       {0x3776, 0x00},
+       {0x377f, 0x08},
+       {0x3780, 0x22},
+       {0x3781, 0x0c},
+       {0x3784, 0x2c},
+       {0x3785, 0x1e},
+       {0x378f, 0xf5},
+       {0x3791, 0xb0},
+       {0x3795, 0x00},
+       {0x3796, 0x64},
+       {0x3797, 0x11},
+       {0x3798, 0x30},
+       {0x3799, 0x41},
+       {0x379a, 0x07},
+       {0x379b, 0xb0},
+       {0x379c, 0x0c},
+       {0x37c5, 0x00},
+       {0x37c6, 0x00},
+       {0x37c7, 0x00},
+       {0x37c9, 0x00},
+       {0x37ca, 0x00},
+       {0x37cb, 0x00},
+       {0x37de, 0x00},
+       {0x37df, 0x00},
+       {0x3800, 0x00},
+       {0x3801, 0x02},
+       {0x3802, 0x00},
+       {0x3803, 0x02},
+       {0x3804, 0x0a},
+       {0x3805, 0x41},
+       {0x3806, 0x07},
+       {0x3807, 0xa5},
+       {0x3808, 0x0a},
+       {0x3809, 0x20},
+       {0x380a, 0x07},
+       {0x380b, 0x98},
+       {0x380c, 0x0a},
+       {0x380d, 0x80},
+       {0x380e, 0x07},
+       {0x380f, 0xc0},
+       {0x3810, 0x00},
+       {0x3811, 0x02},
+       {0x3812, 0x00},
+       {0x3813, 0x02},
+       {0x3814, 0x11},
+       {0x3815, 0x11},
+       {0x3820, 0x00},
+       {0x3821, 0x1e},
+       {0x3823, 0x00},
+       {0x3824, 0x00},
+       {0x3825, 0x00},
+       {0x3826, 0x00},
+       {0x3827, 0x00},
+       {0x382a, 0x04},
+       {0x3a04, 0x06},
+       {0x3a05, 0x14},
+       {0x3a06, 0x00},
+       {0x3a07, 0xfe},
+       {0x3b00, 0x00},
+       {0x3b02, 0x00},
+       {0x3b03, 0x00},
+       {0x3b04, 0x00},
+       {0x3b05, 0x00},
+       {0x3d00, 0x00},
+       {0x3d01, 0x00},
+       {0x3d02, 0x00},
+       {0x3d03, 0x00},
+       {0x3d04, 0x00},
+       {0x3d05, 0x00},
+       {0x3d06, 0x00},
+       {0x3d07, 0x00},
+       {0x3d08, 0x00},
+       {0x3d09, 0x00},
+       {0x3d0a, 0x00},
+       {0x3d0b, 0x00},
+       {0x3d0c, 0x00},
+       {0x3d0d, 0x00},
+       {0x3d0e, 0x00},
+       {0x3d0f, 0x00},
+       {0x3d80, 0x00},
+       {0x3d81, 0x00},
+       {0x3d84, 0x00},
+       {0x3e07, 0x20},
+       {0x4000, 0x08},
+       {0x4001, 0x04},
+       {0x4002, 0x45},
+       {0x4004, 0x08},
+       {0x4005, 0x18},
+       {0x4006, 0x20},
+       {0x4008, 0x24},
+       {0x4009, 0x10},
+       {0x400c, 0x00},
+       {0x400d, 0x00},
+       {0x4058, 0x00},
+       {0x4101, 0xb2},
+       {0x4303, 0x00},
+       {0x4304, 0x08},
+       {0x4307, 0x30},
+       {0x4311, 0x04},
+       {0x4315, 0x01},
+       {0x4511, 0x05},
+       {0x4512, 0x01},
+       {0x4806, 0x00},
+       {0x4816, 0x52},
+       {0x481f, 0x30},
+       {0x4826, 0x2c},
+       {0x4831, 0x64},
+       {0x4d00, 0x04},
+       {0x4d01, 0x71},
+       {0x4d02, 0xfd},
+       {0x4d03, 0xf5},
+       {0x4d04, 0x0c},
+       {0x4d05, 0xcc},
+       {0x4837, 0x0a},
+       {0x5000, 0x06},
+       {0x5001, 0x01},
+       {0x5002, 0x00},
+       {0x5003, 0x20},
+       {0x5046, 0x0a},
+       {0x5013, 0x00},
+       {0x5046, 0x0a},
+       {0x5780, 0x1c},
+       {0x5786, 0x20},
+       {0x5787, 0x10},
+       {0x5788, 0x18},
+       {0x578a, 0x04},
+       {0x578b, 0x02},
+       {0x578c, 0x02},
+       {0x578e, 0x06},
+       {0x578f, 0x02},
+       {0x5790, 0x02},
+       {0x5791, 0xff},
+       {0x5842, 0x01},
+       {0x5843, 0x2b},
+       {0x5844, 0x01},
+       {0x5845, 0x92},
+       {0x5846, 0x01},
+       {0x5847, 0x8f},
+       {0x5848, 0x01},
+       {0x5849, 0x0c},
+       {0x5e00, 0x00},
+       {0x5e10, 0x0c},
+       {OV5693_TABLE_END, 0x0000}
+};
+
+static const struct ov5693_reg ov5693_1296x972_i2c[] = {
+       {OV5693_TABLE_RESET, 0},/* Including sw reset */
+       {0x0103, 0x01},
+       {0x3001, 0x0a},
+       {0x3002, 0x80},
+       {0x3006, 0x00},
+       {0x3011, 0x21},
+       {0x3012, 0x09},
+       {0x3013, 0x10},
+       {0x3014, 0x00},
+       {0x3015, 0x08},
+       {0x3016, 0xf0},
+       {0x3017, 0xf0},
+       {0x3018, 0xf0},
+       {0x301b, 0xb4},
+       {0x301d, 0x02},
+       {0x3021, 0x00},
+       {0x3022, 0x01},
+       {0x3028, 0x44},
+       {0x3098, 0x03},
+       {0x3099, 0x1e},
+       {0x309a, 0x02},
+       {0x309b, 0x01},
+       {0x309c, 0x00},
+       {0x30a0, 0xd2},
+       {0x30a2, 0x01},
+       {0x30b2, 0x00},
+       {0x30b3, 0x64},
+       {0x30b4, 0x03},
+       {0x30b5, 0x04},
+       {0x30b6, 0x01},
+       {0x3104, 0x21},
+       {0x3106, 0x00},
+       {0x3406, 0x01},
+       {0x3500, 0x00},
+       {0x3501, 0x7b},
+       {0x3502, 0x00},
+       {0x3503, 0x07},
+       {0x3504, 0x00},
+       {0x3505, 0x00},
+       {0x3506, 0x00},
+       {0x3507, 0x02},
+       {0x3508, 0x00},
+       {0x3509, 0x10},
+       {0x350a, 0x00},
+       {0x350b, 0x40},
+       {0x3601, 0x0a},
+       {0x3602, 0x38},
+       {0x3612, 0x80},
+       {0x3620, 0x54},
+       {0x3621, 0xc7},
+       {0x3622, 0x0f},
+       {0x3625, 0x10},
+       {0x3630, 0x55},
+       {0x3631, 0xf4},
+       {0x3632, 0x00},
+       {0x3633, 0x34},
+       {0x3634, 0x02},
+       {0x364d, 0x0d},
+       {0x364f, 0xdd},
+       {0x3660, 0x04},
+       {0x3662, 0x10},
+       {0x3663, 0xf1},
+       {0x3665, 0x00},
+       {0x3666, 0x20},
+       {0x3667, 0x00},
+       {0x366a, 0x80},
+       {0x3680, 0xe0},
+       {0x3681, 0x00},
+       {0x3700, 0x42},
+       {0x3701, 0x14},
+       {0x3702, 0xa0},
+       {0x3703, 0xd8},
+       {0x3704, 0x78},
+       {0x3705, 0x02},
+       {0x3708, 0xe6},
+       {0x3709, 0xc3},
+       {0x370a, 0x00},
+       {0x370b, 0x20},
+       {0x370c, 0x0c},
+       {0x370d, 0x11},
+       {0x370e, 0x00},
+       {0x370f, 0x40},
+       {0x3710, 0x00},
+       {0x371a, 0x1c},
+       {0x371b, 0x05},
+       {0x371c, 0x01},
+       {0x371e, 0xa1},
+       {0x371f, 0x0c},
+       {0x3721, 0x00},
+       {0x3724, 0x10},
+       {0x3726, 0x00},
+       {0x372a, 0x01},
+       {0x3730, 0x10},
+       {0x3738, 0x22},
+       {0x3739, 0xe5},
+       {0x373a, 0x50},
+       {0x373b, 0x02},
+       {0x373c, 0x41},
+       {0x373f, 0x02},
+       {0x3740, 0x42},
+       {0x3741, 0x02},
+       {0x3742, 0x18},
+       {0x3743, 0x01},
+       {0x3744, 0x02},
+       {0x3747, 0x10},
+       {0x374c, 0x04},
+       {0x3751, 0xf0},
+       {0x3752, 0x00},
+       {0x3753, 0x00},
+       {0x3754, 0xc0},
+       {0x3755, 0x00},
+       {0x3756, 0x1a},
+       {0x3758, 0x00},
+       {0x3759, 0x0f},
+       {0x376b, 0x44},
+       {0x375c, 0x04},
+       {0x3774, 0x10},
+       {0x3776, 0x00},
+       {0x377f, 0x08},
+       {0x3780, 0x22},
+       {0x3781, 0x0c},
+       {0x3784, 0x2c},
+       {0x3785, 0x1e},
+       {0x378f, 0xf5},
+       {0x3791, 0xb0},
+       {0x3795, 0x00},
+       {0x3796, 0x64},
+       {0x3797, 0x11},
+       {0x3798, 0x30},
+       {0x3799, 0x41},
+       {0x379a, 0x07},
+       {0x379b, 0xb0},
+       {0x379c, 0x0c},
+       {0x37c5, 0x00},
+       {0x37c6, 0x00},
+       {0x37c7, 0x00},
+       {0x37c9, 0x00},
+       {0x37ca, 0x00},
+       {0x37cb, 0x00},
+       {0x37de, 0x00},
+       {0x37df, 0x00},
+       {0x3800, 0x00},
+       {0x3801, 0x00},
+       {0x3802, 0x00},
+       {0x3803, 0x00},
+       {0x3804, 0x0a},
+       {0x3805, 0x3f},
+       {0x3806, 0x07},
+       {0x3807, 0xa3},
+       {0x3808, 0x05},
+       {0x3809, 0x10},
+       {0x380a, 0x03},
+       {0x380b, 0xcc},
+       {0x380c, 0x0a},
+       {0x380d, 0x80},
+       {0x380e, 0x07},
+       {0x380f, 0xc0},
+       {0x3810, 0x00},
+       {0x3811, 0x02},
+       {0x3812, 0x00},
+       {0x3813, 0x02},
+       {0x3814, 0x31},
+       {0x3815, 0x31},
+       {0x3820, 0x01},
+       {0x3821, 0x1f},
+       {0x3823, 0x00},
+       {0x3824, 0x00},
+       {0x3825, 0x00},
+       {0x3826, 0x00},
+       {0x3827, 0x00},
+       {0x382a, 0x04},
+       {0x3a04, 0x06},
+       {0x3a05, 0x14},
+       {0x3a06, 0x00},
+       {0x3a07, 0xfe},
+       {0x3b00, 0x00},
+       {0x3b02, 0x00},
+       {0x3b03, 0x00},
+       {0x3b04, 0x00},
+       {0x3b05, 0x00},
+       {0x3e07, 0x20},
+       {0x4000, 0x08},
+       {0x4001, 0x04},
+       {0x4002, 0x45},
+       {0x4004, 0x08},
+       {0x4005, 0x18},
+       {0x4006, 0x20},
+       {0x4008, 0x24},
+       {0x4009, 0x10},
+       {0x400c, 0x00},
+       {0x400d, 0x00},
+       {0x4058, 0x00},
+       {0x404e, 0x37},
+       {0x404f, 0x8f},
+       {0x4058, 0x00},
+       {0x4101, 0xb2},
+       {0x4303, 0x00},
+       {0x4304, 0x08},
+       {0x4307, 0x30},
+       {0x4311, 0x04},
+       {0x4315, 0x01},
+       {0x4511, 0x05},
+       {0x4512, 0x00},
+       {0x4806, 0x00},
+       {0x4816, 0x52},
+       {0x481f, 0x30},
+       {0x4826, 0x2c},
+       {0x4831, 0x64},
+       {0x4d00, 0x04},
+       {0x4d01, 0x71},
+       {0x4d02, 0xfd},
+       {0x4d03, 0xf5},
+       {0x4d04, 0x0c},
+       {0x4d05, 0xcc},
+       {0x4837, 0x0a},
+       {0x5000, 0x06},
+       {0x5001, 0x01},
+       {0x5002, 0x00},
+       {0x5003, 0x20},
+       {0x5046, 0x0a},
+       {0x5013, 0x00},
+       {0x5046, 0x0a},
+       {0x5780, 0x1c},
+       {0x5786, 0x20},
+       {0x5787, 0x10},
+       {0x5788, 0x18},
+       {0x578a, 0x04},
+       {0x578b, 0x02},
+       {0x578c, 0x02},
+       {0x578e, 0x06},
+       {0x578f, 0x02},
+       {0x5790, 0x02},
+       {0x5791, 0xff},
+       {0x5842, 0x01},
+       {0x5843, 0x2b},
+       {0x5844, 0x01},
+       {0x5845, 0x92},
+       {0x5846, 0x01},
+       {0x5847, 0x8f},
+       {0x5848, 0x01},
+       {0x5849, 0x0c},
+       {0x5e00, 0x00},
+       {0x5e10, 0x0c},
+       {OV5693_TABLE_END, 0x0000}
+};
+
+static const struct ov5693_reg ov5693_1920x1080_i2c[] = {
+       {OV5693_TABLE_RESET, 0x0},/*, 0xIncluding, 0xsw, 0xreset, 0x*/
+       {0x3001, 0x0a},
+       {0x3002, 0x80},
+       {0x3006, 0x00},
+       {0x3011, 0x21},
+       {0x3012, 0x09},
+       {0x3013, 0x10},
+       {0x3014, 0x00},
+       {0x3015, 0x08},
+       {0x3016, 0xf0},
+       {0x3017, 0xf0},
+       {0x3018, 0xf0},
+       {0x301b, 0xb4},
+       {0x301d, 0x02},
+       {0x3021, 0x00},
+       {0x3022, 0x01},
+       {0x3028, 0x44},
+       {0x3098, 0x03},
+       {0x3099, 0x1e},
+       {0x309a, 0x02},
+       {0x309b, 0x01},
+       {0x309c, 0x00},
+       {0x30a0, 0xd2},
+       {0x30a2, 0x01},
+       {0x30b2, 0x00},
+       {0x30b3, 0x64},
+       {0x30b4, 0x03},
+       {0x30b5, 0x04},
+       {0x30b6, 0x01},
+       {0x3104, 0x21},
+       {0x3106, 0x00},
+       {0x3406, 0x01},
+       {0x3500, 0x00},
+       {0x3501, 0x7b},
+       {0x3502, 0x00},
+       {0x3503, 0x07},
+       {0x3504, 0x00},
+       {0x3505, 0x00},
+       {0x3506, 0x00},
+       {0x3507, 0x02},
+       {0x3508, 0x00},
+       {0x3509, 0x10},
+       {0x350a, 0x00},
+       {0x350b, 0x40},
+       {0x3601, 0x0a},
+       {0x3602, 0x38},
+       {0x3612, 0x80},
+       {0x3620, 0x54},
+       {0x3621, 0xc7},
+       {0x3622, 0x0f},
+       {0x3625, 0x10},
+       {0x3630, 0x55},
+       {0x3631, 0xf4},
+       {0x3632, 0x00},
+       {0x3633, 0x34},
+       {0x3634, 0x02},
+       {0x364d, 0x0d},
+       {0x364f, 0xdd},
+       {0x3660, 0x04},
+       {0x3662, 0x10},
+       {0x3663, 0xf1},
+       {0x3665, 0x00},
+       {0x3666, 0x20},
+       {0x3667, 0x00},
+       {0x366a, 0x80},
+       {0x3680, 0xe0},
+       {0x3681, 0x00},
+       {0x3700, 0x42},
+       {0x3701, 0x14},
+       {0x3702, 0xa0},
+       {0x3703, 0xd8},
+       {0x3704, 0x78},
+       {0x3705, 0x02},
+       {0x3708, 0xe2},
+       {0x3709, 0xc3},
+       {0x370a, 0x00},
+       {0x370b, 0x20},
+       {0x370c, 0x0c},
+       {0x370d, 0x11},
+       {0x370e, 0x00},
+       {0x370f, 0x40},
+       {0x3710, 0x00},
+       {0x371a, 0x1c},
+       {0x371b, 0x05},
+       {0x371c, 0x01},
+       {0x371e, 0xa1},
+       {0x371f, 0x0c},
+       {0x3721, 0x00},
+       {0x3724, 0x10},
+       {0x3726, 0x00},
+       {0x372a, 0x01},
+       {0x3730, 0x10},
+       {0x3738, 0x22},
+       {0x3739, 0xe5},
+       {0x373a, 0x50},
+       {0x373b, 0x02},
+       {0x373c, 0x41},
+       {0x373f, 0x02},
+       {0x3740, 0x42},
+       {0x3741, 0x02},
+       {0x3742, 0x18},
+       {0x3743, 0x01},
+       {0x3744, 0x02},
+       {0x3747, 0x10},
+       {0x374c, 0x04},
+       {0x3751, 0xf0},
+       {0x3752, 0x00},
+       {0x3753, 0x00},
+       {0x3754, 0xc0},
+       {0x3755, 0x00},
+       {0x3756, 0x1a},
+       {0x3758, 0x00},
+       {0x3759, 0x0f},
+       {0x376b, 0x44},
+       {0x375c, 0x04},
+       {0x3774, 0x10},
+       {0x3776, 0x00},
+       {0x377f, 0x08},
+       {0x3780, 0x22},
+       {0x3781, 0x0c},
+       {0x3784, 0x2c},
+       {0x3785, 0x1e},
+       {0x378f, 0xf5},
+       {0x3791, 0xb0},
+       {0x3795, 0x00},
+       {0x3796, 0x64},
+       {0x3797, 0x11},
+       {0x3798, 0x30},
+       {0x3799, 0x41},
+       {0x379a, 0x07},
+       {0x379b, 0xb0},
+       {0x379c, 0x0c},
+       {0x37c5, 0x00},
+       {0x37c6, 0x00},
+       {0x37c7, 0x00},
+       {0x37c9, 0x00},
+       {0x37ca, 0x00},
+       {0x37cb, 0x00},
+       {0x37de, 0x00},
+       {0x37df, 0x00},
+       {0x3800, 0x00},
+       {0x3801, 0x00},
+       {0x3802, 0x00},
+       {0x3803, 0xf8},
+       {0x3804, 0x0a},
+       {0x3805, 0x3f},
+       {0x3806, 0x06},
+       {0x3807, 0xab},
+       {0x3808, 0x07},
+       {0x3809, 0x80},
+       {0x380a, 0x04},
+       {0x380b, 0x38},
+       {0x380c, 0x0a},
+       {0x380d, 0x80},
+       {0x380e, 0x07},
+       {0x380f, 0xc0},
+       {0x3810, 0x00},
+       {0x3811, 0x02},
+       {0x3812, 0x00},
+       {0x3813, 0x02},
+       {0x3814, 0x11},
+       {0x3815, 0x11},
+       {0x3820, 0x00},
+       {0x3821, 0x1e},
+       {0x3823, 0x00},
+       {0x3824, 0x00},
+       {0x3825, 0x00},
+       {0x3826, 0x00},
+       {0x3827, 0x00},
+       {0x382a, 0x04},
+       {0x3a04, 0x06},
+       {0x3a05, 0x14},
+       {0x3a06, 0x00},
+       {0x3a07, 0xfe},
+       {0x3b00, 0x00},
+       {0x3b02, 0x00},
+       {0x3b03, 0x00},
+       {0x3b04, 0x00},
+       {0x3b05, 0x00},
+       {0x3e07, 0x20},
+       {0x4000, 0x08},
+       {0x4001, 0x04},
+       {0x4002, 0x45},
+       {0x4004, 0x08},
+       {0x4005, 0x18},
+       {0x4006, 0x20},
+       {0x4008, 0x24},
+       {0x4009, 0x10},
+       {0x400c, 0x00},
+       {0x400d, 0x00},
+       {0x4058, 0x00},
+       {0x404e, 0x37},
+       {0x404f, 0x8f},
+       {0x4058, 0x00},
+       {0x4101, 0xb2},
+       {0x4303, 0x00},
+       {0x4304, 0x08},
+       {0x4307, 0x30},
+       {0x4311, 0x04},
+       {0x4315, 0x01},
+       {0x4511, 0x05},
+       {0x4512, 0x01},
+       {0x4806, 0x00},
+       {0x4816, 0x52},
+       {0x481f, 0x30},
+       {0x4826, 0x2c},
+       {0x4831, 0x64},
+       {0x4d00, 0x04},
+       {0x4d01, 0x71},
+       {0x4d02, 0xfd},
+       {0x4d03, 0xf5},
+       {0x4d04, 0x0c},
+       {0x4d05, 0xcc},
+       {0x4837, 0x0a},
+       {0x5000, 0x06},
+       {0x5001, 0x01},
+       {0x5002, 0x80},
+       {0x5003, 0x20},
+       {0x5046, 0x0a},
+       {0x5013, 0x00},
+       {0x5046, 0x0a},
+       {0x5780, 0x1c},
+       {0x5786, 0x20},
+       {0x5787, 0x10},
+       {0x5788, 0x18},
+       {0x578a, 0x04},
+       {0x578b, 0x02},
+       {0x578c, 0x02},
+       {0x578e, 0x06},
+       {0x578f, 0x02},
+       {0x5790, 0x02},
+       {0x5791, 0xff},
+       {0x5842, 0x01},
+       {0x5843, 0x2b},
+       {0x5844, 0x01},
+       {0x5845, 0x92},
+       {0x5846, 0x01},
+       {0x5847, 0x8f},
+       {0x5848, 0x01},
+       {0x5849, 0x0c},
+       {0x5e00, 0x00},
+       {0x5e10, 0x0c},
+       {OV5693_TABLE_END, 0x0000}
+};
+
+
+static const struct ov5693_reg ov5693_1280x720_120fps_i2c[] = {
+       {OV5693_TABLE_RESET, 0},/* Including sw reset */
+       {0x3001, 0x0a},
+       {0x3002, 0x80},
+       {0x3006, 0x00},
+       {0x3011, 0x21},
+       {0x3012, 0x09},
+       {0x3013, 0x10},
+       {0x3014, 0x00},
+       {0x3015, 0x08},
+       {0x3016, 0xf0},
+       {0x3017, 0xf0},
+       {0x3018, 0xf0},
+       {0x301b, 0xb4},
+       {0x301d, 0x02},
+       {0x3021, 0x00},
+       {0x3022, 0x01},
+       {0x3028, 0x44},
+       {0x3098, 0x03},
+       {0x3099, 0x1e},
+       {0x309a, 0x02},
+       {0x309b, 0x01},
+       {0x309c, 0x00},
+       {0x30a0, 0xd2},
+       {0x30a2, 0x01},
+       {0x30b2, 0x00},
+       {0x30b3, 0x64},
+       {0x30b4, 0x03},
+       {0x30b5, 0x04},
+       {0x30b6, 0x01},
+       {0x3104, 0x21},
+       {0x3106, 0x00},
+       {0x3406, 0x01},
+       {0x3500, 0x00},
+       {0x3501, 0x2e},
+       {0x3502, 0x80},
+       {0x3503, 0x07},
+       {0x3504, 0x00},
+       {0x3505, 0x00},
+       {0x3506, 0x00},
+       {0x3507, 0x02},
+       {0x3508, 0x00},
+       {0x3509, 0x10},
+       {0x350a, 0x00},
+       {0x350b, 0x40},
+       {0x3601, 0x0a},
+       {0x3602, 0x38},
+       {0x3612, 0x80},
+       {0x3620, 0x54},
+       {0x3621, 0xc7},
+       {0x3622, 0x0f},
+       {0x3625, 0x10},
+       {0x3630, 0x55},
+       {0x3631, 0xf4},
+       {0x3632, 0x00},
+       {0x3633, 0x34},
+       {0x3634, 0x02},
+       {0x364d, 0x0d},
+       {0x364f, 0xdd},
+       {0x3660, 0x04},
+       {0x3662, 0x10},
+       {0x3663, 0xf1},
+       {0x3665, 0x00},
+       {0x3666, 0x20},
+       {0x3667, 0x00},
+       {0x366a, 0x80},
+       {0x3680, 0xe0},
+       {0x3681, 0x00},
+       {0x3700, 0x42},
+       {0x3701, 0x14},
+       {0x3702, 0xa0},
+       {0x3703, 0xd8},
+       {0x3704, 0x78},
+       {0x3705, 0x02},
+       {0x3708, 0xe6},
+       {0x3709, 0xc7},
+       {0x370a, 0x00},
+       {0x370b, 0x20},
+       {0x370c, 0x0c},
+       {0x370d, 0x11},
+       {0x370e, 0x00},
+       {0x370f, 0x40},
+       {0x3710, 0x00},
+       {0x371a, 0x1c},
+       {0x371b, 0x05},
+       {0x371c, 0x01},
+       {0x371e, 0xa1},
+       {0x371f, 0x0c},
+       {0x3721, 0x00},
+       {0x3724, 0x10},
+       {0x3726, 0x00},
+       {0x372a, 0x01},
+       {0x3730, 0x10},
+       {0x3738, 0x22},
+       {0x3739, 0xe5},
+       {0x373a, 0x50},
+       {0x373b, 0x02},
+       {0x373c, 0x41},
+       {0x373f, 0x02},
+       {0x3740, 0x42},
+       {0x3741, 0x02},
+       {0x3742, 0x18},
+       {0x3743, 0x01},
+       {0x3744, 0x02},
+       {0x3747, 0x10},
+       {0x374c, 0x04},
+       {0x3751, 0xf0},
+       {0x3752, 0x00},
+       {0x3753, 0x00},
+       {0x3754, 0xc0},
+       {0x3755, 0x00},
+       {0x3756, 0x1a},
+       {0x3758, 0x00},
+       {0x3759, 0x0f},
+       {0x376b, 0x44},
+       {0x375c, 0x04},
+       {0x3774, 0x10},
+       {0x3776, 0x00},
+       {0x377f, 0x08},
+       {0x3780, 0x22},
+       {0x3781, 0x0c},
+       {0x3784, 0x2c},
+       {0x3785, 0x1e},
+       {0x378f, 0xf5},
+       {0x3791, 0xb0},
+       {0x3795, 0x00},
+       {0x3796, 0x64},
+       {0x3797, 0x11},
+       {0x3798, 0x30},
+       {0x3799, 0x41},
+       {0x379a, 0x07},
+       {0x379b, 0xb0},
+       {0x379c, 0x0c},
+       {0x37c5, 0x00},
+       {0x37c6, 0x00},
+       {0x37c7, 0x00},
+       {0x37c9, 0x00},
+       {0x37ca, 0x00},
+       {0x37cb, 0x00},
+       {0x37de, 0x00},
+       {0x37df, 0x00},
+       {0x3800, 0x00},
+       {0x3801, 0x00},
+       {0x3802, 0x00},
+       {0x3803, 0xf4},
+       {0x3804, 0x0a},
+       {0x3805, 0x3f},
+       {0x3806, 0x06},
+       {0x3807, 0xab},
+       {0x3808, 0x05},
+       {0x3809, 0x00},
+       {0x380a, 0x02},
+       {0x380b, 0xd0},
+       {0x380c, 0x06},
+       {0x380d, 0xd8},
+       {0x380e, 0x02},
+       {0x380f, 0xf8},
+       {0x3810, 0x00},
+       {0x3811, 0x02},
+       {0x3812, 0x00},
+       {0x3813, 0x02},
+       {0x3814, 0x31},
+       {0x3815, 0x31},
+       {0x3820, 0x04},
+       {0x3821, 0x1f},
+       {0x3823, 0x00},
+       {0x3824, 0x00},
+       {0x3825, 0x00},
+       {0x3826, 0x00},
+       {0x3827, 0x00},
+       {0x382a, 0x04},
+       {0x3a04, 0x06},
+       {0x3a05, 0x14},
+       {0x3a06, 0x00},
+       {0x3a07, 0xfe},
+       {0x3b00, 0x00},
+       {0x3b02, 0x00},
+       {0x3b03, 0x00},
+       {0x3b04, 0x00},
+       {0x3b05, 0x00},
+       {0x3e07, 0x20},
+       {0x4000, 0x08},
+       {0x4001, 0x04},
+       {0x4002, 0x45},
+       {0x4004, 0x08},
+       {0x4005, 0x18},
+       {0x4006, 0x20},
+       {0x4008, 0x24},
+       {0x4009, 0x10},
+       {0x400c, 0x00},
+       {0x400d, 0x00},
+       {0x4058, 0x00},
+       {0x404e, 0x37},
+       {0x404f, 0x8f},
+       {0x4058, 0x00},
+       {0x4101, 0xb2},
+       {0x4303, 0x00},
+       {0x4304, 0x08},
+       {0x4307, 0x30},
+       {0x4311, 0x04},
+       {0x4315, 0x01},
+       {0x4511, 0x05},
+       {0x4512, 0x00},
+       {0x4806, 0x00},
+       {0x4816, 0x52},
+       {0x481f, 0x30},
+       {0x4826, 0x2c},
+       {0x4831, 0x64},
+       {0x4d00, 0x04},
+       {0x4d01, 0x71},
+       {0x4d02, 0xfd},
+       {0x4d03, 0xf5},
+       {0x4d04, 0x0c},
+       {0x4d05, 0xcc},
+       {0x4837, 0x0a},
+       {0x5000, 0x06},
+       {0x5001, 0x01},
+       {0x5002, 0x00},
+       {0x5003, 0x20},
+       {0x5046, 0x0a},
+       {0x5013, 0x00},
+       {0x5046, 0x0a},
+       {0x5780, 0x1c},
+       {0x5786, 0x20},
+       {0x5787, 0x10},
+       {0x5788, 0x18},
+       {0x578a, 0x04},
+       {0x578b, 0x02},
+       {0x578c, 0x02},
+       {0x578e, 0x06},
+       {0x578f, 0x02},
+       {0x5790, 0x02},
+       {0x5791, 0xff},
+       {0x5842, 0x01},
+       {0x5843, 0x2b},
+       {0x5844, 0x01},
+       {0x5845, 0x92},
+       {0x5846, 0x01},
+       {0x5847, 0x8f},
+       {0x5848, 0x01},
+       {0x5849, 0x0c},
+       {0x5e00, 0x00},
+       {0x5e10, 0x0c},
+       {OV5693_TABLE_END, 0x0000}
+};
+
+static const struct ov5693_reg ov5693_2592x1944_HDR_24fps_i2c[] = {
+       {OV5693_TABLE_RESET, 0},/* Including sw reset */
+       {0x0103, 0x01},
+       {0x3001, 0x0a},
+       {0x3002, 0x80},
+       {0x3006, 0x00},
+       {0x3011, 0x21},
+       {0x3012, 0x09},
+       {0x3013, 0x10},
+       {0x3014, 0x00},
+       {0x3015, 0x08},
+       {0x3016, 0xf0},
+       {0x3017, 0xf0},
+       {0x3018, 0xf0},
+       {0x301b, 0xb4},
+       {0x301d, 0x02},
+       {0x3021, 0x00},
+       {0x3022, 0x01},
+       {0x3028, 0x44},
+       {0x3098, 0x02},
+       {0x3099, 0x16},
+       {0x309a, 0x02},
+       {0x309b, 0x01},
+       {0x309c, 0x00},
+       {0x30b2, 0x00},
+       {0x30b3, 0x6e},
        {0x30b4, 0x03},
+       {0x30a0, 0xd2},
+       {0x30a2, 0x01},
        {0x30b5, 0x04},
        {0x30b6, 0x01},
        {0x3104, 0x21},
        {0x3106, 0x00},
-       {0x3400, 0x04},
-       {0x3401, 0x00},
-       {0x3402, 0x04},
-       {0x3403, 0x00},
-       {0x3404, 0x04},
-       {0x3405, 0x00},
        {0x3406, 0x01},
        {0x3500, 0x00},
        {0x3501, 0x7b},
-       {0x3502, 0x00},
+       {0x3502, 0x80},
        {0x3503, 0x07},
        {0x3504, 0x00},
        {0x3505, 0x00},
        {0x3506, 0x00},
-       {0x3507, 0x02},
-       {0x3508, 0x00},
-       {0x3509, 0x08},
+       {0x3507, 0x01},
+       {0x3508, 0x80},
+       {0x3509, 0x10},
        {0x350a, 0x00},
        {0x350b, 0x40},
        {0x3601, 0x0a},
-       {0x3602, 0x18},
+       {0x3602, 0x38},
        {0x3612, 0x80},
        {0x3620, 0x54},
        {0x3621, 0xc7},
-       {0x3622, 0x0f},
+       {0x3622, 0x05},
        {0x3625, 0x10},
        {0x3630, 0x55},
        {0x3631, 0xf4},
@@ -194,7 +1191,7 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x3700, 0x42},
        {0x3701, 0x14},
        {0x3702, 0xa0},
-       {0x3703, 0xd8},
+       {0x3703, 0xa8},
        {0x3704, 0x78},
        {0x3705, 0x02},
        {0x3708, 0xe2},
@@ -206,12 +1203,13 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x370e, 0x00},
        {0x370f, 0x40},
        {0x3710, 0x00},
-       {0x371a, 0x1c},
+       {0x371a, 0x0c},
        {0x371b, 0x05},
        {0x371c, 0x01},
        {0x371e, 0xa1},
        {0x371f, 0x0c},
        {0x3721, 0x00},
+       {0x3724, 0x10},
        {0x3726, 0x00},
        {0x372a, 0x01},
        {0x3730, 0x10},
@@ -238,6 +1236,7 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x3759, 0x0f},
        {0x376b, 0x44},
        {0x375c, 0x04},
+       {0x3774, 0x10},
        {0x3776, 0x00},
        {0x377f, 0x08},
        {0x3780, 0x22},
@@ -263,37 +1262,37 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x37de, 0x00},
        {0x37df, 0x00},
        {0x3800, 0x00},
-       {0x3801, 0x00},
+       {0x3801, 0x02},
        {0x3802, 0x00},
-       {0x3803, 0x00},
+       {0x3803, 0x06},
        {0x3804, 0x0a},
-       {0x3805, 0x3f},
+       {0x3805, 0x41},
        {0x3806, 0x07},
-       {0x3807, 0xa3},
+       {0x3807, 0xa1},
        {0x3808, 0x0a},
        {0x3809, 0x20},
        {0x380a, 0x07},
        {0x380b, 0x98},
-       {0x380c, 0x0a},
-       {0x380d, 0x80},
+       {0x380c, 0x0e},
+       {0x380d, 0x70},
        {0x380e, 0x07},
        {0x380f, 0xc0},
        {0x3810, 0x00},
-       {0x3811, 0x02},
+       {0x3811, 0x10},
        {0x3812, 0x00},
        {0x3813, 0x02},
        {0x3814, 0x11},
        {0x3815, 0x11},
        {0x3820, 0x00},
-       {0x3821, 0x1e},
+       {0x3821, 0x9e},
        {0x3823, 0x00},
        {0x3824, 0x00},
        {0x3825, 0x00},
        {0x3826, 0x00},
        {0x3827, 0x00},
        {0x382a, 0x04},
-       {0x3a04, 0x06},
-       {0x3a05, 0x14},
+       {0x3a04, 0x09},
+       {0x3a05, 0xa9},
        {0x3a06, 0x00},
        {0x3a07, 0xfe},
        {0x3b00, 0x00},
@@ -301,25 +1300,6 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x3b03, 0x00},
        {0x3b04, 0x00},
        {0x3b05, 0x00},
-       {0x3d00, 0x00},
-       {0x3d01, 0x00},
-       {0x3d02, 0x00},
-       {0x3d03, 0x00},
-       {0x3d04, 0x00},
-       {0x3d05, 0x00},
-       {0x3d06, 0x00},
-       {0x3d07, 0x00},
-       {0x3d08, 0x00},
-       {0x3d09, 0x00},
-       {0x3d0a, 0x00},
-       {0x3d0b, 0x00},
-       {0x3d0c, 0x00},
-       {0x3d0d, 0x00},
-       {0x3d0e, 0x00},
-       {0x3d0f, 0x00},
-       {0x3d80, 0x00},
-       {0x3d81, 0x00},
-       {0x3d84, 0x00},
        {0x3e07, 0x20},
        {0x4000, 0x08},
        {0x4001, 0x04},
@@ -332,6 +1312,9 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x400c, 0x00},
        {0x400d, 0x00},
        {0x4058, 0x00},
+       {0x404e, 0x37},
+       {0x404f, 0x8f},
+       {0x4058, 0x00},
        {0x4101, 0xb2},
        {0x4303, 0x00},
        {0x4304, 0x08},
@@ -351,7 +1334,7 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x4d03, 0xf5},
        {0x4d04, 0x0c},
        {0x4d05, 0xcc},
-       {0x4837, 0x09},
+       {0x4837, 0x0a},
        {0x5000, 0x06},
        {0x5001, 0x01},
        {0x5002, 0x00},
@@ -380,12 +1363,10 @@ static const struct ov5693_reg ov5693_2592x1944_i2c[] = {
        {0x5849, 0x0c},
        {0x5e00, 0x00},
        {0x5e10, 0x0c},
-       {0x0100, 0x01},
-
        {OV5693_TABLE_END, 0x0000}
 };
 
-static const struct ov5693_reg ov5693_1296x972_i2c[] = {
+static const struct ov5693_reg ov5693_1920x1080_HDR_30fps_i2c[] = {
        {OV5693_TABLE_RESET, 0},/* Including sw reset */
        {0x0103, 0x01},
        {0x3001, 0x0a},
@@ -418,23 +1399,17 @@ static const struct ov5693_reg ov5693_1296x972_i2c[] = {
        {0x30b6, 0x01},
        {0x3104, 0x21},
        {0x3106, 0x00},
-       {0x3400, 0x04},
-       {0x3401, 0x00},
-       {0x3402, 0x04},
-       {0x3403, 0x00},
-       {0x3404, 0x04},
-       {0x3405, 0x00},
        {0x3406, 0x01},
        {0x3500, 0x00},
-       {0x3501, 0x7b},
+       {0x3501, 0x72},
        {0x3502, 0x00},
        {0x3503, 0x07},
        {0x3504, 0x00},
        {0x3505, 0x00},
        {0x3506, 0x00},
-       {0x3507, 0x02},
-       {0x3508, 0x00},
-       {0x3509, 0x08},
+       {0x3507, 0x01},
+       {0x3508, 0x80},
+       {0x3509, 0x10},
        {0x350a, 0x00},
        {0x350b, 0x40},
        {0x3601, 0x0a},
@@ -466,7 +1441,7 @@ static const struct ov5693_reg ov5693_1296x972_i2c[] = {
        {0x3703, 0xd8},
        {0x3704, 0x78},
        {0x3705, 0x02},
-       {0x3708, 0xe6},
+       {0x3708, 0xe2},
        {0x3709, 0xc3},
        {0x370a, 0x00},
        {0x370b, 0x20},
@@ -533,38 +1508,38 @@ static const struct ov5693_reg ov5693_1296x972_i2c[] = {
        {0x37cb, 0x00},
        {0x37de, 0x00},
        {0x37df, 0x00},
-       {0x3800, 0x00},
-       {0x3801, 0x00},
-       {0x3802, 0x00},
-       {0x3803, 0x00},
-       {0x3804, 0x0a},
-       {0x3805, 0x3f},
-       {0x3806, 0x07},
-       {0x3807, 0xa3},
-       {0x3808, 0x05},
-       {0x3809, 0x10},
-       {0x380a, 0x03},
-       {0x380b, 0xcc},
-       {0x380c, 0x0a},
-       {0x380d, 0x80},
+       {0x3800, 0x01},
+       {0x3801, 0x70},
+       {0x3802, 0x01},
+       {0x3803, 0xbc},
+       {0x3804, 0x09},
+       {0x3805, 0x0f},
+       {0x3806, 0x05},
+       {0x3807, 0xff},
+       {0x3808, 0x07},
+       {0x3809, 0x80},
+       {0x380a, 0x04},
+       {0x380b, 0x38},
+       {0x380c, 0x0b},
+       {0x380d, 0x40},
        {0x380e, 0x07},
-       {0x380f, 0xc0},
+       {0x380f, 0x3a},
        {0x3810, 0x00},
        {0x3811, 0x02},
        {0x3812, 0x00},
        {0x3813, 0x02},
-       {0x3814, 0x31},
-       {0x3815, 0x31},
-       {0x3820, 0x01},
-       {0x3821, 0x1f},
+       {0x3814, 0x11},
+       {0x3815, 0x11},
+       {0x3820, 0x00},
+       {0x3821, 0x9e},
        {0x3823, 0x00},
        {0x3824, 0x00},
        {0x3825, 0x00},
        {0x3826, 0x00},
        {0x3827, 0x00},
        {0x382a, 0x04},
-       {0x3a04, 0x06},
-       {0x3a05, 0x14},
+       {0x3a04, 0x09},
+       {0x3a05, 0xa9},
        {0x3a06, 0x00},
        {0x3a07, 0xfe},
        {0x3b00, 0x00},
@@ -580,7 +1555,7 @@ static const struct ov5693_reg ov5693_1296x972_i2c[] = {
        {0x4005, 0x18},
        {0x4006, 0x20},
        {0x4008, 0x24},
-       {0x4009, 0x40},
+       {0x4009, 0x10},
        {0x400c, 0x00},
        {0x400d, 0x00},
        {0x4058, 0x00},
@@ -635,12 +1610,12 @@ static const struct ov5693_reg ov5693_1296x972_i2c[] = {
        {0x5849, 0x0c},
        {0x5e00, 0x00},
        {0x5e10, 0x0c},
-       {0x0100, 0x01},
        {OV5693_TABLE_END, 0x0000}
 };
 
-static const struct ov5693_reg ov5693_1920x1080_i2c[] = {
-       {OV5693_TABLE_RESET, 0x0},/*, 0xIncluding, 0xsw, 0xreset, 0x*/
+static const struct ov5693_reg ov5693_1296x972_HDR_30fps_i2c[] = {
+       {OV5693_TABLE_RESET, 0},/* Including sw reset */
+       {0x0103, 0x01},
        {0x3001, 0x0a},
        {0x3002, 0x80},
        {0x3006, 0x00},
@@ -671,23 +1646,17 @@ static const struct ov5693_reg ov5693_1920x1080_i2c[] = {
        {0x30b6, 0x01},
        {0x3104, 0x21},
        {0x3106, 0x00},
-       {0x3400, 0x04},
-       {0x3401, 0x00},
-       {0x3402, 0x04},
-       {0x3403, 0x00},
-       {0x3404, 0x04},
-       {0x3405, 0x00},
        {0x3406, 0x01},
        {0x3500, 0x00},
-       {0x3501, 0x7b},
+       {0x3501, 0x72},
        {0x3502, 0x00},
        {0x3503, 0x07},
        {0x3504, 0x00},
        {0x3505, 0x00},
        {0x3506, 0x00},
-       {0x3507, 0x02},
-       {0x3508, 0x00},
-       {0x3509, 0x08},
+       {0x3507, 0x01},
+       {0x3508, 0x80},
+       {0x3509, 0x10},
        {0x350a, 0x00},
        {0x350b, 0x40},
        {0x3601, 0x0a},
@@ -786,22 +1755,22 @@ static const struct ov5693_reg ov5693_1920x1080_i2c[] = {
        {0x37cb, 0x00},
        {0x37de, 0x00},
        {0x37df, 0x00},
-       {0x3800, 0x00},
-       {0x3801, 0x00},
-       {0x3802, 0x00},
-       {0x3803, 0xf8},
-       {0x3804, 0x0a},
-       {0x3805, 0x3f},
-       {0x3806, 0x06},
-       {0x3807, 0xab},
-       {0x3808, 0x07},
-       {0x3809, 0x80},
-       {0x380a, 0x04},
-       {0x380b, 0x38},
-       {0x380c, 0x0a},
-       {0x380d, 0x80},
+       {0x3800, 0x02},
+       {0x3801, 0xa0},
+       {0x3802, 0x01},
+       {0x3803, 0xe8},
+       {0x3804, 0x07},
+       {0x3805, 0xb7},
+       {0x3806, 0x05},
+       {0x3807, 0xb9},
+       {0x3808, 0x05},
+       {0x3809, 0x10},
+       {0x380a, 0x03},
+       {0x380b, 0xcc},
+       {0x380c, 0x0b},
+       {0x380d, 0x40},
        {0x380e, 0x07},
-       {0x380f, 0xc0},
+       {0x380f, 0x3a},
        {0x3810, 0x00},
        {0x3811, 0x02},
        {0x3812, 0x00},
@@ -809,15 +1778,15 @@ static const struct ov5693_reg ov5693_1920x1080_i2c[] = {
        {0x3814, 0x11},
        {0x3815, 0x11},
        {0x3820, 0x00},
-       {0x3821, 0x1e},
+       {0x3821, 0x9e},
        {0x3823, 0x00},
        {0x3824, 0x00},
        {0x3825, 0x00},
        {0x3826, 0x00},
        {0x3827, 0x00},
        {0x382a, 0x04},
-       {0x3a04, 0x06},
-       {0x3a05, 0x14},
+       {0x3a04, 0x09},
+       {0x3a05, 0xa9},
        {0x3a06, 0x00},
        {0x3a07, 0xfe},
        {0x3b00, 0x00},
@@ -833,7 +1802,7 @@ static const struct ov5693_reg ov5693_1920x1080_i2c[] = {
        {0x4005, 0x18},
        {0x4006, 0x20},
        {0x4008, 0x24},
-       {0x4009, 0x40},
+       {0x4009, 0x10},
        {0x400c, 0x00},
        {0x400d, 0x00},
        {0x4058, 0x00},
@@ -862,7 +1831,7 @@ static const struct ov5693_reg ov5693_1920x1080_i2c[] = {
        {0x4837, 0x0a},
        {0x5000, 0x06},
        {0x5001, 0x01},
-       {0x5002, 0x80},
+       {0x5002, 0x00},
        {0x5003, 0x20},
        {0x5046, 0x0a},
        {0x5013, 0x00},
@@ -888,13 +1857,12 @@ static const struct ov5693_reg ov5693_1920x1080_i2c[] = {
        {0x5849, 0x0c},
        {0x5e00, 0x00},
        {0x5e10, 0x0c},
-       {0x0100, 0x01},
        {OV5693_TABLE_END, 0x0000}
 };
 
-
-static const struct ov5693_reg ov5693_1280x720_120fps_i2c[] = {
+static const struct ov5693_reg ov5693_1280x720_HDR_60fps_i2c[] = {
        {OV5693_TABLE_RESET, 0},/* Including sw reset */
+       {0x0103, 0x01},
        {0x3001, 0x0a},
        {0x3002, 0x80},
        {0x3006, 0x00},
@@ -925,23 +1893,17 @@ static const struct ov5693_reg ov5693_1280x720_120fps_i2c[] = {
        {0x30b6, 0x01},
        {0x3104, 0x21},
        {0x3106, 0x00},
-       {0x3400, 0x04},
-       {0x3401, 0x00},
-       {0x3402, 0x04},
-       {0x3403, 0x00},
-       {0x3404, 0x04},
-       {0x3405, 0x00},
        {0x3406, 0x01},
        {0x3500, 0x00},
-       {0x3501, 0x2e},
-       {0x3502, 0x80},
+       {0x3501, 0x39},
+       {0x3502, 0x00},
        {0x3503, 0x07},
        {0x3504, 0x00},
        {0x3505, 0x00},
        {0x3506, 0x00},
-       {0x3507, 0x02},
-       {0x3508, 0x00},
-       {0x3509, 0x08},
+       {0x3507, 0x01},
+       {0x3508, 0x80},
+       {0x3509, 0x10},
        {0x350a, 0x00},
        {0x350b, 0x40},
        {0x3601, 0x0a},
@@ -973,8 +1935,8 @@ static const struct ov5693_reg ov5693_1280x720_120fps_i2c[] = {
        {0x3703, 0xd8},
        {0x3704, 0x78},
        {0x3705, 0x02},
-       {0x3708, 0xe6},
-       {0x3709, 0xc7},
+       {0x3708, 0xe2},
+       {0x3709, 0xc3},
        {0x370a, 0x00},
        {0x370b, 0x20},
        {0x370c, 0x0c},
@@ -1040,38 +2002,38 @@ static const struct ov5693_reg ov5693_1280x720_120fps_i2c[] = {
        {0x37cb, 0x00},
        {0x37de, 0x00},
        {0x37df, 0x00},
-       {0x3800, 0x00},
-       {0x3801, 0x00},
-       {0x3802, 0x00},
-       {0x3803, 0xf4},
-       {0x3804, 0x0a},
-       {0x3805, 0x3f},
-       {0x3806, 0x06},
-       {0x3807, 0xab},
+       {0x3800, 0x02},
+       {0x3801, 0xa8},
+       {0x3802, 0x02},
+       {0x3803, 0x68},
+       {0x3804, 0x07},
+       {0x3805, 0xb7},
+       {0x3806, 0x05},
+       {0x3807, 0x3b},
        {0x3808, 0x05},
        {0x3809, 0x00},
        {0x380a, 0x02},
        {0x380b, 0xd0},
-       {0x380c, 0x06},
-       {0x380d, 0xd8},
-       {0x380e, 0x02},
-       {0x380f, 0xf8},
+       {0x380c, 0x0b},
+       {0x380d, 0x40},
+       {0x380e, 0x03},
+       {0x380f, 0x9e},
        {0x3810, 0x00},
        {0x3811, 0x02},
        {0x3812, 0x00},
        {0x3813, 0x02},
-       {0x3814, 0x31},
-       {0x3815, 0x31},
-       {0x3820, 0x04},
-       {0x3821, 0x1f},
+       {0x3814, 0x11},
+       {0x3815, 0x11},
+       {0x3820, 0x00},
+       {0x3821, 0x9e},
        {0x3823, 0x00},
        {0x3824, 0x00},
        {0x3825, 0x00},
        {0x3826, 0x00},
        {0x3827, 0x00},
        {0x382a, 0x04},
-       {0x3a04, 0x06},
-       {0x3a05, 0x14},
+       {0x3a04, 0x09},
+       {0x3a05, 0xa9},
        {0x3a06, 0x00},
        {0x3a07, 0xfe},
        {0x3b00, 0x00},
@@ -1087,7 +2049,7 @@ static const struct ov5693_reg ov5693_1280x720_120fps_i2c[] = {
        {0x4005, 0x18},
        {0x4006, 0x20},
        {0x4008, 0x24},
-       {0x4009, 0x40},
+       {0x4009, 0x10},
        {0x400c, 0x00},
        {0x400d, 0x00},
        {0x4058, 0x00},
@@ -1142,8 +2104,6 @@ static const struct ov5693_reg ov5693_1280x720_120fps_i2c[] = {
        {0x5849, 0x0c},
        {0x5e00, 0x00},
        {0x5e10, 0x0c},
-       {0x0100, 0x01},
-       {0x350b, 0xF8},
        {OV5693_TABLE_END, 0x0000}
 };
 
@@ -1152,6 +2112,10 @@ enum {
        OV5693_MODE_1920x1080,
        OV5693_MODE_1296x972,
        OV5693_MODE_1280x720_120FPS,
+       OV5693_MODE_2592x1944_HDR,
+       OV5693_MODE_1920x1080_HDR,
+       OV5693_MODE_1296x972_HDR,
+       OV5693_MODE_1280x720_HDR_60FPS,
 };
 
 static const struct ov5693_reg *mode_table[] = {
@@ -1159,6 +2123,10 @@ static const struct ov5693_reg *mode_table[] = {
        [OV5693_MODE_1920x1080]         = ov5693_1920x1080_i2c,
        [OV5693_MODE_1296x972]          = ov5693_1296x972_i2c,
        [OV5693_MODE_1280x720_120FPS]   = ov5693_1280x720_120fps_i2c,
+       [OV5693_MODE_2592x1944_HDR]     = ov5693_2592x1944_HDR_24fps_i2c,
+       [OV5693_MODE_1920x1080_HDR]     = ov5693_1920x1080_HDR_30fps_i2c,
+       [OV5693_MODE_1296x972_HDR]      = ov5693_1296x972_HDR_30fps_i2c,
+       [OV5693_MODE_1280x720_HDR_60FPS] = ov5693_1280x720_HDR_60fps_i2c,
 };
 
 static int ov5693_i2c_rd8(struct ov5693_info *info, u16 reg, u8 *val)
@@ -1180,28 +2148,15 @@ static int ov5693_i2c_wr_table(struct ov5693_info *info,
        u8 i2c_buf[OV5693_SIZEOF_I2C_BUF];
 
        u8 *b_ptr = i2c_buf;
-       u8 reset_status = 1;
-       u8 reset_tries_left = OV5693_TABLE_RESET_TIMEOUT;
 
        for (next = table; next->addr != OV5693_TABLE_END; next++) {
                if (next->addr == OV5693_TABLE_WAIT_MS) {
                        msleep(next->val);
                        continue;
                } else if (next->addr == OV5693_TABLE_RESET) {
-                       err = regmap_write(info->regmap, 0x0103, 0x01);
+                       err = regmap_write(info->regmap, 0x0100, 0x00);
                        if (err)
                                return err;
-                       while (reset_status) {
-                               usleep_range(200, 300);
-                               if (reset_tries_left < 1)
-                                       return -EIO;
-                               err = ov5693_i2c_rd8(info, 0x0103,
-                                                       &reset_status);
-                               if (err)
-                                       return err;
-                               reset_status &= 0x01;
-                               reset_tries_left -= 1;
-                       }
                        continue;
                }
 
@@ -1244,8 +2199,10 @@ static inline int ov5693_frame_length_reg(struct ov5693_reg *regs,
 }
 
 static inline int ov5693_coarse_time_reg(struct ov5693_reg *regs,
-                                       u32 coarse_time)
+                                       u32 coarse_time, u32 coarse_time_short)
 {
+       int ret = 0;
+
        regs->addr = 0x3500;
        regs->val = (coarse_time >> 12) & 0xff;
        (regs + 1)->addr = 0x3501;
@@ -1253,7 +2210,20 @@ static inline int ov5693_coarse_time_reg(struct ov5693_reg *regs,
        (regs + 2)->addr = 0x3502;
        (regs + 2)->val = (coarse_time & 0xf) << 4;
 
-       return 3;
+       ret += 3;
+
+       if (coarse_time_short != OV5693_INVALID_COARSE_TIME) {
+               (regs + 3)->addr = 0x3506;
+               (regs + 3)->val = (coarse_time_short >> 12) & 0xff;
+               (regs + 4)->addr = 0x3507;
+               (regs + 4)->val = (coarse_time_short >> 4) & 0xff;
+               (regs + 5)->addr = 0x3508;
+               (regs + 5)->val = (coarse_time_short & 0xf) << 4;
+
+               ret += 3;
+       }
+
+       return ret;
 }
 
 #define OV5693_ENTER_GROUP_HOLD(group_hold) \
@@ -1272,7 +2242,7 @@ static inline int ov5693_coarse_time_reg(struct ov5693_reg *regs,
                        reg_list[offset].val = 0x11;\
                        offset++;  \
                        reg_list[offset].addr = 0x3208; \
-                       reg_list[offset].val = 0xe1;\
+                       reg_list[offset].val = 0x61;\
                        offset++;  \
                } \
        } while (0)
@@ -1297,14 +2267,17 @@ static int ov5693_set_frame_length(struct ov5693_info *info,
 }
 
 static int ov5693_set_coarse_time(struct ov5693_info *info,
-                                 u32 coarse_time, bool group_hold)
+                                 u32 coarse_time, u32 coarse_time_short,
+                                 bool group_hold)
 {
        struct ov5693_reg reg_list[16];
        int err = 0;
        int offset = 0;
 
        OV5693_ENTER_GROUP_HOLD(group_hold);
-       offset += ov5693_coarse_time_reg(reg_list + offset, coarse_time);
+       offset += ov5693_coarse_time_reg(reg_list + offset,
+                                               coarse_time,
+                                               coarse_time_short);
        OV5693_LEAVE_GROUP_HOLD(group_hold);
 
        reg_list[offset].addr = OV5693_TABLE_END;
@@ -1317,10 +2290,13 @@ static int ov5693_set_coarse_time(struct ov5693_info *info,
 
 static inline int ov5693_gain_reg(struct ov5693_reg *regs, u32 gain)
 {
-       (regs)->addr = 0x350B;
-       (regs)->val = gain;
+       (regs)->addr = 0x350A;
+       (regs)->val = gain >> 8;
+
+       (regs + 1)->addr = 0x350B;
+       (regs + 1)->val = gain & 0x00FF;
 
-       return 1;
+       return 2;
 }
 
 static int ov5693_bin_wr(struct ov5693_info *info, u8 enable)
@@ -1346,7 +2322,9 @@ static int ov5693_exposure_wr(struct ov5693_info *info,
        bool group_hold = true; /* To use GROUP_HOLD macros */
 
        OV5693_ENTER_GROUP_HOLD(group_hold);
-       offset += ov5693_coarse_time_reg(reg_list + offset, mode->coarse_time);
+       offset += ov5693_coarse_time_reg(reg_list + offset,
+                                               mode->coarse_time,
+                                               mode->coarse_time_short);
        offset += ov5693_gain_reg(reg_list + offset, mode->gain);
        OV5693_LEAVE_GROUP_HOLD(group_hold);
 
@@ -1375,6 +2353,116 @@ static int ov5693_set_gain(struct ov5693_info *info, u32 gain, bool group_hold)
        return err;
 }
 
+static int ov5693_awb_wr(struct ov5693_info *info)
+{
+       struct ov5693_reg reg_list[10];
+       int rg, bg, rg_typical, bg_typical;
+       int R_gain, G_gain, B_gain, G_gain_R, G_gain_B;
+       int offset;
+       int err;
+
+       if (info->cal.loaded == 0)
+               return 0;
+
+       /* update AWB calibration data to register lists */
+       rg = info->cal.rg_ratio;
+       bg = info->cal.bg_ratio;
+       rg_typical = info->cal.rg_ratio_typical;
+       bg_typical = info->cal.bg_ratio_typical;
+
+       if ((rg == 0) || (bg == 0) || (rg_typical == 0) || (bg_typical == 0))
+               return 0;
+
+       if (bg < bg_typical) {
+               if (rg < rg_typical) {
+                       G_gain = 0x400;
+                       B_gain = 0x400 * bg_typical / bg;
+                       R_gain = 0x400 * rg_typical / rg;
+               } else {
+                       R_gain = 0x400;
+                       G_gain = 0x400 * rg / rg_typical;
+                       B_gain = G_gain * bg_typical / bg;
+               }
+       } else {
+               if (rg < rg_typical) {
+                       B_gain = 0x400;
+                       G_gain = 0x400 * bg / bg_typical;
+                       R_gain = G_gain * rg_typical / rg;
+               } else {
+                       G_gain_B = 0x400 * bg / bg_typical;
+                       G_gain_R = 0x400 * rg / rg_typical;
+                       if (G_gain_B > G_gain_R) {
+                               B_gain = 0x400;
+                               G_gain = G_gain_B;
+                               R_gain = G_gain * rg_typical / rg;
+                       } else {
+                               R_gain = 0x400;
+                               G_gain = G_gain_R;
+                               B_gain = G_gain * bg_typical / bg;
+                       }
+               }
+       }
+
+       offset = 0;
+       if (R_gain > 0x400) {
+               reg_list[offset].addr = 0x3400;
+               reg_list[offset].val  = R_gain >> 8;
+               offset++;
+               reg_list[offset].addr = 0x3401;
+               reg_list[offset].val  = R_gain & 0x00ff;
+               offset++;
+       }
+       if (G_gain > 0x400) {
+               reg_list[offset].addr = 0x3402;
+               reg_list[offset].val  = G_gain >> 8;
+               offset++;
+               reg_list[offset].addr = 0x3403;
+               reg_list[offset].val  = G_gain & 0x00ff;
+               offset++;
+       }
+       if (B_gain > 0x400) {
+               reg_list[offset].addr = 0x3404;
+               reg_list[offset].val  = B_gain >> 8;
+               offset++;
+               reg_list[offset].addr = 0x3405;
+               reg_list[offset].val  = B_gain & 0x00ff;
+               offset++;
+       }
+       reg_list[offset].addr = OV5693_TABLE_END;
+       offset++;
+
+       err = ov5693_i2c_wr_table(info, reg_list);
+
+       return err;
+}
+
+static int ov5693_lsc_wr(struct ov5693_info *info)
+{
+       struct ov5693_reg reg_list[64];
+       int offset;
+       int err;
+       int i;
+
+       if (info->cal.loaded == 0)
+               return 0;
+
+       offset = 0;
+       reg_list[offset].addr = 0x5000;
+       reg_list[offset].val  = 0x86;
+       offset++;
+       for (i = 0; i < 62; i++) {
+               reg_list[offset].addr = 0x5800 + i;
+               reg_list[offset].val  = info->cal.lenc[i];
+               offset++;
+       }
+       reg_list[offset].addr = OV5693_TABLE_END;
+       offset++;
+
+       err = ov5693_i2c_wr_table(info, reg_list);
+
+       return err;
+}
+
 static int ov5693_set_group_hold(struct ov5693_info *info,
                                struct ov5693_ae *ae)
 {
@@ -1392,7 +2480,7 @@ static int ov5693_set_group_hold(struct ov5693_info *info,
                                                  ae->frame_length);
        if (ae->coarse_time_enable)
                offset += ov5693_coarse_time_reg(reg_list + offset,
-                                                ae->coarse_time);
+                       ae->coarse_time, ae->coarse_time_short);
        OV5693_LEAVE_GROUP_HOLD(group_hold);
 
        reg_list[offset].addr = OV5693_TABLE_END;
@@ -1744,14 +2832,25 @@ static int ov5693_set_mode(struct ov5693_info *info,
                }
        }
 
-       if (mode->res_x == 2592 && mode->res_y == 1944)
-               mode_index = OV5693_MODE_2592x1944;
-       else if (mode->res_x == 1296 && mode->res_y == 972)
-               mode_index = OV5693_MODE_1296x972;
-       else if (mode->res_x == 1920 && mode->res_y == 1080)
-               mode_index = OV5693_MODE_1920x1080;
-       else if (mode->res_x == 1280 && mode->res_y == 720)
-               mode_index = OV5693_MODE_1280x720_120FPS;
+       if (mode->hdr_en == true) {
+               if (mode->res_x == 2592 && mode->res_y == 1944)
+                       mode_index = OV5693_MODE_2592x1944_HDR;
+               else if (mode->res_x == 1296 && mode->res_y == 972)
+                       mode_index = OV5693_MODE_1296x972_HDR;
+               else if (mode->res_x == 1920 && mode->res_y == 1080)
+                       mode_index = OV5693_MODE_1920x1080_HDR;
+               else if (mode->res_x == 1280 && mode->res_y == 720)
+                       mode_index = OV5693_MODE_1280x720_HDR_60FPS;
+       } else {
+               if (mode->res_x == 2592 && mode->res_y == 1944)
+                       mode_index = OV5693_MODE_2592x1944;
+               else if (mode->res_x == 1296 && mode->res_y == 972)
+                       mode_index = OV5693_MODE_1296x972;
+               else if (mode->res_x == 1920 && mode->res_y == 1080)
+                       mode_index = OV5693_MODE_1920x1080;
+               else if (mode->res_x == 1280 && mode->res_y == 720)
+                       mode_index = OV5693_MODE_1280x720_120FPS;
+       }
 
        if (!info->mode_valid || (info->mode_index != mode_index))
                err = ov5693_mode_wr_full(info, mode_index);
@@ -1769,6 +2868,27 @@ static int ov5693_set_mode(struct ov5693_info *info,
                        "%s set_mode error\n", __func__);
                goto ov5693_mode_wr_err;
        }
+       err = ov5693_awb_wr(info);
+       if (err < 0) {
+               info->mode_valid = false;
+               dev_err(&info->i2c_client->dev,
+                       "%s:%d awb cal write error\n", __func__, __LINE__);
+               goto ov5693_mode_wr_err;
+       }
+       err = ov5693_lsc_wr(info);
+       if (err < 0) {
+               info->mode_valid = false;
+               dev_err(&info->i2c_client->dev,
+                       "%s:%d lsc cal write error\n", __func__, __LINE__);
+               goto ov5693_mode_wr_err;
+       }
+       err = regmap_write(info->regmap, 0x0100, 0x01);
+       if (err) {
+               info->mode_valid = false;
+               dev_err(&info->i2c_client->dev,
+                       "%s:%d stream on failed\n", __func__, __LINE__);
+               goto ov5693_mode_wr_err;
+       }
 
        return 0;
 
@@ -1788,6 +2908,43 @@ static int ov5693_get_fuse_id(struct ov5693_info *info)
        return 0;
 }
 
+static int ov5693_read_otp_bank(struct ov5693_info *info,
+                               struct ov5693_otp_bank *bank)
+{
+       int err;
+
+       err = regmap_write(info->regmap, 0x0100, 0x01);
+       if (err != 0) {
+               dev_err(&info->i2c_client->dev,
+                       "%s ERR %d: cannot write stream mode\n", __func__,
+                       err);
+               return err;
+       }
+       err = regmap_write(info->regmap, 0x3d84, 0xc0 | bank->id);
+       if (err != 0) {
+               dev_err(&info->i2c_client->dev,
+                       "%s ERR %d: cannot write bank index %d\n", __func__,
+                       err, bank->id);
+               return err;
+       }
+       err = regmap_write(info->regmap, 0x3d81, 0x01);
+       if (err != 0) {
+               dev_err(&info->i2c_client->dev,
+                       "%s ERR %d: cannot load OTP data\n", __func__, err);
+               return err;
+       }
+       usleep_range(1000, 11000);
+       err = regmap_bulk_read(info->regmap, 0x3d00, bank->buf, 16);
+       if (err != 0) {
+               dev_err(&info->i2c_client->dev,
+                       "%s ERR %d: cannot read OTP buffer\n", __func__,
+                       err);
+               return err;
+       }
+
+       return err;
+}
+
 static long ov5693_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        struct ov5693_info *info = file->private_data;
@@ -1834,7 +2991,19 @@ static long ov5693_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                return ov5693_set_frame_length(info, (u32)arg, true);
 
        case OV5693_IOCTL_SET_COARSE_TIME:
-               return ov5693_set_coarse_time(info, (u32)arg, true);
+               return ov5693_set_coarse_time(info, (u32)arg,
+                                       OV5693_INVALID_COARSE_TIME, true);
+
+       case OV5693_IOCTL_SET_HDR_COARSE_TIME:
+       {
+               struct ov5693_hdr *hdrcoarse = (struct ov5693_hdr *)arg;
+               int ret = ov5693_set_coarse_time(info,
+                               hdrcoarse->coarse_time_long,
+                               hdrcoarse->coarse_time_short,
+                               true);
+               return ret;
+       }
+
 
        case OV5693_IOCTL_SET_GAIN:
                return ov5693_set_gain(info, (u32)arg, true);
@@ -1857,6 +3026,46 @@ static long ov5693_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                }
                return 0;
        }
+
+       case OV5693_IOCTL_READ_OTP_BANK:
+       {
+               struct ov5693_otp_bank bank;
+               if (copy_from_user(&bank,
+                                  (const void __user *)arg,
+                                  sizeof(bank))) {
+                       dev_err(&info->i2c_client->dev,
+                               "%s %d copy_from_user err\n",
+                               __func__, __LINE__);
+                       return -EINVAL;
+               }
+
+               err = ov5693_read_otp_bank(info, &bank);
+               if (err != 0)
+                       return err;
+
+               if (copy_to_user((void __user *)arg,
+                                &bank,
+                                sizeof(bank))) {
+                       dev_err(&info->i2c_client->dev,
+                               "%s %d copy_to_user err\n",
+                               __func__, __LINE__);
+                       return -EFAULT;
+               }
+               return 0;
+       }
+
+       case OV5693_IOCTL_SET_CAL_DATA:
+       {
+               if (copy_from_user(&info->cal, (const void __user *)arg,
+                                       sizeof(info->cal))) {
+                       dev_err(&info->i2c_client->dev,
+                               "%s %d copy_from_user err\n",
+                               __func__, __LINE__);
+                       return -EINVAL;
+               }
+               return 0;
+       }
+
        default:
                dev_err(&info->i2c_client->dev, "%s unsupported ioctl: %x\n",
                        __func__, cmd);
index ea4f062c866fd2664d9a2c7c8b44660640c2a826..23299562cf50f045725e186d2839ba15f4057ca2 100644 (file)
 #define OV5693_IOCTL_SET_CAMERA_MODE        _IOW('o', 10, __u32)
 #define OV5693_IOCTL_SYNC_SENSORS           _IOW('o', 11, __u32)
 #define OV5693_IOCTL_GET_FUSEID             _IOR('o', 12, struct nvc_fuseid)
+#define OV5693_IOCTL_SET_HDR_COARSE_TIME    _IOW('o', 13, struct ov5693_hdr)
+#define OV5693_IOCTL_READ_OTP_BANK          _IOWR('o', 14, \
+                                               struct ov5693_otp_bank)
+#define OV5693_IOCTL_SET_CAL_DATA           _IOW('o', 15, \
+                                               struct ov5693_cal_data)
+
+#define OV5693_INVALID_COARSE_TIME  -1
 
 
 struct ov5693_mode {
@@ -42,18 +49,45 @@ struct ov5693_mode {
        int fps;
        __u32 frame_length;
        __u32 coarse_time;
+       __u32 coarse_time_short;
        __u16 gain;
+       __u8 hdr_en;
 };
 
 struct ov5693_ae {
        __u32 frame_length;
        __u8  frame_length_enable;
        __u32 coarse_time;
+       __u32 coarse_time_short;
        __u8  coarse_time_enable;
        __s32 gain;
        __u8  gain_enable;
 };
 
+struct ov5693_fuseid {
+       __u32 size;
+       __u8  id[16];
+};
+
+struct ov5693_hdr {
+       __u32 coarse_time_long;
+       __u32 coarse_time_short;
+};
+
+struct ov5693_otp_bank {
+       __u32 id;
+       __u8  buf[16];
+};
+
+struct ov5693_cal_data {
+       int loaded;
+       int rg_ratio;
+       int bg_ratio;
+       int rg_ratio_typical;
+       int bg_ratio_typical;
+       __u8 lenc[62];
+};
+
 /* See notes in the nvc.h file on the GPIO usage */
 enum ov5693_gpio_type {
        OV5693_GPIO_TYPE_PWRDN = 0,