camera rk30 : detect whether cif recevie data in two second's interval,wake up vb...
authorroot <root@zyc-desktop.(none)>
Thu, 17 May 2012 03:22:59 +0000 (11:22 +0800)
committerroot <root@zyc-desktop.(none)>
Thu, 17 May 2012 03:22:59 +0000 (11:22 +0800)
24 files changed:
arch/arm/mach-rk30/board-rk30-sdk.c
drivers/media/video/gc0307.c
drivers/media/video/gc0308.c
drivers/media/video/gc0309.c
drivers/media/video/gc2015.c
drivers/media/video/gt2005.c
drivers/media/video/hi253.c
drivers/media/video/hi704.c
drivers/media/video/mt9d112.c
drivers/media/video/mt9d113.c
drivers/media/video/mt9p111.c
drivers/media/video/mt9t111.c
drivers/media/video/nt99250.c
drivers/media/video/ov2640_rk.c
drivers/media/video/ov2655.c [changed mode: 0644->0755]
drivers/media/video/ov2659.c
drivers/media/video/ov5640.c
drivers/media/video/ov5642.c
drivers/media/video/ov7675.c
drivers/media/video/ov7690.c
drivers/media/video/rk30_camera_oneframe.c
drivers/media/video/s5k6aa.c
drivers/media/video/sid130B.c
drivers/media/video/siv120b.c

index 412474f9e89733817eb4aef193b03c885bb7331d..560deae7ad098efc4561673f716499f0e7d29fbe 100755 (executable)
@@ -41,6 +41,7 @@
 #include <mach/gpio.h>
 #include <mach/iomux.h>
 #include <linux/fb.h>
+#include <linux/regulator/machine.h>
 #if defined(CONFIG_HDMI_RK30)
        #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
 #endif
  * author: ddl@rock-chips.com
  *****************************************************************************************/
 #ifdef CONFIG_VIDEO_RK29
-#define CONFIG_SENSOR_POWER_IOCTL_USR     0
+#define CONFIG_SENSOR_POWER_IOCTL_USR     1 //define this refer to your board layout
 #define CONFIG_SENSOR_RESET_IOCTL_USR     0
 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR         0
 #define CONFIG_SENSOR_FLASH_IOCTL_USR     0
 
+static void rk_cif_power(int on)
+{
+    struct regulator *ldo_18,*ldo_28;
+       ldo_28 = regulator_get(NULL, "ldo7");   // vcc28_cif
+       ldo_18 = regulator_get(NULL, "ldo1");   // vcc18_cif
+
+    if(on == 0){       
+       regulator_disable(ldo_28);
+       regulator_put(ldo_28);
+       regulator_disable(ldo_18);
+       regulator_put(ldo_18);
+       mdelay(500);
+        }
+    else{
+       regulator_set_voltage(ldo_28, 2800000, 2800000);
+       regulator_enable(ldo_28);
+    // printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
+       regulator_put(ldo_28);
+
+       regulator_set_voltage(ldo_18, 1800000, 1800000);
+    // regulator_set_suspend_voltage(ldo, 1800000);
+       regulator_enable(ldo_18);
+    // printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
+       regulator_put(ldo_18);
+        }
+}
+
 #if CONFIG_SENSOR_POWER_IOCTL_USR
 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
 {
-       #error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
+       //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
+    rk_cif_power(on);
 }
 #endif
 
index 8a62bba1619143c2e75ccf5a395f7bae222aca01..79c2ec36b6f41b8bcdd3ed1c7839ad62163d567f 100755 (executable)
@@ -109,7 +109,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_GC0307_USER_DEFINED_SERIES
+#ifdef CONFIG_GC0307_USER_DEFINED_SERIES
 #include "gc0307_user_series.c"
 #else
 /* init 640X480 VGA */
@@ -1749,7 +1749,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -3026,6 +3025,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 4a8067514c85f9e6bf8395aa9fe348f8451da0c9..1bc93fae7f022b7dd809b580afa0e577d790eb98 100755 (executable)
@@ -110,7 +110,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_GC0308_USER_DEFINED_SERIES
+#ifdef CONFIG_GC0308_USER_DEFINED_SERIES
 #include "gc0308_user_series.c"
 #else
 /* init 640X480 VGA */
