VC-MIPI-modules / vc_mipi_nvidia

Vision Components MIPI CSI-2 driver for NVIDIA Jetson Nano, Xavier NX, AGX Xavier, TX2 and Orin Nano, Orin NX
84 stars 34 forks source link

Jetson Nano boot problem with dtsi setting bayer_gbrg8 #53

Open fre-wolf opened 1 year ago

fre-wolf commented 1 year ago

Hello, I have a problem while booting the Jetson Nano with kernel version 32.7.4 and JetPack release 4.6.4:

[    4.988443] i2c 7-0010: +--------+---------------------------------------------+
[    4.995872] i2c 7-0010: +--- Sensor Registers ------+--------+--------+--------+
[    5.003289] i2c 7-0010: |                           | low    | mid    | high   |
[    5.010704] i2c 7-0010: +---------------------------+--------+--------+--------+
[    5.018126] i2c 7-0010: | idle                      | 0x7000 |        |        |
[    5.023113] usb 1-2.5: new high-speed USB device number 3 using tegra-xusb
[    5.032394] i2c 7-0010: | horizontal start          | 0x6013 | 0x6014 |        |
[    5.039783] i2c 7-0010: | vertical start            | 0x600e | 0x600f |        |
[    5.047176] i2c 7-0010: | horizontal end            | 0x0000 | 0x0000 |        |
[    5.054606] i2c 7-0010: | vertical end              | 0x0000 | 0x0000 |        |
[    5.062040] i2c 7-0010: | hor. output width         | 0x6015 | 0x6016 |        |
[    5.067153] usb 2-1: usb_suspend_both: status 0
[    5.067264] usb 1-2.5: New USB device found, idVendor=0424, idProduct=7240
[    5.067270] usb 1-2.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    5.067274] usb 1-2.5: Product: USB2 Controller Hub
[    5.067278] usb 1-2.5: Manufacturer: Microchip Tech
[    5.067526] usb usb2: usb_suspend_both: status 0
[    5.102757] i2c 7-0010: | ver. output height        | 0x6010 | 0x6011 |        |
[    5.110148] i2c 7-0010: | exposure                  | 0x3034 | 0x3035 | 0x3036 |
[    5.117537] i2c 7-0010: | gain                      | 0x301f | 0x3020 |        |
[    5.124924] i2c 7-0010: +---------------------------+--------+--------+--------+
[    5.132313] i2c 7-0010: | clock for ext. trigger    | 74250000 Hz              |
[    5.139701] i2c 7-0010: | pixel clock               | 74250000 Hz              |
[    5.147105] i2c 7-0010: | shutter offset            |        0 us              |
[    5.154491] i2c 7-0010: +---------------------------+--------------------------+
[    5.161879] i2c 7-0010: +--- Module Modes -------+---------+---------+---------+
[    5.169265] i2c 7-0010: |  # | rate    | lanes   | format  | type    | binning |
[    5.176653] i2c 7-0010: +----+---------+---------+---------+---------+---------+
[    5.184044] i2c 7-0010: |  0 |    1500 |       2 | RAW08   | STREAM  |       0 |
[    5.191434] i2c 7-0010: |  1 |    1500 |       2 | RAW10   | STREAM  |       0 |
[    5.198825] i2c 7-0010: |  2 |    1500 |       2 | RAW12   | STREAM  |       0 |
[    5.206215] i2c 7-0010: |  3 |    1500 |       2 | RAW14   | STREAM  |       0 |
[    5.213603] i2c 7-0010: |  4 |    1500 |       2 | RAW08   | EXT.TRG |       0 |
[    5.220993] i2c 7-0010: |  5 |    1500 |       2 | RAW10   | EXT.TRG |       0 |
[    5.228382] i2c 7-0010: |  6 |    1500 |       2 | RAW12   | EXT.TRG |       0 |
[    5.235770] i2c 7-0010: |  7 |    1500 |       2 | RAW14   | EXT.TRG |       0 |
[    5.243159] i2c 7-0010: |  8 |    1500 |       4 | RAW08   | STREAM  |       0 |
[    5.250547] i2c 7-0010: |  9 |    1500 |       4 | RAW10   | STREAM  |       0 |
[    5.257936] i2c 7-0010: | 10 |    1500 |       4 | RAW12   | STREAM  |       0 |
[    5.265325] i2c 7-0010: | 11 |    1500 |       4 | RAW14   | STREAM  |       0 |
[    5.272712] i2c 7-0010: | 12 |    1500 |       4 | RAW08   | EXT.TRG |       0 |
[    5.280100] i2c 7-0010: | 13 |    1500 |       4 | RAW10   | EXT.TRG |       0 |
[    5.287488] i2c 7-0010: | 14 |    1500 |       4 | RAW12   | EXT.TRG |       0 |
[    5.294876] i2c 7-0010: | 15 |    1500 |       4 | RAW14   | EXT.TRG |       0 |
[    5.302262] i2c 7-0010: +----+---------+---------+---------+---------+---------+
[    5.309652] i2c 7-0010: vc_init_ctrl_imx178(): Initialising module control for IMX178
[    5.317477] i2c 7-0010: +-------+--------+----------+-----------+
[    5.323563] i2c 7-0010: | lanes | format | exposure | framerate |
[    5.329650] i2c 7-0010: |       |        | max [us] | max [mHz] |
[    5.335736] i2c 7-0010: +-------+--------+----------+-----------+
[    5.341825] i2c 7-0010: |     2 | RAW08  |  1200265 |     51363 |
[    5.347913] i2c 7-0010: |     2 | RAW10  |  1482704 |     41578 |
[    5.354001] i2c 7-0010: |     2 | RAW12  |  1736833 |     35494 |
[    5.360088] i2c 7-0010: |     2 | RAW14  |  2040504 |     30212 |
[    5.366176] i2c 7-0010: |     4 | RAW08  |  1058980 |     58213 |
[    5.372264] i2c 7-0010: |     4 | RAW10  |  1058980 |     58213 |
[    5.378352] i2c 7-0010: |     4 | RAW12  |  1200265 |     51363 |
[    5.384440] i2c 7-0010: |     4 | RAW14  |  2040504 |     30212 |
[    5.390526] i2c 7-0010: +-------+--------+----------+-----------+
[    5.396612] i2c 7-0010: VC MIPI Core succesfully initialized
[    5.402266] vc_mipi 7-001a: vc_init_io(): Init trigger and flash mode
[    5.408708] i2c 7-0010: vc_mod_set_trigger_mode(): Set trigger mode: DISABLED
[    5.415838] i2c 7-0010: vc_mod_set_io_mode(): Set IO mode: DISABLED
[    5.422103] vc_mipi 7-001a: vc_init_frmfmt(): Init frame (width: 3072, height: 2048, fps: 0)
[    5.430892] extract_pixel_format: Need to extend formatbayer_gbrg8
[    5.437072] vc_mipi 7-001a: Unsupported pixel format
[    5.442033] vc_mipi 7-001a: Failed to read mode0 image props
[    5.447690] vc_mipi 7-001a: Could not initialize sensor properties.
[    5.453951] vc_mipi 7-001a: Failed to initialize vc_mipi
[    5.459259] vc_mipi 7-001a: vc_probe(): Tegra camera device registration failed

