msm8953-mainline / linux

Linux mainline kernel with WIP patches for msm8953 devices
Other
115 stars 60 forks source link

Xiaomi MI A2 Lite Daisy - touchpad does not work #33

Closed qwertyuiopzxcvbnmlkjhgfdsa1 closed 10 months ago

qwertyuiopzxcvbnmlkjhgfdsa1 commented 2 years ago

On my phone display, which has display ILITEK ili7807-fdhplus 1080x2280 video and probably touchpad gt917d is not working.

This is my personal issue for tracking the status , but everyone is of course free and welcome to help. Inspiration here: https://github.com/goodix/goodix_gt9xx_public

https://github.com/LineageOS/android_kernel_xiaomi_msm8953/blob/lineage-18.1/arch/arm64/boot/dts/qcom/apq8053-lite-dragon-v2.2.dtsi

Daisy config here: https://github.com/qwertyuiopzxcvbnmlkjhgfdsa1/xiaomi-daisy-touchpad-config

UPDATE2: Configuration is correctly applied, remaining issue is with IRQ. There is a function which tries to find description in devices radix tree structure by irq 0, but there is no description, thus it fails. Debugging why it happend.

UPDATE3:IRQ=0 it could be parent irq, nobody knows much

ARCHIVE

Old Open questions:

1, Is my touchpad really goodix gt917d? 2, Is gt917s, which is base of this work actually working for anyone? I doubt that those two original lines work, there should be surely different values:
reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>; irq-gpios = <&tlmm 65 GPIO_ACTIVE_HIGH>; 3, How to get know what value holds magic strings like "IRQ_TYPE_EDGE_FALLING"? 4, Some debuging - howto get more debug on boot? 5, Why AVDD28 is uppercase? And how original author know what names to use? 6, Datasheet for gt917d are not to be found. There are only for gt917s. Strange.

M0Rf30 commented 2 years ago

It's correct

