[BPI-R2] Hdmi in uboot and linux

i don’t know why it works before multiple time also with reboot after killing xserver…i have tried it again and now it does not work anymore with 4.16 :frowning:

but i have tried with 4.4, and have same behaviour…

i have no DEBUG-Flag in 4.4, but this errors came up after killing xserver the first time:

[   65.763056] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x300000 pa=0x0 larb=0 port=0                                                     
[   65.763167] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x301000 pa=0x0 larb=0 port=0                                                     
[   65.763212] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x304000 pa=0x0 larb=0 port=0                                                     
[   65.763308] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x300000 pa=0x0 larb=0 port=0                                                     
[   65.764035] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x301000 pa=0x0 larb=0 port=0                                                     
[   65.764065] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x302000 pa=0x0 larb=0 port=0                                                     
[   65.764094] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x304000 pa=0x0 larb=0 port=0                                                     
[   65.764123] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x305000 pa=0x0 larb=0 port=0                                                     
[   65.764153] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x307000 pa=0x0 larb=0 port=0                                                     
[   65.764182] mtk-iommu 10205000.mmsys_iommu: fault type=0x5 iova=0x308000 pa=0x0 larb=0 port=0

@DeadMeat hdmi is working in 4.14? for kernelcrash in wifi-driver did you reset mtk_wdt.c? Maybe this causes watchdog-crash…looks like same crash as here: R2 internal Wifi/BT (MT6625L) - Kernel 4.14.x/4.16

Hi, Frank, As for me there are no problems with hdmi in 4.14 - it’s works same way as in 4.16.

No progress with mtk_wdt.c/wifi/broken reboot for today. :frowning:

I see your last commit…you’ve removed wifi-driver as i suggested…

Which image do you use as base for testing? Are the wmt-tools available? I ask because you have no changes in files used by wifi-driver. Have you same crash with default main-kernel on same system?

i created 4.14-hdmi also in my repo and merged your commits into it for testing…

I’m using 2018-03-29-ubuntu-16.04-mate-desktop-bpi-r2-sd-emmc

I’m not shure

pi@bpi-iot-ros-ai:~$ aptitude search wmt
p   wmtemp                                                                                                         - WM dock applet displaying lm_sensors temperature values
p   wmtime                                                                                                         - Window Maker dockapp that displays the time and date
p   wmtop                                                                                                          - dockapp that displays 3 top memory or CPU using processes
p   wmtv                                                                                                           - Dockable video4linux TV player for WindowMaker

Only on hdmi-patched 4.14.

wmt-tools are not available via apt…these are compiled additionally but in latest official images they should be in /usr/bin (wmt_loader, wmt_loopback, stp_uart_launcher).

i have included wifi-driver in my build…will try it…it will crash if i try to enable wifi-driver, same procedure does not crash with 4.14-main (.44), so it’s a change with the hdmi-driver, hdmi itself works at least with 1080p, nice work… now we have to look why wifi crash => wifi-thread

it seems that you removed the wifi-related dts(i)-nodes…bpi-r2.dts.diff (2,4 KB) mt7623.dtsi.diff (3,5 KB) => fixed in my repo ( https://github.com/frank-w/BPI-R2-4.14/tree/4.14-hdmi ) by applying these 2 patches with -R

have you simply copied dts/dtsi from 4.16 to 4.14?

reverted dts(i) to 4.14-main, removed hdmi-related nodes and readded them from 4.16…works so far. here the full log (including bootloader+ wifi-init): 4.14-hdmi wlan.txt (115,7 KB)

also cleaned defconfig…only thing to do is fix warnings:

drivers/gpu/drm/mediatek/mtk_drm_drv.c:172:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  .main_path = mt2701_mtk_ddp_main,
               ^
drivers/gpu/drm/mediatek/mtk_drm_drv.c:174:14: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  .ext_path = mt2701_mtk_ddp_ext,
              ^
drivers/gpu/drm/mediatek/mtk_drm_drv.c:180:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  .main_path = mt8173_mtk_ddp_main,
               ^
In file included from ./include/linux/cdev.h:8:0,
                 from ./include/drm/drmP.h:36,
                 from drivers/gpu/drm/mediatek/mtk_dpi.c:14:
drivers/gpu/drm/mediatek/mtk_dpi.c: In function 'mtk_dpi_probe':
./include/linux/device.h:1346:36: warning: 'bridge_node' may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
                                    ^
drivers/gpu/drm/mediatek/mtk_dpi.c:731:27: note: 'bridge_node' was declared here
  struct device_node *ep, *bridge_node;
                           ^
In file included from drivers/gpu/drm/mediatek/mtk_drm_fbdev.c:14:0:
drivers/gpu/drm/mediatek/mtk_drm_fbdev.c: In function 'mtk_fbdev_probe':
./include/drm/drmP.h:175:2: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
  drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
  ^
drivers/gpu/drm/mediatek/mtk_drm_fbdev.c:61:6: note: 'err' was declared here
  int err;
      ^

fixed the warnings in my repo…

Have you tried your adapter?

@Ryder.Lee can you explain this hsync-values: Hdmi in uboot and linux ? For 1024x768@60 i need near 48khz…800x600 should be 38khz

Hello Frank,

when i compile, i get these two warnings:

drivers/gpu/drm/mediatek/mtk_drm_fbdev.c: In function 'mtk_fbdev_probe':
./include/drm/drm_print.h:236:2: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
  drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
  ^~~~~~~~~~~~~~
drivers/gpu/drm/mediatek/mtk_drm_fbdev.c:61:6: note: 'err' was declared here
  int err;
      ^~~
In file included from ./include/linux/cdev.h:8:0,
                 from ./include/drm/drmP.h:36,
                 from drivers/gpu/drm/mediatek/mtk_dpi.c:14:
drivers/gpu/drm/mediatek/mtk_dpi.c: In function 'mtk_dpi_probe':
./include/linux/device.h:1357:36: warning: 'bridge_node' may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
                                    ^~~~~~~~~
drivers/gpu/drm/mediatek/mtk_dpi.c:731:27: note: 'bridge_node' was declared here
  struct device_node *ep, *bridge_node;
                           ^~~~~~~~~~~

Which I have solved with the following changes.

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fbdev.c b/drivers/gpu/drm/mediatek/mtk_drm_fbdev.c
index 2bff6bc1c7b7..173fe6702841 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_fbdev.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_fbdev.c
@@ -78,17 +78,17 @@ static int mtk_fbdev_probe(struct drm_fb_helper *helper,

        info = drm_fb_helper_alloc_fbi(helper);
        if (IS_ERR(info)) {
+                err = PTR_ERR(info);
                DRM_DEV_ERROR(dev->dev, "failed to allocate framebuffer info, %d\n",
                        err);
-               err = PTR_ERR(info);
                goto out;
        }

        fb = mtk_drm_framebuffer_create(dev, &mode, private->fbdev_bo);
        if (IS_ERR(fb)) {
+                err = PTR_ERR(fb);
                DRM_DEV_ERROR(dev->dev, "failed to allocate DRM framebuffer, %d\n",
                        err);
-               err = PTR_ERR(fb);
                goto out;
        }
        helper->fb = fb;

and

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index c58b39f55374..40a111820e2d 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -782,16 +782,15 @@ static int mtk_dpi_probe(struct platform_device *pdev)
        if (ep) {
                bridge_node = of_graph_get_remote_port_parent(ep);
                of_node_put(ep);
-       }
-       if (!bridge_node) {
+               if (!bridge_node) {
                dev_err(dev, "Failed to find bridge node\n");
                return -ENODEV;
+               }
+               dev_info(dev, "Found bridge node: %pOF\n", bridge_node);
+               dpi->encoder.bridge = of_drm_find_bridge(bridge_node);
+               of_node_put(bridge_node);
        }

-       dev_info(dev, "Found bridge node: %pOF\n", bridge_node);
-
-       dpi->encoder.bridge = of_drm_find_bridge(bridge_node);
-       of_node_put(bridge_node);
        if (!dpi->encoder.bridge)
                return -EPROBE_DEFER;

could you also add nfs (at least as a client) to your defconfig.

When importing the changes over nfs at least the SD card slot is spared.

1 Like

You use 4.16 or 4.14? In one hdmi-branch i fixed both by initializing them with 0/NULL

err-patch makes more sense than my one…committed to 4.16-hdmi

added nfs-options to 4.16-main

I use the 4.16-hdmi branch which also works with the console. The Xserver quits his service with the following error message.

MESA-LOADER: failed to retrieve device information
gbm: failed to open any driver (search paths /usr/lib/arm-linux-gnueabihf/dri:${ORIGIN}/dri:/usr/lib/dri)
gbm: Last dlopen error: /usr/lib/dri/mediatek_dri.so: cannot open shared object file: No such file or directory
failed to load driver: mediatek
EGL_MESA_drm_image required.
xinit: connection to X server lost

any idea

There is no mediatek-dri…have you tried to install software-dri?

apt-get install libgl1-mesa-dri

yes is installed.

Is there a config entry, that forces xserver to load the software driver.

You can look if there is a /etc/X11/xorg.conf? In my test all config was done on the fly and this file does not exist

Which os do you use? Was xorg installed or have you done this?

I use debian stretch. How did you install the xserver with task desktop or individual packages.

startx brings me only a black screen with mouse pointer and can only kill by kill -9

xinit even a xterm that I can end with the input of exit

I installed lxde, it’s a full and light desktop environment

how do you fixed your xserver-issue?

yes lxde was a good tip.

I uninstalled everything and reinstalled task-lxde.

then it worked immediately with almost all resolutions

Can you create a post here: Searching testing people for hdmi + wifi in Kernel 4.16

With the following Informations:

  • kernel used (4.14/4.16)
  • operation system (debian/ubuntu with version)
  • resolutions and frequency (vsync)
  • adapters used (dvi/vga) if any
  • tested function (fbconsole/xorg)
  • problems

i merged hdmi-branch in 4.14-main and hdmi+wlan to 4.16-main and uploaded new precompiled kernels (4.14main+4.16-main)

1 Like

@DeadMeat have you tried porting hdmi+fbdev to 4.18?

@ryder.lee any progress on getting other (800x600,1024x768) resolutions to work?