From patchwork Sun Sep 8 13:28:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795482 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 1ED46CD4F4C for ; Sun, 8 Sep 2024 13:41:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6003E10E274; Sun, 8 Sep 2024 13:41:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="u2lALnls"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1616610E274 for ; Sun, 8 Sep 2024 13:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1725802880; bh=dbyT3VAtgqFNJh28eDMPmAIkHE6wApqXiwyZdxlGJ50=; b=u2lALnls3FtIldYwrRsNf5v2SKyvlR8J1sgp+OQMG1KH+UAG+OjEb0mXPrTUL2sjru7RvyAcU sm5zvomdTmW8BtdhuArvDUYWP/su+CSA2gn77Kxamx5AW+4oCi7dBVX6fp7q0v3dXsjbZrH8ABt RkQF+3PysvxzkfHKizbNhZJjRjzx6xGIBBz8laDhV5+SrtKhukx3VO8zsxFoTeEMZck3Pa3nBRT GM3zbNWz6/RqDgQcjmlx9E1TobYokxCk2vzxtYzfmDrJ/GbE0wnbZSGKCWanaoq7X8LNeKZc13q juUK32tUWSekLRCzdVpFxJJrVJO2DVNEGUkYMnQGpFwA== From: Jonas Karlman To: Andrzej Hajda , Neil Armstrong , Robert Foss , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Christian Hewitt , Diederik de Haas , Christopher Obbard , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/10] drm: bridge: dw_hdmi: Fold poweron and setup functions Date: Sun, 8 Sep 2024 13:28:07 +0000 Message-ID: <20240908132823.3308029-6-jonas@kwiboo.se> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240908132823.3308029-1-jonas@kwiboo.se> References: <20240908132823.3308029-1-jonas@kwiboo.se> MIME-Version: 1.0 X-Report-Abuse-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Complaints-To: abuse@forwardemail.net X-ForwardEmail-Version: 0.4.40 X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 X-ForwardEmail-ID: 66dda6943c9877b459587956 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Fold the poweron and setup functions into one function and use the adjusted_mode directly from the new crtc_state to remove the need of storing previous_mode. Signed-off-by: Jonas Karlman Reviewed-by: Neil Armstrong --- v2: No change --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 87fb6fd5cffd..1eefa633ff78 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2236,9 +2236,9 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) HDMI_IH_MUTE_FC_STAT2); } -static int dw_hdmi_setup(struct dw_hdmi *hdmi, - const struct drm_connector *connector, - const struct drm_display_mode *mode) +static int dw_hdmi_poweron(struct dw_hdmi *hdmi, + const struct drm_connector *connector, + const struct drm_display_mode *mode) { const struct drm_display_info *display = &connector->display_info; int ret; @@ -2378,15 +2378,6 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi) hdmi_writeb(hdmi, ih_mute, HDMI_IH_MUTE); } -static void dw_hdmi_poweron(struct dw_hdmi *hdmi) -{ - /* - * The curr_conn field is guaranteed to be valid here, as this function - * is only be called when !hdmi->disabled. - */ - dw_hdmi_setup(hdmi, hdmi->curr_conn, &hdmi->previous_mode); -} - static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) { if (hdmi->phy.enabled) { @@ -2936,15 +2927,19 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, { struct dw_hdmi *hdmi = bridge->driver_private; struct drm_atomic_state *state = old_state->base.state; + const struct drm_display_mode *mode; struct drm_connector *connector; + struct drm_crtc *crtc; connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); + crtc = drm_atomic_get_new_connector_state(state, connector)->crtc; + mode = &drm_atomic_get_new_crtc_state(state, crtc)->adjusted_mode; mutex_lock(&hdmi->mutex); hdmi->disabled = false; hdmi->curr_conn = connector; - dw_hdmi_poweron(hdmi); + dw_hdmi_poweron(hdmi, connector, mode); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, true); mutex_unlock(&hdmi->mutex);