diff mbox series

[v2] drm/bridge: adv7511_audio: Update Audio InfoFrame properly

Message ID 20241115-adv7511-audio-info-frame-v2-1-ca4793ef3a91@axis.com (mailing list archive)
State New
Headers show
Series [v2] drm/bridge: adv7511_audio: Update Audio InfoFrame properly | expand

Commit Message

Stefan Ekenberg Nov. 15, 2024, 12:57 p.m. UTC
AUDIO_UPDATE bit (Bit 5 of MAIN register 0x4A) needs to be set to 1
while updating Audio InfoFrame information and then set to 0 when done.
Otherwise partially updated Audio InfoFrames could be sent out. Two
cases where this rule were not followed are fixed:
 - In adv7511_hdmi_hw_params() make sure AUDIO_UPDATE bit is updated
   before/after setting ADV7511_REG_AUDIO_INFOFRAME.
 - In audio_startup() use the correct register for clearing
   AUDIO_UPDATE bit.

The problem with corrupted audio infoframes were discovered by letting
a HDMI logic analyser check the output of ADV7535.

Fixes: 53c515befe28 ("drm/bridge: adv7511: Add Audio support")
Signed-off-by: Stefan Ekenberg <stefan.ekenberg@axis.com>
---
Changes in v2:
- Add Fixes tag
- Link to v1: https://lore.kernel.org/r/20241113-adv7511-audio-info-frame-v1-1-49b368b995a5@axis.com
---
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)


---
base-commit: 59b723cd2adbac2a34fc8e12c74ae26ae45bf230
change-id: 20241108-adv7511-audio-info-frame-54614dd4bf57

Best regards,

Comments

Biju Das Nov. 16, 2024, 12:17 p.m. UTC | #1
Hi Stefan Ekenberg <stefan.ekenberg@axis.com>,

> -----Original Message-----
> From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of Stefan Ekenberg
> Sent: 15 November 2024 12:57
> Subject: [PATCH v2] drm/bridge: adv7511_audio: Update Audio InfoFrame properly
> 
> AUDIO_UPDATE bit (Bit 5 of MAIN register 0x4A) needs to be set to 1 while updating Audio InfoFrame
> information and then set to 0 when done.
> Otherwise partially updated Audio InfoFrames could be sent out. Two cases where this rule were not
> followed are fixed:
>  - In adv7511_hdmi_hw_params() make sure AUDIO_UPDATE bit is updated
>    before/after setting ADV7511_REG_AUDIO_INFOFRAME.
>  - In audio_startup() use the correct register for clearing
>    AUDIO_UPDATE bit.
> 
> The problem with corrupted audio infoframes were discovered by letting a HDMI logic analyser check the
> output of ADV7535.
> 
> Fixes: 53c515befe28 ("drm/bridge: adv7511: Add Audio support")

With and without the patch, Audio works on Renesas RZ/V2L SMARC board.

Tested-by: Biju Das <biju.das.jz@bp.renesas.com>

> Signed-off-by: Stefan Ekenberg <stefan.ekenberg@axis.com>
> ---
> Changes in v2:
> - Add Fixes tag
> - Link to v1: https://lore.kernel.org/r/20241113-adv7511-audio-info-frame-v1-1-49b368b995a5@axis.com
> ---
>  drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> index 61f4a38e7d2bf6905683cbc9e762b28ecc999d05..8f786592143b6c81e5a434768b51508d5e5f3c73 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> @@ -153,7 +153,16 @@ static int adv7511_hdmi_hw_params(struct device *dev, void *data,
>  			   ADV7511_AUDIO_CFG3_LEN_MASK, len);
>  	regmap_update_bits(adv7511->regmap, ADV7511_REG_I2C_FREQ_ID_CFG,
>  			   ADV7511_I2C_FREQ_ID_CFG_RATE_MASK, rate << 4);
> -	regmap_write(adv7511->regmap, 0x73, 0x1);
> +
> +	/* send current Audio infoframe values while updating */
> +	regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
> +			   BIT(5), BIT(5));
> +
> +	regmap_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME(0), 0x1);
> +
> +	/* use Audio infoframe updated info */
> +	regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
> +			   BIT(5), 0);
> 
>  	return 0;
>  }
> @@ -184,8 +193,9 @@ static int audio_startup(struct device *dev, void *data)
>  	regmap_update_bits(adv7511->regmap, ADV7511_REG_GC(0),
>  				BIT(7) | BIT(6), BIT(7));
>  	/* use Audio infoframe updated info */
> -	regmap_update_bits(adv7511->regmap, ADV7511_REG_GC(1),
> +	regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
>  				BIT(5), 0);
> +
>  	/* enable SPDIF receiver */
>  	if (adv7511->audio_source == ADV7511_AUDIO_SOURCE_SPDIF)
>  		regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CONFIG,
> 
> ---
> base-commit: 59b723cd2adbac2a34fc8e12c74ae26ae45bf230
> change-id: 20241108-adv7511-audio-info-frame-54614dd4bf57
> 
> Best regards,
> --
> Stefan Ekenberg <stefan.ekenberg@axis.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index 61f4a38e7d2bf6905683cbc9e762b28ecc999d05..8f786592143b6c81e5a434768b51508d5e5f3c73 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -153,7 +153,16 @@  static int adv7511_hdmi_hw_params(struct device *dev, void *data,
 			   ADV7511_AUDIO_CFG3_LEN_MASK, len);
 	regmap_update_bits(adv7511->regmap, ADV7511_REG_I2C_FREQ_ID_CFG,
 			   ADV7511_I2C_FREQ_ID_CFG_RATE_MASK, rate << 4);
-	regmap_write(adv7511->regmap, 0x73, 0x1);
+
+	/* send current Audio infoframe values while updating */
+	regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
+			   BIT(5), BIT(5));
+
+	regmap_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME(0), 0x1);
+
+	/* use Audio infoframe updated info */
+	regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
+			   BIT(5), 0);
 
 	return 0;
 }
@@ -184,8 +193,9 @@  static int audio_startup(struct device *dev, void *data)
 	regmap_update_bits(adv7511->regmap, ADV7511_REG_GC(0),
 				BIT(7) | BIT(6), BIT(7));
 	/* use Audio infoframe updated info */
-	regmap_update_bits(adv7511->regmap, ADV7511_REG_GC(1),
+	regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
 				BIT(5), 0);
+
 	/* enable SPDIF receiver */
 	if (adv7511->audio_source == ADV7511_AUDIO_SOURCE_SPDIF)
 		regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CONFIG,