msm8916-mainline / linux-mdss-dsi-panel-driver-generator

Generate Linux DRM panel kernel driver based on QCOM MDSS DSI device tree
GNU General Public License v2.0
53 stars 33 forks source link

Generator throws exception on missing panel property qcom,mdss-dsi-off-command-state = "dsi_lp_mode"; #10

Closed qwertyuiopzxcvbnmlkjhgfdsa1 closed 2 years ago

qwertyuiopzxcvbnmlkjhgfdsa1 commented 2 years ago

Generator throws error when trying to generate driver for panel Xiaomi A2 Lite. This was used for generation driver for ili7807_fhdplus_video (ili7807 fhdplus video mode dsi panel)

Debugged process and there was missing property in dtb qcom,mdss-dsi-off-command-state = "dsi_lp_mode"; How i discovered it and repaired it: a) Generate DTS, see Reproduce original bug below b) Patch panel.py by https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator/pull/6 c) Add qcom,mdss-dsi-off-command-state = "dsi_lp_mode"; to DTS c) DTS -> DTB d) Generate driver succesfully

Reproduce original bug: 1, Got boot img from https://forum.xda-developers.com/t/fastboot-daisy-patched-boot-img-for-v11-0-2-0-android-10.4064951/ 2, boot.img -> kernel.img python3 tools/unpackbootimg.py boot.img 3, dtbs extract-dtb kernel.img from https://pypi.org/project/extract-dtb/ 4, driver generation ./lmdpdg.py dtb/02_dtbdump_Qualcomm_Technologies,_Inc._MSM8953_+_PMI8937_Ext_Codec_MTP.dtb

Original Exception: WARNING: DCS command ENTER_SLEEP_MODE with incorrect argument count (expected: 0, is: 1). Consider using --dumb-dcs Parsing: ili7807_fhdplus_video (ili7807 fhdplus video mode dsi panel) Traceback (most recent call last): File "/tmp/linux-mdss-dsi-panel-driver-generator/./lmdpdg.py", line 69, in for panel in Panel.find(fdt): File "/tmp/linux-mdss-dsi-panel-driver-generator/panel.py", line 288, in find panel = Panel.parse(fdt, sub) File "/tmp/linux-mdss-dsi-panel-driver-generator/panel.py", line 282, in parse return name and Panel(name.as_str(), fdt, node) File "/tmp/linux-mdss-dsi-panel-driver-generator/panel.py", line 260, in init 'off': CommandSequence(fdt, mode_node, 'off') File "/tmp/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 "/usr/local/lib/python3.9/dist-packages/libfdt.py", line 451, in getprop pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name), File "/usr/local/lib/python3.9/dist-packages/libfdt.py", line 156, in check_err_null raise FdtException(val) libfdt.FdtException: pylibfdt error -1: FDT_ERR_NOTFOUND

Thank you for looking into this.

DTB File:

02_dtbdump_Qualcomm_Technologies,_Inc.MSM8953+_PMI8937_Ext_Codec_MTP.zip :

Original boot.img:

boot.zip :

stephan-gh commented 2 years ago

Hmm, I think it's best if you edit the DTB before using the generator in this case. There is little we can do if this property is missing since there is no way to guess it.

qwertyuiopzxcvbnmlkjhgfdsa1 commented 2 years ago

@Minecrell Could be the missing property printed out to output if program fails on it? It was very hard to discover what was causing failure.

From log there is written, unclearly. More specific info would be great. off': CommandSequence(fdt, mode_node, 'off') File "/tmp/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()) libfdt.FdtException: pylibfdt error -1: FDT_ERR_NOTFOUND

stephan-gh commented 2 years ago

I'm not opposed as long it doesn't require to add a print() before every single getprop() call. Not sure if there is a good way to do that.

stephan-gh commented 2 years ago

https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator/commit/e7dd1650786ed990bf47fe080c9a44fcce240e83

ERROR: Failed to get property: qcom,mdss-dsi-off-command-state