map220v / sm8150-mainline

WIP Mainline kernel for Xiaomi Pad 5
Other
31 stars 15 forks source link

Does the drm suspend/wakeup works? #12

Open catmengi opened 6 months ago

catmengi commented 6 months ago

Does the drm/dsi suspend works, can i suspend my screen and the wakeup it without any crash and fatal for UX bugs. One important question, does hibernate to disk works? Eg, no crashes after resuming from image

catmengi commented 6 months ago

themagicmojoman

I have tested your fast boot kernels and boot images that I have built: v2boot_ubuntu.img from post #442: fast boot my first boot image: black screen after reverting "removed framebuffer" commit: kernel boot log → black screen (on; background light shimmers) v2boot_ubuntu.img from post #449: black screen v1boot_ubuntu.img from post #449: kernel boot log → black screen (on; background light shimmers) ; in combination with .dtb and .vmlinuz that I have compiled Conclusion: Kernel boots but system/graphics does not start correctly.

catmengi commented 6 months ago

Does this mean anything for you

themagicmojoman

I have tested your fast boot kernels and boot images that I have built: v2boot_ubuntu.img from post #442: fast boot my first boot image: black screen after reverting "removed framebuffer" commit: kernel boot log → black screen (on; background light shimmers) v2boot_ubuntu.img from post #449: black screen v1boot_ubuntu.img from post #449: kernel boot log → black screen (on; background light shimmers) ; in combination with .dtb and .vmlinuz that I have compiled Conclusion: Kernel boots but system/graphics does not start correctly.

map220v commented 6 months ago

Does this mean anything for you

themagicmojoman

I have tested your fast boot kernels and boot images that I have built: v2boot_ubuntu.img from post #442: fast boot my first boot image: black screen after reverting "removed framebuffer" commit: kernel boot log → black screen (on; background light shimmers) v2boot_ubuntu.img from post #449: black screen v1boot_ubuntu.img from post #449: kernel boot log → black screen (on; background light shimmers) ; in combination with .dtb and .vmlinuz that I have compiled Conclusion: Kernel boots but system/graphics does not start correctly.

DSI doesn't init properly, I need log for that

catmengi commented 6 months ago

DSI doesn't init properly, I need log for that

Did you have this issue before in other branches?

map220v commented 6 months ago

DSI doesn't init properly, I need log for that

Did you have this issue before in other branches?

Black screen issue happened in some branches(6.1-6.4), but it's was random and after few reboots dsi inits fine.

catmengi commented 6 months ago

Should i use CONFIG_USB_GADGET to connect my tablet to pc and establish network?

map220v commented 6 months ago

Should i use CONFIG_USB_GADGET to connect my tablet to pc and establish network?

It's already enabled, otherwise it wouldn't be possible to use CONFIG_USB_ETH

catmengi commented 6 months ago

Themagicmojoman said that usb typec "otg" didnt working, no reaction on keyboard and usb stick with led. I think we better move 6.7 back to default and apply UFS phy fix and dispcc required-opps fix. What do you think? Can we use working solution for debugging not working one,huh? Also does all crashes being written to pstore?

map220v commented 6 months ago

Themagicmojoman said that usb typec "otg" didnt working, no reaction on keyboard and usb stick with led. I think we better move 6.7 back to default and apply UFS phy fix and dispcc required-opps fix. What do you think? Can we use working solution for debugging not working one,huh? Also does all crashes being written to pstore?

USB doesn't work, because linux kernel paniced before usb initialization. I will add patches for 6.7 my ubuntu repo now builds both 6.7 and 6.8 kernels. Kernel logs always written to pstore, it starts earlier than most drivers.

catmengi commented 6 months ago

Sorry, i dont know how to use github actions,so im asking for you. How do i download builded kernel and rootfs from actions?

map220v commented 6 months ago

Sorry, i dont know how to use github actions,so im asking for you. How do i download builded kernel and rootfs from actions?

Next to pull requests select Actions, then latest workflow run, and there select one of artifacts. https://github.com/map220v/ubuntu-xiaomi-nabu/actions/runs/8360994443

