From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: dri-devel@lists.freedesktop.org, robh@kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 18/18] drm/bridge: synopsys: dw-dp: Add audio support
Date: Tue, 28 Jul 2026 21:05:01 +0000 [thread overview]
Message-ID: <20260728210501.D86DF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728-synopsys-dw-dp-improvements-v7-18-b7640fa8cf48@collabora.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Multichannel audio channel allocation is hardcoded to 0 (stereo), breaking surround sound routing.
- [High] Audio InfoFrame can steal SDP slot 0, which is hardcoded for Video Stream Configuration (VSC), corrupting the VSC packet if ALSA prepares audio before the display is enabled.
- [Medium] Unconditional attempt to enable both I2S and SPDIF clocks causes valid audio configurations to fail if the unused clock cannot be enabled.
- [Medium] The audio mute state (AUDIO_MUTE) is lost across DisplayPort controller resets during atomic_disable/atomic_enable cycles.
--
--- Patch [18]: [PATCH v7 18/18] drm/bridge: synopsys: dw-dp: Add audio support ---
commit 5e1e4e31e16d403e05ea9b2201464ef6e1a35fc1
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
drm/bridge: synopsys: dw-dp: Add audio support
Implement audio support for the Synopsys DesignWare DisplayPort controller.
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> index c0026bd4c7b53..3b73e822478d7 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
[ ... ]
> @@ -1679,6 +1708,247 @@ static int dw_dp_link_enable(struct dw_dp *dp)
> return ret;
> }
>
> +static int dw_dp_audio_infoframe_send(struct dw_dp *dp)
> +{
> + struct hdmi_audio_infoframe frame;
> + struct dw_dp_sdp sdp;
> + int ret;
> +
> + ret = hdmi_audio_infoframe_init(&frame);
[Severity: High]
The hdmi_audio_infoframe_init() function initializes the frame to zero, which
implicitly sets the channel allocation to 0 (stereo).
Since dw_dp_audio_prepare() receives the channel allocation in
params->cea.channel_allocation but does not save it, will multi-channel audio
(like 5.1 or 7.1) be transmitted incorrectly as stereo, potentially causing
the AV receiver to drop or improperly route channels?
> + if (ret < 0)
> + return ret;
> +
> + frame.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM;
> + frame.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM;
> + frame.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM;
> + frame.channels = dp->audio_channels;
[ ... ]
> +static int __dw_dp_audio_enable(struct dw_dp *dp)
> +{
> + u8 audio_data_in_en;
> +
> + switch (dp->audio_channels) {
[ ... ]
> + }
> +
> + regmap_update_bits(dp->regmap, DW_DP_AUD_CONFIG1,
> + AUDIO_DATA_IN_EN | NUM_CHANNELS | AUDIO_DATA_WIDTH |
> + AUDIO_INF_SELECT | HBR_MODE_ENABLE,
[Severity: Medium]
The dw_dp_audio_mute_stream() function sets the AUDIO_MUTE bit in hardware,
but it does not save this state in the software context.
If the display is disabled and re-enabled (causing a hardware reset),
__dw_dp_audio_enable() restores DW_DP_AUD_CONFIG1 here but does not include
AUDIO_MUTE in its update mask.
Will an intentionally muted audio stream suddenly become unmuted after a
display power cycle?
> + FIELD_PREP(AUDIO_DATA_IN_EN, audio_data_in_en) |
> + FIELD_PREP(NUM_CHANNELS, dp->audio_channels - 1) |
[ ... ]
> +static int dw_dp_audio_prepare(struct drm_bridge *bridge,
> + struct drm_connector *connector,
> + struct hdmi_codec_daifmt *daifmt,
> + struct hdmi_codec_params *params)
> +{
[ ... ]
> + regmap_read(dp->regmap, DW_DP_CONFIG_REG1, &cfg1);
> + supported_audio_interfaces = FIELD_GET(AUDIO_SELECT, cfg1);
> +
> + if (supported_audio_interfaces != DW_DP_AUDIO_I2S_AND_SPDIF &&
> + supported_audio_interfaces != audio_interface) {
> + dev_err(dp->dev, "unsupported DAI %d\n", daifmt->fmt);
> + return -EINVAL;
> + }
> +
> + ret = clk_prepare_enable(dp->spdif_clk);
> + if (ret)
> + return ret;
> +
> + ret = clk_prepare_enable(dp->i2s_clk);
> + if (ret) {
> + clk_disable_unprepare(dp->spdif_clk);
> + return ret;
> + }
[Severity: Medium]
This code attempts to enable both the spdif_clk and i2s_clk unconditionally,
returning an error if either fails.
If a platform has one of these clocks defined in the device tree but it
temporarily or permanently fails to enable, will this cause the entire audio
preparation to fail even if the user only requested the other (working) audio
interface?
> +
> + if (audio_interface == DW_DP_AUDIO_I2S)
> + clk_disable_unprepare(dp->spdif_clk);
[ ... ]
> @@ -1720,6 +1990,14 @@ static void dw_dp_bridge_atomic_enable(struct drm_bridge *bridge,
> dev_err(dp->dev, "failed to enable video: %d\n", ret);
> return;
> }
> +
> + scoped_guard(mutex, &dp->audio_lock) {
> + if (dp->audio_interface != DW_DP_AUDIO_UNUSED) {
> + ret = __dw_dp_audio_enable(dp);
[Severity: High]
If userspace prepares audio while the display is disabled, dw_dp_send_sdp()
might allocate the first free slot (slot 0) for the Audio InfoFrame.
Earlier in this function, dw_dp_bridge_atomic_enable() hardcodes a reservation
for slot 0 for the Video Stream Configuration (VSC) packet:
scoped_guard(mutex, &dp->sdp_lock)
set_bit(0, dp->sdp_reg_bank);
Does calling __dw_dp_audio_enable() here then clear slot 0 (wiping out the VSC
packet) and reallocate it to audio since audio previously held slot 0?
> + if (ret < 0)
> + dev_err(dp->dev, "failed to restore audio: %d\n", ret);
> + }
> + }
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260728-synopsys-dw-dp-improvements-v7-0-b7640fa8cf48@collabora.com?part=18
prev parent reply other threads:[~2026-07-28 21:05 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 17:40 [PATCH v7 00/18] Synopsys DisplayPort Controller improvements for Rockchip platforms Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 17:40 ` [PATCH v7 01/18] drm/bridge: synopsys: dw-dp: Fix incorrect resource lifetimes in bind callback Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 17:59 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 02/18] drm/bridge: synopsys: dw-dp: Cancel pending HPD work on unbind Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 18:09 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 03/18] drm/bridge: synopsys: dw-dp: Add missing mutex cleanups on module removal Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 18:20 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 04/18] drm/bridge: synopsys: dw-dp: Add missing reinit_completion Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 18:34 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 05/18] drm/bridge: synopsys: dw-dp: Reset AUX channel on transfer timeout Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 18:43 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 06/18] drm/bridge: synopsys: dw-dp: Free output_fmts when none are valid Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 17:40 ` [PATCH v7 07/18] drm/bridge: synopsys: dw-dp: Support MEDIA_BUS_FMT_FIXED Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 17:40 ` [PATCH v7 08/18] drm/bridge: synopsys: dw-dp: Add follow-up bridge support Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 17:40 ` [PATCH v7 09/18] drm/bridge: Add out-of-band HPD notify handler Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 19:19 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 10/18] drm/bridge: synopsys: dw-dp: Support software triggered OOB HPD Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 17:40 ` [PATCH v7 11/18] drm/rockchip: dw_dp: Implement out-of-band HPD handling Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 19:41 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 12/18] drm/bridge: synopsys: dw-dp: Add Runtime PM support Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 19:58 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 13/18] drm/rockchip: dw_dp: Add runtime " Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 20:14 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 14/18] drm/bridge: synopsys: dw-dp: Protect sdp_reg_bank from concurrent access Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 20:26 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 15/18] drm/bridge: synopsys: dw-dp: Use regmap_set_bits in dw_dp_send_sdp Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 17:40 ` [PATCH v7 16/18] dt-bindings: display: rockchip: dw-dp: Fix sound DAI cells Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 17:40 ` [PATCH v7 17/18] drm/bridge: synopsys: dw-dp: Clear only enabled SDPs on atomic disable Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 20:50 ` sashiko-bot
2026-07-28 17:40 ` [PATCH v7 18/18] drm/bridge: synopsys: dw-dp: Add audio support Sebastian Reichel
2026-07-28 17:40 ` Sebastian Reichel
2026-07-28 21:05 ` 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=20260728210501.D86DF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sebastian.reichel@collabora.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.