From patchwork Fri Feb 17 12:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13144652 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 E5CD4C64EC4 for ; Fri, 17 Feb 2023 12:43:20 +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=x3iwZ0NAxRJwqBMOVI9MZhm4hMQz9l/HZaLIpPxT/jE=; b=fayoVJTLZK5y+J 146rD7qTs5dnb6t3HvICYnNqGfo+dGy3+rrfxdYdTYO9/4pfSYkdr04uxGD8d1WZn8jySjrgrOX68 A8NCx09HofyFWjr+ZLg4KcxVKeq4Eg24Kf3V5yv5QBLYUWEOmJ+dnlrTJic2gC5VJFC5v5aIV0xbc dUDK8gjf1rNDQT+XOXo6Z4b2RsphDlXqZhSjYUhwlE1aeuuiyIyXiA7NWeiQcL2b1R/wX/rgM9Axb ZUzMG++ul5CEPRo0hqDz9u/LEgT8POXm5xBJokrTXCdGfDv/Dexb4Ts/O7bHc3tsz8jbrnJ7czRCK GmoBBls40pN6DCQuDOWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pT04H-00E9XI-FJ; Fri, 17 Feb 2023 12:42:25 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pT045-00E9T0-BS for linux-arm-kernel@lists.infradead.org; Fri, 17 Feb 2023 12:42:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1676637733; x=1708173733; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=U2iLnm4KuI3Sgwn+ds9QR6hu9ocdgvXPg7MffzvqL48=; b=tiQq/foyr/93K1sfxqL6gIO4YO3e9i9J2jL58MwVXp13YCkOylCEhTzL sZB1XD8cfG3H59+6HS6kusrIEhgDy8Zi/2XHoYsZ8BOLxqNI/45Ax15sI GVy3pD8cv2eHU8Rxo0+L1p2CXbqm1oo4WWcol1F8Hlvqi+CADXamesKjn /2EaDPd3G75u2nqRTIHGRU+eBPDn21+rcpSsQ1tJ/nFuMZ/+QEg8oVI6s KeDC6G3jfcAQhDYPyNvBCqLerWYXkw1Ej9+54d59avbYxvwRLkHxMlfMH CS73MK1W92fHboj6BMmsyOxyUvxkq0ncTvi4P+s0OhbivdyfP/8xT8USG A==; X-IronPort-AV: E=Sophos;i="5.97,304,1669100400"; d="scan'208";a="137771389" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 17 Feb 2023 05:42:03 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 17 Feb 2023 05:42:03 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Fri, 17 Feb 2023 05:42:00 -0700 From: Claudiu Beznea To: , , , , , , , CC: , , , , Claudiu Beznea Subject: [PATCH v2 0/3] ASoC: mchp-pdmc: fix poc noises when starting capture Date: Fri, 17 Feb 2023 14:41:48 +0200 Message-ID: <20230217124151.236216-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-20230217_044213_476013_73FA29A1 X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. 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 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 .../sound/microchip,sama7g5-pdmc.yaml | 6 ++ include/sound/soc-component.h | 2 + sound/soc/atmel/mchp-pdmc.c | 55 +++++++++++++++++-- sound/soc/soc-pcm.c | 27 +++++++-- 4 files changed, 80 insertions(+), 10 deletions(-)