All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Biju <biju.das.au@gmail.com>
Cc: wsa+renesas@sang-engineering.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 2/2] drm: renesas: rz-du: Add support for RZ/G3L LVDS encoder
Date: Fri, 19 Jun 2026 10:20:14 +0000	[thread overview]
Message-ID: <20260619102014.990C71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260619101026.323633-3-biju.das.jz@bp.renesas.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Sleeping functions called in atomic context during bridge enable
- [High] Early returns in `atomic_enable` cause unbalanced PM counter and unpowered hardware access in `atomic_disable`
--

commit 0eae00dcaa6988008a1dca84233d19bc97469ed0
Author: Biju Das <biju.das.jz@bp.renesas.com>

drm: renesas: rz-du: Add support for RZ/G3L LVDS encoder

Adds support for the RZ/G3L LVDS encoder driver operating in single-link
mode with 4 lanes. It supports pixel clocks from 25 to 87 MHz and shares
peripherals with MIPI-DSI.

> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg3l_lvds.c b/drivers/gpu/drm/renesas/rz-du/rzg3l_lvds.c
> new file mode 100644
> index 0000000000000..6100888ea7284
> --- /dev/null
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg3l_lvds.c
[ ... ]
> @@ -0,0 +1,285 @@
> +static void rzg3l_lvds_atomic_enable(struct drm_bridge *bridge,
> +				     struct drm_atomic_commit *state)
> +{
> +	struct rzg3l_lvds *lvds = bridge_to_rzg3l_lvds(bridge);
> +	const struct drm_bridge_state *bridge_state;
> +	u32 fmt;
> +
> +	/* Get the LVDS format from the bridge state. */
> +	bridge_state = drm_atomic_get_new_bridge_state(state, bridge);
> +	if (WARN_ON(!bridge_state))
> +		return;

[Severity: High]
If drm_atomic_get_new_bridge_state() returns NULL and takes this early return,
will rzg3l_lvds_atomic_disable() later execute unconditionally and access
unpowered hardware registers or cause a runtime PM usage counter underflow?
Since atomic_enable returns void, the DRM core might still consider the bridge
enabled.

> +
> +	switch (bridge_state->output_bus_cfg.format) {
> +	case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
> +		fmt = RZG3L_LVDS_MODE_JEIDA;
> +		break;
> +	case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
> +		fmt = RZG3L_LVDS_MODE_VESA;
> +		break;
> +	default:
> +		fmt = RZG3L_LVDS_MODE_VESA;
> +		dev_warn(lvds->dev, "Unsupported bus fmt 0x%04x\n",
> +			 bridge_state->output_bus_cfg.format);
> +		break;
> +	}
> +
> +	if (WARN_ON(pm_runtime_get_sync(lvds->dev) < 0))
> +		return;

[Severity: High]
Similarly, if pm_runtime_get_sync() fails, returning early here leaves the
device unpowered. When rzg3l_lvds_atomic_disable() is called during teardown,
could this lead to a bus fault from accessing unpowered MMIO registers and
an unbalanced pm_runtime_put() counter?

[Severity: High]
Also, since atomic_enable callbacks run in an atomic commit context where
sleeping is forbidden, is it safe to use pm_runtime_get_sync() here? This
function blocks and sleeps while waiting for the device to resume, which might
cause a scheduling while atomic regression.

> +
> +	regmap_update_bits(lvds->regmap, LVDS_0_PHY_OFFSET,
> +			   LVDS_0_PHY_CH_EN_BGR, LVDS_0_PHY_CH_EN_BGR);
> +	fsleep(20);
> +
> +	regmap_update_bits(lvds->regmap, LVDS_0_PHY_OFFSET,
> +			   LVDS_0_PHY_CH_EN_LDO, LVDS_0_PHY_CH_EN_LDO);
> +	fsleep(10);

[Severity: High]
Because this is an atomic commit path, delay functions that can sleep like
fsleep() are unsafe. Could these fsleep() calls (which map to usleep_range()
or msleep()) lead to scheduling while atomic bugs? Would udelay() or ndelay()
be more appropriate for these hardware delays?

> +
> +	regmap_write(lvds->regmap, LVDS_CMN, LVDS_CMN_RST_PHY0_SEL);
> +	regmap_update_bits(lvds->regmap, LVDS_0_CTL_OFFSET,
> +			   LVDS_0_CTL_FMT_SEL0_MSK,
> +			   FIELD_PREP(LVDS_0_CTL_FMT_SEL0_MSK, fmt));
> +	regmap_update_bits(lvds->regmap, LVDS_0_PHY_OFFSET,
> +			   LVDS_0_PHY_CH_IO_EN0_MSK, LVDS_0_PHY_CH_IO_EN0);
> +	regmap_write(lvds->regmap, LVDS_CMN,
> +		     LVDS_CMN_RST_PHY0_SEL | LVDS_CMN_PHY_RESET);
> +	fsleep(100);

[Severity: High]
Could this fsleep(100) call also sleep in this atomic context?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260619101026.323633-1-biju.das.jz@bp.renesas.com?part=2

  reply	other threads:[~2026-06-19 10:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19 10:10 [PATCH v4 0/2] Add support for Renesas RZ/G3L LVDS encoder Biju
2026-06-19 10:10 ` [PATCH v4 1/2] dt-bindings: display: bridge: Document " Biju
2026-06-19 10:10 ` [PATCH v4 2/2] drm: renesas: rz-du: Add support for " Biju
2026-06-19 10:20   ` sashiko-bot [this message]
2026-06-19 11:19     ` Biju Das

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=20260619102014.990C71F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=biju.das.au@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.