Revert "media:video:tegra: add HDR for ar0261"
Mitch Luban [Sat, 7 Sep 2013 20:50:27 +0000 (13:50 -0700)]
This reverts commit 9de14ad78781f63ed2306f7c6f7c1f328e41e132.

Change-Id: I263a614a5afe1eee17cda5e251510e0a205d7256
Signed-off-by: Mitch Luban <mluban@nvidia.com>
Reviewed-on: http://git-master/r/271842
Reviewed-by: Automatic_Commit_Validation_User

drivers/media/platform/tegra/ar0261.c
include/media/ar0261.h

index 9001e5b..d5f1113 100644 (file)
@@ -328,298 +328,13 @@ static struct ar0261_reg mode_1920x1080[] = {
        {0x301A, 0x001C},
        {AR0261_TABLE_END, 0x0000}
 };
-static struct ar0261_reg mode_1920x1080_HDR[] = {
-       {0x301A, 0x0019},
-       {AR0261_TABLE_WAIT_MS, 100},
-       {0x301A, 0x0218},
-       {0x31B0, 0x0062},
-       {0x31B2, 0x0046},
-       {0x31B4, 0x3248},
-       {0x31B6, 0x22A6},
-       {0x31B8, 0x1832},
-       {0x31BA, 0x1052},
-       {0x31BC, 0x0408},
-       {0x31AE, 0x0201},
-       {AR0261_TABLE_WAIT_MS, 1},
-       {0x3044, 0x0590},
-       {0x3EE6, 0x60AD},
-       {0x3EDC, 0xDBFA},
-       {0x301A, 0x0218},
-       {AR0261_TABLE_WAIT_MS, 100},
-       {0x3D00, 0x0481},
-       {0x3D02, 0xFFFF},
-       {0x3D04, 0xFFFF},
-       {0x3D06, 0xFFFF},
-       {0x3D08, 0x6600},
-       {0x3D0A, 0x0311},
-       {0x3D0C, 0x8C67},
-       {0x3D0E, 0x0808},
-       {0x3D10, 0x4380},
-       {0x3D12, 0x4343},
-       {0x3D14, 0x8043},
-       {0x3D16, 0x4330},
-       {0x3D18, 0x0543},
-       {0x3D1A, 0x4381},
-       {0x3D1C, 0x4C85},
-       {0x3D1E, 0x2022},
-       {0x3D20, 0x8020},
-       {0x3D22, 0xA093},
-       {0x3D24, 0x5A8A},
-       {0x3D26, 0x4C81},
-       {0x3D28, 0x5981},
-       {0x3D2A, 0x1E00},
-       {0x3D2C, 0x5F83},
-       {0x3D2E, 0x5C80},
-       {0x3D30, 0x5C81},
-       {0x3D32, 0x5F58},
-       {0x3D34, 0x6880},
-       {0x3D36, 0x1060},
-       {0x3D38, 0x8541},
-       {0x3D3A, 0xB350},
-       {0x3D3C, 0x5F10},
-       {0x3D3E, 0x6050},
-       {0x3D40, 0x5780},
-       {0x3D42, 0x6880},
-       {0x3D44, 0x2220},
-       {0x3D46, 0x805D},
-       {0x3D48, 0x8140},
-       {0x3D4A, 0x864B},
-       {0x3D4C, 0x8524},
-       {0x3D4E, 0x08A0},
-       {0x3D50, 0x55B8},
-       {0x3D52, 0x429C},
-       {0x3D54, 0x4281},
-       {0x3D56, 0x4081},
-       {0x3D58, 0x2808},
-       {0x3D5A, 0x2810},
-       {0x3D5C, 0x5727},
-       {0x3D5E, 0x1069},
-       {0x3D60, 0x4B52},
-       {0x3D62, 0x8265},
-       {0x3D64, 0x8A65},
-       {0x3D66, 0xA95E},
-       {0x3D68, 0x5080},
-       {0x3D6A, 0x5250},
-       {0x3D6C, 0x6080},
-       {0x3D6E, 0x6922},
-       {0x3D70, 0x2080},
-       {0x3D72, 0x5D80},
-       {0x3D74, 0x4080},
-       {0x3D76, 0x5681},
-       {0x3D78, 0x5781},
-       {0x3D7A, 0x4B86},
-       {0x3D7C, 0x2408},
-       {0x3D7E, 0x9345},
-       {0x3D80, 0x8144},
-       {0x3D82, 0x4481},
-       {0x3D84, 0x4586},
-       {0x3D86, 0x4E80},
-       {0x3D88, 0x4FCD},
-       {0x3D8A, 0x4685},
-       {0x3D8C, 0x0006},
-       {0x3D8E, 0x8143},
-       {0x3D90, 0x4380},
-       {0x3D92, 0x4343},
-       {0x3D94, 0x8043},
-       {0x3D96, 0x4380},
-       {0x3D98, 0x4343},
-       {0x3D9A, 0x8043},
-       {0x3D9C, 0x4380},
-       {0x3D9E, 0x4343},
-       {0x3DA0, 0x8648},
-       {0x3DA2, 0x4880},
-       {0x3DA4, 0x6B6B},
-       {0x3DA6, 0x814C},
-       {0x3DA8, 0x864D},
-       {0x3DAA, 0xA442},
-       {0x3DAC, 0x8641},
-       {0x3DAE, 0x804D},
-       {0x3DB0, 0x864C},
-       {0x3DB2, 0x8A45},
-       {0x3DB4, 0x8144},
-       {0x3DB6, 0x4481},
-       {0x3DB8, 0x4583},
-       {0x3DBA, 0x46B7},
-       {0x3DBC, 0x7386},
-       {0x3DBE, 0x4685},
-       {0x3DC0, 0x0006},
-       {0x3DC2, 0x8143},
-       {0x3DC4, 0x4380},
-       {0x3DC6, 0x4343},
-       {0x3DC8, 0x8043},
-       {0x3DCA, 0x4380},
-       {0x3DCC, 0x4343},
-       {0x3DCE, 0x8043},
-       {0x3DD0, 0x4380},
-       {0x3DD2, 0x4343},
-       {0x3DD4, 0x8648},
-       {0x3DD6, 0x4880},
-       {0x3DD8, 0x6A6A},
-       {0x3DDA, 0x814C},
-       {0x3DDC, 0x864D},
-       {0x3DDE, 0xA442},
-       {0x3DE0, 0x8641},
-       {0x3DE2, 0x804D},
-       {0x3DE4, 0x864C},
-       {0x3DE6, 0x8A45},
-       {0x3DE8, 0x8144},
-       {0x3DEA, 0x4481},
-       {0x3DEC, 0x4583},
-       {0x3DEE, 0x4686},
-       {0x3DF0, 0x73FF},
-       {0x3DF2, 0xD358},
-       {0x3DF4, 0x835B},
-       {0x3DF6, 0x825A},
-       {0x3DF8, 0x8153},
-       {0x3DFA, 0x5467},
-       {0x3DFC, 0x6363},
-       {0x3DFE, 0x2640},
-       {0x3E00, 0x6470},
-       {0x3E02, 0xFFFF},
-       {0x3E04, 0xFFFF},
-       {0x3E06, 0xFFED},
-       {0x3E08, 0x4580},
-       {0x3E0A, 0x4384},
-       {0x3E0C, 0x4380},
-       {0x3E0E, 0x0280},
-       {0x3E10, 0x8402},
-       {0x3E12, 0x8080},
-       {0x3E14, 0x6A84},
-       {0x3E16, 0x6A80},
-       {0x3E18, 0x4484},
-       {0x3E1A, 0x4480},
-       {0x3E1C, 0x4578},
-       {0x3E1E, 0x8270},
-       {0x3E20, 0x0000},
-       {0x3E22, 0x0000},
-       {0x3E24, 0x0000},
-       {0x3E26, 0x0000},
-       {0x3E28, 0x0000},
-       {0x3E2A, 0x0000},
-       {0x3E2C, 0x0000},
-       {0x3E2E, 0x0000},
-       {0x3E30, 0x0000},
-       {0x3E32, 0x0000},
-       {0x3E34, 0x0000},
-       {0x3E36, 0x0000},
-       {0x3E38, 0x0000},
-       {0x3E3A, 0x0000},
-       {0x3E3C, 0x0000},
-       {0x3E3E, 0x0000},
-       {0x3E40, 0x0000},
-       {0x3E42, 0x0000},
-       {0x3E44, 0x0000},
-       {0x3E46, 0x0000},
-       {0x3E48, 0x0000},
-       {0x3E4A, 0x0000},
-       {0x3E4C, 0x0000},
-       {0x3E4E, 0x0000},
-       {0x3E50, 0x0000},
-       {0x3E52, 0x0000},
-       {0x3E54, 0x0000},
-       {0x3E56, 0x0000},
-       {0x3E58, 0x0000},
-       {0x3E5A, 0x0000},
-       {0x3E5C, 0x0000},
-       {0x3E5E, 0x0000},
-       {0x3E60, 0x0000},
-       {0x3E62, 0x0000},
-       {0x3E64, 0x0000},
-       {0x3E66, 0x0000},
-       {0x3E68, 0x0000},
-       {0x3E6A, 0x0000},
-       {0x3E6C, 0x0000},
-       {0x3E6E, 0x0000},
-       {0x3E70, 0x0000},
-       {0x3E72, 0x0000},
-       {0x3E74, 0x0000},
-       {0x3E76, 0x0000},
-       {0x3E78, 0x0000},
-       {0x3E7A, 0x0000},
-       {0x3E7C, 0x0000},
-       {0x3E7E, 0x0000},
-       {0x3E80, 0x0000},
-       {0x3E82, 0x0000},
-       {0x3E84, 0x0000},
-       {0x3E86, 0x0000},
-       {0x3E88, 0x0000},
-       {0x3E8A, 0x0000},
-       {0x3E8C, 0x0000},
-       {0x3E8E, 0x0000},
-       {0x3E90, 0x0000},
-       {0x3E92, 0x0000},
-       {0x3E94, 0x0000},
-       {0x3E96, 0x0000},
-       {0x3E98, 0x0000},
-       {0x3E9A, 0x0000},
-       {0x3E9C, 0x0000},
-       {0x3E9E, 0x0000},
-       {0x3EA0, 0x0000},
-       {0x3EA2, 0x0000},
-       {0x3EA4, 0x0000},
-       {0x3EA6, 0x0000},
-       {0x3EA8, 0x0000},
-       {0x3EAA, 0x0000},
-       {0x3EAC, 0x0000},
-       {0x3EAE, 0x0000},
-       {0x3EB0, 0x0000},
-       {0x3EB2, 0x0000},
-       {0x3EB4, 0x0000},
-       {0x3EB6, 0x0000},
-       {0x3EB8, 0x0000},
-       {0x3EBA, 0x0000},
-       {0x3EBC, 0x0000},
-       {0x3EBE, 0x0000},
-       {0x3EC0, 0x0000},
-       {0x3EC2, 0x0000},
-       {0x3EC4, 0x0000},
-       {0x3EC6, 0x0000},
-       {0x3EC8, 0x0000},
-       {0x3ECA, 0x0000},
-       {0x301A, 0x021C},
-       {0x0342, 0x10CC},
-       {0x0340, 0x04A4},
-       {0x0202, 0x0496},
-       {0x0312, 0x045D},
-       {0x0202, 0x1952},
-       {0x3088, 0x0244},
-       {0x303E, 0x0001},
-       {0x31AE, 0x0201},
-       {0x0300, 0x0005},
-       {0x0302, 0x0001},
-       {0x0304, 0x0202},
-       {0x0306, 0x4040},
-       {0x0308, 0x000A},
-       {0x030A, 0x0001},
-       {0x0344, 0x0008},
-       {0x0348, 0x0787},
-       {0x0346, 0x0008},
-       {0x034A, 0x043F},
-       {0x034C, 0x0780},
-       {0x034E, 0x0438},
-       {0x3040, 0x0041},
-       {0x0104, 0x0001},
-       {0x3ECC, 0x008F},
-       {0x3ECE, 0xA8F0},
-       {0x3ED0, 0xFFFF},
-       {0x3ED6, 0x7193},
-       {0x3ED8, 0x8A11},
-       {0x30D2, 0x0020},
-       {0x30D4, 0x0040},
-       {0x3180, 0x80FF},
-       {0x0104, 0x0000},
-       {0x301A, 0x001C},
-       {AR0261_TABLE_END, 0x0000}
-};
 
 enum {
        AR0261_MODE_1920X1080,
-       AR0261_MODE_1920X1080_HDR,
 };
 
 static struct ar0261_reg *mode_table[] = {
        [AR0261_MODE_1920X1080] = mode_1920x1080,
-       [AR0261_MODE_1920X1080_HDR] = mode_1920x1080_HDR,
 };
 
 static inline void