catmengi commented 6 months ago

Did you add patches to nabu-6.7 branch?

catmengi commented 6 months ago

Can you push commits for UFS PHY and DISPCC(required-opps) fixes to 6.7 branch? Please

map220v commented 6 months ago

Can you push commits for UFS PHY and DISPCC(required-opps) fixes to 6.7 branch? Please

I pushed them now.

catmengi commented 6 months ago

Got logs from lesgar Log.txt log2.txt

map220v commented 6 months ago

Got logs from lesgar Log.txt log2.txt

It's nice to see that now UFS works fine, these logs didn't had anything usefull about dsi other than dsi error status 4, so now I need more verbose logs with "drm.debug=0x1ff log_buf_len=16M" in kernel cmdline.

catmengi commented 6 months ago

So today im going home and i will able to install linux on my tablet. Can you give me a link for instruction how to do this, and install efi bootloader? I saw one instruction but it was pretty old it even use partition called 'pmos'. And how i install grub, without ubuntu installed yet?

map220v commented 6 months ago

Here is install instruction: https://github.com/map220v/ubuntu-xiaomi-nabu/tree/master?tab=readme-ov-file#install-info

For creating partitions you need to "fastboot boot" this recovery, then in adb shell run these commands: sgdisk --resize-table 64 /dev/block/sda Increase partition entries of gpt table parted /dev/block/sda rm 31 Remove userdata

For 128Gb model: mkpart userdata ext4 10.9GB 69.7GB mkpart esp fat32 69.7GB 70.2GB mkpart linux ext4 70.2GB 126GB For 256Gb model: mkpart userdata ext4 10.9GB 120.3GB mkpart esp fat32 120.3GB 120.8GB mkpart linux ext4 120.8GB 254GB

set 32 esp on Mark as esp(not required for linux) quit Exit parted mkfs.f2fs -g android -O project_quota,extra_attr -f /dev/block/sda31 Format userdata mke2fs -t ext4 -F /dev/block/sda19 Format metdata(to remove old userdata key) mkfs.fat -F32 -s1 /dev/block/sda32 Format esp mke2fs -t ext4 -F /dev/block/sda33 Format linux

catmengi commented 6 months ago

Here is install instruction: https://github.com/map220v/ubuntu-xiaomi-nabu/tree/master?tab=readme-ov-file#install-info

For creating partitions you need to "fastboot boot" this recovery, then in adb shell run these commands: sgdisk --resize-table 64 /dev/block/sda Increase partition entries of gpt table parted /dev/block/sda rm 31 Remove userdata

For 128Gb model: mkpart userdata ext4 10.9GB 69.7GB mkpart esp fat32 69.7GB 70.2GB mkpart linux ext4 70.2GB 126GB For 256Gb model: mkpart userdata ext4 10.9GB 120.3GB mkpart esp fat32 120.3GB 120.8GB mkpart linux ext4 120.8GB 254GB

set 32 esp on Mark as esp(not required for linux) quit Exit parted mkfs.f2fs -g android -O project_quota,extra_attr -f /dev/block/sda31 Format userdata mke2fs -t ext4 -F /dev/block/sda19 Format metdata(to remove old userdata key) mkfs.fat -F32 -s1 /dev/block/sda32 Format esp mke2fs -t ext4 -F /dev/block/sda33 Format linux

Then i need to flash uefi bootloader to empty slot, and flash ubuntu via : fastboot flash linux [ubuntu file name]?

map220v commented 6 months ago

