From patchwork Tue Nov 21 07:49:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10067711 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 1B4A16022E for ; Tue, 21 Nov 2017 07:49:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D32128585 for ; Tue, 21 Nov 2017 07:49:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01F67287E8; Tue, 21 Nov 2017 07:49:48 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5F7E928F46 for ; Tue, 21 Nov 2017 07:49:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 371186E349; Tue, 21 Nov 2017 07:49:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6D9D6E349 for ; Tue, 21 Nov 2017 07:49:44 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171121074942euoutp027a91938ed08eda46b2c1247d255ba04d~5CmXCvsHK2954629546euoutp02b; Tue, 21 Nov 2017 07:49:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20171121074942euoutp027a91938ed08eda46b2c1247d255ba04d~5CmXCvsHK2954629546euoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1511250582; bh=F/jIaaDQjtS+Mc1y+R5Hk1YMtEMmY4SxBnUYnIa6pbw=; h=From:To:Cc:Subject:Date:References:From; b=MjM/1+hRHH5LQ5adbulvDHkn8ZxxRXY0mUoGg+DHF34xI3zVH1xLZXV9/q2/RVhHq 68aoRITLwIGdrrpQNBQK12TyOq8BmafaEh/L9UBNH7ns68svcpk6n8umgh30OAjfd8 TDne5QiMWv/VM22JjnLRSBTj4HjqIUQ2xyHf7zBQ= Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171121074941eucas1p18a9477b12cccb183613122ea3d35d621~5CmWZiIK71523315233eucas1p1y; Tue, 21 Nov 2017 07:49:41 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 06.63.12907.59AD31A5; Tue, 21 Nov 2017 07:49:41 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171121074940eucas1p17779b35232466785d43c56382dad01b7~5CmVxalif1767417674eucas1p1y; Tue, 21 Nov 2017 07:49:40 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-0a-5a13da95c7e3 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 25.8C.20118.49AD31A5; Tue, 21 Nov 2017 07:49:40 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OZR00F4QCEPEX50@eusync1.samsung.com>; Tue, 21 Nov 2017 07:49:40 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] drm/bridge: analogix dp: Fix runtime PM state in get_modes() callback Date: Tue, 21 Nov 2017 08:49:36 +0100 Message-id: <20171121074936.22520-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.14.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrEIsWRmVeSWpSXmKPExsWy7djP87pTbwlHGez4ymlxa905Voumjres FhtnrGe1uPL1PZtF58Ql7BYzzu9jslh75C67xd0NZxktFmx8xGhxrmEyu8WhqesZHbg9Zjdc ZPG43NfL5LFz1l12j9kdM1k97ncfZ/L4O2s/i0ffllWMHp83yQVwRHHZpKTmZJalFunbJXBl TOt6yFJwS6HieNM9xgbGlTJdjJwcEgImEuf/7mKBsMUkLtxbz9bFyMUhJLCUUeLirh2sEM5n RomGyVOAqjjAOp7MqYSIL2OUeLJnKzuE08AkseDxeUaQUWwChhJdb7vYQGwRATeJpsMzwSYx C3xhkujf/YwZJCEsECExubWZHWQqi4CqxOObdiAmr4CtROvHbIiL5CXeL7jPCNIqIbCGTeL5 mQOsEAkXiTOHVjBC2MISr45vYYewZSQuT+6GeqefUaKpVRvCnsEoce4tL4RtLXH4+EWwOcwC fBKTtk1nhniMV6KjTQiixENi094bUGMcJXq33AMbLyQQK3Fp7T3GCYxSCxgZVjGKpJYW56an FhvpFSfmFpfmpesl5+duYgTG9Ol/xz/uYHx/wuoQowAHoxIP74kE4Sgh1sSy4srcQ4wSHMxK IrxqUUJRQrwpiZVVqUX58UWlOanFhxilOViUxHlto9oihQTSE0tSs1NTC1KLYLJMHJxSDYzX 807HzPpx1fBZwdKOf2Xn9B+xiTsw9ilf2OTIOFtmWo/MJlX1R3s4vdZczfWZraSTzsx5ak7A VoWUtKcvtzGnftVxtJbqVVj7M/G56Gvr2toZ84sf2GztfXag+bnm9tmzsle8nPRaLTP9Qm7R lF93Pq2fsqZYlTs63sKFL+k7R8u9JQlPj+YpsRRnJBpqMRcVJwIAt9g8fuUCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDLMWRmVeSWpSXmKPExsVy+t/xy7pTbglHGRyaqmtxa905Voumjres FhtnrGe1uPL1PZtF58Ql7BYzzu9jslh75C67xd0NZxktFmx8xGhxrmEyu8WhqesZHbg9Zjdc ZPG43NfL5LFz1l12j9kdM1k97ncfZ/L4O2s/i0ffllWMHp83yQVwRHHZpKTmZJalFunbJXBl TOt6yFJwS6HieNM9xgbGlTJdjBwcEgImEk/mVHYxcgKZYhIX7q1n62Lk4hASWMIo0bT3JSOE 08Qk0dC1kxmkik3AUKLrbRcbiC0i4CbRdHgmK0gRs8A3Jonu9hZ2kISwQITEi0N72UE2sAio Sjy+aQdi8grYSrR+zIZYJi/xfsF9xgmM3AsYGVYxiqSWFuem5xYb6RUn5haX5qXrJefnbmIE htm2Yz+37GDsehd8iFGAg1GJh7cgTjhKiDWxrLgy9xCjBAezkgivWpRQlBBvSmJlVWpRfnxR aU5q8SFGaQ4WJXHe3j2rI4UE0hNLUrNTUwtSi2CyTBycUg2MOzQaDnJbz5+UvftWzbTDc47w hCan15/esHjNQ6mtJTHluhzbv/9usHjjFm+cpb/nIteHo0wVNwoXPtZqOuzhrHD8/KWKdrmM JI/u+eYPkhfx/pJIkrkzX2M/Z/ORvYUJr7yjdX6qmBnsfXsyaO7i/Y1vdXubZ99MC7/UbGX5 Os5ZWnderLimEktxRqKhFnNRcSIAggFfdy8CAAA= X-CMS-MailID: 20171121074940eucas1p17779b35232466785d43c56382dad01b7 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171121074940eucas1p17779b35232466785d43c56382dad01b7 X-RootMTR: 20171121074940eucas1p17779b35232466785d43c56382dad01b7 References: Cc: Bartlomiej Zolnierkiewicz , Misha Komarovskiy , stable@vger.kernel.org, Laurent Pinchart , Yakir Yang , Marek Szyprowski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP get_modes() callback might be called asynchronously from the DRM core and it is not synchronized with bridge_enable(), which sets proper runtime PM state of the main DP device. Fix this by calling pm_runtime_get_sync() before calling drm_get_edid(), which in turn calls drm_dp_i2c_xfer() and analogix_dp_transfer() to ensure that main DP device is runtime active when doing any access to its registers. This fixes the following kernel issue 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: 62 Comm: kworker/0:2 Not tainted 4.13.0-rc2-00364-g4a97a3da420b #3357 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) Workqueue: events output_poll_execute task: edc14800 task.stack: edcb2000 PC is at analogix_dp_transfer+0x15c/0x2fc LR is at analogix_dp_transfer+0x134/0x2fc pc : [] lr : [] psr: 60000013 sp : edcb3be8 ip : 0000002a fp : 00000001 r10: 00000000 r9 : edcb3cd8 r8 : edcb3c40 r7 : 00000000 r6 : edd3b380 r5 : edd3b010 r4 : 00000064 r3 : 00000000 r2 : f0ad3000 r1 : edcb3c40 r0 : edd3b010 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 10c5387d Table: 4000406a DAC: 00000051 Process kworker/0:2 (pid: 62, stack limit = 0xedcb2210) Stack: (0xedcb3be8 to 0xedcb4000) [] (analogix_dp_transfer) from [] (drm_dp_i2c_do_msg+0x8c/0x2b4) [] (drm_dp_i2c_do_msg) from [] (drm_dp_i2c_xfer+0x98/0x214) [] (drm_dp_i2c_xfer) from [] (__i2c_transfer+0x140/0x29c) [] (__i2c_transfer) from [] (i2c_transfer+0x70/0xe4) [] (i2c_transfer) from [] (drm_do_probe_ddc_edid+0xb4/0x114) [] (drm_do_probe_ddc_edid) from [] (drm_probe_ddc+0x18/0x28) [] (drm_probe_ddc) from [] (drm_get_edid+0x124/0x2d4) [] (drm_get_edid) from [] (analogix_dp_get_modes+0x90/0x114) [] (analogix_dp_get_modes) from [] (drm_helper_probe_single_connector_modes+0x198/0x68c) [] (drm_helper_probe_single_connector_modes) from [] (drm_setup_crtcs+0x1b4/0xd18) [] (drm_setup_crtcs) from [] (drm_fb_helper_hotplug_event+0x94/0xd0) [] (drm_fb_helper_hotplug_event) from [] (drm_kms_helper_hotplug_event+0x24/0x28) [] (drm_kms_helper_hotplug_event) from [] (output_poll_execute+0x6c/0x174) [] (output_poll_execute) from [] (process_one_work+0x188/0x3fc) [] (process_one_work) from [] (worker_thread+0x30/0x4b8) [] (worker_thread) from [] (kthread+0x128/0x164) [] (kthread) from [] (ret_from_fork+0x14/0x24) Code: 0a000002 ea000009 e2544001 0a00004a (e59537c8) ---[ end trace cddc7919c79f7878 ]--- Reported-by: Misha Komarovskiy CC: stable@vger.kernel.org # v4.10+ Signed-off-by: Marek Szyprowski Tested-by: Misha Komarovskiy --- This issue was there from the beginning, but recent changes to DRM core revealed it. It makes sense to backport it to patch f0a8b49c03d2 ("drm/bridge: analogix dp: Fix runtime PM state on driver bind"), which fixed similar issue on driver bind, thus I've marked it for stable v4.10+. Best regards Marek Szyprowski Samsung R&D Institute Poland --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 5dd3f1cd074a..a8905049b9da 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -946,7 +946,9 @@ static int analogix_dp_get_modes(struct drm_connector *connector) return 0; } + pm_runtime_get_sync(dp->dev); edid = drm_get_edid(connector, &dp->aux.ddc); + pm_runtime_put(dp->dev); if (edid) { drm_mode_connector_update_edid_property(&dp->connector, edid);