diff options
author | Sooman Jeong <sm5.jeong@samsung.com> | 2017-12-13 22:33:57 +0900 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2018-06-15 21:00:01 +0900 |
commit | afcd26a23fee21b2abe07728dc323adf3678ec8e (patch) | |
tree | 45b2daedcb41f04ec670201335aac7087d9df0e3 | |
parent | b4e7d35bad8e74b6799f4a270cb8186d221820c4 (diff) | |
download | linux-artik7-afcd26a23fee21b2abe07728dc323adf3678ec8e.tar.gz linux-artik7-afcd26a23fee21b2abe07728dc323adf3678ec8e.tar.bz2 linux-artik7-afcd26a23fee21b2abe07728dc323adf3678ec8e.zip |
media: ov5640: add s_param callback to set frame rate
This patch adds s_param callback to set frame rate.
Current ov5640 sensor driver supports only two different
frame rate;30fps and 15fps.
Change-Id: I5fbd86bf81c116aec86e54c9b76c6870eb8674af
Signed-off-by: Sooman Jeong <sm5.jeong@samsung.com>
-rw-r--r-- | drivers/media/i2c/ov5640.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 2ad9410edfe6..02c2153d2a12 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -1716,7 +1716,13 @@ static int ov5640_try_frame_interval(struct ov5640_dev *sensor, ret = (fi->denominator == minfps) ? OV5640_15_FPS : OV5640_30_FPS; mode = ov5640_find_mode(sensor, ret, width, height, false); - return mode ? ret : -EINVAL; + + if (mode) { + sensor->current_mode = mode; + return ret; + } else { + return -EINVAL; + } } static int ov5640_get_fmt(struct v4l2_subdev *sd, @@ -2282,6 +2288,35 @@ out: return ret; } +static int ov5640_s_param(struct v4l2_subdev *sd, + struct v4l2_streamparm *param) +{ + struct ov5640_dev *sensor = to_ov5640_dev(sd); + int ret = 0; + struct v4l2_captureparm *cp; + struct v4l2_subdev_frame_interval fi; + + WARN_ON(!sd); + WARN_ON(!param); + + dev_info(&sensor->i2c_client->dev, "%s\n", __func__); + + cp = ¶m->parm.capture; + fi.interval = cp->timeperframe; + fi.pad = 0; + + if (!fi.interval.numerator) { + dev_err(&sensor->i2c_client->dev, "numerator is 0"); + ret = -EINVAL; + goto p_err; + } + + ov5640_s_frame_interval(sd, &fi); + +p_err: + return ret; +} + static const struct v4l2_subdev_core_ops ov5640_core_ops = { .s_power = ov5640_s_power, }; @@ -2290,6 +2325,7 @@ static const struct v4l2_subdev_video_ops ov5640_video_ops = { .g_frame_interval = ov5640_g_frame_interval, .s_frame_interval = ov5640_s_frame_interval, .s_stream = ov5640_s_stream, + .s_parm = ov5640_s_param, }; static const struct v4l2_subdev_pad_ops ov5640_pad_ops = { |