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 v19 2/2] drm/bridge: Add Lontium LT9611C(EX/UXD) MIPI DSI to HDMI driver
Date: Mon, 23 Nov 2026 06:38:37 +0000 [thread overview]
Message-ID: <sashiko-outbox-228772@kernel.org> (raw)
In-Reply-To: <20261123-lt9611c-v7-v19-2-1fbe2b7b5211@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 8 potential
issues to consider:
- [Medium] drm/bridge: missing bridge.supported_hdmi_ver init in
lt9611c_probe()
- [Medium] drm/bridge: missing empty-firmware check in
lt9611c_firmware_upgrade()
- [Medium] drm/bridge: lt9611c: unlinked PM suspend/resume loses bridge
and HPD state
- [Low] drm/bridge: unlocked reset recovery in lt9611c_bridge_suspend()
- [Low] drm/bridge: u8 packet index overflow in lt9611c_get_edid_block()
- [Low] drm/bridge: missing static qualifier on lt9611c_bridge_pm_ops
- [Low] drm/bridge: dev_err_probe() used in runtime sysfs firmware
upgrade path
- [Low] drm/bridge: unused write-only hdmi_connected field in struct
lt9611c
--
commit e4dc76d7da66404497a0938b0ca6f5f1ea01fe2d
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, supporting EDID reading, HPD
handling, I2S HDMI audio, dual-DSI mode, and sysfs firmware upgrades.
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611c.c b/drivers/gpu/drm/bridge/lontium-lt9611c.c
> new file mode 100644
> index 0000000000000..e7c579cd80d5a
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611c.c
> @@ -0,0 +1,1406 @@
[ ... ]
> +struct lt9611c {
> + struct device *dev;
> + struct i2c_client *client;
> + struct drm_bridge bridge;
> + struct regmap *regmap;
> + struct mutex mcu_lock;
> + struct work_struct work;
> + struct gpio_desc *reset_gpio;
> + struct regulator_bulk_data supplies[2];
> + int fw_version;
> + const struct lt9611c_chip_data *cdata;
> + bool hdmi_connected;
> + bool dual_dsi;
> +};
[Severity: Low]
This isn't a bug, but hdmi_connected is only ever written in
lt9611c_detect_hpd() and never read.
[ ... ]
> +static int lt9611c_upgrade_result(struct lt9611c *lt9611c, u8 fw_crc)
> +{
> + struct device *dev = lt9611c->dev;
> + unsigned int crc_result;
> + int ret;
> +
> + regmap_write(lt9611c->regmap, LT9611C_MCU_HALT, LT9611C_MCU_HALT_ENABLE);
> + ret = regmap_read(lt9611c->regmap, LT9611C_FLASH_CRC, &crc_result);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to read firmware crc\n");
> +
> + if (crc_result != fw_crc) {
> + dev_err(dev, "lt9611c fw upgrade failed, expected crc=0x%02x, read crc=0x%02x\n",
> + fw_crc, crc_result);
> + return -EIO;
> + }
> +
> + dev_info(dev, "lt9611c firmware upgrade success, crc=0x%02x\n", crc_result);
> + return 0;
> +}
> +
> +static int lt9611c_firmware_upgrade(struct lt9611c *lt9611c)
> +{
> + struct device *dev = lt9611c->dev;
> + const struct firmware *fw;
> + const size_t total_size = FW_SIZE - 1;
> + u8 fw_crc;
> + int ret;
> +
> + ret = request_firmware(&fw, FW_FILE, dev);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to load '%s'\n", FW_FILE);
[Severity: Low]
Should lt9611c_firmware_upgrade() and lt9611c_upgrade_result() use
dev_err() instead of dev_err_probe()? Both functions are also called at
runtime from the sysfs firmware_store() handler.
> + if (fw->size > total_size) {
> + dev_err(dev, "firmware too large (%zu > %zu)\n", fw->size, total_size);
> + ret = -EINVAL;
> + goto out_release_fw;
> + }
[Severity: Medium]
What happens if request_firmware() loads an empty (0-byte) firmware file?
Because fw->size == 0 is not rejected here, lt9611c_block_erase() erases
both flash blocks to 0xff, lt9611c_write_data() computes npages = 0 and
writes nothing, and lt9611c_write_crc() programs the CRC of 65535 bytes of
0xff at 0xffff. lt9611c_upgrade_result() then sees a matching CRC and
reports a successful upgrade with the SPI flash completely erased.
[ ... ]
> +static int lt9611c_get_edid_block(void *data, u8 *buf,
> + unsigned int block, size_t len)
> +{
> + struct lt9611c *lt9611c = data;
> + struct device *dev = lt9611c->dev;
> + u8 edid_raw[LT9611C_CMD_Y0_SIZE + LT9611C_EDID_BUF_SIZE];
> + u8 y0;
> + int ret, i, offset = 0;
> + struct lt9611c_cmd cmd = {
> + .hdr = { LT9611C_FUNC_READ, LT9611C_TYPE_HDMI, 0x33, LT9611C_CMD_SEP },
> + };
> + struct lt9611c_rsp rsp = {
> + .data = edid_raw,
> + .data_len = LT9611C_CMD_Y0_SIZE + LT9611C_EDID_BUF_SIZE,
> + };
> +
> + if (len != 128)
> + return -EINVAL;
> + guard(mutex)(<9611c->mcu_lock);
> +
> + for (i = 0; i < 4; i++) {
> + y0 = block * 4 + i;
> + cmd.data = &y0;
> + cmd.data_len = 1;
> + ret = lt9611c_read_write_flow(lt9611c, &cmd, &rsp);
[Severity: Low]
Can y0 overflow when block >= 64? An EDID can have up to 256 blocks, so
block * 4 + i wraps around in u8 and reads packet (block % 64) * 4 + i
instead of returning -EINVAL.
[ ... ]
> + lt9611c->bridge.of_node = client->dev.of_node;
> + lt9611c->bridge.ops = DRM_BRIDGE_OP_DETECT |
> + DRM_BRIDGE_OP_EDID |
> + DRM_BRIDGE_OP_HPD |
> + DRM_BRIDGE_OP_HDMI |
> + DRM_BRIDGE_OP_HDMI_AUDIO;
> + lt9611c->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
> +
> + lt9611c->bridge.vendor = "Lontium";
> + lt9611c->bridge.product = "LT9611C";
> +
> + lt9611c->bridge.hdmi_audio_dev = dev;
> + lt9611c->bridge.hdmi_audio_max_i2s_playback_channels = 8;
> + lt9611c->bridge.hdmi_audio_dai_port = 2;
> +
> + drm_bridge_add(<9611c->bridge);
[Severity: Medium]
Should lt9611c_probe() initialize lt9611c->bridge.supported_hdmi_ver before
calling drm_bridge_add()?
Because DRM_BRIDGE_OP_HDMI is set while supported_hdmi_ver is left at
HDMI_VERSION_UNKNOWN, drm_bridge_add() triggers DRM_WARN("HDMI bridge
misses supported HDMI version\n") on every probe, and
drmm_connector_hdmi_init() leaves connector->hdmi.max_tmds_char_rate at 0
and skips the HDMI 2.0 scrambler callback check for CHIP_LT9611UXD.
[ ... ]
> +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(<9611c->work);
> +
> + mutex_lock(<9611c->mcu_lock);
> + gpiod_set_value_cansleep(lt9611c->reset_gpio, 1);
> + ret = regulator_bulk_disable(ARRAY_SIZE(lt9611c->supplies), lt9611c->supplies);
> + mutex_unlock(<9611c->mcu_lock);
> +
> + if (ret) {
> + dev_err(lt9611c->dev, "regulator bulk disable failed\n");
> + gpiod_set_value_cansleep(lt9611c->reset_gpio, 0);
> + msleep(400);
> + enable_irq(lt9611c->client->irq);
> + return ret;
> + }
[Severity: Low]
If regulator_bulk_disable() fails here, does dropping mcu_lock before
deasserting reset_gpio and waiting 400 ms allow concurrent mcu_lock holders
to talk to the MCU while it is still held in reset or booting?
> +
> + 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(<9611c->mcu_lock);
> + lt9611c_reset(lt9611c);
> + mutex_unlock(<9611c->mcu_lock);
> +
> + enable_irq(lt9611c->client->irq);
> + return 0;
> +}
[Severity: Medium]
As reported by Dmitry Baryshkov on v7 [1], can system suspend and resume
miss hotplug events or lose the programmed bridge state?
During suspend and resume, the falling-edge client->irq is disabled across
power-off and the 400 ms lt9611c_reset() delay, and drm_bridge_hpd_disable()
clears bridge->hpd_cb until drm_kms_helper_poll_enable() runs, so cable
changes while powered off are never reported unless HPD status is re-read
after resume. In addition, because cyclic OF graph links between the DSI
host and lt9611c are relaxed to DL_FLAG_SYNC_STATE_ONLY and no device link
orders lt9611c before the DRM device on dpm_list, DRM drivers that call
drm_mode_config_helper_resume() from their .resume callback can run
lt9611c_bridge_atomic_enable() while lt9611c is still powered down, after
which lt9611c_bridge_resume() resets the chip and wipes the video timing,
dual-DSI, and infoframe state.
> +
> +DEFINE_SIMPLE_DEV_PM_OPS(lt9611c_bridge_pm_ops,
> + lt9611c_bridge_suspend, lt9611c_bridge_resume);
[Severity: Low]
Should DEFINE_SIMPLE_DEV_PM_OPS() be prefixed with static so
lt9611c_bridge_pm_ops is not exported with external linkage?
[1] https://lore.kernel.org/r/4t3bar2svwex4wojumql2t66ivtj6bsxnt7pgmygnc7og4zquh@fs7wdd4k4cjp
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-lt9611c-v7-v19-0-1fbe2b7b5211@oss.qualcomm.com?part=2
prev parent reply other threads:[~2026-11-23 6:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 6:09 [PATCH v19 0/2] Add Lontium LT9611C(EX/UXD) MIPI DSI to HDMI driver mohit.dsor
2026-11-23 6:09 ` [PATCH v19 1/2] dt-bindings: bridge: " mohit.dsor
2026-11-23 6:09 ` [PATCH v19 2/2] drm/bridge: " mohit.dsor
2026-11-23 6:38 ` 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-228772@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