msm8953-mainline / linux

Linux mainline kernel with WIP patches for msm8953 devices
Other
106 stars 58 forks source link

drm: Add panel-mdss-otm1911-fhdplus #182

Closed andreabolognani closed 4 months ago

andreabolognani commented 4 months ago

This makes the display work on my xiaomi-daisy with postmarketOS edge.

The results are not perfect: I get

[  218.439096] panel-otm1911plus 1a94000.dsi.0: sending command 0xff failed: -22
[  218.439134] panel-otm1911plus 1a94000.dsi.0: Failed to un-initialize panel: -22
[  230.454949] [drm:mdp5_irq_error_handler [msm]] *ERROR* errors: 04000000

in dmesg when turning off and on the display, and the bottom right corner is somewhat darkened, as if part of the backlight hadn't been turned on. That cannot be seen in the initial "Android One" splash screen, so it's a software thing rather than a physical issue with the display.

Still, the previous situation was no graphical output at all, so this is quite a lot better already :)

M0Rf30 commented 4 months ago

Hi, please change your target branch to 6.7.9. Sounds strange that this variant is not extracted from dtb in panel generator

andreabolognani commented 4 months ago

I was not aware of that repo. I'll take a look and see if I can figure things out.

M0Rf30 commented 4 months ago

I was not aware of that repo. I'll take a look and see if I can figure things out.

seems that otm1911_fhdplus_video is not listed in daisy config

andreabolognani commented 4 months ago

Yup. With that added, the script generated the additional driver, which is slightly different from what I had. I'll try to see about building a 6.7.9-based kernel to try.

andreabolognani commented 4 months ago

In the meantime, here's a PR fixing the script: https://github.com/msm8953-mainline/linux-panel-drivers/pull/9

andreabolognani commented 4 months ago

Oh, so the new driver has been added to the 6.7.9/main branch already. Good.

It's slightly different than the one I had generated locally, somehow? I'll give the one that's already merged a shot. The local one doesn't seem to work. I get

[    2.521763] panel-otm1911plus 1a94000.dsi.0: sending command 0x0 failed: -22
[    2.521773] panel-otm1911plus 1a94000.dsi.0: Failed to initialize panel: -22
[    2.550888] [drm:mdp5_irq_error_handler [msm]] *ERROR* errors: 04000000

in dmesg and no image on the screen itself.

andreabolognani commented 4 months ago

Still no display output when building from 6.7.9/main, but it looks like most of the drivers have not been included somehow?

xiaomi-daisy:~$ find /lib/modules/ | grep panel
/lib/modules/6.7.9-postmarketos-qcom-msm8953/kernel/drivers/gpu/drm/panel
/lib/modules/6.7.9-postmarketos-qcom-msm8953/kernel/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.ko.gz
/lib/modules/6.7.9-postmarketos-qcom-msm8953/kernel/drivers/gpu/drm/panel/panel-edp.ko.gz
/lib/modules/6.7.9-postmarketos-qcom-msm8953/kernel/drivers/gpu/drm/panel/panel-lvds.ko.gz

I might have done something wrong. I'll try to figure it out later.

andreabolognani commented 4 months ago

Never mind, I think I know what's wrong:

$ git diff v6.7.9-r0..6.7.9/main
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 74e03001c5fa..43f01c954731 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -873,5 +873,4 @@ config DRM_PANEL_XINPENG_XPP055C272
          Say Y here if you want to enable support for the Xinpeng
          XPP055C272 controller for 720x1280 LCD panels with MIPI/RGB/SPI
          system interfaces.
-source "drivers/gpu/drm/panel/msm8953-generated/Kconfig"
 endmenu
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 25d2b2489ea2..e07ee8f83617 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -89,4 +89,3 @@ obj-$(CONFIG_DRM_PANEL_VISIONOX_VTDR6130) += panel-visionox-vtdr6130.o
 obj-$(CONFIG_DRM_PANEL_VISIONOX_R66451) += panel-visionox-r66451.o
 obj-$(CONFIG_DRM_PANEL_WIDECHIPS_WS2401) += panel-widechips-ws2401.o
 obj-$(CONFIG_DRM_PANEL_XINPENG_XPP055C272) += panel-xinpeng-xpp055c272.o
-obj-y += msm8953-generated/

So I guess it's not surprising that the drivers are missing...

andreabolognani commented 4 months ago

