DRM Debugging - Black Screen w Backlight - Kernel Hikey970-v4.9

I have been trying to debug the DRM Driver in the 96Boards Kernel.
Using branch hikey970-v4.9

My board has LeUbuntu 16.04 from LeMaker Website loaded on it.
With no changes the display works properly and i have desktop.

If i build the kernel Using branch hikey970-v4.9 then replace
/boot/Image
/boot/hikey907_kirin970.dtb
with the Image and dtb from the build.

The hikey970 boots but the display is blank. It is on / Connected as the backlight is on but there is nothing but a black screen.

If you compare the DMESG Logs between the working kernel ( DISPLAY ) and Non-Working Kernel ( DISPLAY ) I have noted differences that may point to the cause of this issue.

I have uploaded my DMESG Logs to pastebin.

FULL DMESG LOG [ WORKING DISPLAY ]
https://pastebin.com/jQbZ0KDm
snippets where there are differences. SNIPPETT
https://pastebin.com/SqegE910


FULL DMESG LOG [ NO DISPLAY ]
https://pastebin.com/T5mSHTP8

snippets where there are differences. SNIPPETT
https://pastebin.com/vCUeEsJJ

I will try to explain the differences i see that i think are important.

DIFFERENC #1 {dma memory pool}

The working kernel creates a dma memory pool.
[ 0.000000] OF: reserved mem: initialized node graphic, compatible id hisi_ion
[ 0.000000] Reserved memory: created DMA memory pool at 0x0000000032200000, size 128 MiB
[ 0.000000] OF: reserved mem: initialized node drm_dma_mem_region, compatible id shared-dma-pool
[ 0.000000] cma: Reserved 64 MiB at 0x00000000b3400000

NON WORKING DOES NOT.

[ 0.000000] OF: reserved mem: initialized node graphic, compatible id hisi_ion
[ 0.000000] cma: Reserved 64 MiB at 0x00000000b3000000
[ 0.000000] On node 0 totalpages: 1566519


DIFFERENC #2 {kvm IDMAP address}

Working Kernel
[ 0.635892] kvm [1]: IDMAP page: ca0000

Broken Kernel
[ 0.656445] kvm [1]: IDMAP page: c3c000


DIFFERENC #3 { ADV7511 & drm_dma_mem_region }

Working Kernel
[ 0.769544] [drm] Initialized
[ 0.769916] [drm] the device node is dpe
[ 0.769953] [drm] the device remote node is dsi
[ 0.769983] kirin-drm e8600000.dpe: assigned reserved memory node drm_dma_mem_region
[ 0.770248] [drm] dss_pwm_clk:[80000000]->[83000000].
[ 0.770314] [drm] adv match_node ok
[ 0.770325] [drm] adv parse_dt ok , adv7511->type = 1 <0–ADV7511, 1–ADV7533>
[ 0.770411] [drm] adv75xx->vdd = 1800000
[ 0.770417] [drm] adv7533_init_regulators ok
[ 0.775440] [drm] adv get gpio_pd ok
[ 0.775510] [drm] adv devm_regmap_init_i2c ok
[ 0.775660] [drm] regmap_read ok, regmap_read Rev.= 20
[ 0.777965] [drm] host attach, client name=[mipi-hikey], id=1
[ 0.778076] [drm] dsi cur_client is 1 <0->hdmi;1->panel>
[ 0.778206] [drm] dss_version_tag=0x40.
[ 0.778244] [drm] dss irq = 64.

Broken Kernel
[ 0.790254] [drm] Initialized
[ 0.798007] [drm] the device node is dpe
[ 0.798022] [drm] the device remote node is dsi
[ 0.798271] [drm] dss_pwm_clk:[80000000]->[83000000].
[ 0.798288] Error: Driver ‘adv7511’ is already registered, aborting…
[ 0.805049] [drm] host attach, client name=[mipi-hikey], id=1

So it looks like the DRM initialization is failing on the ADV7511 driver and also no drm_dma_mem_region is being created. There are more differences after this occours but obviously the adv7511 needs corrected. It could be causing the other errors.


DIFFERENC #4 {Atomic Driver Called}

