darksparks
Posts: 6
Joined: Tue Feb 20, 2024 6:16 pm
Location: Sandy, Utah, USA

CM4 with ST7701 panel driver does not create /dev/dri/cardX

Tue Feb 20, 2024 7:15 pm

Greetings!

I'm trying to bring up a new MIPI DSI panel that utilizes the Sitronix ST7701 driver chip on a CM4 mounted to a CM4 I/O board. The panel is attached to the DISP0 connector on the CM4, and I'm using an Adafruit 40-Pin TFT Breakout board to connect to the panel ... as well as drive the backlight. When powered up, I get the usual "glow" of a panel that has all pixels set to black or is disabled.

I've patched the "panel-sitronix-st7701.c" driver source to include my new panel info, including a new "compatible" string and MIPI init sequence for the panel. I've sprinkled dozens of debug statements across a variety of drivers to see what's happening during boot, as well as when I do a "modprobe vc4" to start everything up. To my eyes, it appears I have everything correct (and much of the DRM/KMS subsystem is lighting up), but after the boot and modprobe, I do not see the /dev/dri/cardX device.

What follows is the following information:
* additions to the config.txt file
* the device tree overlay source
* selected output from dmesg during the boot cycle
* selected output from /sys/firmware/devicetree/base/XXX
* selected output from dmesg after I do "modprobe vc4"

This feels like I'm just missing an overlay, kernel config option, a modprobe, or device tree entry ... and I thank everyone in advance for any pointers you can provide

-Dave

Here are the additions I've made to the confg.txt file (in the "all" section):

Code: Select all

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Enable DRM Tailor Pixels TTH318BVE LCD Display
ignore_lcd=1
dtoverlay=tth318bve
dtparam=debug=1
dtparam=fps=60
Here's the .dts source for the device tree overlay:

Code: Select all

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835";

    fragment@0 {
        target = <&dsi0>;
        __overlay__ {
            status = "okay";
            #address-cells = <1>;
            #size-cells = <0>;
            port {
                dsi_out: endpoint {
                    remote-endpoint = <&panel_in>;
                };
            };
        };
    };

    fragment@1 {
        target-path = "/";
        __overlay__ {
            tplcd: tplcd@0 {
                compatible = "tailorpixels,tth318bve", "sitronix,st7701";
                status = "okay";
                reg = <0>;
                rotate = <270>;
                width = <480>;
                height = <960>;
                buswidth = <8>;
                dsi-lanes = <2>;
                vc4_dsi = <&dsi0>;
//                dc-gpios = <&gpio 22 0>;
//                enable-gpios = <&gpio 22 0>;
//                reset-gpios = <&gpio 6 1>;
                fps = <50>;
                debug = <0>;
                port {
                    panel_in: endpoint {
                        remote-endpoint = <&dsi_out>;
                    };
                };
            };
        };
    };

    fragment@3 {
        target = <&csi0>;
        __overlay__ {
            status = "disabled";
        };
    };

    fragment@4 {
        target = <&csi1>;
        __overlay__ {
            status = "disabled";
        };
    };

    fragment@5 {
        target = <&hdmi0>;
        __overlay__ {
            status = "disabled";
        };
    };

    fragment@6 {
        target = <&hdmi1>;
        __overlay__ {
            status = "disabled";
        };
    };

    __overrides__ {
        rotate =  <&tplcd>,"rotate:0";
        width =   <&tplcd>,"width:0";
        height =  <&tplcd>,"height:0";
        fps =     <&tplcd>,"fps:0";
        debug =   <&tplcd>,"debug:0";
    };
};
dmesg output during boot (driver function name, followed by op):

Code: Select all


[    9.675204][  T201] drm_core_init: entry
[    9.680259][  T201] __register_chrdev: entry: major=226 baseminor=0 count=256 name="drm"
[    9.684708][  T201] __register_chrdev: complete: (cd->major=226)
[    9.693299][  T201] Initialized
[    9.702937][  T201] drm_core_init: complete
[    9.709855][  T201] panel_st7701_init: entry
[    9.719278][  T201] driver_register: entry: driver='st7701'
[    9.719413][  T201] driver_register: complete
[    9.725464][  T201] panel_st7701_init: registering MIPI DSI driver
[    9.736917][  T201] mipi_dsi_driver_register_full: entry
[    9.736929][  T201] driver_register: entry: driver='st7701'
[    9.742770][  T201] driver_register: complete
[    9.748825][  T201] mipi_dsi_driver_register_full: complete (res=0)
[    9.753651][  T201] panel_st7701_init: complete
[   10.018681][  T201] driver_register: entry: driver='vcsm-cma'
[   10.024448][  T201] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
Device tree view in /sys/firmware/devicetree/base/tplcd@0 after boot:

