From: zyc Date: Sat, 3 Nov 2012 02:29:54 +0000 (+0800) Subject: camera:add interpolation for gc0308 and hi253. X-Git-Tag: firefly_0821_release~8286 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=850d247dc3301521ce797ce6086473541448d268;p=firefly-linux-kernel-4.4.55.git camera:add interpolation for gc0308 and hi253. --- diff --git a/arch/arm/plat-rk/include/plat/rk_camera.h b/arch/arm/plat-rk/include/plat/rk_camera.h index 518a6929c169..b658e238149e 100755 --- a/arch/arm/plat-rk/include/plat/rk_camera.h +++ b/arch/arm/plat-rk/include/plat/rk_camera.h @@ -121,13 +121,30 @@ #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 diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 0b62f57d8921..f83a671dced4 100755 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -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 diff --git a/drivers/media/video/gc0308.c b/drivers/media/video/gc0308.c index 1bc93fae7f02..abffd9a9b16b 100755 --- a/drivers/media/video/gc0308.c +++ b/drivers/media/video/gc0308.c @@ -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; diff --git a/drivers/media/video/hi253.c b/drivers/media/video/hi253.c index 898dc1e90b0e..12cad80975b5 100755 --- a/drivers/media/video/hi253.c +++ b/drivers/media/video/hi253.c @@ -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 */