Working Kernel
[ 0.783106] [drm] host attach, client name=[adv7533], id=0
[ 0.783117] [drm] connector init
[ 0.783129] kirin-drm e8600000.dpe: bound e8601000.dsi (ops dsi_ops)
[ 0.783130] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 0.783132] [drm] No driver support for vblank timestamp query.
[ 0.783279] [drm] connected : regmap_read val = 0xf0
[ 0.783280] [drm] hdmi connector status = 1
[ 0.995529] random: fast init done

Broken Kernel
[ 0.810185] [drm] host attach, client name=[adv7533], id=0
[ 0.810306] [drm] connector init
[ 0.810320] kirin-drm e8600000.dpe: bound e8601000.dsi (ops dsi_ops)
[ 0.810322] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 0.810323] [drm] No driver support for vblank timestamp query.
[ 0.810328] [drm] num_crtc=1, num_connector=2.
[ 0.810338] [drm:drm_helper_disable_unused_functions] ERROR Called for atomic driver, this is not what you want.
[ 1.031983] random: fast init done

The working kernel outputs these lines.
[ 0.783279] [drm] connected : regmap_read val = 0xf0
[ 0.783280] [drm] hdmi connector status = 1

The broken kernel outputs theese lines.
[ 0.810328] [drm] num_crtc=1, num_connector=2.
[ 0.810338] [drm:drm_helper_disable_unused_functions] ERROR Called for atomic driver, this is not what you want.

I’m not sure what has caused this difference.
The kernel should not call
drm:drm_helper_disable_unused_functions


DIFFERENC #5 {fbdev->smem_start}

Working Kernel
[ 0.998356] [drm] kms: can’t enable cloning when we probably wanted to.
[ 0.999319] kirin-drm e8600000.dpe: fb0: frame buffer device
[ 1.014146] [drm] Initialized kirin 1.0.0 20170309 on minor 0

Broken Kernel
[ 1.035078] [drm] kms: can’t enable cloning when we probably wanted to.
[ 1.038707] [drm] fbdev->smem_start = 0x262144, fbdev->screen_base = 0xffff00000d001000
[ 1.038826] kirin-drm e8600000.dpe: fb0: dss frame buffer device
[ 1.055171] [drm] Initialized kirin 1.0.0 20170309 on minor 0


DIFFERENC #6 {hotplug event}

Working Kernel
2.021892] [drm] client change to HDMI
[ 2.021894] [drm] hotplug_event!!!
[ 2.022259] [drm] connected : regmap_read val = 0xf0
[ 2.022260] [drm] hdmi connector status = 1

[ 2.239489] [drm] isr_s1 = 0x10000!
[ 2.239492] [drm] isr_s2 = 0x11!
[ 2.241389] ALSA device list:
[ 2.241390] #0: hikey-hdmi

[ 3.129905] [drm] bl_level is 255
[ 3.129912] [drm] bl_level=255.
[ 3.133563] [drm] hotplug_event!!!
[ 3.134128] vgaarb: this pci device is not a vga device
[ 3.367504] [drm] connected : regmap_read val = 0xf0
[ 3.367511] [drm] hdmi connector status = 1

Broken Kernel
[ 2.086528] [drm] client change to HDMI

[ 2.303649] [drm] isr_s1 = 0x10000!
[ 2.303655] [drm] isr_s2 = 0x11!

DIFFERENC #7 {hotplug event again}

The working kernel outputs these lines.
[ 3.129905] [drm] bl_level is 255
[ 3.129912] [drm] bl_level=255.
[ 3.133563] [drm] hotplug_event!!!

The broken kernel outputs theese lines.
[ 2.962547] [drm] +.
[ 2.962572] [drm] dss_pwm_clk clk_enable successed, ret=0!

[ 3.170556] [drm] bl_level is 255
[ 3.170567] [drm] bl_level=255.

Please take a look at the full logs. Especially the areas where i not the differences. It seems probably best to start with the adv7511 as far as debugging goes. I am going to try a few patches and see what happens.

If you can point me in the right direction or help out here i’m sure many of us will appreciate it.