|
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 |
@@ -2133,6 +2134,7 @@ static int ds5_hw_set_exposure(struct ds5 *state, u32 base, s32 val) |
2133 | 2134 | #define DS5_CAMERA_CID_ERB (DS5_CAMERA_CID_BASE+13) |
2134 | 2135 | #define DS5_CAMERA_CID_EWB (DS5_CAMERA_CID_BASE+14) |
2135 | 2136 | #define DS5_CAMERA_CID_HWMC (DS5_CAMERA_CID_BASE+15) |
| 2137 | +#define DS5_CAMERA_CID_SYNC_MODE (DS5_CAMERA_CID_BASE+16) |
2136 | 2138 |
|
2137 | 2139 | #define DS5_CAMERA_CID_PWM (DS5_CAMERA_CID_BASE+22) |
2138 | 2140 |
|
@@ -2582,6 +2584,15 @@ static int ds5_s_ctrl(struct v4l2_ctrl *ctrl) |
2582 | 2584 | (struct hwm_cmd *)ctrl->p_new.p_u8); |
2583 | 2585 | } |
2584 | 2586 | 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; |
2585 | 2596 | case DS5_CAMERA_CID_PWM: |
2586 | 2597 | if (state->is_depth) |
2587 | 2598 | ret = ds5_write(state, base | DS5_PWM_FREQUENCY, ctrl->val); |
@@ -2922,6 +2933,10 @@ static int ds5_g_volatile_ctrl(struct v4l2_ctrl *ctrl) |
2922 | 2933 | data[bufLen - 1] = 0; |
2923 | 2934 | } |
2924 | 2935 | 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; |
2925 | 2940 | case DS5_CAMERA_CID_PWM: |
2926 | 2941 | if (state->is_depth) |
2927 | 2942 | 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 = { |
3161 | 3176 | .flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_EXECUTE_ON_WRITE, |
3162 | 3177 | }; |
3163 | 3178 |
|
| 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 | + |
3164 | 3191 | static const struct v4l2_ctrl_config ds5_ctrl_pwm = { |
3165 | 3192 | .ops = &ds5_ctrl_ops, |
3166 | 3193 | .id = DS5_CAMERA_CID_PWM, |
@@ -3910,8 +3937,10 @@ static int ds5_ctrl_init(struct ds5 *state, int sid) |
3910 | 3937 | v4l2_ctrl_new_custom(hdl, &ds5_ctrl_hwmc_rw, sensor); |
3911 | 3938 | } |
3912 | 3939 | // DEPTH custom |
3913 | | - if (sid == DEPTH_SID) |
| 3940 | + if (sid == DEPTH_SID) { |
| 3941 | + v4l2_ctrl_new_custom(hdl, &ds5_ctrl_sync_mode, sensor); |
3914 | 3942 | v4l2_ctrl_new_custom(hdl, &ds5_ctrl_pwm, sensor); |
| 3943 | + } |
3915 | 3944 | // IMU custom |
3916 | 3945 | if (sid == IMU_SID) |
3917 | 3946 | ctrls->fw_version = v4l2_ctrl_new_custom(hdl, &ds5_ctrl_fw_version, sensor); |
|
0 commit comments