@@ -1605,7 +1605,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -2866,6 +2865,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 4c1e6938f0d9e9fbf1faa3aa7682cf27544793dc..ddc21d9086f61388c634e01383977b8cbb13e1bc 100755 (executable)
@@ -108,7 +108,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_GC0309_USER_DEFINED_SERIES
+#ifdef CONFIG_GC0309_USER_DEFINED_SERIES
 #include "gc0309_user_series.c"
 #else
 /* init SVGA preview */
@@ -1574,7 +1574,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -2808,6 +2807,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index b388c88e5657ed17c623d76301e39fde71e4d632..1c3101fd046698e107d5fe760c46f4bba5a6f9cf 100755 (executable)
@@ -109,7 +109,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_GC2015_USER_DEFINED_SERIES
+#ifdef CONFIG_GC2015_USER_DEFINED_SERIES
 #include "gc2015_user_series.c"
 #else
 /* init SVGA preview */
@@ -1741,7 +1741,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -3042,6 +3041,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 9658a4d09adb0d616146e5c50eb491fe36844b2b..d9915c3aebd17a6f24bc04d8a05a07dc133c11ba 100755 (executable)
@@ -109,7 +109,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_GT2005_USER_DEFINED_SERIES
+#ifdef CONFIG_GT2005_USER_DEFINED_SERIES
 #include "gt2005_user_series.c"
 #else
 /* init 352X288 SVGA */
@@ -2386,7 +2386,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -3675,6 +3674,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 42a6724a748a6134a8ed6afa9c3a1bacf96a77ed..0588114773ea31d659270e28109621dfe63319b7 100755 (executable)
@@ -110,7 +110,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_HI253_USER_DEFINED_SERIES
+#ifdef CONFIG_HI253_USER_DEFINED_SERIES
 #include "hi253_user_series.c"
 #else
 /* init SVGA preview */
@@ -2289,7 +2289,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -3525,6 +3524,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 5470743c07fb90af091c47f4c19b0f0931431ba4..09ea70fb3a1fc254a4358f9f46e75e0353dff60c 100755 (executable)
@@ -110,7 +110,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_HI704_USER_DEFINED_SERIES
+#ifdef CONFIG_HI704_USER_DEFINED_SERIES
 #include "hi704_user_series.c"
 #else
 /* init SVGA preview */
@@ -1767,7 +1767,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -2978,6 +2977,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 4cd7ed5414f4408a61261bc3c957785544783693..4812dd227c2a12bb752d8d69f7a1140e0798d8d2 100755 (executable)
@@ -118,7 +118,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_MT9D112_USER_DEFINED_SERIES
+#ifdef CONFIG_MT9D112_USER_DEFINED_SERIES
 #include "mt9d112_user_series.c"
 #else
 
@@ -1920,7 +1920,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
 
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -3351,6 +3350,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index fdb34d42015bbb11fc8e7e57facb4eebefe70af2..eea39a2955eac06b63b56af422191340885c979e 100755 (executable)
@@ -117,7 +117,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_MT9D113_USER_DEFINED_SERIES
+#ifdef CONFIG_MT9D113_USER_DEFINED_SERIES
 #include "mt9d113_user_series.c"
 #else
 /* init 800x600 SVGA */
@@ -1723,7 +1723,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -3095,6 +3094,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index ff5682cba5cc0b4403ef472d9a3511989ebfbe20..4228967619410c0ff361aed539e241f57e4c9fa4 100755 (executable)
@@ -126,7 +126,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_MT9P111_USER_DEFINED_SERIES
+#ifdef CONFIG_MT9P111_USER_DEFINED_SERIES
 #include "mt9p111_user_series.c"
 #else
 
@@ -3080,7 +3080,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
 
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -4808,6 +4807,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 02c27ab86816faba3c45db4bf2afabe3b641ffed..6dffcddf6221ab162ae94bd70a476fae8787b745 100755 (executable)
@@ -122,7 +122,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_MT9T111_USER_DEFINED_SERIES
+#ifdef CONFIG_MT9T111_USER_DEFINED_SERIES
 #include "mt9t111_user_series.c"
 #else
 
@@ -6845,7 +6845,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        {
                sensor->info_priv.flash = qctrl->default_value;
        }
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -8427,6 +8426,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 68a64ce19e7911ce33789258929ae4a058f80db7..8ba1261dca1f2e0153e6f23b62bcadff1841d073 100755 (executable)
@@ -109,7 +109,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_NT99250_USER_DEFINED_SERIES
+#ifdef CONFIG_NT99250_USER_DEFINED_SERIES
 #include "NT99250_user_series.c"
 #else
 /* init 352X288 SVGA */
