Open phodina opened 1 year ago
cc @rinigus Our tama sodp Sailfish OS maintainer
For SFOS, we use Sony kernel sources with Jolla's patches and Tama config. Kernel and config are available at https://github.com/sailfishos-sony-tama/android_kernel_sony_msm . That one boots from storage just fine. But, as you can see, kernel version is 4.14.xxx
@rinigus thanks, but yes this issue "solely" concerns with PmOS on a mainline kernel.
(@phodina can you update the title with that? Afaik PmOS is also totally designed for and capable of running on older kernels)
Maybe SfOS can utilize that some day when we resolve more issues and missing features upstream.
Btw is this the commit that fixes the UFS? (on the downstream kernel)
commit cfd148999d17ad8f1a7cbce44bb108570ad631ad
Author: Angelo G. Del Regno <kholk11@gmail.com>
Date: Fri May 24 16:19:17 2019 +0200
scsi: ufs: Forward port Yoshino/Tama UFS quirks/hacks from OD k4.9
This is a forward port of the SoMC Yoshino and SoMC Tama quirks/hacks
for their UFS cards,
************* required to avoid a full UFS card erase *************
************* at kernel boot, which would *************
************* E R A S E T H E B O O T L O A D E R *************
.... taken from the current implementation found in the Open Devices
kernel 4.9 as of the current HEAD (24/05/2019) and partially
reimplemented for kernel 4.14.
BEWARE: DO NOT BOOT SoMC YOSHINO OR TAMA WITHOUT THIS COMMIT!!!!
------- BOOTING ONE OF THEM WITHOUT THIS COMMIT WILL PERMANENTLY
------- (HARD) BRICK YOUR DEVICE WITH ZERO CHANCES TO RECOVER IT.
mainline :wink:
That is the commit, and there should be a port to mainline somewhere but no-one dared to sacrifice their device to test it yet.
Sorry, yeah meant mainline.
Okay, let's leave it as the last thing to do in case it bricks the device ;-)
0001-arm64-dts-qcom-sdm845-tama-Set-serial-indices-and-st.zip try this
(unzip and then git am 0001-.....patch
)
Thanks @konradybcio for the patch. So the debug output has to be enabled in the patch in the kernel.
The bootloader has no such functionality and the logs before the kernel boots are therefore not accessible.
Another question regarding the UFS.
So the debug output has to be enabled in the patch in the kernel.
Yes, always. And this is mostly where you want to look as we've already gone through the work to make these kernels boot fully: if anything is up (and you get no USB for example), it'll be in the kernel logs.
The bootloader has no such functionality and the logs before the kernel boots are therefore not accessible.
Seems so, unfortunately. I was able to see them on Loire but that's a different (older) platform, YMMV on newer ones.
0001-arm64-dts-qcom-sdm845-tama-Set-serial-indices-and-st.zip try this
(unzip and then
git am 0001-.....patch
)
Since the patch just enables the UART how are the pins managed?
The Debug UART is on the SD card pins and I can see on the scope the CLK signal from the SD card controller to attempt to talk to the card.
Is there some mux that is also need to be enabled?
The modified micro SD card adapter I have has the micro SD card form factor and it triggers the Card Detect pin, that tells the kernel, there's a card inserted.
The LineageOS wiki entry lists 3 models. Do we know the differences?
0001-arm64-dts-qcom-sdm845-tama-Set-serial-indices-and-st.zip try this
(unzip and then
git am 0001-.....patch
)
I've applied the patch but didn't get any output. Probed the pins and the pads on the uSD inserted close the circuit if I connect my multimeter to the other side of the flex cable.
Typically dualsim and singlesim, and of that list H9436 has 6GB RAM whereas the others have 4.
0001-arm64-dts-qcom-sdm845-tama-Set-serial-indices-and-st.zip try this (unzip and then
git am 0001-.....patch
)I've applied the patch but didn't get any output. Probed the pins and the pads on the uSD inserted close the circuit if I connect my multimeter to the other side of the flex cable.
hmm.. I wonder if the tray detection kills off uart and kicks in sdcard.. do you think you could jerry rig pushing the sdcard adapter in without the tray?
0001-arm64-dts-qcom-sdm845-tama-Set-serial-indices-and-st.zip try this (unzip and then
git am 0001-.....patch
)I've applied the patch but didn't get any output. Probed the pins and the pads on the uSD inserted close the circuit if I connect my multimeter to the other side of the flex cable.
hmm.. I wonder if the tray detection kills off uart and kicks in sdcard.. do you think you could jerry rig pushing the sdcard adapter in without the tray?
That's my concern https://github.com/sonyxperiadev/bug_tracker/issues/799#issuecomment-1594210432.
I have dremel so I can remove part of the pcb.
Do we have some photo of something Sony or somebody else used in order to get the UART working?
Or can't we just revert the CD pin? Insertion disables the uSD card interface.
Good news. The issue was in loading the firmware. It was in incorrect path so using a framebuffer I could get to the logs and then modify accordingly the path.
@MarijnS95 In order to get the device supported in the PostmarketOS we'll have to pick the patches and apply it to the linux-postmarketos-sdm845
kernel.
Is my assumption correct that what's missing in the mainline is the display panel, display stream controller support and touch controller?
There are few things in the log that stand out:
Does the kernel need some patch in order to boot?
[ 0.000000] [Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader!
Is this connected with the failed firmware later?
[ 1.627170] qcom_scm firmware:scm: No available mechanism for setting download mode
loading of the firmware fails, the files are present under the path
[ 1.882729] remoteproc remoteproc0: remoteproc-adsp is available
[ 1.883596] remoteproc remoteproc0: Direct firmware load for qcom/sdm845/Sony/tama/adsp.mbn failed with error -2
[ 1.883727] remoteproc remoteproc0: powering up remoteproc-adsp
[ 1.883891] remoteproc remoteproc0: Direct firmware load for qcom/sdm845/Sony/tama/adsp.mbn failed with error -2
[ 1.883964] remoteproc remoteproc0: request_firmware failed: -2
[ 1.885721] remoteproc remoteproc1: remoteproc-cdsp is available
[ 1.886874] remoteproc remoteproc1: Direct firmware load for qcom/sdm845/Sony/tama/cdsp.mbn failed with error -2
[ 1.886960] remoteproc remoteproc1: powering up remoteproc-cdsp
[ 1.887150] remoteproc remoteproc1: Direct firmware load for qcom/sdm845/Sony/tama/cdsp.mbn failed with error -2
[ 1.887282] remoteproc remoteproc1: request_firmware failed: -2
Maybe some incorrect line in the DTS?
[ 1.917090] qcom_geni_serial a84000.serial: Invalid line 1
another firmware that does not load
[ 1.933812] ipa 1e40000.ipa: Direct firmware load for qcom/sdm845/Sony/tama/ipa_fws.mbn failed with error -2
[ 1.933923] ipa 1e40000.ipa: error -2 requesting "qcom/sdm845/Sony/tama/ipa_fws.mbn"
Some error regarding the GPU
[ 1.944994] qcom-venus: probe of aa00000.video-codec failed with error -61
Some issue with the cooling of the CPU, maybe thermal-zone is missing in the DTS or allowed frequencies?
[ 1.959894] __cpufreq_cooling_register: Failed to add freq constraint (-22)
[ 1.959963] cpufreq_cooling: cpu4 failed to register as cooling device: -22
Does the touchscreen driver require firmware or some config file in order to work? Do we have datasheet for this one?
[ 2.202917] atmel_mxt_ts 5-004a: Direct firmware load for maxtouch.cfg failed with error -2
Are the regulators missing in the DTS?
[ 2.213940] adreno 5000000.gpu: supply vdd not found, using dummy regulator
[ 2.214103] adreno 5000000.gpu: supply vddcx not found, using dummy regulator
No idea what's this about
[ 13.291100] qnoc-sdm845 1500000.interconnect: sync_state() pending due to 1e40000.ipa
[ 13.291133] qnoc-sdm845 1620000.interconnect: sync_state() pending due to 1e40000.ipa
[ 13.291146] qnoc-sdm845 1380000.interconnect: sync_state() pending due to 1e40000.ipa
[ 13.291160] qnoc-sdm845 1700000.interconnect: sync_state() pending due to 1e40000.ipa
[ 13.291177] qnoc-sdm845 1500000.interconnect: sync_state() pending due to aa00000.video-codec
[ 13.291189] qnoc-sdm845 1380000.interconnect: sync_state() pending due to aa00000.video-codec
[ 13.291200] qnoc-sdm845 1740000.interconnect: sync_state() pending due to aa00000.video-codec
[ 13.291231] qnoc-sdm845 17900000.interconnect: sync_state() pending due to aa00000.video-codec
[ 13.291243] qnoc-sdm845 17900000.interconnect: sync_state() pending due to 1e40000.ipa
[ 13.291274] qcom-rpmhpd 179c0000.rsc:power-controller: sync_state() pending due to aa00000.video-codec
[ 13.291302] qnoc-sdm845 17900000.interconnect: sync_state() pending due to a84000.serial
[ 13.291313] qnoc-sdm845 1500000.interconnect: sync_state() pending due to a84000.serial
[ 13.291324] qnoc-sdm845 1700000.interconnect: sync_state() pending due to a84000.serial
[ 13.291334] qcom-rpmhpd 179c0000.rsc:power-controller: sync_state() pending due to a84000.serial
The kernel logs seem to be filled with these messages
[ 360.542480] bw_kbps = 768000
[ 360.594661] bw_kbps = 1024000
[ 360.690544] bw_kbps = 768000
[ 360.694657] bw_kbps = 1024000
[ 360.762618] bw_kbps = 768000
[ 360.846607] bw_kbps = 1024000
[ 360.910822] bw_kbps = 768000
[ 360.915056] bw_kbps = 1024000
[ 360.983239] bw_kbps = 768000
[ 361.183290] bw_kbps = 1024000
[ 361.251341] bw_kbps = 768000
[ 361.351465] bw_kbps = 1024000
[ 361.420248] bw_kbps = 768000
[ 361.519625] bw_kbps = 1024000
[ 361.588175] bw_kbps = 768000
[ 361.771966] bw_kbps = 1024000
[ 361.840043] bw_kbps = 512000
[ 362.812130] bw_kbps = 1024000
[ 362.884225] bw_kbps = 768000
[ 362.928353] bw_kbps = 1024000
[ 363.000383] bw_kbps = 768000
[ 363.048298] bw_kbps = 1024000
[ 363.116381] bw_kbps = 768000
Also I noticed the touchscreen has input issues on the edges, same can be said if LineageOS runs on the device.
Is that due to missing configuration or support in the driver?
Sony has the Side Sense
feature which works on the edges. Do we now how it works? Is it implemented in the kernel or directly in the firmware of the touchscreen controller?
@phodina Thank you very much for your work Could you also add apollo and akari? :) These have two different panel id's but we only saw the two id's of apollo in the wild. It seems that the second kind of akari panel was never sold international)
@MartinX3 I can definitely add those.
Will there be volunteers to test the images on their devices?
Can you point out the panels? I'll have to port them later as well.
@phodina Thank you :)
Since I own only a single device I couldn't test it, but I could setup a build server and provide images on xda for volunteers like I already do for SODP AOSP on tama.
About the panel: Issue tickets:
PRs:
Sharing prebuild images through Github Actions (or also instructions) on XDA is a great idea.
Thanks for the Issues and PRs.
I'll add the Apollo and Akari and ping once done.
@MartinX3 Oki, so the device is now renamed to tama
and has the 3 subpackages.
[17:38:50] Device codename: tama
[17:38:54] Which kernel do you want to use with your device?
[17:38:54] Available kernels (3):
[17:38:54] * akari: Sony Xperia XZ2
[17:38:54] * akatsuki: Sony Xperia XZ3
[17:38:54] * apollo: Sony Xperia XZ2 Compact
Btw do we have a firmware for the tama
platform? I pulled this one from the device but have no clue which is the latest one.
I'll look later into building those images in automated fashion.
Btw does the tama
platform support avb_custom_key
partition for signing the builds and relocking the bootloader?
Btw does the
tama
platform supportavb_custom_key
partition for signing the builds and relocking the bootloader?
Found ticket that says only newer devices are supported
Also I noticed the touchscreen has input issues on the edges, same can be said if LineageOS runs on the device.
Is that due to missing configuration or support in the driver?
Sony has the
Side Sense
feature which works on the edges. Do we now how it works? Is it implemented in the kernel or directly in the firmware of the touchscreen controller?
I've found a thread on the XDA forum. So If my understanding is correct this feature is just APK and does not rely on any special functionality of the touch controller?
I just listens for all the touch events and in case it happens on the edges of the screen and it's evaluated as a double tap it launches the app container?
https://forum.xda-developers.com/t/sidesense-xperia-xz3-feature-for-other-xperia-device.3851426/
Btw does the
tama
platform supportavb_custom_key
partition for signing the builds and relocking the bootloader?
no
hmm.. I wonder if the tray detection kills off uart and kicks in sdcard.. do you think you could jerry rig pushing the sdcard adapter in without the tray?
Is there tray detection? I thought it was only SIM and SDCard detection, because the tray can be present with nothing in it... (at least that is the case for the SDCard cd
pin, afaik).
we'll have to pick the patches and apply it to the
linux-postmarketos-sdm845
kernel.
Sounds like unnecessary pain, wait until we land the rest in upstream instead of contributing to another downstream.
Is my assumption correct that what's missing in the mainline is the display panel, display stream controller support and touch controller?
Almost. Display Stream Compression but my patches for that should have made it into 6.3 or 6.4 already (the current DSC work is for newer hardware, sdm845 is a relic by comparison). Only the panel driver and DT for that is missing, and maybe a few minor bits and bobs. The touch controller should be upstream, I only have a patch to confirm a wakeup method.
TBH I'm not interested in your opinion on what's in dmesg. Please only spend bandwidth identifying and discussing actual issues.
video-codec
: this is not the GPU.[17:38:54] Which kernel do you want to use with your device? [17:38:54] Available kernels (3): [17:38:54] * akari: Sony Xperia XZ2 [17:38:54] * akatsuki: Sony Xperia XZ3 [17:38:54] * apollo: Sony Xperia XZ2 Compact
These should all use the same kernel, only differentiated by DTB(O), or is this a necessary hack to get pmOS to share things across the same device family (:vomiting_face:)? Fwiw nowadays most Sony phones are very similar (so far as generic mainline userspace drivers are concerned) and only differ by partition layout.
These should all use the same kernel, only differentiated by DTB(O), or is this a necessary hack to get pmOS to share things across the same device family (vomiting_face)? Fwiw nowadays most Sony phones are very similar (so far as generic mainline userspace drivers are concerned) and only differ by partition layout.
@MarijnS95 the kernel is the same, this is just "semantic" to select the right DTB across the same family.
Almost. Display Stream Compression but my patches for that should have made it into 6.3 or 6.4 already (the current DSC work is for newer hardware, sdm845 is a relic by comparison). Only the panel driver and DT for that is missing, and maybe a few minor bits and bobs. The touch controller should be upstream, I only have a patch to confirm a wakeup method.
In that case I won't go through the patches. In the meantime I'll try the 6.3.9
and 6.4-rc7
releases.
The idea is to have single mainline kernel + maybe some minor patches that are waiting to be accepted for the SDM845 devices.
Is there tray detection? I thought it was only SIM and SDCard detection, because the tray can be present with nothing in it... (at least that is the case for the SDCard cd pin, afaik).
Hm, you are probably right that it's for both the SIM and uSD card as the device just detects the tray as whole. Nevertheless you'd need to make some tray that does not trigger the CD pin in that case.
this is just "semantic"
Eww :joy:
In that case I won't go through the patches
Indeed, don't bother. There's a lot of dev-stuff... and it is available on mainline when it is available. Unless you really need it now and feel comfortable searching through our massive backlog.
Fwiw the panel is on the list already, but has seen many cleanups since.
Hm, you are probably right that it's for both the SIM and uSD card as the device just detects the tray as whole. Nevertheless you'd need to make some tray that does not trigger the CD pin in that case.
I'm saying that it's not, if I remember correctly the CARD detect pin only changes if there actually is a card, not if there's a tray.
Unless Tama/Akatsuki is different from the device I've last observed this at.
Well the UART is still on the backlog as the uSD card is the only storage currently available.
Is the UFS disabled because nobody yet tried the patches? Or tested and they didn't work?
maybe try taping over pins that aren't meant for serial..
Is the UFS disabled because nobody yet tried the patches? Or tested and they didn't work?
Because everyone including me is too scared to loose his own device. You said you've got a lab to restore a formatted UFS? Maybe you're our hope to test this patch. :D
Indeed, Akatsuki's Card Detect pin triggers on tray insertion, not based on a physical card being in the slot.
But you can easily turn off sdhc_2
to not have the pinmuxes fight.
Is the UFS disabled because nobody yet tried the patches? Or tested and they didn't work?
We discussed this to length before?
Because everyone including me is too scared to loose his own device. You said you've got a lab to restore a formatted UFS? Maybe you're our hope to test this patch. :D
Fair enough. Yes, I can replace the UFS as we have a lab at work where we changed some BGA eMMC and SoCs as part of R&D.
But my understanding is I can't just jump into LineageOS and do dd id=/dev/ufs of=backup.img
, right?
The partitions are stored as LUNs so not just the content but also this metadata needs to be backup.
@phodina now I'm very curious what you do for work :grimacing:
In theory dd
ing the full UFS block device should work? So /dev/sda
, not the individual partitions, that afaik includes all bytes on the block device including LUNs?
you won't get a full ufs backup, the secure side makes parts of it read-as-zeros
@konradybcio By the secure side you mean the Replay Protected Memory Block?
Do you know if it will be problem booting the system (The secure world side with Trust Zone)? If so soldering new UFS won't help (unless the secure firmware provisions the UFS). Though there are many videos on Youtube where people upgrade the storage and show the phone boots and recognizes the bigger storage. However can't say how genuine they are.
Is that area protected against wiping if the patch does not work? If it's kept they removing the chip, programming it in socket, reballing and putting it back might work. If it's wiped then the RPMB won't probably allow to be provisioned for the second time, right?
@phodina now I'm very curious what you do for work grimacing
In theory
dd
ing the full UFS block device should work? So/dev/sda
, not the individual partitions, that afaik includes all bytes on the block device including LUNs?
@MarijnS95 Working on biometric cameras something like Windows Hello :wink:
@konradybcio By the secure side you mean the Replay Protected Memory Block?
Both that and the hypervisor+trustzone+etc stack
Do you know if it will be problem booting the system (The secure world side with Trust Zone)? If so soldering new UFS won't help (unless the secure firmware provisions the UFS). Though there are many videos on Youtube where people upgrade the storage and show the phone boots and recognizes the bigger storage. However can't say how genuine they are.
Depends on the vendor.
Is that area protected against wiping if the patch does not work? If it's kept they removing the chip, programming it in socket, reballing and putting it back might work. If it's wiped then the RPMB won't probably allow to be provisioned for the second time, right?
Probably.
@MarijnS95 So I've applied the patch set to a mainline kernel and booted on the device.
Unfortunately I don't get anything on the display. The patches applied on the mainline without any issue and I just enabled the DRM_PANEL_SONY_AKATSUKI_LGD
. Not sure if I'm not missing some other config. Checked against the one from your repo and there isn't anything that would suggest otherwise IMHO.
https://gitlab.com/phodina/pmaports/-/commit/f972caefd2133add20bf2a90d7820626d962219a
@phodina you might be missing out on the DTS panel patch (and maybe the touchscreen patch):
Specifically: https://github.com/SoMainline/linux/commit/a628ddfefd98784b0af61f2f1dbdfaf4a1e2a293
If that doesn't work share a dmesg
. It's always tricky to pry a few relevant commits from such a massive history of in-progress work.
@MarijnS95 here's the dmesg log from booting to initramfs where I can get already display output on the SoMainline branch.
sony-mainline-akatsuki-panel-patches-initramfs.dmesg.txt sony-mainline-akatsuki-panel-patches-userspace.dmesg.txt
$ zcat /proc/config.gz | grep AKAT
CONFIG_DRM_PANEL_SONY_AKATSUKI_LGD=y
Also dumped from the device:
The panel definition is present there:
panel@0 {
reg = <0x00>;
vddio-supply = <0xcd>;
pinctrl-0 = <0xce 0xcf>;
pinctrl-1 = <0xd0 0xcf>;
pinctrl-names = "default\0sleep";
compatible = "sony,akatsuki-lgd";
reset-gpios = <0x79 0x06 0x00>;
port {
endpoint {
remote-endpoint = <0xd1>;
phandle = <0xcc>;
};
};
};
And yes the touchscreen won't work without the additional patches but that's currently known and not a concern as the display panel is important step to get output information.
where I can get already display output
@phodina does that mean it is working now (contrary to the comment before)? The dmesg looks good and I cannot tell what issues you are observing on which configuration.
Platform: Tama Device: XZ3 Kernel version: 6.4.0 Android version: None Software binaries version: edge
Hi, this is continuation of ticket to get PostmarketOS working on Tama XZ3. Currently it boots but do to the missing UFS drivers, that won't wipe the UFS storage the device needs workaround to boot off the SDcard.
https://github.com/sonyxperiadev/kernel/issues/2558
@MarijnS95 @jerpelea @konradybcio @Thaodan