Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2360094lqo; Mon, 20 May 2024 03:28:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYAadTnQcNUZ2E0R2BthycWzriZ1kZ1CtpVpE9eX4peUvXvqQpBwHWWo+Hpz5MBqPUntr4BFDfzTuvuLp/1+RFi5ft7jwsR2NyNOrSLA== X-Google-Smtp-Source: AGHT+IH+Gyq/X2dbNnCk9F617EOXrCcbFK9+Pf6ec+OBPeDcTNlmgGe5UvyKG4y75NVYdq5rMEUy X-Received: by 2002:a17:907:c91b:b0:a5c:e82c:42da with SMTP id a640c23a62f3a-a5d5903b785mr486528166b.6.1716200923884; Mon, 20 May 2024 03:28:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716200923; cv=pass; d=google.com; s=arc-20160816; b=Ippww1LwVsi0TbTBTaIU39sIJqHcyEc1iFVK634N0+BKWEwisB/2C3TL8StmxOE826 37kHhjL4npQM2OkbnGMLcdO7txUoY9yqleqwwkZrxvLSp2a6pVUdDYKVjqtlSZy+LcVy WCYHmdxQclJRXFFbpyIEfg74HHX7ZJvjy40ADRPMwpmt7uGaB3YZyagOfvHci4bfF4q/ nmHC7FVL9HlWQzT5ydCzLQARPp1xx3qimjvsJzu6k5cOiqatpPI61UzUbkitd+bnFESm r+87hQd/7lZIz33voJfRnwqqv278M4JAhmyqOHWMA6n4gvDDOe71VGm7SnaIuyZbKLo6 Degg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Uex4XCNgTSmerEHfH09Eq+Hqgh1bTavfU/Ri/xbeGoA=; fh=gWq8CuHcLEzKO77CCELb5pK9uVOUx/WFDoHwAWSGk8k=; b=xOQfOqzml6ayWyE05YopmbjJxTyLx/mCJ9A3Qg4XMO/MGORcQVD8pVrKiizzuQnjrw Q2nkbUlKGkd1v11dp0zf+lvLSRn96WjdokEeUIuiIx7zrXQhbQPB5Wh1Fn/vhEGTmj5w B7+xk9WAUuzHOuXe2yu/QK+CVaXiAf8eTOQjCGnaUB6I+KVPRtck6W/64qGqxBijxh1r JhQQf7AtDg0aojCfk5DFkpvykP/gdDfYYDLSeP9+ezbaTymk3FL98NzA6WAJTHfbEHMZ pLZT9IAkC/VtNRAsk72vMZRMTSjpI9C1G0XclTWRsPm3sHUYgCnRM2baTmroaR+lEw8H Us3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oH2UqPcV; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-183605-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183605-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17c2c285si1275490666b.947.2024.05.20.03.28.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 03:28:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183605-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oH2UqPcV; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-183605-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183605-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9C5B91F22EC3 for ; Mon, 20 May 2024 10:28:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F5B551005; Mon, 20 May 2024 10:28:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oH2UqPcV" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34C6450286; Mon, 20 May 2024 10:28:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716200910; cv=none; b=KpfDTf6sb7Cn/sqXWgPDJMRcdLOo9EMlNYNCGuUz/5uq1K0zGMAgH0WW17Z53oBx0/FtKHLLEiu5VBty8mrLy9YF/07L/gV2ceUGGDUCwZcBosCxSU3Cyx6oWIU+CHbQmCKhJdW1MdeVoX9EL7WrU4Wj0ISkZOdjxU1iyMllkvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716200910; c=relaxed/simple; bh=bRKzyqcLlrX4+PGCOXat0+khakBlpiwK24ehTi1z8yM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Spy0kwcIKHDNIyzic4yu2MuNuBFltOTpDvWix//MGjJeZvo3mHHH7D/R1b0Pd8D+px7U6jX8toLEzZf1D1ZYzJgBILfvmthEDnXZmT5CaTndDx+mXSbcZ4SoV6cUGb+Iff1VuqPxMDGE2rZuXuXdDDw+HMoN0znkTwQ6H+4J95s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oH2UqPcV; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1716200907; bh=bRKzyqcLlrX4+PGCOXat0+khakBlpiwK24ehTi1z8yM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=oH2UqPcVf6XjzjCSoqpkEqHstieql7cPzcsJsWmHIXOChB7KUapE0PdJGKSIRy41J CXWTBi+k2jE8u/cFQL2b1EM+QEJu/jIQU5dsC83XXrIuCf5NL4M1xrLnzgvK/9VpGp 0lFlw7NDXoq4SjbEIn96ZNluNpPQiYuz3cPKdEmlRIQudJQHUNE39e9LPi6GjaMJ00 v9BjDdn3thsHM3OCvIrScN/zKKGJNbU/t227ZVc4FUrDP1Lia4DyfgRxTyodCfIHVH 1Xei0WncqWb5WcAePLRDmSSLDNSV4FAo3FQFR6Q78RqO24etRNvRJCzXx/tIRPj94M 8r5mmvtLAMauw== Received: from [100.113.186.2] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 2E64137821B2; Mon, 20 May 2024 10:28:26 +0000 (UTC) Message-ID: <08b60894-0023-4ad7-9c6b-b1e99b1b4cd8@collabora.com> Date: Mon, 20 May 2024 12:28:25 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 09/16] ASoC: mediatek: mt8365: Add PCM DAI support To: Alexandre Mergnat , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , Lee Jones , Flora Fu , Jaroslav Kysela , Takashi Iwai , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Catalin Marinas , Will Deacon , Rob Herring , Krzysztof Kozlowski Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org References: <20240226-audio-i350-v4-0-082b22186d4c@baylibre.com> <20240226-audio-i350-v4-9-082b22186d4c@baylibre.com> From: AngeloGioacchino Del Regno Content-Language: en-US In-Reply-To: <20240226-audio-i350-v4-9-082b22186d4c@baylibre.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Il 26/04/24 19:22, Alexandre Mergnat ha scritto: > Add Pulse Code Modulation Device Audio Interface support for MT8365 SoC. > > Signed-off-by: Alexandre Mergnat > --- > sound/soc/mediatek/mt8365/mt8365-dai-pcm.c | 293 +++++++++++++++++++++++++++++ > 1 file changed, 293 insertions(+) > > diff --git a/sound/soc/mediatek/mt8365/mt8365-dai-pcm.c b/sound/soc/mediatek/mt8365/mt8365-dai-pcm.c > new file mode 100644 > index 000000000000..a5de47c69620 > --- /dev/null > +++ b/sound/soc/mediatek/mt8365/mt8365-dai-pcm.c > @@ -0,0 +1,293 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Mediatek 8365 ALSA SoC Audio DAI PCM Control > + * > + * Copyright (c) 2024 MediaTek Inc. > + * Authors: Jia Zeng > + * Alexandre Mergnat > + */ > + > +#include > +#include > +#include > +#include "mt8365-afe-clk.h" > +#include "mt8365-afe-common.h" > + > +struct mt8365_pcm_intf_data { > + bool slave_mode; > + bool lrck_inv; > + bool bck_inv; > + unsigned int format; > +}; > + > +/* DAI Drivers */ > + > +static void mt8365_dai_enable_pcm1(struct mtk_base_afe *afe) > +{ > + regmap_update_bits(afe->regmap, PCM_INTF_CON1, > + PCM_INTF_CON1_EN, PCM_INTF_CON1_EN); > +} > + > +static void mt8365_dai_disable_pcm1(struct mtk_base_afe *afe) > +{ > + regmap_update_bits(afe->regmap, PCM_INTF_CON1, > + PCM_INTF_CON1_EN, 0x0); > +} > + > +static int mt8365_dai_configure_pcm1(struct snd_pcm_substream *substream, > + struct snd_soc_dai *dai) > +{ > + struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); > + struct mt8365_afe_private *afe_priv = afe->platform_priv; > + struct mt8365_pcm_intf_data *pcm_priv = afe_priv->dai_priv[MT8365_AFE_IO_PCM1]; > + bool slave_mode = pcm_priv->slave_mode; > + bool lrck_inv = pcm_priv->lrck_inv; > + bool bck_inv = pcm_priv->bck_inv; > + unsigned int fmt = pcm_priv->format; > + unsigned int bit_width = dai->sample_bits; > + unsigned int val = 0; > + > + if (!slave_mode) { > + val |= PCM_INTF_CON1_MASTER_MODE | > + PCM_INTF_CON1_BYPASS_ASRC; > + > + if (lrck_inv) > + val |= PCM_INTF_CON1_SYNC_OUT_INV; > + if (bck_inv) > + val |= PCM_INTF_CON1_BCLK_OUT_INV; > + } else { > + val |= PCM_INTF_CON1_SLAVE_MODE; > + > + if (lrck_inv) > + val |= PCM_INTF_CON1_SYNC_IN_INV; > + if (bck_inv) > + val |= PCM_INTF_CON1_BCLK_IN_INV; > + > + // TODO: add asrc setting /* TODO ... */ after which: Reviewed-by: AngeloGioacchino Del Regno