Commit 7eb5a7e1 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: ccs: Add digital gain support

CCS supports global (all-component) digital gain. Add support for it.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 8fe0267d
...@@ -670,6 +670,11 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl) ...@@ -670,6 +670,11 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_ANALOGUE_GAIN: case V4L2_CID_ANALOGUE_GAIN:
rval = ccs_write(sensor, ANALOG_GAIN_CODE_GLOBAL, ctrl->val); rval = ccs_write(sensor, ANALOG_GAIN_CODE_GLOBAL, ctrl->val);
break;
case V4L2_CID_DIGITAL_GAIN:
rval = ccs_write(sensor, DIGITAL_GAIN_GLOBAL, ctrl->val);
break; break;
case V4L2_CID_EXPOSURE: case V4L2_CID_EXPOSURE:
rval = ccs_write(sensor, COARSE_INTEGRATION_TIME, ctrl->val); rval = ccs_write(sensor, COARSE_INTEGRATION_TIME, ctrl->val);
...@@ -739,7 +744,7 @@ static int ccs_init_controls(struct ccs_sensor *sensor) ...@@ -739,7 +744,7 @@ static int ccs_init_controls(struct ccs_sensor *sensor)
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
int rval; int rval;
rval = v4l2_ctrl_handler_init(&sensor->pixel_array->ctrl_handler, 12); rval = v4l2_ctrl_handler_init(&sensor->pixel_array->ctrl_handler, 13);
if (rval) if (rval)
return rval; return rval;
...@@ -753,6 +758,16 @@ static int ccs_init_controls(struct ccs_sensor *sensor) ...@@ -753,6 +758,16 @@ static int ccs_init_controls(struct ccs_sensor *sensor)
max(CCS_LIM(sensor, ANALOG_GAIN_CODE_STEP), 1U), max(CCS_LIM(sensor, ANALOG_GAIN_CODE_STEP), 1U),
CCS_LIM(sensor, ANALOG_GAIN_CODE_MIN)); CCS_LIM(sensor, ANALOG_GAIN_CODE_MIN));
if (CCS_LIM(sensor, DIGITAL_GAIN_CAPABILITY) ==
CCS_DIGITAL_GAIN_CAPABILITY_GLOBAL)
v4l2_ctrl_new_std(&sensor->pixel_array->ctrl_handler,
&ccs_ctrl_ops, V4L2_CID_DIGITAL_GAIN,
CCS_LIM(sensor, DIGITAL_GAIN_MIN),
CCS_LIM(sensor, DIGITAL_GAIN_MAX),
max(CCS_LIM(sensor, DIGITAL_GAIN_STEP_SIZE),
1U),
0x100);
/* Exposure limits will be updated soon, use just something here. */ /* Exposure limits will be updated soon, use just something here. */
sensor->exposure = v4l2_ctrl_new_std( sensor->exposure = v4l2_ctrl_new_std(
&sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops, &sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops,
......
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