Skip to content

Commit fd1f665

Browse files
committed
Fix D41x resolutions
1 parent b62726a commit fd1f665

1 file changed

Lines changed: 159 additions & 18 deletions

File tree

kernel/realsense/d4xx.c

Lines changed: 159 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -663,11 +663,17 @@ static const u16 ds5_framerate_30 = 30;
663663
static const u16 ds5_framerate_15_30[] = {15, 30};
664664

665665
static const u16 ds5_framerate_25 = 25;
666+
static const u16 ds5_framerate_15_25[] = {15, 25};
666667

667668
static const u16 ds5_depth_framerate_to_30[] = {5, 15, 30};
668669
static const u16 ds5_framerate_to_30[] = {5, 10, 15, 30};
669670
static const u16 ds5_framerate_to_60[] = {5, 15, 30, 60};
670671
static const u16 ds5_framerate_to_90[] = {5, 15, 30, 60, 90};
672+
static const u16 ds5_41x_depth_framerate_to_30[] = {6, 15, 30};
673+
static const u16 ds5_41x_framerate_to_30[] = {6, 15, 30};
674+
static const u16 ds5_41x_framerate_to_60_no_15[] = {6, 30, 60};
675+
static const u16 ds5_41x_framerate_to_60[] = {6, 15, 30, 60};
676+
static const u16 ds5_41x_framerate_to_90[] = {6, 15, 30, 60, 90};
671677
static const u16 ds5_framerate_100[] = {100};
672678
static const u16 ds5_framerate_90[] = {90};
673679
static const u16 ds5_imu_framerates[] = {50, 100, 200, 400};
@@ -676,13 +682,13 @@ static const struct ds5_resolution d41x_depth_sizes[] = {
676682
{
677683
.width = 1280,
678684
.height = 720,
679-
.framerates = ds5_depth_framerate_to_30,
680-
.n_framerates = ARRAY_SIZE(ds5_depth_framerate_to_30),
685+
.framerates = ds5_41x_depth_framerate_to_30,
686+
.n_framerates = ARRAY_SIZE(ds5_41x_depth_framerate_to_30),
681687
}, {
682688
.width = 848,
683689
.height = 480,
684-
.framerates = ds5_framerate_to_90,
685-
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
690+
.framerates = ds5_41x_framerate_to_90,
691+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
686692
}, {
687693
.width = 848,
688694
.height = 100,
@@ -691,23 +697,23 @@ static const struct ds5_resolution d41x_depth_sizes[] = {
691697
}, {
692698
.width = 640,
693699
.height = 480,
694-
.framerates = ds5_framerate_to_90,
695-
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
700+
.framerates = ds5_41x_framerate_to_90,
701+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
696702
}, {
697703
.width = 640,
698704
.height = 360,
699-
.framerates = ds5_framerate_to_90,
700-
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
705+
.framerates = ds5_41x_framerate_to_90,
706+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
701707
}, {
702708
.width = 480,
703709
.height = 270,
704-
.framerates = ds5_framerate_to_90,
705-
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
710+
.framerates = ds5_41x_framerate_to_90,
711+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
706712
}, {
707713
.width = 424,
708714
.height = 240,
709-
.framerates = ds5_framerate_to_90,
710-
.n_framerates = ARRAY_SIZE(ds5_framerate_to_90),
715+
.framerates = ds5_41x_framerate_to_90,
716+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
711717
}, {
712718
.width = 256,
713719
.height = 144,
@@ -808,6 +814,104 @@ static const struct ds5_resolution y8_sizes[] = {
808814
}
809815
};
810816

817+
static const struct ds5_resolution y8_41x_sizes[] = {
818+
{
819+
.width = 1920,
820+
.height = 1080,
821+
.framerates = ds5_framerate_15_25,
822+
.n_framerates = ARRAY_SIZE(ds5_framerate_15_25),
823+
}, {
824+
.width = 1280,
825+
.height = 720,
826+
.framerates = ds5_41x_depth_framerate_to_30,
827+
.n_framerates = ARRAY_SIZE(ds5_41x_depth_framerate_to_30),
828+
}, {
829+
.width = 960,
830+
.height = 540,
831+
.framerates = ds5_framerate_15_25,
832+
.n_framerates = ARRAY_SIZE(ds5_framerate_15_25),
833+
}, {
834+
.width = 848,
835+
.height = 480,
836+
.framerates = ds5_41x_framerate_to_90,
837+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
838+
}, {
839+
.width = 848,
840+
.height = 100,
841+
.framerates = ds5_framerate_100,
842+
.n_framerates = ARRAY_SIZE(ds5_framerate_100),
843+
}, {
844+
.width = 640,
845+
.height = 480,
846+
.framerates = ds5_41x_framerate_to_90,
847+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
848+
}, {
849+
.width = 640,
850+
.height = 360,
851+
.framerates = ds5_41x_framerate_to_90,
852+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
853+
}, {
854+
.width = 480,
855+
.height = 270,
856+
.framerates = ds5_41x_framerate_to_90,
857+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
858+
}, {
859+
.width = 424,
860+
.height = 240,
861+
.framerates = ds5_41x_framerate_to_90,
862+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_90),
863+
}
864+
};
865+
866+
static const struct ds5_resolution ds5_41x_rgb_sizes[] = {
867+
{
868+
.width = 1920,
869+
.height = 1080,
870+
.framerates = ds5_41x_framerate_to_30,
871+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_30),
872+
}, {
873+
.width = 1280,
874+
.height = 720,
875+
.framerates = ds5_41x_framerate_to_30,
876+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_30),
877+
}, {
878+
.width = 960,
879+
.height = 540,
880+
.framerates = ds5_41x_framerate_to_60,
881+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_60),
882+
}, {
883+
.width = 848,
884+
.height = 480,
885+
.framerates = ds5_41x_framerate_to_60,
886+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_60),
887+
}, {
888+
.width = 640,
889+
.height = 480,
890+
.framerates = ds5_41x_framerate_to_60,
891+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_60),
892+
}, {
893+
.width = 640,
894+
.height = 360,
895+
.framerates = ds5_41x_framerate_to_60,
896+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_60),
897+
}, {
898+
.width = 424,
899+
.height = 240,
900+
.framerates = ds5_41x_framerate_to_60,
901+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_60),
902+
}, {
903+
.width = 320,
904+
.height = 240,
905+
.framerates = ds5_41x_framerate_to_60_no_15,
906+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_60_no_15),
907+
}, {
908+
.width = 320,
909+
.height = 180,
910+
.framerates = ds5_41x_framerate_to_60_no_15,
911+
.n_framerates = ARRAY_SIZE(ds5_41x_framerate_to_60_no_15),
912+
},
913+
};
914+
811915
static const struct ds5_resolution ds5_rlt_rgb_sizes[] = {
812916
{
813917
.width = 1280,
@@ -885,10 +989,10 @@ static const struct ds5_resolution ds5_size_w10 = {
885989

886990
static const struct ds5_resolution d41x_calibration_sizes[] = {
887991
{
888-
.width = 1280,
889-
.height = 800,
890-
.framerates = ds5_framerate_15_30,
891-
.n_framerates = ARRAY_SIZE(ds5_framerate_15_30),
992+
.width = 1920,
993+
.height = 1080,
994+
.framerates = ds5_framerate_15_25,
995+
.n_framerates = ARRAY_SIZE(ds5_framerate_15_25),
892996
},
893997
};
894998

@@ -1012,6 +1116,33 @@ static const struct ds5_format ds5_y_formats_ds5u[] = {
10121116
},
10131117
};
10141118

1119+
static const struct ds5_format ds5_y_formats_41x[] = {
1120+
{
1121+
/* First format: default */
1122+
.data_type = GMSL_CSI_DT_RAW_8, /* Y8 */
1123+
.mbus_code = MEDIA_BUS_FMT_Y8_1X8,
1124+
.n_resolutions = ARRAY_SIZE(y8_41x_sizes),
1125+
.resolutions = y8_41x_sizes,
1126+
}, {
1127+
.data_type = GMSL_CSI_DT_YUV422_8, /* Y8I */
1128+
.mbus_code = MEDIA_BUS_FMT_VYUY8_1X16,
1129+
.n_resolutions = ARRAY_SIZE(y8_41x_sizes),
1130+
.resolutions = y8_41x_sizes,
1131+
}, {
1132+
.data_type = GMSL_CSI_DT_RGB_888, /* 24-bit Calibration */
1133+
.mbus_code = MEDIA_BUS_FMT_RGB888_1X24, /* FIXME */
1134+
.n_resolutions = ARRAY_SIZE(d41x_calibration_sizes),
1135+
.resolutions = d41x_calibration_sizes,
1136+
},
1137+
};
1138+
1139+
static const struct ds5_format ds5_41x_rgb_format = {
1140+
.data_type = GMSL_CSI_DT_YUV422_8, /* UYVY */
1141+
.mbus_code = MEDIA_BUS_FMT_YUYV8_1X16,
1142+
.n_resolutions = ARRAY_SIZE(ds5_41x_rgb_sizes),
1143+
.resolutions = ds5_41x_rgb_sizes,
1144+
};
1145+
10151146
static const struct ds5_format ds5_rlt_rgb_format = {
10161147
.data_type = GMSL_CSI_DT_YUV422_8, /* UYVY */
10171148
.mbus_code = MEDIA_BUS_FMT_YUYV8_1X16,
@@ -4681,8 +4812,15 @@ static int ds5_fixed_configuration(struct i2c_client *client, struct ds5 *state)
46814812
sensor->mux_pad = DS5_MUX_PAD_DEPTH;
46824813

46834814
sensor = &state->ir.sensor;
4684-
sensor->formats = state->variant->formats;
4685-
sensor->n_formats = state->variant->n_formats;
4815+
switch (dev_type) {
4816+
case DS5_DEVICE_TYPE_D41X:
4817+
sensor->formats = ds5_y_formats_41x;
4818+
sensor->n_formats = ARRAY_SIZE(ds5_y_formats_41x);
4819+
break;
4820+
default:
4821+
sensor->formats = state->variant->formats;
4822+
sensor->n_formats = state->variant->n_formats;
4823+
}
46864824
sensor->mux_pad = DS5_MUX_PAD_IR;
46874825

46884826
sensor = &state->rgb.sensor;
@@ -4693,6 +4831,9 @@ static int ds5_fixed_configuration(struct i2c_client *client, struct ds5 *state)
46934831
sensor->n_formats = DS5_ONSEMI_RGB_N_FORMATS;
46944832
break;
46954833
case DS5_DEVICE_TYPE_D41X:
4834+
sensor->formats = &ds5_41x_rgb_format;
4835+
sensor->n_formats = DS5_RLT_RGB_N_FORMATS;
4836+
break;
46964837
case DS5_DEVICE_TYPE_D45X:
46974838
sensor->formats = &ds5_rlt_rgb_format;
46984839
sensor->n_formats = DS5_RLT_RGB_N_FORMATS;

0 commit comments

Comments
 (0)