I built the 6.7.9 kernel with the otm1911-fhdplus driver and it the panel works.

I still get

[    2.886015] [drm:mdp5_irq_error_handler [msm]] *ERROR* errors: 04000000

in dmesg and backlight wonkiness in the bottom right corner. Any idea what could be done about that?

barni2000 commented 4 months ago

Oh, so the new driver has been added to the 6.7.9/main branch already. Good.

It's slightly different than the one I had generated locally, somehow? I'll give the one that's already merged a shot. The local one doesn't seem to work. I get

[    2.521763] panel-otm1911plus 1a94000.dsi.0: sending command 0x0 failed: -22
[    2.521773] panel-otm1911plus 1a94000.dsi.0: Failed to initialize panel: -22
[    2.550888] [drm:mdp5_irq_error_handler [msm]] *ERROR* errors: 04000000

in dmesg and no image on the screen itself.

Because it is generated with this https://github.com/msm8953-mainline/linux-mdss-dsi-panel-driver-generator/tree/alikates/test

barni2000 commented 4 months ago

I built the 6.7.9 kernel with the otm1911-fhdplus driver and it the panel works.

I still get

[    2.886015] [drm:mdp5_irq_error_handler [msm]] *ERROR* errors: 04000000

in dmesg and backlight wonkiness in the bottom right corner. Any idea what could be done about that?

it should be checked with other dt from twrp, you can ignore this error message every device has it.

barni2000 commented 4 months ago

I built the 6.7.9 kernel with the otm1911-fhdplus driver and it the panel works. I still get

[    2.886015] [drm:mdp5_irq_error_handler [msm]] *ERROR* errors: 04000000

in dmesg and backlight wonkiness in the bottom right corner. Any idea what could be done about that?

it should be checked with other dt from twrp, you can ignore this error message every device has it.

try pull it out with adb pull /sys/firmware/fdt and regenerate your driver check if it is changing with it.

andreabolognani commented 4 months ago

I switched the copy of linux-mdss-dsi-panel-driver-generator used by msm8953-mainline/linux-panel-drivers to the branch you referred to then pulled the dtb from the latest twrp, replaced dtb/xiaomi-daisy.dtb with it and ran generate.sh. This resulted in the following error:

Parsing: ili7807_fhdplus_video (ili7807 fhdplus video mode dsi panel)
ERROR: Failed to get property: qcom,mdss-dsi-off-command-state
Traceback (most recent call last):
  File "/home/abologna/src/upstream/msm8953-mainline/linux-panel-drivers/linux-mdss-dsi-panel-driver-generator/lmdpdg.py", line 80, in <module>
    panel = Panel.parse(fdt, offset)
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/abologna/src/upstream/msm8953-mainline/linux-panel-drivers/linux-mdss-dsi-panel-driver-generator/panel.py", line 314, in parse
    return name and Panel(name.as_str(), fdt, node)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/abologna/src/upstream/msm8953-mainline/linux-panel-drivers/linux-mdss-dsi-panel-driver-generator/panel.py", line 269, in __init__
    'off': CommandSequence(fdt, mode_node, 'off')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/abologna/src/upstream/msm8953-mainline/linux-panel-drivers/linux-mdss-dsi-panel-driver-generator/panel.py", line 139, in __init__
    self.state = CommandSequence.State(fdt.getprop(node, f'qcom,mdss-dsi-{cmd}-command-state').as_str())
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/abologna/src/upstream/msm8953-mainline/linux-panel-drivers/linux-mdss-dsi-panel-driver-generator/fdt2.py", line 32, in getprop
    return super().getprop(nodeoffset, prop_name, quiet)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/libfdt.py", line 448, in getprop
    pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/libfdt.py", line 153, in check_err_null
    raise FdtException(val)
libfdt.FdtException: pylibfdt error -1: FDT_ERR_NOTFOUND

so I commented out the line for ili7807_fhdplus_video from config/xiaomi-daisy.sh in order to move forward. With that out of the way, I ran generate.sh again, which produced no changes in the otm1911_fhdplus_video driver.

I tried extracting the text representation of the two dtb files using dtc -O dts -o xiaomi-daisy.dts -I dtb xiaomi-daisy.dtb, here are the differences:

--- dtb/xiaomi-daisy.orig.dts   2024-03-09 18:42:08.363089403 +0100
+++ dtb/xiaomi-daisy.twrp.dts   2024-03-10 00:17:21.426113986 +0100
@@ -12082,7 +12082,6 @@
                qcom,mdss-dsi-off-command = [39 01 00 00 00 00 04 ff 78 07 00 39 01 00 00 14 00 02 28 00 39 01 00 00 78 00 02 10 00];
                qcom,mdss-dsi-panel-timings = <0x29402c01 0x767a3044 0x34030400>;
                qcom,mdss-dsi-panel-timings-phy-v2 = <0x2520090c 0x60304a0 0x2520090c 0x60304a0 0x2520090c 0x60304a0 0x2520090c 0x60304a0 0x251e090a 0x60304a0>;
-               qcom,mdss-dsi-off-command-state = "dsi_lp_mode";
                qcom,mdss-dsi-t-clk-post = <0x0e>;
                qcom,mdss-dsi-t-clk-pre = <0x35>;
                qcom,mdss-dsi-CE_on-command-state = "dsi_hs_mode";
@@ -12482,7 +12481,10 @@
    };

    chosen {
-       bootargs = "sched_enable_hmp=1 sched_enable_power_aware=1";
+       pureason = <0x800a1>;
+       linux,initrd-end = <0x14895929>;
+       linux,initrd-start = <0x13600000>;
+       bootargs = "sched_enable_hmp=1 sched_enable_power_aware=1 console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 androidboot.bootdevice=7824900.sdhci earlycon=msm_hsl_uart,0x78af000 veritykeyid=id:5560e7863b4d8118c2f1b065595cf93bb2447992 androidboot.fastboot=1 buildvariant=eng androidboot.emmc=true androidboot.verifiedbootstate=orange androidboot.veritymode=enforcing androidboot.keymaster=1 ddr_sorting=success androidboot.serialno=09c3e66e0805 androidboot.secureboot=1 androidboot.bootloader=MSM8953_DAISY2.0_20200109154211 androidboot.baseband=msm mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_otm1911_fhdplus_video:wpoint=303373:1:none:cfg:single_dsi androidboot.slot_suffix=_b skip_initramfs rootwait ro init=/init  root=/dev/mmcblk0p57";
    };

    aliases {
@@ -12508,7 +12510,7 @@

    memory {
        device_type = "memory";
-       reg = <0x00 0x00 0x00 0x00>;
+       reg = <0x00 0x10000000 0x00 0x70000000 0x00 0x80000000 0x00 0x80000000>;
    };

    firmware {

The qcom,mdss-dsi-off-command-state line being removed is in the ili7807_fhdplus_video section, and seems to match the error message perfectly.

Any other ideas?

andreabolognani commented 4 months ago

Looking at the dmesg from inside twrp:

<4>[    1.488375] mdss_dsi_get_dt_vreg_data: error reading ulp load. rc=-22
<4>[    1.488390] mdss_dsi_get_dt_vreg_data: error reading ulp load. rc=-22
<4>[    1.488402] mdss_dsi_get_dt_vreg_data: error reading ulp load. rc=-22
<6>[    1.489074] mdss_dsi_ctrl_probe: DSI Ctrl name = MDSS DSI CTRL->0
<3>[    1.489589] mdss_dsi_find_panel_of_node: cmdline:0:qcom,mdss_dsi_otm1911_fhdplus_video:wpoint=303373:1:none:cfg:single_dsi panel_name:qcom,mdss_dsi_otm1911_fhdplus_video
<6>[    1.489651] mdss_dsi_panel_init: Panel Name = otm1911 fhdplus video mode dsi panel
<6>[    1.489763] mdss_dsi_panel_timing_from_dt: found new timing "qcom,mdss_dsi_otm1911_fhdplus_video" (ffffffc0df60b208)
<3>[    1.489780] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-post-panel-on-command
<3>[    1.489788] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-timing-switch-command
<4>[    1.489793] mdss_dsi_panel_get_dsc_cfg_np: cannot find dsc config node:
<3>[    1.489880] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-cold_gamma-command
<3>[    1.489888] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-warm_gamma-command
<3>[    1.489895] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-default_gamma-command
<3>[    1.489903] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-PM1-command
<3>[    1.489911] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-PM2-command
<3>[    1.489918] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-PM3-command
<3>[    1.489926] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-PM4-command
<3>[    1.489933] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-PM5-command
<3>[    1.489941] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-PM6-command
<3>[    1.489949] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-PM7-command
<3>[    1.489956] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-PM8-command
<3>[    1.489971] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-idle-on-command
<3>[    1.489979] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-idle-off-command
<6>[    1.489998] mdss_dsi_parse_panel_features: ulps feature disabled
<6>[    1.490004] mdss_dsi_parse_panel_features: ulps during suspend feature disabled
<6>[    1.490011] mdss_dsi_parse_dms_config: dynamic switch feature enabled: 0
<3>[    1.490081] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-lp-mode-on
<3>[    1.490089] mdss_dsi_parse_dcs_cmds: failed, key=qcom,mdss-dsi-lp-mode-off
<4>[    1.490156] mdss_dsi_get_dt_vreg_data: error reading ulp load. rc=-22
<4>[    1.490167] mdss_dsi_get_dt_vreg_data: error reading ulp load. rc=-22
<4>[    1.490177] mdss_dsi_get_dt_vreg_data: error reading ulp load. rc=-22
<4>[    1.490188] mdss_dsi_get_dt_vreg_data: error reading ulp load. rc=-22
<4>[    1.490212] 1a94000.qcom,mdss_dsi_ctrl0 supply vdd not found, using dummy regulator
<3>[    1.490445] mdss_dsi_parse_ctrl_params:4304 Unable to read qcom,display-id, data=0000000000000000,len=20
<6>[    1.490458] mdss_dsi_parse_gpio_params: bklt_en gpio not specified
<3>[    1.490508] msm_dss_get_res_byname: 'dsi_phy_regulator' resource not found
<3>[    1.490518] mdss_dsi_retrieve_ctrl_resources+0x178/0x1fc->msm_dss_ioremap_byname: 'dsi_phy_regulator' msm_dss_get_res_byname failed
<6>[    1.490524] mdss_dsi_retrieve_ctrl_resources: ctrl_base=ffffff80017b4000 ctrl_size=400 phy_base=ffffff80017b6400 phy_size=580
<3>[    1.490540] init_te_irq:liujia  irq = 31
<6>[    1.490683] dsi_panel_device_register: Continuous splash enabled
<6>[    1.490957] adding framebuffer device 1a94000.qcom,mdss_dsi_ctrl0
<4>[    1.491175] lcm mdss_dsi_panel_power_on msm_dss_enable_vreg enter
<4>[    1.493459] lcm mdss_dsi_panel_power_on msm_dss_enable_vreg out
<4>[    1.493476] lcm mdss_dsi_panel_reset  enable enter
<4>[    1.493485] lcm mdss_dsi_panel_reset  enable out
<6>[    1.494253] mdss_dsi_ctrl_probe: Dsi Ctrl->0 initialized, DSI rev:0x10040002, PHY rev:0x2
<6>[    1.494402] mdss_dsi_status_init: DSI status check interval:5000
<6>[    1.495321] adding framebuffer device soc:qcom,mdss_wb_panel
<6>[    1.495849] fb0: split_mode:0 left:0 right:0
<6>[    1.496444] FrameBuffer[0] 1080x2280 registered successfully!
<6>[    1.496781] fb1: split_mode:0 left:0 right:0
<6>[    1.496886] FrameBuffer[1] 640x640 registered successfully!

It looks like they're using a completely different driver: https://github.com/TeamWin/android_kernel_xiaomi_daisy/blob/android-8.1/drivers/video/msm/mdss/mdss_dsi_panel.c

M0Rf30 commented 4 months ago

I merged the panel generator output here https://github.com/msm8953-mainline/linux/commit/0982d74cc6a3c00db2af7bc961e360f439e5e0d6

Can you try latest 6.7.9 commits?

andreabolognani commented 4 months ago

I'm currently running 6.7.9/main, commit 909afc5300fa4bf506ae116f5f8bf186262e202c, so that's included. As mentioned above the display works, but the backlight is a bit off (bottom right corner is noticeably dimmer than the rest).

andreabolognani commented 4 months ago

Is the backlight controlled by the same driver as the panel, or is that possibly a separate one?

barni2000 commented 4 months ago

https://github.com/msm8953-mainline/linux/pull/183

andreabolognani commented 4 months ago

@barni2000 thanks! I'm away from home right now and I don't have my xiaomi-daisy with me, but I'll give it a try next week for sure :)

andreabolognani commented 4 months ago

@barni2000 I can confirm that this fixed the backlight issue completely for me. Thanks a lot!