From patchwork Tue Feb 28 11:01:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13154722 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D97FCC64EC7 for ; Tue, 28 Feb 2023 11:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=NxwKcAKnSnslB0m63hLF+XqxXAUBd7K3Wfq07ZLTclU=; b=BROVSwoZWLMuKq /CD6zOQz5jIQeRgEug6lRLQ34DG20bNk6SOyixN4kRqMC3fY3d+g4AJlm2U4T0B1nqDn3kBnhVcUT gZSTuLCn9rL/j0rt1rE+B/haQgqnCkRTFsRQ33Joh5QOi4RHMsVoXj52lQmRb+A5jy+hd0EgJEg+M gZ5f9LEK9MJX/MNtX4h1OgeEjadhMpcJ9nan8/4KHe65TO6UVlGGpZBnnmSAvyysvGjxzE26gZxki Bi1A1vp7QnbE0kgG2W7lmlLl6AJcx+v5EP3YF/UQvGhhvBWMDVXKHucFetRLsE10FoxeYmrkr+ltc Mseccl2sFaFMZJ6XxOqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWxkD-00Crlc-PI; Tue, 28 Feb 2023 11:02:06 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWxk7-00Crgb-4J for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2023 11:02:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1677582118; x=1709118118; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=uqW3J0nWK2v55D9GYjZBWcYdTtQfZj4KNiRlbuF0uC8=; b=N0RQgAB3KKueNxV2A39zPOoDVdZ3ZnDgkEhgN8vLAhaTx+3asLeMViSZ AVw+jKmUuapYYIimelxJRJRhmDDUFoqM4E2P6Rgc5Th5EA8EqdgClz5tn +egH7lOKVNoZiALuALlUNNCqMJ/1rLZdAH6jbcQPW/ST8dYlmZ6xZRr92 RHn7jwnP6UrCCCtcj7HPKuLzMBIzb2pH1ljhQXKm5EbpPshv1/bThyQMO nuLO3ZrB7y9KaEcVF6z+IiD4NUUQYQsmsq1bl3qbOoZML1V4aPDdR/UyA ZLo7EOvqzH+01mHS6m6BY+2CRvT3oV2pxlK5wijolRk0t2LSYrwVCSk7V Q==; X-IronPort-AV: E=Sophos;i="5.98,221,1673938800"; d="scan'208";a="213967684" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 28 Feb 2023 04:01:54 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 28 Feb 2023 04:01:54 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Tue, 28 Feb 2023 04:01:50 -0700 From: Claudiu Beznea To: , , , , , , , CC: , , , , Claudiu Beznea Subject: [PATCH v3 0/3] ASoC: mchp-pdmc: fix poc noises when starting capture Date: Tue, 28 Feb 2023 13:01:42 +0200 Message-ID: <20230228110145.3770525-1-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230228_030159_224649_29B8A12D X-CRM114-Status: GOOD ( 11.92 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To start capture on Microchip PDMC the enable bits for each supported microphone need to be set. After this bit is set the PDMC starts to receive data from microphones and it considers this data as valid data. Thus if microphones are not ready the PDMC captures anyway data from its lines. This data is interpreted by the human ear as poc noises. To avoid this the following software workaround need to be applied when starting capture: 1/ enable PDMC channel 2/ wait 150ms 3/ execute 16 dummy reads from RHR 4/ clear interrupts 5/ enable interrupts 6/ enable DMA channel For this workaround to work step 6 need to be executed at the end. For step 6 was added patch 1/3 from this series. With this, component DAI driver sets its struct snd_soc_component_driver::start_dma_last = 1 and proper action is taken based on this flag when starting DAI trigger vs DMA. Thank you, Claudiu Beznea Changes in v3: - update the commit message of patch 2/3 to be more descriptive - in patch 3/3 initialize dd->startup_delay_us before calling of_property_read_u32() and don't check its return value; property is optional and the the default value is 150ms Changes in v2: - patch 1/3 from v1 is now "ASoC: soc-pcm: add option to start DMA after DAI" - pass start_dma_last from component DAI driver object (struct snd_soc_component_driver::start_dma_last); adapt patch 3/3 after this; - in patch 1/3 s/Do we need to start dma first/Do we need to start dma last in comment from soc_pcm_trigger() - collect review tag from Krzysztof Claudiu Beznea (3): ASoC: soc-pcm: add option to start DMA after DAI ASoC: dt-bindings: sama7g5-pdmc: add microchip,startup-delay-us binding ASoC: mchp-pdmc: fix poc noise at capture startup Claudiu Beznea (3): ASoC: soc-pcm: add option to start DMA after DAI ASoC: dt-bindings: sama7g5-pdmc: add microchip,startup-delay-us binding ASoC: mchp-pdmc: fix poc noise at capture startup .../sound/microchip,sama7g5-pdmc.yaml | 6 +++ include/sound/soc-component.h | 2 + sound/soc/atmel/mchp-pdmc.c | 53 +++++++++++++++++-- sound/soc/soc-pcm.c | 27 ++++++++-- 4 files changed, 78 insertions(+), 10 deletions(-)