From nobody Thu Sep 24 15:10:58 2026 Received: from mail-wm2-f12.google.com (mail-wm2-f12.google.com [74.125.225.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C39F354146F for ; Tue, 22 Sep 2026 16:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092898; cv=none; b=TfoR+0X6d8ZY38y+lyB8o8UUZX6BYUnm7XS5Bi9J3hVxugyFek50DFI/edCKNckjQrcfxofthGnDtbwr6oFpXjr+LTAVArM8RiuGO4HT7Vb4e9emO0AEMyilgisQCS/YdhLSxKqgURb+CPeTag3HQCgog+ZwFMzV+8njUjKRnHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092898; c=relaxed/simple; bh=BtLAkNapV4DmIrWa28ic6M0lRmuI8gxGAx+Yq38WqnA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E9R1/7hDkDcHquD2BF4Ox8sbQsX/pcLAYOgxgjr9iW8E9a3N+VmKYMHl/MP0BwKUjW/s9Il9iCDye33Xcs0sV2ka6HY/U/WKSekh3gmI7LWFsjrLJCBtu1FJxrrIfNVZ7YFlK+DsyWBvWpNgZ8lNrOkyf5qlhzSFXmbUDpC16KM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=gxxQyeOt; arc=none smtp.client-ip=74.125.225.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="gxxQyeOt" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49cd38e0f79so24657625e9.3 for ; Tue, 22 Sep 2026 09:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790092893; x=1790697693; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FweYFWQvoZssJ6fM//sCdfeUPF500+UD5gOd7nynddo=; b=gxxQyeOt6F6YPVicjcT/gPf6oyF1AGMqZSScVSuKWUs+fTFvWYptHOatU+WuG7SKKW XtYct1ktjsT9dB3dTHHeflhtoPnfTU1zEGrFx3Lxu9qMWvKJ7T3quXM2d4XY6z2GJ7rm 6+y8kPHUXhslcJwK71rrHNuY/3vPFjJhz5KT2xd3+3XTROKa9L2JFSGt0XSCblXDRsyT 0nWisomMtqQZT9GZ3/gWzwDa8WT/HXK4XFF7pjWYCEbUOcgClmJFsgoTpfB2ret+KRtv BjUrGpFh+n74NYSj/vTjCrRR1gKVmbA7JZvn8S6ddXKyF3upWtMr/luwl+iAzRmw9cKi PZ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790092893; x=1790697693; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=FweYFWQvoZssJ6fM//sCdfeUPF500+UD5gOd7nynddo=; b=iPnv+b46ZEsJ0E6rq9uPxaFiOwR+ZrxNfVL3mJuvprsFVxWRgw7Gbk7+he8QBf/wPm JCpKMIkds7wUhoeqmI4mrBCPqFro3sL0wik712Z2C6VMATb+HWSFRCr7S7AJ2zO6gmzy MevhLy3bF9SdlTkPlMSVQQ7AVxmx1EwJNHVCPeE9Y6ZPkrVTSvJR48N4Ln+VtjPqQima Z402scW3lRZU4BlL6KI61xYA08IHlHzT4ReOm5qYeH7k3xGeun0Tn1/ivG+b5k4MbyB8 hDblyemIADyJNhuvPJj834v2KU/oWUSgPznrWb6BAwZRw41Eb1yUBJFc94igTbAxhwiV gx6w== X-Forwarded-Encrypted: i=1; AKwUvBz6sXWsom7VAhoNMw1jea5pJWXyN3pOzzaORvFiZaxAqRi+9OW+a7ZuPS9SZLgwdZGC17dhvf7Xbm5fkfg=@vger.kernel.org X-Gm-Message-State: AFuF++mLVS+o6uOB2yqmPVTO/6JZE6LgZW8dctN5gnOhaxqdrq5qMwy2 KIPAzrqUKWiwp7Wj+bmuQ9r9wHVTopGm+lPrMzAaoeRr52fRjyAT+Tdq6xqRdLcT5sk= X-Gm-Gg: AYBFou2rXgEn8YzLbJNdlmB7T3uzRzg6yXxuD/8LqyTPcIYc+IHIB0MMpFhaitlrIBL QbYN2ET5FiB1BKYaxtWDKR+WXQjVYzUMovXHhnVYb32QJUyiGjlKj3OlpvIOgQw3hlDmHgxngHX BWNZd8K6DGdfFY4BNGFkQRkrYXV19hjT2MMcp+LL3AATd8AAR7Ilz7xhC4emGIpgfJ8PTm1if3w QntQOXP89xiFd6NB+aSwVt3lcabq5ocIot+PtCb/grIKmLDJ2n1aLyHXt/54/Dd6hRqEN9WrsJn pw3c1bUcCTot2zmDY71wdBlFZ2sIZnfJmktUaiVE2+yS0MbkOBE/YjUBVJ7NgGYNuWXCGmaXIo3 djZbA2DNQrqKJRgIiqUyrdxKOMXxvL6lCPCwspaqZpuoCmppF/+eLEdF7MyaS+PC5a3QOhwmAyk tbI26gsEH/fiamnSKKMoB1D8sN0gh4DCukA658Vyadh4omXSQQ4ViAR31bFrL7SohEqA== X-Received: by 2002:a05:600c:4f41:b0:49f:ce78:3570 with SMTP id 5b1f17b1804b1-49fce78372dmr147694095e9.33.1790092892893; Tue, 22 Sep 2026 09:01:32 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48862786dc2sm6118020f8f.25.2026.09.22.09.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:01:32 -0700 (PDT) From: Valerio Setti Date: Tue, 22 Sep 2026 18:00:46 +0200 Subject: [PATCH v3 1/7] ASoC: dt-bindings: amlogic,gx-audin: add schema Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-audin-v3-1-a760312c076c@baylibre.com> References: <20260922-audin-v3-0-a760312c076c@baylibre.com> In-Reply-To: <20260922-audin-v3-0-a760312c076c@baylibre.com> To: Jerome Brunet , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Valerio Setti X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2363; i=vsetti@baylibre.com; h=from:subject:message-id; bh=BtLAkNapV4DmIrWa28ic6M0lRmuI8gxGAx+Yq38WqnA=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFmblkWWhnOnds3fnOve0Z1U8XIO243wpvWmr+s2a35WP Zgk9GpPRykLgxgXg6yYIgvL9Hu/C0rVHhonnCyAmcPKBDKEgYtTACZyYSojw5qcUG+j9tQ6roOS H9z05Xb89jAq6H6fJL84/IjFQkeTPwz/0ybtf7Kn8tHFaIbGnZ5sB+d9Zb+1qbFF9Ps8PRv2Qn9 lLgA= X-Developer-Key: i=vsetti@baylibre.com; a=openpgp; fpr=0497DEFB707526E13360C970DE4B936DD13A0100 AUDIN provides I2S audio input support to the Meson GX platforms (GXBB/GXL). Note: GXBB and GXL are not known to differ so the driver binds on the 'amlogic,gx-audin' fallback. Signed-off-by: Valerio Setti --- .../bindings/sound/amlogic,gx-audin.yaml | 69 ++++++++++++++++++= ++++ 1 file changed, 69 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-audin.yaml = b/Documentation/devicetree/bindings/sound/amlogic,gx-audin.yaml new file mode 100644 index 000000000000..bdf1db882eda --- /dev/null +++ b/Documentation/devicetree/bindings/sound/amlogic,gx-audin.yaml @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/amlogic,gx-audin.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic GX AUDIN + +maintainers: + - Valerio Setti + +description: + AUDIN is the audio input block of the Amlogic GXBB/GXL SoCs. It supports + various input formatters (I2S, SPDIF, PCM, HDMI) feeding three FIFOs that + transfer captured samples to memory. The sound-dai cell selects the FIFO. + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + items: + - enum: + - amlogic,gxbb-audin + - amlogic,gxl-audin + - const: amlogic,gx-audin + + reg: + maxItems: 1 + + resets: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: AUDIN peripheral clock + + "#sound-dai-cells": + const: 1 + +required: + - compatible + - reg + - resets + - interrupts + - clocks + - "#sound-dai-cells" + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + #include + + audio-controller@a000 { + compatible =3D "amlogic,gxbb-audin", "amlogic,gx-audin"; + reg =3D <0xa000 0x148>; + resets =3D <&reset RESET_AUDIN>; + interrupts =3D ; + sound-name-prefix =3D "AUDIN"; + #sound-dai-cells =3D <1>; + clocks =3D <&clkc CLKID_I2S_SPDIF>; + }; --=20 2.47.3 From nobody Thu Sep 24 15:10:58 2026 Received: from mail-wr2-f41.google.com (mail-wr2-f41.google.com [74.125.225.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD8D655C32F for ; Tue, 22 Sep 2026 16:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092899; cv=none; b=CxN/1uGM15hyQ4nS7RQ4iyCEiEG17GXzufcqZkVFXh2Z7LIOUxSVxNmnl9Y5gaiVxlKnBhLtq4g7mKyRsNvJo31lTgvx7RJRKymgk8x1i3FdL942vzaIj6tSJcVYmQcMJEUAjFKbfDbYI730k2habkuyYsZJ/wLIvgSxynXAhbY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092899; c=relaxed/simple; bh=QQUrE+DwZ1KWpqLSQpoA8URn9azrBBw3jC33CI+5l4Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JzrCyCWMctaoh6kLahvqTNOou8pRXUPFhodb1JALL7kkt/heQOllw5TQc6bMZ9KzVcDjxG1E9/tMHPAXoFFQaLmiBsuQiLHWFpgVwSSIHAH4bnnZeqSdoUsoch80QJYoF7vbB4CnwVScxPxZluKs7dWKtGSouy4jUDWNjB/sET8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=KDsmwuBi; arc=none smtp.client-ip=74.125.225.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="KDsmwuBi" Received: by mail-wr2-f41.google.com with SMTP id ffacd0b85a97d-4834977ae75so72191f8f.3 for ; Tue, 22 Sep 2026 09:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790092894; x=1790697694; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3jbM+/xCOFHz2ekpLk2drdaMa28onD9DLLAyaB1dHZ0=; b=KDsmwuBiybtrkSHYDHa7uTKsM3YTxOFLkzqLaGfWrjn42VlGrowqP2iv9Efe2TvG6P iGu5foLddZmfPftl79zvXx11rw5y+7HvR/hHjmklLWaRAk9W/Nson7hFaJISYtj99S1X vezeh+3DoH4btwo3I+RvowLcEA+BaW4bmifyhNGJqbQCnk6HlJekuHGoTzLrM1qY7TSb sx7cHfdIUtyXvHhKerkAl++udwA15HYeXXLm7OcZximJgaIyWtjpB+zfAR++t+DQNQa9 5l5zVf+9oTyUbB5eLYlSesw6Gr9ZAfKpdx+F5ov4L3emdklA/1spTb0bjD2Q/hdS7tHf gyyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790092894; x=1790697694; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3jbM+/xCOFHz2ekpLk2drdaMa28onD9DLLAyaB1dHZ0=; b=AhilQzrUyLuZ7NY+tvUyHcFuyK6d+v8KKbIUS6C+8IB93wW03Y9nCGkglDrJ1acCcQ 8UMWXH3ggvDiNCTPkwLPZMT2y3t+u6zXzIv8tor58zdqXyTnRRvN9HNCHYM5JfJvg+QA 8QH1dpNNi9Dw8owstszrKtSC45TvBYGABVANq6AAvDwMPvgmJAFwrjZnZRfpbH+3Uthl xsDU0FxztWKRFIoUs+Pgmu3DlCVuDiNYkFoBIqV9zJy0T70HYU9iKLckt3xetn+ZEcZz /gqkOkuI5EgB3zJsGYvjniLbdSlEJpfvIwFqfkXBfQ2t5ZfkW56VSxmspKu7SfHNmAvl cj3Q== X-Forwarded-Encrypted: i=1; AKwUvBwsK8/T9BFB+AnYcu/5WMahkfImCqKImH5dXv4gQqcxi4x/bPCtBbySBDUDAp7JqVRu+opq0kEo1Q3DYks=@vger.kernel.org X-Gm-Message-State: AFuF++k/O4UdO367VvTyoKm4UWSr7m7EcYD8Tj6lWOi9g9Y5Zgv46WhQ p4Y2uDSW+J+Tf8RZcLK9E2LM+Nw49SQMgxxFVGAb0gQsaPchTKoE7b+S/kxKyeDYu5A= X-Gm-Gg: AYBFou16QPAcjq4WLDyL9iJkJbEFVTZBxz2JNGvOcYKNyv4Q9LuvW2yekqjqDr2iNdU 5AsAFRO+1JCqEV7OYGCqEnFX1LhI4/Tn43GwOClafhmBMjOt6J9BwWmDhTf0QtHP2GfhxSjSk8m oKImo1yGAG7QnBAycnmC8/g2V8DSt4gsWtuWYypXXseDCMHbp74qnr//dnWPFDjA5l8yC20Hs5l dbnByOTsA0272iraDbMiq4pfzBzEFeo3/9uvrItJICkiH8BQ8vxeRFIkizeapyoNOwgCtEFShMO 9/Jw8lot+vuF/pMYiAdsEuEs4bTRflQ4HjG/KJEeVEySTKh71/lI9V5bSezau6GR1g5zlSFboQH u5cLnauJJIdFnJveko/cjRLGC580O+RGIzkLdd2M73pXIGUYqJAk0akRZyQpQDVuypdcmgaH2v1 Hpq/bHwUiRI7sH6xUIthzroKn1Zamu6fXsDRAplD2IfxF50NGYFvtCm8vL7cAlUAnLbg== X-Received: by 2002:a5d:64e8:0:b0:487:40a:5ba8 with SMTP id ffacd0b85a97d-4886704c06dmr106703f8f.15.1790092893762; Tue, 22 Sep 2026 09:01:33 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48862786dc2sm6118020f8f.25.2026.09.22.09.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:01:33 -0700 (PDT) From: Valerio Setti Date: Tue, 22 Sep 2026 18:00:47 +0200 Subject: [PATCH v3 2/7] ASoC: meson: build gx-formatter as a separate module Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-audin-v3-2-a760312c076c@baylibre.com> References: <20260922-audin-v3-0-a760312c076c@baylibre.com> In-Reply-To: <20260922-audin-v3-0-a760312c076c@baylibre.com> To: Jerome Brunet , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Valerio Setti X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2113; i=vsetti@baylibre.com; h=from:subject:message-id; bh=QQUrE+DwZ1KWpqLSQpoA8URn9azrBBw3jC33CI+5l4Q=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFmblkXNVTA3EJ5w5MTt/YvSv399+NWkRVpNtr1IsiIit nLNRN4pHaUsDGJcDLJiiiws0+/9LihVe2iccLIAZg4rE8gQBi5OAZhIUCzDf/+Ebz4WizZvNz/g d3y1Orf2Uy8bxc47Lg4GVSLnmz9oGDAyXJrMeTWn/N2ZoKyQWY+/RTXLn40+avp9zo2YTT7bTta 9YgMA X-Developer-Key: i=vsetti@baylibre.com; a=openpgp; fpr=0497DEFB707526E13360C970DE4B936DD13A0100 Instead of including it in 'snd-soc-meson-aiu', create a separate module for it. This way it can be independently selected by either AIU or the (upcoming) AUDIN. Signed-off-by: Valerio Setti --- sound/soc/meson/Kconfig | 5 +++++ sound/soc/meson/Makefile | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig index d9a730994a2a..4c40bf60dc4e 100644 --- a/sound/soc/meson/Kconfig +++ b/sound/soc/meson/Kconfig @@ -2,10 +2,15 @@ menu "Amlogic" depends on ARCH_MESON || (COMPILE_TEST && COMMON_CLK) =20 +config SND_MESON_GX_FORMATTER + tristate + select REGMAP_MMIO + config SND_MESON_AIU tristate "Amlogic AIU" select SND_MESON_CODEC_GLUE select SND_PCM_IEC958 + select SND_MESON_GX_FORMATTER imply SND_SOC_MESON_T9015 imply SND_SOC_HDMI_CODEC if DRM_MESON_DW_HDMI help diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile index f9ec0ebb01f0..1b1fbe8a0458 100644 --- a/sound/soc/meson/Makefile +++ b/sound/soc/meson/Makefile @@ -4,12 +4,12 @@ snd-soc-meson-aiu-y :=3D aiu.o snd-soc-meson-aiu-y +=3D aiu-acodec-ctrl.o snd-soc-meson-aiu-y +=3D aiu-codec-ctrl.o snd-soc-meson-aiu-y +=3D aiu-encoder-i2s.o -snd-soc-meson-aiu-y +=3D gx-formatter.o snd-soc-meson-aiu-y +=3D aiu-formatter-i2s.o snd-soc-meson-aiu-y +=3D aiu-encoder-spdif.o snd-soc-meson-aiu-y +=3D aiu-fifo.o snd-soc-meson-aiu-y +=3D aiu-fifo-i2s.o snd-soc-meson-aiu-y +=3D aiu-fifo-spdif.o +snd-soc-meson-gx-formatter-y :=3D gx-formatter.o snd-soc-meson-axg-fifo-y :=3D axg-fifo.o snd-soc-meson-axg-frddr-y :=3D axg-frddr.o snd-soc-meson-axg-toddr-y :=3D axg-toddr.o @@ -29,6 +29,7 @@ snd-soc-meson-g12a-tohdmitx-y :=3D g12a-tohdmitx.o snd-soc-meson-t9015-y :=3D t9015.o =20 obj-$(CONFIG_SND_MESON_AIU) +=3D snd-soc-meson-aiu.o +obj-$(CONFIG_SND_MESON_GX_FORMATTER) +=3D snd-soc-meson-gx-formatter.o obj-$(CONFIG_SND_MESON_AXG_FIFO) +=3D snd-soc-meson-axg-fifo.o obj-$(CONFIG_SND_MESON_AXG_FRDDR) +=3D snd-soc-meson-axg-frddr.o obj-$(CONFIG_SND_MESON_AXG_TODDR) +=3D snd-soc-meson-axg-toddr.o --=20 2.47.3 From nobody Thu Sep 24 15:10:58 2026 Received: from mail-wr2-f12.google.com (mail-wr2-f12.google.com [74.125.225.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88C3554EEA4 for ; Tue, 22 Sep 2026 16:01:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092899; cv=none; b=AVabUEbD56BhxQUew+U/OkstTD5IvzxAsSYv4GVp9nmq9y8BzoDztF8WuA1YPsWifhJUk7S3VOGH/juVmrKDlLyyPjuYMHKdfSNn3sO6OLqBPqFR36T31kZxThn3eJgJe5WmWsM8p6c3wE0kDMRAB6DgJeSISkig+HrnJ+Hu/js= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092899; c=relaxed/simple; bh=USKlfavDbggOjZS2/SFDHhmHPla3alh2Tu6lzPN+798=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b1YuM5z1rbUwWnS/thUT01bKi0xzqztHekwpBcNGVv1bo+GiXUbtbL+iPKlkmrKJbwVrDRxxVnj1k8UNKUS1crgY4v1rNdyBYKn08nviTc01OEnK38n7z1iWF785h36S/ecHg1uzLWc9bBCMLjNBx/W2mqTpreWBntBX42m6J+Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=NOiDVEfd; arc=none smtp.client-ip=74.125.225.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="NOiDVEfd" Received: by mail-wr2-f12.google.com with SMTP id ffacd0b85a97d-4843c3ee4cfso57853f8f.2 for ; Tue, 22 Sep 2026 09:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790092895; x=1790697695; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=W5u7/CkWfak8RB/d8dqpu9NxHBzNm4GVmQxeKd8aK80=; b=NOiDVEfdUQZTEqAvvq9zsRXRJEIYCjjIc3xqpW3h2FZp8PdiLvMK9bWEwOzLUshliR +rPuQTJQcGwlxNu/s/1aVSwqsZQKNu83AdcoGWGVDxK8Xa0DTSNxC3UvNWXEv3I1X3KY QcHnNO5eftVfMSmcr9IY7iBNmnBO+3XQcc8ZIvQ9gcyNNGU4e0vQ5P2r6rRLqfAqDS9U Y+11fkXxJQxUaGL1AHK7pYE70we0Fk1NSckiZjMK/Y6pghwBZcTZ4laLZzD/pte6xaAB 0xgbzADmGhYTk9krLPTMAs9t+pwEnkHZl9H1XWE+jeWUuE8U67tmWNQ1HAUArW7bZHNJ NMnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790092895; x=1790697695; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=W5u7/CkWfak8RB/d8dqpu9NxHBzNm4GVmQxeKd8aK80=; b=ZC+IKPBStg2PlQmeRvbsAfmbjdwLqFBevocw12GBpfaMjW18cIC20jeRpod0Jxa3lh j3RF0U3qYERsZxuSslPHSuEmk2m9QLJBHPMP08e0MJ/OGC5Va7F14lNlHjJuFXupnfkh nysjumzRFus9wHYAK8uwNuVKc3MMC/dGB5r2vDrZ67+jTrCPOVnowBW83slSjyw+GgqM gOjpppENXjtHyOtSvcQlRmjoDM5PXNR59jyN6NaCOJfdHdhxL5H4uj3MkjJm1uPT42LY ub/nrKGrHVMAfMdpJqLkcWRrKaIMYpfESPHUVi26CktJYQRkxJ6M6VU8eDKRkKGyKisL qGMg== X-Forwarded-Encrypted: i=1; AKwUvBxwB95kWkVaeKSgLsGIw+FDI7EDoxLiA3JWcZAyQEo39OLIM9nKfZjo6h0C5YTR5OQ0BWzgSPUW7j9XCVQ=@vger.kernel.org X-Gm-Message-State: AFuF++nwBszb+eZvzsFLG/+HYFqJHvkji57gQOA1GYriZaVRfSQNXu6D +i2W7twNnrnwU/erXvg9dr4Yz2Bwp7Y+kIoZ+pqwa+D+g85ek4ODjr1JPyOT+g1zEbI= X-Gm-Gg: AYBFou30rf8TZFjDVXl/k3hOD+XH/8PtncR9bOZPAhO6+Ze8wCsFNJi3pj+NP9Cwn5q kTVpn6PQrPbhzgvqzyC/buNcveX9Wpw4K28XSeMb6KVFvQ8AHpzqATWshPwhDH5BFWTXJNPn8PU DrO21Z+0JvdX7ExtjDALxiIv+jqXVm8riW14m/ZVkDOcSXKskQuvxyrAeSdW407mRvUWWqjlF1l Q5tBf1ALFNZhnH1BPSLWswp7PLb7CkPlFPZ9bj5zwxW1cS+DESr95rQ4voFDd70pG53yFHSWJbL DNq6LZAoCpZx3ARiSVvl0dp+r8KInCnqf7mwSlUTX6uZJemb98kiz9I4Brl3NrnxaRJEmBnFkL6 cxN9ckGfodRn0K8dw7/hmtaEjKro0tIif/q6yPkT5BVh4jr4yJ4zkzFxdwTb2r9mtBz2vnACyr2 hhq4az0ObF+zXBa+yCWKWblHEFENUZEDsf2GMjXs4/LzW2Sjpk754A7qtccg77V/Z9xA== X-Received: by 2002:a05:600c:4712:b0:49f:dd10:3c71 with SMTP id 5b1f17b1804b1-49fdd103ccfmr22007895e9.11.1790092894693; Tue, 22 Sep 2026 09:01:34 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48862786dc2sm6118020f8f.25.2026.09.22.09.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:01:34 -0700 (PDT) From: Valerio Setti Date: Tue, 22 Sep 2026 18:00:48 +0200 Subject: [PATCH v3 3/7] ASoC: meson: aiu-encoder-i2s: ensure clk divider gets disabled in hw_free Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-audin-v3-3-a760312c076c@baylibre.com> References: <20260922-audin-v3-0-a760312c076c@baylibre.com> In-Reply-To: <20260922-audin-v3-0-a760312c076c@baylibre.com> To: Jerome Brunet , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Valerio Setti X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2122; i=vsetti@baylibre.com; h=from:subject:message-id; bh=USKlfavDbggOjZS2/SFDHhmHPla3alh2Tu6lzPN+798=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFmblkWdmnXxyuvtO2XuTbfN/OPOpc69WvCaZKdG3trCh X+fBTvN7ihlYRDjYpAVU2RhmX7vd0Gp2kPjhJMFMHNYmUCGMHBxCsBEnvgzMnxcnvHv4du5jDnP fC67L/cK+Dm3Y5n1XwnnU2u1VnLGMakyMty8rJ5w66gVU3VHIuuk3+mXLvuFbFboLfCUYa9tWNz TzQAA X-Developer-Key: i=vsetti@baylibre.com; a=openpgp; fpr=0497DEFB707526E13360C970DE4B936DD13A0100 A recent Sashiko review [1] on this code revealed the following problem: If a user opens both streams so snd_soc_dai_active(dai) evaluates to 2, and explicitly calls SNDRV_PCM_IOCTL_HW_FREE before closing them, snd_soc_dai_active(dai) remains 2. This skips disabling the clock divider. When the streams are subsequently closed, the ALSA core skips invoking hw_free again because the state was already changed to SNDRV_PCM_STATE_OPEN. This would leave the clock divider permanently enabled, potentially draining battery or blocking system suspend. This commit resolves this problem by using the 'clk_enabled' field of 'struct gx_stream'. In particular when 'hw_free()' is called on a stream the code check what is the status of the other stream and then only if both are off the clock divider is disabled. [1]: https://lore.kernel.org/all/20260917212019.4ECE61F00893@smtp.kernel.or= g/ Signed-off-by: Valerio Setti --- sound/soc/meson/aiu-encoder-i2s.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encode= r-i2s.c index 58dce9f08c9d..70ea39c77b32 100644 --- a/sound/soc/meson/aiu-encoder-i2s.c +++ b/sound/soc/meson/aiu-encoder-i2s.c @@ -219,16 +219,14 @@ static int aiu_encoder_i2s_hw_free(struct snd_pcm_sub= stream *substream, struct snd_soc_dai *dai) { struct gx_stream *ts =3D snd_soc_dai_get_dma_data(dai, substream); + struct gx_stream *other =3D snd_soc_dai_dma_data_get(dai, !substream->str= eam); struct snd_soc_component *component =3D dai->component; =20 - /* - * If this is the last substream being closed then disable the i2s - * clock divider. - */ - if (snd_soc_dai_active(dai) <=3D 1) - aiu_encoder_i2s_divider_enable(component, 0); - if (ts->clk_enabled) { + /* Disable the clk divider only if also the other stream is not using it= */ + if (!other || !other->clk_enabled) + aiu_encoder_i2s_divider_enable(component, false); + clk_disable_unprepare(ts->iface->mclk); ts->clk_enabled =3D false; } --=20 2.47.3 From nobody Thu Sep 24 15:10:58 2026 Received: from mail-wm2-f13.google.com (mail-wm2-f13.google.com [74.125.225.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C89F560AB0 for ; Tue, 22 Sep 2026 16:01:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092901; cv=none; b=BnDDY/Ow9s6CooUgOsieDBfZhgUM40u/3BgjGqiLf6tIY9eGn6YECV1w4GU3b+Egiw0/M3TznriFXEOXDrY3LQi2jyy3DgabaTfFZ2fTBmMVQbSuXnPgqHVQDFOYsRXfkGA7xOUKVH6ab6pmjP/6YDViJlt9QAb1rzNgOM/8FkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092901; c=relaxed/simple; bh=3IVFxXLaU2FE6gUaLHbR3Dyd4Jq6eW/rsiEArPtNeTA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=otmi3SO/4v+8KndNNIxJIKPTlEEbPjw+doNh7cpoKaWsVYaTJfFXDTVKKjLeVv2asrGcCjE3pcad6meX/OJXSNqRsnKhSfo13gFCT4cuUmIHFSI7jnGxwksUJBFC7PcYL7uwoAYL9gR/QlASA0mo00NFytM0NiJdxSvealKE1IQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=em7pwjdH; arc=none smtp.client-ip=74.125.225.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="em7pwjdH" Received: by mail-wm2-f13.google.com with SMTP id 5b1f17b1804b1-49cd38e0f79so24658035e9.3 for ; Tue, 22 Sep 2026 09:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790092896; x=1790697696; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Lt5QbwQHiPIbczzFJC9IBWwU+BzN47Y6/yoKc0E0H/o=; b=em7pwjdHUkLsetrosITku3nFWXRjEYW/aXUOxEcoZMpSoZ7o1hu3Zo+O3JcPoIMi6R jlmlXJ/gI2awN71igGHInoVBujPx2PuiwnMRElMM8Wq4BSpPFnKblGQ3UPAz8Jk0pbHH jgazKaADXlxMufh6KwlF+2fvIlt3V0TqQnKLZe1Ieufmu1maKPyBcRp2WZIFELfEosVA QthCAgth5hzkDMA9zA5NHrMr1MP784NeLnaBQ+0OnZ/Q8OwGyozONB4FHzseN9UpLlkQ o+RbiG/cBE8rDk1b6w1Esjefs+1wIMv2iU5elYs7a6nchPfDceVTUEeZImFZ6EdIuWx2 t8ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790092896; x=1790697696; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Lt5QbwQHiPIbczzFJC9IBWwU+BzN47Y6/yoKc0E0H/o=; b=GE06OHMyFa33n/1hwe4OGqwP1ES/3GACaIHqpe3D5LfGQjFw09o/sBPeniFyWqiWBe Io00DDVOZzyjzWGQzKT4vnUx0quyfDEoZwbA6+DHRLPjELOTFaHpPY9ykDXnRaXKMcPW x/AUeTRyXE66DDqhS3n6lzIjf9Ywmx0OyaaKd+S9bNz8CJfxLJmak48bqesjOzXiVMKR T9dXnZEWU5i65DesmkoqUSPXFQ2iOLzLO3RpauiIMKLGwK8Muk313PmtVtvN0rZ5iuzO GgCd3qQSjouJc3kzDj8IlaOSE/+kMRm58PebOE3so2VPHUv1X1WdGnfO6GNacF0ZmqZk JOqA== X-Forwarded-Encrypted: i=1; AKwUvBxSDj0+ga9u7NVrPF6W00MEmNdyR5+Qqm5W/X+uSG+dmS3LKeHbfzRLIlrtoHT4BYX3dNsid9OoE93+YMc=@vger.kernel.org X-Gm-Message-State: AFuF++kT4Q0IiGy6NxLY/hIh2QDnkkeFAmDD72Tf3mk2KAcLzmpJfxNU r94N9y+4e354psBx8utbpLnqiyDdgGPU1o4kg2r63KyqMsEI44ffOTW6838AZjywhRs= X-Gm-Gg: AYBFou1U2w3RmbCJ4CVs8Vxt89e0R9oadDO10eG05RX48ZSPmaLBFDA4y0vLucQj4tk Cu42ySFpR+wZZhqsmC0u86f+Erk2QmWPsTjIMXt85dGsku5iy+LMEsbf+1dtwydbbkzt7cSYG4G 6Qnr4+0ozRZ3QtkxfSmZ0Bs+gvcNrh+3FK70G99+Gh0QHZFtqBdvDhzalNir0FfeVVa3W/cbw2l 2H/sc5uWjjmLJclJLMf7wYSWFUWdETmxbUZZiPiQFReFFbrLlwGIzlfOMHTpR2H1sdoJ5LBLZ8j VrmS4jXygFwWEgnrBHatv+0nK+PZwGxndJcIJJ/+dY2OocFJuR6QA9cfHAkyc17HGMk9eIQ7h9G Sjjg29XWgkxiAjn9RWMOpkt3HVjc2HcQ8HN5XI6ktAdFpaKoK8bznWn8TZOD/N6b0nvi42dddYi 18QVyfmoJY/BJdvEAU8P4EtGSCiZC8DM4eM/bjfNTTImIUcyAXUa0JYAKJejHfAniw7Q== X-Received: by 2002:a05:600c:1d06:b0:49c:ed94:cdd8 with SMTP id 5b1f17b1804b1-49fc56aa3f0mr233312445e9.6.1790092895656; Tue, 22 Sep 2026 09:01:35 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48862786dc2sm6118020f8f.25.2026.09.22.09.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:01:35 -0700 (PDT) From: Valerio Setti Date: Tue, 22 Sep 2026 18:00:49 +0200 Subject: [PATCH v3 4/7] ASoC: meson: add AUDIN driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-audin-v3-4-a760312c076c@baylibre.com> References: <20260922-audin-v3-0-a760312c076c@baylibre.com> In-Reply-To: <20260922-audin-v3-0-a760312c076c@baylibre.com> To: Jerome Brunet , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Valerio Setti X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=29022; i=vsetti@baylibre.com; h=from:subject:message-id; bh=3IVFxXLaU2FE6gUaLHbR3Dyd4Jq6eW/rsiEArPtNeTA=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFmblkU9eXPgsCZPxM3s6rdb5ud4bpni/G3POsUVn/Y9O O68XPLH8o5SFgYxLgZZMUUWlun3fheUqj00TjhZADOHlQlkCAMXpwBMZHUww/8obkPrjrt2TU9y L4gIFubM/8/u23Xzs+xjy+RX694cDJnPyPCrRF712grW3kLnS37WUnOtBJzde6MiPhrFxXuYRsX /5AYA X-Developer-Key: i=vsetti@baylibre.com; a=openpgp; fpr=0497DEFB707526E13360C970DE4B936DD13A0100 AUDIN provides audio input support to the Amlogic GX based platforms (GXBB/GXL). It is the counterpart of AIU for capture and it strictly follows the same structure: - It takes the ownership of the entire register range; - It sets up peripheral clock and handles the reset; - It adds support for I2S data formatter through a widget; - It instantiates each of the FIFOs as component's DAI. Both I2S data formatter and FIFO code live separate files ('audin-formatter-i2s' and 'audin-fifo', respectively) for a better code organization. Unfortunately it wasn't possible to add them as independent devices due to the messy register layout organization that has been implemented by the manufacturer on this platform. This component could ideally handle multiple input sources (SPDIF, I2S, PCM, HDMI), but for the time being only I2S is added and has been tested. Note: due to default register configuration, at boot all FIFO input sources are set to "SPDIF". In order to be able to test I2S they must be switched to "I2S". This can easily be achieved with: $ amixer sset 'AUDIN FIFO0 SRC SEL' 'I2S' Signed-off-by: Valerio Setti --- sound/soc/meson/Kconfig | 9 + sound/soc/meson/Makefile | 4 + sound/soc/meson/audin-fifo.c | 371 ++++++++++++++++++++++++++++++= ++++ sound/soc/meson/audin-formatter-i2s.c | 174 ++++++++++++++++ sound/soc/meson/audin.c | 188 +++++++++++++++++ sound/soc/meson/audin.h | 30 +++ 6 files changed, 776 insertions(+) diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig index 4c40bf60dc4e..9d8589b5a88f 100644 --- a/sound/soc/meson/Kconfig +++ b/sound/soc/meson/Kconfig @@ -17,6 +17,14 @@ config SND_MESON_AIU Select Y or M to add support for the Audio output subsystem found in the Amlogic Meson8, Meson8b and GX SoC families =20 +config SND_MESON_AUDIN + tristate "Amlogic AUDIN" + select REGMAP_MMIO + select SND_MESON_GX_FORMATTER + help + Select Y or M to add support for the audio input subsystem found + in the Amlogic GX SoC family. Currently only I2S input is supported. + config SND_MESON_AXG_FIFO tristate select REGMAP_MMIO @@ -113,6 +121,7 @@ config SND_MESON_GX_SOUND_CARD tristate "Amlogic GX Sound Card Support" select SND_MESON_CARD_UTILS imply SND_MESON_AIU + imply SND_MESON_AUDIN help Select Y or M to add support for the GXBB/GXL SoC sound card =20 diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile index 1b1fbe8a0458..4af75df0d19b 100644 --- a/sound/soc/meson/Makefile +++ b/sound/soc/meson/Makefile @@ -10,6 +10,9 @@ snd-soc-meson-aiu-y +=3D aiu-fifo.o snd-soc-meson-aiu-y +=3D aiu-fifo-i2s.o snd-soc-meson-aiu-y +=3D aiu-fifo-spdif.o snd-soc-meson-gx-formatter-y :=3D gx-formatter.o +snd-soc-meson-audin-y :=3D audin.o +snd-soc-meson-audin-y +=3D audin-formatter-i2s.o +snd-soc-meson-audin-y +=3D audin-fifo.o snd-soc-meson-axg-fifo-y :=3D axg-fifo.o snd-soc-meson-axg-frddr-y :=3D axg-frddr.o snd-soc-meson-axg-toddr-y :=3D axg-toddr.o @@ -30,6 +33,7 @@ snd-soc-meson-t9015-y :=3D t9015.o =20 obj-$(CONFIG_SND_MESON_AIU) +=3D snd-soc-meson-aiu.o obj-$(CONFIG_SND_MESON_GX_FORMATTER) +=3D snd-soc-meson-gx-formatter.o +obj-$(CONFIG_SND_MESON_AUDIN) +=3D snd-soc-meson-audin.o obj-$(CONFIG_SND_MESON_AXG_FIFO) +=3D snd-soc-meson-axg-fifo.o obj-$(CONFIG_SND_MESON_AXG_FRDDR) +=3D snd-soc-meson-axg-frddr.o obj-$(CONFIG_SND_MESON_AXG_TODDR) +=3D snd-soc-meson-axg-toddr.o diff --git a/sound/soc/meson/audin-fifo.c b/sound/soc/meson/audin-fifo.c new file mode 100644 index 000000000000..cb59bb267e84 --- /dev/null +++ b/sound/soc/meson/audin-fifo.c @@ -0,0 +1,371 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (c) 2026 BayLibre, SAS. +// Author: Valerio Setti + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "audin.h" + +/* FIFO registers */ +#define AUDIN_FIFO_START 0x00 +#define AUDIN_FIFO_END 0x04 +#define AUDIN_FIFO_PTR 0x08 + +/* FIFOx_CTRL1 registers and bits */ +#define AUDIN_FIFO_CTRL1 0x18 +#define AUDIN_FIFO_CTRL1_DIN_BYTE_NUM_MASK GENMASK(3, 2) +#define AUDIN_FIFO_CTRL1_DIN_POS_01_MASK GENMASK(1, 0) + +/* When the FIFO is full the data is bulk transferred to memory. */ +#define AUDIN_FIFO_LANE_SIZE 8 /* bytes */ +#define AUDIN_FIFO_I2S_BLOCK (AUDIN_FIFO_LANE_SIZE * 32) /* 256 bytes */ + +static const struct snd_pcm_hardware audin_fifo_pcm_hw =3D { + .info =3D (SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_PAUSE), + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + .rate_min =3D 5512, + .rate_max =3D 192000, + .channels_min =3D 2, + .channels_max =3D 2, + /* + * The FIFO only moves data to the memory once it is full, so its pointer + * progresses one block at a time. + */ + .period_bytes_min =3D 2 * AUDIN_FIFO_I2S_BLOCK, + .period_bytes_max =3D UINT_MAX, /* Bounded by buffer_bytes_max */ + .periods_min =3D 2, + .periods_max =3D UINT_MAX, + /* + * It's 1 MB. There is no physical constraint for this; it's only meant to + * provide some decently large buffer size where to store incoming data + * and fit various period_bytes requests. + */ + .buffer_bytes_max =3D 4096 * AUDIN_FIFO_I2S_BLOCK, +}; + +struct audin_fifo_dai_data { + /* + * The AUDIN peripheral has an IRQ to signal when data is received, but + * it cannot grant a periodic behavior. The reason is that the register + * which holds the address which triggers the IRQ must be updated + * continuously. This creates a risk of overflow if for any reason the + * ISR execution is delayed. Using a periodic timer is therefore simpler + * and more reliable. + */ + struct hrtimer polling_timer; + struct snd_soc_dai *dai; + struct snd_pcm_substream *substream; + unsigned int period_bytes; + unsigned int byte_rate; + unsigned int last_pos; /* Position inside the allocated read buffer. */ + bool running; +}; + +static unsigned int audin_fifo_pos(struct snd_soc_dai *dai, + struct snd_pcm_runtime *runtime) +{ + unsigned int ptr =3D lower_32_bits(runtime->dma_addr); + + regmap_read(dai->component->regmap, dai->driver->base + AUDIN_FIFO_PTR, &= ptr); + + return ptr - lower_32_bits(runtime->dma_addr); +} + +static ktime_t audin_fifo_bytes_to_ns(struct audin_fifo_dai_data *data, + unsigned int bytes) +{ + return div_u64((u64)bytes * NSEC_PER_SEC, data->byte_rate); +} + +static int audin_fifo_dai_trigger(struct snd_pcm_substream *substream, int= cmd, + struct snd_soc_dai *dai) +{ + struct audin_fifo_dai_data *data =3D snd_soc_dai_dma_data_get_capture(dai= ); + struct snd_soc_component *component =3D dai->component; + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_= CTRL, + AUDIN_FIFO_CTRL_EN, + AUDIN_FIFO_CTRL_EN); + WRITE_ONCE(data->running, true); + hrtimer_start(&data->polling_timer, + audin_fifo_bytes_to_ns(data, data->period_bytes), + HRTIMER_MODE_REL_SOFT); + break; + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + case SNDRV_PCM_TRIGGER_STOP: + WRITE_ONCE(data->running, false); + /* + * PCM stream lock is held here. If the timer callback is running + * (i.e. it cannot be stopped) there is also hrtimer_cancel() + * in hw_free(). + */ + hrtimer_try_to_cancel(&data->polling_timer); + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_= CTRL, + AUDIN_FIFO_CTRL_EN, 0); + break; + default: + return -EINVAL; + } + + return 0; +} + +static int audin_fifo_dai_prepare(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct audin_fifo_dai_data *data =3D snd_soc_dai_dma_data_get_capture(dai= ); + struct snd_soc_component *component =3D dai->component; + struct snd_pcm_runtime *runtime =3D substream->runtime; + dma_addr_t dma_end =3D runtime->dma_addr + runtime->dma_bytes - AUDIN_FIF= O_LANE_SIZE; + unsigned int val; + + data->last_pos =3D 0; + + /* + * Setup memory boundaries. + * Note: DMA has a 32-bit mask, so it's OK to take lower 32 bits. + */ + snd_soc_component_write(component, dai->driver->base + AUDIN_FIFO_START, + lower_32_bits(runtime->dma_addr)); + snd_soc_component_write(component, dai->driver->base + AUDIN_FIFO_PTR, + lower_32_bits(runtime->dma_addr)); + snd_soc_component_write(component, dai->driver->base + AUDIN_FIFO_END, + lower_32_bits(dma_end)); + + /* Load new addresses (both LOAD and UG are self-clearing). */ + val =3D AUDIN_FIFO_CTRL_LOAD | AUDIN_FIFO_CTRL_UG; + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_C= TRL, val, val); + + /* Reset (RST is self-clearing). */ + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_C= TRL, + AUDIN_FIFO_CTRL_RST, + AUDIN_FIFO_CTRL_RST); + + return 0; +} + +static int audin_fifo_dai_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + struct snd_soc_component *component =3D dai->component; + struct audin_fifo_dai_data *data =3D snd_soc_dai_dma_data_get_capture(dai= ); + unsigned int val; + + /* + * The I2S input decoder passes 24 bits of left-justified data + * but for the time being we only support 16 bit formatted samples + * which means that we drop the LSB. + */ + val =3D FIELD_PREP(AUDIN_FIFO_CTRL1_DIN_POS_01_MASK, 1); + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_C= TRL1, + AUDIN_FIFO_CTRL1_DIN_POS_01_MASK, + val); + + /* Set sample size to 2 bytes (16 bit) */ + val =3D FIELD_PREP(AUDIN_FIFO_CTRL1_DIN_BYTE_NUM_MASK, 1); + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_C= TRL1, + AUDIN_FIFO_CTRL1_DIN_BYTE_NUM_MASK, + val); + + /* + * This is a bit counterintuitive. Even though the platform has a single + * pin for I2S input which would mean that we can only support 2 + * channels, doing so would cause samples to be stored in a weird way + * into the FIFO: all the samples from the 1st channel on the 1st half + * of the FIFO, then samples from the 2nd channel in the other half. Of + * course extra work would be required to properly interleave them + * before returning to the userspace. + * Setting a single channel mode instead solves the problem: samples + * from 1st and 2nd channel are stored interleaved and sequentially in + * the FIFO. + */ + val =3D FIELD_PREP(AUDIN_FIFO_CTRL_CHAN_MASK, 1); + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_C= TRL, + AUDIN_FIFO_CTRL_CHAN_MASK, val); + + /* + * FIFO is filled line by line and each of them is 8 bytes. The + * problem is that each line is filled starting from the end, + * so we need to properly reorder them before moving to the + * RAM. This is the value required to properly re-order samples stored + * in 16 bit format. + */ + val =3D FIELD_PREP(AUDIN_FIFO_CTRL_ENDIAN_MASK, 6); + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_C= TRL, + AUDIN_FIFO_CTRL_ENDIAN_MASK, val); + + /* Used by the polling timer to convert a byte count into a delay. */ + data->period_bytes =3D params_period_bytes(params); + data->byte_rate =3D params_rate(params) * params_channels(params) * + params_physical_width(params) / BITS_PER_BYTE; + + data->substream =3D substream; + + return 0; +} + +static int audin_fifo_dai_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + int ret; + + snd_soc_set_runtime_hwparams(substream, &audin_fifo_pcm_hw); + + ret =3D snd_pcm_hw_constraint_step(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + AUDIN_FIFO_I2S_BLOCK); + if (ret < 0) { + dev_err(dai->dev, "Failed to set constraint on buffer_bytes %d\n", ret); + return ret; + } + + ret =3D snd_pcm_hw_constraint_step(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + AUDIN_FIFO_I2S_BLOCK); + if (ret < 0) { + dev_err(dai->dev, "Failed to set constraint on period_bytes %d\n", ret); + return ret; + } + + return 0; +} + +static int audin_fifo_dai_pcm_new(struct snd_soc_pcm_runtime *rtd, + struct snd_soc_dai *dai) +{ + int ret; + + ret =3D dma_coerce_mask_and_coherent(dai->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(dai->dev, "Failed to set DMA mask %d\n", ret); + return ret; + } + + ret =3D snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + dai->dev, + audin_fifo_pcm_hw.buffer_bytes_max, + audin_fifo_pcm_hw.buffer_bytes_max); + if (ret) { + dev_err(dai->dev, "Failed to set PCM managed buffer %d\n", ret); + return ret; + } + + return 0; +} + +static enum hrtimer_restart audin_fifo_timer_cb(struct hrtimer *timer) +{ + struct audin_fifo_dai_data *data =3D + container_of(timer, struct audin_fifo_dai_data, polling_timer); + struct snd_pcm_runtime *runtime =3D data->substream->runtime; + unsigned int curr_pos; + unsigned int delta, elapsed_periods_bytes, extra_bytes, sleep_bytes; + + if (!READ_ONCE(data->running)) + return HRTIMER_NORESTART; + + curr_pos =3D audin_fifo_pos(data->dai, runtime); + delta =3D (curr_pos >=3D data->last_pos) ? + curr_pos - data->last_pos : + (runtime->dma_bytes - data->last_pos) + curr_pos; + extra_bytes =3D delta % data->period_bytes; + elapsed_periods_bytes =3D delta - extra_bytes; + + /* Report only when the period is completed. */ + if (delta >=3D data->period_bytes) { + data->last_pos =3D data->last_pos + elapsed_periods_bytes; + if (data->last_pos >=3D runtime->dma_bytes) + data->last_pos %=3D runtime->dma_bytes; + snd_pcm_period_elapsed(data->substream); + } + + /* Sleep until the period is completed. */ + sleep_bytes =3D round_up(data->period_bytes - extra_bytes, AUDIN_FIFO_I2S= _BLOCK); + hrtimer_forward_now(timer, audin_fifo_bytes_to_ns(data, sleep_bytes)); + + if (!READ_ONCE(data->running)) + return HRTIMER_NORESTART; + return HRTIMER_RESTART; +} + +static int audin_fifo_dai_probe(struct snd_soc_dai *dai) +{ + struct audin_fifo_dai_data *data; + + data =3D kzalloc_obj(*data); + if (!data) + return -ENOMEM; + + data->dai =3D dai; + + hrtimer_setup(&data->polling_timer, audin_fifo_timer_cb, CLOCK_MONOTONIC, + HRTIMER_MODE_REL_SOFT); + + snd_soc_dai_dma_data_set_capture(dai, data); + + return 0; +} + +static int audin_fifo_dai_remove(struct snd_soc_dai *dai) +{ + kfree(snd_soc_dai_dma_data_get_capture(dai)); + + return 0; +} + +const struct snd_soc_dai_ops audin_fifo_dai_ops =3D { + .trigger =3D audin_fifo_dai_trigger, + .prepare =3D audin_fifo_dai_prepare, + .hw_params =3D audin_fifo_dai_hw_params, + .startup =3D audin_fifo_dai_startup, + .pcm_new =3D audin_fifo_dai_pcm_new, + .probe =3D audin_fifo_dai_probe, + .remove =3D audin_fifo_dai_remove, +}; + +snd_pcm_uframes_t audin_fifo_component_pointer(struct snd_soc_component *c= omponent, + struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime =3D substream->runtime; + struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); + struct snd_soc_dai *dai =3D snd_soc_rtd_to_cpu(rtd, 0); + + return bytes_to_frames(runtime, audin_fifo_pos(dai, runtime)); +} + +/* + * sync_stop() is called before hw_params(), hw_free(), suspend(), prepare= (). + * Cancelling the hrtimer here ensures the timer is really stopped even in + * case the stream is run->stop->prepare->start. + */ +int audin_fifo_sync_stop(struct snd_soc_component *component, struct snd_p= cm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); + struct snd_soc_dai *dai =3D snd_soc_rtd_to_cpu(rtd, 0); + struct audin_fifo_dai_data *data =3D snd_soc_dai_dma_data_get_capture(dai= ); + + hrtimer_cancel(&data->polling_timer); + WRITE_ONCE(data->running, false); + + return 0; +} diff --git a/sound/soc/meson/audin-formatter-i2s.c b/sound/soc/meson/audin-= formatter-i2s.c new file mode 100644 index 000000000000..8bbb5cdb52dc --- /dev/null +++ b/sound/soc/meson/audin-formatter-i2s.c @@ -0,0 +1,174 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (c) 2026 BayLibre, SAS. +// Author: Valerio Setti + +#include +#include +#include +#include + +#include "audin.h" +#include "gx-formatter.h" + +/* I2SIN_CTRL register and bits */ +#define AUDIN_I2SIN_CTRL 0x40 +#define AUDIN_I2SIN_CTRL_I2SIN_DIR BIT(0) +#define AUDIN_I2SIN_CTRL_I2SIN_CLK_SEL BIT(1) +#define AUDIN_I2SIN_CTRL_I2SIN_LRCLK_SEL BIT(2) +#define AUDIN_I2SIN_CTRL_I2SIN_BCLK_INV BIT(3) +#define AUDIN_I2SIN_CTRL_I2SIN_LRCLK_SKEW_MASK GENMASK(6, 4) +#define AUDIN_I2SIN_CTRL_I2SIN_LRCLK_INV BIT(7) +#define AUDIN_I2SIN_CTRL_I2SIN_SIZE_MASK GENMASK(9, 8) +#define AUDIN_I2SIN_CTRL_I2SIN_CHAN_EN_MASK GENMASK(13, 10) +#define AUDIN_I2SIN_CTRL_I2SIN_EN BIT(15) + +static struct snd_soc_dai * +audin_formatter_i2s_get_be(struct snd_soc_dapm_widget *w) +{ + struct snd_soc_dapm_path *p; + struct snd_soc_dai *be; + + snd_soc_dapm_widget_for_each_source_path(w, p) { + if (!p->connect) + continue; + + if (p->source->id =3D=3D snd_soc_dapm_dai_out) + return (struct snd_soc_dai *)p->source->priv; + + be =3D audin_formatter_i2s_get_be(p->source); + if (be) + return be; + } + + return NULL; +} + +static struct gx_stream * +audin_formatter_i2s_get_stream(struct snd_soc_dapm_widget *w) +{ + struct snd_soc_dai *be =3D audin_formatter_i2s_get_be(w); + + if (!be) + return NULL; + + return snd_soc_dai_dma_data_get_capture(be); +} + +static void audin_formatter_i2s_enable(struct regmap *map) +{ + regmap_update_bits(map, AUDIN_I2SIN_CTRL, + AUDIN_I2SIN_CTRL_I2SIN_EN, + AUDIN_I2SIN_CTRL_I2SIN_EN); +} + +static void audin_formatter_i2s_disable(struct regmap *map) +{ + regmap_update_bits(map, AUDIN_I2SIN_CTRL, + AUDIN_I2SIN_CTRL_I2SIN_EN, 0); +} + +static int audin_formatter_i2s_prepare(struct regmap *map, + const struct gx_formatter_hw *quirks, + struct gx_stream *ts) +{ + unsigned int val; + int ret; + + /* + * I2S decoder always outputs 24 bits to the FIFO according to the + * manual. The only thing we can change through + * AUDIN_I2SIN_CTRL_I2SIN_SIZE_MASK is the following: + * - 0 -> output[23:0] =3D {original[23:8],8=E2=80=99d0} + * - 1 -> output[23:0] =3D {original[23:6],6=E2=80=99d0} + * - 2 -> output[23:0] =3D {original[23:4],4=E2=80=99d0} + * - 3 -> output[23:0] =3D {original[23:0]} + * + * We use 3 here and, in case of 16 bit format, we filter unnecessary + * bytes at FIFO stage. + * Note: data is left-justified, so in case of 16 bits samples, this + * means that the LSB is to be discarded at FIFO level and the + * relevant part is in bits [23:8]. + */ + val =3D FIELD_PREP(AUDIN_I2SIN_CTRL_I2SIN_SIZE_MASK, 3); + ret =3D regmap_update_bits(map, AUDIN_I2SIN_CTRL, + AUDIN_I2SIN_CTRL_I2SIN_SIZE_MASK, val); + if (ret) + return ret; + + /* + * The manual claims that this platform supports up to 4 streams + * (8 channels), but currently only 1 stream (2 channels) has been + * tested and it's supported. + */ + val =3D FIELD_PREP(AUDIN_I2SIN_CTRL_I2SIN_CHAN_EN_MASK, 1); + ret =3D regmap_update_bits(map, AUDIN_I2SIN_CTRL, + AUDIN_I2SIN_CTRL_I2SIN_CHAN_EN_MASK, val); + if (ret) + return ret; + + /* + * Use clocks from AIU and not from the pads since we only want to + * support master mode. + */ + val =3D AUDIN_I2SIN_CTRL_I2SIN_CLK_SEL | + AUDIN_I2SIN_CTRL_I2SIN_LRCLK_SEL | + AUDIN_I2SIN_CTRL_I2SIN_DIR; + ret =3D regmap_update_bits(map, AUDIN_I2SIN_CTRL, val, val); + if (ret) + return ret; + + switch (ts->iface->fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_IB_NF: + val =3D AUDIN_I2SIN_CTRL_I2SIN_BCLK_INV; + break; + case SND_SOC_DAIFMT_NB_IF: + val =3D AUDIN_I2SIN_CTRL_I2SIN_LRCLK_INV; + break; + case SND_SOC_DAIFMT_IB_IF: + val =3D AUDIN_I2SIN_CTRL_I2SIN_BCLK_INV | AUDIN_I2SIN_CTRL_I2SIN_LRCLK_I= NV; + break; + case SND_SOC_DAIFMT_NB_NF: + val =3D 0; + break; + default: + return -EINVAL; + } + + ret =3D regmap_update_bits(map, AUDIN_I2SIN_CTRL, + AUDIN_I2SIN_CTRL_I2SIN_LRCLK_INV | + AUDIN_I2SIN_CTRL_I2SIN_BCLK_INV, val); + if (ret) + return ret; + + switch (ts->iface->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_I2S: + val =3D 1; + break; + case SND_SOC_DAIFMT_LEFT_J: + val =3D 0; + break; + default: + return -EINVAL; + } + + val =3D FIELD_PREP(AUDIN_I2SIN_CTRL_I2SIN_LRCLK_SKEW_MASK, val); + ret =3D regmap_update_bits(map, AUDIN_I2SIN_CTRL, + AUDIN_I2SIN_CTRL_I2SIN_LRCLK_SKEW_MASK, + val); + if (ret) + return ret; + + return 0; +} + +static const struct gx_formatter_ops audin_formatter_i2s_ops =3D { + .get_stream =3D audin_formatter_i2s_get_stream, + .prepare =3D audin_formatter_i2s_prepare, + .enable =3D audin_formatter_i2s_enable, + .disable =3D audin_formatter_i2s_disable, +}; + +const struct gx_formatter_driver audin_formatter_i2s_drv =3D { + .ops =3D &audin_formatter_i2s_ops, +}; diff --git a/sound/soc/meson/audin.c b/sound/soc/meson/audin.c new file mode 100644 index 000000000000..15824354abed --- /dev/null +++ b/sound/soc/meson/audin.c @@ -0,0 +1,188 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (c) 2026 BayLibre, SAS. +// Author: Valerio Setti + +#include +#include +#include +#include +#include +#include + +#include "audin.h" +#include "gx-formatter.h" + +#define AUDIN_FIFO0_BASE 0x80 +#define AUDIN_FIFO1_BASE 0xCC +#define AUDIN_FIFO2_BASE 0x114 + +static const char * const audin_fifo_input_sel_texts[] =3D { + "SPDIF", "I2S", "PCM", "HDMI", "Demodulator" +}; + +static SOC_ENUM_SINGLE_DECL(audin_fifo0_input_sel_enum, AUDIN_FIFO0_BASE += AUDIN_FIFO_CTRL, + AUDIN_FIFO_CTRL_DIN_SEL_OFF, + audin_fifo_input_sel_texts); +static SOC_ENUM_SINGLE_DECL(audin_fifo1_input_sel_enum, AUDIN_FIFO1_BASE += AUDIN_FIFO_CTRL, + AUDIN_FIFO_CTRL_DIN_SEL_OFF, + audin_fifo_input_sel_texts); +static SOC_ENUM_SINGLE_DECL(audin_fifo2_input_sel_enum, AUDIN_FIFO2_BASE += AUDIN_FIFO_CTRL, + AUDIN_FIFO_CTRL_DIN_SEL_OFF, + audin_fifo_input_sel_texts); + +static const struct snd_kcontrol_new audin_fifo0_input_sel_mux =3D + SOC_DAPM_ENUM("FIFO0 Input Source", audin_fifo0_input_sel_enum); +static const struct snd_kcontrol_new audin_fifo1_input_sel_mux =3D + SOC_DAPM_ENUM("FIFO1 Input Source", audin_fifo1_input_sel_enum); +static const struct snd_kcontrol_new audin_fifo2_input_sel_mux =3D + SOC_DAPM_ENUM("FIFO2 Input Source", audin_fifo2_input_sel_enum); + +#define AUDIN_WIDGET_I2S_FORMATTER 0 + +static struct snd_soc_dapm_widget audin_dapm_widgets[] =3D { + [AUDIN_WIDGET_I2S_FORMATTER] =3D + SND_SOC_DAPM_PGA_E("I2S Formatter", SND_SOC_NOPM, 0, 0, NULL, 0, + gx_formatter_event, + (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD)), + SND_SOC_DAPM_MUX("FIFO0 SRC SEL", SND_SOC_NOPM, 0, 0, + &audin_fifo0_input_sel_mux), + SND_SOC_DAPM_MUX("FIFO1 SRC SEL", SND_SOC_NOPM, 0, 0, + &audin_fifo1_input_sel_mux), + SND_SOC_DAPM_MUX("FIFO2 SRC SEL", SND_SOC_NOPM, 0, 0, + &audin_fifo2_input_sel_mux), +}; + +static const struct snd_soc_dapm_route audin_dapm_routes[] =3D { + { "FIFO0 SRC SEL", "I2S", "I2S Formatter" }, + { "FIFO0 Capture", NULL, "FIFO0 SRC SEL" }, + { "FIFO1 SRC SEL", "I2S", "I2S Formatter" }, + { "FIFO1 Capture", NULL, "FIFO1 SRC SEL" }, + { "FIFO2 SRC SEL", "I2S", "I2S Formatter" }, + { "FIFO2 Capture", NULL, "FIFO2 SRC SEL" }, +}; + +static struct snd_soc_dai_driver audin_dai_drv[] =3D { + { + .name =3D "FIFO0", + .base =3D AUDIN_FIFO0_BASE, + .capture =3D { + .stream_name =3D "FIFO0 Capture", + .channels_min =3D 2, + .channels_max =3D 2, + .rates =3D SNDRV_PCM_RATE_CONTINUOUS, + .rate_min =3D 5512, + .rate_max =3D 192000, + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + }, + .ops =3D &audin_fifo_dai_ops, + }, + { + .name =3D "FIFO1", + .base =3D AUDIN_FIFO1_BASE, + .capture =3D { + .stream_name =3D "FIFO1 Capture", + .channels_min =3D 2, + .channels_max =3D 2, + .rates =3D SNDRV_PCM_RATE_CONTINUOUS, + .rate_min =3D 5512, + .rate_max =3D 192000, + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + }, + .ops =3D &audin_fifo_dai_ops, + }, + { + .name =3D "FIFO2", + .base =3D AUDIN_FIFO2_BASE, + .capture =3D { + .stream_name =3D "FIFO2 Capture", + .channels_min =3D 2, + .channels_max =3D 2, + .rates =3D SNDRV_PCM_RATE_CONTINUOUS, + .rate_min =3D 5512, + .rate_max =3D 192000, + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + }, + .ops =3D &audin_fifo_dai_ops, + }, +}; + +static const struct snd_soc_component_driver audin_component =3D { + .dapm_widgets =3D audin_dapm_widgets, + .num_dapm_widgets =3D ARRAY_SIZE(audin_dapm_widgets), + .dapm_routes =3D audin_dapm_routes, + .num_dapm_routes =3D ARRAY_SIZE(audin_dapm_routes), + .pointer =3D audin_fifo_component_pointer, + .sync_stop =3D audin_fifo_sync_stop, +}; + +static const struct regmap_config audin_regmap_cfg =3D { + .reg_bits =3D 32, + .val_bits =3D 32, + .reg_stride =3D 4, + .max_register =3D 0x148, +}; + +static int audin_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + void __iomem *mmio; + struct regmap *regmap; + struct clk *clk; + int ret; + + ret =3D device_reset(dev); + if (ret) + return dev_err_probe(dev, ret, "Failed to reset device\n"); + + mmio =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(mmio)) + return dev_err_probe(dev, PTR_ERR(mmio), "Failed to ioremap memory\n"); + + regmap =3D devm_regmap_init_mmio(dev, mmio, &audin_regmap_cfg); + if (IS_ERR(regmap)) + return dev_err_probe(dev, PTR_ERR(regmap), "Failed to init regmap\n"); + + clk =3D devm_clk_get_enabled(dev, NULL); + if (IS_ERR(clk)) + return dev_err_probe(dev, PTR_ERR(clk), "Failed to get clock\n"); + + ret =3D gx_formatter_create(dev, &audin_dapm_widgets[AUDIN_WIDGET_I2S_FOR= MATTER], + &audin_formatter_i2s_drv, regmap); + if (ret) + return dev_err_probe(dev, ret, "Failed to allocate formatter\n"); + + ret =3D devm_snd_soc_register_component(dev, &audin_component, + audin_dai_drv, ARRAY_SIZE(audin_dai_drv)); + if (ret) { + gx_formatter_free(&audin_dapm_widgets[AUDIN_WIDGET_I2S_FORMATTER]); + return dev_err_probe(dev, ret, "Failed to register component\n"); + } + + return 0; +} + +static void audin_remove(struct platform_device *pdev) +{ + gx_formatter_free(&audin_dapm_widgets[AUDIN_WIDGET_I2S_FORMATTER]); +} + +static const struct of_device_id audin_of_match[] =3D { + { .compatible =3D "amlogic,gx-audin" }, + { } +}; +MODULE_DEVICE_TABLE(of, audin_of_match); + +static struct platform_driver audin_driver =3D { + .driver =3D { + .name =3D "gx-audin", + .of_match_table =3D audin_of_match, + }, + .probe =3D audin_probe, + .remove =3D audin_remove, +}; +module_platform_driver(audin_driver); + +MODULE_DESCRIPTION("Meson GX AUDIN driver"); +MODULE_AUTHOR("Valerio Setti "); +MODULE_LICENSE("GPL"); diff --git a/sound/soc/meson/audin.h b/sound/soc/meson/audin.h new file mode 100644 index 000000000000..7f3b58a780c0 --- /dev/null +++ b/sound/soc/meson/audin.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Valerio Setti + */ + +#ifndef _MESON_AUDIN_H +#define _MESON_AUDIN_H + +#include "gx-formatter.h" + +/* FIFOx CTRL registers and bits */ +#define AUDIN_FIFO_CTRL 0x14 +#define AUDIN_FIFO_CTRL_EN BIT(0) +#define AUDIN_FIFO_CTRL_RST BIT(1) +#define AUDIN_FIFO_CTRL_LOAD BIT(2) +#define AUDIN_FIFO_CTRL_DIN_SEL_OFF 3 +#define AUDIN_FIFO_CTRL_ENDIAN_MASK GENMASK(10, 8) +#define AUDIN_FIFO_CTRL_CHAN_MASK GENMASK(14, 11) +#define AUDIN_FIFO_CTRL_UG BIT(15) + +extern const struct gx_formatter_driver audin_formatter_i2s_drv; + +extern const struct snd_soc_dai_ops audin_fifo_dai_ops; +extern snd_pcm_uframes_t audin_fifo_component_pointer(struct snd_soc_compo= nent *component, + struct snd_pcm_substream *substream); +extern int audin_fifo_sync_stop(struct snd_soc_component *component, + struct snd_pcm_substream *substream); + +#endif --=20 2.47.3 From nobody Thu Sep 24 15:10:58 2026 Received: from mail-wr2-f41.google.com (mail-wr2-f41.google.com [74.125.225.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 780865616DA for ; Tue, 22 Sep 2026 16:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092901; cv=none; b=Q5PjUG6I6+9Dg3sXSO4vMPG5LTOCr46JEXLAC4pqiEKrXPDsH9ZCdBXsm3WOaSpiaiMqZCZIXfD1ofHIetYeFaCWapTzi7hGou5slCLMP8Ui8EPKqojcAd8WerM1MohpEjo2Pc+jQfrkKXF54Izcas7hIwErGtKpW2HCU0DGXRs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092901; c=relaxed/simple; bh=Uvy6WjK33Ql5QDc+7YeTX2qUEcUUi+n12SinkXVNwt4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IY2jTrZd+bY7Rt5CEV6m3YDuYLLc7lKTLBKQSJ9sE+16JOUNj4jSdQIfrNBq2ZI7rolDpwa07JgUHsT4cP0SIwNZF34D1Fo4ioUIBFSJW7GqTsnP/X+g69N2QJtmPTxFT83nwYk1lLofMXguAZW0iO9vmy6Kdm2CCClBJCwW9V0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=LZfDtRGD; arc=none smtp.client-ip=74.125.225.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="LZfDtRGD" Received: by mail-wr2-f41.google.com with SMTP id ffacd0b85a97d-4834977ae75so72234f8f.3 for ; Tue, 22 Sep 2026 09:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790092896; x=1790697696; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0a21Y1nKSOFECTC5sqA3T0CqQ+Krc+hIIInAv6Qgnz4=; b=LZfDtRGDSMrwexcOSCtj1QggG3vEOiN3TYALWyKQeONa2O+x2wdZk2R1E5lpOpgkxn ZBhDYKJHNmogNg0r4H5pelejJgLqW4wg0jC98MqG0yphUq+OZJ3x6wkrUC9vAPMdBKIe t8HSJr+3H9tZ9ov7+YlfZiPw/rQlaIxJMO3f0v1E6UMC5XvWS3BgzqS5833BaNhxHK/d A74X8oebk7fJtBQKszMkhor+0Y9kpTnvX5VFflTWsAW8IDFb+PmZ/QKX+xoClWIdh1T5 9QQqBSs8hZRK2w2aGo6GFRh2N0fa0HA2tQCIoDN+aX0nLyx+16xKCmmm6dcXbP5ePHG5 oJHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790092896; x=1790697696; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0a21Y1nKSOFECTC5sqA3T0CqQ+Krc+hIIInAv6Qgnz4=; b=BZ3ZbTeAVKyv/YeMoYAbjPcqgoG1u6NiGqO1x2V1BK2ShB7Dh1HzYL2AmFaVILE+yU MshJvTfV9gXMjUtv6fFa0gs6IInMASV7A0pujPFRCQ4VkmwuPUBHNbyZH3ANJsJM8VHg DALLL65nt1tqFjF3EUjiQoiF/y5rn78T4+EBzQbGKx1mO9teQGU85XbXIp4RcfE/MJIq D2zR+kH3kmUItCqzcQLXmDbUt418iU49EMQF/bpYrTVEPHqJlfDkQEG1sfWjU7LbN0PE dvqBGDVANJrnP2JOoU2Ue4TFO6k6yVuXT+s1ovToVenXevcIWzTDIILjvgAMs2bmc+/8 enEw== X-Forwarded-Encrypted: i=1; AKwUvBxltPqd2zkdq28SBlJCKnC/3KwFpi66IN1UwSeitz//4qX79kurs34MhinU0lomnt7Ax6zSSImmJ/OTMEE=@vger.kernel.org X-Gm-Message-State: AFuF++kdj0ikVXZl3mxDlcAB0qQ/hm2tVETo0vi7vmYfzMjQlc2ruBXv DEMR3tyjs3hL8IPpQ6U73ATml1cNC6+BCDm/pnsRh1fyBaioPqMI9uVgf9BdRa+x8fo= X-Gm-Gg: AYBFou0fmUerht5OlTqXHgEZGNId2POVeVXmPJnlLwdLaqOYWTjiwZGO/5l5UpHx+60 HO+9kI61mMity6f4xpc9FRtDT3MceI3nO6M2Gb+op8mKFN24pZ7r2Foe5hOvMRaq5msVdwfwiXg 6+O7Zi+QgSpOmCTeDIeQrsRDJ6jbzsdOA65bUIY23cyX6VuWUNV9FjhDv5fIIDQGW5wKDaQYjVx JEG4h4A5ej7kzVfXGOhTxH2ED+XrpDwFRCdhfw4jxgxyJgZSnnG7vwai5FMUTmh3+uadH2OkqF0 f9RDWt6TpPzhFYp7MbD4M4F1yZmwsnaXsd6BexM8VjkCUbJ6EtcuT0YYVy4vJPR9EAB+jNZRd3S BsqmRHYB/xNHm2xPHf07d5cze16lLvMqxb/BkC5E0c3IVzI0Se7YNIaBQIifgMHDvjJfjtzY4Fm iuzlkBm3N/HO+L23fCX8rSBi4Sd4ZxyFjWODwMTTAFZwWpdSCeZv3+Om124U8ZJ4iwQJc= X-Received: by 2002:a05:6000:491e:b0:487:27f6:a4ce with SMTP id ffacd0b85a97d-4886708a7c7mr50365f8f.30.1790092896498; Tue, 22 Sep 2026 09:01:36 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48862786dc2sm6118020f8f.25.2026.09.22.09.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:01:36 -0700 (PDT) From: Valerio Setti Date: Tue, 22 Sep 2026 18:00:50 +0200 Subject: [PATCH v3 5/7] ASoC: meson: aiu: add I2S Capture DAI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-audin-v3-5-a760312c076c@baylibre.com> References: <20260922-audin-v3-0-a760312c076c@baylibre.com> In-Reply-To: <20260922-audin-v3-0-a760312c076c@baylibre.com> To: Jerome Brunet , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Valerio Setti X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1725; i=vsetti@baylibre.com; h=from:subject:message-id; bh=Uvy6WjK33Ql5QDc+7YeTX2qUEcUUi+n12SinkXVNwt4=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFmblkVtm8ch7b+rdEeF24O1qxX7Q+9OCG6Yalu1deMbg cIFkROWdJSyMIhxMciKKbKwTL/3u6BU7aFxwskCmDmsTCBDGLg4BWAiURwM/10Pswef6OL78Of5 qanpLsULSnRd7qvUHAub22fQI8gbZ8PIsG7x0a85R2YGzDt56vFKLyubu5IFe0KFeTfUH4mPtrj QzAEA X-Developer-Key: i=vsetti@baylibre.com; a=openpgp; fpr=0497DEFB707526E13360C970DE4B936DD13A0100 Add capture stream to CPU_I2S_ENCODER making it able to handle both playback and capture streams. Captured data is formatted from "audin-formatter-i2s" widget, buffered from "audin-fifo" into an internal FIFO and then bulk transmitted into RAM when the FIFO is full. As for the naming of the stream "I2S Encoder" is kept as base following the same pattern used for the playback stream and with the goal to minimize changes. Supported format for capture is currently limited to S16_LE because it's the only one that has been tested. According to the manual also S24_LE should be supported, but this is kept as follow-up. This capture support also takes advantage of the following commits that has recently been merged: commit df3c987ab3d7 ("ASoC: meson: aiu-encoder-i2s: reflect bs quirk in hw = constraints") commit e82159384a50 ("ASoC: meson: aiu-encoder-i2s: use the core symmetric_= rate handling") They ensure bs_quirk and rate symmetry across playback and capture streams. Signed-off-by: Valerio Setti --- sound/soc/meson/aiu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c index 535fbf7c1639..14d0e20a4bd6 100644 --- a/sound/soc/meson/aiu.c +++ b/sound/soc/meson/aiu.c @@ -153,6 +153,13 @@ static struct snd_soc_dai_driver aiu_cpu_dai_drv[] =3D= { .rates =3D SNDRV_PCM_RATE_8000_192000, .formats =3D AIU_FORMATS, }, + .capture =3D { + .stream_name =3D "I2S Encoder Capture", + .channels_min =3D 2, + .channels_max =3D 2, + .rates =3D SNDRV_PCM_RATE_8000_192000, + .formats =3D SNDRV_PCM_FMTBIT_S16_LE, + }, .ops =3D &aiu_encoder_i2s_dai_ops, .symmetric_rate =3D 1, }, --=20 2.47.3 From nobody Thu Sep 24 15:10:58 2026 Received: from mail-wr2-f12.google.com (mail-wr2-f12.google.com [74.125.225.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37193280CD5 for ; Tue, 22 Sep 2026 16:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092902; cv=none; b=QkzdVU/pY6wVTF0gzGjAkcu4PyC1TmdxZZ4R/NUghrqUynwIEYnU1GxtBrKjsWAwvMzY+VTH/ktTPuV2g39Dspkuze3RlxhMuUZqEzjzyjCR6V+bR9d6o5Nim4FzV2H2OnUJdIcSrj1ENU16QrsOclxsQyMtpxJAThXLdoOqiNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092902; c=relaxed/simple; bh=vu+Bm1uBGIa5rQR0KJvCXwwxy1648qk7OnTjRUBnopY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cOiGeX7AmoRz7dTOFW7v5xScvO+eLZ6sRBBXMM9x/AAbwRIDC/o8XvWFyKomn2XL2Az9Ljz1lIVKkEgZyYvy8uzyazZnsW3SdJp/UANCas0HgrBL73oR97eT5WvurceiE/ft8vQHkl2mK2ufqrB4r+dZCKJ3YyesI0s9TUbPKWY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=YrqyvQFq; arc=none smtp.client-ip=74.125.225.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="YrqyvQFq" Received: by mail-wr2-f12.google.com with SMTP id ffacd0b85a97d-485ac898fa4so101058f8f.0 for ; Tue, 22 Sep 2026 09:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790092897; x=1790697697; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pQfq1mATHoXVEi2yZgGnZpynXkHV46ypp/DnWHom6Nw=; b=YrqyvQFqX+CXerrr3Qj5RMzqfJqWqQyomll9sA8w6/GNZaXdEoQzyi7jqiyO5fO9a8 s1tVbOxpBH933YjUrneWc8WNgyMo5oEkyViq3B9dKBR+cxXLhhifzVczM5Dn8VKm8dcy 8o8Nq3Wf3z1AHK35FwJuFIUtDR2yqxW1By4TV0Fwj5iZr3WH5K7SChSACKyvE+d50cgy 0wNq5xVplAt2UQuWjKCelSz96HEA5AJ1a6pqE9XJKCog0CYRF0WNdDyHSFojHuere25t 0BokCsKOfdh7gBTROj9DZty/d39h3yaqreTBP3B4gE1N7JdFoVcF5C3nJAIXTdfgFtAr AbZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790092897; x=1790697697; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pQfq1mATHoXVEi2yZgGnZpynXkHV46ypp/DnWHom6Nw=; b=Wi4Kc88rgDcZ7fAOmZnty0nTG/rE40mNkOHv9Z6VPt3hE5/55UTjujYK1wEBHCFGKT eCnr9sTA3hgmgdRhflA51TNsWR7/XxFviak4OM235oV1dEyN8dObVGFF+bg5BZ5dCGv6 vcwUszvN/njpApgM0UKV5eqmbnz55puXHSBpt5og9D0VK0rdy4EEgeW6kxrQj11HgXZ3 dToMj3YFScApE9ZbPhps1chRaoYDiIJr6KYVv2ZED+hqSLOBKplEDVGijOWtzdfF3Rst nEmLX4f+zK6Y2veCAvxZpr/7p8ofIfTSlHnS4du9vnvWdU3sPlNDuxAouztxfuKS3nJU 1rgg== X-Forwarded-Encrypted: i=1; AKwUvBxB+xgj7N1rcI+TEqJhTySwYBHL3witSkqD0hSbZyAVwL0yVp5GeZIWsSM7CsMdVpjsa4bTtI2sR5HXWSI=@vger.kernel.org X-Gm-Message-State: AFuF++n4yfDZZXAppH6Nbny+gd6TIci8JPZ3s08oEi5MsXF3YnfmXrwB laJjaI3lz8G7jkHegOzS+/itEEI7bkEBxhpam+siX79Jld1gPGCwtXfD9NP6OzXJnIo= X-Gm-Gg: AYBFou2RpRAlKKXx8D/4lu+MebIb8OTGzh9cfqTwc6vL1dLcqBQoknzZ2/yIN+uW8ML G0BEHCF9DeB8pun8JUIvlDA+2CiqwMm9XrYPYwc4tiN/F1Vy7YHRV4SUDZiCLQ1OPtO0nSjruN1 Awqa8iPPvZBQQawIYzASTaTVFK0o2Eff8s5pJ/pUjoXCR5KsWSDVuBZ/S1AJlQq3ykYG4U0P2eZ rELJzKxRo6iuAkk43ByR89RgHwy67b3JZZueNvTsCZzgqSNJsEI1tCpCb4+2w2iADWb/5TSendu Wm6791sSWIHuw8ha+V5fLK3Mv8JYsaOGatrf0azyzwAWpZe3+LAxrXQAqwKVMeuooW+4iPpJrO0 YPglXqH//I1/Sd0A1jI6mm2aE7X7Gzsyi8r2H2DJd3JGm4c1m2ooJxC6IdB/2CvNOpxbtRasfG0 8Rz0Qh7pAg/UzyFRzh5aGmFm76u/wkLgyJUa+SJQ8MiIAFSPKGOGl04md0Vg1HPHQzlg== X-Received: by 2002:a05:6000:400c:b0:487:951:20 with SMTP id ffacd0b85a97d-4886709c990mr52052f8f.46.1790092897354; Tue, 22 Sep 2026 09:01:37 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48862786dc2sm6118020f8f.25.2026.09.22.09.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:01:37 -0700 (PDT) From: Valerio Setti Date: Tue, 22 Sep 2026 18:00:51 +0200 Subject: [PATCH v3 6/7] ASoC: meson: gx-card: add support for audin FIFO Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-audin-v3-6-a760312c076c@baylibre.com> References: <20260922-audin-v3-0-a760312c076c@baylibre.com> In-Reply-To: <20260922-audin-v3-0-a760312c076c@baylibre.com> To: Jerome Brunet , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Valerio Setti X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2156; i=vsetti@baylibre.com; h=from:subject:message-id; bh=vu+Bm1uBGIa5rQR0KJvCXwwxy1648qk7OnTjRUBnopY=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFmblkV9nDbpoPCsi3wfGe85eb//3veLqzqv8vL9f77H5 Bb1XNC36ShlYRDjYpAVU2RhmX7vd0Gp2kPjhJMFMHNYmUCGMHBxCsBEnh5jZJh8PLx+x5Kkf4En tx3hcQq7ZN6dfHP+huW255scDDPPzZrM8M/y5f8Fz2ObGJ+5Zcr1de14Pev+GRfHepXq9HTff82 2HxgB X-Developer-Key: i=vsetti@baylibre.com; a=openpgp; fpr=0497DEFB707526E13360C970DE4B936DD13A0100 Slightly modify "gx_card_cpu_identify()" by making the compatible matching string an input parameter. This allows to easily support also AUDIN's FIFO with minimal changes. Signed-off-by: Valerio Setti --- sound/soc/meson/gx-card.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c index 932be0a09306..35bc47254752 100644 --- a/sound/soc/meson/gx-card.c +++ b/sound/soc/meson/gx-card.c @@ -66,10 +66,10 @@ static int gx_card_parse_i2s(struct snd_soc_card *card, } =20 static int gx_card_cpu_identify(struct snd_soc_dai_link_component *c, - char *match) + const char *compatible_match, const char *dai_match) { - if (of_device_is_compatible(c->of_node, DT_PREFIX "aiu")) { - if (strstr(c->dai_name, match)) + if (of_device_is_compatible(c->of_node, compatible_match)) { + if (strstr(c->dai_name, dai_match)) return 1; } =20 @@ -96,21 +96,23 @@ static int gx_card_add_link(struct snd_soc_card *card, = struct device_node *np, if (ret) return ret; =20 - if (gx_card_cpu_identify(dai_link->cpus, "FIFO")) - return meson_card_set_fe_link(card, dai_link, np, true); + if (gx_card_cpu_identify(dai_link->cpus, DT_PREFIX "aiu", "FIFO")) + return meson_card_set_fe_link(card, dai_link, np, true); + if (gx_card_cpu_identify(dai_link->cpus, DT_PREFIX "gx-audin", "FIFO")) + return meson_card_set_fe_link(card, dai_link, np, false); =20 ret =3D meson_card_set_be_link(card, dai_link, np); if (ret) return ret; =20 /* Or apply codec to codec params if necessary */ - if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) { + if (gx_card_cpu_identify(dai_link->cpus, DT_PREFIX "aiu", "CODEC CTRL")) { dai_link->c2c_params =3D &codec_params; dai_link->num_c2c_params =3D 1; } else { dai_link->no_pcm =3D 1; /* Check if the cpu is the i2s encoder and parse i2s data */ - if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder")) + if (gx_card_cpu_identify(dai_link->cpus, DT_PREFIX "aiu", "I2S Encoder")) ret =3D gx_card_parse_i2s(card, np, index); } =20 --=20 2.47.3 From nobody Thu Sep 24 15:10:58 2026 Received: from mail-wm2-f12.google.com (mail-wm2-f12.google.com [74.125.225.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 312B05625FB for ; Tue, 22 Sep 2026 16:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092902; cv=none; b=pSa85QDMGWz9n62QUBM8Qz/Ujv1f8GqLkp/VGaRYGQ6aMSkWPcythCYpl8PUbF3++5RVg3J4lpYRlSACZ9nPTM6/3mjs4D3iHfXv6pA3C/+fG3bon6qQMpCwM2jb29q0yzf8Ym864azOVN6q95KOq6GOe/FGFyKjh7wfmG8zHUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790092902; c=relaxed/simple; bh=TZWXiYpGe3PgSXyHXeQpQDxriAYLZIkbRgm507qkSqQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pgty1QLT7asLiHgd892LgDxPo2Alb1og19ymwRCCWg9LbTdIk4p9zxyDqU69wEE/4zcnHv/KT6GAPYCVAp5JWj6vb3zs3z+aUsWjNh15hihnMl+tiWzIxghLnY277Qp2suZ+0oAus9Keovp0/HijW/XlZQ0DKMOsADfAGLAGQmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=EvSLqEtG; arc=none smtp.client-ip=74.125.225.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="EvSLqEtG" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49cd4ba9f68so57835715e9.1 for ; Tue, 22 Sep 2026 09:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790092898; x=1790697698; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OrTs8R98RYpxja2qfNL5l+wSlcq0HfU9S2hHFoYZzL8=; b=EvSLqEtGPHpxPy4Sw8qtL5Ih9TQCv4qaPRn0hPJ4wQF/s//LGPB3H2lBf34pulVbva QKzBiSJYiseJA2g8aXMD6eilM1oAAHPS2Ockkk949SAQ6zOavkBLgJv3/en+fIba/63M 3MMPZjUgixNHYg5WrXmVeBrHHMV56rqX/+APoJMmhAw3zbpNECjlDLW8C9DURHzIQyuE BLOIXlozE8Gu3ALri5STVf86/0mOZnArjVjXpLZFNvXPow40epWGDxHSo7UBMvqYrean 5aIBUFWYv7u0Z5YH2Ra/DSlGMp3eFY6ItFd6QlJe7XIDJdQZaA7/sXcy2DVtprgbewQy FstA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790092898; x=1790697698; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OrTs8R98RYpxja2qfNL5l+wSlcq0HfU9S2hHFoYZzL8=; b=f1B1p75NnVkDQoy8gmkDRva9F3ear4VufdufSRUlmuvbFhtMNWj1oEaKg8lOpEZo6d Yig8aeTUmwfAa5FXFAP4WNhz41aLYuk6/xywXlgWmfFWBSf++GWUR7OrJPgd4GFW4INi crgcT+RH9L6zEtCh4RzEO2qZSOxYAuGobzaK4X30mhwrTdyBnH3XseD4TCuc/EA/Sm+p 0+RgC76lx96V4SeQhbhHr0KAkvkBv/VOHubgifumJt6RrrDiLb5T63wh2WThajfaSv36 a2LtFTyJEwWz758SutK+pwDOON19p+foUdZB6atKJnRRGKIYZhT46TUgT1Uyjs96prpt 0bng== X-Forwarded-Encrypted: i=1; AKwUvBwiukQ0GbghtuK9EFdMrqhWUeNRind9IgBHxyAGFIgJW2oycB5R4pibWQdcsNdJI7WO/pmLE7Jl3/YzVTM=@vger.kernel.org X-Gm-Message-State: AFuF++k+Tgc6wuo54jueXvHGQGXH4m9yiDD1dVVDKmxD9hwk16utykjJ b60MWeR67wZU7L/UkSVKgit92GM4m2tuEJpZO0zmxjtIbKmh+/CnqGM81wwh+MaoJTo= X-Gm-Gg: AYBFou31JkaBzHjMz/MxSXHmE4LzmctOLLDp4ExrrpkKI/4lQv8mWRb8dYqVjhuoV94 Qu+2jZhzIQNkkxLHwmOFUYTx7AhI1RkYBCGmgzYIA7fRfTQYQ7pQwr7dr7JwUztaKA1XdwOW7sp tFiaAdE6uM203fIPcICgG6TPZE61lspUZjddy08SMm+Hyh70ChP1ZnpZnaByP7MGi9QVYllIgfG I7nlFXS+IjTERNkoRLx8d45nTCxZV/fhkOkjYVt5R1LrklzJjCFdEO3EojoQ/rgbAVnC6x3PxRI O8agArNQJvUoIaj8GEm0qSYet6omoEqFg8FKTNF75AzDUCHNm1wI8MlQB7Sjci0kwthpLIQ8/uc //M6stqmIDrpzY+JGNmZU1/XT935/XWh/3nlqvtfzxNVtSTWWyigGzaqre3zd++xE8amIHGZ1OL gaxrEBQmBgVeFXu3tIA3Jyc4XgsRp8WTIrQ385G/as36jffbhk3wmx5DNdiAhcfejbNg== X-Received: by 2002:a05:600c:37ce:b0:49e:799a:8952 with SMTP id 5b1f17b1804b1-49fc5743c81mr211815845e9.26.1790092898289; Tue, 22 Sep 2026 09:01:38 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48862786dc2sm6118020f8f.25.2026.09.22.09.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:01:38 -0700 (PDT) From: Valerio Setti Date: Tue, 22 Sep 2026 18:00:52 +0200 Subject: [PATCH v3 7/7] arm64: dts: amlogic: gx: add AUDIN node Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260922-audin-v3-7-a760312c076c@baylibre.com> References: <20260922-audin-v3-0-a760312c076c@baylibre.com> In-Reply-To: <20260922-audin-v3-0-a760312c076c@baylibre.com> To: Jerome Brunet , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Kevin Hilman , Martin Blumenstingl , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Valerio Setti X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3080; i=vsetti@baylibre.com; h=from:subject:message-id; bh=TZWXiYpGe3PgSXyHXeQpQDxriAYLZIkbRgm507qkSqQ=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFmblkUluVq2notODD5885mM8wnW4gkfrmuWbj2g/WZV3 jkRm4BbHaUsDGJcDLJiiiws0+/9LihVe2iccLIAZg4rE8gQBi5OAZgI30GGf/YJqwxtZTav1WHf IHpv+n120WDjmKciN9d/vhsdFxNpacfwV6bGgXeD9emgB0cmu0q4L9Q0DGix8TRbL1T96nVa9Jf jbAA= X-Developer-Key: i=vsetti@baylibre.com; a=openpgp; fpr=0497DEFB707526E13360C970DE4B936DD13A0100 AUDIN provides audio input support to Amlogic Meson GXBB/GXL platforms. What's missing after this to get capture support working is to connect a capture capable codec to the SoC. For example to test these changes an NXP SGTL5000 chip has been connected to an OdroidC2 (Meson GXBB) board using a custom hat board. The following additions/overlay are required on top of 'amlogic/meson-gxbb-odroidc2.dts' to make that hat board to work: &sound { audio-routing =3D "AUDIN I2S Formatter", "AIU I2S Encoder Captu= re"; dai-link-1 { codec-1 { sound-dai =3D <&sgtl5000>; }; }; dai-link-3 { sound-dai =3D <&audin 0>; }; }; &audin { status =3D "okay"; }; Then, from userspace: $ amixer sset 'AUDIN FIFO0 SRC SEL' 'I2S' $ arecord -l # find the "FIFO Capture" device $ arecord -D hw:0, -f S16_LE -r 48000 -c 2 /tmp/in.wav Signed-off-by: Valerio Setti --- arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 9 +++++++++ arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 6 ++++++ arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dt= s/amlogic/meson-gx.dtsi index c1d8e81d95cb..54b6cc0bb8ff 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi @@ -436,6 +436,15 @@ watchdog@98d0 { reg =3D <0x0 0x098d0 0x0 0x10>; clocks =3D <&xtal>; }; + + audin: audio-controller@a000 { + compatible =3D "amlogic,gx-audin"; + reg =3D <0x0 0xa000 0x0 0x148>; + interrupts =3D ; + sound-name-prefix =3D "AUDIN"; + #sound-dai-cells =3D <1>; + status =3D "disabled"; + }; }; =20 gic: interrupt-controller@c4301000 { diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/= dts/amlogic/meson-gxbb.dtsi index a9c830a570cc..7ad69992a226 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi @@ -84,6 +84,12 @@ &aiu { resets =3D <&reset RESET_AIU>; }; =20 +&audin { + compatible =3D "amlogic,gxbb-audin", "amlogic,gx-audin"; + clocks =3D <&clkc CLKID_I2S_SPDIF>; + resets =3D <&reset RESET_AUDIN>; +}; + &aobus { pinctrl_aobus: pinctrl@14 { compatible =3D "amlogic,meson-gxbb-aobus-pinctrl"; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/d= ts/amlogic/meson-gxl.dtsi index d5e0f72892f8..9181eba81eb7 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi @@ -100,6 +100,12 @@ &aiu { resets =3D <&reset RESET_AIU>; }; =20 +&audin { + compatible =3D "amlogic,gxl-audin", "amlogic,gx-audin"; + clocks =3D <&clkc CLKID_I2S_SPDIF>; + resets =3D <&reset RESET_AUDIN>; +}; + &apb { usb2_phy0: phy@78000 { compatible =3D "amlogic,meson-gxl-usb2-phy"; --=20 2.47.3