From patchwork Tue Dec 8 15:33:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 7799041 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9CD8E9F387 for ; Tue, 8 Dec 2015 15:34:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E59D20523 for ; Tue, 8 Dec 2015 15:34:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0412F204D2 for ; Tue, 8 Dec 2015 15:34:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E68EF6E0B4; Tue, 8 Dec 2015 07:34:08 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from gloria.sntech.de (gloria.sntech.de [95.129.55.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 030766E0B4 for ; Tue, 8 Dec 2015 07:34:08 -0800 (PST) Received: from ipb2181aa0.dynamic.kabel-deutschland.de ([178.24.26.160] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1a6KGq-0003CU-EW; Tue, 08 Dec 2015 16:33:40 +0100 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Yakir Yang , Thierry Reding Subject: Re: [PATCH v10 0/17] Add Analogix Core Display Port Driver Date: Tue, 08 Dec 2015 16:33:39 +0100 Message-ID: <1982691.ZDuzTFTUUe@diego> User-Agent: KMail/4.14.10 (Linux/4.2.0-1-amd64; KDE/4.14.13; x86_64; ; ) In-Reply-To: <1449470239-30667-1-git-send-email-ykk@rock-chips.com> References: <1449470239-30667-1-git-send-email-ykk@rock-chips.com> MIME-Version: 1.0 Cc: Krzysztof Kozlowski , Seung-Woo Kim , dri-devel@lists.freedesktop.org, Andrzej Hajda , Gustavo Padovan , linux-samsung-soc@vger.kernel.org, Russell King , linux-rockchip@lists.infradead.org, Kishon Vijay Abraham I , javier@osg.samsung.com, devicetree@vger.kernel.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Jingoo Han , emil.l.velikov@gmail.com, linux-kernel@vger.kernel.org, Kyungmin Park , ajaynumb@gmail.com, Andy Yan 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Yakir, Am Montag, 7. Dezember 2015, 14:37:19 schrieb Yakir Yang: > The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller > share the same IP, so a lot of parts can be re-used. I split the common > code into bridge directory, then rk3288 and exynos only need to keep > some platform code. Cause I can't find the exact IP name of exynos dp > controller, so I decide to name dp core driver with "analogix" which I > find in rk3288 eDP TRM [...] > Changes in v10: > - Correct the ROCKCHIP_ANALOGIX_DP indentation in Kconfig to tabs here > (Heiko) - Fix the wrong macro value of > GRF_EDP_REF_CLK_SEL_INTER_HIWORD_MASK BIT(4) -> BIT(20) > - Remove the surplus "plat_data" check. (Heiko) > - switch (dp->plat_data && dp->plat_data->dev_type) { > + switch (dp->plat_data->dev_type) { > - Revert parts of Gustavo Padovan's changes in commit: > drm/exynos: do not start enabling DP at bind() phase > Add dp phy poweron function in bind time. The hotplug issue is still present, but I think I found the cause. When the first detect call happens, the display simply is still off. I just did some very basic tracing [0] and it seems the display simply is not enabled when it is supposed to get detected. And it seems injecting a drm_panel_prepare early for _testing_ [1] really did make the hotplug work on both my jerry and minnie. So I guess we should somehow make sure the panel is actually powered when detection is running. Although I'm not sure yet, how that should look like. Intuition suggests, making drm_panel calls nestable (similar to clk_prepare/unprepare, etc) and simply wrapping the detection code in a prepare-unprepare calls, but I'm not sure if Thierry might have other ideas ;-) Also my "log" below suggests some sort of mismatch between prepare/unprepare calls, as there are a lot more of the prepare-side. And the locking issue also seems to be still there [2]. Heiko [0] [ 2.797383] analogix_dp_reset [ 2.800709] analogix_dp_init_hpd [ 2.803960] analogix_dp_init_video [ 2.807653] rockchip-drm display-subsystem: bound ff970000.dp (ops rockchip_dp_component_ops) [ 2.817176] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 2.823799] [drm] No driver support for vblank timestamp query. [ 2.829947] analogix_dp_detect [ 2.833015] analogix_dp_get_plug_in_status: hpd status 0 ... [ 2.893425] analogix_dp_get_plug_in_status: hpd status 0 [ 2.893456] rockchip-dp ff970000.dp: failed to get hpd plug status, try to force hpd [ 2.893458] analogix_dp_force_hpd [ 2.893464] analogix_dp_get_plug_in_status: hpd status 112 [ 2.893470] panel_simple_prepare [ 2.952183] rockchip-dp ff970000.dp: EDID data does not include any extensions. [ 2.961727] panel_simple_get_modes [ 3.432154] analogix_dp_detect [ 3.432158] analogix_dp_get_plug_in_status: hpd status 120 [ 3.432160] panel_simple_prepare [ 3.433731] rockchip-dp ff970000.dp: EDID data does not include any extensions. [ 3.443268] panel_simple_get_modes [ 3.444668] panel_simple_prepare [ 3.444755] analogix_dp_reset [ 3.445078] analogix_dp_init_hpd [ 3.445096] panel_simple_disable [ 3.455349] analogix_dp_init_video [ 3.558323] rockchip-dp ff970000.dp: Timeout of video streamclk ok [ 3.558326] rockchip-dp ff970000.dp: unable to config video [ 3.558328] panel_simple_enable [ 3.573915] analogix_dp_detect [ 3.573919] analogix_dp_get_plug_in_status: hpd status 72 [ 3.573921] panel_simple_prepare [1] [2] [ 11.971277] panel_simple_get_modes [ OK ] Started LSB: X display manager for KDE. [ OK ] Started LSB: Speech Dispatcher. [ 12.007120] panel_simple_disable [ 12.012323] [ 12.013820] ====================================================== [ 12.019993] [ INFO: possible circular locking dependency detected ] [ 12.026250] 4.4.0-rc3+ #2755 Not tainted [ 12.030165] ------------------------------------------------------- [ 12.036417] Xorg/793 is trying to acquire lock: [ 12.040855] ((&dp->hotplug_work)){+.+...}[ 12.040870] [ 12.040870] but task is already holding lock: [ 12.040871] (crtc_ww_class_mutex){+.+.+.}, at: [] drm_modeset_lock+0x84/0x104 [ 12.040881] [ 12.040881] which lock already depends on the new lock. [ 12.040881] [ 12.040882] [ 12.040882] the existing dependency chain (in reverse order) is: [ 12.040883] [ 12.040883] -> #2 (crtc_ww_class_mutex){+.+.+.}: [ 12.040887] [] mutex_lock_nested+0x78/0x41c [ 12.040893] [] drm_modeset_lock+0xe0/0x104 [ 12.040896] [] drm_mode_getconnector+0x168/0x38c [ 12.040902] [] drm_ioctl+0x274/0x408 [ 12.040907] [] do_vfs_ioctl+0x670/0x750 [ 12.040911] [] SyS_ioctl+0x5c/0x84 [ 12.040914] [] ret_fast_syscall+0x0/0x1c [ 12.040920] [ 12.040920] -> #1 (&dev->mode_config.mutex){+.+.+.}: [ 12.040924] [] mutex_lock_nested+0x78/0x41c [ 12.040928] [] drm_helper_hpd_irq_event+0x40/0x150 [ 12.040934] [] analogix_dp_hotplug+0x24/0x28 [ 12.040938] [] process_one_work+0x328/0x668 [ 12.040942] [] worker_thread+0x2cc/0x41c [ 12.040945] [] kthread+0xf4/0x10c [ 12.040950] [] ret_from_fork+0x14/0x24 [ 12.040954] [ 12.040954] -> #0 ((&dp->hotplug_work)){+.+...}: [ 12.040958] [] lock_acquire+0x178/0x218 [ 12.040963] [] flush_work+0x4c/0x22c [ 12.040966] [] analogix_dp_bridge_disable+0x74/0xf0 [ 12.040970] [] drm_bridge_disable+0x34/0x38 [ 12.040973] [] drm_crtc_helper_set_mode+0x200/0x424 [ 12.040977] [] drm_crtc_helper_set_config+0x6c0/0x988 [ 12.040981] [] drm_mode_set_config_internal+0x60/0xdc [ 12.040984] [] drm_mode_setcrtc+0x3cc/0x474 [ 12.040988] [] drm_ioctl+0x274/0x408 [ 12.040991] [] do_vfs_ioctl+0x670/0x750 [ 12.040994] [] SyS_ioctl+0x5c/0x84 [ 12.040997] [] ret_fast_syscall+0x0/0x1c [ 12.041001] [ 12.041001] other info that might help us debug this: [ 12.041001] [ 12.041002] Chain exists of: [ 12.041002] (&dp->hotplug_work) --> &dev->mode_config.mutex --> crtc_ww_class_mutex [ 12.041007] [ 12.041008] Possible unsafe locking scenario: [ 12.041008] [ 12.041009] CPU0 CPU1 [ 12.041010] ---- ---- [ 12.041011] lock(crtc_ww_class_mutex); [ 12.041013] lock(&dev->mode_config.mutex); [ 12.041016] lock(crtc_ww_class_mutex); [ 12.041018] lock((&dp->hotplug_work)); [ 12.041020] [ 12.041020] *** DEADLOCK *** [ 12.041020] [ 12.041023] 3 locks held by Xorg/793: [ 12.041023] #0: (&dev->mode_config.mutex){+.+.+.}, at: [] drm_modeset_lock_all+0x50/0xd8 [ 12.041030] #1: (crtc_ww_class_acquire){+.+.+.}, at: [] drm_modeset_lock_all+0x60/0xd8 [ 12.041037] #2: (crtc_ww_class_mutex){+.+.+.}, at: [] drm_modeset_lock+0x84/0x104 [ 12.041044] [ 12.041044] stack backtrace: [ 12.041048] CPU: 3 PID: 793 Comm: Xorg Not tainted 4.4.0-rc3+ #2755 [ 12.041049] Hardware name: Rockchip (Device Tree) [ 12.041059] [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [ 12.041066] [] (show_stack) from [] (dump_stack+0x84/0xb8) [ 12.041072] [] (dump_stack) from [] (print_circular_bug+0x278/0x2cc) [ 12.041078] [] (print_circular_bug) from [] (__lock_acquire+0x14a0/0x1aec) [ 12.041082] [] (__lock_acquire) from [] (lock_acquire+0x178/0x218) [ 12.041086] [] (lock_acquire) from [] (flush_work+0x4c/0x22c) [ 12.041091] [] (flush_work) from [] (analogix_dp_bridge_disable+0x74/0xf0) [ 12.041097] [] (analogix_dp_bridge_disable) from [] (drm_bridge_disable+0x34/0x38) [ 12.041102] [] (drm_bridge_disable) from [] (drm_crtc_helper_set_mode+0x200/0x424) [ 12.041108] [] (drm_crtc_helper_set_mode) from [] (drm_crtc_helper_set_config+0x6c0/0x988) [ 12.041114] [] (drm_crtc_helper_set_config) from [] (drm_mode_set_config_internal+0x60/0xdc) [ 12.041119] [] (drm_mode_set_config_internal) from [] (drm_mode_setcrtc+0x3cc/0x474) [ 12.041124] [] (drm_mode_setcrtc) from [] (drm_ioctl+0x274/0x408) [ 12.041129] [] (drm_ioctl) from [] (do_vfs_ioctl+0x670/0x750) [ 12.041134] [] (do_vfs_ioctl) from [] (SyS_ioctl+0x5c/0x84) [ 12.041138] [] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x1c) [ 12.041210] panel_simple_unprepare [ 12.041359] panel_simple_prepare [ 12.101638] analogix_dp_reset [ 12.101879] analogix_dp_init_hpd [ 12.101897] panel_simple_disable [ 12.108543] analogix_dp_irq_handler: irq-type 0 [ 12.110452] rockchip-dp ff970000.dp: Link Training Clock Recovery success [ 12.111900] rockchip-dp ff970000.dp: Link Training success! [ 12.113384] analogix_dp_init_video [ 12.215825] rockchip-dp ff970000.dp: Timeout of video streamclk ok [ 12.215829] rockchip-dp ff970000.dp: unable to config video [ 12.215832] panel_simple_enable ,at: [] flush_work+0x0/0x22c diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 3990951..0c2dca5 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -399,6 +399,8 @@ static int rockchip_dp_probe(struct platform_device *pdev) dp->plat_data.panel = panel; +drm_panel_prepare(dp->plat_data.panel); + /* * We just use the drvdata until driver run into component * add function, and then we would set drvdata to null, so