From patchwork Tue Nov 19 07:40:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Ekenberg X-Patchwork-Id: 13879477 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 7ED41D60074 for ; Tue, 19 Nov 2024 08:09:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7E1910E13C; Tue, 19 Nov 2024 08:09:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=axis.com header.i=@axis.com header.b="hJVkJePI"; dkim-atps=neutral Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2071.outbound.protection.outlook.com [40.107.22.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA64510E13C for ; Tue, 19 Nov 2024 07:40:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YT9vES0bJnWBdcOfK+uvvNBFYVDFF6n06Os2jd7wtwvUSV2/HCv4FTCMPHHuibnOJB2uB8TFffmEnL7vyACGvPgtLkj9SYsZfBDjQWjMHqgm0AHpe1fMEoLMNUhCE5Z7EWTgrfOX4TY7cCtMds4PqDcTCJPd5bsE1YBURwpSO+rik/hr1EC2TYGZHwBsPxxm5G2OsYGkoHSHW2knnL9RxZulVNe9NSbzJVK9lqkmK4Yj1tFd2yFJavPDMKcAL9tnAd0+/JcJFvcPor0y5yvYA86iaLwpMzjETSbCjdx5Jg9CAcSOEQJ+Vdk+JV2HTBcCKJAxoeJZ8WiNtCAa/zD7Xw== 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=oJmB8fg/OjYnIRr/FDUQr2RcQ0nrrTgSYbPBkPsf328=; b=Pl+d+O7fXNudYWsd5Q3dg3lubJkthXL+bn+oBnSrKVKEzzqw696QCJbXt0fZWishuW1S+pm/yip8N/o/5JvF7yoUakdeSN84iM4weszIkgRMslFtJGpsQQlYYzMAeeCsoOZ46lidah1wfbffhCtxQTVE8H7ybcVDQl92p4aVDWVMWukE6rCuMMfj2dHI5QLs3pVdZ2LXqKmkn5YA3pvD+TE0nYAts8yKtkeKVo2Im/NaNnTT+MwdPkIxUx3t3gZorS9mLRruZFpJ6lYATNfiLIBQUqR0Ld1Ns1rCz/HFr7n044fTzFSXIJ3KVbhZ51raL0wBWi0sC7DeaGaA279UtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=bp.renesas.com 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=oJmB8fg/OjYnIRr/FDUQr2RcQ0nrrTgSYbPBkPsf328=; b=hJVkJePITEJNIyXEjh/XLOJSn/uYmShbMalsORYHc/sugQoXp5RS6aIFegm+8uOtmUzG8zYir1CXh9ByfdD1mYv9CimlVbzqrFzES9LJehHfBx34b6CBjM4g0BCW4jbnPUY618YVJgUvEJlZFKCzzWMreOUmOBHdRGfmA4YjMlE= Received: from AS9PR06CA0207.eurprd06.prod.outlook.com (2603:10a6:20b:45d::34) by PAWPR02MB9054.eurprd02.prod.outlook.com (2603:10a6:102:337::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.14; Tue, 19 Nov 2024 07:40:31 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:45d:cafe::c2) by AS9PR06CA0207.outlook.office365.com (2603:10a6:20b:45d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23 via Frontend Transport; Tue, 19 Nov 2024 07:40:31 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Tue, 19 Nov 2024 07:40:30 +0000 Received: from se-mail02w.axis.com (10.20.40.8) 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; Tue, 19 Nov 2024 08:40:30 +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; Tue, 19 Nov 2024 08:40:30 +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 063B5881; Tue, 19 Nov 2024 08:40:30 +0100 (CET) Received: by pc39391-2017.se.axis.com (Postfix, from userid 10612) id 003AE4462505; Tue, 19 Nov 2024 08:40:29 +0100 (CET) From: Stefan Ekenberg Date: Tue, 19 Nov 2024 08:40:29 +0100 Subject: [PATCH v4] drm/bridge: adv7511_audio: Update Audio InfoFrame properly MIME-Version: 1.0 Message-ID: <20241119-adv7511-audio-info-frame-v4-1-4ae68e76c89c@axis.com> X-B4-Tracking: v=1; b=H4sIAOxAPGcC/33PSw6CMBCA4auQrq1h+gDqynsYF4W2MgupabXBE O5uIS6IiSz/SeabzESiDWgjORUTCTZhRD/kEIeCdL0ebpaiyU1YyQRA2VBtUi0BqH4Z9BQH56k L+m6pFBUIY0TrZE3y+iNYh+NKX665e4xPH97rpQTL9IsC/48moECFannVtEpJLc96xHjs/J0sZ mJbR+44LDudFrXi1nGt4MfhW2fnycSzw8EaoxSHRlYbZ57nD8CIjXtPAQAA 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: , , , Biju Das , Stefan Ekenberg X-Mailer: b4 0.14.2 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|PAWPR02MB9054:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f5950d8-dc67-41ab-e8b0-08dd086d71ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|7416014|1800799024|82310400026|36860700013|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?kMHvJoa0lYntGWZo873CfU3u3k7soDl?= =?utf-8?q?oI8zYFqASZrvuGBArINqWe9PF04IumOXe0k9pEbdZVb3ZcO6QA69e6qSDib6A1q9I?= =?utf-8?q?Ok4HiQ2tpBLTw3FA4bZ31roCiM3XOX8yw2oFYbd5m+qdBAqpzv+XRtmgGYqh377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?utf-8?q?Pmkbd3tt9JGdn/Kf+0oHEGudUvqglMj+L77CDVP9VSOSgGZb6ZVzJFgl72lGJLQPW?= =?utf-8?q?C4uHkUDvoN4mrYqEIhRqUzxYldf2vYfbSlNwNa/Bj1klQSYdQme1clNzuEbQqFtzn?= =?utf-8?q?W7yQpx6+hwsrmjZtrFFwNfzhAvK/mJdaHRfueI756XppBElqdZbZvbnxhiRmvZ5/H?= =?utf-8?q?nfxp9W/8y/UOLQYQObhB2pG6GRJY1un8smGx0jZRSH67sSBcLydCUrohLiVI6GrMI?= =?utf-8?q?vApNqUv08Ad8A1nsDMzD26f/2HxQhUcl5vZl+JYHuSj1M9OrM3612PD5pJE4jrziv?= =?utf-8?q?I/AMyhND/bn5T1jdePmNZtNvZwBEuHrd1+7wafJ5FuUKrcFFJDRQYDU=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)(376014)(7416014)(1800799024)(82310400026)(36860700013)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2024 07:40:30.7689 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5950d8-dc67-41ab-e8b0-08dd086d71ad 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: AMS0EPF00000190.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR02MB9054 X-Mailman-Approved-At: Tue, 19 Nov 2024 08:09:25 +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. Tested-by: Biju Das Fixes: 53c515befe28 ("drm/bridge: adv7511: Add Audio support") Signed-off-by: Stefan Ekenberg --- Changes in v4: - Add Tested-by tag - Link to v3: https://lore.kernel.org/r/20241118-adv7511-audio-info-frame-v3-1-31edd9931856@axis.com 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,