From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17D6DC43460 for ; Fri, 7 May 2021 14:05:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D71ED61448 for ; Fri, 7 May 2021 14:05:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237406AbhEGOGM (ORCPT ); Fri, 7 May 2021 10:06:12 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:43981 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237368AbhEGOGL (ORCPT ); Fri, 7 May 2021 10:06:11 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id AA4BEE2F; Fri, 7 May 2021 10:05:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 07 May 2021 10:05:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=bkzl9rYriWyfy rE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=XnZuZ5LzqRoVpYziEgNA8Gzrs7NNt ieEDw9ONYrRC05Q/0R4EBHJ70U1ru+R6J6HGf7vLagpDe7NeojoN+IyrpLUBwwzd /rBmDxBImj9+O2/ZXDA8FpUhmGh6W/ruUtmfJwkXu9E2Vhi4wCthFirKkHeSTNFY tUcEtiPdvIMd6t5IRZK9/RvGJUHRxDg3dfkMvC0gYARQGQXvduFm/KMlFcAiXeh3 +xzphjDvLlJ3ZzICHb73aIQNmcocmLC/29+d0SghUNJkFkhdehrTzfGXrSGGIXIx 8UHDU7AW+V9Gc4X1axj8l1RIr6m8Du2ikY0xf7ydmOQgCx4KhSKAvq1fQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=bkzl9rYriWyfyrE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=EDLyEELZ VMa3Ao8yEpaV2B99bxRi/OLRiw0ugXi4LwnsvcZWO/lAF4HwhI+Ip0EcAryz6/SM oTHXHqsNZRvTBDknMK7y3fwVNQDFw07t7si2JWlslfwZaBHrgbRnlrw7hfsI+/ll oK2O1y+nwcAxc2EzIFQAb2rh9JB1Br3G8lcv724x7GXquN8agpH2x7MCnETS8k09 epfeGuC0mKw6+SnC5Ou1ssEk5ETRLTAplvnBti/nNC7v5g7ZojlkBSheHqd/7icU Vi5KQuhQO6qI/Io+kUVwh9YTqAffQoKrcI6LfJ/uHhbXGrgfilBrQCABrsAsFpsp Zu2Ak36s8AjblQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegvddgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepudenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 May 2021 10:05:08 -0400 (EDT) From: Maxime Ripard To: Mark Brown , Takashi Iwai , Liam Girdwood , Jaroslav Kysela , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Cc: Nicolas Saenz Julienne , Rob Herring , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, Maxime Ripard , linux-kernel@vger.kernel.org, Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , Daniel Vetter , linux-rpi-kernel@lists.infradead.org, Eric Anholt , Dom Cobley Subject: [PATCH 05/11] drm/vc4: hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET Date: Fri, 7 May 2021 16:03:28 +0200 Message-Id: <20210507140334.204865-6-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210507140334.204865-1-maxime@cerno.tech> References: <20210507140334.204865-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dom Cobley Symptom is random switching of speakers when using multichannel. Repeatedly running speakertest -c8 occasionally starts with channels jumbled. This is fixed with HD_CTL_WHOLSMP. The other bit looks beneficial and apears harmless in testing so I'd suggest adding it too. Documentation says: HD_CTL_WHILSMP_SET Wait for whole sample. When this bit is set MAI transmit will start only when there is at least one whole sample available in the fifo. Documentation says: HD_CTL_CHALIGN_SET Channel Align When Overflow. This bit is used to realign the audio channels in case of an overflow. If this bit is set, after the detection of an overflow, equal amount of dummy words to the missing words will be written to fifo, filling up the broken sample and maintaining alignment. Signed-off-by: Dom Cobley Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 1fda574579af..459d76414a29 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1211,7 +1211,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, HDMI_WRITE(HDMI_MAI_CTL, VC4_SET_FIELD(vc4_hdmi->audio.channels, VC4_HD_MAI_CTL_CHNUM) | - VC4_HD_MAI_CTL_ENABLE); + VC4_HD_MAI_CTL_WHOLSMP | + VC4_HD_MAI_CTL_CHALIGN | + VC4_HD_MAI_CTL_ENABLE); break; case SNDRV_PCM_TRIGGER_STOP: HDMI_WRITE(HDMI_MAI_CTL, -- 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15B6DC433B4 for ; Fri, 7 May 2021 14:08:11 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A58E461421 for ; Fri, 7 May 2021 14:08:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A58E461421 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 00F8B15E5; Fri, 7 May 2021 16:07:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 00F8B15E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1620396488; bh=we2zV1ywrjeSYFR4J4wL1lxbkFjamRM0naAzpXJS5Rc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BLXs8cXPuA1de4fe37QAtRDJclUoftt3Y7X0uIN7O9uc1f7oMVyLoQUwZmZenexS6 BTHI3/eiG7890kXrpjIar1W7xW88xKsLOCN+oqt8FDh0mlgWcI6RW9uoe51XW5kTK1 ZGn2PKGTeVzCGOyWOrs0RdQZyg2kyDwAm4N1Nskc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4FC69F804C1; Fri, 7 May 2021 16:05:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 79187F804D9; Fri, 7 May 2021 16:05:15 +0200 (CEST) Received: from wnew4-smtp.messagingengine.com (wnew4-smtp.messagingengine.com [64.147.123.18]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C97FBF804D1 for ; Fri, 7 May 2021 16:05:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C97FBF804D1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cerno.tech header.i=@cerno.tech header.b="XnZuZ5Lz"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="EDLyEELZ" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id AA4BEE2F; Fri, 7 May 2021 10:05:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 07 May 2021 10:05:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=bkzl9rYriWyfy rE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=XnZuZ5LzqRoVpYziEgNA8Gzrs7NNt ieEDw9ONYrRC05Q/0R4EBHJ70U1ru+R6J6HGf7vLagpDe7NeojoN+IyrpLUBwwzd /rBmDxBImj9+O2/ZXDA8FpUhmGh6W/ruUtmfJwkXu9E2Vhi4wCthFirKkHeSTNFY tUcEtiPdvIMd6t5IRZK9/RvGJUHRxDg3dfkMvC0gYARQGQXvduFm/KMlFcAiXeh3 +xzphjDvLlJ3ZzICHb73aIQNmcocmLC/29+d0SghUNJkFkhdehrTzfGXrSGGIXIx 8UHDU7AW+V9Gc4X1axj8l1RIr6m8Du2ikY0xf7ydmOQgCx4KhSKAvq1fQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=bkzl9rYriWyfyrE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=EDLyEELZ VMa3Ao8yEpaV2B99bxRi/OLRiw0ugXi4LwnsvcZWO/lAF4HwhI+Ip0EcAryz6/SM oTHXHqsNZRvTBDknMK7y3fwVNQDFw07t7si2JWlslfwZaBHrgbRnlrw7hfsI+/ll oK2O1y+nwcAxc2EzIFQAb2rh9JB1Br3G8lcv724x7GXquN8agpH2x7MCnETS8k09 epfeGuC0mKw6+SnC5Ou1ssEk5ETRLTAplvnBti/nNC7v5g7ZojlkBSheHqd/7icU Vi5KQuhQO6qI/Io+kUVwh9YTqAffQoKrcI6LfJ/uHhbXGrgfilBrQCABrsAsFpsp Zu2Ak36s8AjblQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegvddgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepudenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 May 2021 10:05:08 -0400 (EDT) From: Maxime Ripard To: Mark Brown , Takashi Iwai , Liam Girdwood , Jaroslav Kysela , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Subject: [PATCH 05/11] drm/vc4: hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET Date: Fri, 7 May 2021 16:03:28 +0200 Message-Id: <20210507140334.204865-6-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210507140334.204865-1-maxime@cerno.tech> References: <20210507140334.204865-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Dom Cobley , Tim Gover , Dave Stevenson , linux-kernel@vger.kernel.org, Maxime Ripard , Eric Anholt , Rob Herring , bcm-kernel-feedback-list@broadcom.com, Nicolas Saenz Julienne , Daniel Vetter , Dom Cobley , Phil Elwell , linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Dom Cobley Symptom is random switching of speakers when using multichannel. Repeatedly running speakertest -c8 occasionally starts with channels jumbled. This is fixed with HD_CTL_WHOLSMP. The other bit looks beneficial and apears harmless in testing so I'd suggest adding it too. Documentation says: HD_CTL_WHILSMP_SET Wait for whole sample. When this bit is set MAI transmit will start only when there is at least one whole sample available in the fifo. Documentation says: HD_CTL_CHALIGN_SET Channel Align When Overflow. This bit is used to realign the audio channels in case of an overflow. If this bit is set, after the detection of an overflow, equal amount of dummy words to the missing words will be written to fifo, filling up the broken sample and maintaining alignment. Signed-off-by: Dom Cobley Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 1fda574579af..459d76414a29 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1211,7 +1211,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, HDMI_WRITE(HDMI_MAI_CTL, VC4_SET_FIELD(vc4_hdmi->audio.channels, VC4_HD_MAI_CTL_CHNUM) | - VC4_HD_MAI_CTL_ENABLE); + VC4_HD_MAI_CTL_WHOLSMP | + VC4_HD_MAI_CTL_CHALIGN | + VC4_HD_MAI_CTL_ENABLE); break; case SNDRV_PCM_TRIGGER_STOP: HDMI_WRITE(HDMI_MAI_CTL, -- 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D36AC43460 for ; Fri, 7 May 2021 14:11:13 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E457461436 for ; Fri, 7 May 2021 14:11:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E457461436 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/cZM6O435fwcvKKGtFbUms+nNKdrFySNHGi+eJgy7bM=; b=AV8ojfsvFmjdA0vCxvheGEK7j 9NIJvqk5p5GdTedoccLfeGtMRcgmWkkNuKrTJ/owd/8n1C/BguKEczxcK5JuXBcxOJBkm8CgrLbsK TxUnCzTHb4cLJ8FSnfrWNresTkYATYvnSN3cuy3DKPqIwvgkVMd0l3/Y7z8+TzcMuRt3cg1EniCYe +fBmFCMyLsC//Pgdj9g0RZlfcSDb0+M+mCzoXjdjbWmf9HeFBRpWU4YzppZL4jV0+OQ0t1wv3NhlE B1+ztEauuMdfpyWVNBIst2fbwhPFBSWYAKY2e/KIqHoGB2SI5sYeUyzXmkZANAiVOSq8MfsFxzzW5 JLgASsdgg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf1AB-007GIc-6V; Fri, 07 May 2021 14:09:08 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf16Q-007FXk-I9; Fri, 07 May 2021 14:05:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=bkzl9rYriWyfyrE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=2sObbBzjM9HTFG3mBkwUSRaWb/ IFdA8JLfnPAgZpe4MQIl62Or6LrFZko7qGz3Wk5gwnZJ5EmsLvev+lG7iP+2Tqf6oi8YFfiay/urK RF70DIKkQTjItrvgJUqFNEY9ta2nGD8amltbe+nJ+ezitEY1rcMwpGzPgSE1Eftaer29QI7p8e6Bu DAg23odf4f+d0vd4VnMr/Pwp8lEjcmyskh9JKZY9PVm/AmyfObrlSIoPgHs82QPwhH+UTKaLotrLK BRqe73uu76iYEQEviy187a6h82aP+BQRRr7C6V4f7p6uMVf8SJ7G5htwWqm1mx/rgrmb/IWG+Zxpu OGaTdCRg==; Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf16N-006uaj-Ph; Fri, 07 May 2021 14:05:13 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id AA4BEE2F; Fri, 7 May 2021 10:05:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 07 May 2021 10:05:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=bkzl9rYriWyfy rE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=XnZuZ5LzqRoVpYziEgNA8Gzrs7NNt ieEDw9ONYrRC05Q/0R4EBHJ70U1ru+R6J6HGf7vLagpDe7NeojoN+IyrpLUBwwzd /rBmDxBImj9+O2/ZXDA8FpUhmGh6W/ruUtmfJwkXu9E2Vhi4wCthFirKkHeSTNFY tUcEtiPdvIMd6t5IRZK9/RvGJUHRxDg3dfkMvC0gYARQGQXvduFm/KMlFcAiXeh3 +xzphjDvLlJ3ZzICHb73aIQNmcocmLC/29+d0SghUNJkFkhdehrTzfGXrSGGIXIx 8UHDU7AW+V9Gc4X1axj8l1RIr6m8Du2ikY0xf7ydmOQgCx4KhSKAvq1fQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=bkzl9rYriWyfyrE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=EDLyEELZ VMa3Ao8yEpaV2B99bxRi/OLRiw0ugXi4LwnsvcZWO/lAF4HwhI+Ip0EcAryz6/SM oTHXHqsNZRvTBDknMK7y3fwVNQDFw07t7si2JWlslfwZaBHrgbRnlrw7hfsI+/ll oK2O1y+nwcAxc2EzIFQAb2rh9JB1Br3G8lcv724x7GXquN8agpH2x7MCnETS8k09 epfeGuC0mKw6+SnC5Ou1ssEk5ETRLTAplvnBti/nNC7v5g7ZojlkBSheHqd/7icU Vi5KQuhQO6qI/Io+kUVwh9YTqAffQoKrcI6LfJ/uHhbXGrgfilBrQCABrsAsFpsp Zu2Ak36s8AjblQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegvddgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepudenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 May 2021 10:05:08 -0400 (EDT) From: Maxime Ripard To: Mark Brown , Takashi Iwai , Liam Girdwood , Jaroslav Kysela , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Cc: Nicolas Saenz Julienne , Rob Herring , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, Maxime Ripard , linux-kernel@vger.kernel.org, Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , Daniel Vetter , linux-rpi-kernel@lists.infradead.org, Eric Anholt , Dom Cobley Subject: [PATCH 05/11] drm/vc4: hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET Date: Fri, 7 May 2021 16:03:28 +0200 Message-Id: <20210507140334.204865-6-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210507140334.204865-1-maxime@cerno.tech> References: <20210507140334.204865-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_070511_876600_ED95A40A X-CRM114-Status: GOOD ( 11.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Dom Cobley Symptom is random switching of speakers when using multichannel. Repeatedly running speakertest -c8 occasionally starts with channels jumbled. This is fixed with HD_CTL_WHOLSMP. The other bit looks beneficial and apears harmless in testing so I'd suggest adding it too. Documentation says: HD_CTL_WHILSMP_SET Wait for whole sample. When this bit is set MAI transmit will start only when there is at least one whole sample available in the fifo. Documentation says: HD_CTL_CHALIGN_SET Channel Align When Overflow. This bit is used to realign the audio channels in case of an overflow. If this bit is set, after the detection of an overflow, equal amount of dummy words to the missing words will be written to fifo, filling up the broken sample and maintaining alignment. Signed-off-by: Dom Cobley Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 1fda574579af..459d76414a29 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1211,7 +1211,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, HDMI_WRITE(HDMI_MAI_CTL, VC4_SET_FIELD(vc4_hdmi->audio.channels, VC4_HD_MAI_CTL_CHNUM) | - VC4_HD_MAI_CTL_ENABLE); + VC4_HD_MAI_CTL_WHOLSMP | + VC4_HD_MAI_CTL_CHALIGN | + VC4_HD_MAI_CTL_ENABLE); break; case SNDRV_PCM_TRIGGER_STOP: HDMI_WRITE(HDMI_MAI_CTL, -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A61CAC433ED for ; Fri, 7 May 2021 14:05:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5C53261448 for ; Fri, 7 May 2021 14:05:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C53261448 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD36E6E7E5; Fri, 7 May 2021 14:05:12 +0000 (UTC) Received: from wnew4-smtp.messagingengine.com (wnew4-smtp.messagingengine.com [64.147.123.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id A01CC6E7EC for ; Fri, 7 May 2021 14:05:11 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id AA4BEE2F; Fri, 7 May 2021 10:05:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 07 May 2021 10:05:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=bkzl9rYriWyfy rE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=XnZuZ5LzqRoVpYziEgNA8Gzrs7NNt ieEDw9ONYrRC05Q/0R4EBHJ70U1ru+R6J6HGf7vLagpDe7NeojoN+IyrpLUBwwzd /rBmDxBImj9+O2/ZXDA8FpUhmGh6W/ruUtmfJwkXu9E2Vhi4wCthFirKkHeSTNFY tUcEtiPdvIMd6t5IRZK9/RvGJUHRxDg3dfkMvC0gYARQGQXvduFm/KMlFcAiXeh3 +xzphjDvLlJ3ZzICHb73aIQNmcocmLC/29+d0SghUNJkFkhdehrTzfGXrSGGIXIx 8UHDU7AW+V9Gc4X1axj8l1RIr6m8Du2ikY0xf7ydmOQgCx4KhSKAvq1fQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=bkzl9rYriWyfyrE5FMMB6UqEVnuBc8EK63iwpqjJF1Y=; b=EDLyEELZ VMa3Ao8yEpaV2B99bxRi/OLRiw0ugXi4LwnsvcZWO/lAF4HwhI+Ip0EcAryz6/SM oTHXHqsNZRvTBDknMK7y3fwVNQDFw07t7si2JWlslfwZaBHrgbRnlrw7hfsI+/ll oK2O1y+nwcAxc2EzIFQAb2rh9JB1Br3G8lcv724x7GXquN8agpH2x7MCnETS8k09 epfeGuC0mKw6+SnC5Ou1ssEk5ETRLTAplvnBti/nNC7v5g7ZojlkBSheHqd/7icU Vi5KQuhQO6qI/Io+kUVwh9YTqAffQoKrcI6LfJ/uHhbXGrgfilBrQCABrsAsFpsp Zu2Ak36s8AjblQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegvddgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepudenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 May 2021 10:05:08 -0400 (EDT) From: Maxime Ripard To: Mark Brown , Takashi Iwai , Liam Girdwood , Jaroslav Kysela , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Subject: [PATCH 05/11] drm/vc4: hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET Date: Fri, 7 May 2021 16:03:28 +0200 Message-Id: <20210507140334.204865-6-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210507140334.204865-1-maxime@cerno.tech> References: <20210507140334.204865-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Dom Cobley , Tim Gover , Dave Stevenson , linux-kernel@vger.kernel.org, Rob Herring , bcm-kernel-feedback-list@broadcom.com, Nicolas Saenz Julienne , Dom Cobley , Phil Elwell , linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Dom Cobley Symptom is random switching of speakers when using multichannel. Repeatedly running speakertest -c8 occasionally starts with channels jumbled. This is fixed with HD_CTL_WHOLSMP. The other bit looks beneficial and apears harmless in testing so I'd suggest adding it too. Documentation says: HD_CTL_WHILSMP_SET Wait for whole sample. When this bit is set MAI transmit will start only when there is at least one whole sample available in the fifo. Documentation says: HD_CTL_CHALIGN_SET Channel Align When Overflow. This bit is used to realign the audio channels in case of an overflow. If this bit is set, after the detection of an overflow, equal amount of dummy words to the missing words will be written to fifo, filling up the broken sample and maintaining alignment. Signed-off-by: Dom Cobley Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 1fda574579af..459d76414a29 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1211,7 +1211,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, HDMI_WRITE(HDMI_MAI_CTL, VC4_SET_FIELD(vc4_hdmi->audio.channels, VC4_HD_MAI_CTL_CHNUM) | - VC4_HD_MAI_CTL_ENABLE); + VC4_HD_MAI_CTL_WHOLSMP | + VC4_HD_MAI_CTL_CHALIGN | + VC4_HD_MAI_CTL_ENABLE); break; case SNDRV_PCM_TRIGGER_STOP: HDMI_WRITE(HDMI_MAI_CTL, -- 2.31.1