clear-pkgs-linux-iot-lts2018/0804-media-ov2775-Update-v4...

472 lines
15 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Meng Wei <wei.meng@intel.com>
Date: Tue, 27 Nov 2018 19:31:50 +0800
Subject: [PATCH] media: ov2775: Update v4l2 ctrl setting
Fix error and update setting in v4l2 ctrls of ov2775 sensor driver
Change-Id: I722b39ed8333ca69a4db9f86637cd2c9c9fae06d
Tracked-On: PKT-1624
Signed-off-by: mingdaxu <mingda.xu@intel.com>
Signed-off-by: Meng Wei <wei.meng@intel.com>
---
.../i2c/crlmodule/crl_ov2775_configuration.h | 242 +++++++++++-------
include/uapi/linux/crlmodule.h | 3 +
2 files changed, 148 insertions(+), 97 deletions(-)
diff --git a/drivers/media/i2c/crlmodule/crl_ov2775_configuration.h b/drivers/media/i2c/crlmodule/crl_ov2775_configuration.h
index cffc0cc..9178913 100644
--- a/drivers/media/i2c/crlmodule/crl_ov2775_configuration.h
+++ b/drivers/media/i2c/crlmodule/crl_ov2775_configuration.h
@@ -7306,6 +7306,13 @@ static struct crl_arithmetic_ops ov2775_ana_gain_vs_ops[] = {
},
};
+static struct crl_arithmetic_ops ov2775_ana_gain_linear_ops[] = {
+ {
+ .op = CRL_BITWISE_LSHIFT,
+ .operand.entity_val = 6,
+ },
+};
+
static struct crl_arithmetic_ops ov2775_digital_gain_ops[] = {
{
.op = CRL_BITWISE_RSHIFT,
@@ -7366,6 +7373,16 @@ static struct crl_dynamic_register_access ov2775_ana_gain_vs_regs[] = {
},
};
+static struct crl_dynamic_register_access ov2775_ana_gain_linear_cg_regs[] = {
+ {
+ .address = 0x30BB,
+ .len = CRL_REG_LEN_08BIT | CRL_REG_READ_AND_UPDATE,
+ .ops_items = ARRAY_SIZE(ov2775_ana_gain_linear_ops),
+ .ops = ov2775_ana_gain_linear_ops,
+ .mask = 0x40,
+ },
+};
+
static struct crl_dynamic_register_access ov2775_digital_gain_h_regs[] = {
{
.address = 0x315A,
@@ -7586,7 +7603,7 @@ static struct crl_mode_rep ov2775_modes[] = {
.width = 1920,
.height = 1088,
.min_llp = 3550,
- .min_fll = 1126,
+ .min_fll = 1096,
.comp_items = 0,
.ctrl_data = 0,
.mode_regs_items =
@@ -7602,7 +7619,7 @@ static struct crl_mode_rep ov2775_modes[] = {
.width = 1920,
.height = 1088,
.min_llp = 3550,
- .min_fll = 1126,
+ .min_fll = 1096,
.comp_items = 0,
.ctrl_data = 0,
.mode_regs_items =
@@ -7618,7 +7635,7 @@ static struct crl_mode_rep ov2775_modes[] = {
.width = 1920,
.height = 1088,
.min_llp = 3550,
- .min_fll = 1126,
+ .min_fll = 1096,
.comp_items = 0,
.ctrl_data = 0,
.mode_regs_items = ARRAY_SIZE(ov2775_2x12_30fps_mipi960_regset),
@@ -7633,7 +7650,7 @@ static struct crl_mode_rep ov2775_modes[] = {
.width = 1920,
.height = 1088,
.min_llp = 3550,
- .min_fll = 1126,
+ .min_fll = 1096,
.comp_items = 0,
.ctrl_data = 0,
.mode_regs_items = ARRAY_SIZE(ov2775_3x12_30fps_mipi960_regset),
@@ -7657,7 +7674,7 @@ static struct crl_sensor_limits ov2775_sensor_limits = {
.y_addr_min = 0,
.x_addr_max = 1936,
.y_addr_max = 1096,
- .min_frame_length_lines = 1126,
+ .min_frame_length_lines = 1096,
.max_frame_length_lines = 65535,
.min_line_length_pixels = 3550,
.max_line_length_pixels = 32752,
@@ -7778,18 +7795,18 @@ static struct crl_v4l2_ctrl ov2775_v4l2_ctrls[] = {
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = CRL_CID_ANALOG_GAIN_S,
- .name = "CRL_CID_ANALOG_GAIN_HCG",
+ .ctrl_id = V4L2_CID_HFLIP,
+ .name = "V4L2_CID_HFLIP",
.type = CRL_V4L2_CTRL_TYPE_INTEGER,
.data.std_data.min = 0,
- .data.std_data.max = 4096,
+ .data.std_data.max = 1,
.data.std_data.step = 1,
- .data.std_data.def = 128,
+ .data.std_data.def = 0,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_ana_gain_h_regs),
- .regs = ov2775_ana_gain_h_regs,
+ .regs_items = ARRAY_SIZE(ov2775_h_flip_regs),
+ .regs = ov2775_h_flip_regs,
.dep_items = 0,
.dep_ctrls = 0,
},
@@ -7797,18 +7814,18 @@ static struct crl_v4l2_ctrl ov2775_v4l2_ctrls[] = {
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = CRL_CID_ANALOG_GAIN_L,
- .name = "CRL_CID_ANALOG_GAIN_LCG",
+ .ctrl_id = V4L2_CID_VFLIP,
+ .name = "V4L2_CID_VFLIP",
.type = CRL_V4L2_CTRL_TYPE_INTEGER,
.data.std_data.min = 0,
- .data.std_data.max = 4096,
+ .data.std_data.max = 1,
.data.std_data.step = 1,
- .data.std_data.def = 128,
+ .data.std_data.def = 0,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_ana_gain_l_regs),
- .regs = ov2775_ana_gain_l_regs,
+ .regs_items = ARRAY_SIZE(ov2775_v_flip_regs),
+ .regs = ov2775_v_flip_regs,
.dep_items = 0,
.dep_ctrls = 0,
},
@@ -7816,171 +7833,199 @@ static struct crl_v4l2_ctrl ov2775_v4l2_ctrls[] = {
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = CRL_CID_ANALOG_GAIN_VS,
- .name = "CRL_CID_ANALOG_GAIN_VS",
- .type = CRL_V4L2_CTRL_TYPE_INTEGER,
- .data.std_data.min = 0,
- .data.std_data.max = 4096,
+ .ctrl_id = V4L2_CID_FRAME_LENGTH_LINES,
+ .name = "Frame Length Lines",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
+ .data.std_data.min = 160,
+ .data.std_data.max = 65535,
.data.std_data.step = 1,
- .data.std_data.def = 128,
- .flags = 0,
+ .data.std_data.def = 1120,
+ .flags = V4L2_CTRL_FLAG_UPDATE,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_ana_gain_vs_regs),
- .regs = ov2775_ana_gain_vs_regs,
+ .regs_items = ARRAY_SIZE(ov2775_vblank_regs),
+ .regs = ov2775_vblank_regs,
.dep_items = 0,
.dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
{
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = CRL_CID_DIGITAL_GAIN_L,
- .name = "CRL_CID_DIGITAL_GAIN_LCG",
- .type = CRL_V4L2_CTRL_TYPE_INTEGER,
+ .ctrl_id = V4L2_CID_LINE_LENGTH_PIXELS,
+ .name = "Line Length Pixels",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
+ .data.std_data.min = 1024,
+ .data.std_data.max = 65520,
+ .data.std_data.step = 1,
+ .data.std_data.def = 3550,
+ .flags = V4L2_CTRL_FLAG_UPDATE,
+ .impact = CRL_IMPACTS_NO_IMPACT,
+ .ctrl = 0,
+ .regs_items = ARRAY_SIZE(ov2775_hblank_regs),
+ .regs = ov2775_hblank_regs,
+ .dep_items = 0,
+ .dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
+ },
+ {
+ .sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
+ .op_type = CRL_V4L2_CTRL_SET_OP,
+ .context = SENSOR_POWERED_ON,
+ .ctrl_id = CRL_CID_ANALOG_GAIN_L,
+ .name = "CRL_CID_ANALOG_GAIN_HCG",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
.data.std_data.min = 0,
- .data.std_data.max = 4096,
+ .data.std_data.max = 0xFF,
.data.std_data.step = 1,
- .data.std_data.def = 128,
+ .data.std_data.def = 0,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_digital_gain_l_regs),
- .regs = ov2775_digital_gain_l_regs,
+ .regs_items = ARRAY_SIZE(ov2775_ana_gain_h_regs),
+ .regs = ov2775_ana_gain_h_regs,
.dep_items = 0,
.dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
{
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = CRL_CID_DIGITAL_GAIN_S,
- .name = "CRL_CID_DIGITAL_GAIN_HCG",
- .type = CRL_V4L2_CTRL_TYPE_INTEGER,
+ .ctrl_id = CRL_CID_ANALOG_GAIN_S,
+ .name = "CRL_CID_ANALOG_GAIN_LCG",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
.data.std_data.min = 0,
- .data.std_data.max = 4096,
+ .data.std_data.max = 0xFF,
.data.std_data.step = 1,
- .data.std_data.def = 128,
+ .data.std_data.def = 0,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_digital_gain_h_regs),
- .regs = ov2775_digital_gain_h_regs,
+ .regs_items = ARRAY_SIZE(ov2775_ana_gain_l_regs),
+ .regs = ov2775_ana_gain_l_regs,
.dep_items = 0,
.dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
{
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = CRL_CID_DIGITAL_GAIN_VS,
- .name = "CRL_CID_DIGITAL_GAIN_VS",
- .type = CRL_V4L2_CTRL_TYPE_INTEGER,
+ .ctrl_id = CRL_CID_ANALOG_GAIN_VS,
+ .name = "CRL_CID_ANALOG_GAIN_VS",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
.data.std_data.min = 0,
- .data.std_data.max = 4096,
+ .data.std_data.max = 0xFF,
.data.std_data.step = 1,
- .data.std_data.def = 128,
+ .data.std_data.def = 0,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_digital_gain_vs_regs),
- .regs = ov2775_digital_gain_vs_regs,
+ .regs_items = ARRAY_SIZE(ov2775_ana_gain_vs_regs),
+ .regs = ov2775_ana_gain_vs_regs,
.dep_items = 0,
.dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
{
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = CRL_CID_EXPOSURE_SHS1,
- .name = "CRL_CID_EXPOSURE_DCG",
- .type = CRL_V4L2_CTRL_TYPE_INTEGER,
- .data.std_data.min = 1,
- .data.std_data.max = 65500,
+ .ctrl_id = CRL_CID_ANALOG_LINEAR_CG,
+ .name = "CRL_CID_ANALOG_LINEAR_CG",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
+ .data.std_data.min = 0,
+ .data.std_data.max = 0xFF,
.data.std_data.step = 1,
.data.std_data.def = 0,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_exposure_dcg_regs),
- .regs = ov2775_exposure_dcg_regs,
- .dep_items = 0, /* FLL is changes automatically */
+ .regs_items = ARRAY_SIZE(ov2775_ana_gain_linear_cg_regs),
+ .regs = ov2775_ana_gain_linear_cg_regs,
+ .dep_items = 0,
.dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
{
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = CRL_CID_EXPOSURE_SHS2,
- .name = "CRL_CID_EXPOSURE_VS",
- .type = CRL_V4L2_CTRL_TYPE_INTEGER,
+ .ctrl_id = CRL_CID_DIGITAL_GAIN_L,
+ .name = "CRL_CID_DIGITAL_GAIN_HCG",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
.data.std_data.min = 1,
- .data.std_data.max = 65500,
+ .data.std_data.max = 0xFFFF,
.data.std_data.step = 1,
- .data.std_data.def = 0,
+ .data.std_data.def = 0x100,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_exposure_vs_regs),
- .regs = ov2775_exposure_vs_regs,
- .dep_items = 0, /* FLL is changes automatically */
+ .regs_items = ARRAY_SIZE(ov2775_digital_gain_h_regs),
+ .regs = ov2775_digital_gain_h_regs,
+ .dep_items = 0,
.dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
{
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = V4L2_CID_HFLIP,
- .name = "V4L2_CID_HFLIP",
- .type = CRL_V4L2_CTRL_TYPE_INTEGER,
- .data.std_data.min = 0,
- .data.std_data.max = 1,
+ .ctrl_id = CRL_CID_DIGITAL_GAIN_S,
+ .name = "CRL_CID_DIGITAL_GAIN_LCG",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
+ .data.std_data.min = 1,
+ .data.std_data.max = 0xFFFF,
.data.std_data.step = 1,
- .data.std_data.def = 0,
+ .data.std_data.def = 0x100,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_h_flip_regs),
- .regs = ov2775_h_flip_regs,
+ .regs_items = ARRAY_SIZE(ov2775_digital_gain_l_regs),
+ .regs = ov2775_digital_gain_l_regs,
.dep_items = 0,
.dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
{
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = V4L2_CID_VFLIP,
- .name = "V4L2_CID_VFLIP",
- .type = CRL_V4L2_CTRL_TYPE_INTEGER,
- .data.std_data.min = 0,
- .data.std_data.max = 1,
+ .ctrl_id = CRL_CID_DIGITAL_GAIN_VS,
+ .name = "CRL_CID_DIGITAL_GAIN_VS",
+ .type = CRL_V4L2_CTRL_TYPE_CUSTOM,
+ .data.std_data.min = 1,
+ .data.std_data.max = 0xFFFF,
.data.std_data.step = 1,
- .data.std_data.def = 0,
+ .data.std_data.def = 0x100,
.flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_v_flip_regs),
- .regs = ov2775_v_flip_regs,
+ .regs_items = ARRAY_SIZE(ov2775_digital_gain_vs_regs),
+ .regs = ov2775_digital_gain_vs_regs,
.dep_items = 0,
.dep_ctrls = 0,
+ .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
{
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = V4L2_CID_FRAME_LENGTH_LINES,
- .name = "Frame Length Lines",
+ .ctrl_id = CRL_CID_EXPOSURE_SHS1,
+ .name = "CRL_CID_EXPOSURE_DCG",
.type = CRL_V4L2_CTRL_TYPE_CUSTOM,
- .data.std_data.min = 160,
- .data.std_data.max = 65535,
+ .data.std_data.min = 1,
+ .data.std_data.max = 0xFFFF,
.data.std_data.step = 1,
- .data.std_data.def = 1126,
- .flags = V4L2_CTRL_FLAG_UPDATE,
+ .data.std_data.def = 0x10,
+ .flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_vblank_regs),
- .regs = ov2775_vblank_regs,
- .dep_items = 0,
+ .regs_items = ARRAY_SIZE(ov2775_exposure_dcg_regs),
+ .regs = ov2775_exposure_dcg_regs,
+ .dep_items = 0, /* FLL is changes automatically */
.dep_ctrls = 0,
.v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
@@ -7988,19 +8033,19 @@ static struct crl_v4l2_ctrl ov2775_v4l2_ctrls[] = {
.sd_type = CRL_SUBDEV_TYPE_PIXEL_ARRAY,
.op_type = CRL_V4L2_CTRL_SET_OP,
.context = SENSOR_POWERED_ON,
- .ctrl_id = V4L2_CID_LINE_LENGTH_PIXELS,
- .name = "Line Length Pixels",
+ .ctrl_id = CRL_CID_EXPOSURE_SHS2,
+ .name = "CRL_CID_EXPOSURE_VS",
.type = CRL_V4L2_CTRL_TYPE_CUSTOM,
- .data.std_data.min = 1024,
- .data.std_data.max = 65520,
+ .data.std_data.min = 1,
+ .data.std_data.max = 0xFFFF,
.data.std_data.step = 1,
- .data.std_data.def = 3550,
- .flags = V4L2_CTRL_FLAG_UPDATE,
+ .data.std_data.def = 0x02,
+ .flags = 0,
.impact = CRL_IMPACTS_NO_IMPACT,
.ctrl = 0,
- .regs_items = ARRAY_SIZE(ov2775_hblank_regs),
- .regs = ov2775_hblank_regs,
- .dep_items = 0,
+ .regs_items = ARRAY_SIZE(ov2775_exposure_vs_regs),
+ .regs = ov2775_exposure_vs_regs,
+ .dep_items = 0, /* FLL is changes automatically */
.dep_ctrls = 0,
.v4l2_type = V4L2_CTRL_TYPE_INTEGER,
},
@@ -8129,6 +8174,9 @@ static struct crl_sensor_configuration ov2775_crl_configuration = {
.power_items = ARRAY_SIZE(ov2775_power_items),
.power_entities = ov2775_power_items,
+ .onetime_init_regs_items = 0,
+ .onetime_init_regs = 0,
+
.powerup_regs_items = ARRAY_SIZE(ov2775_powerup_standby_regset),
.powerup_regs = ov2775_powerup_standby_regset,
diff --git a/include/uapi/linux/crlmodule.h b/include/uapi/linux/crlmodule.h
index 8bcb8c9..f13d278 100644
--- a/include/uapi/linux/crlmodule.h
+++ b/include/uapi/linux/crlmodule.h
@@ -73,4 +73,7 @@ struct crl_registers_info {
/* Set HDR mode exposure ratio */
#define CRL_CID_EXPOSURE_HDR_RATIO (V4L2_CID_CRLMODULE_BASE + 24)
+/* choose hcg/lcg for linear analog */
+#define CRL_CID_ANALOG_LINEAR_CG (V4L2_CID_CRLMODULE_BASE + 25)
+
#endif /* UAPI_LINUX_CRLMODULE_H */
--
2.21.0