camera:add interpolation for gc0308 and hi253.
authorzyc <zyc@rock-chips.com>
Sat, 3 Nov 2012 02:29:54 +0000 (10:29 +0800)
committerzyc <zyc@rock-chips.com>
Sat, 3 Nov 2012 02:30:15 +0000 (10:30 +0800)
arch/arm/plat-rk/include/plat/rk_camera.h
drivers/media/video/Kconfig
drivers/media/video/gc0308.c
drivers/media/video/hi253.c

index 518a6929c169fa4506c060bb71ae94d13e870b41..b658e238149e18ddbc58d8a7f63dd21520c1fa59 100755 (executable)
 #define mt9t111_FULL_RESOLUTION    0x300000           // 3 megapixel
 #define mt9p111_FULL_RESOLUTION    0x500000           // 5 megapixel
 #define gt2005_FULL_RESOLUTION     0x200000           // 2 megapixel
-#define gc0308_FULL_RESOLUTION     0x30000            // 0.3 megapixel
+#if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M)
+       #define gc0308_FULL_RESOLUTION     0x500000            // 5 megapixel
+#elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M)
+       #define gc0308_FULL_RESOLUTION     0x300000            // 3 megapixel
+#elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_2M)
+       #define gc0308_FULL_RESOLUTION     0x200000            // 2 megapixel
+#else
+       #define gc0308_FULL_RESOLUTION     0x30000            // 0.3 megapixel#endif
+#endif
+
 #define gc0309_FULL_RESOLUTION     0x30000            // 0.3 megapixel
 #define gc2015_FULL_RESOLUTION     0x200000           // 2 megapixel
 #define siv120b_FULL_RESOLUTION     0x30000            // 0.3 megapixel
 #define siv121d_FULL_RESOLUTION     0x30000            // 0.3 megapixel
 #define sid130B_FULL_RESOLUTION     0x200000           // 2 megapixel    
-#define hi253_FULL_RESOLUTION       0x200000           // 2 megapixel
+
+#if defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_5M) 
+       #define hi253_FULL_RESOLUTION       0x500000                    // 5 megapixel
+#elif defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_3M)
+       #define hi253_FULL_RESOLUTION       0x300000           // 3 megapixel
+#else
+       #define hi253_FULL_RESOLUTION       0x200000           // 2 megapixel
+#endif
+
 #define hi704_FULL_RESOLUTION       0x30000            // 0.3 megapixel
 #define nt99250_FULL_RESOLUTION     0x200000           // 2 megapixel
 #define sp0838_FULL_RESOLUTION      0x30000            // 0.3 megapixel
index 0b62f57d8921c828b2ae199f37430609199f552c..f83a671dced4c6982ba0fb4e744830b939defac5 100755 (executable)
@@ -1134,6 +1134,28 @@ config GC0308_USER_DEFINED_SERIES
        bool "GC0308 user defined init series"
        default n
 
+config SOC_CAMERA_GC0308_INTERPOLATION
+       bool "support sensor interpolation for higher resolution"
+       depends on SOC_CAMERA_GC0308
+
+config SOC_CAMERA_GC0308_INTERPOLATION_2M
+       bool "sensor interpolation 2 megapixel 1600x1200"
+       depends on SOC_CAMERA_GC0308_INTERPOLATION
+       help 
+               0x200000 2 megapixel 1600x1200
+               
+config SOC_CAMERA_GC0308_INTERPOLATION_3M
+       bool "sensor interpolation 3 megapixel 2048x1536"
+       depends on SOC_CAMERA_GC0308_INTERPOLATION
+       help 
+               0x300000 3 megapixel 2048x1536
+       
+config SOC_CAMERA_GC0308_INTERPOLATION_5M
+       bool "sensor interpolation 5 megapixel 2592x1944"
+       depends on SOC_CAMERA_GC0308_INTERPOLATION
+       help 
+               0x500000  5 megapixel    2592x1944
+
 config SOC_CAMERA_GC0309
        tristate "GC0309 support for rockchip"
        depends on SOC_CAMERA && I2C
@@ -1184,6 +1206,22 @@ config HI253_USER_DEFINED_SERIES
        bool "HI253 user defined init series"
        default n
 