Code: Select all

# ls
buswidth    dsi-lanes   name        reg         vc4_dsi
compatible  fps         phandle     rotate      width
debug       height      port        status
# hexdump -C buswidth
00000000  00 00 00 08                                       |....|
00000004
# hexdump -C compatible
00000000  74 61 69 6c 6f 72 70 69  78 65 6c 73 2c 74 74 68  |tailorpixels,tth|
00000010  33 31 38 62 76 65 00 73  69 74 72 6f 6e 69 78 2c  |318bve.sitronix,|
00000020  73 74 37 37 30 31 00                              |st7701.|
00000027
# hexdump -C debug
00000000  00 00 00 01                                       |....|
00000004
# hexdump -C dsi-lanes
00000000  00 00 00 02                                       |....|
00000004
# hexdump -C fps
00000000  00 00 00 3c                                       |...<|
00000004
# hexdump -C height
00000000  00 00 03 c0                                       |....|
00000004
# hexdump -C name
00000000  74 70 6c 63 64 00                                 |tplcd.|
00000006
# hexdump -C phandle
00000000  00 00 01 0e                                       |....|
00000004
# hexdump -C reg
00000000  00 00 00 00                                       |....|
00000004
# hexdump -C rotate
00000000  00 00 01 0e                                       |....|
00000004
# hexdump -C status
00000000  6f 6b 61 79 00                                    |okay.|
00000005
# hexdump -C vc4_dsi
00000000  00 00 00 04                                       |....|
00000004
# hexdump -C width
00000000  00 00 01 e0                                       |....|
dmesg output from "modprobe vc4" (driver function name, followed by op):

Code: Select all

