]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/bridge: adv7511_audio: Update Audio InfoFrame properly
authorStefan Ekenberg <stefan.ekenberg@axis.com>
Tue, 19 Nov 2024 07:40:29 +0000 (08:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:25:02 +0000 (13:25 +0100)
[ Upstream commit 902806baf3c1e8383c1fe3ff0b6042b8cb5c2707 ]

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.

Note that this patchs replaces writing REG_GC(1) with
REG_INFOFRAME_UPDATE. Bit 5 of REG_GC(1) is positioned within field
GC_PP[3:0] and that field doesn't control audio infoframe and is read-
only. My conclusion therefore was that the author if this code meant to
clear bit 5 of REG_INFOFRAME_UPDATE from the very beginning.

Tested-by: Biju Das <biju.das.jz@bp.renesas.com>
Fixes: 53c515befe28 ("drm/bridge: adv7511: Add Audio support")
Signed-off-by: Stefan Ekenberg <stefan.ekenberg@axis.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241119-adv7511-audio-info-frame-v4-1-4ae68e76c89c@axis.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c

index f101dd2819b5290dbb2992c3d04aea0432c14182..0a1ac11e2e4f6202868f8c3b9c4219d02d4a1fee 100644 (file)
@@ -147,7 +147,16 @@ 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;
 }
@@ -178,8 +187,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,