Commit 4eb3419d authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] m5mols: Add wide dynamic range control

Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 48311db6
...@@ -169,6 +169,7 @@ struct m5mols_version { ...@@ -169,6 +169,7 @@ struct m5mols_version {
* @colorfx: color effect control * @colorfx: color effect control
* @saturation: saturation control * @saturation: saturation control
* @zoom: zoom control * @zoom: zoom control
* @wdr: wide dynamic range control
* @ver: information of the version * @ver: information of the version
* @cap: the capture mode attributes * @cap: the capture mode attributes
* @power: current sensor's power status * @power: current sensor's power status
...@@ -207,6 +208,7 @@ struct m5mols_info { ...@@ -207,6 +208,7 @@ struct m5mols_info {
struct v4l2_ctrl *colorfx; struct v4l2_ctrl *colorfx;
struct v4l2_ctrl *saturation; struct v4l2_ctrl *saturation;
struct v4l2_ctrl *zoom; struct v4l2_ctrl *zoom;
struct v4l2_ctrl *wdr;
struct m5mols_version ver; struct m5mols_version ver;
struct m5mols_capture cap; struct m5mols_capture cap;
......
...@@ -360,6 +360,21 @@ static int m5mols_set_iso(struct m5mols_info *info, int auto_iso) ...@@ -360,6 +360,21 @@ static int m5mols_set_iso(struct m5mols_info *info, int auto_iso)
return m5mols_write(&info->sd, AE_ISO, iso); return m5mols_write(&info->sd, AE_ISO, iso);
} }
static int m5mols_set_wdr(struct m5mols_info *info, int wdr)
{
int ret;
ret = m5mols_write(&info->sd, MON_TONE_CTL, wdr ? 9 : 5);
if (ret < 0)
return ret;
ret = m5mols_set_mode(info, REG_CAPTURE);
if (ret < 0)
return ret;
return m5mols_write(&info->sd, CAPP_WDR_EN, wdr);
}
static int m5mols_g_volatile_ctrl(struct v4l2_ctrl *ctrl) static int m5mols_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
{ {
struct v4l2_subdev *sd = to_sd(ctrl); struct v4l2_subdev *sd = to_sd(ctrl);
...@@ -436,6 +451,10 @@ static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -436,6 +451,10 @@ static int m5mols_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_COLORFX: case V4L2_CID_COLORFX:
ret = m5mols_set_color_effect(info, ctrl->val); ret = m5mols_set_color_effect(info, ctrl->val);
break; break;
case V4L2_CID_WIDE_DYNAMIC_RANGE:
ret = m5mols_set_wdr(info, ctrl->val);
break;
} }
if (ret == 0 && info->mode != last_mode) if (ret == 0 && info->mode != last_mode)
...@@ -513,6 +532,9 @@ int m5mols_init_controls(struct v4l2_subdev *sd) ...@@ -513,6 +532,9 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
info->colorfx = v4l2_ctrl_new_std_menu(&info->handle, &m5mols_ctrl_ops, info->colorfx = v4l2_ctrl_new_std_menu(&info->handle, &m5mols_ctrl_ops,
V4L2_CID_COLORFX, 4, 0, V4L2_COLORFX_NONE); V4L2_CID_COLORFX, 4, 0, V4L2_COLORFX_NONE);
info->wdr = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops,
V4L2_CID_WIDE_DYNAMIC_RANGE, 0, 1, 1, 0);
if (info->handle.error) { if (info->handle.error) {
int ret = info->handle.error; int ret = info->handle.error;
v4l2_err(sd, "Failed to initialize controls: %d\n", ret); v4l2_err(sd, "Failed to initialize controls: %d\n", ret);
......
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