Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: mohit.dsor@oss.qualcomm.com
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v20 2/2] drm/bridge: Add Lontium LT9611C(EX/UXD) MIPI DSI to HDMI driver
Date: Tue, 01 Dec 2026 06:06:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-242675@kernel.org> (raw)
In-Reply-To: <20261201-lt9611c-v7-v20-2-fbe0e5581b4f@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] drm/bridge: missing HDMI 2.0 scrambler callbacks in
  lt9611c_bridge_funcs
- [Medium] drm/bridge: lt9611c: broken PM suspend/resume ordering and
  HPD notification
- [Low] drm/bridge: mixed __free() and goto error handling in
  lt9611c_probe()
--

commit b7c34121ab3b82f687b0cfa86b801eb2897b3aa6
Author: Sunyun Yang <syyang@lontium.com>

drm/bridge: Add Lontium LT9611C(EX/UXD) MIPI DSI to HDMI driver

This commit adds a DRM bridge driver for the Lontium LT9611C, LT9611EX, and
LT9611UXD MIPI DSI to HDMI bridge chips, including support for EDID reading,
HPD detection, HDMI audio, dual-DSI mode, and firmware upgrades via sysfs.

> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611c.c b/drivers/gpu/drm/bridge/lontium-lt9611c.c
> new file mode 100644
> index 0000000000000..443981bec923e
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611c.c

[ ... ]

> +static const struct drm_bridge_funcs lt9611c_bridge_funcs = {
> +	.attach = lt9611c_bridge_attach,
> +	.detect = lt9611c_bridge_detect,
> +	.edid_read = lt9611c_bridge_edid_read,
> +	.atomic_enable = lt9611c_bridge_atomic_enable,
> +	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
> +	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
> +	.atomic_create_state = drm_atomic_helper_bridge_create_state,
> +
> +	.hdmi_tmds_char_rate_valid = lt9611c_hdmi_tmds_char_rate_valid,
> +	.hdmi_write_avi_infoframe = lt9611c_hdmi_write_avi_infoframe,
> +	.hdmi_clear_avi_infoframe = lt9611c_hdmi_clear_avi_infoframe,
> +	.hdmi_write_hdmi_infoframe = lt9611c_hdmi_write_hdmi_infoframe,
> +	.hdmi_clear_hdmi_infoframe = lt9611c_hdmi_clear_hdmi_infoframe,
> +	.hdmi_write_audio_infoframe = lt9611c_hdmi_write_audio_infoframe,
> +	.hdmi_clear_audio_infoframe = lt9611c_hdmi_clear_audio_infoframe,
> +
> +	.hdmi_audio_prepare = lt9611c_hdmi_audio_prepare,
> +	.hdmi_audio_shutdown = lt9611c_hdmi_audio_shutdown,
> +};

[Severity: High]
Does connector initialization always fail with -EINVAL on LT9611UXD because
lt9611c_bridge_funcs is missing .hdmi_scrambler_enable and
.hdmi_scrambler_disable?

In lt9611c_probe(), the driver sets DRM_BRIDGE_OP_HDMI in bridge.ops and sets
bridge.supported_hdmi_ver to HDMI_VERSION_2_0 for CHIP_LT9611UXD, while
lt9611c_bridge_attach() requires DRM_BRIDGE_ATTACH_NO_CONNECTOR.  When the
display driver initializes the connector, drm_bridge_connector_init() rejects
any HDMI_VERSION_2_0 bridge that lacks the scrambler callbacks:

drivers/gpu/drm/display/drm_bridge_connector.c:drm_bridge_connector_init() {
	...
			if (bridge->supported_hdmi_ver >= HDMI_VERSION_2_0 &&
			    (!bridge->funcs->hdmi_scrambler_enable ||
			     !bridge->funcs->hdmi_scrambler_disable))
				return ERR_PTR(-EINVAL);
	...
}

This breaks display pipeline probe on all lontium,lt9611uxd devices.

[ ... ]

> +static int lt9611c_probe(struct i2c_client *client)
> +{
> +	struct lt9611c *lt9611c;
> +	struct device *dev = &client->dev;
> +	struct device_node *dsi0_node __free(device_node) = NULL;
> +	struct device_node *dsi1_node __free(device_node) = NULL;
> +	struct mipi_dsi_device *dsi;
> +	int ret;

[ ... ]

> +err_remove_bridge:
> +	drm_bridge_remove(&lt9611c->bridge);
> +	cancel_work_sync(&lt9611c->work);
> +
> +err_disable_regulators:
> +	regulator_bulk_disable(ARRAY_SIZE(lt9611c->supplies), lt9611c->supplies);
> +
> +	return ret;
> +}