# modprobe vc4
[   48.924448][  T595] __platform_driver_register: entry
[   48.924482][  T595] driver_register: entry: driver='snd-soc-dummy'
[   48.930510][  T595] driver_register: complete
[   48.937215][  T595] __platform_driver_register: complete (res=0)
[   48.942074][  T595] __platform_driver_register: entry
[   48.948560][  T595] driver_register: entry: driver='soc-audio'
[   48.954339][  T595] driver_register: complete
[   48.960650][  T595] __platform_driver_register: complete (res=0)
[   49.034269][  T595] __platform_driver_register: entry
[   49.040802][  T595] driver_register: entry: driver='hdmi-audio-codec'
[   49.046592][  T595] driver_register: complete
[   49.053510][  T595] __platform_driver_register: complete (res=0)
[   49.129635][  T595] vc4_drm_register: entry
[   49.136170][  T595] vc4_drm_register: tag: platform_register_drivers
[   49.140830][  T595] __platform_register_drivers: entry
[   49.147710][  T595] __platform_register_drivers: registering platform driver vc4_hvs_driver [vc4]
[   49.153320][  T595] __platform_driver_register: entry
[   49.162666][  T595] driver_register: entry: driver='vc4_hvs'
[   49.168627][  T595] driver_register: complete
[   49.174770][  T595] __platform_driver_register: complete (res=0)
[   49.179651][  T595] __platform_register_drivers: registering platform driver vc4_hdmi_driver [vc4]
[   49.186124][  T595] __platform_driver_register: entry
[   49.195557][  T595] driver_register: entry: driver='vc4_hdmi'
[   49.201449][  T595] driver_register: complete
[   49.207669][  T595] __platform_driver_register: complete (res=0)
[   49.212541][  T595] __platform_register_drivers: registering platform driver vc4_vec_driver [vc4]
[   49.219016][  T595] __platform_driver_register: entry
[   49.228354][  T595] driver_register: entry: driver='vc4_vec'
[   49.234169][  T595] driver_register: complete
[   49.240300][  T595] __platform_driver_register: complete (res=0)
[   49.245219][  T595] __platform_register_drivers: registering platform driver vc4_dpi_driver [vc4]
[   49.251713][  T595] __platform_driver_register: entry
[   49.261067][  T595] driver_register: entry: driver='vc4_dpi'
[   49.266963][  T595] driver_register: complete
[   49.273102][  T595] __platform_driver_register: complete (res=0)
[   49.277981][  T595] __platform_register_drivers: registering platform driver vc4_dsi_driver [vc4]
[   49.284456][  T595] __platform_driver_register: entry
[   49.293800][  T595] driver_register: entry: driver='vc4_dsi'
[   49.299832][  T595] vc4_dsi_dev_probe: entry
[   49.305984][  T595] mipi_dsi_host_register: entry: host->dev->init_name="(null)"
[   49.310729][  T595] mipi_dsi_host_register: adding host to list with mutex
[   49.318589][  T595] mipi_dsi_host_register: complete
[   49.325993][  T595] vc4_dsi_dev_probe: complete
[   49.331449][  T595] vc4_dsi_dev_probe: complete
[   49.337197][  T595] driver_register: complete
[   49.342222][  T595] __platform_driver_register: complete (res=0)
[   49.347105][  T595] __platform_register_drivers: registering platform driver vc4_txp_driver [vc4]
[   49.353657][  T595] __platform_driver_register: entry
[   49.363057][  T595] driver_register: entry: driver='vc4_txp'
[   49.368955][  T595] driver_register: complete
[   49.375087][  T595] __platform_driver_register: complete (res=0)
[   49.379961][  T595] __platform_register_drivers: registering platform driver vc4_crtc_driver [vc4]
[   49.386433][  T595] __platform_driver_register: entry
[   49.395858][  T595] driver_register: entry: driver='vc4_crtc'
[   49.401791][  T595] driver_register: complete
[   49.408004][  T595] __platform_driver_register: complete (res=0)
[   49.412874][  T595] __platform_register_drivers: registering platform driver vc4_firmware_kms_driver [vc4]
[   49.419343][  T595] __platform_driver_register: entry
[   49.429466][  T595] driver_register: entry: driver='vc4_firmware_kms'
[   49.435265][  T595] driver_register: complete
[   49.442176][  T595] __platform_driver_register: complete (res=0)
[   49.447041][  T595] __platform_register_drivers: registering platform driver vc4_v3d_driver [vc4]
[   49.453514][  T595] __platform_driver_register: entry
[   49.462851][  T595] driver_register: entry: driver='vc4_v3d'
[   49.468683][  T595] driver_register: complete
[   49.474825][  T595] __platform_driver_register: complete (res=0)
[   49.479651][  T595] __platform_register_drivers: complete
[   49.486118][  T595] vc4_drm_register: tag: platform_driver_register
[   49.491981][  T595] __platform_driver_register: entry
[   49.498722][  T595] driver_register: entry: driver='vc4-drm'
[   49.504577][  T595] driver_register: complete
[   49.510704][  T595] __platform_driver_register: complete (res=0)
[   49.515524][  T595] vc4_drm_register: complete

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 16115
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM4 with ST7701 panel driver does not create /dev/dri/cardX

Wed Feb 21, 2024 11:27 am

There seem to be a load of random parameters thrown into your overlay, unless you've done severe hacks to the driver.

Code: Select all

    fragment@1 {
        target-path = "/";
        __overlay__ {
            tplcd: tplcd@0 {
                compatible = "tailorpixels,tth318bve", "sitronix,st7701";
                status = "okay";
                reg = <0>;
                rotate = <270>;
                width = <480>;
                height = <960>;
                buswidth = <8>;
                dsi-lanes = <2>;
                vc4_dsi = <&dsi0>;
//                dc-gpios = <&gpio 22 0>;
//                enable-gpios = <&gpio 22 0>;
//                reset-gpios = <&gpio 6 1>;
                fps = <50>;
                debug = <0>;
                port {
                    panel_in: endpoint {
                        remote-endpoint = <&dsi_out>;
                    };
                };
            };
        };
    };