+config SOC_CAMERA_HI253_INTERPOLATION
+       bool "support sensor interpolation for higher resolution"
+       depends on SOC_CAMERA_HI253
+               
+config SOC_CAMERA_HI253_INTERPOLATION_3M
+       bool "sensor interpolation 3 megapixel 2048x1536"
+       depends on SOC_CAMERA_HI253_INTERPOLATION
+       help 
+               0x300000 3 megapixel 2048x1536
+       
+config SOC_CAMERA_HI253_INTERPOLATION_5M
+       bool "sensor interpolation 5 megapixel 2592x1944"
+       depends on SOC_CAMERA_HI253_INTERPOLATION
+       help 
+               0x500000  5 megapixel    2592x1944
+
 config SOC_CAMERA_HI704
        tristate "HI704 support for rockchip"
        depends on SOC_CAMERA && I2C
index 1bc93fae7f022b7dd809b580afa0e577d790eb98..abffd9a9b16b5bab4f5b3f5a8d939906b56f3817 100755 (executable)
@@ -49,8 +49,19 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define SENSOR_ID 0x9b
 #define SENSOR_MIN_WIDTH    640//176
 #define SENSOR_MIN_HEIGHT   480//144
-#define SENSOR_MAX_WIDTH    640
-#define SENSOR_MAX_HEIGHT   480
+#if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M)
+       #define SENSOR_MAX_WIDTH    2592
+       #define SENSOR_MAX_HEIGHT   1944
+#elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M)
+       #define SENSOR_MAX_WIDTH    2048
+       #define SENSOR_MAX_HEIGHT   1536
+#elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_2M)
+       #define SENSOR_MAX_WIDTH    1600
+       #define SENSOR_MAX_HEIGHT   1200
+#else
+       #define SENSOR_MAX_WIDTH    640
+       #define SENSOR_MAX_HEIGHT   480
+#endif
 #define SENSOR_INIT_WIDTH      640                     /* Sensor pixel size for sensor_init_data array */
 #define SENSOR_INIT_HEIGHT  480
 #define SENSOR_INIT_WINSEQADR sensor_vga
@@ -1828,6 +1839,15 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
         set_w = 1280;
         set_h = 1024;
     }
+#if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_2M)||defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M) || defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M) 
+       else if (((set_w <= SENSOR_MAX_WIDTH) && (set_h <= SENSOR_MAX_HEIGHT)) )
+       {
+       winseqe_set_addr = sensor_vga;
+       set_w = 640;
+       set_h = 480;
+       }
+#endif
+
     else
     {
         winseqe_set_addr = SENSOR_INIT_WINSEQADR;               /* ddl@rock-chips.com : Sensor output smallest size if  isn't support app  */
@@ -1961,6 +1981,14 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
         set_w = 1280;
         set_h = 1024;
     }
+#if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_2M)||defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M) || defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M) 
+  else if (((set_w <= SENSOR_MAX_WIDTH) && (set_h <= SENSOR_MAX_HEIGHT)) )
+       {
+       set_w = 640;
+       set_h = 480;
+       }
+#endif
+
     else
     {
         set_w = SENSOR_INIT_WIDTH;
index 898dc1e90b0e203691aad9cf127b1aba821d2a47..12cad80975b531540b3898e3871da4c6ab5c9056 100755 (executable)
@@ -48,8 +48,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define SENSOR_ID 0x92
 #define SENSOR_MIN_WIDTH    176
 #define SENSOR_MIN_HEIGHT   144
-#define SENSOR_MAX_WIDTH    1600
-#define SENSOR_MAX_HEIGHT   1200
+#if defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_5M)
+       #define SENSOR_MAX_WIDTH    2592
+       #define SENSOR_MAX_HEIGHT   1944
+#elif defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_3M)
+       #define SENSOR_MAX_WIDTH    2048
+       #define SENSOR_MAX_HEIGHT   1536
+#else
+       #define SENSOR_MAX_WIDTH    1600
+       #define SENSOR_MAX_HEIGHT   1200
+#endif
+
 #define SENSOR_INIT_WIDTH      1600                    /* Sensor pixel size for sensor_init_data array */
 #define SENSOR_INIT_HEIGHT  1200
 #define SENSOR_INIT_WINSEQADR sensor_uxga
@@ -2532,6 +2541,14 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
         set_w = 1600;
         set_h = 1200;
     }
+#if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M) || defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M) 
+    else if (((set_w <= SENSOR_MAX_WIDTH) && (set_h <= SENSOR_MAX_HEIGHT)) )
+    {
+    winseqe_set_addr = sensor_uxga;
+    set_w = 1600;
+    set_h = 1200;
+    }
+#endif
     else
     {
         winseqe_set_addr = SENSOR_INIT_WINSEQADR;               /* ddl@rock-chips.com : Sensor output smallest size if  isn't support app  */