Skip to content

Commit cbe167d

Browse files
authored
PR #188 from dmipx: d4xx: imu support for 32bit data.
2 parents 9b0604b + 029010a commit cbe167d

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

kernel/realsense/d4xx.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,16 @@ static const struct ds5_resolution ds5_size_imu[] = {
863863
},
864864
};
865865

866+
// 32 bit IMU introduced with IMU sensitivity attribute Firmware
867+
static const struct ds5_resolution ds5_size_imu_extended[] = {
868+
{
869+
.width = 38,
870+
.height = 1,
871+
.framerates = ds5_imu_framerates,
872+
.n_framerates = ARRAY_SIZE(ds5_imu_framerates),
873+
},
874+
};
875+
866876
static const struct ds5_format ds5_depth_formats_d43x[] = {
867877
{
868878
// TODO: 0x31 is replaced with 0x1e since it caused low FPS in Jetson.
@@ -959,6 +969,16 @@ static const struct ds5_format ds5_imu_formats[] = {
959969
},
960970
};
961971

972+
static const struct ds5_format ds5_imu_formats_extended[] = {
973+
{
974+
/* First format: default */
975+
.data_type = GMSL_CSI_DT_RAW_8, /* IMU DT */
976+
.mbus_code = MEDIA_BUS_FMT_Y8_1X8,
977+
.n_resolutions = ARRAY_SIZE(ds5_size_imu_extended),
978+
.resolutions = ds5_size_imu_extended,
979+
},
980+
};
981+
962982
static const struct v4l2_mbus_framefmt ds5_mbus_framefmt_template = {
963983
.width = 0,
964984
.height = 0,
@@ -4594,7 +4614,15 @@ static int ds5_fixed_configuration(struct i2c_client *client, struct ds5 *state)
45944614
sensor->mux_pad = DS5_MUX_PAD_RGB;
45954615

45964616
sensor = &state->imu.sensor;
4597-
sensor->formats = ds5_imu_formats;
4617+
4618+
/* For fimware version starting from: 5.16,
4619+
IMU will have 32bit axis values.
4620+
5.16.x.y = firmware version: 0x0510 */
4621+
if (state->fw_version >= 0x510)
4622+
sensor->formats = ds5_imu_formats_extended;
4623+
else
4624+
sensor->formats = ds5_imu_formats;
4625+
45984626
sensor->n_formats = 1;
45994627
sensor->mux_pad = DS5_MUX_PAD_IMU;
46004628

0 commit comments

Comments
 (0)