None of rotate, width, height, buswidth, dsi-lanes, vc4_dsi, fps, and debug exist as properties for that driver. (I'd love to know where the vc4_dsi link has come from - as AFAIK it has never existed, but lots of people keep on adding it to their overlays).
Your overrides for them will also do nothing for the same reason.
Look at the binding for the panel at https://elixir.free-electrons.com/linux ... t7701.yaml, which references https://elixir.free-electrons.com/linux ... ommon.yaml

Code: Select all

    fragment@3 {
        target = <&csi0>;
        __overlay__ {
            status = "disabled";
        };
    };

    fragment@4 {
        target = <&csi1>;
        __overlay__ {
            status = "disabled";
        };
    };

    fragment@5 {
        target = <&hdmi0>;
        __overlay__ {
            status = "disabled";
        };
    };

    fragment@6 {
        target = <&hdmi1>;
        __overlay__ {
            status = "disabled";
        };
    };
These all seem a little redundant, particularly the csi nodes as they're disabled by default anyway.

Check /sys/kernel/debug/devices_deferred for devices that haven't probed, and /sys/kernel/debug/device_component/gpu for parts of the vc4 component that haven't bound correctly.

Please note that DSI0 on CM1/3/4 is known to have issues with stopping and restarting at present - https://github.com/raspberrypi/linux/issues/4946
DSI1 is recommended unless you have very good reasons to work with DSI0.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

darksparks
Posts: 6
Joined: Tue Feb 20, 2024 6:16 pm
Location: Sandy, Utah, USA

Re: CM4 with ST7701 panel driver does not create /dev/dri/cardX

Wed Feb 21, 2024 3:15 pm

Thanks! Very helpful!

After mounting debugfs and then doing "modprobe vc4", I found the following:

Code: Select all

# cat /sys/kernel/debug/devices_deferred
#
# cat /sys/kernel/debug/device_component/gpu
cat: can't open '/sys/kernel/debug/device_component/gpu': No such file or directory
# ls /sys/kernel/debug/dri
#
# hexdump -C /sys/firmware/devicetree/base/gpu/compatible
00000000  62 72 63 6d 2c 62 63 6d  32 37 31 31 2d 76 63 35  |brcm,bcm2711-vc5|
00000010  00                                                |.|
# hexdump -C /sys/firmware/devicetree/base/gpu/name
00000000  67 70 75 00                                       |gpu.|
# hexdump -C /sys/firmware/devicetree/base/gpu/status
00000000  64 69 73 61 62 6c 65 64  00                       |disabled.|
I don't see any deferred drivers, but it also appears the GPU is disabled in the device tree. I've read elsewhere that adding the "dtoverlay=vc4-kms-v3d-pi4" entry in config.txt should enable it, but an examination of the files in /arch/arm/boot/dts/bmc* files don't show a status = "okay" anywhere for the GPU node. Is enabling the GPU handled somewhere else or should the following be added to my tth318bve overlay?

Code: Select all

fragment@x {
       target = <&gpu>;
        __overlay__ {
                status = "okay";
        };
};
Thanks in advance for your help!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 16115
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM4 with ST7701 panel driver does not create /dev/dri/cardX

Wed Feb 21, 2024 4:10 pm

Are you using Raspberry Pi OS, or some other base for your development? Your comments imply something else, at which point all bets are off.

Are you using our kernel or mainline?
Mainline largely doesn't support dt overlays, and is well behind our tree for SoC specific stuff (we're working on upstreaming support), and I'm afraid I don't have much time to provide support on it. We maintain our own tree for very good reason.

I'm expecting config.txt to have

Code: Select all

dtoverlay=vc4-kms-v3d
in it, otherwise you are heading down a dead end. overlay_map.dts will convert that to vc4-kms-v3d-pi4 on a bcm2711 platform.
That includes enabling the node labelled vc4, which is the /gpu node.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

darksparks
Posts: 6
Joined: Tue Feb 20, 2024 6:16 pm
Location: Sandy, Utah, USA

Re: CM4 with ST7701 panel driver does not create /dev/dri/cardX

Wed Feb 21, 2024 11:22 pm

We're using Raspberry Pi OS version 6.5.y (specifically commit id e952db2429405106362e5ecdc41047c528b291cb) as our baseline, with some modifications to the kernel config ... but nothing within the Graphics/DRM arena.

I can also confirm the entry in config.txt has been changed to "dtoverlay=vc4-kms-v3d" with no changes in behavior (see below). The GPU's "status" entry in the device tree is still showing "disabled" after boot completes. Here's an excerpt from the config.txt file:

Code: Select all

# How much memory in MB to assign to the GPU on Pi models having
# 256, 512 or 1024 MB total memory
gpu_mem_256=100
gpu_mem_512=100
gpu_mem_1024=100

dtparam=eee=off
dtparam=i2c_vc=on
dtoverlay=i2c-rtc,pcf85063a,i2c_csi_dsi

# enable 64bits support
arm_64bit=1

dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on

# Automatically load overlays for detected cameras
#camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]
# Enable VC4/KMS/V3D/DRM
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Enable Tailor Pixels TTH318BVE LCD Display
ignore_lcd=1
dtoverlay=tth318bve
dtparam=debug=1
dtparam=fps=60

