[BPI-R2] Hdmi in uboot and linux

HI, i’ve trying to get hdmi working but i’ve not figured out how to change HDMI-Params (800x600x60Hz) in uboot. hdmi-port seems to be enabled by uboot, but TFT-Screen says wrong timing…maybe false resolution

i tried that in uEnv.txt:

screen=disp.screen0_output_type=4 disp.screen0_output_mode=5
#appending screen-var to abootargs
abootargs=setenv bootargs board=${board} console=${console} root=${root} service=${service} ${bootopts} ${screen}

and also tried to set these 2 options via setenv in uboot, both does not work…

params taken from here: http://linux-sunxi.org/Fex_Guide#disp_init_configuration

@garywang where in uboot is the screen-resolution defined (maybe 720p as img-name says)? i think i’ve found it: https://github.com/BPI-SINOVOIP/BPI-R2-bsp/blob/363f3b1679e48799a94ca83fc5a0beff65908781/mt-pack/mtk/bpi-r2/configs/BPI-R2-720P/sys_config.fex#L679

output_type = 3
output_mode = 5

changing type to 4 (vga) should fix it in uboot…

how to change it with uEnv.txt?

it should be a resulution, that is accepted by nearly all TFTs, also if connected via hdmi2vga-adapters

the if that is working i want to change cmdline and boot the system.

uboot does not know boot-command, but it is listed in help…

BPI-IoT> boot
Unknown command 'boot' - try 'help'
BPI-IoT> boot help
boot - boot default, i.e., run 'bootcmd'

“bootm” seems to load kernel-image but fails on CRC

in system (debian stretch) i tried to load drm-module, but i’ve got no fbdev

root@bpi-r2:~# find /lib/modules/4.14.13-bpi-r2 -name '*hdmi*'
/lib/modules/4.14.13-bpi-r2/kernel/drivers/gpu/drm/mediatek/mediatek-drm-hdmi.ko
/lib/modules/4.14.13-bpi-r2/kernel/sound/soc/codecs/snd-soc-hdmi-codec.ko
root@bpi-r2:~# modprobe mediatek-drm-hdmi
root@bpi-r2:~# [   86.517560] random: crng init done

root@bpi-r2:~# 
root@bpi-r2:~# dmesg | grep hdmi                                                                                                                       
root@bpi-r2:~# hwinfo --framebuffer                                                                                                                    
root@bpi-r2:~#

root@bpi-r2:~# lsmod
Module                  Size  Used by
mediatek_drm_hdmi      36864  0
drm_kms_helper        163840  1 mediatek_drm_hdmi
cfbfillrect            16384  1 drm_kms_helper
syscopyarea            16384  1 drm_kms_helper
cfbimgblt              16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
cfbcopyarea            16384  1 drm_kms_helper
fb                     53248  1 drm_kms_helper
drm                   380928  2 mediatek_drm_hdmi,drm_kms_helper

in linux i’ve tried that config, but no hdmi-out: mt7623n_evb_fwu_defconfig (7,6 KB)

mhm…in 4.4’s dts(i) there are also hdmi-nodes which are missing in 4.14…maybe i need to add them

	hdmi_phy: hdmi-phy@10209100 {
		compatible = "mediatek,mt7623-hdmi-phy",
			     "mediatek,mt2701-hdmi-phy";
		reg = <0 0x10209100 0 0x24>;
		clocks = <&apmixedsys CLK_APMIXED_HDMI_REF>;
		clock-names = "pll_ref";
		clock-output-names = "hdmitx_dig_cts";
		mediatek,ibias = <0xa>;
		mediatek,ibias_up = <0x1c>;
		#clock-cells = <0>;
		#phy-cells = <0>;
		status = "disabled";
	};
    	disp_rdma1: rdma@14012000 {
    		compatible = "mediatek,mt7623-disp-rdma",
    			     "mediatek,mt2701-disp-rdma";
    		reg = <0 0x14012000 0 0x1000>;
    		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>;
    		clocks = <&mmsys CLK_MM_DISP_RDMA1>;
    		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA1>;
    		mediatek,larb = <&larb0>;
    	};

	dpi0: dpi@14014000 {
		compatible = "mediatek,mt7623-dpi",
			     "mediatek,mt2701-dpi";
		reg = <0 0x14014000 0 0x1000>;
		interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>;
		clocks = <&mmsys CLK_MM_DPI1_DIGL>,
			 <&mmsys CLK_MM_DPI1_ENGINE>,
			 <&topckgen CLK_TOP_TVDPLL>;
		clock-names = "pixel",
			      "engine",
			      "pll";
		status = "disabled";
		port {
			dpi0_out: endpoint@0 {
				remote-endpoint = <&hdmi0_in>;
			};

			dpi0_in: endpoint@1 {
				remote-endpoint = <&bls_out>;
			};
		};
	};

	hdmi0: hdmi@14015000 {
		compatible = "mediatek,mt7623-hdmi",
			     "mediatek,mt8173-hdmi";
		reg = <0 0x14015000 0 0x400>;
		clocks = <&mmsys CLK_MM_HDMI_PIXEL>,
			 <&mmsys CLK_MM_HDMI_PLL>,
			 <&mmsys CLK_MM_HDMI_AUDIO>,
			 <&mmsys CLK_MM_HDMI_SPDIF>;
		clock-names = "pixel", "pll", "bclk", "spdif";
		pinctrl-names = "default";
		pinctrl-0 = <&hdmi_pin>;
		phys = <&hdmi_phy>;
		phy-names = "hdmi";
		mediatek,syscon-hdmi = <&mmsys 0x900>;
		cec = <&cec>;
		ddc-i2c-bus = <&hdmiddc0>;
		assigned-clocks = <&topckgen CLK_TOP_HDMI_SEL>;
		assigned-clock-parents = <&hdmi_phy>;
		status = "disabled";
		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;

				hdmi0_in: endpoint {
					remote-endpoint = <&dpi0_out>;
				};
			};
		};
	};
&hdmi0 {
	status = "okay";
};

&hdmi_phy {
	status = "okay";
};

regards Frank

change in uboot does not work ;( same timing error on tft

is that config used once? where to change that?

also tried to set it in uboot-console (setenv+saveenv+reset):

BPI-IoT> printenv
...
boot_disp.output_mode=5
boot_disp.output_type=4
...
disp.screen0_output_mode=5
disp.screen0_output_type=4

added dts-nodes in my github-repo hdmi-branch, but kernel seems not to be loaded…

hangs after uboot-message “starting kernel…” in debug-uart, no hdmi-out

one positive…i’ve figured out, how to boot out of uboot-prompt :wink:

bootmenu_2=3. Boot Linux from SD.=run boot10

so i have to enter “run boot10”, but i’m not figured out how default is set…

depending on http://www.denx.de/wiki/view/DULG/UBootEnvVariables i assume it should be bootcmd, but if i use printenv this is set to “No” :thinking:

back to kernel…in my repo i tried to merge full graphics-part…as i see hdmi0 depends only on hdmi_phy,hdmi_ddc0,dpi0,bls,mmsys,cec and pio.hdmi_pin

other tree contains immu,smi_common,larb0 with (mali,ovl,disp_rdma0/1,wdma),larb1,larb2

then i have dsi0 with mipi_tx0

and some standalone nodes like display_components,color,mutex,imgsys and vdecsys

which parts are needed to get only hdmi to work? only the directly linked nodes, so i can disable the other ones? in other words, do i need mali and the larb0-depencies for hdmi-out?

any idea?

Good luck, I’ve been trying for months to get HDMI working. The unit seems to AutoDetect the settings incorrectly on some HDMI devices and no amount of boot setting changes or running any of the usual commands after boot to change the settings seems to work.

1 Like

Maybe it is the auto_hpd-option in https://github.com/BPI-SINOVOIP/BPI-R2-bsp/blob/363f3b1679e48799a94ca83fc5a0beff65908781/mt-pack/mtk/bpi-r2/configs/BPI-R2-720P/sys_config.fex ?

I think we need vendor/gary to fix that :frowning:

@ryder.lee how far is the work on this? we have fixed the dts-nodes and applied the patch for iommu_v1 to get the Kernel booting

HDMI port is actually enabled by pre-loader (1st stage loader), but when the system boot to kernel we will reinitialize all display stuff in drm driver, so you don’t need to care about bootloader. If you want to change setting you can follow the KMS flow to do that. Or, there’s an easier way - change resolution from UI.

Currently in uboot seems to be resolution 720p is set which do not work with my test-tft and vga-converter so i tried to change the mode in uboot via console and code,but both not works

Kernel 4.14 is not ready yet. We have fixed dts-nodes and iommu-v1 to get it booting (crash in early kernel boot). Also activated drm but can’t get output.

That’s because we set HDMI in preloader not uboot. The bug (iommu) has been fixed: https://patchwork.kernel.org/patch/10185161/

We will support DRM/HDMI in v4.16 then you could backport to v4.14

1 Like

I had applied v2 of this patch…are the patches depending on each other or can i revert v2 and apply v4?

Either will do. But I’d prefer to use the latest one.

ok, reverted v2 and applied v4

kernel boots so far :wink: waiting for hdmi-patches :wink:

any idea how to change resolution in uboot? i want to set a vga-mode with resolution of 1024x768 see first post

@garywang how can i change hdmi-resolution in uboot?

i tried to change sys_config.fex https://github.com/frank-w/BPI-R2-4.4/commit/fd6a70def69fb6126503026e25cc5e2e10217e6c

i want vga-mode 1024x768 to ensure that my hdmi/vga-adapter and my test-tft show at least uboot

still waiting for kernel-patches…see some basic patches for dma which may be related, how far is the work?

Any idea about hdmi in uboot?

@Ryder.Lee how far is the work for mainline hdmi-support? I see some patches for drm which maybe related

Hmm, we will send related patches in next RC cycle as we have other high priority tasks.

Continuing the hdmi theme from What´s the best Practice to Build own Kernel thread.

I’ve built and ran latest Frank’s kernel. No errors in dmesg, Xorg has been started, but no framebuffer device is avaliable.

I can’t check monitors image right now, as my R2 is in different location. But according to logs everything seems fine. I’ll update my topic ASAP, when i check the monitor.

i have rebuild hdmi-kernel (with latest options till framebuffer-console) from

and uploaded to my gdrive: https://drive.google.com/open?id=1dJPz1REuIQiVfY4XliGOmGSZVDgT80Yc

1 Like

I’ve checked hdmi - it works. For now, without framebuffer, HDMI stays disabled unless Xorg server is started. So fo everyone, who want to test new kernel - make shure that X-server is configured.

Frank, I’ve also tested your precompiled kernel. Everything is Ok - no errors and HDMI works.

1 Like

do you see anyrhing before xserver starts? I have enabled framebuffer-console but maybe uenv.txt needs to be modified

http://linux-sunxi.org/Kernel_arguments

Here at end of console-paran (both: serial and framebuffer)

Can you send me your working xconfig?

No, but i’m working on it.