vldly commented 2 years ago
  1. Try to find productinfo in sysfs (probably in /sys/class/input/*/device).
  2. No, person who contributed it has focaltech.
  3. I wouldn't compare any magic values to downstream ones. Those depends on how driver uses it. Also pinephone with gt917s uses IRQ_TYPE_LEVEL_HIGH. It might be right value for you too.
  4. I suggest loglevel=7 debug log_buf_len=10M in cmdline and
    CONFIG_DYNAMIC_DEBUG=y
    CONFIG_DEBUG_DRIVER=y
    CONFIG_DEBUG_DEVRES=y
  5. Author of the touchscreen driver chosen so. Check dt-bindings and driver source to know more.
  6. Hopefully those are similar enough. But if it doesn't just work you can only rely on downstream source then. If you actually have 917d and it's similar gt917s you may want to add chip_id entry to the driver, because it defaults to gt9x_chip_data.
apolemus commented 2 years ago

Assuming that downstream uses this driver, 917D seems rather similar to 967 or something than to 917S, doesn’t it?

REG_CONFIG_DATA is set to 0x8047 and not 0x8050 like for the 917S in the upstream driver.

And these cfg groups are 186 and 228 bits long – but not 240 like for the 917S. Why there are different cfg groups actually...

So I tried adding some chip_id entry combinations to mainline driver but wasn’t successful. In sysfs my 917D appears anyway but gives no output. I would like to test 4. but have no time for that atm.

vldly commented 2 years ago

Assuming that downstream uses this driver, 917D seems rather similar to 967 or something than to 917S, doesn’t it?

You're right, i was judging just by model number.

And these cfg groups are 186 and 228 bits long – but not 240 like for the 917S. Why there are different cfg groups actually...

No idea. But because of CONFIG_OF being set it will parse it from dt instead and it's 228 bytes there, just like on 967.

In sysfs my 917D appears anyway but gives no output.

So it probed successfully? It might need the reset and config to work properly. You can easily create it by cat /proc/device-tree/<path>/goodix,cfg-group0 > /sdcard/goodix_917D_cfg.bin on android.

qwertyuiopzxcvbnmlkjhgfdsa1 commented 2 years ago

@vldly Do you think is it possible to get this info without rooted phone?

cat /proc/device-tree//goodix,cfg-group0 > /sdcard/goodix_917D_cfg.bin

@apolemus I will extract config from android(have two same phones - one with pmos, second with android) and make it disponible soon.

apolemus commented 2 years ago

You can easily create it by cat /proc/device-tree//goodix,cfg-group0 > /sdcard/goodix_917D_cfg.bin on android.

I compiled the sequence you’ve given (and several other versions from different sources before) with this script, put it in /lib/firmware and got this:

xiaomi-daisy:~$ dmesg | grep Goodix
[   18.750445] Goodix-TS 3-005d: ID 917D, version: 501c
[   18.806238] input: Goodix Capacitive TouchScreen as /devices/platform/soc@0/78b7000.i2c/i2c-3/3-005d/input/input4

But it doesn’t work yet.

Before adding it, dmesg looks like this:

[   18.430649] Goodix-TS 3-005d: ID 917D, version: 501c
[   18.430757] Goodix-TS 3-005d: Direct firmware load for goodix_917D_cfg.bin failed with error -2
[   18.453243] input: Goodix Capacitive TouchScreen as /devices/platform/soc@0/78b7000.i2c/i2c-3/3-005d/input/input4
apolemus commented 2 years ago

I had still gt917s as compatible in device tree. With gt967 I get (with and without firmware in /lib/firmware):

xiaomi-daisy:~$ dmesg | grep Goodix
[   18.049977] Goodix-TS 3-005d: Error reading 1 bytes from 0x8140: -6
[   18.078625] Goodix-TS 3-005d: ID \xeeM\x94\x8c, version: a9d9
[   18.101183] input: Goodix Capacitive TouchScreen as /devices/platform/soc@0/78b7000.i2c/i2c-3/3-005d/input/input3

So it’s not only.

Edit: Sorry, that was not triggered by my change but after pmbootstrap pull somehow. But interesting anyway.

qwertyuiopzxcvbnmlkjhgfdsa1 commented 2 years ago

@apolemus Configuration for touchpad and other configurations are here. Look into firmware directory https://github.com/qwertyuiopzxcvbnmlkjhgfdsa1/xiaomi-daisy-touchpad-config

autumnull commented 2 years ago

I am also having this problem -- is there any further progress on a fix?

qwertyuiopzxcvbnmlkjhgfdsa1 commented 2 years ago

Last progress is here: https://github.com/qwertyuiopzxcvbnmlkjhgfdsa1/linux/tree/msm8953-5.16

What is working there so far: -added 917d to driver -when you copy configuration goodix_917D_cfg.bin to /lib/firmware, it is loaded

There is remaining problem with IRQ...somehow the device gets the wrong IRQ(0). Then in manage.c there is line desc = irq_to_desc(irq); where description should be get from device tree(in radix tree structure). But for IRQ=0 there is nothing in device tree.

Was asking for this, how to get the right IRQ -> this is set automatically, there is probe function which set up many settings for drivers, i think setting anything in dts wont help. Somebody replied, that the irq number is got from parent device. Not sure what do to now, tried with irq-flags = <2>; al well, does not help.

So there is progress, but i am stuck, not having knowledge, how to proceed next. So abandoning this task for now.

psyhlo commented 2 years ago

Hello, how can i help with this problem i have the same phone but not sure which touchpad? i have install postmarketos and boots but no touch response so far how can i check which model touch panel i have?

apolemus commented 2 years ago

You can get some information out of dmesg (e.g. dmesg | grep Goodix). Also the goodix gt917d shows up in sysfs. But like above discussed, this works but there is no output anyway.

psyhlo commented 2 years ago

i have gt917s found it in /sys/devices/platform/soc@0/78b7000.i2c/i2c-3/3-005d/name if any want some info from my device, just tell i'll try something on my own

xiaomi-daisy:~$ dmesg | grep Goodix [ 18.279106] Goodix-TS 3-005d: ID 917D, version: 501c [ 18.279269] Goodix-TS 3-005d: Direct firmware load for goodix_917D_cfg.bin failed with error -2 [ 18.301759] input: Goodix Capacitive TouchScreen as /devices/platform/soc@0/78b7000.i2c/i2c-3/3-005d/input/input4

psyhlo commented 2 years ago

i found this driver for kernel 3.18 https://github.com/anjum51/android_kernel_xiaomi_onclite/tree/884c3832d9e115fcd45cd15bda25f5edaeac29f2/drivers/input/touchscreen and for 4.x https://github.com/LineageOS/android_kernel_xiaomi_msm8953/tree/lineage-19.1/drivers/input/touchscreen/gt9xx_v2.8 has someone tried to port it?

apolemus commented 2 years ago

No, that will probably make different problems. It’s highly likely that the Goodix touchscreen driver in mainline will work also for this gt917d. Probably we just have to adjust the daisy dts for getting the irq correctly working. But somehow everyone with this problem has not the knowledge yet how to do that. ;)

psyhlo commented 2 years ago

i'm going to try porting it to mainline. Will see what difference will make

alikates commented 1 year ago

Hi, any update with this?

Mr-Yuling commented 1 year ago

On my phone display, which has display ILITEK ili7807-fdhplus 1080x2280 video and probably touchpad gt917d is not working.

This is my personal issue for tracking the status , but everyone is of course free and welcome to help. Inspiration here: https://github.com/goodix/goodix_gt9xx_public

https://github.com/LineageOS/android_kernel_xiaomi_msm8953/blob/lineage-18.1/arch/arm64/boot/dts/qcom/apq8053-lite-dragon-v2.2.dtsi

Daisy config here: https://github.com/qwertyuiopzxcvbnmlkjhgfdsa1/xiaomi-daisy-touchpad-config

UPDATE2: Configuration is correctly applied, remaining issue is with IRQ. There is a function which tries to find description in devices radix tree structure by irq 0, but there is no description, thus it fails. Debugging why it happend.

UPDATE3:IRQ=0 it could be parent irq, nobody knows much

ARCHIVE ###Old Open questions: 1, Is my touchpad really goodix gt917d? 2, Is gt917s, which is base of this work actually working for anyone? I doubt that those two original lines work, there should be surely different values: reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>; irq-gpios = <&tlmm 65 GPIO_ACTIVE_HIGH>; 3, How to get know what value holds magic strings like "IRQ_TYPE_EDGE_FALLING"? 4, Some debuging - howto get more debug on boot? 5, Why AVDD28 is uppercase? And how original author know what names to use? 6, Datasheet for gt917d are not to be found. There are only for gt917s. Strange.

I use redmi 6pro (the same as Mi A2 Lite),also has display ili7807-fdhplus,but it can not display.

qwertyuiopzxcvbnmlkjhgfdsa1 commented 1 year ago

Do not have phone any longer, but found driver, which may be perhaps inspiration https://gitlab.com/postmarketOS/pmaports/-/merge_requests/3963

Mr-Yuling commented 1 year ago

Do not have phone any longer, but found driver, which may be perhaps inspiration https://gitlab.com/postmarketOS/pmaports/-/merge_requests/3963

I have resolved the display,also having this problem.touchpad can not use. [ 102.680660] Goodix-TS 2-005d: ID 917D, version: 501c [ 102.759884] input: Goodix Capacitive TouchScreen as /devices/platform/soc@0/78b7000.i2c/i2c-2/2-005d/input/input5

ntonnaett commented 1 year ago

If you test #128 make sure to also apply the lk2nd patch that it depends on.

tphlru commented 11 months ago

Any further progress ?

ntonnaett commented 11 months ago

PRs are ready but need to be merged. First lk2nd and then the kernel / dt.

barni2000 commented 10 months ago

Already merged this should be closed.

qwertyuiopzxcvbnmlkjhgfdsa1 commented 10 months ago

fixed