Commit 32979f67 authored by Jacopo Mondi's avatar Jacopo Mondi Committed by Mauro Carvalho Chehab

media: ov5640: Add HBLANK control

Add the HBLANK control as read-only.

The hblank value is fixed in the mode definition and is updated
everytime a new format is applied.
Signed-off-by: default avatarJacopo Mondi <jacopo@jmondi.org>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent e4359019
...@@ -321,6 +321,7 @@ struct ov5640_ctrls { ...@@ -321,6 +321,7 @@ struct ov5640_ctrls {
struct v4l2_ctrl_handler handler; struct v4l2_ctrl_handler handler;
struct v4l2_ctrl *pixel_rate; struct v4l2_ctrl *pixel_rate;
struct v4l2_ctrl *link_freq; struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *hblank;
struct { struct {
struct v4l2_ctrl *auto_exp; struct v4l2_ctrl *auto_exp;
struct v4l2_ctrl *exposure; struct v4l2_ctrl *exposure;
...@@ -2699,6 +2700,8 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor) ...@@ -2699,6 +2700,8 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor)
const struct ov5640_mode_info *mode = sensor->current_mode; const struct ov5640_mode_info *mode = sensor->current_mode;
enum ov5640_pixel_rate_id pixel_rate_id = mode->pixel_rate; enum ov5640_pixel_rate_id pixel_rate_id = mode->pixel_rate;
struct v4l2_mbus_framefmt *fmt = &sensor->fmt; struct v4l2_mbus_framefmt *fmt = &sensor->fmt;
const struct ov5640_timings *timings;
unsigned int hblank;
unsigned int i = 0; unsigned int i = 0;
u32 pixel_rate; u32 pixel_rate;
s64 link_freq; s64 link_freq;
...@@ -2756,6 +2759,11 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor) ...@@ -2756,6 +2759,11 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor)
__v4l2_ctrl_s_ctrl_int64(sensor->ctrls.pixel_rate, pixel_rate); __v4l2_ctrl_s_ctrl_int64(sensor->ctrls.pixel_rate, pixel_rate);
__v4l2_ctrl_s_ctrl(sensor->ctrls.link_freq, i); __v4l2_ctrl_s_ctrl(sensor->ctrls.link_freq, i);
timings = ov5640_timings(sensor, mode);
hblank = timings->htot - mode->width;
__v4l2_ctrl_modify_range(sensor->ctrls.hblank,
hblank, hblank, 1, hblank);
return 0; return 0;
} }
...@@ -3220,6 +3228,8 @@ static int ov5640_init_controls(struct ov5640_dev *sensor) ...@@ -3220,6 +3228,8 @@ static int ov5640_init_controls(struct ov5640_dev *sensor)
const struct v4l2_ctrl_ops *ops = &ov5640_ctrl_ops; const struct v4l2_ctrl_ops *ops = &ov5640_ctrl_ops;
struct ov5640_ctrls *ctrls = &sensor->ctrls; struct ov5640_ctrls *ctrls = &sensor->ctrls;
struct v4l2_ctrl_handler *hdl = &ctrls->handler; struct v4l2_ctrl_handler *hdl = &ctrls->handler;
const struct ov5640_timings *timings;
unsigned int hblank;
int ret; int ret;
v4l2_ctrl_handler_init(hdl, 32); v4l2_ctrl_handler_init(hdl, 32);
...@@ -3239,6 +3249,11 @@ static int ov5640_init_controls(struct ov5640_dev *sensor) ...@@ -3239,6 +3249,11 @@ static int ov5640_init_controls(struct ov5640_dev *sensor)
OV5640_DEFAULT_LINK_FREQ, OV5640_DEFAULT_LINK_FREQ,
ov5640_csi2_link_freqs); ov5640_csi2_link_freqs);
timings = ov5640_timings(sensor, mode);
hblank = timings->htot - mode->width;
ctrls->hblank = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_HBLANK, hblank,
hblank, 1, hblank);
/* Auto/manual white balance */ /* Auto/manual white balance */
ctrls->auto_wb = v4l2_ctrl_new_std(hdl, ops, ctrls->auto_wb = v4l2_ctrl_new_std(hdl, ops,
V4L2_CID_AUTO_WHITE_BALANCE, V4L2_CID_AUTO_WHITE_BALANCE,
...@@ -3288,6 +3303,7 @@ static int ov5640_init_controls(struct ov5640_dev *sensor) ...@@ -3288,6 +3303,7 @@ static int ov5640_init_controls(struct ov5640_dev *sensor)
ctrls->pixel_rate->flags |= V4L2_CTRL_FLAG_READ_ONLY; ctrls->pixel_rate->flags |= V4L2_CTRL_FLAG_READ_ONLY;
ctrls->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; ctrls->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
ctrls->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
ctrls->gain->flags |= V4L2_CTRL_FLAG_VOLATILE; ctrls->gain->flags |= V4L2_CTRL_FLAG_VOLATILE;
ctrls->exposure->flags |= V4L2_CTRL_FLAG_VOLATILE; ctrls->exposure->flags |= V4L2_CTRL_FLAG_VOLATILE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment