Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asus Transformers fixes #48

Merged
merged 2 commits into from
Jul 11, 2021
Merged

Asus Transformers fixes #48

merged 2 commits into from
Jul 11, 2021

Conversation

maximschwalm
Copy link
Contributor

@maximschwalm maximschwalm commented Jul 5, 2021

  • Fix booting from recovery
  • Fix RT5631 registers being out of sync after resuming from suspend
  • Fix backlight supply
  • Add some missing supplies
  • Reduce W1 ramp delay to 20ms
  • Choose better regulator names

regulator-max-microvolt = <3300000>;
regulator-max-microvolt = <3100000>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this result in a error from MMC core when it tries to set 3.3v mode? I think this should stay 3.3v.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that 3.3v will be used. The kernel tries to match the vmmc and vqmmc voltage. That's why I can't set vqmmc lower than what vmmc is set to, because then the kernel complains that the voltage would be out of range

@digetx
Copy link
Member

digetx commented Jul 5, 2021

What change fixed panel after rebooting?

@maximschwalm
Copy link
Contributor Author

maximschwalm commented Jul 5, 2021

What change fixed panel after rebooting?

Removing the ramp delay from the panel regulator

@digetx
Copy link
Member

digetx commented Jul 5, 2021

Do you have any idea why ramp delay causes the problem?

@maximschwalm
Copy link
Contributor Author

Do you have any idea why ramp delay causes the problem?

I don't have any explanation. I discovered this purely by trial and error

@digetx
Copy link
Member

digetx commented Jul 5, 2021

The original downstream kernel seems use 20ms delay, could you please check whether it works?

https://github.com/clamor-s/morpheus_kernel_asus_tf201/blob/asus/arch/arm/mach-tegra/board-cardhu-panel.c#L315

-		regulator-enable-ramp-delay = <300000>;
+		regulator-enable-ramp-delay = <20000>;

@maximschwalm
Copy link
Contributor Author

The original downstream kernel seems use 20ms delay, could you please check whether it works?

https://github.com/clamor-s/morpheus_kernel_asus_tf201/blob/asus/arch/arm/mach-tegra/board-cardhu-panel.c#L315

-		regulator-enable-ramp-delay = <300000>;
+		regulator-enable-ramp-delay = <20000>;

Shouldn't startup-delay-us be used when the regulator is fixed?

@digetx
Copy link
Member

digetx commented Jul 6, 2021

Looks like both should work equally. I don't know why startup-delay-us exists, maybe it's a legacy property.

@maximschwalm
Copy link
Contributor Author

No, it doesn't work. Same issue again

@digetx
Copy link
Member

digetx commented Jul 6, 2021

Can you try a lower delay? Like 1ms.

@clamor-s
Copy link
Contributor

clamor-s commented Jul 6, 2021

@digetx may you halt this PR till 9th of June. I would really like to review them as well. I'm currently out of home network with poot wifi.

@digetx
Copy link
Member

digetx commented Jul 6, 2021

We can wait. I want to know why regulator delay makes a difference, this is the biggest question for me here.

@maximschwalm
Copy link
Contributor Author

After further testing it seems like removing the ramp delay didn't fix it at all. It was probably just a coincidence that the display worked after reboot, but I could reboot several times in row and it was still working.

@okias
Copy link
Contributor

okias commented Jul 8, 2021

...but I could reboot several times in row and it was still working.

maybe you set something before and it's not (properly) initialized by kernel?

@digetx
Copy link
Member

digetx commented Jul 11, 2021

@maximschwalm could you please check reboot with this change?

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index a46f86d2fea5..5bbf5132dc41 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -4954,7 +4954,7 @@ static struct mipi_dsi_driver panel_simple_dsi_driver = {
 	},
 	.probe = panel_simple_dsi_probe,
 	.remove = panel_simple_dsi_remove,
-	.shutdown = panel_simple_dsi_shutdown,
+// 	.shutdown = panel_simple_dsi_shutdown,
 };
 
 static int __init panel_simple_init(void)

@maximschwalm
Copy link
Contributor Author

maximschwalm commented Jul 11, 2021

@maximschwalm could you please check reboot with this change?

Thanks, so it worked better, but after the 5th try it failed again. What seems to be different is, that it can work again after another reboot. Previously I had to completely switch off the device

@digetx
Copy link
Member

digetx commented Jul 11, 2021

It may lead to the root of the problem, but it's not a fix yet. Could be that the W1 gpio needs to be enabled for the TC bridge, have you checked it?

diff --git a/arch/arm/boot/dts/tegra30-asus-tf700t.dts b/arch/arm/boot/dts/tegra30-asus-tf700t.dts
index 1dec83d07555..bec5056efb66 100644
--- a/arch/arm/boot/dts/tegra30-asus-tf700t.dts
+++ b/arch/arm/boot/dts/tegra30-asus-tf700t.dts
@@ -157,7 +157,6 @@ display-panel@1 {
 				compatible = "panasonic,vvx10f004b00";
 				reg = <1>;
 
-				power-supply = <&vdd_pnl>;
 				backlight = <&backlight>;
 
 				port {
@@ -231,7 +230,7 @@ vdd_1v2_mipi: regulator@6 {
 		regulator-boot-on;
 		gpio = <&gpio TEGRA_GPIO(BB, 3) GPIO_ACTIVE_HIGH>;
 		enable-active-high;
-		vin-supply = <&vdd_3v3_sys>;
+		vin-supply = <&vdd_pnl>;
 	};
 
 	vibrator {

We shouldn't remove the W1 ramp delay (maybe change it to 20msec) and should be better not to change the limits of those regulators where we not sure yet. Could you please update this PR?

@maximschwalm
Copy link
Contributor Author

It may lead to the root of the problem, but it's not a fix yet. Could be that the W1 gpio needs to be enabled for the TC bridge, have you checked it?

Not yet. Should I try it without the previous patch?

@digetx
Copy link
Member

digetx commented Jul 11, 2021

Yes, without the previous patch.

@digetx
Copy link
Member

digetx commented Jul 11, 2021

The reboot problem is unrelated to the rest of the changes in this PR, it shouldn't block fixing the MMC regulators.

The ALC5631 does not like multi-write accesses, avoid them. This fixes:

rt5631 4-001a: Unable to sync registers 0x3a-0x3c. -121

errors on resume (and all registers after the registers in the error not
being synced).

Inspired by commit 2d30e94 ("ASoC: rt5651: Fix regcache sync errors
on resume") from Hans de Geode, which fixed the same errors on ALC5651.

Signed-off-by: Maxim Schwalm <[email protected]>
@maximschwalm
Copy link
Contributor Author

maximschwalm commented Jul 11, 2021

Yes, without the previous patch.

This time it fails sooner and doesn't get fixed by another reboot

@digetx
Copy link
Member

digetx commented Jul 11, 2021

Now you can narrow down the panel_simple_dsi_shutdown() to the point that breaks display after reboot. Once we will know that point, we will think about how to fix it.

The updated PR looks good to me. I'll merge it, thanks!

@digetx digetx merged commit 4162a9f into grate-driver:master Jul 11, 2021
okias pushed a commit to okias/linux that referenced this pull request Jan 7, 2024
[ Upstream commit fe57575 ]

The `cgrp_local_storage` test triggers a kernel panic like:

  # ./test_progs -t cgrp_local_storage
  Can't find bpf_testmod.ko kernel module: -2
  WARNING! Selftests relying on bpf_testmod.ko will be skipped.
  [  550.930632] CPU 1 Unable to handle kernel paging request at virtual address 0000000000000080, era == ffff80000200be34, ra == ffff80000200be00
  [  550.931781] Oops[#1]:
  [  550.931966] CPU: 1 PID: 1303 Comm: test_progs Not tainted 6.7.0-rc2-loong-devel-g2f56bb0d2327 grate-driver#35 a896aca3f4164f09cc346f89f2e09832e07be5f6
  [  550.932215] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022
  [  550.932403] pc ffff80000200be34 ra ffff80000200be00 tp 9000000108350000 sp 9000000108353dc0
  [  550.932545] a0 0000000000000000 a1 0000000000000517 a2 0000000000000118 a3 00007ffffbb15558
  [  550.932682] a4 00007ffffbb15620 a5 90000001004e7700 a6 0000000000000021 a7 0000000000000118
  [  550.932824] t0 ffff80000200bdc0 t1 0000000000000517 t2 0000000000000517 t3 00007ffff1c06ee0
  [  550.932961] t4 0000555578ae04d0 t5 fffffffffffffff8 t6 0000000000000004 t7 0000000000000020
  [  550.933097] t8 0000000000000040 u0 00000000000007b8 s9 9000000108353e00 s0 90000001004e7700
  [  550.933241] s1 9000000004005000 s2 0000000000000001 s3 0000000000000000 s4 0000555555eb2ec8
  [  550.933379] s5 00007ffffbb15bb8 s6 00007ffff1dafd60 s7 000055555663f610 s8 00007ffff1db0050
  [  550.933520]    ra: ffff80000200be00 bpf_prog_98f1b9e767be2a84_on_enter+0x40/0x200
  [  550.933911]   ERA: ffff80000200be34 bpf_prog_98f1b9e767be2a84_on_enter+0x74/0x200
  [  550.934105]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
  [  550.934596]  PRMD: 00000004 (PPLV0 +PIE -PWE)
  [  550.934712]  EUEN: 00000003 (+FPE +SXE -ASXE -BTE)
  [  550.934836]  ECFG: 00071c1c (LIE=2-4,10-12 VS=7)
  [  550.934976] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
  [  550.935097]  BADV: 0000000000000080
  [  550.935181]  PRID: 0014c010 (Loongson-64bit, Loongson-3A5000)
  [  550.935291] Modules linked in:
  [  550.935391] Process test_progs (pid: 1303, threadinfo=000000006c3b1c41, task=0000000061f84a55)
  [  550.935643] Stack : 00007ffffbb15bb8 0000555555eb2ec8 0000000000000000 0000000000000001
  [  550.935844]         9000000004005000 ffff80001b864000 00007ffffbb15450 90000000029aa034
  [  550.935990]         0000000000000000 9000000108353ec0 0000000000000118 d07d9dfb09721a09
  [  550.936175]         0000000000000001 0000000000000000 9000000108353ec0 0000000000000118
  [  550.936314]         9000000101d46ad0 900000000290abf0 000055555663f610 0000000000000000
  [  550.936479]         0000000000000003 9000000108353ec0 00007ffffbb15450 90000000029d7288
  [  550.936635]         00007ffff1dafd60 000055555663f610 0000000000000000 0000000000000003
  [  550.936779]         9000000108353ec0 90000000035dd1f0 00007ffff1dafd58 9000000002841c5c
  [  550.936939]         0000000000000119 0000555555eea5a8 00007ffff1d78780 00007ffffbb153e0
  [  550.937083]         ffffffffffffffda 00007ffffbb15518 0000000000000040 00007ffffbb15558
  [  550.937224]         ...
  [  550.937299] Call Trace:
  [  550.937521] [<ffff80000200be34>] bpf_prog_98f1b9e767be2a84_on_enter+0x74/0x200
  [  550.937910] [<90000000029aa034>] bpf_trace_run2+0x90/0x154
  [  550.938105] [<900000000290abf0>] syscall_trace_enter.isra.0+0x1cc/0x200
  [  550.938224] [<90000000035dd1f0>] do_syscall+0x48/0x94
  [  550.938319] [<9000000002841c5c>] handle_syscall+0xbc/0x158
  [  550.938477]
  [  550.938607] Code: 580009ae  50016000  262402e4 <28c20085> 14092084  03a00084  16000024  03240084  00150006
  [  550.938851]
  [  550.939021] ---[ end trace 0000000000000000 ]---

Further investigation shows that this panic is triggered by memory
load operations:

  ptr = bpf_cgrp_storage_get(&map_a, task->cgroups->dfl_cgrp, 0,
                             BPF_LOCAL_STORAGE_GET_F_CREATE);

The expression `task->cgroups->dfl_cgrp` involves two memory load.
Since the field offset fits in imm12 or imm14, we use ldd or ldptrd
instructions. But both instructions have the side effect that it will
signed-extended the imm operand. Finally, we got the wrong addresses
and panics is inevitable.

Use a generic ldxd instruction to avoid this kind of issues.

With this change, we have:

  # ./test_progs -t cgrp_local_storage
  Can't find bpf_testmod.ko kernel module: -2
  WARNING! Selftests relying on bpf_testmod.ko will be skipped.
  test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec
  grate-driver#48/1    cgrp_local_storage/tp_btf:OK
  test_attach_cgroup:PASS:skel_open 0 nsec
  test_attach_cgroup:PASS:prog_attach 0 nsec
  test_attach_cgroup:PASS:prog_attach 0 nsec
  libbpf: prog 'update_cookie_tracing': failed to attach: ERROR: strerror_r(-524)=22
  test_attach_cgroup:FAIL:prog_attach unexpected error: -524
  grate-driver#48/2    cgrp_local_storage/attach_cgroup:FAIL
  test_recursion:PASS:skel_open_and_load 0 nsec
  libbpf: prog 'on_lookup': failed to attach: ERROR: strerror_r(-524)=22
  libbpf: prog 'on_lookup': failed to auto-attach: -524
  test_recursion:FAIL:skel_attach unexpected error: -524 (errno 524)
  grate-driver#48/3    cgrp_local_storage/recursion:FAIL
  grate-driver#48/4    cgrp_local_storage/negative:OK
  grate-driver#48/5    cgrp_local_storage/cgroup_iter_sleepable:OK
  test_yes_rcu_lock:PASS:skel_open 0 nsec
  test_yes_rcu_lock:PASS:skel_load 0 nsec
  libbpf: prog 'yes_rcu_lock': failed to attach: ERROR: strerror_r(-524)=22
  libbpf: prog 'yes_rcu_lock': failed to auto-attach: -524
  test_yes_rcu_lock:FAIL:skel_attach unexpected error: -524 (errno 524)
  grate-driver#48/6    cgrp_local_storage/yes_rcu_lock:FAIL
  grate-driver#48/7    cgrp_local_storage/no_rcu_lock:OK
  grate-driver#48      cgrp_local_storage:FAIL

  All error logs:
  test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec
  test_attach_cgroup:PASS:skel_open 0 nsec
  test_attach_cgroup:PASS:prog_attach 0 nsec
  test_attach_cgroup:PASS:prog_attach 0 nsec
  libbpf: prog 'update_cookie_tracing': failed to attach: ERROR: strerror_r(-524)=22
  test_attach_cgroup:FAIL:prog_attach unexpected error: -524
  grate-driver#48/2    cgrp_local_storage/attach_cgroup:FAIL
  test_recursion:PASS:skel_open_and_load 0 nsec
  libbpf: prog 'on_lookup': failed to attach: ERROR: strerror_r(-524)=22
  libbpf: prog 'on_lookup': failed to auto-attach: -524
  test_recursion:FAIL:skel_attach unexpected error: -524 (errno 524)
  grate-driver#48/3    cgrp_local_storage/recursion:FAIL
  test_yes_rcu_lock:PASS:skel_open 0 nsec
  test_yes_rcu_lock:PASS:skel_load 0 nsec
  libbpf: prog 'yes_rcu_lock': failed to attach: ERROR: strerror_r(-524)=22
  libbpf: prog 'yes_rcu_lock': failed to auto-attach: -524
  test_yes_rcu_lock:FAIL:skel_attach unexpected error: -524 (errno 524)
  grate-driver#48/6    cgrp_local_storage/yes_rcu_lock:FAIL
  grate-driver#48      cgrp_local_storage:FAIL
  Summary: 0/4 PASSED, 0 SKIPPED, 1 FAILED

No panics any more (The test still failed because lack of BPF trampoline
which I am actively working on).

Fixes: 5dc6155 ("LoongArch: Add BPF JIT support")
Signed-off-by: Hengqi Chen <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants