2022-07-17 18:11:28

by Adam Ford

[permalink] [raw]
Subject: [PATCH 1/6] arm64: dts: imx8mn-beacon: Enable Digitial Microphone

There is a PDM microphone on the baseboard which is connected to the
micfil controller. Create a new sound card to support this interface.

Signed-off-by: Adam Ford <[email protected]>

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi
index 9e82069c941f..fa66cc9bf455 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi
@@ -63,7 +63,7 @@ reg_usb_otg_vbus: regulator-usb {
enable-active-high;
};

- sound {
+ sound-codec {
compatible = "fsl,imx-audio-wm8962";
model = "wm8962-audio";
audio-cpu = <&sai3>;
@@ -76,6 +76,18 @@ sound {
"AMIC", "MICBIAS",
"IN3R", "AMIC";
};
+
+ sound-micfil {
+ compatible = "fsl,imx-audio-card";
+ model = "imx-audio-micfil";
+ pri-dai-link {
+ link-name = "micfil hifi";
+ format = "i2s";
+ cpu {
+ sound-dai = <&micfil>;
+ };
+ };
+ };
};

&ecspi2 {
@@ -150,6 +162,16 @@ &easrc {
status = "okay";
};

+&micfil {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_pdm>;
+ assigned-clocks = <&clk IMX8MN_CLK_PDM>;
+ assigned-clock-parents = <&clk IMX8MN_AUDIO_PLL1_OUT>;
+ assigned-clock-rates = <196608000>;
+ status = "okay";
+ #sound-dai-cells = <0>;
+};
+
&sai3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
@@ -232,6 +254,13 @@ MX8MN_IOMUXC_SAI2_MCLK_GPIO4_IO27 0x19
>;
};

+ pinctrl_pdm: pdmgrp {
+ fsl,pins = <
+ MX8MN_IOMUXC_SAI5_RXC_PDM_CLK 0xd6
+ MX8MN_IOMUXC_SAI5_RXD0_PDM_BIT_STREAM0 0xd6
+ >;
+ };
+
pinctrl_reg_usb_otg: reg-otggrp {
fsl,pins = <
MX8MN_IOMUXC_SAI3_RXC_GPIO4_IO29 0x19
--
2.34.1


2022-07-19 06:18:33

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH 1/6] arm64: dts: imx8mn-beacon: Enable Digitial Microphone

Hello Adam,

On 17.07.22 20:09, Adam Ford wrote:
> +
> + sound-micfil {
> + compatible = "fsl,imx-audio-card";
> + model = "imx-audio-micfil";
> + pri-dai-link {
> + link-name = "micfil hifi";
> + format = "i2s";

Given that MICFIL and mic speak PDM with each other,
is i2s the correct format here?

Cheers,
Ahmad

--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2022-07-19 19:37:15

by Adam Ford

[permalink] [raw]
Subject: Re: [PATCH 1/6] arm64: dts: imx8mn-beacon: Enable Digitial Microphone

On Tue, Jul 19, 2022 at 12:57 AM Ahmad Fatoum <[email protected]> wrote:
>
> Hello Adam,
>
> On 17.07.22 20:09, Adam Ford wrote:
> > +
> > + sound-micfil {
> > + compatible = "fsl,imx-audio-card";
> > + model = "imx-audio-micfil";
> > + pri-dai-link {
> > + link-name = "micfil hifi";
> > + format = "i2s";
>
> Given that MICFIL and mic speak PDM with each other,
> is i2s the correct format here?

I was basing this off some references from some NXP stuff in their
downstream kernel. I know the audio I record with the PDM microphone
worked and sounded like I expected when I tested it.

adam

>
> Cheers,
> Ahmad
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |