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

media: ccs: Add support for old-style SMIA digital gain

SMIA only has per-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 7eb5a7e1
......@@ -673,7 +673,34 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
break;
case V4L2_CID_DIGITAL_GAIN:
rval = ccs_write(sensor, DIGITAL_GAIN_GLOBAL, ctrl->val);
if (CCS_LIM(sensor, DIGITAL_GAIN_CAPABILITY) ==
CCS_DIGITAL_GAIN_CAPABILITY_GLOBAL) {
rval = ccs_write(sensor, DIGITAL_GAIN_GLOBAL,
ctrl->val);
break;
}
rval = ccs_write_addr(sensor,
SMIAPP_REG_U16_DIGITAL_GAIN_GREENR,
ctrl->val);
if (rval)
break;
rval = ccs_write_addr(sensor,
SMIAPP_REG_U16_DIGITAL_GAIN_RED,
ctrl->val);
if (rval)
break;
rval = ccs_write_addr(sensor,
SMIAPP_REG_U16_DIGITAL_GAIN_BLUE,
ctrl->val);
if (rval)
break;
rval = ccs_write_addr(sensor,
SMIAPP_REG_U16_DIGITAL_GAIN_GREENB,
ctrl->val);
break;
case V4L2_CID_EXPOSURE:
......@@ -759,7 +786,9 @@ static int ccs_init_controls(struct ccs_sensor *sensor)
CCS_LIM(sensor, ANALOG_GAIN_CODE_MIN));
if (CCS_LIM(sensor, DIGITAL_GAIN_CAPABILITY) ==
CCS_DIGITAL_GAIN_CAPABILITY_GLOBAL)
CCS_DIGITAL_GAIN_CAPABILITY_GLOBAL ||
CCS_LIM(sensor, DIGITAL_GAIN_CAPABILITY) ==
SMIAPP_DIGITAL_GAIN_CAPABILITY_PER_CHANNEL)
v4l2_ctrl_new_std(&sensor->pixel_array->ctrl_handler,
&ccs_ctrl_ops, V4L2_CID_DIGITAL_GAIN,
CCS_LIM(sensor, DIGITAL_GAIN_MIN),
......
......@@ -535,6 +535,8 @@
#define SMIAPP_DIGITAL_CROP_CAPABILITY_NONE 0
#define SMIAPP_DIGITAL_CROP_CAPABILITY_INPUT_CROP 1
#define SMIAPP_DIGITAL_GAIN_CAPABILITY_PER_CHANNEL 1
#define SMIAPP_BINNING_CAPABILITY_NO 0
#define SMIAPP_BINNING_CAPABILITY_YES 1
......
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