sensor_common.c looks like this in the unpatched code:

static int extract_pixel_format(
    const char *pixel_t, u32 *format)
{
    size_t size = strnlen(pixel_t, OF_MAX_STR_LEN);

    if (strncmp(pixel_t, "bayer_bggr10", size) == 0)
        *format = V4L2_PIX_FMT_SBGGR10;
    else if (strncmp(pixel_t, "bayer_rggb10", size) == 0)
        *format = V4L2_PIX_FMT_SRGGB10;
    else if (strncmp(pixel_t, "bayer_grbg10", size) == 0)
        *format = V4L2_PIX_FMT_SGRBG10;
    else if (strncmp(pixel_t, "bayer_gbrg10", size) == 0)
        *format = V4L2_PIX_FMT_SGBRG10;
    else if (strncmp(pixel_t, "bayer_bggr12", size) == 0)
        *format = V4L2_PIX_FMT_SBGGR12;
    else if (strncmp(pixel_t, "bayer_rggb12", size) == 0)
        *format = V4L2_PIX_FMT_SRGGB12;
    else if (strncmp(pixel_t, "bayer_gbrg12", size) == 0)
        *format = V4L2_PIX_FMT_SGBRG12;
    else if (strncmp(pixel_t, "bayer_grbg12", size) == 0)
        *format = V4L2_PIX_FMT_SGRBG12;
    else if (strncmp(pixel_t, "rgb_rgb88824", size) == 0)
        *format = V4L2_PIX_FMT_RGB24;
    else if (strncmp(pixel_t, "bayer_wdr_pwl_rggb12", size) == 0)
        *format = V4L2_PIX_FMT_SRGGB12;
    else if (strncmp(pixel_t, "bayer_wdr_pwl_gbrg12", size) == 0)
        *format = V4L2_PIX_FMT_SGBRG12;
    else if (strncmp(pixel_t, "bayer_wdr_pwl_grbg12", size) == 0)
        *format = V4L2_PIX_FMT_SGRBG12;
    else if (strncmp(pixel_t, "bayer_wdr_dol_rggb10", size) == 0)
        *format = V4L2_PIX_FMT_SRGGB10;
    else if (strncmp(pixel_t, "bayer_xbggr10p", size) == 0)
        *format = V4L2_PIX_FMT_XBGGR10P;
    else if (strncmp(pixel_t, "bayer_xrggb10p", size) == 0)
        *format = V4L2_PIX_FMT_XRGGB10P;
    else if (strncmp(pixel_t, "yuv_yuyv16", size) == 0)
        *format = V4L2_PIX_FMT_YUYV;
    else if (strncmp(pixel_t, "yuv_yvyu16", size) == 0)
        *format = V4L2_PIX_FMT_YVYU;
    else if (strncmp(pixel_t, "yuv_uyvy16", size) == 0)
        *format = V4L2_PIX_FMT_UYVY;
    else if (strncmp(pixel_t, "yuv_vyuy16", size) == 0)
        *format = V4L2_PIX_FMT_VYUY;
    else {
        pr_err("%s: Need to extend format%s\n", __func__, pixel_t);
        return -EINVAL;
    }

    return 0;
}

