diff mbox series

[2/2] ASoC: tegra: Fix CBB error during probe()

Message ID 20240823144342.4123814-3-spujar@nvidia.com (mailing list archive)
State Accepted
Commit 6781b962d97bc52715a8db8cc17278cc3c23ebe8
Headers show
Series Fixes for Tegra audio | expand

Commit Message

Sameer Pujar Aug. 23, 2024, 2:43 p.m. UTC
From: Mohan Kumar <mkumard@nvidia.com>

When Tegra audio drivers are built as part of the kernel image,
TIMEOUT_ERR is observed from cbb-fabric. Following is seen on
Jetson AGX Orin during boot:

[    8.012482] **************************************
[    8.017423] CPU:0, Error:cbb-fabric, Errmon:2
[    8.021922]    Error Code            : TIMEOUT_ERR
[    8.025966]    Overflow              : Multiple TIMEOUT_ERR
[    8.030644]
[    8.032175]    Error Code            : TIMEOUT_ERR
[    8.036217]    MASTER_ID             : CCPLEX
[    8.039722]    Address               : 0x290a0a8
[    8.043318]    Cache                 : 0x1 -- Bufferable
[    8.047630]    Protection            : 0x2 -- Unprivileged, Non-Secure, Data Access
[    8.054628]    Access_Type           : Write
[    8.058223]    Access_ID             : 0x0
[    8.058224]    Fabric                : cbb-fabric
[    8.065056]    Slave_Id              : 0x26
[    8.068295]    Burst_length          : 0x0
[    8.071798]    Burst_type            : 0x1
[    8.075127]    Beat_size             : 0x2
[    8.078351]    VQC                   : 0x0
[    8.081146]    GRPSEC                : 0x7e
[    8.084208]    FALCONSEC             : 0x0
[    8.087450]    AXI2APB_2_BLOCK_TMO_STATUS : 0x1
[    8.092118]    AXI2APB_2_BLOCK0_TMO : 0x4
[    8.096255]  **************************************
[    8.101366] ------------[ cut here ]------------
[    8.106130] WARNING: CPU: 0 PID: 124 at drivers/soc/tegra/cbb/tegra234-cbb.c:604 tegra234_cbb_isr+0x134/0x178
[    8.116405] Modules linked in:
[    8.119585] CPU: 0 UID: 0 PID: 124 Comm: kworker/u50:2 Not tainted 6.11.0-rc4-next-20240823-00004-g0ed92c507dab #4
[    8.130260] Hardware name: NVIDIA NVIDIA Jetson AGX Orin Developer Kit/Jetson, BIOS buildbrain-gcid-37325339 08/21/2024
[    8.141384] Workqueue: events_unbound deferred_probe_work_func
[    8.147422] pstate: 604000c9 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    8.154604] pc : tegra234_cbb_isr+0x134/0x178
[    8.159093] lr : tegra234_cbb_isr+0x10c/0x178
[    8.163582] sp : ffff800080003c60
[    8.167000] x29: ffff800080003c60 x28: ffffd89a3d40b988 x27: 0000000000000001
[    8.174362] x26: ffff000006f90000 x25: 0000000000000001 x24: 00000000000000c0
[    8.181725] x23: ffffd89a3c030440 x22: ffffd89a3d6d1c48 x21: 0000000000000021
[    8.189089] x20: ffffd89a3d40b998 x19: 0000000000000000 x18: ffffffffffffffff
[    8.196443] x17: ffff27756663b000 x16: ffff800080000000 x15: ffff8001000036f7
[    8.203800] x14: 0000000000000000 x13: 2a2a2a2a2a2a2a2a x12: 2a2a2a2a2a2a2a2a
[    8.211154] x11: 2a2a2a2a2a2a2a2a x10: ffffd89a3d0a7520 x9 : ffffd89a3a9ebfa4
[    8.218513] x8 : 00000000ffffefff x7 : ffffd89a3d0a7520 x6 : 0000000000000000
[    8.225877] x5 : 80000000fffff000 x4 : 0000000000000fff x3 : 0000000000000000
[    8.233240] x2 : 0000000000000000 x1 : ffff000006f90000 x0 : 0000000100010101
[    8.240602] Call trace:
[    8.243126]  tegra234_cbb_isr+0x134/0x178
[    8.247261]  __handle_irq_event_percpu+0x60/0x238
[    8.252132]  handle_irq_event+0x54/0xb8
[    8.256085]  handle_fasteoi_irq+0xac/0x1e0
[    8.260320]  generic_handle_domain_irq+0x34/0x58
[    8.265075]  gic_handle_irq+0x54/0x120
[    8.268950]  do_interrupt_handler+0x58/0x98
[    8.273267]  el1_interrupt+0x34/0x68
[    8.276974]  el1h_64_irq_handler+0x18/0x28
[    8.281196]  el1h_64_irq+0x64/0x68
[    8.284700]  handle_softirqs+0xa4/0x368
[    8.288665]  __do_softirq+0x1c/0x28
[    8.292263]  ____do_softirq+0x18/0x30
[    8.296034]  call_on_irq_stack+0x24/0x58
[    8.300076]  do_softirq_own_stack+0x24/0x38
[    8.304390]  irq_exit_rcu+0x94/0xd0
[    8.307992]  el1_interrupt+0x38/0x68
[    8.311676]  el1h_64_irq_handler+0x18/0x28
[    8.315902]  el1h_64_irq+0x64/0x68
[    8.319406]  _raw_spin_unlock_irqrestore+0x10/0x58
[    8.324354]  regmap_update_bits_base+0x80/0xa8
[    8.328945]  tegra210_mvc_runtime_resume+0x60/0x80
[    8.333898]  pm_generic_runtime_resume+0x34/0x58
[    8.338665]  __rpm_callback+0x50/0x1b0
[    8.342530]  rpm_callback+0x70/0x88
[    8.346128]  rpm_resume+0x430/0x638
[    8.349722]  __pm_runtime_resume+0x54/0xa0
[    8.353944]  tegra210_mvc_reset_vol_settings+0x48/0x110
[    8.359325]  tegra210_mvc_platform_probe+0xd8/0x140
[    8.364350]  platform_probe+0x70/0xf0
[    8.368130]  really_probe+0xc4/0x2a8
[    8.371814]  __driver_probe_device+0x80/0x140
[    8.376302]  driver_probe_device+0x48/0x170
[    8.380614]  __device_attach_driver+0xc0/0x148
[    8.385189]  bus_for_each_drv+0x88/0xf0
[    8.389154]  __device_attach+0xb0/0x1c0
[    8.393107]  device_initial_probe+0x1c/0x30
[    8.397415]  bus_probe_device+0xb4/0xc0
[    8.401370]  device_add+0x598/0x768
[    8.404967]  of_device_add+0x4c/0x70
[    8.408664]  of_platform_device_create_pdata+0x98/0x130
[    8.414047]  of_platform_bus_create+0x188/0x3a8
[    8.418717]  of_platform_populate+0x60/0x108
[    8.423120]  tegra_ahub_probe+0xe4/0x180
[    8.427162]  platform_probe+0x70/0xf0
[    8.430934]  really_probe+0xc4/0x2a8
[    8.434618]  __driver_probe_device+0x80/0x140
[    8.439108]  driver_probe_device+0x48/0x170
[    8.443418]  __device_attach_driver+0xc0/0x148
[    8.447995]  bus_for_each_drv+0x88/0xf0
[    8.451949]  __device_attach+0xb0/0x1c0
[    8.455901]  device_initial_probe+0x1c/0x30
[    8.460211]  bus_probe_device+0xb4/0xc0
[    8.464163]  device_add+0x598/0x768
[    8.467762]  of_device_add+0x4c/0x70
[    8.471446]  of_platform_device_create_pdata+0x98/0x130
[    8.476827]  of_platform_bus_create+0x188/0x3a8
[    8.481501]  of_platform_populate+0x60/0x108
[    8.485902]  tegra_aconnect_probe+0x9c/0x118
[    8.490322]  platform_probe+0x70/0xf0
[    8.494095]  really_probe+0xc4/0x2a8
[    8.434618]  __driver_probe_device+0x80/0x140
[    8.439108]  driver_probe_device+0x48/0x170
[    8.443418]  __device_attach_driver+0xc0/0x148
[    8.447995]  bus_for_each_drv+0x88/0xf0
[    8.451949]  __device_attach+0xb0/0x1c0
[    8.455901]  device_initial_probe+0x1c/0x30
[    8.460211]  bus_probe_device+0xb4/0xc0
[    8.464163]  device_add+0x598/0x768
[    8.467762]  of_device_add+0x4c/0x70
[    8.471446]  of_platform_device_create_pdata+0x98/0x130
[    8.476827]  of_platform_bus_create+0x188/0x3a8
[    8.481501]  of_platform_populate+0x60/0x108
[    8.485902]  tegra_aconnect_probe+0x9c/0x118
[    8.490322]  platform_probe+0x70/0xf0
[    8.494095]  really_probe+0xc4/0x2a8
[    8.497779]  __driver_probe_device+0x80/0x140
[    8.502263]  driver_probe_device+0x48/0x170
[    8.506571]  __device_attach_driver+0xc0/0x148
[    8.511149]  bus_for_each_drv+0x88/0xf0
[    8.515102]  __device_attach+0xb0/0x1c0
[    8.519055]  device_initial_probe+0x1c/0x30
[    8.523363]  bus_probe_device+0xb4/0xc0
[    8.527316]  deferred_probe_work_func+0x90/0xd0
[    8.531984]  process_one_work+0x15c/0x3c0
[    8.536128]  worker_thread+0x2e0/0x3e8
[    8.539995]  kthread+0x120/0x130
[    8.543328]  ret_from_fork+0x10/0x20
[    8.547018] ---[ end trace 0000000000000000 ]---