dtoverlay=i2c-mux,pca9544
dtoverlay=dwc2,dr_mode=peripheral
dtoverlay=spi1-1cs
disable_splash=1
dtoverlay=disable-bt
I don't see any overlays occurring after vc4-kms-v3d that might be disabling the GPU ... just my LCD panel overlay, and some I2C, USB, SPI, and bluetooth changes.

Based on your previous comment, I'm moving everything over to use DSI1 so we can avoid the RGB/GBR/BGR issue you referenced.

What other areas should I be looking into?

darksparks
Posts: 6
Joined: Tue Feb 20, 2024 6:16 pm
Location: Sandy, Utah, USA

Re: CM4 with ST7701 panel driver does not create /dev/dri/cardX

Mon Feb 26, 2024 4:22 pm

Here are some updates. I'm up against a deadline, so any help resolving these issues is appreciated ... especially from the RPi engineers.

- I'm using Raspberry Pi OS v6.5.y (6.5.6-v8 specifically) on a CM4 mounted to a CM4 I/O board.
- It appears that the vc4-kms-v3d overlay is not properly enabling the GPU with this specific Raspberry Pi OS version and CM4 hardware combination.
- I have forced the GPU to be enabled by patching the bcm2711-rpi-ds.dtsi file to change status = "okay". This is the last device tree file in the include chain.

After a build and boot, I see the GPU is enabled in /sys/firmware/devicetree/base/gpu/status, and the boot log shows many new VC4/DRM operations. Along with this good news, I've found the following problematic issues:

Issue #1
This appears to be a warning, but I suspect it is an indicator of a larger problem. It occurs just after the drm_dev_register() function is called:

Code: Select all

[    6.897500][  T207] ------------[ cut here ]------------
[    6.907508][  T207] Bogus possible_crtcs: [ENCODER:31:DSI-31] possible_crtcs=0x0 (full crtc mask=0x0)
[    6.916853][  T207] WARNING: CPU: 1 PID: 207 at drivers/gpu/drm/drm_mode_config.c:626 drm_mode_config_validate+0x1c8/0x4e0 [drm]
...
From other VC4/DRM output, it does appear there is a connector, and it is using the expected panel resolution:

Code: Select all

[    7.263066][  T207] adding "DSI-1" to sysfs
[    7.267478][  T207] Initialized vc4 0.0.0 20140616 for gpu on minor 0
[    7.321419][  T207] OBJ ID: 32 (2)
[    7.332195][  T207] [CONNECTOR:32:DSI-1]
[    7.343047][  T207] [CONNECTOR:32:DSI-1] status updated from unknown to connected
[    7.350597][   T58] generating hotplug event
[    7.359249][  T207] [CONNECTOR:32:DSI-1] probed modes :
[    7.364507][  T207] Modeline "480x960": 60 32192 480 500 502 536 960 974 984 1001 0x48 0x0
[    7.372816][  T207] connector 32 enabled? yes
[    7.377224][  T207] Not using firmware configuration
[    7.397004][  T207] looking for cmdline mode on connector 32
[    7.416052][  T207] looking for preferred mode on connector 32 0
[    7.429707][  T207] found mode 480x960
[    7.440946][  T207] picking CRTCs for 7680x7680 config   <<< is this expected?
Issue #2
A kernel NULL pointer fault occurs when calling the drm_client_modeset_commit() function from inside drm_fb_helper_single_fb_probe():

Code: Select all

