From patchwork Sun Sep 8 13:28:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795474 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 11062E6FE49 for ; Sun, 8 Sep 2024 13:28:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D46510E26E; Sun, 8 Sep 2024 13:28:51 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="WOBmAzsb"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id 27BF810E26B for ; Sun, 8 Sep 2024 13:28:49 +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=1725802115; bh=hy/enUDFhn7EYrNY9bdwQkDRAdMM4VCr4M1zQdlFbcA=; b=WOBmAzsbKeEJgWFKLw7VqUnKlD7/EROqP8iVaIy7FXDzXG0YyUgzgk3+Ik+zRxgmF1jUjPmyn 1b9gca1la+9OP7m7ZMWo657t3/lDrd0vBDCP6XJmh1kqt50GCduS3Dnkrg+RzdYtS3A9oR1e6xg F0bZpixiAB+AjZs6d8IGzp1GE11EJiI0HOM+Xm6Vf2ZtGD3tfN877sqmFY+OWo0gY60kArNXkz7 E6MyqLPgeyDPkL0ALAjquoIAUxyUtLeVo5PNgOyXn4neSg5A0Qe1Jmmm/INjMP2NrO0Q84gZI9Y Kg5XK0Yd7rLk0Le6objUdVkCMpah6TM9xJWXePKuoJzg== 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 01/10] drm: bridge: dw_hdmi: Disable scrambler feature when not supported Date: Sun, 8 Sep 2024 13:28:03 +0000 Message-ID: <20240908132823.3308029-2-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: 66dda6823c9877b4595878fc 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" The scrambler feature can be left enabled when hotplugging from a sink and mode that require scrambling to a sink that does not support SCDC or scrambling. Typically a blank screen or 'no signal' message can be observed after using a HDMI 2.0 4K@60Hz mode and then hotplugging to a sink that only support HDMI 1.4. Fix this by disabling the scrambler feature when SCDC is not supported. Fixes: 264fce6cc2c1 ("drm/bridge: dw-hdmi: Add SCDC and TMDS Scrambling support") Reported-by: Christopher Obbard Signed-off-by: Jonas Karlman Reviewed-by: Neil Armstrong --- v2: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 0031f3c54882..9e7f86a0bf5c 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2117,6 +2117,8 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, HDMI_MC_SWRSTZ); drm_scdc_set_scrambling(hdmi->curr_conn, 0); } + } else if (hdmi->version >= 0x200a) { + hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL); } /* Set up horizontal active pixel width */ From patchwork Sun Sep 8 13:28:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795485 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 42EB5E6FE49 for ; Sun, 8 Sep 2024 13:41:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7109110E276; Sun, 8 Sep 2024 13:41:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="QNl/oDXn"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A54B10E275 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=Kv653550ZAaYWcH77Mo8Hgi73sCYCuyVNLs67561gpQ=; b=QNl/oDXnAwNwSHHdqHGR8JO1xciDmBX6yQ9MBTe6qH0jkw3ofkRnJP1pD9UUfjgfH/m2F9h8y 0tPBk61A77f+eLzx10e/02nXz0iRX73MNOsbfupMtVU8N7ETsu7Mi1hWia7i6dR9uhijZiDc4lP eFL5lhShLodbR6VgfWWpBw+z5tIulBlbt/4lu/fko5QwG/I66hI/sZCxKCJS6dtOGeFeRRGdkuK 7Vy9YQ4JPk1Oe9a+s70ZGh+a45v9b0bero93nmqR7F60Yxbue3JEb/490tzRiP2378R5W2R/Kg5 K8KY5aWidCPGZAEN1phWb7qkyRaXrPYkXGyo7t7RHO5Q== 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 , Lucas Stach 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 02/10] drm: bridge: dw_hdmi: Only notify connected status on HPD interrupt Date: Sun, 8 Sep 2024 13:28:04 +0000 Message-ID: <20240908132823.3308029-3-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: 66dda6873c9877b459587918 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" drm_helper_hpd_irq_event() and drm_bridge_hpd_notify() may incorrectly be called with a connected status when HPD is high and RX sense is changed. This typically happen when the HDMI cable is unplugged, shortly before the HPD is changed to low. Fix this by only notify connected status on the HPD interrupt when HPD is going high, not on the RX sense interrupt when RX sense is changed. Fixes: da09daf88108 ("drm: bridge: dw_hdmi: only trigger hotplug event on link change") Signed-off-by: Jonas Karlman --- v2: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 9e7f86a0bf5c..055fc9848df4 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3123,7 +3123,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) mutex_unlock(&hdmi->cec_notifier_mutex); } - if (phy_stat & HDMI_PHY_HPD) + if ((intr_stat & HDMI_IH_PHY_STAT0_HPD) && + (phy_stat & HDMI_PHY_HPD)) status = connector_status_connected; if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) From patchwork Sun Sep 8 13:28:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795484 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 D7785ECE579 for ; Sun, 8 Sep 2024 13:41:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 664E610E273; Sun, 8 Sep 2024 13:41:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="syF7NX6z"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A82310E273 for ; Sun, 8 Sep 2024 13:41:29 +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=NEOQIls6G9LJG/5aOQ8hTffhHkvDHnR+iX1UstZb2no=; b=syF7NX6zoQA6iibaxLyzDvTZf/J0XtNoFxrUtDhX866161H+lzAMImy7tiGdVFHWEoHh3yjo1 GFpvdGvolslFJrIA4xdFwXqcjOFH2vBPAZ8Yh7rLsZHbXU5g/jNBciqsK8VRbszitGlceNSJb1O uAaByWN0f39AqrmGnrvw62f9dUGGmdbBKn8fzYqerrBI+BhvkGVecW0Y5mlMq00ROKsrQW8i5uF YrDeuMH4kIhEiVCflL5I/MmA9k0vRza+5mT3Qi8GvbKtTDeN/a4MKzfPD/fpzwhshsksmS7sp4y n9MRmbzBKxscfIVsaE5k8f/ihaJyUafVGVXguKJk5Sgw== 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 03/10] drm: bridge: dw_hdmi: Call poweron/poweroff from atomic enable/disable Date: Sun, 8 Sep 2024 13:28:05 +0000 Message-ID: <20240908132823.3308029-4-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: 66dda68b3c9877b45958792c 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" Change to only call poweron/poweroff from atomic_enable/atomic_disable ops 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 our own mutex. Signed-off-by: Jonas Karlman Reviewed-by: Neil Armstrong --- 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/bridge/synopsys/dw-hdmi.c index 055fc9848df4..5b67640b1d0a 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 !disabled) */ 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 */ @@ -2382,8 +2381,6 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi) static void dw_hdmi_poweron(struct dw_hdmi *hdmi) { - hdmi->bridge_is_on = true; - /* * The curr_conn field is guaranteed to be valid here, as this function * is only be called when !hdmi->disabled. @@ -2397,30 +2394,6 @@ static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) hdmi->phy.ops->disable(hdmi, hdmi->phy.data); hdmi->phy.enabled = false; } - - hdmi->bridge_is_on = false; -} - -static void dw_hdmi_update_power(struct dw_hdmi *hdmi) -{ - int force = hdmi->force; - - if (hdmi->disabled) { - force = DRM_FORCE_OFF; - } else if (force == DRM_FORCE_UNSPECIFIED) { - if (hdmi->rxsense) - force = DRM_FORCE_ON; - else - force = DRM_FORCE_OFF; - } - - if (force == DRM_FORCE_OFF) { - if (hdmi->bridge_is_on) - dw_hdmi_poweroff(hdmi); - } else { - if (!hdmi->bridge_is_on) - dw_hdmi_poweron(hdmi); - } } /* @@ -2545,7 +2518,6 @@ static void dw_hdmi_connector_force(struct drm_connector *connector) mutex_lock(&hdmi->mutex); hdmi->force = connector->force; - dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); mutex_unlock(&hdmi->mutex); } @@ -2954,7 +2926,7 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled = true; hdmi->curr_conn = 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); @@ -2973,7 +2945,7 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled = false; hdmi->curr_conn = 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); @@ -3072,7 +3044,6 @@ void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) if (hpd) hdmi->rxsense = true; - dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); } mutex_unlock(&hdmi->mutex); From patchwork Sun Sep 8 13:28:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795483 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 29BB4CD4F4C for ; Sun, 8 Sep 2024 13:41:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 776CC10E275; 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="HZjtNx6W"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id 065E310E273 for ; Sun, 8 Sep 2024 13:41:24 +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=SwssP0ZpPX5Ykot2pn4Kbx+P04XckEzOPPdS7RWmo0Q=; b=HZjtNx6WFNS3JtcGhLwsS13hh47EBnUOR9yMONoZXHTBaexPG0hqen/2+7AX7QGyBO/D+uyw7 D8eYPQsmUoZjHt6erc91OP3E4EtlaEbm24qTllZf50YNDOuznwPnUWMlc6oAUGSwxwq1/SAi5Gx V8/D5SAjFkEN2L7LE2GBvkRjfRRpucJNHMMAMMq0mTmNUDlay12xx6VzSHGwLTzmSJW5LcKic0y rNZEwnC9P/LuSpdxkfntdjZUQFTZlYgUBTK+ZmSwc//R0mzPZE8mf/BpnPvOTVXbtHynZ+oziqx Ds6uAleKbkYYvdTXemcZEU6dH+mQqeejSGyOEK35KIRg== 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 04/10] drm: bridge: dw_hdmi: Use passed mode instead of stored previous_mode Date: Sun, 8 Sep 2024 13:28:06 +0000 Message-ID: <20240908132823.3308029-5-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: 66dda6903c9877b459587942 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" Use the passed mode instead of mixing use of passed mode and the stored previous_mode. The passed mode is currenly always the previous_mode. Also fix a small typo and add a variable to help shorten a code line. Signed-off-by: Jonas Karlman Reviewed-by: Neil Armstrong --- v2: Update commit message, s/type/typo/ --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 5b67640b1d0a..87fb6fd5cffd 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2240,6 +2240,7 @@ static int dw_hdmi_setup(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; hdmi_disable_overflow_interrupts(hdmi); @@ -2285,12 +2286,10 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, hdmi->hdmi_data.video_mode.mdataenablepolarity = true; /* HDMI Initialization Step B.1 */ - hdmi_av_composer(hdmi, &connector->display_info, mode); + hdmi_av_composer(hdmi, display, mode); - /* HDMI Initializateion Step B.2 */ - ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, - &connector->display_info, - &hdmi->previous_mode); + /* HDMI Initialization Step B.2 */ + ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, display, mode); if (ret) return ret; hdmi->phy.enabled = true; 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); From patchwork Sun Sep 8 13:28:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795475 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 51536E6FE49 for ; Sun, 8 Sep 2024 13:29:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9891210E26D; Sun, 8 Sep 2024 13:29:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="RFreiCMw"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id 06E9710E26D for ; Sun, 8 Sep 2024 13:29:11 +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=1725802140; bh=PMtF2O6gt4k2B52zCrqb9+HqSYyBlwLm0yxYoXiBs0M=; b=RFreiCMwTU2X8JQ9IGlVoSEMYHgeMxWmIs0eUknjGi6shdywHEYXMRf9ATeTndJgTTYh7M1Fd TxIzNrCv2jbE63YLjz7OMBiHIrgA/x6+EOVHyJJOpA4t6cXOYs8mX6G9V7rPQGTU8gHmlB2ExLu PwUQciIryPldt8ArfjdlMRsRJT0N/oL4MjyVSlngdGPUomlENBB8m3HD4r+bF45YcDelaIy9Mi6 qKIvwNpAQhGivX3EiwMtyybE1vi9OWs7ZreZEev+A7E6gs9WAWrvkmAnhB1ct+La72Zm9zU5lVX xDW6iaVKjFUb5mF8Mwmj9reFGnsulP6qtUOxdTVVh2/g== 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 06/10] drm: bridge: dw_hdmi: Remove previous_mode and mode_set Date: Sun, 8 Sep 2024 13:28:08 +0000 Message-ID: <20240908132823.3308029-7-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: 66dda6993c9877b459587968 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" With the use of adjusted_mode directly from the crtc_state there is no longer a need to store a copy in previous_mode, remove it and the now unneeded mode_set ops. Signed-off-by: Jonas Karlman Reviewed-by: Neil Armstrong --- v2: No change --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 1eefa633ff78..6a94376a3da3 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -154,8 +154,6 @@ struct dw_hdmi { bool enabled; } phy; - struct drm_display_mode previous_mode; - struct i2c_adapter *ddc; void __iomem *regs; bool sink_is_hdmi; @@ -165,7 +163,7 @@ struct dw_hdmi { struct pinctrl_state *default_state; struct pinctrl_state *unwedge_state; - struct mutex mutex; /* for state below and previous_mode */ + struct mutex mutex; /* for state below */ enum drm_connector_force force; /* mutex-protected force state */ struct drm_connector *curr_conn;/* current connector (only valid when !disabled) */ bool disabled; /* DRM has disabled our bridge */ @@ -2894,20 +2892,6 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, return mode_status; } -static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge, - const struct drm_display_mode *orig_mode, - const struct drm_display_mode *mode) -{ - struct dw_hdmi *hdmi = bridge->driver_private; - - mutex_lock(&hdmi->mutex); - - /* Store the display mode for plugin/DKMS poweron events */ - drm_mode_copy(&hdmi->previous_mode, mode); - - mutex_unlock(&hdmi->mutex); -} - static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, struct drm_bridge_state *old_state) { @@ -2971,7 +2955,6 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { .atomic_get_input_bus_fmts = dw_hdmi_bridge_atomic_get_input_bus_fmts, .atomic_enable = dw_hdmi_bridge_atomic_enable, .atomic_disable = dw_hdmi_bridge_atomic_disable, - .mode_set = dw_hdmi_bridge_mode_set, .mode_valid = dw_hdmi_bridge_mode_valid, .detect = dw_hdmi_bridge_detect, .edid_read = dw_hdmi_bridge_edid_read, From patchwork Sun Sep 8 13:28:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795476 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 87ED8E6FE49 for ; Sun, 8 Sep 2024 13:29:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E994B10E26B; Sun, 8 Sep 2024 13:29:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="irIJXzKj"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id E089E10E26B for ; Sun, 8 Sep 2024 13:29:21 +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=1725802145; bh=bw7hUA9+T9ojuBGzAwclXIncQiP3YNb92ShoyGh/flo=; b=irIJXzKjfxQDHQuGOAJzKUxX4mvjCB4XMUrvWnyX9XcNVS0WkpkPBwmf4okaWaixE6WIcKRzQ YqgkSQBE/yZrD5XcgwidI1wV2I8ZRndbkzgsW92FzCfUqf4NWU0SLve6yaF/bAVSGO83SDjAKsM EUyBayPFiykG3+5NBN5NGz7q0+JTVHkeiX4FF6qvh+nEnLF670zgk2nhuJA1pxnosZi6TMRw48u t89YR5ikSMgw6rLnRq/AjR37QCLvMVmGC5KAMeFQHif4kF60Eq7AYbUWJbfxmKK0ENFwLDmCMB/ vwjGHB7aiXCv7qC2t030xXkw+AcEir6354uHB2habKtQ== 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 07/10] drm: bridge: dw_hdmi: Invalidate CEC phys addr from connector detect Date: Sun, 8 Sep 2024 13:28:09 +0000 Message-ID: <20240908132823.3308029-8-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: 66dda69d3c9877b45958797c 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" Wait until the connector detect ops is called to invalidate CEC phys addr instead of doing it directly from the irq handler. Reviewed-by: Neil Armstrong Signed-off-by: Jonas Karlman --- v2: Collect r-b tag --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 6a94376a3da3..8ec97babd334 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2454,7 +2454,17 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) { struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); - return dw_hdmi_detect(hdmi); + enum drm_connector_status status; + + status = dw_hdmi_detect(hdmi); + + if (status == connector_status_disconnected) { + mutex_lock(&hdmi->cec_notifier_mutex); + cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + mutex_unlock(&hdmi->cec_notifier_mutex); + } + + return status; } static int dw_hdmi_connector_get_modes(struct drm_connector *connector) @@ -3065,12 +3075,6 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) phy_stat & HDMI_PHY_HPD, phy_stat & HDMI_PHY_RX_SENSE); - if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) { - mutex_lock(&hdmi->cec_notifier_mutex); - cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); - mutex_unlock(&hdmi->cec_notifier_mutex); - } - if ((intr_stat & HDMI_IH_PHY_STAT0_HPD) && (phy_stat & HDMI_PHY_HPD)) status = connector_status_connected; From patchwork Sun Sep 8 13:28:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795478 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 4817FCD4F4C for ; Sun, 8 Sep 2024 13:29:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0BAE10E270; Sun, 8 Sep 2024 13:29:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="XtqTRQ8J"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id BCE8F10E270 for ; Sun, 8 Sep 2024 13:29:30 +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=1725802151; bh=TuhVKe3weOntTsfCsjZn+CLnTcjzMkqTe8icEx7g6YU=; b=XtqTRQ8JtADF5rAoc9u22pLFnF/8lC4syVJBR++Yj5/iNfTgYsCyxzaTxeFpIqlCxA99JWJA8 pKoKi2hBGilRZtk+ZUJdrwgRKJkH0BKFIg2MhoCgA16YTXFFsQLHPcQBBHSfbx102aust5S5UWQ PPxAGgKFfMZ2mEmHVTlw3WYpKAksJwygSgHuQi3PSZywPGgL1czaRaAZjVJMiVl6SD1y8HSA5dh AQNGkkJjy3TGFWbzVKRpzzWV3OO41qWQXAd60C8stYGQjj0H8olj8VCxA3nzEI0WKxm9IVV+dgx XGSV4bF6w3BChDFAUas0M63V5orjkz054Umye1XSkJfA== 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 08/10] drm: bridge: dw_hdmi: Remove cec_notifier_mutex Date: Sun, 8 Sep 2024 13:28:10 +0000 Message-ID: <20240908132823.3308029-9-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: 66dda6a23c9877b45958799d 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" With CEC phys addr invalidation moved away from the irq handler there is no longer a need for cec_notifier_mutex, remove it. Reviewed-by: Neil Armstrong Signed-off-by: Jonas Karlman --- v2: Collect r-b tag --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 8ec97babd334..c19307120909 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -186,7 +186,6 @@ struct dw_hdmi { void (*enable_audio)(struct dw_hdmi *hdmi); void (*disable_audio)(struct dw_hdmi *hdmi); - struct mutex cec_notifier_mutex; struct cec_notifier *cec_notifier; hdmi_codec_plugged_cb plugged_cb; @@ -2458,11 +2457,8 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) status = dw_hdmi_detect(hdmi); - if (status == connector_status_disconnected) { - mutex_lock(&hdmi->cec_notifier_mutex); + if (status == connector_status_disconnected) cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); - mutex_unlock(&hdmi->cec_notifier_mutex); - } return status; } @@ -2576,9 +2572,7 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) if (!notifier) return -ENOMEM; - mutex_lock(&hdmi->cec_notifier_mutex); hdmi->cec_notifier = notifier; - mutex_unlock(&hdmi->cec_notifier_mutex); return 0; } @@ -2876,10 +2870,8 @@ static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) { struct dw_hdmi *hdmi = bridge->driver_private; - mutex_lock(&hdmi->cec_notifier_mutex); cec_notifier_conn_unregister(hdmi->cec_notifier); hdmi->cec_notifier = NULL; - mutex_unlock(&hdmi->cec_notifier_mutex); } static enum drm_mode_status @@ -3304,7 +3296,6 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, mutex_init(&hdmi->mutex); mutex_init(&hdmi->audio_mutex); - mutex_init(&hdmi->cec_notifier_mutex); spin_lock_init(&hdmi->audio_lock); ret = dw_hdmi_parse_dt(hdmi); From patchwork Sun Sep 8 13:28:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795477 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 3261AECE57A for ; Sun, 8 Sep 2024 13:29:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E80610E26F; Sun, 8 Sep 2024 13:29:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="SiliM5Y4"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7262A10E26F for ; Sun, 8 Sep 2024 13:29:28 +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=1725802151; bh=8TqgWjT3UGoq8NhlqNVT+UNBc/OTSgrzdmn4WedFMlo=; b=SiliM5Y4uv2xAzqEW+kAAu/blbSllSL/y+qZapkThn+8tepqhlG7/P7tSN2kHBjMZC4w2sG+u pnwbz7P1CW2jtYTM281z1BbT1beKCMT0MYyHw/qfWsO5vReUYcv7WHjcsrcafdKlmcKBmzuBi+8 pzccuCRELE62qQZDcSZZEMRl8o+QArmL+MLBcRDnnh/hirA/ZAMNXm05NEILgtpMXxP+dc1fFt4 lndVGtMo4nRVI5gmoNjfeok1QR79uMa+KbE4ag0ViHB0EQgWT4mYzk//NXd/ZX/xNGxKRMVPiWV 2J2xgcKLljj5FSlSFiET7xcG+nerpJYh8sJCvmK13nyw== 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 09/10] drm: bridge: dw_hdmi: Update EDID during hotplug processing Date: Sun, 8 Sep 2024 13:28:11 +0000 Message-ID: <20240908132823.3308029-10-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: 66dda6a63c9877b4595879b6 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" Update successfully read EDID during hotplug processing to ensure the connector diplay_info is always up-to-date. Signed-off-by: Jonas Karlman --- v2: No change --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index c19307120909..7bd9f895f03f 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2457,6 +2457,18 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) status = dw_hdmi_detect(hdmi); + /* Update EDID during hotplug processing (force=false) */ + if (status == connector_status_connected && !force) { + const struct drm_edid *drm_edid; + + drm_edid = dw_hdmi_edid_read(hdmi, connector); + if (drm_edid) + drm_edid_connector_update(connector, drm_edid); + cec_notifier_set_phys_addr(hdmi->cec_notifier, + connector->display_info.source_physical_address); + drm_edid_free(drm_edid); + } + if (status == connector_status_disconnected) cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); From patchwork Sun Sep 8 13:28:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13795479 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 604F2ECE57A for ; Sun, 8 Sep 2024 13:29:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CDEEC10E271; Sun, 8 Sep 2024 13:29:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="G6QUvcBF"; dkim-atps=neutral Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1E24910E271 for ; Sun, 8 Sep 2024 13:29:32 +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=1725802156; bh=PP2Q5FqW/bN+deyQX3i1184rCXMWlxXESw9UhvzQYVs=; b=G6QUvcBFgWWyHpZGH137Ht0yhKDVAU313ONpBmYC1FzNVoJyo1ca/BR2NtA6vfj3/dh/fq8zd eRLd1Ei7ZYlKnplSs4E0cDLoJWWYgSs5Mj/Xt3zd08C2e1x9VvBq3P2CrzNakSZn+CxQkDSPJ/L iXXWUrP8ACEAdq238tfVsv+VOkXXWEQ1T5fkWLJDcZyPSr/geSFHs+dDJuwSJkCUh2oCodTgkK5 xBEkDxotiD38PoZ82rSPN1I7ENbAYpisRp8xqcKyeKdCbjCMW+w4KZwGKB1xjNriAt63CNJ/UeO ITqvdJvvxNgy11KMWeZ5L2s7FZi1rXHDveoX5VGVrRhQ== 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 10/10] drm: bridge: dw_hdmi: Use display_info is_hdmi and has_audio Date: Sun, 8 Sep 2024 13:28:12 +0000 Message-ID: <20240908132823.3308029-11-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: 66dda6ab3c9877b4595879ca 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" drm_edid_connector_update() is being called from bridge connector ops and from detect and get_modes ops for dw-hdmi connector. Change to use is_hdmi and has_audio from display_info directly instead of keeping our own state in sink_is_hdmi and sink_has_audio. Also remove the old and unused edid struct member and related define. Reviewed-by: Neil Armstrong Signed-off-by: Jonas Karlman --- v2: Collect r-b tag --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 32 ++++------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 7bd9f895f03f..b9a1304b740c 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -43,8 +43,6 @@ #define DDC_CI_ADDR 0x37 #define DDC_SEGMENT_ADDR 0x30 -#define HDMI_EDID_LEN 512 - /* DW-HDMI Controller >= 0x200a are at least compliant with SCDC version 1 */ #define SCDC_MIN_SOURCE_VERSION 0x1 @@ -145,8 +143,6 @@ struct dw_hdmi { int vic; - u8 edid[HDMI_EDID_LEN]; - struct { const struct dw_hdmi_phy_ops *ops; const char *name; @@ -156,8 +152,6 @@ struct dw_hdmi { struct i2c_adapter *ddc; void __iomem *regs; - bool sink_is_hdmi; - bool sink_has_audio; struct pinctrl *pinctrl; struct pinctrl_state *default_state; @@ -2038,7 +2032,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, HDMI_FC_INVIDCONF_IN_I_P_INTERLACED : HDMI_FC_INVIDCONF_IN_I_P_PROGRESSIVE; - inv_val |= hdmi->sink_is_hdmi ? + inv_val |= display->is_hdmi ? HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE : HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE; @@ -2274,7 +2268,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, if (hdmi->hdmi_data.enc_out_bus_format == MEDIA_BUS_FMT_FIXED) hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; - hdmi->hdmi_data.rgb_limited_range = hdmi->sink_is_hdmi && + hdmi->hdmi_data.rgb_limited_range = display->is_hdmi && drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED; @@ -2294,7 +2288,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, /* HDMI Initialization Step B.3 */ dw_hdmi_enable_video_path(hdmi); - if (hdmi->sink_has_audio) { + if (display->has_audio) { dev_dbg(hdmi->dev, "sink has audio support\n"); /* HDMI Initialization Step E - Configure audio */ @@ -2303,7 +2297,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, } /* not for DVI mode */ - if (hdmi->sink_is_hdmi) { + if (display->is_hdmi) { dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__); /* HDMI Initialization Step F - Configure AVI InfoFrame */ @@ -2417,29 +2411,13 @@ static const struct drm_edid *dw_hdmi_edid_read(struct dw_hdmi *hdmi, struct drm_connector *connector) { const struct drm_edid *drm_edid; - const struct edid *edid; if (!hdmi->ddc) return NULL; drm_edid = drm_edid_read_ddc(connector, hdmi->ddc); - if (!drm_edid) { + if (!drm_edid) dev_dbg(hdmi->dev, "failed to get edid\n"); - return NULL; - } - - /* - * FIXME: This should use connector->display_info.is_hdmi and - * connector->display_info.has_audio from a path that has read the EDID - * and called drm_edid_connector_update(). - */ - edid = drm_edid_raw(drm_edid); - - dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", - edid->width_cm, edid->height_cm); - - hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); - hdmi->sink_has_audio = drm_detect_monitor_audio(edid); return drm_edid; }