camera rk30 : detect whether cif recevie data in two second's interval,wake up vb when no data.

This commit is contained in:
root 2012-05-17 11:22:59 +08:00
parent a8f97a8e95
commit b0c86fcac1
24 changed files with 125 additions and 98 deletions

View File

@ -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
@ -207,15 +208,43 @@
* 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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -99,7 +99,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_OV2640_USER_DEFINED_SERIES
#ifdef CONFIG_OV2640_USER_DEFINED_SERIES
#include "ov2640_user_series.c"
#else
/* init 800*600 SVGA */
@ -1775,7 +1775,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
@ -3079,6 +3078,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;
}

4
drivers/media/video/ov2655.c Normal file → Executable file
View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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_SID130B_USER_DEFINED_SERIES
#ifdef CONFIG_SID130B_USER_DEFINED_SERIES
#include "sid130B_user_series.c"
#else
/* init 352X288 SVGA */
@ -1828,7 +1828,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
@ -3127,6 +3126,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;
}

View File

@ -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;
}