The patch from patch/kernel_Nano_32.6.1+/0002-Added-RAW8-grey-RAW10-y10-and-RAW12-y12-format-to-th.patch adds this:

diff --git a/kernel/nvidia/drivers/media/platform/tegra/camera/sensor_common.c b/kernel/nvidia/drivers/media/platform/tegra/camera/sensor_common.c
index 32f7c417a..dd040dee2 100644
--- a/kernel/nvidia/drivers/media/platform/tegra/camera/sensor_common.c
+++ b/kernel/nvidia/drivers/media/platform/tegra/camera/sensor_common.c
@@ -227,6 +227,14 @@ 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, "gray", size) == 0)
+       *format = V4L2_PIX_FMT_GREY;
+   else if (strncmp(pixel_t, "y10", size) == 0)
+       *format = V4L2_PIX_FMT_Y10;
+   else if (strncmp(pixel_t, "y12", size) == 0)
+       *format = V4L2_PIX_FMT_Y12;
+   else if (strncmp(pixel_t, "bayer_rggb8", size) == 0)
+       *format = V4L2_PIX_FMT_SRGGB8;
    else {
        pr_err("%s: Need to extend format%s\n", __func__, pixel_t);
        return -EINVAL;

can you please add the bayer_gbrg8 to that patch?

Thank you