[Severity: Low]
This isn't a bug, but lt9611c_probe() declares dsi0_node and dsi1_node with
__free(device_node) = NULL at the top of the function for later assignment
while using goto labels for the rest of its error unwinding.  Per cleanup.h
conventions, __free() variables should be defined and initialized in a single
statement and not mixed with goto-based cleanup in the same function.

[ ... ]

> +static int lt9611c_bridge_suspend(struct device *dev)
> +{
> +	struct lt9611c *lt9611c = dev_get_drvdata(dev);
> +	int ret;
> +
> +	disable_irq(lt9611c->client->irq);
> +	cancel_work_sync(&lt9611c->work);
> +
> +	mutex_lock(&lt9611c->mcu_lock);
> +	gpiod_set_value_cansleep(lt9611c->reset_gpio, 1);
> +	ret = regulator_bulk_disable(ARRAY_SIZE(lt9611c->supplies), lt9611c->supplies);
> +	if (ret) {
> +		dev_err(lt9611c->dev, "regulator bulk disable failed\n");
> +		gpiod_set_value_cansleep(lt9611c->reset_gpio, 0);
> +		msleep(400);
> +		mutex_unlock(&lt9611c->mcu_lock);
> +		enable_irq(lt9611c->client->irq);
> +		return ret;
> +	}
> +	mutex_unlock(&lt9611c->mcu_lock);
> +
> +	return 0;
> +}
> +
> +static int lt9611c_bridge_resume(struct device *dev)
> +{
> +	struct lt9611c *lt9611c = dev_get_drvdata(dev);
> +	int ret;
> +
> +	ret = regulator_bulk_enable(ARRAY_SIZE(lt9611c->supplies), lt9611c->supplies);
> +	if (ret) {
> +		dev_err(lt9611c->dev, "regulator bulk enable failed\n");
> +		return ret;
> +	}
> +
> +	mutex_lock(&lt9611c->mcu_lock);
> +	lt9611c_reset(lt9611c);
> +	mutex_unlock(&lt9611c->mcu_lock);
> +
> +	enable_irq(lt9611c->client->irq);
> +
> +	/*
> +	 * Re-read HPD after reset so cable changes during suspend are not
> +	 * missed. lt9611c_detect_hpd() acquires mcu_lock internally.
> +	 */
> +	drm_bridge_hpd_notify(&lt9611c->bridge,
> +			      lt9611c_detect_hpd(lt9611c, 0));
> +
> +	return 0;
> +}

[Severity: Medium]
As reported by Dmitry Baryshkov on v7 [1], can system suspend and resume drop
hotplug changes or leave the bridge unconfigured after resume?

During suspend, drm_mode_config_helper_suspend() calls
drm_bridge_hpd_disable(), which clears bridge.hpd_cb to NULL until
drm_mode_config_helper_resume() re-enables HPD polling.  When
lt9611c_bridge_resume() runs before drm_mode_config_helper_resume() (for
example on DRM drivers that suspend in .prepare and resume in .complete),
drm_bridge_hpd_notify() sees bridge.hpd_cb == NULL and drops the
notification, so cable changes during suspend are still lost.

Conversely, because the bidirectional OF graph links between the DSI host and
lt9611c form a cycle that fw_devlink relaxes to DL_FLAG_SYNC_STATE_ONLY and
no PM device link orders lt9611c before the DRM device, DRM drivers that call
drm_mode_config_helper_resume() from their .resume callback can run
lt9611c_bridge_atomic_enable() while lt9611c is still powered off in reset,
after which lt9611c_bridge_resume() resets the chip into an unconfigured
state.

[1] https://lore.kernel.org/r/4t3bar2svwex4wojumql2t66ivtj6bsxnt7pgmygnc7og4zquh@fs7wdd4k4cjp

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-lt9611c-v7-v20-0-fbe0e5581b4f@oss.qualcomm.com?part=2

      reply	other threads:[~2026-12-01  6:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  5:47 [PATCH v20 0/2] Add Lontium LT9611C(EX/UXD) MIPI DSI to HDMI driver mohit.dsor
2026-12-01  5:47 ` [PATCH v20 1/2] dt-bindings: bridge: " mohit.dsor
2026-12-01  5:52   ` sashiko-bot
2026-12-01  5:47 ` [PATCH v20 2/2] drm/bridge: " mohit.dsor
2026-12-01  6:06   ` sashiko-bot [this message]

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=sashiko-outbox-242675@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mohit.dsor@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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