From patchwork Fri Nov 15 12:57:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Ekenberg X-Patchwork-Id: 13877540 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12BFCD68BE5 for ; Sat, 16 Nov 2024 09:51:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B59C10E11C; Sat, 16 Nov 2024 09:51:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=axis.com header.i=@axis.com header.b="h03++5ei"; dkim-atps=neutral Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2058.outbound.protection.outlook.com [40.107.21.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 807EE10E09D for ; Fri, 15 Nov 2024 12:57:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wlKgO4GTKVHDhYdZbyPHq7DzCy5LNShyb0LELJeh7WiMrIXE6AAwNMx0FwkV5gzA0qrsb1yrJUMGNn1sMYw2CJI2FVP/GxTNduI8Q/ERNDfyqxfqeivE14mF1Db5eHD+swhSX6ZN8dcE63y9bPJb5JsIE7D3Tf0iVcOXBsZtcW/XhmJZQH/7YWf2E/PzdUrfQfsuCn80WRt6Oqb1YtG2e3i+HfAcCFthspkTM+ERZQkzK6GxSjTnEar6yZlZP5FD4rv+mXYaMCEWPKvQ5v3KmCccZN/PqbpFgbm6AAvyRICWMYbSmwR960vwuQCPR1PnTTGTaIXIwRfuj2eZPZ6l+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hbJ6lZfTY+DuhfQkjUWQIcPpNdxDk9l8ALGzqO5tGAk=; b=qcPcNou9Cm5KUDQXyDlL9mGnCDRVHI9VNJziV6IirTBXTbkAPamzOzJxcdDisVtp4n6gA5qsPp0/4q9ozC2vhD7VLjhMv9eEUVp+1+M3vkynCmnJ5BvL4pWnBZCPuqz8Hor9mvGzTgGJHvJBKvY98ICNEkFwyIm+w0i/8TFt+FAJvpbv8CbpvMnX295VZskM79qkOa2bEUtpiqVex+awBtE6v/4nLBohSODybusNrlWUKauZ4/U7e2msjwQWsjfA17m/bF4ZGevyxAZckPstvoVoIguKf0+lcaBTFViRUpqlbTpexElvP8yaZETAFqo6p9NIlL4OjHPHuiLKjJswKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=ffwll.ch smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hbJ6lZfTY+DuhfQkjUWQIcPpNdxDk9l8ALGzqO5tGAk=; b=h03++5ei2PSbJtP0Klt0sUQ7jN/57dHwEwPCxqAMm7cRtONGBcqJ82St+PvVgUa4leeImLtxWXtlTDwoVUYFIlfV5AKItgMGmGsy1ruD+ThhcFhAaKRoOt7JRy2tzkhHkw2ch+rJhoubR7KIT6yVnJRXO/De+Y143HhnxZvlOY4= Received: from DU2PR04CA0287.eurprd04.prod.outlook.com (2603:10a6:10:28c::22) by GV2PR02MB10046.eurprd02.prod.outlook.com (2603:10a6:150:e0::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.17; Fri, 15 Nov 2024 12:57:43 +0000 Received: from DU2PEPF00028D07.eurprd03.prod.outlook.com (2603:10a6:10:28c:cafe::b6) by DU2PR04CA0287.outlook.office365.com (2603:10a6:10:28c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.17 via Frontend Transport; Fri, 15 Nov 2024 12:57:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DU2PEPF00028D07.mail.protection.outlook.com (10.167.242.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Fri, 15 Nov 2024 12:57:43 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 15 Nov 2024 13:57:40 +0100 Received: from se-intmail02x.se.axis.com (10.4.0.28) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 15 Nov 2024 13:57:40 +0100 Received: from pc39391-2017.se.axis.com (pc39391-2017.se.axis.com [10.92.82.2]) by se-intmail02x.se.axis.com (Postfix) with ESMTP id 5CCA45E1; Fri, 15 Nov 2024 13:57:40 +0100 (CET) Received: by pc39391-2017.se.axis.com (Postfix, from userid 10612) id 57D0C4462505; Fri, 15 Nov 2024 13:57:40 +0100 (CET) From: Stefan Ekenberg Date: Fri, 15 Nov 2024 13:57:28 +0100 Subject: [PATCH v2] drm/bridge: adv7511_audio: Update Audio InfoFrame properly MIME-Version: 1.0 Message-ID: <20241115-adv7511-audio-info-frame-v2-1-ca4793ef3a91@axis.com> X-B4-Tracking: v=1; b=H4sIADdFN2cC/3WNyw6CMBBFf4XM2jFMaXm48j8Mi0JbmQXUtNpgC P9uJW5dnpPcczeINrCNcCk2CDZxZL9kEKcCxkkvd4tsMoMohSQqW9QmNYoI9cuwR16cRxf0bFH JmqQxcnCqgTx/BOt4PdK3PvPE8enD+3hK9LW/KFX/o4mQUHZDVbdD1ymtrnrleB79DP2+7x9dA rPmvwAAAA== X-Change-ID: 20241108-adv7511-audio-info-frame-54614dd4bf57 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , "Jernej Skrabec" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter CC: , , , Stefan Ekenberg X-Mailer: b4 0.14.2 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D07:EE_|GV2PR02MB10046:EE_ X-MS-Office365-Filtering-Correlation-Id: cf047db0-6810-410c-09a2-08dd05751830 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|1800799024|36860700013|376014|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+OBr6kuEKnQs5ir+GncI62IDRLXK10c?= =?utf-8?q?d7XMVz8bVLwy+znZDCA7A8hhXxt3z75q6999gfYIJSNAwr6dAvg2imD0SbDryBuql?= =?utf-8?q?kXDwLS1lC34KLZxLHqglTdM7QnyNvUiZDHku6aaQeYQDx/wjWDCd4YR4QC26pGQvK?= =?utf-8?q?d7RXIYeZTCe9wkdr6apu5wuak5PAZCJ86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K+5WluDnrsrs0yPHWpHcGsGlcO1JRHypd?= =?utf-8?q?SrPc5f0fLM/zrpGEu3fGMfsfElVquUHSv+XPdceK1bhPzA8RMneVOR9D7rpOYaquh?= =?utf-8?q?YVdKGmUkO3IVaiwFSHx99sQYn99Q/1u982QnQrntrE9sNAe58QLl6QNmDFoU18S3d?= =?utf-8?q?mCBGhHYsoqFALcs4evCqo5w7zAISximVMLzA454eW4f55wQA+QtrkKxOrxW5JhFED?= =?utf-8?q?5vjg4TQBZcuOiVy0rfWlZjRPk2VBI5KGcTblmug/5FrgM208+RXgWN6oxb+LMCigc?= =?utf-8?q?N+zKGCilwAxyDqiHeNQEzMi8QNaw51cPowIZKLpla3nKzZicQ9H8z84=3D?= X-Forefront-Antispam-Report: CIP:195.60.68.100; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.axis.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(7416014)(1800799024)(36860700013)(376014)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 12:57:43.0967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf047db0-6810-410c-09a2-08dd05751830 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af; Ip=[195.60.68.100]; Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D07.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR02MB10046 X-Mailman-Approved-At: Sat, 16 Nov 2024 09:51:27 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Tested-by: Biju Das --- 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, 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,