Skip to content

Commit a613224

Browse files
committed
Refactor: define DS5_IMU_PIPE/VC/DT constants, eliminate duplication
The IMU pipe configuration (pipe_id=3, vc_id=3, DT1=YUV422_8, DT2=EMBED) was hardcoded in two places: - ds5_configure() (stream-start path) - Step 11 of ds5_hw_reset_with_recovery() (post-reset pipe restore) Define DS5_IMU_PIPE_ID, DS5_IMU_VC_ID, DS5_IMU_DT1, DS5_IMU_DT2 constants near the GMSL CSI DT defines and use them in both locations. If the IMU pipe parameters ever change, only one place needs updating.
1 parent 9cd345a commit a613224

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

kernel/realsense/d4xx.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ struct dser_interface {
7575
#define GMSL_CSI_DT_EMBED 0x12
7676
#endif
7777

78+
/* IMU pipe defaults — used by ds5_configure() and post-reset pipe restoration.
79+
* The D457 FW configures pipes 0-2 (Depth/RGB/IR) but NOT pipe 3 (IMU).
80+
* The driver must configure pipe 3 explicitly with these values.
81+
*/
82+
#define DS5_IMU_PIPE_ID 3
83+
#define DS5_IMU_VC_ID 3
84+
#define DS5_IMU_DT1 GMSL_CSI_DT_YUV422_8
85+
#define DS5_IMU_DT2 GMSL_CSI_DT_EMBED
86+
7887
//#define DS5_DRIVER_NAME "DS5 RealSense camera driver"
7988
#define DS5_DRIVER_NAME "d4xx"
8089
#define DS5_DRIVER_NAME_AWG "d4xx-awg"
@@ -1829,7 +1838,7 @@ static int ds5_configure(struct ds5 *state)
18291838
fps_addr = DS5_IMU_FPS;
18301839
width_addr = DS5_IMU_RES_WIDTH;
18311840
height_addr = DS5_IMU_RES_HEIGHT;
1832-
vc_id = 3;
1841+
vc_id = DS5_IMU_VC_ID;
18331842
} else {
18341843
return -EINVAL;
18351844
}
@@ -3136,10 +3145,10 @@ static int ds5_hw_reset_with_recovery(struct ds5 *state)
31363145
}
31373146

31383147
pipe3_ret = ds5_setup_pipeline(state,
3139-
GMSL_CSI_DT_YUV422_8,
3140-
GMSL_CSI_DT_EMBED,
3141-
3, /* pipe_id = 3 (IMU) */
3142-
3 /* vc_id = 3 */);
3148+
DS5_IMU_DT1,
3149+
DS5_IMU_DT2,
3150+
DS5_IMU_PIPE_ID,
3151+
DS5_IMU_VC_ID);
31433152
if (pipe3_ret)
31443153
dev_warn(&state->client->dev,
31453154
"%s(): post-reset pipe 3 (IMU) setup failed: %d\n",

0 commit comments

Comments
 (0)