@@ -647,15 +362,6 @@ ar0261_get_coarse_time_regs(struct ar0261_reg *regs, u32 coarse_time)
 }
 
 static inline void
-ar0261_get_coarse_time_short_regs(struct ar0261_reg *regs, u32 coarse_time)
-{
-       regs->addr = AR0261_COARSE_INTEGRATION_SHORT_TIME_15_8;
-       regs->val = (coarse_time >> 8) & 0xff;
-       (regs + 1)->addr = AR0261_COARSE_INTEGRATION_SHORT_TIME_7_0;
-       (regs + 1)->val = (coarse_time) & 0xff;
-}
-
-static inline void
 ar0261_get_gain_reg(struct ar0261_reg *regs, u16 gain)
 {
        regs->addr = AR0261_ANA_GAIN_GLOBAL;
@@ -791,24 +497,14 @@ ar0261_set_mode(struct ar0261_info *info, struct ar0261_mode *mode)
        struct device *dev = &info->i2c_client->dev;
        int sensor_mode;
        int err;
-       struct ar0261_reg reg_list[HDR_MODE_OVERRIDE_REGS];
+       struct ar0261_reg reg_list[5];
 
-       dev_info(dev, "%s: res [%ux%u] framelen %u coarsetime %u gain %u hdr %d\n",
+       dev_info(dev, "%s: res [%ux%u] framelen %u coarsetime %u gain %u\n",
                __func__, mode->xres, mode->yres,
-               mode->frame_length, mode->coarse_time, mode->gain,
-               mode->hdr_en);
-
-       if ((mode->xres == 1920) && (mode->yres == 1080)) {
-               if (mode->hdr_en == 0)
-                       sensor_mode = AR0261_MODE_1920X1080;
-               else if (mode->hdr_en == 1)
-                       sensor_mode = AR0261_MODE_1920X1080_HDR;
-               else {
-                       dev_err(dev, "%s: invalid hdr setting to set mode %d\n",
-                       __func__, mode->hdr_en);
-                       return -EINVAL;
-               }
-       }
+               mode->frame_length, mode->coarse_time, mode->gain);
+
+       if ((mode->xres == 1920) && (mode->yres == 1080))
+               sensor_mode = AR0261_MODE_1920X1080;
        else {
                dev_err(dev, "%s: invalid resolution to set mode %d %d\n",
                        __func__, mode->xres, mode->yres);
@@ -822,15 +518,9 @@ ar0261_set_mode(struct ar0261_info *info, struct ar0261_mode *mode)
        ar0261_get_frame_length_regs(reg_list, mode->frame_length);
        ar0261_get_coarse_time_regs(reg_list + 2, mode->coarse_time);
        ar0261_get_gain_reg(reg_list + 4, mode->gain);
-       /* if HDR is enabled */
-       if (mode->hdr_en == 1) {
-               ar0261_get_coarse_time_short_regs(
-                       reg_list + 5, mode->coarse_time_short);
-       }
 
        err = ar0261_write_table(info->i2c_client, mode_table[sensor_mode],
-                       reg_list, mode->hdr_en ? HDR_MODE_OVERRIDE_REGS :
-                       NORMAL_MODE_OVERRIDE_REGS);
+                       reg_list, 5);
        if (err)
                return err;
 
@@ -919,52 +609,6 @@ ar0261_set_coarse_time(struct ar0261_info *info,
 }
 
 static int
-ar0261_set_hdr_coarse_time(struct ar0261_info *info,
-                               struct ar0261_hdr *values,
-                               bool group_hold)
-{
-       struct ar0261_reg reg_list[2];
-       struct ar0261_reg reg_list_short[2];
-       int ret, i = 0;
-
-       /* get long and short coarse time registers */
-       ar0261_get_coarse_time_regs(reg_list, values->coarse_time_long);
-       ar0261_get_coarse_time_short_regs(reg_list_short,
-                       values->coarse_time_short);
-       /* set group hold */
-
-       if (group_hold) {
-               ret = ar0261_i2c_wr8(info->i2c_client,
-                       AR0261_GROUP_PARAM_HOLD, 0x1);
-               if (ret)
-                       return ret;
-       }
-       /* writing long exposure */
-       for (i = 0; i < 2; i++) {
-               ret = ar0261_i2c_wr8(info->i2c_client, reg_list[i].addr,
-                        reg_list[i].val);
-               if (ret)
-                       return ret;
-       }
-       /* writing short exposure */
-       for (i = 0; i < 2; i++) {
-               ret = ar0261_i2c_wr8(info->i2c_client, reg_list_short[i].addr,
-                        reg_list_short[i].val);
-               if (ret)
-                       return ret;
-       }
-
-       if (group_hold) {
-               ret = ar0261_i2c_wr8(info->i2c_client,
-                       AR0261_GROUP_PARAM_HOLD, 0x0);
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
-}
-
-static int
 ar0261_set_gain(struct ar0261_info *info, u16 gain, bool group_hold)
 {
        int ret;
@@ -979,7 +623,7 @@ ar0261_set_gain(struct ar0261_info *info, u16 gain, bool group_hold)
                        return ret;
        }
 
-ret = ar0261_i2c_wr8(info->i2c_client, reg_list.addr, reg_list.val);
+       ret = ar0261_i2c_wr8(info->i2c_client, reg_list.addr, reg_list.val);
        if (ret)
                return ret;
 
@@ -998,10 +642,6 @@ ar0261_set_group_hold(struct ar0261_info *info, struct ar0261_ae *ae)
        int ret;
        int count = 0;
        bool grouphold_enabled = false;
-       struct ar0261_hdr values;
-
-       values.coarse_time_long = ae->coarse_time;
-       values.coarse_time_short = ae->coarse_time_short;
 
        if (ae->gain_enable)
                count++;
@@ -1023,7 +663,7 @@ ar0261_set_group_hold(struct ar0261_info *info, struct ar0261_ae *ae)
        if (ae->gain_enable)
                ar0261_set_gain(info, ae->gain, false);
        if (ae->coarse_time_enable)
-               ar0261_set_hdr_coarse_time(info, &values, false);
+               ar0261_set_coarse_time(info, ae->coarse_time, false);
        if (ae->frame_length_enable)
                ar0261_set_frame_length(info, ae->frame_length, false);
 
@@ -1039,6 +679,12 @@ ar0261_set_group_hold(struct ar0261_info *info, struct ar0261_ae *ae)
 
 static int ar0261_get_sensor_id(struct ar0261_info *info)
 {
+       int ret = 0;
+       int i;
+       u16 bak = 0;
+
+       if (info->sensor_data.fuse_id_size)
+               return 0;
 
        /*
         * TBD 1: If the sensor does not have power at this point
@@ -1138,21 +784,6 @@ ar0261_ioctl(struct file *file,
                }
                return ar0261_set_group_hold(info, &ae);
        }
-       case AR0261_IOCTL_SET_HDR_COARSE_TIME:
-       {
-               struct ar0261_hdr values;
-
-               dev_dbg(&info->i2c_client->dev,
-                               "AR0261_IOCTL_SET_HDR_COARSE_TIME\n");
-               if (copy_from_user(&values,
-                       (const void __user *)arg,
-                       sizeof(struct ar0261_hdr))) {
-                               err = -EFAULT;
-                               break;
-               }
-               err = ar0261_set_hdr_coarse_time(info, &values, true);
-               break;
-       }
        default:
                dev_err(dev, "%s:unknown cmd.\n", __func__);
                return -EINVAL;
index 88d156a..678dd0e 100644 (file)
@@ -20,7 +20,6 @@
 #define AR0261_IOCTL_SET_GAIN          _IOW('o', 5, __u16)
 #define AR0261_IOCTL_GET_SENSORDATA _IOR('o', 6, struct ar0261_sensordata)
 #define AR0261_IOCTL_SET_GROUP_HOLD    _IOW('o', 7, struct ar0261_ae)
-#define AR0261_IOCTL_SET_HDR_COARSE_TIME       _IOW('o', 8, struct ar0261_hdr)
 
 /* AR0261 registers */
 #define AR0261_GROUP_PARAM_HOLD                        (0x0104)
 #define AR0261_ANA_GAIN_GLOBAL                 (0x305F)
 #define AR0261_FRAME_LEN_LINES_15_8            (0x0340)
 #define AR0261_FRAME_LEN_LINES_7_0             (0x0341)
-#define AR0261_COARSE_INTEGRATION_SHORT_TIME_15_8      (0x3088)
-#define AR0261_COARSE_INTEGRATION_SHORT_TIME_7_0       (0x3089)
 
 #define NUM_OF_FRAME_LEN_REG           2
 #define NUM_OF_COARSE_TIME_REG         2
-#define HDR_MODE_OVERRIDE_REGS         7
-#define NORMAL_MODE_OVERRIDE_REGS      5
+#define NUM_OF_SENSOR_ID_SPECIFIC_REG  8
 struct ar0261_mode {
        int xres;
        int yres;
        __u32 frame_length;
        __u32 coarse_time;
-       __u32 coarse_time_short;
        __u16 gain;
-       __u8 hdr_en;
-};
-
-struct ar0261_hdr {
-       __u32 coarse_time_long;
-       __u32 coarse_time_short;
 };
 
 struct ar0261_ae {
        __u32 frame_length;
        __u8  frame_length_enable;
        __u32 coarse_time;
-       __u32 coarse_time_short;
        __u8  coarse_time_enable;
        __s32 gain;
        __u8  gain_enable;