From e5291ee9cf993d0286c9546dbba663787fda6adc Mon Sep 17 00:00:00 2001 From: Finley Xiao Date: Wed, 23 Oct 2019 10:45:50 +0800 Subject: [PATCH] MALI: bifrost: Make set regulater before initialize OPPs WARNING: CPU: 3 PID: 35 at drivers/opp/core.c:1406 dev_pm_opp_set_regulators+0x160/0x1f8 Modules linked in: CPU: 3 PID: 35 Comm: kworker/3:1 Not tainted 4.19.53 #252 Hardware name: Rockchip rk3326 863 rkisp1 board (DT) Workqueue: events deferred_probe_work_func pstate: 20400005 (nzCv daif +PAN -UAO) pc : dev_pm_opp_set_regulators+0x160/0x1f8 lr : dev_pm_opp_set_regulators+0x28/0x1f8 sp : ffffff80097ebb10 x29: ffffff80097ebb10 x28: 0000000000000000 x27: 0000000000000001 x26: ffffffc03b48c0b8 x25: ffffffc03e2a4810 x24: 0000000000000002 x23: ffffff80093d10d8 x22: ffffffc03e2a4800 x21: ffffffc03b48c000 x20: ffffffc03b48b200 x19: ffffffc03b48c000 x18: ffffffffffffffff x17: 0000000000000000 x16: ffffffc03e26a880 x15: ffffff800933da88 x14: ffffff80894ecdf7 x13: ffffff80094ece05 x12: ffffff80094ed240 x11: 0000000000000004 x10: 0101010101010101 x9 : fffffffffffffffd x8 : 7f7f7f7f7f7f7f7f x7 : fefefeff646c606d x6 : 0d0d0206ebadf2e1 x5 : 0000000000000007 x4 : 0000000000000006 x3 : ffffff8009427ff8 x2 : 0000000000000000 x1 : ffffffc03b45d180 x0 : ffffffc03b48b250 Call trace: dev_pm_opp_set_regulators+0x160/0x1f8 kbase_platform_device_probe+0x24c/0xd30 platform_drv_probe+0x50/0xa8 really_probe+0x1f8/0x288 driver_probe_device+0x58/0x100 __device_attach_driver+0x9c/0xf8 bus_for_each_drv+0x70/0xc8 __device_attach+0xdc/0x138 device_initial_probe+0x10/0x18 bus_probe_device+0x94/0xa0 deferred_probe_work_func+0x6c/0xa0 process_one_work+0x1ec/0x450 worker_thread+0x234/0x428 kthread+0xfc/0x128 ret_from_fork+0x10/0x18 ---[ end trace 30d550c0a063d9db ]--- Change-Id: I66b1642bc54729bf0bb6d1d015069b7b8e51e02c Signed-off-by: Finley Xiao --- drivers/gpu/arm/bifrost/mali_kbase_core_linux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/arm/bifrost/mali_kbase_core_linux.c b/drivers/gpu/arm/bifrost/mali_kbase_core_linux.c index 98ec535a9c9a..073e16309dc9 100644 --- a/drivers/gpu/arm/bifrost/mali_kbase_core_linux.c +++ b/drivers/gpu/arm/bifrost/mali_kbase_core_linux.c @@ -3493,10 +3493,6 @@ static int power_control_init(struct platform_device *pdev) kbdev->nr_clocks = i; dev_dbg(&pdev->dev, "Clocks probed: %u\n", kbdev->nr_clocks); - err = kbase_platform_rk_init_opp_table(kbdev); - if (err) - dev_err(kbdev->dev, "Failed to init_opp_table (%d)\n", err); - #if defined(CONFIG_PM_OPP) #if ((KERNEL_VERSION(4, 10, 0) <= LINUX_VERSION_CODE) && \ defined(CONFIG_REGULATOR)) @@ -3505,8 +3501,14 @@ static int power_control_init(struct platform_device *pdev) regulator_names, BASE_MAX_NR_CLOCKS_REGULATORS); } #endif /* (KERNEL_VERSION(4, 10, 0) <= LINUX_VERSION_CODE */ +#ifdef CONFIG_ARCH_ROCKCHIP + err = kbase_platform_rk_init_opp_table(kbdev); + if (err) + dev_err(kbdev->dev, "Failed to init_opp_table (%d)\n", err); +#else err = dev_pm_opp_of_add_table(kbdev->dev); CSTD_UNUSED(err); +#endif #endif /* CONFIG_PM_OPP */ #endif /* KERNEL_VERSION(4, 4, 0) > LINUX_VERSION_CODE */