From nobody Fri Sep 25 01:20:26 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 36D9F3FFABF for ; Thu, 17 Sep 2026 21:02:42 +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=1789678963; cv=none; b=eZkqRlqS/DCh18nqtm4ic9jmasY1oACaN53iZpff16T1go1+EgG+Ieb+p1Ay5xP0O6XWEYr+/Mn8y6RdZ41GRpWX/hsh9Hk3oeOUAjeyLvwhC8+7qSIPhCDj8oymGlQali4nUFNe/gzdE0Ef7fcU3JrUQzF1mP+IX2LgTgD4IM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789678963; c=relaxed/simple; bh=8xj7kUdGgsVPCmxBLgs3dFbkoQPLuPzp6csuOKCL82I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HwpArOnsLM6nOJyvYcqfE7zUssAbGGz37gy/8DjNMUAGzA5Ck8QZ1y076wdSpnVNNF8E4zNfVk0pN8/7PioZxPOHDirvk9sp0Vu6ve7p+q+eoMu96YTtV+6PsjfA7E3zewmmDQ3kr+AT2Z6rM4z1nZq7SILy5v99w3eVY3d4mMY= 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=a7VWaH2Y; 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="a7VWaH2Y" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49cd4ba9f68so969235e9.1 for ; Thu, 17 Sep 2026 14:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1789678960; x=1790283760; 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=9AZ0+eI++/PlX83+JWP2Cs841uENpnsQxPBRefFFlIk=; b=a7VWaH2YtBBOzNNg9O5oBuirnKPuT9q6Shtnl2c25hnivyG8HheSxYJbAXjYhkrZ1d 45Gc8+wVZn6xM7tyiErDO41hQgAwK5C8165JpuGJITkVn/U09koKoLdIc/aOIaFWClHp LL5Ka3JlqHpPsIGJcsp/dyXW65Pel5RlukokTd++VpcL22weOaHzr9MX1VE8y99249rr 8ewTl6CUsBIFXpVy5CmymXNpgYU19SW3ggF/AzJ1/zTxGN01yBCKiOU6dRwcWA8TtD80 xqJAv2JIgHq66wKJRwZA1k1lwgXxTNiW8E5i2LM1ymC4urYEH2cp4tpMAehjg6bdAZ53 UXYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789678960; x=1790283760; 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=9AZ0+eI++/PlX83+JWP2Cs841uENpnsQxPBRefFFlIk=; b=ADgVsRQI2NdVyBqDanbDECmLYb/Jh+o7hn5AH82BS9Pn6QHwmvnVxCDF6YijUi2g8f FBEGr5sX0DL4svHQbeWuGQlR5GlW7NdwHxahYqGPz4PVm0uxTpTNVEl5RdvoztlqxWKE JAEDIhXG+FWrZn+zu9jukPusNGH/gGk5lLLvmA6yhDGujGbMm8No7K+log2d+m1M5oxG Gat6NunSglVUXF2MoUmGTE7oIM02+zCAPMuWZN5gSI+zForWsNNFoHTTTYPg3WzuVLBI hpwvODn0JqXGbkmvkR3FFrml0+AvDtZS9XxMsaX4MBBXx6XagBvzcw821IrQSX5eeuBH 8EAw== X-Forwarded-Encrypted: i=1; AKwUvBw/cOZJah85ecClxXQpaLF9aTgbDg0rOXGKE9bWbyFUuBqzqPgwk0dfm3hboqJCBTiziz/+MkBtyw8hdkM=@vger.kernel.org X-Gm-Message-State: AFuF++k/UP2rm2JGNUcTdF0eMqzxz2GdmuyCrFFEqY1qBKip1W6F9wnq vNc9aFPpRAPD9cDb1qky9UClG64o35HDNV5bncWfvtl6Ty0hxU/4VnyZlYEWnbqC1jA= X-Gm-Gg: AYBFou03wlQrbCgZj8KQ6+fmZsvoZi3ktjUGH4vSX4ox715EFfZ41NSyJRIZTgnU0/x MYpD4Kk9wvxRPRX2ahxQ60+G9vp/fX5j1H5uUVFOylOKYYbbk9IiR8r/BnU705NRPCBAbCmfmWb JNiChGG8bzPcK2emwVnq81xMEPDrI5OyeXTIQAbrpPAUtwT050jURvD893e2ih0QNroPTj3+xdd hahaS+5S34JF7BTYa6t3/Y7uhzD+3pHRJGsUFG3yGl9/Tf8hyPmFRl+/Uoi80bZso91WgZYaLGU UOy7EenQ2u5Hss4LULGAuQbrRGpG57cWCd43A72xOHNYZ8f6D+x1R/UTq1bKgzg+xNnQ8C0Dwcq aTgXFiNVa1BmP6uXdMhW91HX1NQv8U5LtcHUqLqFPF1v6PUUwpdHIT7pTex6pQDm/W1DOqsmLPR UE/4uk4tqm0wnCJkWnu/ZTTvVwiypcL+PlVQwmLXpm3Vbr/Xe1D81TcYA0vLU1AW2Elg== X-Received: by 2002:a05:600c:354e:b0:49e:6bc7:4e1b with SMTP id 5b1f17b1804b1-49fc56ef4fcmr2059135e9.15.1789678960500; Thu, 17 Sep 2026 14:02:40 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fc5755c40sm3106095e9.3.2026.09.17.14.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 14:02:40 -0700 (PDT) From: Valerio Setti Date: Thu, 17 Sep 2026 23:02:31 +0200 Subject: [PATCH v2 1/6] 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: <20260917-audin-v2-1-38de4bc1de34@baylibre.com> References: <20260917-audin-v2-0-38de4bc1de34@baylibre.com> In-Reply-To: <20260917-audin-v2-0-38de4bc1de34@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=2321; i=vsetti@baylibre.com; h=from:subject:message-id; bh=8xj7kUdGgsVPCmxBLgs3dFbkoQPLuPzp6csuOKCL82I=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFlrQnP/iLUayjLtvv3w1WaL+o6/q3gtS730b2x5bv4nd NEio0nXOkpZGMS4GGTFFFlYpt/7XVCq9tA44WQBzBxWJpAhDFycAjCR1lBGhhv/lF3Dql31FD5P 951y7UhLXb9bXqdBKoNG8RaevrMxhQx/5e75/EuWX26jUxHwt4L/5y1eLaYPe2wDn4ooN2QzxW/ hAgA= 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 | 66 ++++++++++++++++++= ++++ 1 file changed, 66 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..76e6a6ddef36 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/amlogic,gx-audin.yaml @@ -0,0 +1,66 @@ +# 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 + +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 Fri Sep 25 01:20:26 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 444B4495AF4 for ; Thu, 17 Sep 2026 21:02:43 +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=1789678965; cv=none; b=i0CJjHDxqrWUkWet5JyNPs4J4P8/jylThl9ZUsQo1cVWqTdLGfeqrfpzTXEGKvyKOx15Wx95cVYYwM7k5pwZpLBxwFHhglKSTSbOsPjumACr+Onc8NoXDEHtwkeDfaoeBs6D0Q4Ze92cIDox4ghtKLt0QyE7M6hNinaNe1lOWMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789678965; c=relaxed/simple; bh=QQUrE+DwZ1KWpqLSQpoA8URn9azrBBw3jC33CI+5l4Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dFqxqG3CnUmlrVwOc3Yh1UB5ZSU1JozF4JD123c/4gZ9EOm5pOGCM0nJKddqDl9C3nwIxgSrzxAMDrO7nvvf+GUVlY6MK14v6xfR4yP/jtIP7B5dz8Hd3Kr0Dd0Nu/8gKxU1ldZqRYa3vty5kGL6PzapNhE1wiv0vxA9x4Rmcr4= 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=kvMRcmRq; 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="kvMRcmRq" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49e620fa473so515265e9.1 for ; Thu, 17 Sep 2026 14:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1789678961; x=1790283761; 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=kvMRcmRqM3DL8mI5LTcS+zb28kEG24CbsM+8fVvbf8mXh+RTGiMrkPCCEtGozIWgLO 1bydYgn0WBOW9DaHmq9es5yrmM9GvFNlymBFBY2+C1qXtHoiE3heRxOBTxDv0SgwF1zM r3qjRXwr+j6/zBEnNdlI0PAwu3Fch19NqKGr3hCWjTTpvXvsOfMQ5vAJe4gTiBVVT/il EGVXjwV9w0bZf73kZbJE/hmqU+dkcWMeH/2PdNfXy527xk9BTykyhO9a6o/JsfdWUXso /3allJYPE547ttQHhU7REsX8KWDUSbAdywX91VcCpMw9GnuXD/xWvrkxQb621oLhVn3u K8mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789678961; x=1790283761; 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=aNp5a+1eTFITo6eKf6PS1NIMu9C1pvwn7giricou3SYJevy1Y0ac8SroH7SK6DOE7O n24X4Un4+fWsUK6fwGEHY74jZUAgwpszM1Rkm/MIvRO68zEuM5Gc8Kjzg42ufbpMcicw HbS/ibPxP6hXzD8oGN1oP0fhIodnvNDzNKNIteo3QTel4oYBIBh+CS6I4NT+aDnH42aE fQ5Q+WG7U22VHhrYw5TV1ugsWEn7xkfxruaLiVbByHGrlq5yhETLMWRwoMe0CyjeFQKl g0WwqcdzhGmhM0m+DpUVxT+x1J33SMpaMfp1mPxl5RyWPFNcnBwsY5TNqahwrCgCP19K mLpw== X-Forwarded-Encrypted: i=1; AKwUvByCoN6yX8lh039wzmn0m7OK8M/3/z2woVJbHDWs/4NS91okAOp3VYxUvg0KgrgZn9Js4oACuHZArbpu8ig=@vger.kernel.org X-Gm-Message-State: AFuF++m1KCLaOLsvdxUZdEDKw8IcLlrggWh2UNWYX3ta3ZY/2/8DQnwL 8OIuvZqSkDj9/knpltX6WRWxfg22h+REmsDxiucfhms1huobwvobRhmD/sbk3tIA5RM= X-Gm-Gg: AYBFou3O65+rMvR+B6B0FClSwyodC3/eNlCuMbGPaR7JSrs9ovQR3y3f08g7b/pUcvP U18Z3Gsscs+9YjYxwhqbEmgikWvosWQDdJI8QL8Zm2/pGeQs5q3lhNzF80W3ytktciXww9toeRb nMFD3SKCu+OK9iDThNkWcPCv7NQRF4/YvL5MUBotEflUCoy+6LwDfrMSCtroTk57vUU7Ams1R3p UYr63uenBJJ5Cj8K9w4+SrcJ82r0jHX9HA7fkVlYG4TSILuWV5gKYnFKsg/4j367YSHjKMBE9sr +Q8PjdvnoZjFBQVrjQ2FpcbqdWrlGKm6VTfzgzOpfD1kCdEnyEcDkAZmLKFbxax6DyvHqbyDwrs uQcs0EiIwQxIjzcRSGceScfDPDFHi24uNxcA4oMR7Pe8TW6VrBp6xrDEzrWnOtPf9xRla9U7rV2 1iYwLTFZ1A5J9zsKzNJAOlMcbDLAtlxguhGrjVkA4+g44rrmVVtY7oIpGaX/8KugGpCg== X-Received: by 2002:a05:600c:1382:b0:49d:1d7e:4085 with SMTP id 5b1f17b1804b1-49fc5750e24mr1268555e9.22.1789678961573; Thu, 17 Sep 2026 14:02:41 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fc5755c40sm3106095e9.3.2026.09.17.14.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 14:02:41 -0700 (PDT) From: Valerio Setti Date: Thu, 17 Sep 2026 23:02:32 +0200 Subject: [PATCH v2 2/6] 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: <20260917-audin-v2-2-38de4bc1de34@baylibre.com> References: <20260917-audin-v2-0-38de4bc1de34@baylibre.com> In-Reply-To: <20260917-audin-v2-0-38de4bc1de34@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=owGbwMvMwCV2z3ty7kUrRgbG02pJDFlrQnO/ntzvH79Q1yg+wHDPzcDdgsyPt4S7+TmzcyTnS q6tPyjRUcrCIMbFICumyMIy/d7vglK1h8YJJwtg5rAygQxh4OIUgIlMjmVk2D3tWLfIEYmnStLP /m/gO1Gyv01q+5md1iVJinUf3L7fWMrwT/X1lLkaX47s9/Cy4d9UN/tG6+v8jQampY+YJrX/q7X p4AMA 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 Fri Sep 25 01:20:26 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 BE90349A3B1 for ; Thu, 17 Sep 2026 21:02:44 +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=1789678968; cv=none; b=koLH572By+18K4A4n8Atd8gRPPRjhTLWLzDrZiFYsQ4zUcavW2nO1oXFblO96wRbqBjlBIBqG28vvnXxkXDN7o5lljua03SQd7jdkuBn4XhHQq9bUh3+Tv456VXbdGJch/j+zYOMVmoeG4fIkTW+oPe6pr1R8jRDPN4k2G/xyWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789678968; c=relaxed/simple; bh=AOYdmWNtnAPFdoV4iO0i0WTAgTqFKle4O5cMxyzJiHY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H4ktF6aayDFvhlItWRxeGA7Sm2o8NfdhWVbPmwkTnHJU+38GoJHNzvUCBosieVfaDUZ6IEDSbuTWAubLWDGjGZpu0FVkTG7/ai22B83j4TGKT/Uz3p5ywamlLVevDEDuTtgHd6UFvzqRByv0IjVBpYiJh2orGnKq2tHhG9K5tdQ= 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=Rmp/NNM1; 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="Rmp/NNM1" Received: by mail-wm2-f13.google.com with SMTP id 5b1f17b1804b1-49e6b885ef8so450105e9.1 for ; Thu, 17 Sep 2026 14:02:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1789678963; x=1790283763; 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=BVSFbjnkl8UpNcArJJM1cv5lAji7DzunjkCRs+hQbqc=; b=Rmp/NNM16bBA8jPWw0qNGFOoCL47J3hZH65q90b7oF+8Bs8QDHgdKvmGFVC3HU+lyY oVGwMDSN5SnUMwVhdetC92gb9dqNKSyJG3361aGs8jMcTke0nXWQzR21BkeVtDhDCB+z SFdhFiJlpSwhhh5/cKXksauk5Vv4ELe3iAdnktNBS5/bZCMHZm7j1DKVVyEEzeQyx4fL bPZrdpKemC7uz/UDNeAr8nPJ+MSGOf6r1YfqrdmLhJekYDsTkY5FI1N3ctqSV+i6+FV+ VXC/GkvJytT/p50uE5ebquxwiw9004ZDmdsI9p5FsW+juN24qwFMfL7LH1Q5yvrLBA95 7Fxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789678963; x=1790283763; 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=BVSFbjnkl8UpNcArJJM1cv5lAji7DzunjkCRs+hQbqc=; b=Y7eUKxGEWRJL9y8HFEgenhOqNQOEjlg2ZzsiVh0S0hCPdlB0IvHMxWin6jqa/VmniY b/RsydpvfMEHb4GI6DvxRc1eU3WnFDyZgFB78s6ihC9XVJ1I6S3o0lmeOm6hp7VnxSa4 zL/IbFvBuDbTG9M2D0IlsEPrZnmRXlnRZu2p501hZJbCp2HPGs7Sdy4m0VMvo5eKSgfh /A/+EZZ5z6PTjhJ/vrlKHkFuIjqsh/3ej4zmkReghv6d/a/2huiEN/5e6ytEPFoxto8W Gu1T4demfCGqa+Pa+FpE5zitHxywN1ftIo28cwPXO0Pgl6b3k6XuiMChWjtQLCcip8RG GSCQ== X-Forwarded-Encrypted: i=1; AKwUvBy6NNuJOaFAymGmCHHk1QyHc9JJWTaEWvFJiMuNa/0tkPdi8+4xak09b8sLQ6w224ezXFIpAhHOltcWIe0=@vger.kernel.org X-Gm-Message-State: AFuF++mDhckbocI2fholrVDLCgHuCcA56kPnSjKmeYqBhC06oNskVEZa THpv9Ov9k8B8tv8aIYE7Le6h6R6Gn4OnXrF4suVz+lAq8y43fFWH6m30EeYCZW+84qw= X-Gm-Gg: AYBFou0xv56M+EkbVi+HTmuAmNdl1nCiAhtWZ8mp0lmXEXfI+Ud/0KdqHwOIjJUt4t5 b4wr+OtxzO+yGsCEiogNMGXVnWaeLoeVQL8eWtFEzzclOc9cTkD6DnZKn/MKvxrg32h3xDNtkZI gPYY3ebYVqczwH/w1DAIhFmyv8Ikygfu/9HM/8kNiQKSqnHiugsHMACs6q8OuiXx0ruzHxdOKOh u6wmpdSx9/En5BI4zJqoTms/YFJQz1Qax7Q+3R1hscqpvYUsky2pWiNVqpMqCrF6wYAY0NVTJh/ BKG5o/VLIQQ0dVm/UnTBpRUioHaRwE8BWoH+UmGSmaOaXJmnW9mgtzt8ItgEs6ncbqjSGqKjyFj BuaPJ/2YMZvW0L9T9rG+sSYaIjCowiO9a4qYrI5fhtHJSexWaPZ0y4/HmBbhjpk/BcpenjSj82A 6AjWqwHf1ja1Qcrqx1PPcbQ8l0Cj9dYG1RGsMIE/RKvB85QCH4dxYoGdFgg6J5ACeniVSR6DtxF ucZ2Q== X-Received: by 2002:a05:600c:34d0:b0:495:6e68:5df2 with SMTP id 5b1f17b1804b1-49fc56ef520mr1779275e9.12.1789678962730; Thu, 17 Sep 2026 14:02:42 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fc5755c40sm3106095e9.3.2026.09.17.14.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 14:02:42 -0700 (PDT) From: Valerio Setti Date: Thu, 17 Sep 2026 23:02:33 +0200 Subject: [PATCH v2 3/6] 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: <20260917-audin-v2-3-38de4bc1de34@baylibre.com> References: <20260917-audin-v2-0-38de4bc1de34@baylibre.com> In-Reply-To: <20260917-audin-v2-0-38de4bc1de34@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=28710; i=vsetti@baylibre.com; h=from:subject:message-id; bh=AOYdmWNtnAPFdoV4iO0i0WTAgTqFKle4O5cMxyzJiHY=; b=owGbwMvMwCV2z3ty7kUrRgbG02pJDFlrQnP129+eXbGoZhOPl/omz6CUdeccfzf5MNx8/H7Op l1SYjEbO0pZGMS4GGTFFFlYpt/7XVCq9tA44WQBzBxWJpAhDFycAjCRZdcYGf4y/Z7A8m9fh45B 1d6/ojcf/1EsmngsjUPtpQXLuSe7T9ow/OEv0PnQ+8juoPpktoZDwozMYmW9ptztZQJzL+/vdmA R5wEA 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 | 367 ++++++++++++++++++++++++++++++= ++++ sound/soc/meson/audin-formatter-i2s.c | 174 ++++++++++++++++ sound/soc/meson/audin.c | 186 +++++++++++++++++ sound/soc/meson/audin.h | 30 +++ 6 files changed, 770 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..39ca65e3cee9 --- /dev/null +++ b/sound/soc/meson/audin-fifo.c @@ -0,0 +1,367 @@ +// 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, delta, sleep_time; + + 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; + + /* Report only when the period is completed. */ + if (delta >=3D data->period_bytes) { + data->last_pos =3D curr_pos; + delta =3D delta % data->period_bytes; + snd_pcm_period_elapsed(data->substream); + } + + /* Sleep until the period is completed. */ + sleep_time =3D round_up(data->period_bytes - delta, AUDIN_FIFO_I2S_BLOCK); + hrtimer_forward_now(timer, audin_fifo_bytes_to_ns(data, sleep_time)); + + 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..ec024267ac29 --- /dev/null +++ b/sound/soc/meson/audin.c @@ -0,0 +1,186 @@ +// 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) + 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 Fri Sep 25 01:20:26 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 A2DC249B1F5 for ; Thu, 17 Sep 2026 21:02:45 +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=1789678968; cv=none; b=MfHiZX4yJK2pQ9B/rMtbNo8IgiQORxqPfQqQ/BGwKh5CPH5cdzcQSqhT6yyvr8ca1KZMkeRO/qJfb3+fWweN8TrrOKpfUGhZaG599qGhkl4O90iJvKdBITmpQBJ7T3Qt0nrNg86cpuUaJizLqVWVu6EWdOoth9dpqwLARDuim+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789678968; c=relaxed/simple; bh=Uvy6WjK33Ql5QDc+7YeTX2qUEcUUi+n12SinkXVNwt4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G1Sc1pzfJ6R6nAxZcyNbUVE6pmtVOtGIV2RF5kokUP7WjPv+zZ3Pisch2Putj1BHghPQse7zDEoL9r6vINWV9ehrqCoMLoeeEV52cP9s5Os0lKdWC02FzRUam6dHCbyiLxLojM/EOvKCG7K2cjGTHrsMWJSX/0HJaAeUgd/07T8= 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=Kg29WfOX; 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="Kg29WfOX" Received: by mail-wm2-f13.google.com with SMTP id 5b1f17b1804b1-49cd4ba9f68so969935e9.1 for ; Thu, 17 Sep 2026 14:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1789678964; x=1790283764; 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=Kg29WfOXjW0/kjOCVjKbclVDnPh3qxPBMr1GjKk08d9lkTd0rQs2+Gzhyd+xK+mapQ g3bfeddu9K3OLL/poxG2PsWSGTmv42okVppmbTUHWK29IJyWUZufIiV+QsaFJc9/XwlV TWfQDTZu5T1as5y8p3HWHNxJ3IrzVgQ8PWCNsRKrcgkl7LrCwR2j2TUc/REN43WBlzm/ 49/J0zeduwh263aK+AFcaQHN7I7Lk6WtLAGir3sdBGUN2tLE49dwSY7nBRIvBYzxDg0e wIWseMXZ1Hgc5EwUPVXAm1puHUla8qYB8bFqeLUAzooFjchpvBzKrGLCSg4iMMfWKgSm VI/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789678964; x=1790283764; 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=pdOAe1UWzJHaEYHhzMaMd26dgvuASTZbbsjcmnM269JREXguivaE7woa48H68yoEE7 CTQrrpIiq4VAkMZLi79b/0tly/6ctNpGHx2lqre2z1PYpPVgGzpVwJlBXTcylPeoCl74 dkreXbbU4G7kU1ekNg9/fgGt/1i47dSvx3f8C+9CKfjfQgu5L04/8G5+yphabVDDst4o FUIadR7mx8Esrop6NppzhqpY7TKng5p5WOCGIOxFSTK8hCjvKEw4CwOEjG+LvAE2fBZG 8aQkr14qEmML8k07Gi4N/KV3LniVkA+MXwYYjMQfRa+6Yljt7tvhfRNlZQmVH3HUhASj Z65g== X-Forwarded-Encrypted: i=1; AKwUvBx8Od8S0eW3wFKoHbr5P2ndJbvRsiUHe1qqOjgfnbpaNbI9q4iHLZISNMUXOaborK2dJVD2/e+Tertkygk=@vger.kernel.org X-Gm-Message-State: AFuF++lwbSPK/NJp2djKtzexFc/g2aXRwQRWfKaZpSb/3Wh+X7IsS3Kw Cx/FjCAqUxLkQRdfVanGVzauUr+zKnEUYI67dopabJ+1zkx036d0OxG+Gtsnf475eOo= X-Gm-Gg: AYBFou1c3SrMmykJiOOmyICjjnR+3Q7Ud6F+bpuGqZREdjbPE/RyxsGoTkK+0ZvMfhw mipqRyTWi0b5s0nkUrbYS69XUTdb7ApCqGgVtEd6ATdTbayKfcF6Ln4DISBPBO75j4axsjZTNiB q9EMEYihAmfDNW0nUt/GaPEG49U9jAquJBut82/u/Rq2Rdz1T9hVA17PuHi9CAy/GJ7c5PmRjHf 1N3Lt+7kSajtlyIGtEhsoxTYJq+Gnp/GcJnxndiI8kyyomREy/BvjkWmAuvsDz6bjqHAbGcAJJs p5dV1YGbuR1ooiqO5Auu+edQgm8Om3bPAUwUSYoLkW+eqPefocF4bqiFrW9C++hXpDQZeCiP64E XfYSkv0g1vLH+JpwzFlVgsuW44o6qJECv9QX5b56cYP3VQfnQnS7WuzxORxYvRDRRasBbjd130r EJPZ2S5spzQndPskFcqppad8KoYl/lwPevKXd3VTQ8TNOZYqyXJBtI+rTIDyzVqtHRTG8GP8upa +tUjg== X-Received: by 2002:a05:600c:198b:b0:49c:fc6e:8cbd with SMTP id 5b1f17b1804b1-49fc574f05dmr1574425e9.33.1789678963884; Thu, 17 Sep 2026 14:02:43 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fc5755c40sm3106095e9.3.2026.09.17.14.02.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 14:02:43 -0700 (PDT) From: Valerio Setti Date: Thu, 17 Sep 2026 23:02:34 +0200 Subject: [PATCH v2 4/6] 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: <20260917-audin-v2-4-38de4bc1de34@baylibre.com> References: <20260917-audin-v2-0-38de4bc1de34@baylibre.com> In-Reply-To: <20260917-audin-v2-0-38de4bc1de34@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=owGbwMvMwCV2z3ty7kUrRgbG02pJDFlrQnPVXXIkF19akM2yaANzTvkv5SwOwx05M15mSF780 rfPiNOso5SFQYyLQVZMkYVl+r3fBaVqD40TThbAzGFlAhnCwMUpABM59ZLhf0BKUawkm9T3o373 JU4++fdX5HWgZ7tPR4R6xFNtM3WhnQz/TBt0/F/LRDzrEImSn2DTeaBkfTLbsZcn2dRi5yVor2h mAgA= 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 Fri Sep 25 01:20:26 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 A294F49BD87 for ; Thu, 17 Sep 2026 21:02:46 +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=1789678969; cv=none; b=K7WpK4CGieaoLgElPM+pNbNqHtTSfAXczN+uYU9Oy2s9w+2Qle9Hy9f8oiOD91I8sRgflGrladaiXqf7iybU7FccRLobuLbS2R/0vJ7Ict1SoERNKmw8nD8pSDFoLwGbtE1gRnLNTXaRA00NKgQCnBjHCiCvj6jwU4DaEtV7m/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789678969; c=relaxed/simple; bh=vu+Bm1uBGIa5rQR0KJvCXwwxy1648qk7OnTjRUBnopY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sepiKBj7wZ+sunbxv4KcG1sE5YerBwTWwKbH6DDZBZemiiz7B9Fu7aYEWAwiJp66yyeuIrTuQf5L7dLDSPLdE9DQpKEtdCASA/WGXNyt74YxK/8+dqsje9GlvxAFlL/U2mWSGQQxYwvspQrFqwWQl0vk35a4vM8FEez8+jmzOPA= 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=jW+Q9yK7; 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="jW+Q9yK7" Received: by mail-wm2-f13.google.com with SMTP id 5b1f17b1804b1-49e6c0fce17so400965e9.1 for ; Thu, 17 Sep 2026 14:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1789678965; x=1790283765; 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=jW+Q9yK72RWoq3WmHe8KNAtPEh7KfvRNDbcjHNk3+ZaO2apNhfFTziYnMhfZnTzAf6 gEz8Lh+pFCEBegz7gptsL9cb2rzUqZaD4B2T/GEvwWjOAkpWcCjGFOpnevltOADVVm5g Yu9r22ukRBlglnzkNWO9fNsxQEfRqxpMMK27Y5tWqtTIzB29uFmdIBCvoAuGWPJwNGVX kHUEgDUK50nZgI/dCehrFIfxIr4cgC7FjaPI+ncNL2+A1T8ZB+KwzqV90xWycaaE/D3O NvPN+waG1gTtnM6t+OPxexHLy4HTPLvchJ8H3/dbJU9PfFhfDh95hRP/T3KSHApI8pNh q4rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789678965; x=1790283765; 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=1gRifZ4Uo/oPuzx6dgPhbCUoRvJj8HB9bXK/kVSB24C8Ej8H/1ABilnPImCVdngt1v x/w1LSLC2pY5X1zqgFxiiqpIhtRxihy0EG9CcMAhm1lSOQ20YLhVOLyF3GDtPdNliTLb ysC83Q1k1H3YmzhwrEhBtec49e2vi6bFf2yADPBHTCCr6l4rHx90ZScpa2h4ern8I6Y1 gfMdGfaDq4vTVb23munsfr7NUHYVytjfXCl1piGanfjbdvkMobfrR/KjyeGG3e0kB1us 2ukhUxhX+8JpGGq50cVKfAQANomz9G6Sk51kwkfkGPxgdKmjkFJ+F592U0Ryn3d5UbAF rSwA== X-Forwarded-Encrypted: i=1; AKwUvBz2gvwOFl/9ii5/2zkP2ugzcZEjdvAa27INXuuoq9eeoWXkSb4SeYVgIa6U4Ao3w41ufjHbmJSgwHjMTu4=@vger.kernel.org X-Gm-Message-State: AFuF++kN4azsflzT0P+KLRYgVL/1JguhlJj5NXU/m+ap0thJ0E6bTHT+ RhFLLMuYc6nCINXdb76XWarJDmxe3URcusbovnUDSIsqBy4RUjikttjbgiNLIL6w806nvs8HrsE I3tPnoqVKFA== X-Gm-Gg: AYBFou0XXRV3dyPwm5YbCkelec2Y62araC4jMW/cEXLXo2PhQjfIBep7o47bDZT4+Ue lXWlSiUUY+PqfiFFxIjh2g+JZQKbHeZM1jVI700MRsRjEDEN7JpHVtRkoXh7O9ETvXsEj0X1Wng 2eMa18t0HHp7Go6I/QJraMOkmyigAnP4AEmYb43Sl2HA4ieB9jdBPYkUP9cg++vP6Zrr3o623Fo DDF6HVgWwt7M7WHxvzSEe5Ctsq3X6aVE1xMfLkc1o9HwB2VTGSBv9F8ZHYKe4S/s/S1rU6U2PjK kh8TvMaqWFuVmzXcmO5K8AT5ZXwhM1+ReC78Av02dUfXe3gn4DNft91iQTPosWL95Qs9+Tvyi6g FHkog5a86K938KuxcWTSM8lFkbJoH+lcAifm6tKndqKNOKuvpoYtIGYBjgd2nrZcdKdDoByyTh8 ke+KpPajChaO6N/n9IBysV/nhKnIoB2HZoaRerE9Rnzhma3LFAzC4s7rMRr1xa89FUKw== X-Received: by 2002:a05:600c:3b98:b0:49d:1f10:8b9f with SMTP id 5b1f17b1804b1-49fc56dba0dmr2100645e9.7.1789678964981; Thu, 17 Sep 2026 14:02:44 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fc5755c40sm3106095e9.3.2026.09.17.14.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 14:02:44 -0700 (PDT) From: Valerio Setti Date: Thu, 17 Sep 2026 23:02:35 +0200 Subject: [PATCH v2 5/6] 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: <20260917-audin-v2-5-38de4bc1de34@baylibre.com> References: <20260917-audin-v2-0-38de4bc1de34@baylibre.com> In-Reply-To: <20260917-audin-v2-0-38de4bc1de34@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=owGbwMvMwCV2z3ty7kUrRgbG02pJDFlrQnNvBO8UVQ8+9qB99/VbLAl3fB9mMG7qDv2Yxp5U5 frLok6to5SFQYyLQVZMkYVl+r3fBaVqD40TThbAzGFlAhnCwMUpABMJ0mZkWOu4oW5S2wKu3Rzr Q+/P8zi2ftoWrZUGXCl7/jeey3uy8inD//RNdj9qdysuEMmYfGw9S67zmvPuhY+4dB5MXj71EvO So3wA 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 Fri Sep 25 01:20:26 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 0654F4A0918 for ; Thu, 17 Sep 2026 21:02:47 +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=1789678970; cv=none; b=e4+YIxHRthVsUeejAHGaRLE0PYXmhTmu/IMzsWKfU17iuQzYf+QT3HbaeR/q+kQbJtY4BEvBxfpa2iCVt2+nNCobn/og7bGGWRqaqXv18codRoNHflGRwfSuG8GKnRuiriq+TedGFZBgtswfEvHE7qjoh+qu0/z8cz4t93IeWVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789678970; c=relaxed/simple; bh=TZWXiYpGe3PgSXyHXeQpQDxriAYLZIkbRgm507qkSqQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J4bXhCWvLatRYyXvxB5v/Xe5SPWFzr0Kdcslt/FIefW9hdMc4wLEA++XgYDy+IRgsnnR9WUTelGHVB5c0u5qeNZyRRqsT1K2yTrNWbHq7p5iLW3HK/IGDcpX/clIrpD52suwvFrcKb15AMa5UJjP1s8YrhQLXfaePUJlk6I4E9k= 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=lGuRQtB8; 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="lGuRQtB8" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49ce364488dso235155e9.0 for ; Thu, 17 Sep 2026 14:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1789678966; x=1790283766; 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=lGuRQtB8bziadpmIUSknGxFc4zk/X7BMDPdxDRipeKfokNmsuroEBXw0PrqR/KLUKg wYU1fpPykgfoskWZ70dRDdRasd1OgfbZGkSEvkD/vMcnUQ0rPVxWzCakcyZBbm4V3KVi 9PGZCPOd8J8hFivbEcAdh8zz6FWPoAGh8X+y0YbesOSdWbepxRQyehE3JHkTvpvLEgBW MVkkyiGWvp3/OwMGpptzU+ax88S+jug6Mp8uBGMfYmU9lma3BlZ64H8A5mOYnN0XpvJA 9c7Qz3vkji9bA8IbQ433sHfyEBwZ99+wh62N4K8wYchAHVzP0vG71z+C6kWMp4VKwTwn 3gAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789678966; x=1790283766; 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=P7PfuldX0HVeCEgWAiTU/TNUKhiLx/EHny9qlB6/t4FC7GJ8oMGnz/f/oKBV6TdnZZ UKANiO23SJmjznpiF2VaZiHmyh3a439Y3LWk63xI4mdU5yfVrDGB8LPr9YYbm9UhtY0P /GgO7kAXIkP01WYWneqDyYOJNX7Yc6g00Uia7EoQGjKlzAOa7pv7c9oOXvrUodqBxaAt AxIhsSFHA18QoeTbw2ezRMrape/hcGfZCA9MSLsPhHkntiRNSMKp0SRBOaOOkAxa+rQZ /U0y6L4mZ7cyIKsrDSjjWYvcXYQ3QXN1Gd5RLSbtv8yX30A3bubcu/4auJnJ+ZBLVScK h9bA== X-Forwarded-Encrypted: i=1; AKwUvBxXKFBphArX4grtMGFd7l0IHP3uvDf5AFAHdmqftpOsrMVoS3QBIhNRGVaQio9ZVQG9/pFnO634HonMWMk=@vger.kernel.org X-Gm-Message-State: AFuF++m0urlFMOo8iZYr7o325VdN+rPGUDC1JAqHvxIPz53Gt14CwrBk nCtV0x1EurdBya+TFBtTKwAKrrMtTxzfBSvo5/23oqu1/NXvY20hYkogoEfK+7oqN8E= X-Gm-Gg: AYBFou1qzyoqsuIXg2ASllK5kvCthUa1IgU26+HvDoXL9X7Kv0Pvl1RzzfSo2xQY2fX 5bC8CREL7vZnWj2agrxV1dp+K3oz/vCpQL+G59lBb3DPkfwyxeQgUG7N4Id+amt4dMW8sHzvOJX mGLjjJ2BcI3vu4QTr00VJ8/2sZ+SAOslAE4uJlV9AtToyHhXgc6aauQfBtg965yK1DkmR4BHhZW anQJDIczs3oOh18qYJRlURl5uXktJijD6xo44Dy5FnP6MHuBLh+XAh4V0oVLsXMETfqh+kU4jYi nOvQcIR/6guTN1U8rxwu9IfYjFN31wbKQT4dx7dfQopvKHpRa5whPjk1UHTZJvymkIyoQlE2f0x EHmcI6PsqIBPwlEPL0ctyP+WnaBP/t8zbFHLOC1TZH7ptpK2sNoIDl4GzhsvhZCOe2qqGb7ctwE zb1asmPk2zE3qyysMkGdklk9hJmmlB1E5mC/IJDaY1eLYpzFaU04VTuzAS0ElKGwPaDz+cdZLqp T8e X-Received: by 2002:a05:600c:1d06:b0:49e:8222:3451 with SMTP id 5b1f17b1804b1-49fc5001358mr4202515e9.14.1789678966047; Thu, 17 Sep 2026 14:02:46 -0700 (PDT) Received: from [127.0.1.1] ([151.42.87.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fc5755c40sm3106095e9.3.2026.09.17.14.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 14:02:45 -0700 (PDT) From: Valerio Setti Date: Thu, 17 Sep 2026 23:02:36 +0200 Subject: [PATCH v2 6/6] 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: <20260917-audin-v2-6-38de4bc1de34@baylibre.com> References: <20260917-audin-v2-0-38de4bc1de34@baylibre.com> In-Reply-To: <20260917-audin-v2-0-38de4bc1de34@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=owGbwMvMwCV2z3ty7kUrRgbG02pJDFlrQvNmvF8unFH9eH6EzySORvUZecWKr2zfpoin7n3IZ Pr0cfujjlIWBjEuBlkxRRaW6fd+F5SqPTROOFkAM4eVCWQIAxenAExkUTIjw8en9zJ2svh/+rbU ff5ZllW67KenBohvO8zx3b2e5fi9Un6G/9GnGbPtczkErYJuBjNXp/QLT67Xi2s6cP1A6E+3vFf OrAA= 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