提交 2b899025 编写于 作者: D Dave Stevenson 提交者: Zheng Zengkai

media: i2c: ov9281: add enum_frame_interval function for iq tool 2.2 and hal3

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

Adds the ov9281 parts of the Rockchip patch adding enum_frame_interval to
a large number of drivers.

Change-Id: I03344cd6cf278dd7c18fce8e97479089ef185a5c
Signed-off-by: NZefa Chen <zefa.chen@rock-chips.com>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 e44fe588
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* *
* Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd. * Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd.
* V0.0X01.0X02 fix mclk issue when probe multiple camera. * V0.0X01.0X02 fix mclk issue when probe multiple camera.
* V0.0X01.0X03 add enum_frame_interval function.
*/ */
#include <linux/clk.h> #include <linux/clk.h>
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
#include <media/v4l2-subdev.h> #include <media/v4l2-subdev.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x2) #define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x3)
#ifndef V4L2_CID_DIGITAL_GAIN #ifndef V4L2_CID_DIGITAL_GAIN
#define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN #define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN
...@@ -92,7 +93,7 @@ struct regval { ...@@ -92,7 +93,7 @@ struct regval {
struct ov9281_mode { struct ov9281_mode {
u32 width; u32 width;
u32 height; u32 height;
u32 max_fps; struct v4l2_fract max_fps;
u32 hts_def; u32 hts_def;
u32 vts_def; u32 vts_def;
u32 exp_def; u32 exp_def;
...@@ -246,7 +247,10 @@ static const struct ov9281_mode supported_modes[] = { ...@@ -246,7 +247,10 @@ static const struct ov9281_mode supported_modes[] = {
{ {
.width = 1280, .width = 1280,
.height = 800, .height = 800,
.max_fps = 120, .max_fps = {
.numerator = 10000,
.denominator = 1200000,
},
.exp_def = 0x0320, .exp_def = 0x0320,
.hts_def = 0x0b60,//0x2d8*4 .hts_def = 0x0b60,//0x2d8*4
.vts_def = 0x038e, .vts_def = 0x038e,
...@@ -483,8 +487,7 @@ static int OV9281_g_frame_interval(struct v4l2_subdev *sd, ...@@ -483,8 +487,7 @@ static int OV9281_g_frame_interval(struct v4l2_subdev *sd,
const struct ov9281_mode *mode = ov9281->cur_mode; const struct ov9281_mode *mode = ov9281->cur_mode;
mutex_lock(&ov9281->mutex); mutex_lock(&ov9281->mutex);
fi->interval.numerator = 10000; fi->interval = mode->max_fps;
fi->interval.denominator = mode->max_fps * 10000;
mutex_unlock(&ov9281->mutex); mutex_unlock(&ov9281->mutex);
return 0; return 0;
...@@ -778,6 +781,23 @@ static int ov9281_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ...@@ -778,6 +781,23 @@ static int ov9281_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
} }
#endif #endif
static int
ov9281_enum_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_frame_interval_enum *fie)
{
if (fie->index >= ARRAY_SIZE(supported_modes))
return -EINVAL;
if (fie->code != MEDIA_BUS_FMT_Y10_1X10)
return -EINVAL;
fie->width = supported_modes[fie->index].width;
fie->height = supported_modes[fie->index].height;
fie->interval = supported_modes[fie->index].max_fps;
return 0;
}
static const struct dev_pm_ops ov9281_pm_ops = { static const struct dev_pm_ops ov9281_pm_ops = {
SET_RUNTIME_PM_OPS(ov9281_runtime_suspend, SET_RUNTIME_PM_OPS(ov9281_runtime_suspend,
ov9281_runtime_resume, NULL) ov9281_runtime_resume, NULL)
...@@ -805,6 +825,7 @@ static const struct v4l2_subdev_video_ops ov9281_video_ops = { ...@@ -805,6 +825,7 @@ static const struct v4l2_subdev_video_ops ov9281_video_ops = {
static const struct v4l2_subdev_pad_ops ov9281_pad_ops = { static const struct v4l2_subdev_pad_ops ov9281_pad_ops = {
.enum_mbus_code = ov9281_enum_mbus_code, .enum_mbus_code = ov9281_enum_mbus_code,
.enum_frame_size = ov9281_enum_frame_sizes, .enum_frame_size = ov9281_enum_frame_sizes,
.enum_frame_interval = ov9281_enum_frame_interval,
.get_fmt = ov9281_get_fmt, .get_fmt = ov9281_get_fmt,
.set_fmt = ov9281_set_fmt, .set_fmt = ov9281_set_fmt,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册