Skip to content
134 changes: 133 additions & 1 deletion kernel/realsense/d4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#define DS5_FW_VERSION 0x030C
#define DS5_FW_BUILD 0x030E
#define DS5_DEVICE_TYPE 0x0310
#define DS5_DEVICE_TYPE_D40X 8
#define DS5_DEVICE_TYPE_D41X 7
#define DS5_DEVICE_TYPE_D45X 6
#define DS5_DEVICE_TYPE_D43X 5
Expand Down Expand Up @@ -675,6 +676,45 @@ static const u16 ds5_framerate_100[] = {100};
static const u16 ds5_framerate_90[] = {90};
static const u16 ds5_imu_framerates[] = {50, 100, 200, 400};

static const struct ds5_resolution d40x_depth_sizes[] = {
{
.width = 1280,
.height = 720,
.framerates = ds5_depth_framerate_to_30,
.n_framerates = ARRAY_SIZE(ds5_depth_framerate_to_30),
}, {
.width = 848,
.height = 480,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 640,
.height = 480,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 640,
.height = 360,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 480,
.height = 270,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 424,
.height = 240,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 256,
.height = 144,
.framerates = ds5_framerate_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_90),
},
};

static const struct ds5_resolution d41x_depth_sizes[] = {
{
.width = 1280,
Expand Down Expand Up @@ -811,6 +851,40 @@ static const struct ds5_resolution y8_sizes[] = {
}
};

static const struct ds5_resolution y8_40x_sizes[] = {
{
.width = 1280,
.height = 720,
.framerates = ds5_depth_framerate_to_30,
.n_framerates = ARRAY_SIZE(ds5_depth_framerate_to_30),
}, {
.width = 848,
.height = 480,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 640,
.height = 480,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 640,
.height = 360,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 480,
.height = 270,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
}, {
.width = 424,
.height = 240,
.framerates = ds5_framerate_to_90,
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
},
};

static const struct ds5_resolution y8_41x_sizes[] = {
{
.width = 1920,
Expand Down Expand Up @@ -984,6 +1058,15 @@ static const struct ds5_resolution ds5_size_w10 = {
.n_framerates = 1,
};

static const struct ds5_resolution d40x_calibration_sizes[] = {
{
.width = 1288,
.height = 808,
.framerates = ds5_framerate_15_25,
.n_framerates = ARRAY_SIZE(ds5_framerate_15_25),
},
};

static const struct ds5_resolution d41x_calibration_sizes[] = {
{
.width = 1920,
Expand Down Expand Up @@ -1039,6 +1122,26 @@ static const struct ds5_resolution ds5_size_imu_extended[] = {
},
};

static const struct ds5_format ds5_depth_formats_d40x[] = {
{
// TODO: 0x31 is replaced with 0x1e since it caused low FPS in Jetson.
.data_type = GMSL_CSI_DT_YUV422_8, /* Z16 */
.mbus_code = MEDIA_BUS_FMT_UYVY8_1X16,
.n_resolutions = ARRAY_SIZE(d40x_depth_sizes),
.resolutions = d40x_depth_sizes,
}, {
.data_type = GMSL_CSI_DT_RAW_8, /* Y8 */
.mbus_code = MEDIA_BUS_FMT_Y8_1X8,
.n_resolutions = ARRAY_SIZE(d40x_depth_sizes),
.resolutions = d40x_depth_sizes,
}, {
.data_type = GMSL_CSI_DT_RGB_888, /* 24-bit Calibration */
.mbus_code = MEDIA_BUS_FMT_RGB888_1X24, /* FIXME */
.n_resolutions = ARRAY_SIZE(d40x_calibration_sizes),
.resolutions = d40x_calibration_sizes,
},
};

static const struct ds5_format ds5_depth_formats_d41x[] = {
{
// TODO: 0x31 is replaced with 0x1e since it caused low FPS in Jetson.
Expand Down Expand Up @@ -1122,6 +1225,26 @@ static const struct ds5_format ds5_y_formats_ds5u[] = {
},
};

static const struct ds5_format ds5_y_formats_40x[] = {
{
/* First format: default */
.data_type = GMSL_CSI_DT_RAW_8, /* Y8 */
.mbus_code = MEDIA_BUS_FMT_Y8_1X8,
.n_resolutions = ARRAY_SIZE(y8_40x_sizes),
.resolutions = y8_40x_sizes,
}, {
.data_type = GMSL_CSI_DT_YUV422_8, /* Y8I */
.mbus_code = MEDIA_BUS_FMT_VYUY8_1X16,
.n_resolutions = ARRAY_SIZE(y8_40x_sizes),
.resolutions = y8_40x_sizes,
}, {
.data_type = GMSL_CSI_DT_RGB_888, /* Y12I, 24-bit Calibration */
.mbus_code = MEDIA_BUS_FMT_RGB888_1X24,
.n_resolutions = ARRAY_SIZE(d40x_calibration_sizes),
.resolutions = d40x_calibration_sizes,
},
};

static const struct ds5_format ds5_y_formats_41x[] = {
{
/* First format: default */
Expand Down Expand Up @@ -4822,6 +4945,9 @@ static int ds5_fixed_configuration(struct i2c_client *client, struct ds5 *state)
case DS5_DEVICE_TYPE_D41X:
sensor->formats = ds5_depth_formats_d41x;
break;
case DS5_DEVICE_TYPE_D40X:
sensor->formats = ds5_depth_formats_d40x;
break;
case DS5_DEVICE_TYPE_D43X:
case DS5_DEVICE_TYPE_D45X:
sensor->formats = ds5_depth_formats_d43x;
Expand All @@ -4837,6 +4963,10 @@ static int ds5_fixed_configuration(struct i2c_client *client, struct ds5 *state)

sensor = &state->ir.sensor;
switch (dev_type) {
case DS5_DEVICE_TYPE_D40X:
sensor->formats = ds5_y_formats_40x;
sensor->n_formats = ARRAY_SIZE(ds5_y_formats_40x);
break;
case DS5_DEVICE_TYPE_D41X:
sensor->formats = ds5_y_formats_41x;
sensor->n_formats = ARRAY_SIZE(ds5_y_formats_41x);
Expand All @@ -4862,6 +4992,8 @@ static int ds5_fixed_configuration(struct i2c_client *client, struct ds5 *state)
sensor->formats = &ds5_41x_rgb_format;
sensor->n_formats = DS5_RLT_RGB_N_FORMATS;
break;
/* TODO EHUD: Should be disabled (no rgb in 401) */
case DS5_DEVICE_TYPE_D40X:
Comment thread
Nikolai-L marked this conversation as resolved.
Comment thread
Nikolai-L marked this conversation as resolved.
case DS5_DEVICE_TYPE_D45X:
sensor->formats = &ds5_rlt_rgb_format;
sensor->n_formats = DS5_RLT_RGB_N_FORMATS;
Expand Down Expand Up @@ -5925,4 +6057,4 @@ MODULE_AUTHOR("Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>,\n\
Shikun Ding <shikun.ding@intel.com>,\n\
Dmitry Perchanov <dmitry.perchanov@intel.com>");
MODULE_LICENSE("GPL v2");
MODULE_VERSION("1.0.1.33");
MODULE_VERSION("1.0.2.3");