From nobody Sat Nov 30 16:38:20 2024 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 975C2169AE3 for ; Sun, 8 Sep 2024 13:28:56 +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=1725802138; cv=none; b=aMnOAMvt2Ho1nHKQ70C/sYjXQGVOT9wySo4aGZDiD4zaOQTOldjWvN4ZjAiC3xvnoYCaLebQZebUKBRlIzU2HNLFPjJAiDnj1UVqDW9o034pdLyOH/25SNWnE8vU8vWp5qAlrPHVhJsUDDqae/LbiAhSfrbbzxTTSp30+fBpeHA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802138; c=relaxed/simple; bh=GrI4opR+kr4AsJ6Etg/Qjdy9EfwwwJ5+46y3TO7YBKA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HSoLAj7Xqpap4RY0gASYz+uhHCttun0M4kMWpJCcj4f5nt4V/G4S/goqgZFbW2VqNPLVh6qKBbgBCxoTPPyHQxPqppxNJJBNZfYFUQ7FRTGVFasOdLZM+/EZpCZ/C9MmpOvKnN04Pfr8aivRc/2J01VhwxwDytsUVx40jEz5Ho8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=WOBmAzsb; arc=none smtp.client-ip=149.28.215.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="WOBmAzsb" 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> 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 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 Content-Type: text/plain; charset="utf-8" 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 sup= port") 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/br= idge/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 >=3D 0x200a) { + hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL); } =20 /* Set up horizontal active pixel width */ --=20 2.46.0 From nobody Sat Nov 30 16:38:20 2024 Received: from smtp.forwardemail.net (smtp.forwardemail.net [207.246.76.47]) (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 2050D169382 for ; Sun, 8 Sep 2024 13:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.246.76.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802152; cv=none; b=NLVktU/9q+W+bKDf95NYNCX9S6w26srkKBtHR6i7tn2o27A4cDiUvSYd65QTHYuSs6SalUKiEcbOSi9t3XzDovRGeIvjGjhJIQp9e/Q/dZzcPsdeiPbL1tuxJLqhm+dDwaT7Jl/Npf4RaV5FgvmcuVguV9nDlvWCLiM0GzE/y10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802152; c=relaxed/simple; bh=tOaMnuPdwTV9/9ThVq4HRnP/PQCu2FYyniLaLSxMpFs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dM3T6q3rU6d4+YUCOKL4p1juVfws93AM857dk3qqQM5CuouFc93/zIgT3DI5mvp3xK72aBJ2KLcUB0WSVuRGSK2b9yCGiPKNVaNlyeg2gC1nPdQ55/0sRPzWyJBRk08Pshxkgx6WwffC2v+PJxb4JY3EQFif3lr29kIVJxj/v5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=MeyI+Xr9; arc=none smtp.client-ip=207.246.76.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="MeyI+Xr9" 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=1725802119; bh=Kv653550ZAaYWcH77Mo8Hgi73sCYCuyVNLs67561gpQ=; b=MeyI+Xr9e5DGYFdF8X8Zcctpz8J3Ytfvis5MqM/5+ASyyuVckg0YITWoqFKtg6WNLzBTktxN6 rhAVUyzVuEio18nugu8UT+SwCXqrJPjdHWrrE2ByjdbP7CL4wNe2vo8Ar3qrCNxUoaLpVZIU58C jeSlopzkOszghoA2RE605iS0Vq5ySTe+2DfDQiyKfzUMcD+xtXDjS2FVDED61O0atDmyaRmJdbp t+rdVkUb23eqTykIunpkyFg0lkPHBq6EjKhLD0phhN+Jx1e03sZjoWciYcRjQR0AluA7DL1N9/u /kPEMlmTZjnlKnTevrlbJaAIQS4aXxV16ihCgB6YolXQ== 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> 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 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, 207.246.76.47 X-ForwardEmail-ID: 66dda6873c9877b459587918 Content-Type: text/plain; charset="utf-8" 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 l= ink 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/br= idge/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); } =20 - if (phy_stat & HDMI_PHY_HPD) + if ((intr_stat & HDMI_IH_PHY_STAT0_HPD) && + (phy_stat & HDMI_PHY_HPD)) status =3D connector_status_connected; =20 if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) --=20 2.46.0 From nobody Sat Nov 30 16:38:20 2024 Received: from smtp.forwardemail.net (smtp.forwardemail.net [207.246.76.47]) (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 27EAA169AE3 for ; Sun, 8 Sep 2024 13:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.246.76.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802153; cv=none; b=Hm5Gv+coK2umRZS/KXmwQsGG5xpOb64HYAqpeyeb6UOX7kFtihCV9IAMfohKxCSM5LeUWfSRcwucrTiTx7yrOZy8N0N20sMUPJdvayyHv94wI2l5vJ0wL7YG13XhYuVUoevpc2kK4BtEPmIUcJ2XuknGf38eowHWnfCCN1Jn4c8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802153; c=relaxed/simple; bh=TiTawGsoL5BXS8wAZOe3Qtz870Q7AQcvUvjoYEkJ9xY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=himeG0O222lzZW7eXgWwBIDP/VkKaVGrrig48JzTFZ3liUzd6qm/VewpXfxTsNSkfGDuguZDOXJZuQkW37vdkYw5RysrHbBhR9srqhiuSa6Tpj3M5Yts4wSh9EE3jBVRn9Z05ITN3H/G8IGNztnFZkxeftT0OIkQW5nMbvImGSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=0iP8J8nD; arc=none smtp.client-ip=207.246.76.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="0iP8J8nD" 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=1725802125; bh=NEOQIls6G9LJG/5aOQ8hTffhHkvDHnR+iX1UstZb2no=; b=0iP8J8nD/rILYwFBix8TzvShoVcSRLTnUGN6fEs8TvmwxxZhPolnc59u+IUtdBU9x89GfH2k0 GaDp3dDaPe2q86zMyRGjeTcO4DRDEfEUy3VeA6j1+gKJ5dONSHfqZfLv6RDixW5RbM2PUeHN/rS slSCb32najPQct1tqVUNwRbXpJTNu9NFnXL75R12/KBlO2xD+pHjWDMF5eI8MoM7BDdmLmritGT ocSiecPCNzn/XiUAoi4SvljBA2pJhiACuK83H2d/wVFVERk/fqx3JwKeQUYvdD0U0alMeRu3XGp Necs7nDguOlHAitsxfjoh0M2+7/iy641aEImlyGDj2lw== 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> 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 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, 207.246.76.47 X-ForwardEmail-ID: 66dda68b3c9877b45958792c Content-Type: text/plain; charset="utf-8" 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/br= idge/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 !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 */ @@ -2382,8 +2381,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. @@ -2397,30 +2394,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 /* @@ -2545,7 +2518,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); } @@ -2954,7 +2926,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); @@ -2973,7 +2945,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); @@ -3072,7 +3044,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.46.0 From nobody Sat Nov 30 16:38:20 2024 Received: from smtp.forwardemail.net (smtp.forwardemail.net [207.246.76.47]) (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 4ACF8167296 for ; Sun, 8 Sep 2024 13:29:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.246.76.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802153; cv=none; b=eLY6woMnzxZ6z/tx8NWy1G+nmTzO3xcSWiX2tTbTkwA9qTfmzztsyRrmMeFcpYplqVgCWp/vcNazG0D6cT21rY8cy3NVIa7U9I0ndaCsr5TQaKloHtdNZCCJ08O7/NmXsQlFrWeyuzYPYi5fg1kryCJ9Od1NvpzACw2tTFrHX28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802153; c=relaxed/simple; bh=QBjftpFE00OunI40RJX3FzxsG9u8JiaZOgW8fd9XDtc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZYHggWBIgp2/skYDZfGMkDkkwqvgpgxKzNDl7ocCnVQQLYTXZfzPZ0MiGbRn9C+nhhR7nfwZi/Snp3BiHSHm2hNobSaPensDROmc5be9GRQIqBMORcoeR0i9/kDjaj1crrbINt0zZ/llKcduEJDPLWaFXKTwpuTfj/9dIHKId+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=iRA9mz85; arc=none smtp.client-ip=207.246.76.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="iRA9mz85" 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=1725802130; bh=SwssP0ZpPX5Ykot2pn4Kbx+P04XckEzOPPdS7RWmo0Q=; b=iRA9mz85jO/O9CJ/OMJ6xgpSH5z+MIAZW2dbu7dgBeSXtMX2tiPnf0elCHnY3Ncgee3OZ954C ZMG4rX32ljGHSkTn4M/YdniFpIvUw7DqadONi1Lg1SUjFW6sYpdcPyC6gYZIx9fp6hT65JkomVE Y13UjOQZ62dpEPrnBYuHIxCZytTo6YtM1rG5nSJ8N0Kv7rEy/jr8cwL9GVzg2jD2ACnAyGxiB// ajOuTj5Zk8rtBDAJ8twgxc4Tk4zZdRc8g/QcxTuENOvm5/peMLUVj1r0XizOWZK7IPZK5qmjsDD X2Q2BzNFaVfMUNveA0yEUC2Por7faBUOzIYqPKbwI5YQ== 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> 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 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, 207.246.76.47 X-ForwardEmail-ID: 66dda6903c9877b459587942 Content-Type: text/plain; charset="utf-8" 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/br= idge/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 =3D &connector->display_info; int ret; =20 hdmi_disable_overflow_interrupts(hdmi); @@ -2285,12 +2286,10 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, hdmi->hdmi_data.video_mode.mdataenablepolarity =3D true; =20 /* HDMI Initialization Step B.1 */ - hdmi_av_composer(hdmi, &connector->display_info, mode); + hdmi_av_composer(hdmi, display, mode); =20 - /* HDMI Initializateion Step B.2 */ - ret =3D hdmi->phy.ops->init(hdmi, hdmi->phy.data, - &connector->display_info, - &hdmi->previous_mode); + /* HDMI Initialization Step B.2 */ + ret =3D hdmi->phy.ops->init(hdmi, hdmi->phy.data, display, mode); if (ret) return ret; hdmi->phy.enabled =3D true; --=20 2.46.0 From nobody Sat Nov 30 16:38:20 2024 Received: from smtp.forwardemail.net (smtp.forwardemail.net [207.246.76.47]) (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 6E4B116B396 for ; Sun, 8 Sep 2024 13:29:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.246.76.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802158; cv=none; b=CQA+MzKQlG7JcU4kF0VKvmMLHA4kKb+eGJwaAQWxi/naK7wDaC0/fA4GEC8lvGzFZcIS70d5ZlkIR0h1JJ1fBlNshEvNc/nagYekFp+w5h3mhlmShyrJrfbDezcFLq4/vqby4izH03KK7PEgC+M1ZJmKe1aXVIMcbkq6CsvlsCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802158; c=relaxed/simple; bh=2oOtJBX+NrccfHTcufrs6z0wriZKAF9lH7s08bQrrQs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AxkJ4uJh/QDWeCAbfh8Ip+OW8Kq+9Y736ZJBBMjyvyulkCzA+Bj1mtagyL8yEGSbdG1TJkCr0otMNirCks1sNXAIky5TXVmreSqZKYoJylhUUa13USm6tbYev+YfdAzYzi8MJQ0xnj22pBGS0lVju1fZWzibWcH5P7QKfxXBcAE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=eXg+J6yY; arc=none smtp.client-ip=207.246.76.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="eXg+J6yY" 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=1725802135; bh=dbyT3VAtgqFNJh28eDMPmAIkHE6wApqXiwyZdxlGJ50=; b=eXg+J6yY2ho68gZxczDf9ptPgVNEqKCgFIUF1ABOkk9V+8oRlByp15AaaIdvk2/wpE9Skwwmt bU4CQR4DApmyxK31xVIODvcSmhATVv/xe0wA+1LHjkTCXVuz5bo/Vo/zDuEryHi/0RytbMowC3E PLS3iOrlix/1uMLfUqph2TtBso8mSJi9Hu97+PkSNdkXu42L+sXgPlVT/j8775S/Z/3xNS45raR wf/R9KthxXUnPwtsuAJ/uL5/vk8v7VYpIL7ylra9Kd+M8vXFwGPJWsRc3XnWYUiMXRwx+oNmr2N sbIOrjlhI/4lBzOlSq9O3+4K4AQguMSxUc+02sN8fbxQ== 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> 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 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, 207.246.76.47 X-ForwardEmail-ID: 66dda6943c9877b459587956 Content-Type: text/plain; charset="utf-8" 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/br= idge/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 d= w_hdmi *hdmi) HDMI_IH_MUTE_FC_STAT2); } =20 -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 =3D &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); } =20 -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 =3D bridge->driver_private; struct drm_atomic_state *state =3D old_state->base.state; + const struct drm_display_mode *mode; struct drm_connector *connector; + struct drm_crtc *crtc; =20 connector =3D drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); + crtc =3D drm_atomic_get_new_connector_state(state, connector)->crtc; + mode =3D &drm_atomic_get_new_crtc_state(state, crtc)->adjusted_mode; =20 mutex_lock(&hdmi->mutex); hdmi->disabled =3D false; hdmi->curr_conn =3D 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); --=20 2.46.0 From nobody Sat Nov 30 16:38:20 2024 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 24A7616A924 for ; Sun, 8 Sep 2024 13:29:12 +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=1725802156; cv=none; b=nBwRbSq7fYH9iLbPWhA0ikFs15BqashsamolZFGymILNGfVkAYrH+urmU1RHnigqU7d14MG0xRzq4fHCICeI8XbK5nDLKVrRNsKlcOt4qG0J4oulZ6IBIqSz+Mh7R3hUwNjHp0NQqQ/v76F101C0pibCwswimH9GmU5eqiUeEY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802156; c=relaxed/simple; bh=Mhs6wZix2bP21g1CDNYMsdZZqlfok+FeZX4AEp59FSI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SLNTLevCdsfMBYSFPwko3J5TbxZ3rmij3TZ/BUlgrz/7oxGCPfe316Szb6tpr6YRwh+9ZbHtf/4Gg0l8J9Q6bqi0asD7HYuovsIP8660yv831Z7jwkeMgFIxGM2BbgJJ7wC+qkm8oS+lClbtyJPf6HH5ytem6LjCg3JWQ7pxRpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=RFreiCMw; arc=none smtp.client-ip=149.28.215.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="RFreiCMw" 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> 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 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 Content-Type: text/plain; charset="utf-8" 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/br= idge/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; =20 - 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; =20 - 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 !di= sabled) */ bool disabled; /* DRM has disabled our bridge */ @@ -2894,20 +2892,6 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, return mode_status; } =20 -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 =3D 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_f= uncs =3D { .atomic_get_input_bus_fmts =3D dw_hdmi_bridge_atomic_get_input_bus_fmts, .atomic_enable =3D dw_hdmi_bridge_atomic_enable, .atomic_disable =3D dw_hdmi_bridge_atomic_disable, - .mode_set =3D dw_hdmi_bridge_mode_set, .mode_valid =3D dw_hdmi_bridge_mode_valid, .detect =3D dw_hdmi_bridge_detect, .edid_read =3D dw_hdmi_bridge_edid_read, --=20 2.46.0 From nobody Sat Nov 30 16:38:20 2024 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 0DCF116BE3F for ; Sun, 8 Sep 2024 13:29:23 +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=1725802166; cv=none; b=dpHbHzfOlUmgJ7iyi8Zx/sAoxcb1HSeDKxNLk3GA34q6bAy0puI62hiF/ttm9MMhVzdy1gdz2YtQc9Ona/0CPcozqKakrxyV40Q/mU7MwwcbfbjSbIvXTMlww6YCgRnRH5Ued941VdtLV8tZURZnng8k21HJh/WSLvcj7qrbeFQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802166; c=relaxed/simple; bh=yjxwFeT+ax2YQbYDL/znuQXIisIA+xYp2KdtH3aXyC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A1kqFs/p/9tRE0/ArdN7mwtv4ibhnjZWXl0o4y0hfH2dQyUK6BbPIlXxfEaTtLthhAI+xG8VC1Xpz+x1fJyMGV4+nibPVn7ue1iDca/7PwN2arPPktANHdQz5h14IPHnpIu36c3CFG8CGtFEPBcLznOjmASH/hD+6PRXFXdb53E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=irIJXzKj; arc=none smtp.client-ip=149.28.215.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="irIJXzKj" 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> 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 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 Content-Type: text/plain; charset="utf-8" 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/br= idge/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 *conne= ctor, bool force) { struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connector); - return dw_hdmi_detect(hdmi); + enum drm_connector_status status; + + status =3D dw_hdmi_detect(hdmi); + + if (status =3D=3D 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; } =20 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); =20 - if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) =3D=3D 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 =3D connector_status_connected; --=20 2.46.0 From nobody Sat Nov 30 16:38:20 2024 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 3CD5916B388 for ; Sun, 8 Sep 2024 13:29:30 +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=1725802173; cv=none; b=JQhYsknSU8iUYSFp+PdlrOzKJN+WCrbrTMvUusqni+eLNgkHvCrziVj8IxYQDj6oNceuphRcVCYsp0XQTlonkwvBHm5B/goA1Yhs9Ij685Erpg6IfnOpo3rb2joZXbDTvpiRMbBjR+FLDWPjlktwF1PaIi+x0kPh4jxzLFU2MTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802173; c=relaxed/simple; bh=rcjppB5yUa2TYio5/fZb2JwpL48SiuhfKZDFkD0EvEI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UYzngUgnfjqfAhdP0+WJy5HJIvxLqW50IHcX1Q+MCNm8kcoU3XQzDGyLW15Y0wOalP0A4LOn4MJ57varMgHqQCmf8LFCCHDZv5N0SQ/17lwB+cDg3t8h+T/1csZgMcAgjOWaOQzZ4ikkrey+lQvZhOJXj9ZZTN+CoNZMgKqSwvY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=XtqTRQ8J; arc=none smtp.client-ip=149.28.215.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="XtqTRQ8J" 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> 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 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 Content-Type: text/plain; charset="utf-8" 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/br= idge/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); =20 - struct mutex cec_notifier_mutex; struct cec_notifier *cec_notifier; =20 hdmi_codec_plugged_cb plugged_cb; @@ -2458,11 +2457,8 @@ dw_hdmi_connector_detect(struct drm_connector *conne= ctor, bool force) =20 status =3D dw_hdmi_detect(hdmi); =20 - if (status =3D=3D connector_status_disconnected) { - mutex_lock(&hdmi->cec_notifier_mutex); + if (status =3D=3D connector_status_disconnected) cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); - mutex_unlock(&hdmi->cec_notifier_mutex); - } =20 return status; } @@ -2576,9 +2572,7 @@ static int dw_hdmi_connector_create(struct dw_hdmi *h= dmi) if (!notifier) return -ENOMEM; =20 - mutex_lock(&hdmi->cec_notifier_mutex); hdmi->cec_notifier =3D notifier; - mutex_unlock(&hdmi->cec_notifier_mutex); =20 return 0; } @@ -2876,10 +2870,8 @@ static void dw_hdmi_bridge_detach(struct drm_bridge = *bridge) { struct dw_hdmi *hdmi =3D bridge->driver_private; =20 - mutex_lock(&hdmi->cec_notifier_mutex); cec_notifier_conn_unregister(hdmi->cec_notifier); hdmi->cec_notifier =3D NULL; - mutex_unlock(&hdmi->cec_notifier_mutex); } =20 static enum drm_mode_status @@ -3304,7 +3296,6 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device = *pdev, =20 mutex_init(&hdmi->mutex); mutex_init(&hdmi->audio_mutex); - mutex_init(&hdmi->cec_notifier_mutex); spin_lock_init(&hdmi->audio_lock); =20 ret =3D dw_hdmi_parse_dt(hdmi); --=20 2.46.0 From nobody Sat Nov 30 16:38:20 2024 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 DDC9416A95C for ; Sun, 8 Sep 2024 13:29:30 +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=1725802172; cv=none; b=n7xotr28lR+uYgGO7BBzjyrEiWcx5ecX0+cerN0nj4+M3KKqfXx5+QVBuG0ThVBNYWK3IQLKhPt8qPmY8lMr40jZFEkL59yn8CQVF49lubeqrzhU60UQen6XIAQBgNm6Q1lnWF6D1RFdG34yDojQfTyhldLyCt4fKMcD+2Hgkns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802172; c=relaxed/simple; bh=TLnE+I3Km3LhX9uCXy0i3BsVfFWkyan3TgA0dDhpGwM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aZqrqg8nU5hwDWj+5jCNsRZxvAXYtenWPALr4Bo0d3JRTGXkWGnsIA5XCnU/WyPXNmfC2Ci4eH0gCLgNhOeF6mOf9l7YieW3mSegUYKovjq4NhAQbj58iN0ofeqgGt7rfi66dgOfbcRkP/IDPZgPJ0lWjZtwTTjXd45d2iLw4OU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=SiliM5Y4; arc=none smtp.client-ip=149.28.215.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="SiliM5Y4" 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> 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 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 Content-Type: text/plain; charset="utf-8" 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/br= idge/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 *conne= ctor, bool force) =20 status =3D dw_hdmi_detect(hdmi); =20 + /* Update EDID during hotplug processing (force=3Dfalse) */ + if (status =3D=3D connector_status_connected && !force) { + const struct drm_edid *drm_edid; + + drm_edid =3D 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 =3D=3D connector_status_disconnected) cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); =20 --=20 2.46.0 From nobody Sat Nov 30 16:38:20 2024 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 EC0D516C6A2 for ; Sun, 8 Sep 2024 13:29:33 +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=1725802175; cv=none; b=Iz3uS3a+Bbja2aa/9ln4r0BCIzAZ72ZT2YwaQwAgprMbDNygz02b11kW28dcXkysSlCCequyQI3bOBFQPhj086yXk/niU8CvTNFrZn43Qu+MdTLxAl9xrs7CJhtfl1GEOW4PUabc/3j32a9M62VPAp6O+ZC8C7b3EfIZ3BDr6IE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725802175; c=relaxed/simple; bh=VwiE9zdi0HOLl8uwddvAdWVBAipm3KGbew0Qr1xyzNk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NTO4lLysDqZRIAL9JI9gs+ukfPK2m1FdujRtIk7OZEFdAQhpKQ27/kiu2k6HGd0MnYczQDy7vGXdgPZbB/o1Mey1ipOc/N3bzcDhwQJsLJQjxPR67WelDcK2pUK1CY+RvWLPGUBiMfBZYQ5F3XoVIGG/Fc5ECIr/evq9E01Ltrk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=G6QUvcBF; arc=none smtp.client-ip=149.28.215.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="G6QUvcBF" 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> 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 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 Content-Type: text/plain; charset="utf-8" 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/br= idge/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 =20 -#define HDMI_EDID_LEN 512 - /* DW-HDMI Controller >=3D 0x200a are at least compliant with SCDC version= 1 */ #define SCDC_MIN_SOURCE_VERSION 0x1 =20 @@ -145,8 +143,6 @@ struct dw_hdmi { =20 int vic; =20 - u8 edid[HDMI_EDID_LEN]; - struct { const struct dw_hdmi_phy_ops *ops; const char *name; @@ -156,8 +152,6 @@ struct dw_hdmi { =20 struct i2c_adapter *ddc; void __iomem *regs; - bool sink_is_hdmi; - bool sink_has_audio; =20 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; =20 - inv_val |=3D hdmi->sink_is_hdmi ? + inv_val |=3D display->is_hdmi ? HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE : HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE; =20 @@ -2274,7 +2268,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, if (hdmi->hdmi_data.enc_out_bus_format =3D=3D MEDIA_BUS_FMT_FIXED) hdmi->hdmi_data.enc_out_bus_format =3D MEDIA_BUS_FMT_RGB888_1X24; =20 - hdmi->hdmi_data.rgb_limited_range =3D hdmi->sink_is_hdmi && + hdmi->hdmi_data.rgb_limited_range =3D display->is_hdmi && drm_default_rgb_quant_range(mode) =3D=3D HDMI_QUANTIZATION_RANGE_LIMITED; =20 @@ -2294,7 +2288,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, /* HDMI Initialization Step B.3 */ dw_hdmi_enable_video_path(hdmi); =20 - if (hdmi->sink_has_audio) { + if (display->has_audio) { dev_dbg(hdmi->dev, "sink has audio support\n"); =20 /* HDMI Initialization Step E - Configure audio */ @@ -2303,7 +2297,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, } =20 /* not for DVI mode */ - if (hdmi->sink_is_hdmi) { + if (display->is_hdmi) { dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__); =20 /* HDMI Initialization Step F - Configure AVI InfoFrame */ @@ -2417,29 +2411,13 @@ static const struct drm_edid *dw_hdmi_edid_read(str= uct dw_hdmi *hdmi, struct drm_connector *connector) { const struct drm_edid *drm_edid; - const struct edid *edid; =20 if (!hdmi->ddc) return NULL; =20 drm_edid =3D 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 =3D 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 =3D drm_detect_hdmi_monitor(edid); - hdmi->sink_has_audio =3D drm_detect_monitor_audio(edid); =20 return drm_edid; } --=20 2.46.0