sonyxperiadev / bug_tracker

Empty repository that is used as a bugtracker for Open Devices project
52 stars 13 forks source link

[Tama][4.19][AOSP12][Apollo] Touchscreen not working #773

Open chippmann opened 2 years ago

chippmann commented 2 years ago

Platform: Tama Device: Apollo Kernel version: 4.19 Android version: 12.1 Software binaries version: v1c

Previously working on Not sure if relevant: Lineage OS 18.1

Description Touchscreen not working after boot and no ADB logs available as i cannot activate USB debugging.

The device was flashed using @MartinX3 build from 12-04-2022 and Android_12_4.19_v1c_tama OEM. I also built AOSP myself with the instructions provided at: Build AOSP 12L

Symptoms Touchscreen not working.

How to reproduce Either build AOSP with tag android-12.1.0_r3 or use @MartinX3 build from 12-04-2022, flash and boot it.

Additional context Had to flash both oem and system to both slots a and b manually to not get stuck in a bootloop.

chippmann commented 2 years ago

I hooked up a mouse to the device and was able to enable USB debugging. Here is the output of logcat -b all: logs.txt

chippmann commented 2 years ago

I think these are the relevant lines but TBH I have no real clue what I'm looking at as i have almost zero experience in this field:

06-02 03:36:26.727     0     0 E OF      : graph: no port node found in /soc/qcom,dsi-display-primary
06-02 03:36:26.727     0     0 I somc_panel_detect: Starting ADC Panel Detection...
06-02 03:36:26.727     0     0 I adc_panel_detect: Found panel ADC: 229682
06-02 03:36:26.727     0     0 I         : Found 2 panels in DT!
06-02 03:36:26.727     0     0 I dsi_panel_get: Panel Name = apollo default
06-02 03:36:26.727     0     0 E dsi_panel_driver_parse_gpios: touch-vddh-en gpio not present
06-02 03:36:26.727     0     0 E dsi_panel_driver_parse_gpios: failed get touch-int-gpio
06-02 03:36:26.727     0     0 E dsi_panel_driver_parse_gpios: failed get vddio-gpio
06-02 03:36:26.727     0     0 E dsi_panel_driver_parse_gpios: disp dcdc en gpio not specified
06-02 03:36:26.728     0     0 E dsi_panel_driver_parse_gpios: failed get vci enable gpio
06-02 03:36:26.728     0     0 E dsi_panel_driver_parse_gpios: failed get disp error flag gpio
06-02 03:36:26.728     0     0 I dsi_panel_driver_parse_power_cfg: Not configured touch vregs
06-02 03:36:26.728     0     0 E somc_panel_color_manager: somc_panel_parse_dt_colormgr_config:404, Unable to read pcc table
06-02 03:36:26.728     0     0 E somc_panel_color_manager: somc_panel_parse_dt_colormgr_config:418, Unable to read srgb_pcc table
06-02 03:36:26.728     0     0 E somc_panel_color_manager: somc_panel_parse_dt_colormgr_config:432, Unable to read vivid_pcc table
06-02 03:36:26.728     0     0 E somc_panel_color_manager: somc_panel_parse_dt_colormgr_config:445, Unable to read hdr_pcc table
06-02 03:36:26.728     0     0 I dsi_panel_driver_parse_dt: touch avdd power info not registered
06-02 03:36:26.728     0     0 I dsi_panel_driver_parse_dt: touch avdd power info not registered
06-02 03:36:26.728     0     0 I somc_panel_parse_dt_chgfps_config: Dynamic FPS not enabled. Skipping conf.
chippmann commented 2 years ago

Maybe this is linked to https://github.com/sonyxperiadev/bug_tracker/issues/351 and the corresponding fixes done in: https://github.com/sonyxperiadev/kernel/pull/2053/ and https://github.com/sonyxperiadev/kernel/pull/2076

bartcubbins commented 2 years ago

@chippmann please test https://github.com/sonyxperiadev/kernel/pull/2507 and https://github.com/sonyxperiadev/kernel-defconfig/pull/117

chippmann commented 2 years ago

I'm running into some issues trying to build the kernel. Google does not seem to use gcc anymore so i can't use their crosscompiler from their repo. I tried building it with a crosscompiler from linaro as stated as an option by the kernel building guide on sodp. But then i get a bunch of build errors regarding too many parameters for certain functions. Which has to be a problem with the crosscompiler (i think?). So what crosscompiler do you guys use nowadays?