@@ -1590,7 +1590,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -2868,6 +2867,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index af72cf5e581dbce8141e19cc8584deb88e828569..0229d657090d85257578386e2bb1e16bed658a21 100755 (executable)
@@ -99,7 +99,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 \r
 static struct  flash_timer flash_off_timer;\r
 //for user defined if user want to customize the series , zyc\r
-#if CONFIG_OV2640_USER_DEFINED_SERIES\r
+#ifdef CONFIG_OV2640_USER_DEFINED_SERIES\r
 #include "ov2640_user_series.c"\r
 #else\r
 /* init 800*600 SVGA */\r
@@ -1775,7 +1775,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        if (qctrl)\r
         sensor->info_priv.flash = qctrl->default_value;\r
 \r
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);\r
     flash_off_timer.icd = icd;\r
        flash_off_timer.timer.function = flash_off_func;\r
     #endif\r
@@ -3079,6 +3078,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);\r
                sensor = NULL;\r
     }\r
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);\r
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);\r
     return ret;\r
 }\r
old mode 100644 (file)
new mode 100755 (executable)
index c12a5a4..f6b90b4
@@ -106,7 +106,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_OV2655_USER_DEFINED_SERIES
+#ifdef CONFIG_OV2655_USER_DEFINED_SERIES
 #include "ov2655_user_series.c"
 #else
 
@@ -1934,7 +1934,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
 
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -3239,6 +3238,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 943ffd824b1c2ba029cbdfa9ab9f8dbe7fdadf5c..071f070b2404b9e6803fb5ae9c30d54cd7134b0e 100755 (executable)
@@ -105,7 +105,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_OV2659_USER_DEFINED_SERIES
+#ifdef CONFIG_OV2659_USER_DEFINED_SERIES
 #include "ov2659_user_series.c"
 #else
 /* init 800*600 SVGA */
@@ -1720,7 +1720,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -3063,6 +3062,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 8bc9c96aceb95fa7aed11aa33b526a151adc234f..609f56aa33fdfee32fdda473127e8fc6b9df8690 100755 (executable)
@@ -186,7 +186,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_OV5640_USER_DEFINED_SERIES
+#ifdef CONFIG_OV5640_USER_DEFINED_SERIES
 #include "ov5640_user_series.c"
 #else
 
@@ -2514,7 +2514,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -4040,7 +4039,7 @@ static int sensor_probe(struct i2c_client *client,
                mutex_init(&sensor->wq_lock);
                #endif
     }
-
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 2749671bd8adc51da1a4f1f3f60e111c13cfb83e..783a7a63f7ae5036d4f336b9b2a6dff4d7f22c14 100755 (executable)
@@ -172,7 +172,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_OV5642_USER_DEFINED_SERIES
+#ifdef CONFIG_OV5642_USER_DEFINED_SERIES
 #include "ov5642_user_series.c"
 #else
 /* init 800X600 SVGA */
@@ -4463,7 +4463,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -6023,7 +6022,7 @@ static int sensor_probe(struct i2c_client *client,
                mutex_init(&sensor->wq_lock);
                #endif
     }
-
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 9734410c90141e8619e34db7b92f14392e48c6d1..4c10b58ee8f4caf7c4fecb76e7377c4acf1a4d62 100755 (executable)
@@ -105,7 +105,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_OV7675_USER_DEFINED_SERIES
+#ifdef CONFIG_OV7675_USER_DEFINED_SERIES
 #include "ov7675_user_series.c"
 #else
 /* init 640X480 VGA */
@@ -1498,7 +1498,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -2768,6 +2767,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index c4f567f841d1766b25cf87ef3d8385bdfee3add9..2ef56d08c597e9109ce6cd29691fb127d64dd5fc 100755 (executable)
@@ -105,7 +105,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_OV7690_USER_DEFINED_SERIES
+#ifdef CONFIG_OV7690_USER_DEFINED_SERIES
 #include "ov7690_user_series.c"
 #else
 
@@ -1299,7 +1299,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -2545,6 +2544,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index 5429c123cee71f8ef8e059fa5a518e19b07b03a1..172b8d48b8bdc83cada57bad063e3e9b8f5d55b6 100755 (executable)
@@ -38,7 +38,6 @@
 #include <mach/io.h>
 #include <plat/ipp.h>
 #include <mach/rk30_camera.h>
-#include <linux/regulator/machine.h>
 #include <mach/cru.h>
 #include <mach/pmu.h>
 
