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: 119343 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4927227qgn; Mon, 20 Nov 2017 23:49:47 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ59M0IqdMdGMC1Einz1eKZxp3CYFv366/rFkMwQvFTq5FNxw6KMxyZyQn97ZlkKclN1DTD X-Received: by 10.99.135.199 with SMTP id i190mr15848535pge.356.1511250587443; Mon, 20 Nov 2017 23:49:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511250587; cv=none; d=google.com; s=arc-20160816; b=xSu1E0HkuIV7kky5Cbf6Th6gYpE7XxEtM4vlgRzE0W3O4rRstw1OpXgZoffK+qKAti xWcQzpSxf5yV2JmrRJhwQG2qYBT/ASGbqdLIawcM/vZl8EF9f0b+wBdIk2gndaXC8ZtS USOHGHQP9rnsW9a1xc6/wv/53ywBtPc05/kcDtDGrjIg7HL6iz5Hd3kfUmImh+tnL/Nf OllDjXZ6SMbtCgWlU5QWLOCy2x4ICb/7N8Xe72pRpqusDoR50SNV/Z+eCX7eO6Kv/4Ez JCewJ64TrEV+1u7TOBblGqaSUYg85YM+8lfrD4j1OwSV/n7MOi08dSM9GQIbwGVNXJtj x0Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=e1lX75mMVYRfytn120E9GiXYjUMwMgtxwiQ+U3Ug/yU=; b=T9iA9WX5tAM97SBfQwKXOIupYfa+2kGaONntj5u1dJIQCsf16DUQIkW8Ml75vvdS+d dxFPl56iBooljhRYyHWlBNhb+DCcgCctGg8t7vvn/qw9LLZrajL3T9kBU0rnZzAnl0ah o623IHNCn8361D3YcpC1U6pFwTDIerfKAMNElhrE49XRwZmzEXdwUVFEmj8eYc6KVn20 QhQipnbctNjxlvz2OygtqRI1QpA9UC433GqBTY0AD1aCpjYOBMvOkrHWG3Saw5HUmFz5 n6l0BqkAhiqUhnxPwclwly+/soWFzXBbZnug0jEwKXUy6YnjBqv6rRZtu5k4fumLUE9G uiUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=MjM/1+hR; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si10696757pfe.53.2017.11.20.23.49.47; Mon, 20 Nov 2017 23:49:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=MjM/1+hR; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751247AbdKUHtq (ORCPT + 3 others); Tue, 21 Nov 2017 02:49:46 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:36053 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbdKUHto (ORCPT ); Tue, 21 Nov 2017 02:49:44 -0500 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 Cc: Marek Szyprowski , Archit Taneja , Yakir Yang , Sean Paul , Bartlomiej Zolnierkiewicz , Laurent Pinchart , Andrzej Hajda , Misha Komarovskiy , stable@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: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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 --- 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(+) -- 2.14.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);