From nobody Sun Feb 8 11:25:53 2026 Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31729329E78 for ; Thu, 30 Oct 2025 20:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761856632; cv=none; b=DA5I5AQZ1cJpmvyck19iJc80bE3WVc01Km5pIxBwuBqgVa11w2UIDvIhSugx8t9sXXKqxlhxOWx1h8wp33Va/6v3bWIETmiKozCW6YbopirOagTMztSCiIeetYyPhjuRaJdHCcir06oKHHNhkT3qOnAdkoCCEuI2h7r8CnWjj94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761856632; c=relaxed/simple; bh=mxWhh1FCkJo5UGiIEo9esESyzNkTFWOhTirRuYiMSUI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qqdKbBfUKBwsV8xGWiKOEU5Y4frzVesGso4IN9KY1BoAa71h2no0x9cex5f+iykTwsiSm4depfU7jnZAPAYwMhVYgkd3TuDR1+ipwIO2DPdueUx/7usbeOWG7EuiQ/lXDdAvDYQmljl6Rg1bVaiENAHa2MaZREFXDTdnAxIFedQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=N0SuEF2o; arc=none smtp.client-ip=95.215.58.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="N0SuEF2o" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1761856625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OiEhZggfL5Xg3vG4VJq5+2MUKP+PyMAkCqc8zsFcA0Q=; b=N0SuEF2owlityULu8HbFwF+FzJTHjmGoY7AjOStB2YayB+e2B78GHkSEC/TttUuEA/ZBfr PKRbttM6nTlsAnFhwvmKa54B88nzdVTLVXkBcsVMLOaxJ2UAWzy9uqWR29uNqCFA7eaH+D yRSJGf1klvk1IJHcEkYNmo8hwN3w1Dk= From: Sean Anderson To: Laurent Pinchart , Tomi Valkeinen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Cc: Michal Simek , linux-arm-kernel@lists.infradead.org, Simona Vetter , David Airlie , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v2 1/3] drm: zynqmp_dp: Update connector state before AUX transfers Date: Thu, 30 Oct 2025 16:36:40 -0400 Message-Id: <20251030203642.3076656-2-sean.anderson@linux.dev> In-Reply-To: <20251030203642.3076656-1-sean.anderson@linux.dev> References: <20251030203642.3076656-1-sean.anderson@linux.dev> 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-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" We still want to retry AUX transfers even when the connector is first plugged in. Update the connector state before reading the DPDC to ensure the AUX bus sees the most-recent state. Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPo= rt Subsystem") Signed-off-by: Sean Anderson --- (no changes since v1) drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp= _dp.c index 34ddbf98e81d..f39c78b08e6a 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1697,6 +1697,7 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) } =20 if (state & ZYNQMP_DP_INTERRUPT_SIGNAL_STATE_HPD) { + dp->status =3D connector_status_connected; ret =3D drm_dp_dpcd_read(&dp->aux, 0x0, dp->dpcd, sizeof(dp->dpcd)); if (ret < 0) { @@ -1711,7 +1712,6 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) drm_dp_max_lane_count(dp->dpcd), dp->num_lanes); =20 - dp->status =3D connector_status_connected; return connector_status_connected; } =20 --=20 2.35.1.1320.gc452695387.dirty From nobody Sun Feb 8 11:25:53 2026 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3767F332EA4 for ; Thu, 30 Oct 2025 20:37:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761856632; cv=none; b=eG5uPizvvpSYo7RopjWgVSwlHWBbKZwTE0KaaCi+rUQilIpGBzPmN8xEGdPhE0y0t+se2XWnjfiRj+PLwuy93mGcOHWfSsjihUhJ+x9XmIBC+EhT/xAuwzxl06SLwkPqBUxbhmmw/dy8BnHQsefBB7tRL1gEa2nmRdiNFGth4MM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761856632; c=relaxed/simple; bh=EPY6CKbSqt+H5S8GBFOMhYVfy8sPeNqL7S9hMry67YA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WcccU+heGCCBdxQq2aU9btDBzcTCPWAm+J06L165T9uJAIg4FF7VOn//lohdBHsPs5MX3DjFb9AE5v/HszpCH6JbIBu/lZoAsWSvx8mNKv+Z8btP+w9uyLfeT9WcQ4Jurrh9LPiFeThhwj6LAJCwbPkTd1fOvzIMuN2x/UxNScU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=tMhNy32r; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="tMhNy32r" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1761856628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TqzdzzYSnHYqd7lgLdiNXL8RderpADhP5hUHZURlmAE=; b=tMhNy32r1KcQAFPPDHGfVHcGLodrWtlciZGMt4iRCtbCiiOrRoxH5kwlCrG9GcEP2Fu93W IXKw4S6mthkgxWFegHfsJhApZCJH3/kl6IM6IJIwFTw3mGbi+3HsvgG+f6RNBQFsNei/7X UowFicSOo05cNxL59ZjBr9EabBivbKQ= From: Sean Anderson To: Laurent Pinchart , Tomi Valkeinen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Cc: Michal Simek , linux-arm-kernel@lists.infradead.org, Simona Vetter , David Airlie , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v2 2/3] drm: zynqmp_dp: Use smp_load/store for status Date: Thu, 30 Oct 2025 16:36:41 -0400 Message-Id: <20251030203642.3076656-3-sean.anderson@linux.dev> In-Reply-To: <20251030203642.3076656-1-sean.anderson@linux.dev> References: <20251030203642.3076656-1-sean.anderson@linux.dev> 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-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" dp->status is read asynchronously by the AUX bus. Therefore, all reads outside of dp->lock must be atomic. Similarly, writes must be atomic as well. Reads with dp->lock held do not need to be atomic. Fixes: a7d5eeaa57d7 ("drm: zynqmp_dp: Add locking") Signed-off-by: Sean Anderson --- (no changes since v1) drivers/gpu/drm/xlnx/zynqmp_dp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp= _dp.c index f39c78b08e6a..caf2e0ce3644 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1111,7 +1111,7 @@ zynqmp_dp_aux_transfer(struct drm_dp_aux *aux, struct= drm_dp_aux_msg *msg) return msg->size; } =20 - if (dp->status =3D=3D connector_status_disconnected) { + if (READ_ONCE(dp->status) =3D=3D connector_status_disconnected) { dev_dbg(dp->dev, "no connected aux device\n"); if (dp->ignore_aux_errors) goto fake_response; @@ -1697,7 +1697,7 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) } =20 if (state & ZYNQMP_DP_INTERRUPT_SIGNAL_STATE_HPD) { - dp->status =3D connector_status_connected; + WRITE_ONCE(dp->status, connector_status_connected); ret =3D drm_dp_dpcd_read(&dp->aux, 0x0, dp->dpcd, sizeof(dp->dpcd)); if (ret < 0) { @@ -1716,7 +1716,7 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) } =20 disconnected: - dp->status =3D connector_status_disconnected; + WRITE_ONCE(dp->status, connector_status_disconnected); return connector_status_disconnected; } =20 --=20 2.35.1.1320.gc452695387.dirty From nobody Sun Feb 8 11:25:53 2026 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 508C533BBA6 for ; Thu, 30 Oct 2025 20:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761856635; cv=none; b=XzCpzaqZvoGMTyFWXnJgdZanzZDF+QfVh4rl0yiy7xAE+Uw+pmyVmOJ0hj9zp3iwMowmfMjs9+wJ/mXBXBeAIgIODkSjIh3dioiKN3JlUODn5PRyF8l6oZ/IpxJXFeIe9H/cjJcr+ymXFV6TPldvzmMBmOauvR/7tVkONeXSvOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761856635; c=relaxed/simple; bh=fzSAIUaTYjf8ShocXZfywyaajREUuPoA984VLil+nC0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FVeIPxZYzVBzMYsXmEhb0tZpPkN0TU1VdmI7xdP7D3dl59fWtpx9VewusfXnBybRqeTiMBuatSPZ9Is1k/egviOr6qTjRnqr8Or4p1kaiTx1OIvL97NEmkPJrgGA2+uwAMQh+iUSZfOkLp8l1CZb45g+m14TkPT/xI8JKYxn7Vs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Ra39n0bk; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Ra39n0bk" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1761856630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=StFKrxbxfYIJoJBUUN3mU8RLnkw52PoELYYr9mlAnjo=; b=Ra39n0bkxPyoUmWB9kvA4rMKKA9GZXerdageuO5tse47RanAy8oS3/HETTj3LHZ6he2UpZ cnRq0BQC/dWbXiElShOq6FjeQlbLk5vzzARVsQd45DtlGrwiS9yAYAOOP4kKYyfbwlk3jN fq5c2n0IN545pwa4tjhvZrz1Bo7MKNM= From: Sean Anderson To: Laurent Pinchart , Tomi Valkeinen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Cc: Michal Simek , linux-arm-kernel@lists.infradead.org, Simona Vetter , David Airlie , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v2 3/3] drm: zynqmp_dp: Retrain link after HPD if necessary Date: Thu, 30 Oct 2025 16:36:42 -0400 Message-Id: <20251030203642.3076656-4-sean.anderson@linux.dev> In-Reply-To: <20251030203642.3076656-1-sean.anderson@linux.dev> References: <20251030203642.3076656-1-sean.anderson@linux.dev> 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-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The section 5.1.4 of the v1.2 DisplayPort standard says > The Source device shall respond to Hot Plug event/Hot Re-plug event by > first reading DPCD Link/Sink Device Status registers at DPCD 00200h > through 00205h.... If the link is unstable or lost, the Source device > then reads the DPCD Receiver Capabilities registers at DPCD 00000h > through 0000Fh to determine the appropriate information needed to > train the link. The Source device shall then initiate link training. However, zynqmp_dp_hpd_work_func does not check the link status. This may prevent the sink from detecting the source if, for example, the user disconnects the cable and then reconnects it. I encountered this problem when testing a mini DP connector (although I had no problem when using a full-size connector with the existing driver). Follow the spec by checking the link status after a HPD event and retraining if necessary. Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPo= rt Subsystem") Signed-off-by: Sean Anderson --- Changes in v2: - needs_retain -> needs_retrain - Actually retrain the loop (accidentally removed while rebasing) drivers/gpu/drm/xlnx/zynqmp_dp.c | 38 ++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp= _dp.c index caf2e0ce3644..1619aa61f7e1 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1677,6 +1677,24 @@ static int zynqmp_dp_bridge_atomic_check(struct drm_= bridge *bridge, return 0; } =20 +static bool zynqmp_hpd_needs_retrain(struct zynqmp_dp *dp) +{ + u8 status[DP_LINK_STATUS_SIZE + 2]; + int err; + + err =3D drm_dp_dpcd_read(&dp->aux, DP_SINK_COUNT, status, + DP_LINK_STATUS_SIZE + 2); + if (err < 0) { + dev_dbg_ratelimited(dp->dev, + "could not read sink status: %d\n", err); + return false; + } + + return status[4] & DP_LINK_STATUS_UPDATED || + !drm_dp_clock_recovery_ok(&status[2], dp->mode.lane_cnt) || + !drm_dp_channel_eq_ok(&status[2], dp->mode.lane_cnt); +} + static enum drm_connector_status __zynqmp_dp_bridge_detect(struct zynqmp_d= p *dp) { struct zynqmp_dp_link_config *link_config =3D &dp->link_config; @@ -1698,6 +1716,9 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) =20 if (state & ZYNQMP_DP_INTERRUPT_SIGNAL_STATE_HPD) { WRITE_ONCE(dp->status, connector_status_connected); + if (!zynqmp_hpd_needs_retrain(dp)) + return connector_status_connected; + ret =3D drm_dp_dpcd_read(&dp->aux, 0x0, dp->dpcd, sizeof(dp->dpcd)); if (ret < 0) { @@ -1712,6 +1733,7 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) drm_dp_max_lane_count(dp->dpcd), dp->num_lanes); =20 + zynqmp_dp_train_loop(dp); return connector_status_connected; } =20 @@ -2335,25 +2357,13 @@ static void zynqmp_dp_hpd_irq_work_func(struct work= _struct *work) { struct zynqmp_dp *dp =3D container_of(work, struct zynqmp_dp, hpd_irq_work); - u8 status[DP_LINK_STATUS_SIZE + 2]; - int err; =20 guard(mutex)(&dp->lock); if (dp->ignore_hpd) return; =20 - err =3D drm_dp_dpcd_read(&dp->aux, DP_SINK_COUNT, status, - DP_LINK_STATUS_SIZE + 2); - if (err < 0) { - dev_dbg_ratelimited(dp->dev, - "could not read sink status: %d\n", err); - } else { - if (status[4] & DP_LINK_STATUS_UPDATED || - !drm_dp_clock_recovery_ok(&status[2], dp->mode.lane_cnt) || - !drm_dp_channel_eq_ok(&status[2], dp->mode.lane_cnt)) { - zynqmp_dp_train_loop(dp); - } - } + if (zynqmp_hpd_needs_retrain(dp)) + zynqmp_dp_train_loop(dp); } =20 static irqreturn_t zynqmp_dp_irq_handler(int irq, void *data) --=20 2.35.1.1320.gc452695387.dirty