@@ -334,6 +333,8 @@ struct rk_camera_dev
        rk29_camera_sensor_cb_s icd_cb;
        struct rk_camera_frmivalinfo icd_frmival[2];
  //   atomic_t to_process_frames;
+    bool timer_get_fps;
+    struct videobuf_queue *video_vq;
 };
 
 static const struct v4l2_queryctrl rk_camera_controls[] =
@@ -356,34 +357,6 @@ static const char *rk_cam_driver_description = "RK_Camera";
 
 static int rk_camera_s_stream(struct soc_camera_device *icd, int enable);
 
-static void rk_cif_poweroff(struct rk_camera_dev *pcdev)
-{
-    struct regulator *ldo_18,*ldo_28;
-       ldo_28 = regulator_get(NULL, "ldo7");   // vcc28_cif
-       ldo_18 = regulator_get(NULL, "ldo1");   // vcc18_cif
-       
-       regulator_disable(ldo_28);
-       regulator_put(ldo_28);
-       regulator_disable(ldo_18);
-       regulator_put(ldo_18);
-       mdelay(500);
-}
-static void rk_cif_poweron(struct rk_camera_dev *pcdev)
-{
-    struct regulator *ldo_18,*ldo_28;
-       ldo_28 = regulator_get(NULL, "ldo7");   // vcc28_cif
-       ldo_18 = regulator_get(NULL, "ldo1");   // vcc18_cif
-       regulator_set_voltage(ldo_28, 2800000, 2800000);
-       regulator_enable(ldo_28);
-//     printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
-       regulator_put(ldo_28);
-
-       regulator_set_voltage(ldo_18, 1800000, 1800000);
-//     regulator_set_suspend_voltage(ldo, 1800000);
-       regulator_enable(ldo_18);
-//     printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
-       regulator_put(ldo_18);
-}
 
 /*
  *  Videobuf operations
@@ -434,6 +407,7 @@ static int rk_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
                        pcdev->camera_work_count = *count;
                }
        }
+    pcdev->video_vq = vq;
     RKCAMERA_DG("%s..%d.. videobuf size:%d, vipmem_buf size:%d, count:%d \n",__FUNCTION__,__LINE__, *size,pcdev->vipmem_size, *count);
 
     return 0;
@@ -1794,7 +1768,11 @@ static void rk_camera_reinit_work(struct work_struct *work)
        struct rk_camera_work *camera_work = container_of(work, struct rk_camera_work, work);
        struct rk_camera_dev *pcdev = camera_work->pcdev;
     struct videobuf_buffer     *tmp_vb;
-               sd = soc_camera_to_subdev(pcdev->icd);
+    struct soc_camera_link *tmp_soc_cam_link;
+    int index = 0;
+       unsigned long flags = 0;
+    sd = soc_camera_to_subdev(pcdev->icd);
+    tmp_soc_cam_link = to_soc_camera_link(pcdev->icd);
        //dump regs
        {
                RKCAMERA_DG("CIF_CIF_CTRL = 0x%x\n",read_cif_reg(pcdev->base,CIF_CIF_CTRL));
@@ -1814,19 +1792,35 @@ static void rk_camera_reinit_work(struct work_struct *work)
        RKCAMERA_DG("CIF_CIF_FRM0_ADDR_UV = 0X%x\n",read_cif_reg(pcdev->base,CIF_CIF_FRM0_ADDR_UV));
        RKCAMERA_DG("CIF_CIF_FRAME_STATUS = 0X%x\n",read_cif_reg(pcdev->base,CIF_CIF_FRAME_STATUS));
        }
+       write_cif_reg(pcdev->base,CIF_CIF_CTRL, (read_cif_reg(pcdev->base,CIF_CIF_CTRL)&(~ENABLE_CAPTURE)));
+    #if 0
     while (!list_empty(&pcdev->capture)) {
-        printk("wake up video buffer!!!\n");
         tmp_vb = list_entry(pcdev->capture.next, struct videobuf_buffer, queue);
-       if (tmp_vb && (tmp_vb->state == VIDEOBUF_QUEUED)
+       if (tmp_vb/* && (tmp_vb->state == VIDEOBUF_QUEUED)*/
          {
-               list_del_init(&(tmp_vb->queue));
+            printk("wake up video buffer index = %d ,state = %d, !!!\n",tmp_vb->i,tmp_vb->state);
             tmp_vb->state = VIDEOBUF_ERROR;
-
-           wake_up_all(&tmp_vb->done);
+               list_del_init(&(tmp_vb->queue));
+           wake_up(&tmp_vb->done);
        }
     }
