|
132 | 132 | #define DS5_EXPOSURE_ROI_RIGHT 0x001C |
133 | 133 | #define DS5_MANUAL_LASER_POWER 0x0024 |
134 | 134 | #define DS5_PWM_FREQUENCY 0x0028 |
| 135 | +#define DS5_CAMERA_SYNC_MODE 0x002C |
135 | 136 |
|
136 | 137 | #define DS5_DEPTH_CONFIG_STATUS 0x4800 |
137 | 138 | #define DS5_RGB_CONFIG_STATUS 0x4802 |
@@ -2139,6 +2140,7 @@ static int ds5_hw_set_exposure(struct ds5 *state, u32 base, s32 val) |
2139 | 2140 | #define DS5_CAMERA_CID_ERB (DS5_CAMERA_CID_BASE+13) |
2140 | 2141 | #define DS5_CAMERA_CID_EWB (DS5_CAMERA_CID_BASE+14) |
2141 | 2142 | #define DS5_CAMERA_CID_HWMC (DS5_CAMERA_CID_BASE+15) |
| 2143 | +#define DS5_CAMERA_CID_SYNC_MODE (DS5_CAMERA_CID_BASE+16) |
2142 | 2144 |
|
2143 | 2145 | #define DS5_CAMERA_CID_PWM (DS5_CAMERA_CID_BASE+22) |
2144 | 2146 |
|
@@ -2745,6 +2747,15 @@ static int ds5_s_ctrl(struct v4l2_ctrl *ctrl) |
2745 | 2747 | __func__); |
2746 | 2748 | ret = ds5_hw_reset_with_recovery(state); |
2747 | 2749 | 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; |
2748 | 2759 | case DS5_CAMERA_CID_PWM: |
2749 | 2760 | if (state->is_depth) |
2750 | 2761 | ret = ds5_write(state, base | DS5_PWM_FREQUENCY, ctrl->val); |
@@ -3085,6 +3096,10 @@ static int ds5_g_volatile_ctrl(struct v4l2_ctrl *ctrl) |
3085 | 3096 | data[bufLen - 1] = 0; |
3086 | 3097 | } |
3087 | 3098 | 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; |
3088 | 3103 | case DS5_CAMERA_CID_PWM: |
3089 | 3104 | if (state->is_depth) |
3090 | 3105 | 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 = { |
3336 | 3351 | .flags = V4L2_CTRL_FLAG_EXECUTE_ON_WRITE, |
3337 | 3352 | }; |
3338 | 3353 |
|
| 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 | + |
3339 | 3366 | static const struct v4l2_ctrl_config ds5_ctrl_pwm = { |
3340 | 3367 | .ops = &ds5_ctrl_ops, |
3341 | 3368 | .id = DS5_CAMERA_CID_PWM, |
@@ -4086,8 +4113,10 @@ static int ds5_ctrl_init(struct ds5 *state, int sid) |
4086 | 4113 | v4l2_ctrl_new_custom(hdl, &ds5_ctrl_hw_reset, sensor); |
4087 | 4114 | } |
4088 | 4115 | // DEPTH custom |
4089 | | - if (sid == DEPTH_SID) |
| 4116 | + if (sid == DEPTH_SID) { |
| 4117 | + v4l2_ctrl_new_custom(hdl, &ds5_ctrl_sync_mode, sensor); |
4090 | 4118 | v4l2_ctrl_new_custom(hdl, &ds5_ctrl_pwm, sensor); |
| 4119 | + } |
4091 | 4120 | // IMU custom |
4092 | 4121 | if (sid == IMU_SID) |
4093 | 4122 | ctrls->fw_version = v4l2_ctrl_new_custom(hdl, &ds5_ctrl_fw_version, sensor); |
|
0 commit comments