Here is install instruction: https://github.com/map220v/ubuntu-xiaomi-nabu/tree/master?tab=readme-ov-file#install-info For creating partitions you need to "fastboot boot" this recovery, then in adb shell run these commands: sgdisk --resize-table 64 /dev/block/sda Increase partition entries of gpt table parted /dev/block/sda rm 31 Remove userdata For 128Gb model: mkpart userdata ext4 10.9GB 69.7GB mkpart esp fat32 69.7GB 70.2GB mkpart linux ext4 70.2GB 126GB For 256Gb model: mkpart userdata ext4 10.9GB 120.3GB mkpart esp fat32 120.3GB 120.8GB mkpart linux ext4 120.8GB 254GB set 32 esp on Mark as esp(not required for linux) quit Exit parted mkfs.f2fs -g android -O project_quota,extra_attr -f /dev/block/sda31 Format userdata mke2fs -t ext4 -F /dev/block/sda19 Format metdata(to remove old userdata key) mkfs.fat -F32 -s1 /dev/block/sda32 Format esp mke2fs -t ext4 -F /dev/block/sda33 Format linux

Then i need to flash uefi bootloader to empty slot, and flash ubuntu via : fastboot flash linux [ubuntu file name]?

Yes, flash any UEFI bootloader that has secure boot disabled, I recommend this UEFI because it uses DXE's from Pad 5 insetad of MTP8150 that Renegade uses.

catmengi commented 6 months ago

Then need to boot kernel via fastboot, then install grub and vmlinuz and dtb images for grub? And install grub

map220v commented 6 months ago

Then need to boot kernel via fastboot, then install grub and vmlinuz and dtb images for grub? And install grub

Yes, use boot.img with mainline kernel and make sure it has "root=PARTLABEL=linux" in cmdline, then after booting linux replace linux-xiaomi-nabu with the one that has new zImage and dtb or replace zImage and dtb in /boot After that run sudo grub-install and sudo grub-mkconfig -o /boot/grub/grub.cfg then you can use UEFI to boot linux instead of legacy boot.img method.

catmengi commented 6 months ago

Can you trigger action on ubuntu build repo ti rebuild 6.7 kernel + rootfs?

map220v commented 6 months ago

Can you trigger action on ubuntu build repo ti rebuild 6.7 kernel + rootfs?

https://github.com/map220v/ubuntu-xiaomi-nabu/actions/runs/8401005928

catmengi commented 6 months ago

built kernel with your script, black screen, used nabu-6.7

catmengi commented 6 months ago

Also tried kernel that crash after bootlog on other tablets, but no image at all on mine. Fixed by erasing dtbo

catmengi commented 6 months ago

kernel stuck at usb detection it just infinite detecting usb something on usb 1-1

catmengi commented 6 months ago

UFS phy gives -EBUSY on 6.7,only 6.8 ufs work properly . Also systemd cant start services. Also no pstore is genereted, because 6.8 is not crashing(tested by usb), i can use script for taking out logs from dmesg instead of standart init

catmengi commented 6 months ago

script isnt worked, possible kernel crashes very early. Possibly we need to backport ufs fixes to 6.7 or use drm subsystem of 6.7 in 6.8. what do you think?

map220v commented 6 months ago

script isnt worked, possible kernel crashes very early. Possibly we need to backport ufs fixes to 6.7 or use drm subsystem of 6.7 in 6.8. what do you think?

For UFS issue in 6.7 I need UFS crash log For DSI issue in 6.8 I need full log with drm verbose enabled "drm.debug=0x1ff log_buf_len=16M"

Among these two problems, UFS should be easier to fix.

catmengi commented 6 months ago

script isnt worked, possible kernel crashes very early. Possibly we need to backport ufs fixes to 6.7 or use drm subsystem of 6.7 in 6.8. what do you think?

For UFS issue in 6.7 I need UFS crash log For DSI issue in 6.8 I need full log with drm verbose enabled "drm.debug=0x1ff log_buf_len=16M"

Among these two problems, UFS should be easier to fix.

6.7 doesnt crash when ufs returned -EBUSY, can be fixed) with dsi i cant even get logs. Also my system starting but systemd failuring to start services

map220v commented 6 months ago

script isnt worked, possible kernel crashes very early. Possibly we need to backport ufs fixes to 6.7 or use drm subsystem of 6.7 in 6.8. what do you think?

For UFS issue in 6.7 I need UFS crash log For DSI issue in 6.8 I need full log with drm verbose enabled "drm.debug=0x1ff log_buf_len=16M" Among these two problems, UFS should be easier to fix.

