Commit 9fbceb37 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-misc-fixes-2025-06-26' of...

Merge tag 'drm-misc-fixes-2025-06-26' of https://gitlab.freedesktop.org/drm/misc/kernel

 into drm-fixes

drm-misc-fixes for v6.16-rc4:
- Fix function signature of drm_writeback_connector_cleanup.
- Use correct HDMI audio bridge in drm_connector_hdmi_audio_init.
- Make HPD work on SN65DSI86.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://lore.kernel.org/r/3dd1d5e1-73b6-4b0c-a208-f7d6235cf530@linux.intel.com
parents 6daaa479 55e8ff84
Loading
Loading
Loading
Loading
+60 −9
Original line number Diff line number Diff line
@@ -348,10 +348,16 @@ static void ti_sn65dsi86_enable_comms(struct ti_sn65dsi86 *pdata,
	 * 200 ms.  We'll assume that the panel driver will have the hardcoded
	 * delay in its prepare and always disable HPD.
	 *
	 * If HPD somehow makes sense on some future panel we'll have to
	 * change this to be conditional on someone specifying that HPD should
	 * be used.
	 * For DisplayPort bridge type, we need HPD. So we use the bridge type
	 * to conditionally disable HPD.
	 * NOTE: The bridge type is set in ti_sn_bridge_probe() but enable_comms()
	 * can be called before. So for DisplayPort, HPD will be enabled once
	 * bridge type is set. We are using bridge type instead of "no-hpd"
	 * property because it is not used properly in devicetree description
	 * and hence is unreliable.
	 */

	if (pdata->bridge.type != DRM_MODE_CONNECTOR_DisplayPort)
		regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG, HPD_DISABLE,
				   HPD_DISABLE);

@@ -1195,9 +1201,14 @@ static enum drm_connector_status ti_sn_bridge_detect(struct drm_bridge *bridge)
	struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge);
	int val = 0;

	pm_runtime_get_sync(pdata->dev);
	/*
	 * Runtime reference is grabbed in ti_sn_bridge_hpd_enable()
	 * as the chip won't report HPD just after being powered on.
	 * HPD_DEBOUNCED_STATE reflects correct state only after the
	 * debounce time (~100-400 ms).
	 */

	regmap_read(pdata->regmap, SN_HPD_DISABLE_REG, &val);
	pm_runtime_put_autosuspend(pdata->dev);

	return val & HPD_DEBOUNCED_STATE ? connector_status_connected
					 : connector_status_disconnected;
@@ -1220,6 +1231,26 @@ static void ti_sn65dsi86_debugfs_init(struct drm_bridge *bridge, struct dentry *
	debugfs_create_file("status", 0600, debugfs, pdata, &status_fops);
}

static void ti_sn_bridge_hpd_enable(struct drm_bridge *bridge)
{
	struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge);

	/*
	 * Device needs to be powered on before reading the HPD state
	 * for reliable hpd detection in ti_sn_bridge_detect() due to
	 * the high debounce time.
	 */

	pm_runtime_get_sync(pdata->dev);
}

static void ti_sn_bridge_hpd_disable(struct drm_bridge *bridge)
{
	struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge);

	pm_runtime_put_autosuspend(pdata->dev);
}

static const struct drm_bridge_funcs ti_sn_bridge_funcs = {
	.attach = ti_sn_bridge_attach,
	.detach = ti_sn_bridge_detach,
@@ -1234,6 +1265,8 @@ static const struct drm_bridge_funcs ti_sn_bridge_funcs = {
	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
	.debugfs_init = ti_sn65dsi86_debugfs_init,
	.hpd_enable = ti_sn_bridge_hpd_enable,
	.hpd_disable = ti_sn_bridge_hpd_disable,
};

static void ti_sn_bridge_parse_lanes(struct ti_sn65dsi86 *pdata,
@@ -1321,8 +1354,26 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev,
	pdata->bridge.type = pdata->next_bridge->type == DRM_MODE_CONNECTOR_DisplayPort
			   ? DRM_MODE_CONNECTOR_DisplayPort : DRM_MODE_CONNECTOR_eDP;

	if (pdata->bridge.type == DRM_MODE_CONNECTOR_DisplayPort)
		pdata->bridge.ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT;
	if (pdata->bridge.type == DRM_MODE_CONNECTOR_DisplayPort) {
		pdata->bridge.ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT |
				    DRM_BRIDGE_OP_HPD;
		/*
		 * If comms were already enabled they would have been enabled
		 * with the wrong value of HPD_DISABLE. Update it now. Comms
		 * could be enabled if anyone is holding a pm_runtime reference
		 * (like if a GPIO is in use). Note that in most cases nobody
		 * is doing AUX channel xfers before the bridge is added so
		 * HPD doesn't _really_ matter then. The only exception is in
		 * the eDP case where the panel wants to read the EDID before
		 * the bridge is added. We always consistently have HPD disabled
		 * for eDP.
		 */
		mutex_lock(&pdata->comms_mutex);
		if (pdata->comms_enabled)
			regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG,
					   HPD_DISABLE, 0);
		mutex_unlock(&pdata->comms_mutex);
	};

	drm_bridge_add(&pdata->bridge);

+5 −2
Original line number Diff line number Diff line
@@ -708,11 +708,14 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
	if (bridge_connector->bridge_hdmi_audio ||
	    bridge_connector->bridge_dp_audio) {
		struct device *dev;
		struct drm_bridge *bridge;

		if (bridge_connector->bridge_hdmi_audio)
			dev = bridge_connector->bridge_hdmi_audio->hdmi_audio_dev;
			bridge = bridge_connector->bridge_hdmi_audio;
		else
			dev = bridge_connector->bridge_dp_audio->hdmi_audio_dev;
			bridge = bridge_connector->bridge_dp_audio;

		dev = bridge->hdmi_audio_dev;

		ret = drm_connector_hdmi_audio_init(connector, dev,
						    &drm_bridge_connector_hdmi_audio_funcs,
+4 −3
Original line number Diff line number Diff line
@@ -343,17 +343,18 @@ EXPORT_SYMBOL(drm_writeback_connector_init_with_encoder);
/**
 * drm_writeback_connector_cleanup - Cleanup the writeback connector
 * @dev: DRM device
 * @wb_connector: Pointer to the writeback connector to clean up
 * @data: Pointer to the writeback connector to clean up
 *
 * This will decrement the reference counter of blobs and destroy properties. It
 * will also clean the remaining jobs in this writeback connector. Caution: This helper will not
 * clean up the attached encoder and the drm_connector.
 */
static void drm_writeback_connector_cleanup(struct drm_device *dev,
					    struct drm_writeback_connector *wb_connector)
					    void *data)
{
	unsigned long flags;
	struct drm_writeback_job *pos, *n;
	struct drm_writeback_connector *wb_connector = data;

	delete_writeback_properties(dev);
	drm_property_blob_put(wb_connector->pixel_formats_blob_ptr);
@@ -405,7 +406,7 @@ int drmm_writeback_connector_init(struct drm_device *dev,
	if (ret)
		return ret;

	ret = drmm_add_action_or_reset(dev, (void *)drm_writeback_connector_cleanup,
	ret = drmm_add_action_or_reset(dev, drm_writeback_connector_cleanup,
				       wb_connector);
	if (ret)
		return ret;