Skip to content

Commit

Permalink
camera: rk_cam_cif:v0.3.0x17 rk_cam_sensor: v0.1.0x13
Browse files Browse the repository at this point in the history
  • Loading branch information
Rockchip committed Jun 4, 2014
1 parent 7cea666 commit 65777ac
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
9 changes: 8 additions & 1 deletion drivers/media/video/generic_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
* 2. The resoultion which the ration is same is first choice;
*v0.1.0x11:
* 1. add support sensor af power;
*v0.1.0x13:
* 1. add support skip frames function;
*/
static int version = KERNEL_VERSION(0,1,0x11);
static int version = KERNEL_VERSION(0,1,0x13);
module_param(version, int, S_IRUGO);


Expand All @@ -61,6 +63,8 @@ module_param(debug, int, S_IRUGO|S_IWUSR);


#define CONFIG_SENSOR_I2C_RDWRCHK 0
#define CONFIG_SENSOR_SKIP_FRAME 0 /*[email protected]: v0.1.0x12*/
extern void rk_camera_skip_frames(struct soc_camera_device *icd, unsigned int id, unsigned int frmcnt);

static const struct rk_sensor_datafmt *generic_sensor_find_datafmt(
enum v4l2_mbus_pixelcode code, const struct rk_sensor_datafmt *fmt,
Expand Down Expand Up @@ -1039,6 +1043,9 @@ int generic_sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)

if (ctrl_info->cb) {
ret = (ctrl_info->cb)(icd,ctrl_info, &ext_ctrl,true);
#if (CONFIG_SENSOR_SKIP_FRAME == 1)
rk_camera_skip_frames(icd, ext_ctrl.id, 1);
#endif
} else {
SENSOR_TR("v4l2_control id(0x%x) callback isn't exist",ctrl->id);
ret = -EINVAL;
Expand Down
38 changes: 33 additions & 5 deletions drivers/media/video/rk30_camera_oneframe.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,11 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
* 2. Reset cif and Reinit sensor when cif havn't receive data first;
*v0.3.0x15:
* 1. fix access cif register in rk_camera_remove_device, it may be happen before clock turn on;
*v0.3.0x17:
* 1. fix display bug when the moment switch awb mode;add rk_camera_skip_frames function;
*/

#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 3, 0x15)
#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 3, 0x17)
static int version = RK_CAM_VERSION_CODE;
module_param(version, int, S_IRUGO);

Expand Down Expand Up @@ -366,6 +368,8 @@ module_param(version, int, S_IRUGO);

extern void videobuf_dma_contig_free(struct videobuf_queue *q, struct videobuf_buffer *buf);
extern dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf);


/* buffer for one video frame */
struct rk_camera_buffer
{
Expand Down Expand Up @@ -524,6 +528,8 @@ struct rk_camera_dev
struct timeval first_tv;

int chip_id;
unsigned int frmcnt_cur;
unsigned int frmcnt_to_skip;
};

static const struct v4l2_queryctrl rk_camera_controls[] =
Expand Down Expand Up @@ -1321,7 +1327,7 @@ static void rk_camera_capture_process(struct work_struct *work)
spin_lock_irqsave(&pcdev->camera_work_lock, flags);
list_add_tail(&camera_work->queue, &pcdev->camera_work_queue);
spin_unlock_irqrestore(&pcdev->camera_work_lock, flags);
wake_up(&(camera_work->vb->done)); /* [email protected] : v0.3.9 */
wake_up(&(camera_work->vb->done)); /* [email protected] : v0.3.9 */
return;
}

Expand Down Expand Up @@ -1387,7 +1393,6 @@ static inline irqreturn_t rk_camera_cifirq(int irq, void *data)

return IRQ_HANDLED;
}

static inline irqreturn_t rk_camera_dmairq(int irq, void *data)
{
struct rk_camera_dev *pcdev = data;
Expand Down Expand Up @@ -1421,7 +1426,12 @@ static inline irqreturn_t rk_camera_dmairq(int irq, void *data)
RKCAMERA_TR("frame_inval : %0x",pcdev->frame_inval);
pcdev->frame_inval = 0;
}

if(pcdev->fps - pcdev->frmcnt_cur <= pcdev->frmcnt_to_skip)
{
rk_videobuf_capture(pcdev->active,pcdev);
goto end;
}

if(pcdev->fps == RK30_CAM_FRAME_MEASURE) {
do_gettimeofday(&tv);
pcdev->frame_interval = ((tv.tv_sec*1000000 + tv.tv_usec) - (pcdev->first_tv.tv_sec*1000000 + pcdev->first_tv.tv_usec))
Expand Down Expand Up @@ -1465,7 +1475,7 @@ static inline irqreturn_t rk_camera_dmairq(int irq, void *data)
vb->state = VIDEOBUF_DONE;
vb->field_count++;
}
wake_up(&vb->done);
wake_up(&vb->done);
}
}

Expand Down Expand Up @@ -2921,6 +2931,8 @@ static int rk_camera_s_stream(struct soc_camera_device *icd, int enable)
pcdev->fps = 0;
pcdev->last_fps = 0;
pcdev->frame_interval = 0;
pcdev->frmcnt_cur = 0;
pcdev->frmcnt_to_skip = 0;
hrtimer_cancel(&(pcdev->fps_timer.timer));
pcdev->fps_timer.pcdev = pcdev;
pcdev->timer_get_fps = false;
Expand Down Expand Up @@ -3168,6 +3180,22 @@ static int rk_camera_set_digit_zoom(struct soc_camera_device *icd,
return 0;
}

void rk_camera_skip_frames(struct soc_camera_device *icd, unsigned int id, unsigned int frmcnt)
{
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
struct rk_camera_dev *pcdev = ici->priv;

switch(id)
{
case V4L2_CID_DO_WHITE_BALANCE:
pcdev->frmcnt_cur = pcdev->fps;
pcdev->frmcnt_to_skip = frmcnt;
break;
default:
break;
}
}

static inline struct v4l2_queryctrl const *rk_camera_soc_camera_find_qctrl(
struct soc_camera_host_ops *ops, int id)
{
Expand Down

0 comments on commit 65777ac

Please sign in to comment.