]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
WAR:media:i2c:ov5693: add flip and mirror setting l4t/l4t-r28.1 l4t/l4t-r283.1
authorWenjia Zhou <wenjiaz@nvidia.com>
Sat, 15 Jul 2017 02:35:59 +0000 (19:35 -0700)
committerWinnie Hsu <whsu@nvidia.com>
Sun, 16 Jul 2017 05:22:01 +0000 (22:22 -0700)
mode table enable mirror, WAR by unmirror it.

Bug 200292212

Change-Id: I17ab87946c17d45813f9b76cf5ebb2918d00da03
Signed-off-by: Wenjia Zhou <wenjiaz@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1520873
Reviewed-by: Michelle Bourland <msoult@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sean Pieper <spieper@nvidia.com>
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
drivers/media/i2c/ov5693.c
include/media/camera_common.h
include/media/ov5693.h

index 605586d12abd33faa688bb07bb2252dc05c2ecab..aa9e7feb35c912bc376c3cc076cdf2951e784494 100644 (file)
@@ -499,6 +499,7 @@ static int ov5693_s_stream(struct v4l2_subdev *sd, int enable)
        struct v4l2_control control;
        int err;
        u32 frame_time;
+       u8 val;
 
        dev_dbg(&client->dev, "%s++\n", __func__);
 
@@ -570,7 +571,20 @@ static int ov5693_s_stream(struct v4l2_subdev *sd, int enable)
        err = ov5693_write_table(priv, mode_table[OV5693_MODE_START_STREAM]);
        if (err)
                goto exit;
-
+        if (priv->pdata->v_flip) {
+               ov5693_read_reg(priv->s_data, OV5693_TIMING_REG20, &val);
+               ov5693_write_reg(priv->s_data, OV5693_TIMING_REG20,
+                                val | VERTICAL_FLIP);
+       }
+       if (priv->pdata->h_mirror) {
+               ov5693_read_reg(priv->s_data, OV5693_TIMING_REG21, &val);
+               ov5693_write_reg(priv->s_data, OV5693_TIMING_REG21,
+                                val | HORIZONTAL_MIRROR_MASK);
+       } else {
+               ov5693_read_reg(priv->s_data, OV5693_TIMING_REG21, &val);
+               ov5693_write_reg(priv->s_data, OV5693_TIMING_REG21,
+                                val & (~HORIZONTAL_MIRROR_MASK));
+       }
        if (test_mode)
                err = ov5693_write_table(priv,
                        mode_table[OV5693_MODE_TEST_PATTERN]);
@@ -1331,7 +1345,9 @@ static struct camera_common_pdata *ov5693_parse_dt(struct i2c_client *client)
 
        board_priv_pdata->has_eeprom =
                of_property_read_bool(node, "has-eeprom");
-
+       board_priv_pdata->v_flip= of_property_read_bool(node, "vertical-flip");
+       board_priv_pdata->h_mirror = of_property_read_bool(node,
+                                                        "horizontal-mirror");
        return board_priv_pdata;
 
 error:
index 6b2e8753d9a88ae720fea60eee4a18abebfce130..5c5a17e345b0f2647e649fb4093936aabcf4136b 100644 (file)
@@ -125,6 +125,8 @@ struct camera_common_pdata {
        bool use_cam_gpio;
        bool has_eeprom;
        struct camera_common_mode_info *mode_info;
+       bool v_flip;
+       bool h_mirror;
 };
 
 struct camera_common_eeprom_data {
index e8f94859cef475aa5657d8c7e5ea1c49803fe4a6..f1649560396505ab56b9626d985951b182aea7d2 100644 (file)
 #define OV5693_GAIN_ADDR_MSB                   0x350A
 #define OV5693_GAIN_ADDR_LSB                   0x350B
 #define OV5693_GROUP_HOLD_ADDR                 0x3208
+#define OV5693_TIMING_REG20                    0x3820
+#define VERTICAL_FLIP                          ((0x1 << 1) | (0x1 << 6))
+#define OV5693_TIMING_REG21                    0x3821
+#define HORIZONTAL_MIRROR_MASK                 (0x3 << 1)
 
 struct ov5693_mode {
        int res_x;