mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: "Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Robert Foss" <rfoss@kernel.org>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	kernel@collabora.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org,
	"Diederik de Haas" <diederik@cknow-tech.com>,
	"Maud Spierings" <maud_spierings@hotmail.com>
Subject: Re: [PATCH v2 3/4] drm/bridge: dw-hdmi-qp: Add high TMDS clock ratio and scrambling support
Date: Tue, 13 Jan 2026 17:10:06 +0200	[thread overview]
Message-ID: <38f9e21c-ac64-45cd-a425-4036ad2ef32b@collabora.com> (raw)
In-Reply-To: <20260113-unselfish-russet-chicken-80d3c3@houat>

Hi Maxime,

On 1/13/26 5:00 PM, Maxime Ripard wrote:
> On Tue, Jan 13, 2026 at 12:26:20AM +0200, Cristian Ciocaltea wrote:
>> @@ -902,13 +981,74 @@ static void dw_hdmi_qp_bridge_atomic_disable(struct drm_bridge *bridge,
>>  
>>  	hdmi->tmds_char_rate = 0;
>>  
>> +	dw_hdmi_qp_disable_scramb(hdmi);
>> +
>> +	hdmi->curr_conn = NULL;
>>  	hdmi->phy.ops->disable(hdmi, hdmi->phy.data);
>>  }
>>  
>> -static enum drm_connector_status
>> -dw_hdmi_qp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *connector)
>> +static int dw_hdmi_qp_reset_link(struct dw_hdmi_qp *hdmi,
>> +				 struct drm_connector *conn,
>> +				 struct drm_modeset_acquire_ctx *ctx)
>> +{
>> +	struct drm_crtc *crtc;
>> +	u8 config;
>> +	int ret;
>> +
>> +	if (!conn->state)
>> +		return 0;
>> +
>> +	crtc = conn->state->crtc;
>> +	if (!crtc)
>> +		return 0;
>> +
>> +retry:
>> +	ret = drm_modeset_lock(&crtc->mutex, ctx);
>> +	if (ret)
>> +		goto check_err;
>> +
>> +	if (!crtc->state->active)
>> +		return 0;
>> +
>> +	if (conn->state->commit &&
>> +	    !try_wait_for_completion(&conn->state->commit->hw_done))
>> +		return 0;
>> +
>> +	ret = drm_scdc_readb(hdmi->bridge.ddc, SCDC_TMDS_CONFIG, &config);
>> +	if (ret < 0) {
>> +		dev_err(hdmi->dev, "Failed to read TMDS config: %d\n", ret);
>> +		return 0;
>> +	}
>> +
>> +	if (!!(config & SCDC_SCRAMBLING_ENABLE) == hdmi->scramb_enabled)
>> +		return 0;
>> +
>> +	dev_dbg(hdmi->dev, "%s resetting crtc\n", __func__);
>> +
>> +	drm_atomic_helper_connector_hdmi_hotplug(conn, connector_status_connected);
>> +
>> +	/*
>> +	 * Conform to HDMI 2.0 spec by ensuring scrambled data is not sent
>> +	 * before configuring the sink scrambling, as well as suspending any
>> +	 * TMDS transmission while changing the TMDS clock rate in the sink.
>> +	 */
>> +	ret = drm_atomic_helper_reset_crtc(crtc, ctx);
>> +
>> +check_err:
>> +	if (ret == -EDEADLK) {
>> +		drm_modeset_backoff(ctx);
>> +		goto retry;
>> +	}
>> +
>> +	return ret;
>> +}
>> +
>> +static int dw_hdmi_qp_bridge_detect(struct drm_bridge *bridge,
>> +				    struct drm_connector *connector,
>> +				    struct drm_modeset_acquire_ctx *ctx)
>>  {
>>  	struct dw_hdmi_qp *hdmi = bridge->driver_private;
>> +	enum drm_connector_status status;
>>  	const struct drm_edid *drm_edid;
>>  
>>  	if (hdmi->no_hpd) {
>> @@ -919,7 +1059,15 @@ dw_hdmi_qp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *connec
>>  			return connector_status_disconnected;
>>  	}
>>  
>> -	return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data);
>> +	status = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data);
>> +
>> +	dev_dbg(hdmi->dev, "%s status=%d scramb=%d\n", __func__,
>> +		status, hdmi->scramb_enabled);
>> +
>> +	if (status == connector_status_connected && hdmi->scramb_enabled)
>> +		dw_hdmi_qp_reset_link(hdmi, connector, ctx);
>> +
>> +	return status;
>>  }
> 
> We have drm_bridge_helper_reset_crtc() now, any reason you didn't use it?

Ups, I missed it somehow..

Thanks,
Cristian

  reply	other threads:[~2026-01-13 15:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 22:26 [PATCH v2 0/4] Add HDMI 2.0 support to DW HDMI QP TX Cristian Ciocaltea
2026-01-12 22:26 ` [PATCH v2 1/4] drm/bridge: Add ->detect_ctx hook and drm_bridge_detect_ctx() Cristian Ciocaltea
2026-01-14 10:08   ` Luca Ceresoli
2026-01-14 23:04     ` Cristian Ciocaltea
2026-01-12 22:26 ` [PATCH v2 2/4] drm/bridge-connector: Switch to using ->detect_ctx hook Cristian Ciocaltea
2026-01-12 22:26 ` [PATCH v2 3/4] drm/bridge: dw-hdmi-qp: Add high TMDS clock ratio and scrambling support Cristian Ciocaltea
2026-01-13 15:00   ` Maxime Ripard
2026-01-13 15:10     ` Cristian Ciocaltea [this message]
2026-01-12 22:26 ` [PATCH v2 4/4] drm/rockchip: dw_hdmi_qp: Do not send HPD events for all connectors Cristian Ciocaltea
2026-01-12 22:40 ` [PATCH v2 0/4] Add HDMI 2.0 support to DW HDMI QP TX Cristian Ciocaltea
2026-01-14 16:16   ` Chris Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38f9e21c-ac64-45cd-a425-4036ad2ef32b@collabora.com \
    --to=cristian.ciocaltea@collabora.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=andy.yan@rock-chips.com \
    --cc=diederik@cknow-tech.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maud_spierings@hotmail.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®