-       write_cif_reg(pcdev->base,CIF_CIF_CTRL, (read_cif_reg(pcdev->base,CIF_CIF_CTRL)&(~ENABLE_CAPTURE)));
-    rk_cif_poweroff(pcdev);
+    #else
+       spin_lock_irqsave(pcdev->video_vq->irqlock, flags);
+       for (index = 0; index < VIDEO_MAX_FRAME; index++) {
+               if (NULL == pcdev->video_vq->bufs[index])
+                       continue;
+               if (pcdev->video_vq->bufs[index]->state == VIDEOBUF_QUEUED) {
+                       list_del_init(&pcdev->video_vq->bufs[index]->queue);
+                       pcdev->video_vq->bufs[index]->state = VIDEOBUF_NEEDS_INIT;
+                       wake_up_all(&pcdev->video_vq->bufs[index]->done);
+                printk("wake up video buffer index = %d  !!!\n",index);
+               }
+       }
+       spin_unlock_irqrestore(pcdev->video_vq->irqlock, flags);
+
+    #endif
+   // rk_cif_poweroff(pcdev);
+    tmp_soc_cam_link->power(pcdev->icd->pdev,0);
     if(IS_CIF0()){
        //      write_cru_reg(CRU_CIF_RST_REG30,(read_cru_reg(CRU_CIF_RST_REG30)|MASK_RST_CIF0|RQUEST_RST_CIF0 ));
         
@@ -1834,7 +1828,7 @@ static void rk_camera_reinit_work(struct work_struct *work)
 
                pmu_set_idle_request(IDLE_REQ_VIO, true);
                cru_set_soft_reset(SOFT_RST_CIF0, true);
-               udelay(300);
+               udelay(50);
                cru_set_soft_reset(SOFT_RST_CIF0, false);
                pmu_set_idle_request(IDLE_REQ_VIO, false);
 
@@ -1845,13 +1839,14 @@ static void rk_camera_reinit_work(struct work_struct *work)
        // write_cru_reg(CRU_CIF_RST_REG30,(read_cru_reg(CRU_CIF_RST_REG30)&(~RQUEST_RST_CIF1)) | MASK_RST_CIF1);
                pmu_set_idle_request(IDLE_REQ_VIO, true);
                cru_set_soft_reset(SOFT_RST_CIF1, true);
-               udelay(300);
+               udelay(50);
                cru_set_soft_reset(SOFT_RST_CIF1, false);
                pmu_set_idle_request(IDLE_REQ_VIO, false);  
    
     }
-    rk_cif_poweron(pcdev);
-
+   // rk_cif_poweron(pcdev);
+    tmp_soc_cam_link->power(pcdev->icd->pdev,1);
+   #if 0
        control = to_soc_camera_control(pcdev->icd);
        sd = dev_get_drvdata(control);
        ret = v4l2_subdev_call(sd,core, init, 1);
@@ -1864,9 +1859,7 @@ static void rk_camera_reinit_work(struct work_struct *work)
        ret |= v4l2_subdev_call(sd, video, s_mbus_fmt, &mf);
 
        write_cif_reg(pcdev->base,CIF_CIF_CTRL, (read_cif_reg(pcdev->base,CIF_CIF_CTRL)|ENABLE_CAPTURE));
-
-
-
+    #endif
        RKCAMERA_TR("Camera host haven't recevie data from sensor,Reinit sensor now! ret:0x%x\n",ret);
 }
 static enum hrtimer_restart rk_camera_fps_func(struct hrtimer *timer)
@@ -1875,14 +1868,18 @@ static enum hrtimer_restart rk_camera_fps_func(struct hrtimer *timer)
        struct rk_camera_timer *fps_timer = container_of(timer, struct rk_camera_timer, timer);
        struct rk_camera_dev *pcdev = fps_timer->pcdev;
     int rec_flag,i;
-    
+    static unsigned int last_fps = 0;
+    struct soc_camera_link *tmp_soc_cam_link;
+    tmp_soc_cam_link = to_soc_camera_link(pcdev->icd);
+
        RKCAMERA_DG("rk_camera_fps_func fps:0x%x\n",pcdev->fps);