6.7 doesnt crash when ufs returned -EBUSY, can be fixed) with dsi i cant even get logs. Also my system starting but systemd failuring to start services

systemd doesn't start services properly only when rootfs is mounted as read only or for some other reason data cannot be written to partition.

catmengi commented 6 months ago

ufshcd-qcom 1d84000.ufshc: error -EBUSY: ufshcd_pltfrm_init() fail also it do: ufshcd-qcom 1d84000.ufshcd: ,controller enable failed ufshcd-qcom 1d84000.ufshc: ufshd_host_reset_and_restore: Host init failed with -5 pstore is empty, maybe try to boot from usb?

catmengi commented 6 months ago

Why do ufs_phy_lanes dont exist in 6.8 sm8150.dtsi, and it dont use them, it use ufs_phy instead of ufs_phy_lanes, maybe if i change ufs part of dtsi, it change its behavior to normal?https://github.com/map220v/sm8150-mainline/commit/935c76f7f85912962d72eceabdfa2c38c4c07f02

catmengi commented 6 months ago

that useless, even cant get out log, if i can boot to /bin/bash, no reation to usb keyboard

catmengi commented 6 months ago

How do i can get logs from 6.8, it has reaction to usb stick, led is blinking like normal,pc dont see table, script for dmesg isnt working, pstore isnt generated

map220v commented 6 months ago

How do i can get logs from 6.8, it has reaction to usb stick, led is blinking like normal,pc dont see table, script for dmesg isnt working, pstore isnt generated

If with any enabled USB gadget in configfs or other legacy gadgets PC doesn't detect tablet, then try changing otg to peripheral here https://github.com/map220v/sm8150-mainline/blob/8f4e58135eef3b49d91a4a2cfd8e208f624b4b53/arch/arm64/boot/dts/qcom/sm8150-xiaomi-nabu.dts#L1091

pstore probably just has header corrupted, thats why android kernel doesn't see it.

catmengi commented 6 months ago

How do i can get logs from 6.8, it has reaction to usb stick, led is blinking like normal,pc dont see table, script for dmesg isnt working, pstore isnt generated

If with any enabled USB gadget in configfs or other legacy gadgets PC doesn't detect tablet, then try changing otg to peripheral here

https://github.com/map220v/sm8150-mainline/blob/8f4e58135eef3b49d91a4a2cfd8e208f624b4b53/arch/arm64/boot/dts/qcom/sm8150-xiaomi-nabu.dts#L1091

pstore probably just has header corrupted, thats why android kernel doesn't see it.

Lesgar somehow got logs from 6.8 kernel from armbian? (His words) Maybe just try to mount linux partition in recovery and take a look at /var/log/syslog?

catmengi commented 6 months ago

I succesfully got systemd journal from 6.8, now unpacking it

catmengi commented 6 months ago

this is log from kernel with drm.debug=0x11f log.txt Edit: i used custom built kernel with your modules, probably this log will be useless as none of modules should be loaded because module folder have random ID after version and its mismatch with my kernel

LesGaR commented 6 months ago

IMG_20240324_205720 IMG_20240324_205618 ![Uploading IMG_20240324_205427.jpg…]() FullLog68s.zip [Uploading FullLog68s.txt…]() FullLog.zip Full log latest kernel 6.7 Kenel not boot all times, fail 2 or 3 times until boot. Kernel can suspend tablet only 2 times, next time when I try to suspend, noting happens.

Kernel 6.7 sometime boot and screen working and suspend sometimes. Kernel 6.8 never have screen

Please tell me if logs are good or need more info

map220v commented 6 months ago

These logs is exactly what I needed, thanks. From brief analysis I can already see that 6.8 has 2 times higher bclk and different timings calculated for some reason, 6.8 probably broke C-PHY support.

LesGaR commented 6 months ago

I see this patch, but I don't kow is related than your response https://patchwork.kernel.org/project/linux-arm-msm/cover/20231205032552.1583336-1-dmitry.baryshkov@linaro.org/

