From patchwork Mon Nov 18 08:03:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Ekenberg X-Patchwork-Id: 13878289 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 542CAD43FEC for ; Mon, 18 Nov 2024 08:35:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D05D110E071; Mon, 18 Nov 2024 08:35:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=axis.com header.i=@axis.com header.b="HokLDZWH"; dkim-atps=neutral Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2087.outbound.protection.outlook.com [40.107.22.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id B917C10E336 for ; Mon, 18 Nov 2024 08:03:55 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DQRjRvxdLubab8OEq1xc1cfuVnbuzrnyR4IFtmYgJLcYzA9NT5P7OblDNRo/axnnNGulyT0nwM0LbA4Y3fxstl6dDs62aUAZyrLLkm6mKNzeo7t1i0E4PjsCHJA8yscCqXHlZJcQ6Ai5kOQf5gnPkoY3WEKPzWgHiPQtJ0z6RCTOBuVnokGeVuaMYmWgYh07J7hJy9y0zQFzsJ/oSTJjsrNEaA/2/KSIWeoxi9DRsd0jLuiq0hgLduTlx3DhZf3J/IQ8ZHmpwMqhAfDtjeiqNDglGoO7R62o6jfG5PXe1d7qYy4sIAHvVUzfDiA7zo1W/UfzDBG/OdD84dT6X3AHnA== 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=PHGlPhmvwumxdK3g0Id1Bh/8TtzZecngJz49euIFcdY=; b=r+j1fgcZvXERQFm9rv/1WFALmVk8kPFmEugBMEGtW3kEUh7VyTpTrtfmV08xOYhNRXpE7P0jT3ts2ny3yciOetPTdufyaOGHG9OfHuGr7oqj/3DilVwwGaYGRkNaR4wpfrXJ/qwDk2ahqaiAgpCTMKdnA92FoX31D2FdcpATi46D8gAKtQdxtx25sfBZFu3kvy001XITuH0Oc6hIT86JlkCmC+vBeLOXQDrr0PPdf3qSyOZxokGRLDj9FKGreCVtPR2yd9gKz3h8LakuD36GPPS1hyqh26F3r5CuiT5Lv7duAFfjAbA0ibmGgBTg/fezYVj03rS/ga0Z2qKudzdQ0g== 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=PHGlPhmvwumxdK3g0Id1Bh/8TtzZecngJz49euIFcdY=; b=HokLDZWH48VKcFuuthwY6eSWbscvYcdBH0xClmdR0LOXSLUMdVL08Ov0aDA60gsA5c4GvnP55ROXY8yH+LukMsDBaTGIGXgixWja/FgoSSeHLW4Zz46WOZCaez1XsRjePTGshHGBqdFBkIFxJlF3xdV/na2o7LODbVZqwjnPtmo= Received: from DU2PR04CA0291.eurprd04.prod.outlook.com (2603:10a6:10:28c::26) by VI0PR02MB10681.eurprd02.prod.outlook.com (2603:10a6:800:20c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Mon, 18 Nov 2024 08:03:50 +0000 Received: from DB1PEPF000509E7.eurprd03.prod.outlook.com (2603:10a6:10:28c:cafe::53) by DU2PR04CA0291.outlook.office365.com (2603:10a6:10:28c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22 via Frontend Transport; Mon, 18 Nov 2024 08:03:50 +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 DB1PEPF000509E7.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Mon, 18 Nov 2024 08:03:50 +0000 Received: from se-mail01w.axis.com (10.20.40.7) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 18 Nov 2024 09:03:48 +0100 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 18 Nov 2024 09:03:48 +0100 Received: from pc39391-2017.se.axis.com (pc39391-2017.se.axis.com [10.92.82.2]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 0421F2C5; Mon, 18 Nov 2024 09:03:48 +0100 (CET) Received: by pc39391-2017.se.axis.com (Postfix, from userid 10612) id F2D4F4462505; Mon, 18 Nov 2024 09:03:47 +0100 (CET) From: Stefan Ekenberg Date: Mon, 18 Nov 2024 09:03:33 +0100 Subject: [PATCH v3] drm/bridge: adv7511_audio: Update Audio InfoFrame properly MIME-Version: 1.0 Message-ID: <20241118-adv7511-audio-info-frame-v3-1-31edd9931856@axis.com> X-B4-Tracking: v=1; b=H4sIANT0OmcC/33NsQ6CMBDG8VchnT3D0Rask+9hHApt5QaoabXBE N7dQhxYdPx/yf1uZtEGspGdi5kFmyiSH3PwQ8G6Xo93C2Rys6qsBGJ5Am1SIxFBvwx5oNF5cEE PFqSoURgjWicbls8fwTqaNvp6y91TfPrw3j4lXNcvivw3mhAQhGp5fWqVklpe9ETx2PmBrWaq9 o7841TZ6bRoFLeOa4U7Z1mWDzuiiwYHAQAA 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: DB1PEPF000509E7:EE_|VI0PR02MB10681:EE_ X-MS-Office365-Filtering-Correlation-Id: 12bff9ac-958a-443c-beef-08dd07a7896d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|1800799024|82310400026|376014|36860700013|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?tE2zbUAo67wLYtPAhZGTM5VrvxcRqWO?= =?utf-8?q?uTtsSKocqJ1kcFP0h/mb8+u73F1Df8ymOsi2mmOVqqS+yRBVP7y2umEbLXT7OWzde?= =?utf-8?q?5pm13jFch0biFSd+txqqRvLIQ4A/UGpDw3/kFkGPbrWegWBeWblTD3cgniy/Sj9KG?= =?utf-8?q?4vdO4eDIPbqDnP7uiVUV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hl8zzPhf7vhAi76OKmoHRab1Cjy?= =?utf-8?q?arIXhvpVAQDb7z5Z0bnVqRf+8KyIyNvdxj0G5aI9xCPBEaT6tsbz8P0fSknU7nDkv?= =?utf-8?q?ZRILTD4NFkAX3aYJsO9rF4OPb2/UnmzIr95mrXQ8UKTSuqNWPgKrBHcxdhhb/cTkC?= =?utf-8?q?m9CMX+KwMdnPLbNIrGUqpYOzqYypXrmNUHijRzYSF+vwuFXxZmAOBCU2tHyC3mKtj?= =?utf-8?q?iQhbruq0CddV9XDl0UdoWmNjhm4tUblcYgs//e6SmrlQDSWzT9t7G583P2afFsuB5?= =?utf-8?q?0E0EVZDsUX8yDb5N9t3K6IAJMCQhPYMcXRt/lrlcAaRPsbKpBu/MZUs=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)(82310400026)(376014)(36860700013)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2024 08:03:50.2457 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12bff9ac-958a-443c-beef-08dd07a7896d 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: DB1PEPF000509E7.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR02MB10681 X-Mailman-Approved-At: Mon, 18 Nov 2024 08:35:34 +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. 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. Fixes: 53c515befe28 ("drm/bridge: adv7511: Add Audio support") Signed-off-by: Stefan Ekenberg --- Changes in v3: - Extend commit message and explain replacement of REG_GC(1) - Link to v2: https://lore.kernel.org/r/20241115-adv7511-audio-info-frame-v2-1-ca4793ef3a91@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, 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,