An example of an error i get:

kernel/sched/fair.c: In function ‘idle_balance’:
kernel/sched/fair.c:11841:23: error: too many arguments to function ‘prefer_spread_on_idle’
  bool prefer_spread = prefer_spread_on_idle(this_cpu, true);
MarijnS95 commented 2 years ago

@chippmann SODP ships with kernel prebuilts nowadays, and that repo https://github.com/sonyxperiadev/kernel-sony-msm-4.19-common conveniently includes the script used to generate said prebuilts, so that you can do this on your own.

MarijnS95 commented 2 years ago

It seems no Tama device support has been added to this 4.19 prebuilts repo yet though... ?

MarijnS95 commented 2 years ago

Yuck, that's just the main branch being far behind. @jerpelea can you delete it and stick to aosp/LA.UM.9.12.r1 as default solely?

chippmann commented 2 years ago

@MarijnS95 Oh very nice thx! So if i understeand the procedure correctly i need to;

Or is it just:

Sorry if these questions seem stupid but this is still unclear to me.

MarijnS95 commented 2 years ago

Instead of the cumbersome "replacing" of repositories I'd take advantage of the fact that repo checks them out as git repositories with the repos from this organization set up as remotes. You could add @bartcubbins remotes, fetch his branches and check out the ones he created PRs from but it's easier to just fetch them directly through pull request references such as (example in the kernel): git fetch sony pull/2507/head && git checkout FETCH_HEAD (replicate for kernel-defconfig with PR number 117). Note that the official github-cli tool can automate this for you: as listed on the PR page this is just a gh pr checkout 2507 away.