[    7.577356][  T207] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000050
[    7.583057][  T207] Mem abort info:
[    7.606826][  T207]   ESR = 0x0000000096000005
[    7.611287][  T207]   EC = 0x25: DABT (current EL), IL = 32 bits
[    7.624879][  T207]   SET = 0, FnV = 0
[    7.634900][  T207]   EA = 0, S1PTW = 0
[    7.634911][  T207]   FSC = 0x05: level 1 translation fault
[    7.634922][  T207] Data abort info:
[    7.646331][  T207]   ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
[    7.661778][  T207]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[    7.675557][  T207]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[    7.687317][  T207] user pgtable: 4k pages, 39-bit VAs, pgdp=0000000043d48000
[    7.700926][  T207] [0000000000000050] pgd=0000000000000000, p4d=0000000000000000
[    7.714527][  T207] , pud=0000000000000000
[    7.729586][  T207]
[    7.742694][  T207] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
[    7.760417][  T207] Modules linked in: bcm2835_codec(C) bcm2835_v4l2(C) bcm2835_mmal_vchiq(C) vc_sm_cma(C) videobuf2_vmalloc dwc2 spi_bcm2835 spi_bcm2835aux nvmem_rmem i2c_bcm2835 i2c_mux_pinctrl i2c_mux panel_sitronix_st7701(+) vc4 snd_soc_hdmi_codec drm_display_helper cec drm_dma_helper drm_kms_helper drm drm_panel_orientation_quirks snd_soc_core snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd backlight raspberrypi_gpiomem rpivid_hevc(C) v4l2_mem2mem videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videodev videobuf2_common mc uio_pdrv_genirq uio crct10dif_ce
[    7.811149][  T207] CPU: 1 PID: 207 Comm: modprobe Tainted: G        WC         6.5.6-v8 #1
[    7.819520][  T207] Hardware name: Raspberry Pi Compute Module 4 Rev 1.1 (DT)
[    7.826665][  T207] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    7.834339][  T207] pc : vc4_atomic_commit_tail+0x254/0x8f0 [vc4]
[    7.840529][  T207] lr : vc4_atomic_commit_tail+0x58/0x8f0 [vc4]
[    7.846613][  T207] sp : ffffffc080662e50
[    7.850628][  T207] x29: ffffffc080662e50 x28: 0000000000000003 x27: ffffff80419b3610
[    7.858488][  T207] x26: 00000000ffffffff x25: ffffffe19ee70208 x24: 0000000000000000
[    7.866346][  T207] x23: 0000000000000000 x22: ffffff80419b3900 x21: ffffff80419b35a0
[    7.874203][  T207] x20: ffffff80419d8000 x19: ffffff8043e01b00 x18: ffffffc080662c68
[    7.882059][  T207] x17: 6f635f6374726320 x16: ffffffe1f154c350 x15: 0000000000000000
[    7.889915][  T207] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
[    7.897771][  T207] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffffe19ee28248
[    7.905627][  T207] x8 : ffffff8040edf180 x7 : 0000000000000000 x6 : 0000000019cb24e0
[    7.913484][  T207] x5 : 00ffffffffffffff x4 : ffffff80419d8000 x3 : ffffff8040fb0380
[    7.921340][  T207] x2 : ffffff80419d8938 x1 : 0000000000000000 x0 : 0000000000000000
[    7.929197][  T207] Call trace:
[    7.932344][  T207]  vc4_atomic_commit_tail+0x254/0x8f0 [vc4]
[    7.938167][  T207]  commit_tail+0xac/0x1a0 [drm_kms_helper]
[    7.943948][  T207]  drm_atomic_helper_commit+0x178/0x198 [drm_kms_helper]
[    7.950929][  T207]  drm_atomic_commit+0xb0/0x118 [drm]
[    7.956406][  T207]  drm_client_modeset_commit_atomic+0x208/0x270 [drm]
[    7.963241][  T207]  drm_client_modeset_commit_locked+0x64/0x1a8 [drm]
[    7.969987][  T207]  drm_client_modeset_commit+0x38/0x68 [drm]
[    7.976041][  T207]  __drm_fb_helper_initial_config_and_unlock+0x7bc/0x800 [drm_kms_helper]
[    7.984507][  T207]  drm_fb_helper_initial_config+0x40/0x58 [drm_kms_helper]
[    7.991662][  T207]  drm_fbdev_dma_client_hotplug+0x8c/0xe0 [drm_dma_helper]
[    7.998744][  T207]  drm_client_register+0x60/0xb0 [drm]
[    8.004277][  T207]  drm_fbdev_dma_setup+0x90/0x148 [drm_dma_helper]
[    8.010661][  T207]  vc4_drm_bind+0x200/0x4f8 [vc4]
[    8.015618][  T207]  try_to_bring_up_aggregate_device+0x16c/0x1e0
[    8.021742][  T207]  __component_add+0xf8/0x230
[    8.026290][  T207]  component_add+0x50/0x88
[    8.030577][  T207]  vc4_dsi_host_attach+0xa0/0x1b8 [vc4]
[    8.036053][  T207]  mipi_dsi_attach+0x68/0xe8
[    8.040513][  T207]  st7701_dsi_probe+0x94/0x160 [panel_sitronix_st7701]
[    8.047251][  T207]  mipi_dsi_drv_probe+0x58/0xc0
[    8.051970][  T207]  really_probe+0x150/0x2d0
[    8.056342][  T207]  __driver_probe_device+0x80/0x140
[    8.061410][  T207]  driver_probe_device+0xe0/0x170
[    8.066303][  T207]  __driver_attach+0x9c/0x1b0
[    8.070849][  T207]  bus_for_each_dev+0x7c/0xe8
[    8.075393][  T207]  driver_attach+0x2c/0x40
[    8.079677][  T207]  bus_add_driver+0xec/0x1f8
[    8.084135][  T207]  driver_register+0x8c/0x1c8
[    8.088681][  T207]  mipi_dsi_driver_register_full+0x9c/0x108
[    8.094444][  T207]  panel_st7701_init+0x74/0xff8 [panel_sitronix_st7701]
[    8.101261][  T207]  do_one_initcall+0x4c/0x2a0
[    8.105807][  T207]  do_init_module+0x5c/0x210
[    8.110265][  T207]  load_module+0x1bdc/0x1d08
[    8.114721][  T207]  __do_sys_init_module+0x1b8/0x1f8
[    8.119787][  T207]  __arm64_sys_init_module+0x24/0x38
[    8.124939][  T207]  invoke_syscall+0x50/0x128
[    8.129400][  T207]  el0_svc_common.constprop.0+0x68/0x120
[    8.134902][  T207]  do_el0_svc+0x40/0xb8
[    8.138926][  T207]  el0_svc+0x30/0x98
[    8.142692][  T207]  el0t_64_sync_handler+0xc0/0xc8
[    8.147586][  T207]  el0t_64_sync+0x190/0x198
[    8.151959][  T207] Code: 39592280 35fff560 f9400aa0 f9400ac1 (f9402b15)
[    8.158762][  T207] ---[ end trace 0000000000000000 ]---
Here's the latest device tree overlay being used to enable the panel-sitronix-st7701 driver:

