]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
media: i2c: imx2xx: fix crop support
authorArun Kannan <akannan@nvidia.com>
Wed, 15 Jun 2016 23:26:47 +0000 (16:26 -0700)
committermobile promotions <svcmobile_promotions@nvidia.com>
Fri, 17 Jun 2016 13:12:23 +0000 (06:12 -0700)
Fix sensor max width and height for
crop support to work correctly.

Bug 1778484

Change-Id: I4474878f57ea079461329926e645bd9160036db5
Signed-off-by: Arun Kannan <akannan@nvidia.com>
Reviewed-on: http://git-master/r/1165296
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
drivers/media/i2c/imx2xx.c

index 118a889505e2881ede271a2cfae200c544759a6e..c0f87fba0b069240c93359a2807ea2097fa620c6 100644 (file)
@@ -51,6 +51,8 @@ struct imx_sensor_data {
        int imx_fuse_id_pg_num;
        u16 imx_fuse_id_reg_start;
        int imx_fuse_id_size;
+       int imx_sensor_max_width;
+       int imx_sensor_max_height;
 };
 
 const struct imx_sensor_data imx214_sensor_data = {
@@ -64,6 +66,8 @@ const struct imx_sensor_data imx214_sensor_data = {
        .imx_fuse_id_pg_num = 19,
        .imx_fuse_id_reg_start = 0x0A36,
        .imx_fuse_id_size = 11,
+       .imx_sensor_max_width = 4096,
+       .imx_sensor_max_height = 3072,
 };
 
 const struct imx_sensor_data imx230_sensor_data = {
@@ -77,6 +81,8 @@ const struct imx_sensor_data imx230_sensor_data = {
        .imx_fuse_id_pg_num = 31,
        .imx_fuse_id_reg_start = 0x0A36,
        .imx_fuse_id_size = 11,
+       .imx_sensor_max_width = 5344,
+       .imx_sensor_max_height = 4016,
 };
 
 /* Useful macros to dereference sensor-type constants */
@@ -632,8 +638,8 @@ static int imx2xx_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *crop)
        }
        right = rect->left + width - 1;
        bottom = rect->top + height - 1;
-       if ((right > s_data->def_width) ||
-               (bottom > s_data->def_height)) {
+       if ((right > priv->sensor_data->imx_sensor_max_width) ||
+               (bottom > priv->sensor_data->imx_sensor_max_height)) {
                dev_err(&client->dev,
                        "%s: CROP Bound Error: right:%d, bottom:%d)\n",
                        __func__, right, bottom);