From nobody Tue Apr 7 13:46:40 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 759E33C343C for ; Fri, 3 Apr 2026 18:53:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.215.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775242436; cv=none; b=hB5aqNeMhlrfePN7gWjPcz0aJFQmUMN/BgvAOqYkMcPNurORZbK9fUj1iFLH+GJluGJ25aKWy0SArbviKDeQvrYtsp+WT39uCUrvMBnhsK3ac9ANoj7VlC3B9Kjgy99zfDUm6cZYd3C5mvEKsbbhKHavvp3YFD2u89/Fi0eokqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775242436; c=relaxed/simple; bh=/o8daqB18ymFKCsKxghV/ctbORjW4/l9JykYIb4MLIo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tyh1Kn1LuI9bhDkHcspm03VANIEQvuBdU+Tgzi4uC0AcPlvnbrUEuvLdFxi+H8j4aRTP7muLLGS5SKKllY+ZFHydsGziMxKMbxbSgA3WzftK1Wl0MP80hFmTY1ur5t4PxvMuNppKXJ69QDXsYsYnP52sIla4od1gDlXrzb0fpAA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b=mhTdGlCj; arc=none smtp.client-ip=149.28.215.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="mhTdGlCj" 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=1775242428; bh=t0j6fHmt5eOTjqBJf8He6l0hKsw3FQ0FWAqMAP76P7w=; b=mhTdGlCjb1heRreye3pZ30hDEbFYe4u3lwstQ/MqZNaTc5dCH0CpgPxor7WLc3SDA1RNY1nzH 5NyBwsuX9anD+gSgEahsq5bb8Z/8Yy1HL10iWLsSVjIwWoPZTydlQpbOugmUtN+MZjd7+Tgifkb 9p10lgR55Gkx0Xu6q3wRE4AIMdtNjJ6n765PCdbwDawbikuEmXNbVo68Fu1PpAiQ/ulb8t2Xnb4 RSIlMdYG/eWbQSeFVuEDvSMz5C0gwPjFBVen6uom1EqdJF/71AnEeYZK9rXqOCE48uUWVUjA0fs uLUSZFguFZRMKEzFuT6xk37BHcdfgJFtZeNGp1zUjYOA== X-Forward-Email-ID: 69d00cb4dc98192b40b8933f X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 X-Forward-Email-Version: 2.6.68 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Report-Abuse-To: abuse@forwardemail.net From: Jonas Karlman To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Christian Hewitt , Diederik de Haas , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 03/13] drm: bridge: dw_hdmi: Call poweron/poweroff from atomic enable/disable Date: Fri, 3 Apr 2026 18:52:49 +0000 Message-ID: <20260403185303.80748-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260403185303.80748-1-jonas@kwiboo.se> References: <20260403185303.80748-1-jonas@kwiboo.se> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Change to only call poweron/poweroff from atomic_enable/atomic_disable funcs instead of trying to be clever by keeping a bridge_is_on state and poweron/off in the hotplug irq handler. The bridge is already enabled/disabled depending on connection state with the call to drm_helper_hpd_irq_event() in hotplug irq handler. A benefit of this is that drm mode_config mutex is always held at poweron/off, something that may reduce the need for the dw-hdmi mutex. Reviewed-by: Neil Armstrong Signed-off-by: Jonas Karlman --- v3: Collect r-b tag v2: Update commit message --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 33 ++--------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 3b851f12adfe..eea266d01de3 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -169,7 +169,6 @@ struct dw_hdmi { enum drm_connector_force force; /* mutex-protected force state */ struct drm_connector *curr_conn;/* current connector (only valid when !di= sabled) */ bool disabled; /* DRM has disabled our bridge */ - bool bridge_is_on; /* indicates the bridge is on */ bool rxsense; /* rxsense state */ u8 phy_mask; /* desired phy int mask settings */ u8 mc_clkdis; /* clock disable register */ @@ -2398,8 +2397,6 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *= hdmi) =20 static void dw_hdmi_poweron(struct dw_hdmi *hdmi) { - hdmi->bridge_is_on =3D true; - /* * The curr_conn field is guaranteed to be valid here, as this function * is only be called when !hdmi->disabled. @@ -2413,30 +2410,6 @@ static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) hdmi->phy.ops->disable(hdmi, hdmi->phy.data); hdmi->phy.enabled =3D false; } - - hdmi->bridge_is_on =3D false; -} - -static void dw_hdmi_update_power(struct dw_hdmi *hdmi) -{ - int force =3D hdmi->force; - - if (hdmi->disabled) { - force =3D DRM_FORCE_OFF; - } else if (force =3D=3D DRM_FORCE_UNSPECIFIED) { - if (hdmi->rxsense) - force =3D DRM_FORCE_ON; - else - force =3D DRM_FORCE_OFF; - } - - if (force =3D=3D DRM_FORCE_OFF) { - if (hdmi->bridge_is_on) - dw_hdmi_poweroff(hdmi); - } else { - if (!hdmi->bridge_is_on) - dw_hdmi_poweron(hdmi); - } } =20 /* @@ -2561,7 +2534,6 @@ static void dw_hdmi_connector_force(struct drm_connec= tor *connector) =20 mutex_lock(&hdmi->mutex); hdmi->force =3D connector->force; - dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); mutex_unlock(&hdmi->mutex); } @@ -2971,7 +2943,7 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_= bridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled =3D true; hdmi->curr_conn =3D NULL; - dw_hdmi_update_power(hdmi); + dw_hdmi_poweroff(hdmi); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, false); mutex_unlock(&hdmi->mutex); @@ -2989,7 +2961,7 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_b= ridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled =3D false; hdmi->curr_conn =3D connector; - dw_hdmi_update_power(hdmi); + dw_hdmi_poweron(hdmi); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, true); mutex_unlock(&hdmi->mutex); @@ -3089,7 +3061,6 @@ void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, boo= l hpd, bool rx_sense) if (hpd) hdmi->rxsense =3D true; =20 - dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); } mutex_unlock(&hdmi->mutex); --=20 2.53.0