Skip to content

Commit f0e7f35

Browse files
committed
drm/bridge: write full Audio InfoFrame
Instead of writing the first byte of the infoframe (and hoping that the rest is default / zeroes), hook Audio InfoFrame support into the write_infoframe / clear_infoframes callbacks and use drm_atomic_helper_connector_hdmi_update_audio_infoframe() to write the frame. Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20250903-adv7511-audio-infoframe-v1-2-05b24459b9a4@oss.qualcomm.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
1 parent 723a170 commit f0e7f35

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

drivers/gpu/drm/bridge/adv7511/adv7511_audio.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <sound/soc.h>
1313
#include <linux/of_graph.h>
1414

15+
#include <drm/display/drm_hdmi_state_helper.h>
16+
1517
#include "adv7511.h"
1618

1719
static void adv7511_calc_cts_n(unsigned int f_tmds, unsigned int fs,
@@ -155,17 +157,8 @@ int adv7511_hdmi_audio_prepare(struct drm_bridge *bridge,
155157
regmap_update_bits(adv7511->regmap, ADV7511_REG_I2C_FREQ_ID_CFG,
156158
ADV7511_I2C_FREQ_ID_CFG_RATE_MASK, rate << 4);
157159

158-
/* send current Audio infoframe values while updating */
159-
regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
160-
BIT(5), BIT(5));
161-
162-
regmap_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME(0), 0x1);
163-
164-
/* use Audio infoframe updated info */
165-
regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
166-
BIT(5), 0);
167-
168-
return 0;
160+
return drm_atomic_helper_connector_hdmi_update_audio_infoframe(connector,
161+
&hparms->cea);
169162
}
170163

171164
int adv7511_hdmi_audio_startup(struct drm_bridge *bridge,
@@ -188,15 +181,9 @@ int adv7511_hdmi_audio_startup(struct drm_bridge *bridge,
188181
/* not copyrighted */
189182
regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CFG1,
190183
BIT(5), BIT(5));
191-
/* enable audio infoframes */
192-
regmap_update_bits(adv7511->regmap, ADV7511_REG_PACKET_ENABLE1,
193-
BIT(3), BIT(3));
194184
/* AV mute disable */
195185
regmap_update_bits(adv7511->regmap, ADV7511_REG_GC(0),
196186
BIT(7) | BIT(6), BIT(7));
197-
/* use Audio infoframe updated info */
198-
regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
199-
BIT(5), 0);
200187

201188
/* enable SPDIF receiver */
202189
if (adv7511->audio_source == ADV7511_AUDIO_SOURCE_SPDIF)
@@ -214,4 +201,6 @@ void adv7511_hdmi_audio_shutdown(struct drm_bridge *bridge,
214201
if (adv7511->audio_source == ADV7511_AUDIO_SOURCE_SPDIF)
215202
regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CONFIG,
216203
BIT(7), 0);
204+
205+
drm_atomic_helper_connector_hdmi_clear_audio_infoframe(connector);
217206
}

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,9 @@ static int adv7511_bridge_hdmi_clear_infoframe(struct drm_bridge *bridge,
893893
struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
894894

895895
switch (type) {
896+
case HDMI_INFOFRAME_TYPE_AUDIO:
897+
adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_AUDIO_INFOFRAME);
898+
break;
896899
case HDMI_INFOFRAME_TYPE_AVI:
897900
adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_AVI_INFOFRAME);
898901
break;
@@ -917,6 +920,21 @@ static int adv7511_bridge_hdmi_write_infoframe(struct drm_bridge *bridge,
917920
struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
918921

919922
switch (type) {
923+
case HDMI_INFOFRAME_TYPE_AUDIO:
924+
/* send current Audio infoframe values while updating */
925+
regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
926+
BIT(5), BIT(5));
927+
928+
/* The Audio infoframe id is not configurable */
929+
regmap_bulk_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME_VERSION,
930+
buffer + 1, len - 1);
931+
932+
/* use Audio infoframe updated info */
933+
regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
934+
BIT(5), 0);
935+
936+
adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_AUDIO_INFOFRAME);
937+
break;
920938
case HDMI_INFOFRAME_TYPE_AVI:
921939
/* send current AVI infoframe values while updating */
922940
regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,

0 commit comments

Comments
 (0)