From a7b563f2a436c837d93a3ac3093c3cfc5184a178 Mon Sep 17 00:00:00 2001 From: Tao Jing Date: Tue, 17 Apr 2012 19:03:53 +0800 Subject: [PATCH] Mt9e013: correct fps for different resolutions of different settings. BZ: 31575 correct the fps for different resolutions of different settings. Change-Id: I3dcc05b11be3cadee5d11b2fac8bacec132ecdb1 Signed-off-by: Tao Jing Signed-off-by: ziyux.jiang Reviewed-on: http://android.intel.com:8080/43702 Reviewed-by: Wang, Wen W Reviewed-by: Gong, Shuguang Reviewed-by: Koski, Anttu Tested-by: Koski, Anttu Reviewed-by: buildbot Tested-by: buildbot --- drivers/media/video/atomisp/atomisp_ioctl.c | 14 +++++++++++++- drivers/media/video/mt9e013.c | 18 +++++++++++++++++- drivers/media/video/mt9e013.h | 1 + 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/atomisp/atomisp_ioctl.c b/drivers/media/video/atomisp/atomisp_ioctl.c index f3a860e..c53ec3e 100644 --- a/drivers/media/video/atomisp/atomisp_ioctl.c +++ b/drivers/media/video/atomisp/atomisp_ioctl.c @@ -1606,9 +1606,21 @@ static int atomisp_s_parm(struct file *file, void *fh, } isp->sw_contex.run_mode = parm->parm.capture.capturemode; + ret = v4l2_subdev_call(isp->inputs[isp->input_curr].camera, + video, s_parm, parm); mutex_unlock(&isp->input_lock); - return ret; + /* + * why do we think the return value -ENOIOCTLCMD is ok? + * that's because some sensor drivers may don't need s_parm + * to set their run_mode and so have no the s_parm interface. + */ + if (ret && ret != -ENOIOCTLCMD) { + v4l2_err(&atomisp_dev, + "failed to s_parm for sensor\n"); + return ret; + } + return 0; } static int atomisp_s_parm_file(struct file *file, void *fh, diff --git a/drivers/media/video/mt9e013.c b/drivers/media/video/mt9e013.c index 2665302..da1d8ee 100644 --- a/drivers/media/video/mt9e013.c +++ b/drivers/media/video/mt9e013.c @@ -73,6 +73,7 @@ static struct mt9e013_resolution mt9e013_res_preview[] = { .width = 820 , .height = 616 , .fps = 30 , + .low_fps = 15 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1020, /* consistent with regs arrays */ .lines_per_frame = 0x060E, /* consistent with regs arrays */ @@ -86,6 +87,7 @@ static struct mt9e013_resolution mt9e013_res_preview[] = { .width = 1640 , .height = 956 , .fps = 30 , + .low_fps = 15 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1020, /* consistent with regs arrays */ .lines_per_frame = 0x060E, /* consistent with regs arrays */ @@ -105,6 +107,7 @@ static struct mt9e013_resolution mt9e013_res_still[] = { .width = 1640 , .height = 1232 , .fps = 15 , + .low_fps = 3 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1020, /* consistent with regs arrays */ .lines_per_frame = 0x0C1C, /* consistent with regs arrays */ @@ -118,6 +121,7 @@ static struct mt9e013_resolution mt9e013_res_still[] = { .width = 3280 , .height = 1848 , .fps = 15 , + .low_fps = 3 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1258, /* consistent with regs arrays */ .lines_per_frame = 0x0AA4, /* consistent with regs arrays */ @@ -131,6 +135,7 @@ static struct mt9e013_resolution mt9e013_res_still[] = { .width = 3280 , .height = 2464 , .fps = 15 , + .low_fps = 3 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1258, /* consistent with regs arrays */ .lines_per_frame = 0x0AA4, /* consistent with regs arrays */ @@ -149,6 +154,7 @@ static struct mt9e013_resolution mt9e013_res_video[] = { .width = 216 , .height = 176 , .fps = 30 , + .low_fps = 15 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1020, /* consistent with regs arrays */ .lines_per_frame = 0x060E, /* consistent with regs arrays */ @@ -162,6 +168,7 @@ static struct mt9e013_resolution mt9e013_res_video[] = { .width = 408 , .height = 308 , .fps = 30 , + .low_fps = 15 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1020, /* consistent with regs arrays */ .lines_per_frame = 0x060E, /* consistent with regs arrays */ @@ -175,6 +182,7 @@ static struct mt9e013_resolution mt9e013_res_video[] = { .width = 820 , .height = 616 , .fps = 30 , + .low_fps = 15 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1020, /* consistent with regs arrays */ .lines_per_frame = 0x060E, /* consistent with regs arrays */ @@ -188,6 +196,7 @@ static struct mt9e013_resolution mt9e013_res_video[] = { .width = 1640 , .height = 1024 , .fps = 30 , + .low_fps = 15 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1020, /* consistent with regs arrays */ .lines_per_frame = 0x060E, /* consistent with regs arrays */ @@ -201,6 +210,7 @@ static struct mt9e013_resolution mt9e013_res_video[] = { .width = 1568 , .height = 880 , .fps = 30 , + .low_fps = 15 , /* fps when pixel clock is 96MHZ */ .used = 0 , .pixels_per_line = 0x1020, /* consistent with regs arrays */ .lines_per_frame = 0x060E, /* consistent with regs arrays */ @@ -214,6 +224,7 @@ static struct mt9e013_resolution mt9e013_res_video[] = { .width = 2336, .height = 1308, .fps = 30, + .low_fps = 15 , /* fps when pixel clock is 96MHZ */ .used = 0, .pixels_per_line = 0x113A, /* consistent with regs arrays */ .lines_per_frame = 0x05AB, /* consistent with regs arrays */ @@ -1817,6 +1828,7 @@ static int mt9e013_enum_framesizes(struct v4l2_subdev *sd, static int mt9e013_enum_frameintervals(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival) { + struct mt9e013_device *dev = to_mt9e013_sensor(sd); unsigned int index = fival->index; if (index >= N_RES) @@ -1834,7 +1846,11 @@ static int mt9e013_enum_frameintervals(struct v4l2_subdev *sd, /* fival->width = mt9e013_res[index].width; fival->height = mt9e013_res[index].height; */ fival->discrete.numerator = 1; - fival->discrete.denominator = mt9e013_res[index].fps; + if (dev->platform_data->pixel_rate && + dev->platform_data->pixel_rate() <= 96) + fival->discrete.denominator = mt9e013_res[index].low_fps; + else + fival->discrete.denominator = mt9e013_res[index].fps; return 0; } diff --git a/drivers/media/video/mt9e013.h b/drivers/media/video/mt9e013.h index e596c17..780de85 100644 --- a/drivers/media/video/mt9e013.h +++ b/drivers/media/video/mt9e013.h @@ -258,6 +258,7 @@ struct mt9e013_resolution { int width; int height; int fps; + int low_fps; bool used; unsigned short pixels_per_line; unsigned short lines_per_frame; -- 2.7.4