Skip to content

Commit 9e0c6a9

Browse files
committed
Adding XU control for camera sync command
1 parent 9b542dc commit 9e0c6a9

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

kernel/realsense/d4xx.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
#define DS5_EXPOSURE_ROI_RIGHT 0x001C
133133
#define DS5_MANUAL_LASER_POWER 0x0024
134134
#define DS5_PWM_FREQUENCY 0x0028
135+
#define DS5_CAMERA_SYNC_MODE 0x002C
135136

136137
#define DS5_DEPTH_CONFIG_STATUS 0x4800
137138
#define DS5_RGB_CONFIG_STATUS 0x4802
@@ -2133,6 +2134,7 @@ static int ds5_hw_set_exposure(struct ds5 *state, u32 base, s32 val)
21332134
#define DS5_CAMERA_CID_ERB (DS5_CAMERA_CID_BASE+13)
21342135
#define DS5_CAMERA_CID_EWB (DS5_CAMERA_CID_BASE+14)
21352136
#define DS5_CAMERA_CID_HWMC (DS5_CAMERA_CID_BASE+15)
2137+
#define DS5_CAMERA_CID_SYNC_MODE (DS5_CAMERA_CID_BASE+16)
21362138

21372139
#define DS5_CAMERA_CID_PWM (DS5_CAMERA_CID_BASE+22)
21382140

@@ -2582,6 +2584,15 @@ static int ds5_s_ctrl(struct v4l2_ctrl *ctrl)
25822584
(struct hwm_cmd *)ctrl->p_new.p_u8);
25832585
}
25842586
break;
2587+
case DS5_CAMERA_CID_SYNC_MODE:
2588+
dev_info(&state->client->dev, "%s(): XU SYNC_MODE control received, value: %d\n",
2589+
__func__, ctrl->val);
2590+
if (state->is_depth) {
2591+
ret = ds5_write(state, base | DS5_CAMERA_SYNC_MODE, ctrl->val);
2592+
dev_info(&state->client->dev, "%s(): SYNC_MODE command passed to FW, addr: 0x%x, value: %d, ret: %d\n",
2593+
__func__, base | DS5_CAMERA_SYNC_MODE, ctrl->val, ret);
2594+
}
2595+
break;
25852596
case DS5_CAMERA_CID_PWM:
25862597
if (state->is_depth)
25872598
ret = ds5_write(state, base | DS5_PWM_FREQUENCY, ctrl->val);
@@ -2922,6 +2933,10 @@ static int ds5_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
29222933
data[bufLen - 1] = 0;
29232934
}
29242935
break;
2936+
case DS5_CAMERA_CID_SYNC_MODE:
2937+
if (state->is_depth)
2938+
ds5_read(state, base | DS5_CAMERA_SYNC_MODE, ctrl->p_new.p_u16);
2939+
break;
29252940
case DS5_CAMERA_CID_PWM:
29262941
if (state->is_depth)
29272942
ds5_read(state, base | DS5_PWM_FREQUENCY, ctrl->p_new.p_u16);
@@ -3161,6 +3176,18 @@ static const struct v4l2_ctrl_config ds5_ctrl_hwmc_rw = {
31613176
.flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_EXECUTE_ON_WRITE,
31623177
};
31633178

3179+
static const struct v4l2_ctrl_config ds5_ctrl_sync_mode = {
3180+
.ops = &ds5_ctrl_ops,
3181+
.id = DS5_CAMERA_CID_SYNC_MODE,
3182+
.name = "Camera Sync Mode",
3183+
.type = V4L2_CTRL_TYPE_INTEGER,
3184+
.min = 0,
3185+
.max = 4,
3186+
.step = 1,
3187+
.def = 0,
3188+
.flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_EXECUTE_ON_WRITE,
3189+
};
3190+
31643191
static const struct v4l2_ctrl_config ds5_ctrl_pwm = {
31653192
.ops = &ds5_ctrl_ops,
31663193
.id = DS5_CAMERA_CID_PWM,
@@ -3910,8 +3937,10 @@ static int ds5_ctrl_init(struct ds5 *state, int sid)
39103937
v4l2_ctrl_new_custom(hdl, &ds5_ctrl_hwmc_rw, sensor);
39113938
}
39123939
// DEPTH custom
3913-
if (sid == DEPTH_SID)
3940+
if (sid == DEPTH_SID) {
3941+
v4l2_ctrl_new_custom(hdl, &ds5_ctrl_sync_mode, sensor);
39143942
v4l2_ctrl_new_custom(hdl, &ds5_ctrl_pwm, sensor);
3943+
}
39153944
// IMU custom
39163945
if (sid == IMU_SID)
39173946
ctrls->fw_version = v4l2_ctrl_new_custom(hdl, &ds5_ctrl_fw_version, sensor);

0 commit comments

Comments
 (0)