[PATCH v4 5/5] drm/bridge: it6505: Don't reject audio hw_params without an encoder
From: Daniel Golle
Date: Tue Jul 21 2026 - 21:05:25 EST
it6505_audio_setup_hw_params() returns -ENODEV when the bridge is not
attached to a DRM encoder. Now that it6505 registers an hdmi-audio-codec,
this callback runs whenever a stream is configured on the I2S DAI it is
wired to, including when that DAI is shared with another codec. On
mt8186-corsola the speaker amplifier (rt1019) and it6505 share I2S3, so
when the it6505 DP output has no display attached (bridge.encoder is
NULL) the -ENODEV propagates up through dpcm_be_dai_hw_params() and tears
down the whole backend, breaking speaker playback.
The check is harmful in its own right: the rest of the function only
caches the stream parameters (channel count, rate, word length) in
software, none of which needs an encoder. Returning early leaves
it6505->audio.channel_count at 0, which would then index
audio_info_ca[-1] in it6505_enable_audio_infoframe() should a display be
hotplugged while a stream is running, and makes such a hotplug play with
stale parameters.
Drop the encoder check so the parameters are always cached; the actual
audio output is already gated by it6505->powered.
For the cached parameters to survive until a display shows up they must
also not be clobbered when it appears: it6505_variable_config()
re-applies the compile-time audio defaults on every fresh DPCD read.
Apply the defaults once at probe time instead, so a hotplug uses
whatever ALSA last configured.
Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
---
v4:
* move the audio parameter defaults from it6505_variable_config() to
probe time: it runs again on every fresh DPCD read (i.e. on
display hotplug) and would clobber the parameters cached from
hw_params with the 2ch/48kHz defaults, defeating this patch's
purpose; flagged by Sashiko AI review of v3
v3: no changes
v2: drop the encoder check entirely instead of returning 0 early, so
the stream parameters are always cached even while no display is
attached; rewrite the commit message to explain why the check is
harmful
drivers/gpu/drm/bridge/ite-it6505.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 6bb5db565cca..e01d57b0166a 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -1369,16 +1369,6 @@ static void it6505_variable_config(struct it6505 *it6505)
it6505->link_state = LINK_IDLE;
it6505->hdcp_desired = HDCP_DESIRED;
it6505->auto_train_retry = AUTO_TRAIN_RETRY;
- it6505->audio.select = AUDIO_SELECT;
- it6505->audio.sample_rate = AUDIO_SAMPLE_RATE;
- it6505->audio.channel_count = AUDIO_CHANNEL_COUNT;
- it6505->audio.type = AUDIO_TYPE;
- it6505->audio.i2s_input_format = I2S_INPUT_FORMAT;
- it6505->audio.i2s_justified = I2S_JUSTIFIED;
- it6505->audio.i2s_data_delay = I2S_DATA_DELAY;
- it6505->audio.i2s_ws_channel = I2S_WS_CHANNEL;
- it6505->audio.i2s_data_sequence = I2S_DATA_SEQUENCE;
- it6505->audio.word_length = AUDIO_WORD_LENGTH;
memset(it6505->sha1_input, 0, sizeof(it6505->sha1_input));
memset(it6505->bksvs, 0, sizeof(it6505->bksvs));
}
@@ -3004,9 +2994,6 @@ static int it6505_audio_setup_hw_params(struct it6505 *it6505,
params->sample_rate, params->sample_width,
params->cea.channels);
- if (!it6505->bridge.encoder)
- return -ENODEV;
-
if (params->cea.channels <= 1 || params->cea.channels > 8) {
DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support",
params->cea.channels);
@@ -3137,6 +3124,16 @@ static int it6505_register_audio_driver(struct device *dev)
};
struct platform_device *pdev;
+ it6505->audio.select = AUDIO_SELECT;
+ it6505->audio.sample_rate = AUDIO_SAMPLE_RATE;
+ it6505->audio.channel_count = AUDIO_CHANNEL_COUNT;
+ it6505->audio.type = AUDIO_TYPE;
+ it6505->audio.i2s_input_format = I2S_INPUT_FORMAT;
+ it6505->audio.i2s_justified = I2S_JUSTIFIED;
+ it6505->audio.i2s_data_delay = I2S_DATA_DELAY;
+ it6505->audio.i2s_ws_channel = I2S_WS_CHANNEL;
+ it6505->audio.i2s_data_sequence = I2S_DATA_SEQUENCE;
+ it6505->audio.word_length = AUDIO_WORD_LENGTH;
it6505->audio.mute = true;
INIT_DELAYED_WORK(&it6505->delayed_audio, it6505_delayed_audio);
--
2.55.0