https://patchwork.kernel.org/project/linux-arm-msm/patch/20231205032552.1583336-7-dmitry.baryshkov@linaro.org/

I see pipa is in mainline in kernel 6.8, (I know the socket is diferent) but when I try to compile TWRP have same issues like nabu, only see 2cm in the top of screen. In crdroid recovery work fine, I don't know how they fixed, yet without your kernel hack Now can boot pipa in mainline and see logs, but screen not work if can fix screen, the logs of pipa are useful for you?

map220v commented 6 months ago

I see this patch, but I don't kow is related than your response https://patchwork.kernel.org/project/linux-arm-msm/cover/20231205032552.1583336-1-dmitry.baryshkov@linaro.org/

https://patchwork.kernel.org/project/linux-arm-msm/patch/20231205032552.1583336-7-dmitry.baryshkov@linaro.org/

I see pipa is in mainline in kernel 6.8, (I know the socket is diferent) but when I try to compile TWRP have same issues like nabu, only see 2cm in the top of screen. In crdroid recovery work fine, I don't know how they fixed, yet without your kernel hack Now can boot pipa in mainline and see logs, but screen not work if can fix screen, the logs of pipa are useful for you?

pipa has D-PHY and DSC, I don't think logs from it will help, on sm8250 Dual DSI and D-PHY should work fine, but DSC seem to be still broken https://gitlab.freedesktop.org/drm/msm/-/issues/41 As for recovery issue, I guess this hack was used in crdroid recovery.

catmengi commented 6 months ago

These logs is exactly what I needed, thanks. From brief analysis I can already see that 6.8 has 2 times higher bclk and different timings calculated for some reason, 6.8 probably broke C-PHY support.

Can you say me, which driver control C-PHY?

map220v commented 6 months ago

These logs is exactly what I needed, thanks. From brief analysis I can already see that 6.8 has 2 times higher bclk and different timings calculated for some reason, 6.8 probably broke C-PHY support.

Can you say me, which driver control C-PHY?

https://github.com/map220v/sm8150-mainline/blob/nabu-6.8/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c Search for "cphy_mode"

catmengi commented 6 months ago

These logs is exactly what I needed, thanks. From brief analysis I can already see that 6.8 has 2 times higher bclk and different timings calculated for some reason, 6.8 probably broke C-PHY support.

Can you say me, which driver control C-PHY?

https://github.com/map220v/sm8150-mainline/blob/nabu-6.8/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c Search for "cphy_mode"

I'l try to downgrade it, it should work if it really a problen

catmengi commented 6 months ago

Still the same issue, when switching from simple-framebuffer i have blackscreen, now it even crashes

catmengi commented 6 months ago

These logs is exactly what I needed, thanks. From brief analysis I can already see that 6.8 has 2 times higher bclk and different timings calculated for some reason, 6.8 probably broke C-PHY support.

do you have any ideas of fixing this? I read your link to issue, they have some kind of "image", but xiaomi nabu have full blank screen. But the kernel log console is fine this is very strange -_-, can you try to fix calculation of timing and bclk? Maybe this can be useful https://github.com/SoMainline/linux/commit/de905ea91d28de74b767236ae9b202b8270be4a3 https://github.com/somainline/linux/commits/marijn/panel-exclusives https://github.com/SoMainline/linux/commit/63f9c5742fc81478782894b5d8421ae8479ea902

map220v commented 6 months ago

These logs is exactly what I needed, thanks. From brief analysis I can already see that 6.8 has 2 times higher bclk and different timings calculated for some reason, 6.8 probably broke C-PHY support.

do you have any ideas of fixing this? I read your link to issue, they have some kind of "image", but xiaomi nabu have full blank screen. But the kernel log console is fine this is very strange -_-, can you try to fix calculation of timing and bclk? Maybe this can be useful SoMainline/linux@de905ea https://github.com/somainline/linux/commits/marijn/panel-exclusives SoMainline/linux@63f9c57

I will search for root of this problem later today. For now try disabling ktz8866 node and removing backlight from panel node, it can fix display graphics but only if backlight initializes after dsi and panel for some reason.