Hello,
Following up on this issue: RAW8 MIPI CSI capture issue
I have since successfully ported the driver to other platforms and changed the behavior of the camera to have a discontinuous clock. Now I’m using this device tree:
mode0 {
num_lanes = "2";
pix_clk_hz = "44007840";
serdes_pix_clk_hz = "44007840";
csi_pixel_bit_depth = "8";
tegra_sinterface = "serial_c";
phy_mode = "DPHY";
active_w = "640";
active_h = "480";
line_length = "1464";
pixel_t = "y8";
lane_polarity = "0";
gain_factor = "10";
min_gain_val = "0"; /* 0dB */
max_gain_val = "480"; /* 48dB */
step_gain_val = "3"; /* 0.3 */
default_gain = "0";
framerate_factor = "1000000";
default_framerate = "60000000";
min_framerate = "60000000";
max_framerate = "60000000";
step_framerate = "1000000";
min_exp_time = "30"; /* us */
max_exp_time = "660000"; /* us */
step_exp_time = "10";
default_exp_time = "33334"; /* us */
exposure_factor = "1";
cil_settletime = "0";
embedded_metadata_height = "0";
discontinuous_clk = "yes";
};
and still using this kernel patch:
--- a/drivers/media/platform/tegra/camera/camera_common.c
+++ b/drivers/media/platform/tegra/camera/camera_common.c
@@ -129,6 +129,11 @@ static const struct camera_common_colorfmt camera_common_color_fmts[] = {
V4L2_COLORSPACE_SRGB,
V4L2_PIX_FMT_VYUY,
},
+ {
+ MEDIA_BUS_FMT_Y8_1X8,
+ V4L2_COLORSPACE_RAW,
+ V4L2_PIX_FMT_GREY,
+ },
};
struct camera_common_csi_io_pad_ctx {
@@ -667,7 +672,8 @@ int camera_common_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
verify_code:
mf->field = V4L2_FIELD_NONE;
- mf->colorspace = V4L2_COLORSPACE_SRGB;
+ //mf->colorspace = V4L2_COLORSPACE_SRGB;
mf->xfer_func = V4L2_XFER_FUNC_DEFAULT;
mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
mf->quantization = V4L2_QUANTIZATION_DEFAULT;
--- a/drivers/media/platform/tegra/camera/sensor_common.c
+++ b/drivers/media/platform/tegra/camera/sensor_common.c
@@ -267,6 +267,8 @@ static int extract_pixel_format(
*format = V4L2_PIX_FMT_UYVY;
else if (strncmp(pixel_t, "yuv_vyuy16", size) == 0)
*format = V4L2_PIX_FMT_VYUY;
+ else if (strncmp(pixel_t, "grey_y8", size) == 0)
+ *format = V4L2_PIX_FMT_GREY;
else {
pr_err("%s: Need to extend format%s\n", __func__, pixel_t);
return -EINVAL;
--- a/drivers/media/platform/tegra/camera/vi/vi5_formats.h
+++ b/drivers/media/platform/tegra/camera/vi/vi5_formats.h
@@ -82,6 +82,8 @@ static const struct tegra_video_format vi5_video_formats[] = {
/* RAW 7: TODO */
/* RAW 8 */
+ TEGRA_VIDEO_FORMAT(RAW8, 8, Y8_1X8, 1, 1, T_R8, RAW8, GREY, "Greyscale 8"),
+
TEGRA_VIDEO_FORMAT(RAW8, 8, SRGGB8_1X8, 1, 1, T_R8,
RAW8, SRGGB8, "RGRG.. GBGB.."),
TEGRA_VIDEO_FORMAT(RAW8, 8, SGRBG8_1X8, 1, 1, T_R8,
I have also used this to get more traces:
sudo modprobe rtcpu_debug
echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 3 > /sys/kernel/debug/camrtc/log-level
echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
echo > /sys/kernel/debug/tracing/trace
cat /sys/kernel/debug/tracing/trace
traces.txt (88.2 KB)
But I get only a partial frame from 20 to 70 lines (not always the same). The same camera works on both rpi4 and imx95 platforms. The lines I see in the image so it looks like a desync issue. Is there is an issue with a clock or some other parameter that I’m missing ?