don't delete any folders; those guides are horribly outdated and I've alerted Sony about this a million times by now :( - they should at least clarify that it applies to older Android versions or a different kernel copyleft entirely.

Don't run build_shared, run build-kernels-clang. You may want to adjust the script to only build the platform/device of your choosing though, instead of rebuilding them all.

chippmann commented 2 years ago

Wow that was extremely painless. Thx a lot! Now if i saw that correctly my output is just the <buildRoot>/kernel/sony/msm-4.19/common-kernel/dtbo-apollo.img. And now a simple make -j$(nproc) and reflashing boot.img and dtbo.img should be enough to test it right?

chippmann commented 2 years ago

I did that anyways and it seemed to work give that the logs state that the kernel was built on my build server: Linux version 4.19.188-gfed859490e5f-dirty (gaige@g-vs-bs01) (Android (7284624, based on r416183b) clang version 12.0.5 (https://android.googlesource.com/toolchain/llvm-project c935d99d7cf2016289302412d708641d52d2f7ee)) #1 SMP PREEMPT Fri Apr 22 16:44:45 UTC 2022

But not sure if i done everything correct.

In any case, the touchscreen is still not working and here are the logs (FYI @bartcubbins): logs_2.txt

Edit: let me know if I need to do something differently or test something else.

MarijnS95 commented 2 years ago

Now if i saw that correctly my output is just the <buildRoot>/kernel/sony/msm-4.19/common-kernel/dtbo-apollo.img.

There should also be kernel-dtb-apollo, but it seems you've got that from the second message.

Error is pretty clear:

06-07 06:48:59.470     0     0 E synaptics_tcm_i2c 2-003c: Error getting reset gpio
06-07 06:48:59.470     0     0 E synaptics_tcm_i2c 2-003c: syna_tcm_i2c_probe (line 437): Failed to parse dt
06-07 06:48:59.470     0     0 W synaptics_tcm_i2c: probe of 2-003c failed with error -2

Either a different revision of the TCM driver is imported, or the TCM DT was improperly ported from the previous kernel (presumably the latter).

chippmann commented 2 years ago

@MarijnS95 Yeah there is. I just overlooked it. But the build/flash procedure I mentioned would've been correct? I just flashed everything again this time just to be sure.

Just for my understanding; What's TCM DT (i mean the DT shorthand)?

MarijnS95 commented 2 years ago

Device tree, that's where the driver is configured and where seemingly the GPIO property (and perhaps others) is/are missing.

On this range of phones, and for kernel-related changes, only boot and dtbo are relevant for flashing.

chippmann commented 2 years ago

Gotcha. Thanks!

bartcubbins commented 2 years ago

Did you update the defconfig?

chippmann commented 2 years ago
gaige@g-vs-bs01:~/android/kernel/sony/msm-4.19/kernel/arch/arm64/configs/sony$ git status
On branch 912r1_tama_tcm
nothing to commit, working tree clean
gaige@g-vs-bs01:~/android/kernel/sony/msm-4.19/kernel/arch/arm64/configs/sony$ git rev-parse HEAD
28f829090a6ea3f06110bf39f60b0b72367585d0

Should be alright.

chippmann commented 2 years ago

For completeness sake same for kernel:

gaige@g-vs-bs01:~/android/kernel/sony/msm-4.19/kernel$ git status
On branch 912r1_tama_tcm
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   drivers/staging/wlan-qc/qca-wifi-host-cmn (new commits)
        modified:   drivers/staging/wlan-qc/qcacld-3.0 (new commits)

no changes added to commit (use "git add" and/or "git commit -a")
gaige@g-vs-bs01:~/android/kernel/sony/msm-4.19/kernel$ git rev-parse HEAD
fed859490e5f8da360d5b449442257385ef456e1
bartcubbins commented 2 years ago

Please do adb pull /proc/config.gz and attach it here

chippmann commented 2 years ago

Here you go: config.gz

Didn't knew one can pull those configs. It seems your defconfig changes are not applied as far as i can see.

I wonder what i did wrong then...

MarijnS95 commented 2 years ago

Defconfig changes must be "generated" to end up in the kernel repo.

@bartcubbins any justification for adding a copypaste driver specifically for Tama? Is it that different from the original TCM driver? Either way it seems to be missing from your PR.

bartcubbins commented 2 years ago

@chippmann Yes, the defconfig was not updated so the driver was not compiled.

@MarijnS95 The driver is quite different from the one that is already available and unfortunately I do not have the opportunity and Tama device with TCM touch to port and test all the required hacks to the existing driver. Sorry..

chippmann commented 2 years ago

What do you mean by generated? I just saw a script ~/android/kernel/sony/msm-4.19/kernel/arch/arm64/configs/sony/update_defconfig.sh. Do you mean that?

Looking at it's content I'm not 100% sure what it's purpose is but i suspect it merges the changes from base_tama_apollo_defconfig and aosp_tama_apollo_defconfig together?

Because looking at the extracted config, it only seems to contain stuff which is present in aosp_tama_apollo_defconfig but nothing from base_tama_apollo_defconfig.

MarijnS95 commented 2 years ago

@MarijnS95 The driver is quite different from the one that is already available and unfortunately I do not have the opportunity and Tama device with TCM touch to port and test all the required hacks to the existing driver. Sorry..

I know that we've accepted by now that it's okay for this downstream kernel to be messy, simply because it's not worth spending an inordinate amount of time and effort to make/keep it clean; it wasn't clean to begin with and we'll have Linux 500 with all these devices mainlined by the time such an effort might be finished (oh, the sweet 4.4/4.9 times where everything was unified). However, would you mind at least documenting this in the commit (and perhaps PR) message so that we won't be wondering about the same during the next porting phase?

What do you mean by generated? I just saw a script ~/android/kernel/sony/msm-4.19/kernel/arch/arm64/configs/sony/update_defconfig.sh. Do you mean that?

Yes.

Because looking at the extracted config, it only seems to contain stuff which is present in aosp_tama_apollo_defconfig but nothing from base_tama_apollo_defconfig.

aosp_tama_apollo_defconfig is the result of combining base_tama_apollo_defconfig with base_sdm845_defconfig and android-* files (note that the output file is not in the sony submodule, but part of the kernel directly. Once merged, there's a stable hash that @bartcubbins can create and push a "regenerate defconfig" commit for).

chippmann commented 2 years ago

@bartcubbins I did now regenerate the defconfig using update_defconfig.sh. Kernel: 06-07 20:24:04.982 0 0 I : Linux version 4.19.188-gfed859490e5f-dirty (gaige@g-vs-bs01) (Android (7284624, based on r416183b) clang version 12.0.5 (https://android.googlesource.com/toolchain/llvm-project c935d99d7cf2016289302412d708641d52d2f7ee)) #1 SMP PREEMPT Sat Apr 23 06:20:22 UTC 2022

Logs: logs_4.txt

Config.gz: config.gz

Looks ok this time as far as i can see.

But still no touch.

These log statements are also still present:

06-07 20:24:08.706     0     0 E OF      : graph: no port node found in /soc/qcom,dsi-display-primary
06-07 20:24:08.706     0     0 I somc_panel_detect: Starting ADC Panel Detection...
06-07 20:24:08.706     0     0 I adc_panel_detect: Found panel ADC: 229797
06-07 20:24:08.706     0     0 I         : Found 2 panels in DT!
06-07 20:24:08.706     0     0 I dsi_panel_get: Panel Name = apollo default
06-07 20:24:08.706     0     0 E dsi_panel_driver_parse_gpios: touch-vddh-en gpio not present
06-07 20:24:08.706     0     0 E dsi_panel_driver_parse_gpios: failed get touch-int-gpio
06-07 20:24:08.707     0     0 E dsi_panel_driver_parse_gpios: failed get vddio-gpio
06-07 20:24:08.707     0     0 E dsi_panel_driver_parse_gpios: disp dcdc en gpio not specified
06-07 20:24:08.707     0     0 E dsi_panel_driver_parse_gpios: failed get vci enable gpio
06-07 20:24:08.707     0     0 E dsi_panel_driver_parse_gpios: failed get disp error flag gpio
06-07 20:24:08.707     0     0 I dsi_panel_driver_parse_power_cfg: Not configured touch vregs

Could I've done something else wrong? Let me know if i can test/do something else.

Edit: ah but one difference: for the good i guess: Now: 06-07 20:24:10.670 0 0 E synaptics_tcm_i2c 2-003c: syna_tcm_i2c_probe (line 471): (null): Active panel not found, aborting probe Before: 06-07 06:48:59.470 0 0 E synaptics_tcm_i2c 2-003c: syna_tcm_i2c_probe (line 437): Failed to parse dt

bartcubbins commented 2 years ago

Nice. Please update this string and try again https://github.com/sonyxperiadev/kernel/blob/aosp/LA.UM.9.12.r1/arch/arm64/boot/dts/somc/somc-tama-touch_apollo.dtsi#L15 from parent = <&dsi_8>; to panel = <&dsi_default_panel &dsi_8>;

bartcubbins commented 2 years ago

@MarijnS95 I will update the description when I have the opportunity to reach the PC

chippmann commented 2 years ago

So the file now looks like this:

cat kernel/sony/msm-4.19/kernel/arch/arm64/boot/dts/somc/somc-tama-touch_apollo.dtsi 
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
 */

&qupv3_se5_i2c {
        synaptics_clearpad@2c {
                preset_x_max = <1079>;
                preset_y_max = <2159>;

                panel = <&dsi_4>;
        };

        synaptics_tcm@3c {
                parent = <&dsi_default_panel &dsi_8>;
        };
};

Touchscreen not working.

Logs: logs_5.txt

config.gz: config.gz

What i noticed though: During boot the android logo is not in the middle of the screen anymore. It's not in the top third of the screen -> expected?

Also Is there a way to check if the changes were actually applied?

The kernel build took a normal amount of time i guess but the system build was almost instantly done. Not too surprising if it only needed to repack stuff and not compile anything new but just to make sure...

chippmann commented 2 years ago

Oh i just noticed you also replaced parent with panel. Typo or wanted? I don't have that in my file as i overlooked it.

chippmann commented 2 years ago

Just replaced parent with panel so it looks like this:

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
 */

&qupv3_se5_i2c {
        synaptics_clearpad@2c {
                preset_x_max = <1079>;
                preset_y_max = <2159>;

                panel = <&dsi_4>;
        };

        synaptics_tcm@3c {
                panel = <&dsi_default_panel &dsi_8>;
        };
};

and I'm stuck at the sony logo.

bartcubbins commented 2 years ago

Please provide a log from 4.14 kernel to understand exactly which touchscreen your version of the device has

chippmann commented 2 years ago

Here you go: logs_aosp_11_2.txt

Used the build by MartinX3 provided here: https://forum.xda-developers.com/t/eol-sodp-rom-aosp-xz2-xz2c-xz3-sonyaosp-11-beta.4180835/

pegalus commented 1 year ago

Is there any progress here? I bought a second hand "Sony xperia xz2c" and stumbled across the same issue as above:

The touchscreen works like a charm with AOSP-11.0 and OEM Kernel 4.14

but for all ROMS based on OEM Kernel 4.19 the hardware buttons are working correctly but the touchscreen is not reacting at all!

I tested: AOSP-12.1 AOSP-13.0

I tried also combining OEM Kernel 4.14 with AOSP-12.1 ROM but it got stucked at the "Sony" screen which is probably expected behaviour, right?

I am open for and happy about any necessary tests you need to do to bring this issue forward.