Skip to content

Commit 09c69c4

Browse files
committed
Adding XU control for camera sync command
1 parent e22dab3 commit 09c69c4

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
@@ -2139,6 +2140,7 @@ static int ds5_hw_set_exposure(struct ds5 *state, u32 base, s32 val)
21392140
#define DS5_CAMERA_CID_ERB (DS5_CAMERA_CID_BASE+13)
21402141
#define DS5_CAMERA_CID_EWB (DS5_CAMERA_CID_BASE+14)
21412142
#define DS5_CAMERA_CID_HWMC (DS5_CAMERA_CID_BASE+15)
2143+
#define DS5_CAMERA_CID_SYNC_MODE (DS5_CAMERA_CID_BASE+16)
21422144

21432145
#define DS5_CAMERA_CID_PWM (DS5_CAMERA_CID_BASE+22)
21442146

@@ -2745,6 +2747,15 @@ static int ds5_s_ctrl(struct v4l2_ctrl *ctrl)
27452747
__func__);
27462748
ret = ds5_hw_reset_with_recovery(state);
27472749
break;
2750+
case DS5_CAMERA_CID_SYNC_MODE:
2751+
dev_info(&state->client->dev, "%s(): XU SYNC_MODE control received, value: %d\n",
2752+
__func__, ctrl->val);
2753+
if (state->is_depth) {
2754+
ret = ds5_write(state, base | DS5_CAMERA_SYNC_MODE, ctrl->val);
2755+
dev_info(&state->client->dev, "%s(): SYNC_MODE command passed to FW, addr: 0x%x, value: %d, ret: %d\n",
2756+
__func__, base | DS5_CAMERA_SYNC_MODE, ctrl->val, ret);
2757+
}
2758+
break;
27482759
case DS5_CAMERA_CID_PWM:
27492760
if (state->is_depth)
27502761
ret = ds5_write(state, base | DS5_PWM_FREQUENCY, ctrl->val);
@@ -3085,6 +3096,10 @@ static int ds5_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
30853096
data[bufLen - 1] = 0;
30863097
}
30873098
break;
3099+
case DS5_CAMERA_CID_SYNC_MODE:
3100+
if (state->is_depth)
3101+
ds5_read(state, base | DS5_CAMERA_SYNC_MODE, ctrl->p_new.p_u16);
3102+
break;
30883103
case DS5_CAMERA_CID_PWM:
30893104
if (state->is_depth)
30903105
ds5_read(state, base | DS5_PWM_FREQUENCY, ctrl->p_new.p_u16);
@@ -3336,6 +3351,18 @@ static const struct v4l2_ctrl_config ds5_ctrl_hw_reset = {
33363351
.flags = V4L2_CTRL_FLAG_EXECUTE_ON_WRITE,
33373352
};
33383353

3354+
static const struct v4l2_ctrl_config ds5_ctrl_sync_mode = {
3355+
.ops = &ds5_ctrl_ops,
3356+
.id = DS5_CAMERA_CID_SYNC_MODE,
3357+
.name = "Camera Sync Mode",
3358+
.type = V4L2_CTRL_TYPE_INTEGER,
3359+
.min = 0,
3360+
.max = 4,
3361+
.step = 1,
3362+
.def = 0,
3363+
.flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_EXECUTE_ON_WRITE,
3364+
};
3365+
33393366
static const struct v4l2_ctrl_config ds5_ctrl_pwm = {
33403367
.ops = &ds5_ctrl_ops,
33413368
.id = DS5_CAMERA_CID_PWM,
@@ -4086,8 +4113,10 @@ static int ds5_ctrl_init(struct ds5 *state, int sid)
40864113
v4l2_ctrl_new_custom(hdl, &ds5_ctrl_hw_reset, sensor);
40874114
}
40884115
// DEPTH custom
4089-
if (sid == DEPTH_SID)
4116+
if (sid == DEPTH_SID) {
4117+
v4l2_ctrl_new_custom(hdl, &ds5_ctrl_sync_mode, sensor);
40904118
v4l2_ctrl_new_custom(hdl, &ds5_ctrl_pwm, sensor);
4119+
}
40914120
// IMU custom
40924121
if (sid == IMU_SID)
40934122
ctrls->fw_version = v4l2_ctrl_new_custom(hdl, &ds5_ctrl_fw_version, sensor);

0 commit comments

Comments
 (0)