-       if (pcdev->fps < 2) {
+       if ((pcdev->fps < 2) || (last_fps == pcdev->fps)) {
                RKCAMERA_TR("Camera host haven't recevie data from sensor,Reinit sensor delay!\n");
                pcdev->camera_reinit_work.pcdev = pcdev;
-               INIT_WORK(&(pcdev->camera_reinit_work.work), rk_camera_reinit_work);
+               //INIT_WORK(&(pcdev->camera_reinit_work.work), rk_camera_reinit_work);
                queue_work(pcdev->camera_wq,&(pcdev->camera_reinit_work.work));
-       } else {
+       } else if(!pcdev->timer_get_fps) {
+           pcdev->timer_get_fps = true;
            for (i=0; i<2; i++) {
             if (pcdev->icd == pcdev->icd_frmival[i].icd) {
                 fival_nxt = pcdev->icd_frmival[i].fival_list;                
@@ -1942,8 +1939,10 @@ static enum hrtimer_restart rk_camera_fps_func(struct hrtimer *timer)
             }
         }
        }
-
-       return HRTIMER_NORESTART;
+    last_fps = pcdev->fps ;
+    pcdev->fps_timer.timer.node.expires= ktime_add_us(pcdev->fps_timer.timer.node.expires, ktime_to_us(ktime_set(2, 0)));
+       //return HRTIMER_NORESTART;
+    return HRTIMER_RESTART;
 }
 static int rk_camera_s_stream(struct soc_camera_device *icd, int enable)
 {
@@ -1959,6 +1958,7 @@ static int rk_camera_s_stream(struct soc_camera_device *icd, int enable)
                pcdev->fps = 0;
                hrtimer_cancel(&(pcdev->fps_timer.timer));
                pcdev->fps_timer.pcdev = pcdev;
+        pcdev->timer_get_fps = false;
 //             hrtimer_start(&(pcdev->fps_timer.timer),ktime_set(3, 0),HRTIMER_MODE_REL);
                cif_ctrl_val |= ENABLE_CAPTURE;
                write_cif_reg(pcdev->base,CIF_CIF_CTRL, cif_ctrl_val);
index e8beae9d34627dbad6d32580f74d07ef7a545c16..a7fd2e6f1014af7befdc6886019cd35493055299 100755 (executable)
@@ -119,7 +119,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_S5K6AA_USER_DEFINED_SERIES
+#ifdef CONFIG_S5K6AA_USER_DEFINED_SERIES
 #include "s5k6aa_user_series.c"
 #else
 
@@ -3454,7 +3454,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
 
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
 
@@ -4759,6 +4758,7 @@ static int sensor_probe(struct i2c_client *client,
         i2c_set_clientdata(client, NULL);
         kfree(sensor);
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }
index a3a9d62c4ec89f5b2bfedd9b45a9973b69b15466..4028cf199d569f1bf6929b99e28f3a94e3812fa5 100755 (executable)
@@ -109,7 +109,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 \r
 static struct  flash_timer flash_off_timer;\r
 //for user defined if user want to customize the series , zyc\r
-#if CONFIG_SID130B_USER_DEFINED_SERIES\r
+#ifdef CONFIG_SID130B_USER_DEFINED_SERIES\r
 #include "sid130B_user_series.c"\r
 #else\r
 /* init 352X288 SVGA */\r
@@ -1828,7 +1828,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);\r
        if (qctrl)\r
         sensor->info_priv.flash = qctrl->default_value;\r
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);\r
     flash_off_timer.icd = icd;\r
        flash_off_timer.timer.function = flash_off_func;\r
     #endif\r
@@ -3127,6 +3126,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);\r
                sensor = NULL;\r
     }\r
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);\r
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);\r
     return ret;\r
 }\r
index 854442006f2bc68b653830de382a32f2ace2cfba..ea88fc90f2bc6440bdb4abc31b74f0d36d320d07 100755 (executable)
@@ -109,7 +109,7 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 
 static struct  flash_timer flash_off_timer;
 //for user defined if user want to customize the series , zyc
-#if CONFIG_SIV120B_USER_DEFINED_SERIES
+#ifdef CONFIG_SIV120B_USER_DEFINED_SERIES
 #include "siv120b_user_series.c"
 #else
 /* init 640X480 VGA */
@@ -1581,7 +1581,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
        if (qctrl)
         sensor->info_priv.flash = qctrl->default_value;
-       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     flash_off_timer.icd = icd;
        flash_off_timer.timer.function = flash_off_func;
     #endif
@@ -2795,6 +2794,7 @@ static int sensor_probe(struct i2c_client *client,
         kfree(sensor);
                sensor = NULL;
     }
+       hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
     SENSOR_DG("\n%s..%s..%d  ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
     return ret;
 }