These errors happen when MVC device, which is a child of AHUB
device, tries to access its device registers. This happens as
part of call tegra210_mvc_reset_vol_settings() in MVC device
probe().

The root cause of this problem is, the child MVC device gets
probed before the AHUB clock gets enabled. The AHUB clock is
enabled in runtime PM resume of parent AHUB device and due to
the wrong sequence of pm_runtime_enable() in AHUB driver,
runtime PM resume doesn't happen for AHUB device when MVC makes
register access.

Fix this by calling pm_runtime_enable() for parent AHUB device
before of_platform_populate() in AHUB driver. This ensures that
clock becomes available when MVC makes register access.

Fixes: 16e1bcc2caf4 ("ASoC: tegra: Add Tegra210 based AHUB driver")
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Signed-off-by: Ritu Chaudhary <rituc@nvidia.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
 sound/soc/tegra/tegra210_ahub.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c
index 3f114a2adfce..ab3c6b2544d2 100644
--- a/sound/soc/tegra/tegra210_ahub.c
+++ b/sound/soc/tegra/tegra210_ahub.c
@@ -2,7 +2,7 @@ 
 //
 // tegra210_ahub.c - Tegra210 AHUB driver
 //
-// Copyright (c) 2020-2022, NVIDIA CORPORATION.  All rights reserved.
+// Copyright (c) 2020-2024, NVIDIA CORPORATION.  All rights reserved.
 
 #include <linux/clk.h>
 #include <linux/device.h>
@@ -1391,11 +1391,13 @@  static int tegra_ahub_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	pm_runtime_enable(&pdev->dev);
+
 	err = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
-	if (err)
+	if (err) {
+		pm_runtime_disable(&pdev->dev);
 		return err;
-
-	pm_runtime_enable(&pdev->dev);
+	}
 
 	return 0;
 }