From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D83F6C54FCD for ; Thu, 30 Jul 2026 03:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZOGfkFQw9P09ICYq3dP7Cmnkm3UbspD2UKIejaJKRIY=; b=hflGxy1X0nzUOZPiZoPYq3RJ57 7+VjuVNs8OwDJb3TnOc+KCLKQkb4eMJ+4/9zggflr14rpJ+i1oUFkR1KX5lfvJ6LHjwcSUshylV/W 2JCbtMnVXAZ7aV5aapKcyrN7yzU78D7cPe5MYhRosbwVzrryntGNd5b9p8anBXE4J/IgpHgxoQZ2n UFxIK/BiwFcPL+w/sxH6OcegdtC1lZIyS5RpitOlGGz/DkelMCC/4J+6xBg7591dKzoYIRD9WASKl ITYsj/hhua34VArYwggwdk0njV+T8MX2jrRsos84gABflY7sNwXSFFroljvW5Ajplefbee70vXKsC hhaMV9Hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wpHRv-00000009QYx-0t7u; Thu, 30 Jul 2026 03:28:47 +0000 Received: from mail-m25479.xmail.ntesmail.com ([103.129.254.79]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wpHRJ-00000009Q98-3lmP; Thu, 30 Jul 2026 03:28:13 +0000 Received: from zyb-HP-ProDesk-680-G2-MT.. (unknown [61.154.14.86]) by smtp.qiye.163.com (Hmail) with ESMTP id 481c5dbc6; Thu, 30 Jul 2026 11:27:57 +0800 (GMT+08:00) From: Damon Ding To: Andrzej Hajda , Neil Armstrong , Robert Foss , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Heiko Stuebner , Andy Yan Cc: Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Dmitry Baryshkov , Marek Szyprowski , Sebastian Reichel , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Damon Ding Subject: [PATCH v1 1/7] drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection Date: Thu, 30 Jul 2026 11:27:38 +0800 Message-Id: <20260730032744.381566-2-damon.ding@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730032744.381566-1-damon.ding@rock-chips.com> References: <20260730032744.381566-1-damon.ding@rock-chips.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0a9fb110839103a8kunm040f79123746d0 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkaTUpDVhkfTx9KThoYSRlOHVYVFA kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSU 9PT0hVSktLVUpCS0tZBg++ DKIM-Signature: a=rsa-sha256; b=iN22kAvV7y9P3Y4nkAsRqaTHyg9Fnsmxj+NKbYFGlbJTivI+FhlKAaonlRq6saPIelsRuKKfNR775t+Rxj8hJ/V6F3p+qPpJy3movN6X+toIEIeYL7EPjUy+wwQTzj8RmDzsIdfrLcUfBwW90UA8rFfZJFo/V8fRbpuUya7aSx8=; c=relaxed/relaxed; s=default; d=rock-chips.com; v=1; bh=ZOGfkFQw9P09ICYq3dP7Cmnkm3UbspD2UKIejaJKRIY=; h=date:mime-version:subject:message-id:from; X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260729_202810_169032_D4ABB7DB X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Rockchip platforms, the Analogix DP native HPD pin IRQ functionality requires the DP controller to be powered, clocked and initialized to generate plug/unplug interrupts correctly. To keep HPD detection active, move enable_irq()/disable_irq() from bridge enabling/disabling handlers into analogix_dp_bind() and analogix_dp_unbind(). Call pm_runtime_resume_and_get() before enabling IRQ and pm_runtime_put_sync() after disabling IRQ for symmetric power management. Persistent power is only necessary for native HPD pin mode. It is not required for force-HPD or GPIO HPD modes. Add helper to handle this special case exclusively for Rockchip native HPD pin configurations. Signed-off-by: Damon Ding --- .../drm/bridge/analogix/analogix_dp_core.c | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 8d3d4a6e6ca2..d414f4ff40c8 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -40,6 +40,12 @@ static const bool verify_fast_training; +static bool analogix_dp_require_pm_for_hpd_irq(struct analogix_dp_device *dp) +{ + return analogix_dp_is_rockchip(dp->plat_data->dev_type) && !dp->hpd_gpiod && + !dp->force_hpd; +} + static void analogix_dp_init_dp(struct analogix_dp_device *dp) { analogix_dp_reset(dp); @@ -1014,7 +1020,6 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp) goto out_dp_init; } - enable_irq(dp->irq); return 0; out_dp_init: @@ -1156,8 +1161,6 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) if (dp->dpms_mode != DRM_MODE_DPMS_ON) return; - disable_irq(dp->irq); - analogix_dp_set_analog_power_down(dp, POWER_ALL, 1); pm_runtime_put_sync(dp->dev); @@ -1504,6 +1507,14 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev) goto err_unregister_aux; } + if (analogix_dp_require_pm_for_hpd_irq(dp)) { + ret = pm_runtime_resume_and_get(dp->dev); + if (ret) + goto err_unregister_aux; + } + + enable_irq(dp->irq); + return 0; err_unregister_aux: @@ -1515,6 +1526,11 @@ EXPORT_SYMBOL_GPL(analogix_dp_bind); void analogix_dp_unbind(struct analogix_dp_device *dp) { + disable_irq(dp->irq); + + if (analogix_dp_require_pm_for_hpd_irq(dp)) + pm_runtime_put_sync(dp->dev); + drm_dp_aux_unregister(&dp->aux); } EXPORT_SYMBOL_GPL(analogix_dp_unbind); -- 2.34.1