Commit 33039a88 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: ccs: Add shading correction and luminance correction level controls

Add controls for supporting lens shading correction, including colour
shading and luminance correction level.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 7c0ed600
......@@ -756,6 +756,19 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_TEST_PATTERN_GREENB:
rval = ccs_write(sensor, TEST_DATA_GREENB, ctrl->val);
break;
case V4L2_CID_CCS_SHADING_CORRECTION:
rval = ccs_write(sensor, SHADING_CORRECTION_EN,
ctrl->val ? CCS_SHADING_CORRECTION_EN_ENABLE :
0);
if (!rval && sensor->luminance_level)
v4l2_ctrl_activate(sensor->luminance_level, ctrl->val);
break;
case V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL:
rval = ccs_write(sensor, LUMINANCE_CORRECTION_LEVEL, ctrl->val);
break;
case V4L2_CID_PIXEL_RATE:
/* For v4l2_ctrl_s_ctrl_int64() used internally. */
......@@ -877,6 +890,39 @@ static int ccs_init_controls(struct ccs_sensor *sensor)
}
}
if (CCS_LIM(sensor, SHADING_CORRECTION_CAPABILITY) &
(CCS_SHADING_CORRECTION_CAPABILITY_COLOR_SHADING |
CCS_SHADING_CORRECTION_CAPABILITY_LUMINANCE_CORRECTION)) {
const struct v4l2_ctrl_config ctrl_cfg = {
.name = "Shading Correction",
.type = V4L2_CTRL_TYPE_BOOLEAN,
.id = V4L2_CID_CCS_SHADING_CORRECTION,
.ops = &ccs_ctrl_ops,
.max = 1,
.step = 1,
};
v4l2_ctrl_new_custom(&sensor->pixel_array->ctrl_handler,
&ctrl_cfg, NULL);
}
if (CCS_LIM(sensor, SHADING_CORRECTION_CAPABILITY) &
CCS_SHADING_CORRECTION_CAPABILITY_LUMINANCE_CORRECTION) {
const struct v4l2_ctrl_config ctrl_cfg = {
.name = "Luminance Correction Level",
.type = V4L2_CTRL_TYPE_BOOLEAN,
.id = V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL,
.ops = &ccs_ctrl_ops,
.max = 255,
.step = 1,
.def = 128,
};
sensor->luminance_level =
v4l2_ctrl_new_custom(&sensor->pixel_array->ctrl_handler,
&ctrl_cfg, NULL);
}
if (CCS_LIM(sensor, DIGITAL_GAIN_CAPABILITY) ==
CCS_DIGITAL_GAIN_CAPABILITY_GLOBAL ||
CCS_LIM(sensor, DIGITAL_GAIN_CAPABILITY) ==
......
......@@ -268,6 +268,7 @@ struct ccs_sensor {
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *pixel_rate_parray;
struct v4l2_ctrl *luminance_level;
/* src controls */
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *pixel_rate_csi;
......
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