Code: Select all

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835";

    fragment@0 {
        target = <&dsi1>;
        __overlay__ {
            status = "okay";
            #address-cells = <1>;
            #size-cells = <0>;
            port {
                dsi_out: endpoint {
                    remote-endpoint = <&panel_in>;
                };
            };

            tplcd: tplcd@0 {
                compatible = "tailorpixels,tth318bve", "sitronix,st7701";
                status = "okay";
                reg = <0>;
//fixme                VCC-supply = <&fixedregulator_5v0>;
//fixme                IOVCC-supply = <&fixedregulator_3v3>;
//fixme                reset-gpios = <&gpio 6 1 GPIO_ACTIVE_LOW>;
                fps = <60>;
                debug = <1>;
                port {
                    panel_in: endpoint {
                        remote-endpoint = <&dsi_out>;
                    };
                };
            };
        };
    };

    __overrides__ {
        fps =     <&tplcd>,"fps:0";
        debug =   <&tplcd>,"debug:0";
    };
};
Thanks again for any assistance!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 16115
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM4 with ST7701 panel driver does not create /dev/dri/cardX

Wed Feb 28, 2024 4:41 pm

6.5 is an odd branch to choose. 6.5 hit EOL as soon as 6.6.0 was released.
6.1 and 6.6 are the long term support (LTS) branches from mainline, and the ones that Raspberry Pi focus on supporting.
https://www.kernel.org/category/releases.html

If you're getting " Bogus possible_crtcs: [ENCODER:31:DSI-31] possible_crtcs=0x0 (full crtc mask=0x0)" then you've messed something up in DT big time, quite possibly linked to failing to load vc4-kms-v3d.

You can add "dtdebug=1" to /boot/firmware/config.txt, and then "sudo vclog -m" will give you far more detail over what the firmware did in DT during the early phase of boot.

Push your branch to Github so that others can pull it and build it, and then it's possible to advise. Just looking at logs is far harder.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

darksparks
Posts: 6
Joined: Tue Feb 20, 2024 6:16 pm
Location: Sandy, Utah, USA

Re: CM4 with ST7701 panel driver does not create /dev/dri/cardX

Fri Mar 15, 2024 1:25 pm

Problems Resolved!

The new LCD panel is working. For those that might find this thread as you bring up your LCD panel, here's what I did to resolve the issues.

1- Updates to Device Tree Overlays
There appears to be an issue with the vc4-kms-v3d.dtbo overlay when used with the 6.5.6 release. Even with this device tree overlay added to the /boot/config.txt file, it did NOT enable the GPU and other components. To resolve this issue, I copied the source of the vc4-kms-v3d into my LCD panel device tree overlay file. Here is the final result:

Code: Select all

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835";

    fragment@0 {
        target = <&dsi1>;
        __overlay__ {
            status = "okay";
            #address-cells = <1>;
            #size-cells = <0>;
            port {
                dsi_out_panel: endpoint {
                    remote-endpoint = <&dsi_in_panel>;
                };
            };

            tplcd: tplcd@0 {
                compatible = "tailorpixels,tth318bve","sitronix,st7701";
                reg = <0>;
//                reset-gpios = <&gpio 6 1 GPIO_ACTIVE_LOW>;
                rotation = <0>;
                fps = <50>;
                debug = <0>;
                port {
                    dsi_in_panel: endpoint {
                        remote-endpoint = <&dsi_out_panel>;
                    };
                };
            };
        };
    };

fragment@1 {
	target = <&ddc0>;
	__overlay__  {
		status = "okay";
	};
};

fragment@2 {
	target = <&ddc1>;
	__overlay__  {
		status = "okay";
	};
};

fragment@3 {
	target = <&hdmi0>;
	__overlay__  {
		status = "okay";
	};
};

fragment@4 {
	target = <&hdmi1>;
	__overlay__  {
		status = "okay";
	};
};

fragment@5 {
	target = <&hvs>;
	__overlay__  {
		status = "okay";
	};
};

fragment@6 {
	target = <&pixelvalve0>;
	__overlay__  {
		status = "okay";
	};
};

fragment@7 {
	target = <&pixelvalve1>;
	__overlay__  {
		status = "okay";
	};
};

fragment@8 {
	target = <&pixelvalve2>;
	__overlay__  {
		status = "okay";
	};
};

fragment@9 {
	target = <&pixelvalve3>;
	__overlay__  {
		status = "okay";
	};
};

fragment@10 {
	target = <&pixelvalve4>;
	__overlay__  {
		status = "okay";
	};
};

fragment@11 {
	target = <&v3d>;
	__overlay__  {
		status = "okay";
	};
};

fragment@12 {
	target = <&vc4>;
	__overlay__  {
		status = "okay";
	};
};

fragment@13 {
	target = <&txp>;
	__overlay__  {
		status = "okay";
	};
};

fragment@14 {
	target = <&fb>;
	__overlay__  {
		status = "disabled";
	};
};

fragment@15 {
	target = <&firmwarekms>;
	__overlay__  {
		status = "disabled";
	};
};

fragment@16 {
	target = <&vec>;
	__overlay__  {
		status = "disabled";
	};
};

fragment@17 {
	target = <&hdmi0>;
	__dormant__  {
		dmas;
	};
};

fragment@18 {
	target = <&hdmi1>;
	__dormant__  {
		dmas;
	};
};

fragment@19 {
	target-path = "/chosen";
	__overlay__  {
		bootargs = "snd_bcm2835.enable_hdmi=0";
	};
};

fragment@20 {
	target = <&dvp>;
	__overlay__  {
		status = "okay";
	};
};

fragment@21 {
	target = <&pixelvalve3>;
	__dormant__  {
		status = "okay";
	};
};

fragment@22 {
	target = <&vec>;
	__dormant__  {
		status = "okay";
	};
};

fragment@23 {
	target = <&aon_intr>;
	__overlay__  {
		status = "okay";
	};
};

__overrides__ {
        rotate =  <&tplcd>,"rotate:0";
        width =   <&tplcd>,"width:0";
        height =  <&tplcd>,"height:0";
        fps =     <&tplcd>,"fps:0";
        debug =   <&tplcd>,"debug:0";
};
Once this device tree overlay was copied into the initial section of /boot/config.txt, I could see the GPU was enabled, DSI was working, and all the pixelvalves were up and running.

2- Corrections to Device Setup Sequence

It appears the panel-sitronix-st7701.c driver source does not properly initialize the ST7701 device prior to the transmission of video data. With the device not yet initialized when video starts, thousands of data transmission failures occur (seen on screen and in logs). To resolve this, the following line was added to the panel-sitronix-st7701.c source in the st7701_probe() function:

Code: Select all

struct st7701 {
	struct drm_panel panel;
	...
};

static int st7701_probe(struct device *dev, struct st7701 **ret_st7701)
{
	...
	st7701->panel.prepare_prev_first = 1;   <<< added this line
	...
}
By setting the prepare_prev_first to non-zero in the drm_panel structure, the ST7701 device was initialized before any video data was transmitted.

With these two changes, the TailorPixels TTH318BVE LCD panel started to display video.

Return to “Compute Module”