From patchwork Fri Dec 30 09:57:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9491955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9F4760838 for ; Fri, 30 Dec 2016 09:58:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CF021FEBD for ; Fri, 30 Dec 2016 09:58:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 917441FF8F; Fri, 30 Dec 2016 09:58:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F5841FEBD for ; Fri, 30 Dec 2016 09:58:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbcL3J6g (ORCPT ); Fri, 30 Dec 2016 04:58:36 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:60834 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbcL3J6f (ORCPT ); Fri, 30 Dec 2016 04:58:35 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OIZ004F5T1KOJ50@mailout3.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Fri, 30 Dec 2016 09:58:32 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20161230095832eucas1p1674a144989643ec7783c8e954c6e14f2~VADyFik4N3220832208eucas1p1b; Fri, 30 Dec 2016 09:58:32 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id C6.88.10572.7CF26685; Fri, 30 Dec 2016 09:58:31 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161230095831eucas1p2c315f7ca20a49e1a7ad421cc68b1101a~VADxWgvMf1969919699eucas1p2N; Fri, 30 Dec 2016 09:58:31 +0000 (GMT) X-AuditID: cbfec7f5-f79676d00000294c-89-58662fc70de3 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EA.FB.06573.BBF26685; Fri, 30 Dec 2016 09:58:19 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OIZ00LLAT1ESW60@eusync4.samsung.com>; Fri, 30 Dec 2016 09:58:31 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Archit Taneja , Yakir Yang , Sean Paul , Bartlomiej Zolnierkiewicz , Daniel Vetter , David Airlie Subject: [PATCH] drm/bridge: analogix dp: Fix runtime PM state on driver bind Date: Fri, 30 Dec 2016 10:57:46 +0100 Message-id: <1483091866-1088-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJIsWRmVeSWpSXmKPExsWy7djPc7rH9dMiDKZ8trLoPXeSyaKp4y2r xcYZ61kt/m+byGxx5et7NotJ9yewWMw4v4/JYu2Ru+wWdzecZbQ41zCZ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p2yW4Zcyd2MleMFWmon9RG3MD 4xuJLkZODgkBE4nV248xQthiEhfurWfrYuTiEBJYwihxtGUWE4TTxCSx8/EJVpAqNgFDia63 XWwgtoiAm0TT4ZlgcWaBPUwSvd8jQWxhAV+Jx7euMYPYLAKqEr/vPmQCsXkF3CV+fF/AArFN TuLkscmsExi5FzAyrGIUSS0tzk3PLTbSK07MLS7NS9dLzs/dxAgM7G3Hfm7Zwdj1LvgQowAH oxIP74KS1Agh1sSy4srcQ4wSHMxKIrwGemkRQrwpiZVVqUX58UWlOanFhxhNgZZPZJYSTc4H Rl1eSbyhiaG5paGRsYWFuZGRkjjv1A9XwoUE0hNLUrNTUwtSi2D6mDg4pRoYj+5+Lv88ckFc Eq81zxaHz9WbT7Cuj78dvLCN49183/aVW7pubL1UefPs4rUr1EX1b6aIZJn8LxA9s90tNzKC v8z0E1f7499fAvNOuN0LDM2dIWD9ZPKfOVPuZQqueGjwLSKg1z7M2CDk0F2vrpJNN85Hll85 nLHWraK1c8uNSxzzz7M+/1SpoMRSnJFoqMVcVJwIAKE/J8KCAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161230095831eucas1p2c315f7ca20a49e1a7ad421cc68b1101a X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161230095831eucas1p2c315f7ca20a49e1a7ad421cc68b1101a X-RootMTR: 20161230095831eucas1p2c315f7ca20a49e1a7ad421cc68b1101a References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Analogix_dp_bind() can be called from component framework, which doesn't guarantee proper runtime PM state of the device during bind operation, so ensure that device is runtime active before doing any register access. This ensures that the power domain, to which DP module belongs, is turned on. While at it, also fix the unbalanced call to phy_power_on() in analogix_dp_bind() function. This patch solves the following kernel oops on Samsung Exynos5250 Snow board: Unhandled fault: imprecise external abort (0x406) at 0x00000000 pgd = c0004000 [00000000] *pgd=00000000 Internal error: : 406 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 75 Comm: kworker/0:2 Not tainted 4.9.0 #1046 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) Workqueue: events deferred_probe_work_func task: ee272300 task.stack: ee312000 PC is at analogix_dp_enable_sw_function+0x18/0x2c LR is at analogix_dp_init_dp+0x2c/0x50 ... [] (analogix_dp_enable_sw_function) from [] (analogix_dp_init_dp+0x2c/0x50) [] (analogix_dp_init_dp) from [] (analogix_dp_bind+0x184/0x42c) [] (analogix_dp_bind) from [] (component_bind_all+0xf0/0x218) [] (component_bind_all) from [] (exynos_drm_load+0x134/0x200) [] (exynos_drm_load) from [] (drm_dev_register+0xa0/0xd0) [] (drm_dev_register) from [] (drm_platform_init+0x58/0xb0) [] (drm_platform_init) from [] (try_to_bring_up_master+0x14c/0x188) [] (try_to_bring_up_master) from [] (component_add+0x88/0x138) [] (component_add) from [] (platform_drv_probe+0x50/0xb0) [] (platform_drv_probe) from [] (driver_probe_device+0x1f0/0x2a8) [] (driver_probe_device) from [] (bus_for_each_drv+0x44/0x8c) [] (bus_for_each_drv) from [] (__device_attach+0x9c/0x100) [] (__device_attach) from [] (bus_probe_device+0x84/0x8c) [] (bus_probe_device) from [] (deferred_probe_work_func+0x60/0x8c) [] (deferred_probe_work_func) from [] (process_one_work+0x120/0x318) [] (process_one_work) from [] (process_scheduled_works+0x28/0x38) [] (process_scheduled_works) from [] (worker_thread+0x204/0x4ac) [] (worker_thread) from [] (kthread+0xd8/0xf4) [] (kthread) from [] (ret_from_fork+0x14/0x3c) Code: e59035f0 e5935018 f57ff04f e3c55001 (f57ff04e) ---[ end trace 3d1d0d87796de344 ]--- Signed-off-by: Marek Szyprowski Reviewed-by: Sean Paul --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index eb9bf8786c24..18eefdcbf1ba 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1382,6 +1382,7 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, pm_runtime_enable(dev); + pm_runtime_get_sync(dev); phy_power_on(dp->phy); analogix_dp_init_dp(dp); @@ -1414,9 +1415,15 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, goto err_disable_pm_runtime; } + phy_power_off(dp->phy); + pm_runtime_put(dev); + return 0; err_disable_pm_runtime: + + phy_power_off(dp->phy); + pm_runtime_put(dev); pm_runtime_disable(dev); return ret;