Skip to content
Noralf Trønnes edited this page Mar 23, 2024 · 4 revisions

Some debugging info

drm.debug

The drm.debug module parameter controls what is logged to the kernel log.

# Log DRIVER and KMS category
# add to kernel command line: drm.debug=0x06
# OR
$ echo 0x06 | sudo tee /sys/module/drm/parameters/debug

# reloading the driver module let's us see the commands loaded from the firmware file
$ sudo rmmod panel_mipi_dbi && sudo modprobe panel-mipi-dbi

$ dmesg
[ 1528.947178] [drm:drm_mode_debug_printmodeline] Modeline "320x240": 0 0 320 320 320 320 240 240 240 240 0x0 0x0
[ 1528.947257] panel-mipi-dbi-spi spi0.0: supply power not found, using dummy regulator
[ 1528.948064] [drm:mipi_dbi_spi_init [drm_mipi_dbi]] SPI speed: 65MHz
[ 1528.948674] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] size=130 version=1
[ 1528.948709] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command 28
[ 1528.948736] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command cf 00 83 30
[ 1528.948762] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command ed 64 03 12 81
[ 1528.948787] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command e8 85 01 79
[ 1528.948811] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command cb 39 2c 00 34 02
[ 1528.948835] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command f7 20
[ 1528.948859] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command ea 00 00
[ 1528.948883] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command c0 26
[ 1528.948907] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command c1 11
[ 1528.948930] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command c5 35 3e
[ 1528.948954] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command c7 be
[ 1528.948977] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command 3a 05
[ 1528.949000] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command b1 00 1b
[ 1528.949024] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command f2 08
[ 1528.949048] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command 26 01
[ 1528.949071] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command e0 1f 1a 18 0a 0f 06 45 87 32 0a 07 02 07 05 00
[ 1528.949095] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command e1 00 25 27 05 10 09 3a 78 4d 05 18 0d 38 3a 1f
[ 1528.949119] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command b7 07
[ 1528.949143] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command b6 0a 82 27 00
[ 1528.949166] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command 11
[ 1528.949190] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] sleep 100ms
[ 1528.949213] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command 29
[ 1528.949237] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] sleep 100ms
[ 1528.949260] panel-mipi-dbi-spi spi0.0: [drm:panel_mipi_dbi_commands_from_fw [panel_mipi_dbi]] command 36 28
[ 1528.949669] [drm:mipi_dbi_dev_init_with_formats [drm_mipi_dbi]] rotation = 0
[ 1528.951964] panel-mipi-dbi-spi spi0.0: [drm:drm_sysfs_connector_hotplug_event] [CONNECTOR:31:SPI-1] generating connector hotplug event
[ 1528.952093] [drm] Initialized panel-mipi-dbi 1.0.0 20220103 for spi0.0 on minor 0
...
[ 1528.962002] [drm:mipi_dbi_fb_dirty [drm_mipi_dbi]] Flushing [FB:36] 320x240+0+0
[ 1528.964745] [drm:mipi_dbi_typec3_command [drm_mipi_dbi]] cmd=2a, par=00 00 01 3f
[ 1528.965033] [drm:mipi_dbi_typec3_command [drm_mipi_dbi]] cmd=2b, par=00 00 00 ef
[ 1528.965227] [drm:mipi_dbi_typec3_command [drm_mipi_dbi]] cmd=2c, len=153600

Backlight

# turn off backlight
$ echo 4 | sudo tee /sys/class/backlight/*/bl_power

# turn on backlight
$ echo 0 | sudo tee /sys/class/backlight/*/bl_power

$ cat /sys/class/backlight/*/brightness
1

modetest

A tool for simple driver testing.

Display a test image:

$ modetest -M panel-mipi-dbi -s 31:320x240
setting mode 320x240-60.00Hz on connectors 31, crtc 34

See: https://github.com/notro/gud/wiki/Debug#modetest

debugfs

Turn on and off display (pixels):

$ echo 28 | sudo tee /sys/kernel/debug/dri/0/command
$ echo 29 | sudo tee /sys/kernel/debug/dri/0/command

Dump MIPI DCS commands (if the controller is readable):

$ sudo cat /sys/kernel/debug/dri/0/command
04: 000000
06: 00
07: 00
08: 00
09: 94530400
0a: 9c
0b: 28
0c: 05
0d: 00
0e: 00
0f: c0
2e: 0000
3e: 0000
45: 00
52: 00
54: 00
56: 00
5f: 00
a1: 00
a8: 00

SPI trace

Event tracing can be used to see what's been written to the controller:

$ sudo apt install trace-cmd

$ sudo trace-cmd start -e spi:spi_transfer_start
$ sudo trace-cmd show
<...>
    kworker/u8:0-1371    [001] .... 56488.437992: spi_transfer_start: spi0.0 6a13c37b len=1 tx=[2a] rx=[]
    kworker/u8:0-1371    [001] .... 56488.438062: spi_transfer_start: spi0.0 6a13c37b len=4 tx=[00-00-01-3f] rx=[]
    kworker/u8:0-1371    [001] .... 56488.438137: spi_transfer_start: spi0.0 6a13c37b len=1 tx=[2b] rx=[]
    kworker/u8:0-1371    [001] .... 56488.438203: spi_transfer_start: spi0.0 6a13c37b len=4 tx=[00-00-00-ef] rx=[]
    kworker/u8:0-1371    [001] .... 56488.438277: spi_transfer_start: spi0.0 1c3c9519 len=1 tx=[2c] rx=[]
    kworker/u8:0-1371    [001] .... 56488.438456: spi_transfer_start: spi0.0 2a1b0fd1 len=65532 tx=[...] rx=[]
    kworker/u8:0-1371    [001] .... 56488.459568: spi_transfer_start: spi0.0 aa8fc3e1 len=65532 tx=[...] rx=[]
    kworker/u8:0-1371    [001] .... 56488.480712: spi_transfer_start: spi0.0 14c13493 len=22536 tx=[...] rx=[]
<...>

# command short list
$ sudo trace-cmd -h
  commands:
     record - record a trace into a trace.dat file
     start - start tracing without recording into a file
     stop - stop the kernel from recording trace data
     show - show the contents of the kernel tracing buffer
     reset - disable all kernel tracing and clear the trace buffers
     clear - clear the trace buffers
     report - read out the trace stored in a trace.dat file
Clone this wiki locally