media: i2c: add g_frame_interval function

Change-Id: Iae23985499357d9e544bd94ed779ca4742e49c42
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
This commit is contained in:
Hu Kejun
2018-10-12 15:42:59 +08:00
committed by Tao Huang
parent 1481e8ff9f
commit 83bf424780
4 changed files with 59 additions and 0 deletions

View File

@@ -495,6 +495,19 @@ static int imx219_s_ctrl_test_pattern(struct v4l2_ctrl *ctrl)
return 0;
}
static int imx219_g_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_frame_interval *fi)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct imx219 *priv = to_imx219(client);
const struct imx219_mode *mode = priv->cur_mode;
fi->interval.numerator = 10000;
fi->interval.denominator = mode->max_fps * 10000;
return 0;
}
static int imx219_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct imx219 *priv =
@@ -701,6 +714,7 @@ static int imx219_get_fmt(struct v4l2_subdev *sd,
/* Various V4L2 operations tables */
static struct v4l2_subdev_video_ops imx219_subdev_video_ops = {
.s_stream = imx219_s_stream,
.g_frame_interval = imx219_g_frame_interval,
};
static struct v4l2_subdev_core_ops imx219_subdev_core_ops = {

View File

@@ -865,6 +865,20 @@ static int ov13850_enable_test_pattern(struct ov13850 *ov13850, u32 pattern)
val);
}
static int ov13850_g_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_frame_interval *fi)
{
struct ov13850 *ov13850 = to_ov13850(sd);
const struct ov13850_mode *mode = ov13850->cur_mode;
mutex_lock(&ov13850->mutex);
fi->interval.numerator = 10000;
fi->interval.denominator = mode->max_fps * 10000;
mutex_unlock(&ov13850->mutex);
return 0;
}
static int __ov13850_start_stream(struct ov13850 *ov13850)
{
int ret;
@@ -1062,6 +1076,7 @@ static const struct v4l2_subdev_internal_ops ov13850_internal_ops = {
static const struct v4l2_subdev_video_ops ov13850_video_ops = {
.s_stream = ov13850_s_stream,
.g_frame_interval = ov13850_g_frame_interval,
};
static const struct v4l2_subdev_pad_ops ov13850_pad_ops = {

View File

@@ -621,6 +621,20 @@ static int ov4689_enable_test_pattern(struct ov4689 *ov4689, u32 pattern)
OV4689_REG_VALUE_08BIT, val);
}
static int ov4689_g_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_frame_interval *fi)
{
struct ov4689 *ov4689 = to_ov4689(sd);
const struct ov4689_mode *mode = ov4689->cur_mode;
mutex_lock(&ov4689->mutex);
fi->interval.numerator = 10000;
fi->interval.denominator = mode->max_fps * 10000;
mutex_unlock(&ov4689->mutex);
return 0;
}
static int __ov4689_start_stream(struct ov4689 *ov4689)
{
int ret;
@@ -814,6 +828,7 @@ static const struct v4l2_subdev_internal_ops ov4689_internal_ops = {
static const struct v4l2_subdev_video_ops ov4689_video_ops = {
.s_stream = ov4689_s_stream,
.g_frame_interval = ov4689_g_frame_interval,
};
static const struct v4l2_subdev_pad_ops ov4689_pad_ops = {

View File

@@ -912,6 +912,20 @@ static int ov5695_enable_test_pattern(struct ov5695 *ov5695, u32 pattern)
OV5695_REG_VALUE_08BIT, val);
}
static int ov5695_g_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_frame_interval *fi)
{
struct ov5695 *ov5695 = to_ov5695(sd);
const struct ov5695_mode *mode = ov5695->cur_mode;
mutex_lock(&ov5695->mutex);
fi->interval.numerator = 10000;
fi->interval.denominator = mode->max_fps * 10000;
mutex_unlock(&ov5695->mutex);
return 0;
}
static int __ov5695_start_stream(struct ov5695 *ov5695)
{
int ret;
@@ -1087,6 +1101,7 @@ static const struct v4l2_subdev_internal_ops ov5695_internal_ops = {
static const struct v4l2_subdev_video_ops ov5695_video_ops = {
.s_stream = ov5695_s_stream,
.g_frame_interval = ov5695_g_frame_interval,
};
static const struct v4l2_subdev_pad_ops ov5695_pad_ops = {