All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
@ 2023-05-08 11:42 Marek Vasut
  2023-05-08 11:42 ` [PATCH v8 2/2] arm64: dts: imx8mp: Add analog audio output on i.MX8MP EVK Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Marek Vasut @ 2023-05-08 11:42 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Marek Vasut, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Adam Ford, Alexander Stein, Richard Leitner,
	Abel Vesa, Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart,
	Lucas Stach, Michael Turquette, NXP Linux Team,
	Pengutronix Kernel Team, Richard Cochran, Rob Herring,
	Sascha Hauer, Shawn Guo, Stephen Boyd, devicetree, linux-clk

Add all SAI nodes, SDMA2 and SDMA3 nodes, and AudioMIX node. This is
needed to get audio operational on i.MX8MP .

Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon-kit
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: Richard Leitner <richard.leitner@skidata.com>
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Abel Vesa <abelvesa@kernel.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Jacky Bai <ping.bai@nxp.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-clk@vger.kernel.org
---
V2: - Add AUDIO_AXI clock to audio gpc
    - Use IMX8MP_CLK_AUDIOMIX_SDMA2_ROOT for SDMA2 IPG clock
V3: Rename audio_ahb to plain ahb
V4: - Add RB/TB from Luca
    - Rebase on next 20230223
V5: - Add TB from Adam and Alexander
    - Replace blk-ctrl@ with clock-controller@
    - Specify sound-dai-cells in sai nodes
V6: - Add RB from Fabio
    - Drop power-domain-names from audiomix block/clock controller
    - Move reg below compatible property
    - Move sound-dai-cells below reg property
    - Sort DT properties: compatible, regs, #cells, properties, status
V7: - Move #clock-cells below reg property
    - Add AB from Peng
    - Add RB from Marco, sort the tags
V8: Add TB from Richard
---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 158 ++++++++++++++++++++++
 1 file changed, 158 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index f81391993354f..149f4e7e1d9b5 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -595,6 +595,13 @@ pgc_usb2_phy: power-domain@3 {
 						reg = <IMX8MP_POWER_DOMAIN_USB2_PHY>;
 					};
 
+					pgc_audio: power-domain@5 {
+						#power-domain-cells = <0>;
+						reg = <IMX8MP_POWER_DOMAIN_AUDIOMIX>;
+						clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
+							 <&clk IMX8MP_CLK_AUDIO_AXI>;
+					};
+
 					pgc_gpu2d: power-domain@6 {
 						#power-domain-cells = <0>;
 						reg = <IMX8MP_POWER_DOMAIN_GPU2D>;
@@ -1167,6 +1174,157 @@ opp-1000000000 {
 			};
 		};
 
+		aips5: bus@30c00000 {
+			compatible = "fsl,aips-bus", "simple-bus";
+			reg = <0x30c00000 0x400000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			spba-bus@30c00000 {
+				compatible = "fsl,spba-bus", "simple-bus";
+				reg = <0x30c00000 0x100000>;
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges;
+
+				sai1: sai@30c10000 {
+					compatible = "fsl,imx8mp-sai", "fsl,imx8mq-sai";
+					reg = <0x30c10000 0x10000>;
+					#sound-dai-cells = <0>;
+					clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI1_IPG>,
+						 <&clk IMX8MP_CLK_DUMMY>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI1_MCLK1>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI1_MCLK2>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI1_MCLK3>;
+					clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
+					dmas = <&sdma2 0 2 0>, <&sdma2 1 2 0>;
+					dma-names = "rx", "tx";
+					interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
+					status = "disabled";
+				};
+
+				sai2: sai@30c20000 {
+					compatible = "fsl,imx8mp-sai", "fsl,imx8mq-sai";
+					reg = <0x30c20000 0x10000>;
+					#sound-dai-cells = <0>;
+					clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI2_IPG>,
+						 <&clk IMX8MP_CLK_DUMMY>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI2_MCLK1>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI2_MCLK2>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI2_MCLK3>;
+					clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
+					dmas = <&sdma2 2 2 0>, <&sdma2 3 2 0>;
+					dma-names = "rx", "tx";
+					interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
+					status = "disabled";
+				};
+
+				sai3: sai@30c30000 {
+					compatible = "fsl,imx8mp-sai", "fsl,imx8mq-sai";
+					reg = <0x30c30000 0x10000>;
+					#sound-dai-cells = <0>;
+					clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_IPG>,
+						 <&clk IMX8MP_CLK_DUMMY>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK2>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK3>;
+					clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
+					dmas = <&sdma2 4 2 0>, <&sdma2 5 2 0>;
+					dma-names = "rx", "tx";
+					interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+					status = "disabled";
+				};
+
+				sai5: sai@30c50000 {
+					compatible = "fsl,imx8mp-sai", "fsl,imx8mq-sai";
+					reg = <0x30c50000 0x10000>;
+					#sound-dai-cells = <0>;
+					clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI5_IPG>,
+						 <&clk IMX8MP_CLK_DUMMY>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI5_MCLK1>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI5_MCLK2>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI5_MCLK3>;
+					clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
+					dmas = <&sdma2 8 2 0>, <&sdma2 9 2 0>;
+					dma-names = "rx", "tx";
+					interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
+					status = "disabled";
+				};
+
+				sai6: sai@30c60000 {
+					compatible = "fsl,imx8mp-sai", "fsl,imx8mq-sai";
+					reg = <0x30c60000 0x10000>;
+					#sound-dai-cells = <0>;
+					clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI6_IPG>,
+						 <&clk IMX8MP_CLK_DUMMY>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI6_MCLK1>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI6_MCLK2>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI6_MCLK3>;
+					clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
+					dmas = <&sdma2 10 2 0>, <&sdma2 11 2 0>;
+					dma-names = "rx", "tx";
+					interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
+					status = "disabled";
+				};
+
+				sai7: sai@30c80000 {
+					compatible = "fsl,imx8mp-sai", "fsl,imx8mq-sai";
+					reg = <0x30c80000 0x10000>;
+					#sound-dai-cells = <0>;
+					clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI7_IPG>,
+						 <&clk IMX8MP_CLK_DUMMY>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI7_MCLK1>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI7_MCLK2>,
+						 <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI7_MCLK3>;
+					clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
+					dmas = <&sdma2 12 2 0>, <&sdma2 13 2 0>;
+					dma-names = "rx", "tx";
+					interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
+					status = "disabled";
+				};
+			};
+
+			sdma3: dma-controller@30e00000 {
+				compatible = "fsl,imx8mp-sdma", "fsl,imx8mq-sdma";
+				reg = <0x30e00000 0x10000>;
+				#dma-cells = <3>;
+				clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SDMA3_ROOT>,
+					 <&clk IMX8MP_CLK_AUDIO_ROOT>;
+				clock-names = "ipg", "ahb";
+				interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
+				fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+			};
+
+			sdma2: dma-controller@30e10000 {
+				compatible = "fsl,imx8mp-sdma", "fsl,imx8mq-sdma";
+				reg = <0x30e10000 0x10000>;
+				#dma-cells = <3>;
+				clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SDMA2_ROOT>,
+					 <&clk IMX8MP_CLK_AUDIO_ROOT>;
+				clock-names = "ipg", "ahb";
+				interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+				fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+			};
+
+			audio_blk_ctrl: clock-controller@30e20000 {
+				compatible = "fsl,imx8mp-audio-blk-ctrl";
+				reg = <0x30e20000 0x10000>;
+				#clock-cells = <1>;
+				clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
+					 <&clk IMX8MP_CLK_SAI1>,
+					 <&clk IMX8MP_CLK_SAI2>,
+					 <&clk IMX8MP_CLK_SAI3>,
+					 <&clk IMX8MP_CLK_SAI5>,
+					 <&clk IMX8MP_CLK_SAI6>,
+					 <&clk IMX8MP_CLK_SAI7>;
+				clock-names = "ahb",
+					      "sai1", "sai2", "sai3",
+					      "sai5", "sai6", "sai7";
+				power-domains = <&pgc_audio>;
+			};
+		};
+
 		aips4: bus@32c00000 {
 			compatible = "fsl,aips-bus", "simple-bus";
 			reg = <0x32c00000 0x400000>;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v8 2/2] arm64: dts: imx8mp: Add analog audio output on i.MX8MP EVK
  2023-05-08 11:42 [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Marek Vasut
@ 2023-05-08 11:42 ` Marek Vasut
  2023-05-15  1:30 ` [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Shawn Guo
  2023-08-30  2:44   ` Adam Ford
  2 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2023-05-08 11:42 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Marek Vasut, Peng Fan, Fabio Estevam, Marco Felsch, Abel Vesa,
	Alexander Stein, Jacky Bai, Krzysztof Kozlowski,
	Laurent Pinchart, Luca Ceresoli, Lucas Stach, Michael Turquette,
	NXP Linux Team, Pengutronix Kernel Team, Richard Cochran,
	Rob Herring, Sascha Hauer, Shawn Guo, Stephen Boyd, devicetree,
	linux-clk

Enable SAI3 on i.MX8MP EVK, add WM8960 codec binding and regulator.
This is all that is needed to get analog audio output operational
on i.MX8MP EVK.

Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Abel Vesa <abelvesa@kernel.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Jacky Bai <ping.bai@nxp.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-clk@vger.kernel.org
---
V2: No change
V3: No change
V4: - Update codec node name and phandle label
    - Use just sound for the sound node name
    - Rebase on next 20230223
V5: - Drop regulator-always-on from codec regulator
    - Add RB from Fabio
    - TB by Alexander added and removed again, since the patch was reworked
    - Switch to simple-audio-card
    - Add sound-dai-cells to codec node
V6: - Split off separate pinctrl for regulator
    - Drop unused SAI3_RXFS pinmux
V7: - Add AB from Peng
    - Add RB from Marco
V8: No change
---
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 80 ++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
index 7816853162b3f..fa37ce89f8d3d 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
@@ -40,6 +40,17 @@ pcie0_refclk: pcie0-refclk {
 		clock-frequency = <100000000>;
 	};
 
+	reg_audio_pwr: regulator-audio-pwr {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_audio_pwr_reg>;
+		regulator-name = "audio-pwr";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	reg_can1_stby: regulator-can1-stby {
 		compatible = "regulator-fixed";
 		regulator-name = "can1-stby";
@@ -83,6 +94,37 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
 		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
+
+	sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "wm8960-audio";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,frame-master = <&cpudai>;
+		simple-audio-card,bitclock-master = <&cpudai>;
+		simple-audio-card,widgets =
+			"Headphone", "Headphone Jack",
+			"Speaker", "External Speaker",
+			"Microphone", "Mic Jack";
+		simple-audio-card,routing =
+			"Headphone Jack", "HP_L",
+			"Headphone Jack", "HP_R",
+			"External Speaker", "SPK_LP",
+			"External Speaker", "SPK_LN",
+			"External Speaker", "SPK_RP",
+			"External Speaker", "SPK_RN",
+			"LINPUT1", "Mic Jack",
+			"LINPUT3", "Mic Jack",
+			"Mic Jack", "MICB";
+
+		cpudai: simple-audio-card,cpu {
+			sound-dai = <&sai3>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&wm8960>;
+		};
+
+	};
 };
 
 &flexspi {
@@ -344,6 +386,18 @@ &i2c3 {
 	pinctrl-0 = <&pinctrl_i2c3>;
 	status = "okay";
 
+	wm8960: codec@1a {
+		compatible = "wlf,wm8960";
+		reg = <0x1a>;
+		#sound-dai-cells = <0>;
+		clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
+		clock-names = "mclk";
+		wlf,shared-lrclk;
+		wlf,hp-cfg = <3 2 3>;
+		wlf,gpio-cfg = <1 3>;
+		SPKVDD1-supply = <&reg_audio_pwr>;
+	};
+
 	pca6416: gpio@20 {
 		compatible = "ti,tca6416";
 		reg = <0x20>;
@@ -422,6 +476,16 @@ &pwm4 {
 	status = "okay";
 };
 
+&sai3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_sai3>;
+	assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
+	assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
+	assigned-clock-rates = <12288000>;
+	fsl,sai-mclk-direction-output;
+	status = "okay";
+};
+
 &snvs_pwrkey {
 	status = "okay";
 };
@@ -499,6 +563,12 @@ &wdog1 {
 };
 
 &iomuxc {
+	pinctrl_audio_pwr_reg: audiopwrreggrp {
+		fsl,pins = <
+			MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29		0xd6
+		>;
+	};
+
 	pinctrl_eqos: eqosgrp {
 		fsl,pins = <
 			MX8MP_IOMUXC_ENET_MDC__ENET_QOS_MDC				0x2
@@ -668,6 +738,16 @@ MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS	0x140
 		>;
 	};
 
+	pinctrl_sai3: sai3grp {
+		fsl,pins = <
+			MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI3_TX_SYNC	0xd6
+			MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI3_TX_BCLK	0xd6
+			MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_SAI3_RX_DATA00	0xd6
+			MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI3_TX_DATA00	0xd6
+			MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SAI3_MCLK	0xd6
+		>;
+	};
+
 	pinctrl_uart2: uart2grp {
 		fsl,pins = <
 			MX8MP_IOMUXC_UART2_RXD__UART2_DCE_RX	0x140
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
  2023-05-08 11:42 [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Marek Vasut
  2023-05-08 11:42 ` [PATCH v8 2/2] arm64: dts: imx8mp: Add analog audio output on i.MX8MP EVK Marek Vasut
@ 2023-05-15  1:30 ` Shawn Guo
  2023-08-30  2:44   ` Adam Ford
  2 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2023-05-15  1:30 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Adam Ford, Alexander Stein, Richard Leitner,
	Abel Vesa, Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart,
	Lucas Stach, Michael Turquette, NXP Linux Team,
	Pengutronix Kernel Team, Richard Cochran, Rob Herring,
	Sascha Hauer, Stephen Boyd, devicetree, linux-clk

On Mon, May 08, 2023 at 01:42:35PM +0200, Marek Vasut wrote:
> Add all SAI nodes, SDMA2 and SDMA3 nodes, and AudioMIX node. This is
> needed to get audio operational on i.MX8MP .
> 
> Acked-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Fabio Estevam <festevam@gmail.com>
> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon-kit
> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Tested-by: Richard Leitner <richard.leitner@skidata.com>
> Signed-off-by: Marek Vasut <marex@denx.de>

Applied both, thanks!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
  2023-05-08 11:42 [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Marek Vasut
@ 2023-08-30  2:44   ` Adam Ford
  2023-05-15  1:30 ` [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Shawn Guo
  2023-08-30  2:44   ` Adam Ford
  2 siblings, 0 replies; 15+ messages in thread
From: Adam Ford @ 2023-08-30  2:44 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Richard Leitner, Abel Vesa,
	Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On Mon, May 8, 2023 at 6:42 AM Marek Vasut <marex@denx.de> wrote:
>
> Add all SAI nodes, SDMA2 and SDMA3 nodes, and AudioMIX node. This is
> needed to get audio operational on i.MX8MP .
>
> Acked-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Fabio Estevam <festevam@gmail.com>
> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon-kit
> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Tested-by: Richard Leitner <richard.leitner@skidata.com>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Abel Vesa <abelvesa@kernel.org>
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Jacky Bai <ping.bai@nxp.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Marco Felsch <m.felsch@pengutronix.de>
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-clk@vger.kernel.org
> ---
> V2: - Add AUDIO_AXI clock to audio gpc
>     - Use IMX8MP_CLK_AUDIOMIX_SDMA2_ROOT for SDMA2 IPG clock
> V3: Rename audio_ahb to plain ahb
> V4: - Add RB/TB from Luca
>     - Rebase on next 20230223
> V5: - Add TB from Adam and Alexander
>     - Replace blk-ctrl@ with clock-controller@
>     - Specify sound-dai-cells in sai nodes
> V6: - Add RB from Fabio
>     - Drop power-domain-names from audiomix block/clock controller
>     - Move reg below compatible property
>     - Move sound-dai-cells below reg property
>     - Sort DT properties: compatible, regs, #cells, properties, status
> V7: - Move #clock-cells below reg property
>     - Add AB from Peng
>     - Add RB from Marco, sort the tags
> V8: Add TB from Richard
> ---
>  arch/arm64/boot/dts/freescale/imx8mp.dtsi | 158 ++++++++++++++++++++++
>  1 file changed, 158 insertions(+)
>
<snip>
Marek,

I have a question about the clocking for eASRC and PDM.

> +
> +                       audio_blk_ctrl: clock-controller@30e20000 {
> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
> +                               reg = <0x30e20000 0x10000>;
> +                               #clock-cells = <1>;
> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
> +                                        <&clk IMX8MP_CLK_SAI1>,
> +                                        <&clk IMX8MP_CLK_SAI2>,
> +                                        <&clk IMX8MP_CLK_SAI3>,
> +                                        <&clk IMX8MP_CLK_SAI5>,
> +                                        <&clk IMX8MP_CLK_SAI6>,
> +                                        <&clk IMX8MP_CLK_SAI7>;
> +                               clock-names = "ahb",
> +                                             "sai1", "sai2", "sai3",
> +                                             "sai5", "sai6", "sai7";
> +                               power-domains = <&pgc_audio>;
> +                       };
> +               };
> +

I am trying to plumb in the micfil driver with a PDM microphone on a
Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
micfil, the PDM clock doesn't get turned on, and the micfil doesn't
appear to see anything coming in.  I was curious why the
audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
one for the PDM nor the ASRC clocks.  I added the MICFIL noted to the
8mp in a previous patch [1], and I am trying to customize the MICFIL
node as follows:

&micfil {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pdm>;
assigned-clocks = <&clk IMX8MP_CLK_PDM>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <196608000>;
status = "okay";
};

I also noticed in the down-stream kernel, the pdm_ipg_clk and
pdm_root_clk are shared gates with separate parents.

The PDM tree of the down-stream kernel looks like this:
 audio_pll1_ref_sel                0        0        0    24000000
     0     0  50000         Y
       audio_pll1                     0        0        0   393216000
        0     0  50000         Y
          audio_pll1_bypass           0        0        0   393216000
        0     0  50000         Y
             audio_pll1_out           0        0        0   393216000
        0     0  50000         N
                pdm                   0        0        0   196608000
        0     0  50000         N
                   pdm_root           0        0        0   196608000
        0     0  50000         N
                      pdm_sel         0        0        0   196608000
        0     0  50000         Y
                         pdm_root_clk       0        0        0
196608000          0     0  50000         N

The PDM tree of the mainline looks like this:

   audio_pll1_ref_sel                0        0        0    24000000
       0     0  50000         Y
       audio_pll1                     0        0        0   393216000
        0     0  50000         Y
          audio_pll1_bypass           0        0        0   393216000
        0     0  50000         Y
             audio_pll1_out           0        0        0   393216000
        0     0  50000         N
                pdm                   0        0        0   196608000
        0     0  50000         N
                   pdm_root           0        0        0   196608000
        0     0  50000         N
                      pdm_sel         0        0        0   196608000
        0     0  50000         Y

It seems like the "pdm_root_clk" generated by the shared audo-blk
down-sream driver is missing from the mainline.  I looked up the clock
I referenced when I attempted to enable the miffil, but
'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
the macros, but it seems like the pdm_sel should somehow have an
additional variable for the shared clock and an additional clock like
pdm_root_clk assigned with it.

I have similar configurations for Mini and Nano, and both of them are
able to record audio, so I think there might be a clock issue
somewhere related to the audiomix driver, and not a misconfiguration
of the sound-card or the micfil itself.

thanks for any suggestions,

adam


[1] - https://patchwork.kernel.org/project/linux-arm-kernel/patch/20230827023155.467807-3-aford173@gmail.com/

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
@ 2023-08-30  2:44   ` Adam Ford
  0 siblings, 0 replies; 15+ messages in thread
From: Adam Ford @ 2023-08-30  2:44 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Richard Leitner, Abel Vesa,
	Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On Mon, May 8, 2023 at 6:42 AM Marek Vasut <marex@denx.de> wrote:
>
> Add all SAI nodes, SDMA2 and SDMA3 nodes, and AudioMIX node. This is
> needed to get audio operational on i.MX8MP .
>
> Acked-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Fabio Estevam <festevam@gmail.com>
> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon-kit
> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Tested-by: Richard Leitner <richard.leitner@skidata.com>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Abel Vesa <abelvesa@kernel.org>
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Jacky Bai <ping.bai@nxp.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Marco Felsch <m.felsch@pengutronix.de>
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-clk@vger.kernel.org
> ---
> V2: - Add AUDIO_AXI clock to audio gpc
>     - Use IMX8MP_CLK_AUDIOMIX_SDMA2_ROOT for SDMA2 IPG clock
> V3: Rename audio_ahb to plain ahb
> V4: - Add RB/TB from Luca
>     - Rebase on next 20230223
> V5: - Add TB from Adam and Alexander
>     - Replace blk-ctrl@ with clock-controller@
>     - Specify sound-dai-cells in sai nodes
> V6: - Add RB from Fabio
>     - Drop power-domain-names from audiomix block/clock controller
>     - Move reg below compatible property
>     - Move sound-dai-cells below reg property
>     - Sort DT properties: compatible, regs, #cells, properties, status
> V7: - Move #clock-cells below reg property
>     - Add AB from Peng
>     - Add RB from Marco, sort the tags
> V8: Add TB from Richard
> ---
>  arch/arm64/boot/dts/freescale/imx8mp.dtsi | 158 ++++++++++++++++++++++
>  1 file changed, 158 insertions(+)
>
<snip>
Marek,

I have a question about the clocking for eASRC and PDM.

> +
> +                       audio_blk_ctrl: clock-controller@30e20000 {
> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
> +                               reg = <0x30e20000 0x10000>;
> +                               #clock-cells = <1>;
> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
> +                                        <&clk IMX8MP_CLK_SAI1>,
> +                                        <&clk IMX8MP_CLK_SAI2>,
> +                                        <&clk IMX8MP_CLK_SAI3>,
> +                                        <&clk IMX8MP_CLK_SAI5>,
> +                                        <&clk IMX8MP_CLK_SAI6>,
> +                                        <&clk IMX8MP_CLK_SAI7>;
> +                               clock-names = "ahb",
> +                                             "sai1", "sai2", "sai3",
> +                                             "sai5", "sai6", "sai7";
> +                               power-domains = <&pgc_audio>;
> +                       };
> +               };
> +

I am trying to plumb in the micfil driver with a PDM microphone on a
Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
micfil, the PDM clock doesn't get turned on, and the micfil doesn't
appear to see anything coming in.  I was curious why the
audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
one for the PDM nor the ASRC clocks.  I added the MICFIL noted to the
8mp in a previous patch [1], and I am trying to customize the MICFIL
node as follows:

&micfil {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pdm>;
assigned-clocks = <&clk IMX8MP_CLK_PDM>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <196608000>;
status = "okay";
};

I also noticed in the down-stream kernel, the pdm_ipg_clk and
pdm_root_clk are shared gates with separate parents.

The PDM tree of the down-stream kernel looks like this:
 audio_pll1_ref_sel                0        0        0    24000000
     0     0  50000         Y
       audio_pll1                     0        0        0   393216000
        0     0  50000         Y
          audio_pll1_bypass           0        0        0   393216000
        0     0  50000         Y
             audio_pll1_out           0        0        0   393216000
        0     0  50000         N
                pdm                   0        0        0   196608000
        0     0  50000         N
                   pdm_root           0        0        0   196608000
        0     0  50000         N
                      pdm_sel         0        0        0   196608000
        0     0  50000         Y
                         pdm_root_clk       0        0        0
196608000          0     0  50000         N

The PDM tree of the mainline looks like this:

   audio_pll1_ref_sel                0        0        0    24000000
       0     0  50000         Y
       audio_pll1                     0        0        0   393216000
        0     0  50000         Y
          audio_pll1_bypass           0        0        0   393216000
        0     0  50000         Y
             audio_pll1_out           0        0        0   393216000
        0     0  50000         N
                pdm                   0        0        0   196608000
        0     0  50000         N
                   pdm_root           0        0        0   196608000
        0     0  50000         N
                      pdm_sel         0        0        0   196608000
        0     0  50000         Y

It seems like the "pdm_root_clk" generated by the shared audo-blk
down-sream driver is missing from the mainline.  I looked up the clock
I referenced when I attempted to enable the miffil, but
'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
the macros, but it seems like the pdm_sel should somehow have an
additional variable for the shared clock and an additional clock like
pdm_root_clk assigned with it.

I have similar configurations for Mini and Nano, and both of them are
able to record audio, so I think there might be a clock issue
somewhere related to the audiomix driver, and not a misconfiguration
of the sound-card or the micfil itself.

thanks for any suggestions,

adam


[1] - https://patchwork.kernel.org/project/linux-arm-kernel/patch/20230827023155.467807-3-aford173@gmail.com/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
  2023-08-30  2:44   ` Adam Ford
@ 2023-08-30 19:10     ` Marek Vasut
  -1 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2023-08-30 19:10 UTC (permalink / raw)
  To: Adam Ford
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Richard Leitner, Abel Vesa,
	Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On 8/30/23 04:44, Adam Ford wrote:

Hi,

> I have a question about the clocking for eASRC and PDM.
> 
>> +
>> +                       audio_blk_ctrl: clock-controller@30e20000 {
>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
>> +                               reg = <0x30e20000 0x10000>;
>> +                               #clock-cells = <1>;
>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
>> +                                        <&clk IMX8MP_CLK_SAI1>,
>> +                                        <&clk IMX8MP_CLK_SAI2>,
>> +                                        <&clk IMX8MP_CLK_SAI3>,
>> +                                        <&clk IMX8MP_CLK_SAI5>,
>> +                                        <&clk IMX8MP_CLK_SAI6>,
>> +                                        <&clk IMX8MP_CLK_SAI7>;
>> +                               clock-names = "ahb",
>> +                                             "sai1", "sai2", "sai3",
>> +                                             "sai5", "sai6", "sai7";
>> +                               power-domains = <&pgc_audio>;
>> +                       };
>> +               };
>> +
> 
> I am trying to plumb in the micfil driver with a PDM microphone on a
> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
> appear to see anything coming in.  I was curious why the
> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
> one for the PDM nor the ASRC clocks.

I only ever needed SAI, so that was what was tested on the EVK .

> I added the MICFIL noted to the
> 8mp in a previous patch [1], and I am trying to customize the MICFIL
> node as follows:
> 
> &micfil {
> #sound-dai-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&pinctrl_pdm>;
> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
> assigned-clock-rates = <196608000>;
> status = "okay";
> };
> 
> I also noticed in the down-stream kernel, the pdm_ipg_clk and
> pdm_root_clk are shared gates with separate parents.
> 
> The PDM tree of the down-stream kernel looks like this:
>   audio_pll1_ref_sel                0        0        0    24000000
>       0     0  50000         Y
>         audio_pll1                     0        0        0   393216000
>          0     0  50000         Y
>            audio_pll1_bypass           0        0        0   393216000
>          0     0  50000         Y
>               audio_pll1_out           0        0        0   393216000
>          0     0  50000         N
>                  pdm                   0        0        0   196608000
>          0     0  50000         N
>                     pdm_root           0        0        0   196608000
>          0     0  50000         N
>                        pdm_sel         0        0        0   196608000
>          0     0  50000         Y
>                           pdm_root_clk       0        0        0
> 196608000          0     0  50000         N
> 
> The PDM tree of the mainline looks like this:
> 
>     audio_pll1_ref_sel                0        0        0    24000000
>         0     0  50000         Y
>         audio_pll1                     0        0        0   393216000
>          0     0  50000         Y
>            audio_pll1_bypass           0        0        0   393216000
>          0     0  50000         Y
>               audio_pll1_out           0        0        0   393216000
>          0     0  50000         N
>                  pdm                   0        0        0   196608000
>          0     0  50000         N
>                     pdm_root           0        0        0   196608000
>          0     0  50000         N
>                        pdm_sel         0        0        0   196608000
>          0     0  50000         Y
> 
> It seems like the "pdm_root_clk" generated by the shared audo-blk
> down-sream driver is missing from the mainline.  I looked up the clock
> I referenced when I attempted to enable the miffil, but
> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
> the macros, but it seems like the pdm_sel should somehow have an
> additional variable for the shared clock and an additional clock like
> pdm_root_clk assigned with it.
> 
> I have similar configurations for Mini and Nano, and both of them are
> able to record audio, so I think there might be a clock issue
> somewhere related to the audiomix driver, and not a misconfiguration
> of the sound-card or the micfil itself.

Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and 
enable those clock in the driver ?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
@ 2023-08-30 19:10     ` Marek Vasut
  0 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2023-08-30 19:10 UTC (permalink / raw)
  To: Adam Ford
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Richard Leitner, Abel Vesa,
	Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On 8/30/23 04:44, Adam Ford wrote:

Hi,

> I have a question about the clocking for eASRC and PDM.
> 
>> +
>> +                       audio_blk_ctrl: clock-controller@30e20000 {
>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
>> +                               reg = <0x30e20000 0x10000>;
>> +                               #clock-cells = <1>;
>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
>> +                                        <&clk IMX8MP_CLK_SAI1>,
>> +                                        <&clk IMX8MP_CLK_SAI2>,
>> +                                        <&clk IMX8MP_CLK_SAI3>,
>> +                                        <&clk IMX8MP_CLK_SAI5>,
>> +                                        <&clk IMX8MP_CLK_SAI6>,
>> +                                        <&clk IMX8MP_CLK_SAI7>;
>> +                               clock-names = "ahb",
>> +                                             "sai1", "sai2", "sai3",
>> +                                             "sai5", "sai6", "sai7";
>> +                               power-domains = <&pgc_audio>;
>> +                       };
>> +               };
>> +
> 
> I am trying to plumb in the micfil driver with a PDM microphone on a
> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
> appear to see anything coming in.  I was curious why the
> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
> one for the PDM nor the ASRC clocks.

I only ever needed SAI, so that was what was tested on the EVK .

> I added the MICFIL noted to the
> 8mp in a previous patch [1], and I am trying to customize the MICFIL
> node as follows:
> 
> &micfil {
> #sound-dai-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&pinctrl_pdm>;
> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
> assigned-clock-rates = <196608000>;
> status = "okay";
> };
> 
> I also noticed in the down-stream kernel, the pdm_ipg_clk and
> pdm_root_clk are shared gates with separate parents.
> 
> The PDM tree of the down-stream kernel looks like this:
>   audio_pll1_ref_sel                0        0        0    24000000
>       0     0  50000         Y
>         audio_pll1                     0        0        0   393216000
>          0     0  50000         Y
>            audio_pll1_bypass           0        0        0   393216000
>          0     0  50000         Y
>               audio_pll1_out           0        0        0   393216000
>          0     0  50000         N
>                  pdm                   0        0        0   196608000
>          0     0  50000         N
>                     pdm_root           0        0        0   196608000
>          0     0  50000         N
>                        pdm_sel         0        0        0   196608000
>          0     0  50000         Y
>                           pdm_root_clk       0        0        0
> 196608000          0     0  50000         N
> 
> The PDM tree of the mainline looks like this:
> 
>     audio_pll1_ref_sel                0        0        0    24000000
>         0     0  50000         Y
>         audio_pll1                     0        0        0   393216000
>          0     0  50000         Y
>            audio_pll1_bypass           0        0        0   393216000
>          0     0  50000         Y
>               audio_pll1_out           0        0        0   393216000
>          0     0  50000         N
>                  pdm                   0        0        0   196608000
>          0     0  50000         N
>                     pdm_root           0        0        0   196608000
>          0     0  50000         N
>                        pdm_sel         0        0        0   196608000
>          0     0  50000         Y
> 
> It seems like the "pdm_root_clk" generated by the shared audo-blk
> down-sream driver is missing from the mainline.  I looked up the clock
> I referenced when I attempted to enable the miffil, but
> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
> the macros, but it seems like the pdm_sel should somehow have an
> additional variable for the shared clock and an additional clock like
> pdm_root_clk assigned with it.
> 
> I have similar configurations for Mini and Nano, and both of them are
> able to record audio, so I think there might be a clock issue
> somewhere related to the audiomix driver, and not a misconfiguration
> of the sound-card or the micfil itself.

Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and 
enable those clock in the driver ?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
  2023-08-30 19:10     ` Marek Vasut
@ 2023-08-30 19:59       ` Adam Ford
  -1 siblings, 0 replies; 15+ messages in thread
From: Adam Ford @ 2023-08-30 19:59 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Richard Leitner, Abel Vesa,
	Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
>
> On 8/30/23 04:44, Adam Ford wrote:
>
> Hi,
>
> > I have a question about the clocking for eASRC and PDM.
> >
> >> +
> >> +                       audio_blk_ctrl: clock-controller@30e20000 {
> >> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
> >> +                               reg = <0x30e20000 0x10000>;
> >> +                               #clock-cells = <1>;
> >> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
> >> +                                        <&clk IMX8MP_CLK_SAI1>,
> >> +                                        <&clk IMX8MP_CLK_SAI2>,
> >> +                                        <&clk IMX8MP_CLK_SAI3>,
> >> +                                        <&clk IMX8MP_CLK_SAI5>,
> >> +                                        <&clk IMX8MP_CLK_SAI6>,
> >> +                                        <&clk IMX8MP_CLK_SAI7>;
> >> +                               clock-names = "ahb",
> >> +                                             "sai1", "sai2", "sai3",
> >> +                                             "sai5", "sai6", "sai7";
> >> +                               power-domains = <&pgc_audio>;
> >> +                       };
> >> +               };
> >> +
> >
> > I am trying to plumb in the micfil driver with a PDM microphone on a
> > Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
> > micfil, the PDM clock doesn't get turned on, and the micfil doesn't
> > appear to see anything coming in.  I was curious why the
> > audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
> > one for the PDM nor the ASRC clocks.
>
> I only ever needed SAI, so that was what was tested on the EVK .

That makes sense.

>
> > I added the MICFIL noted to the
> > 8mp in a previous patch [1], and I am trying to customize the MICFIL
> > node as follows:
> >
> > &micfil {
> > #sound-dai-cells = <0>;
> > pinctrl-names = "default";
> > pinctrl-0 = <&pinctrl_pdm>;
> > assigned-clocks = <&clk IMX8MP_CLK_PDM>;
> > assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
> > assigned-clock-rates = <196608000>;
> > status = "okay";
> > };
> >
> > I also noticed in the down-stream kernel, the pdm_ipg_clk and
> > pdm_root_clk are shared gates with separate parents.
> >
> > The PDM tree of the down-stream kernel looks like this:
> >   audio_pll1_ref_sel                0        0        0    24000000
> >       0     0  50000         Y
> >         audio_pll1                     0        0        0   393216000
> >          0     0  50000         Y
> >            audio_pll1_bypass           0        0        0   393216000
> >          0     0  50000         Y
> >               audio_pll1_out           0        0        0   393216000
> >          0     0  50000         N
> >                  pdm                   0        0        0   196608000
> >          0     0  50000         N
> >                     pdm_root           0        0        0   196608000
> >          0     0  50000         N
> >                        pdm_sel         0        0        0   196608000
> >          0     0  50000         Y
> >                           pdm_root_clk       0        0        0
> > 196608000          0     0  50000         N
> >
> > The PDM tree of the mainline looks like this:
> >
> >     audio_pll1_ref_sel                0        0        0    24000000
> >         0     0  50000         Y
> >         audio_pll1                     0        0        0   393216000
> >          0     0  50000         Y
> >            audio_pll1_bypass           0        0        0   393216000
> >          0     0  50000         Y
> >               audio_pll1_out           0        0        0   393216000
> >          0     0  50000         N
> >                  pdm                   0        0        0   196608000
> >          0     0  50000         N
> >                     pdm_root           0        0        0   196608000
> >          0     0  50000         N
> >                        pdm_sel         0        0        0   196608000
> >          0     0  50000         Y
> >
> > It seems like the "pdm_root_clk" generated by the shared audo-blk
> > down-sream driver is missing from the mainline.  I looked up the clock
> > I referenced when I attempted to enable the miffil, but
> > 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
> > either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
> > the macros, but it seems like the pdm_sel should somehow have an
> > additional variable for the shared clock and an additional clock like
> > pdm_root_clk assigned with it.
> >
> > I have similar configurations for Mini and Nano, and both of them are
> > able to record audio, so I think there might be a clock issue
> > somewhere related to the audiomix driver, and not a misconfiguration
> > of the sound-card or the micfil itself.
>
> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
> enable those clock in the driver ?

Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
directory.  I tried making it use pdm_sel, but it threw an error.  I
am not near my system, so I'm sorry I don't have more details.

In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
pdm_sel, but I am not certain as to what the difference between them
was since they appeared to be shared.

adam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
@ 2023-08-30 19:59       ` Adam Ford
  0 siblings, 0 replies; 15+ messages in thread
From: Adam Ford @ 2023-08-30 19:59 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Richard Leitner, Abel Vesa,
	Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
>
> On 8/30/23 04:44, Adam Ford wrote:
>
> Hi,
>
> > I have a question about the clocking for eASRC and PDM.
> >
> >> +
> >> +                       audio_blk_ctrl: clock-controller@30e20000 {
> >> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
> >> +                               reg = <0x30e20000 0x10000>;
> >> +                               #clock-cells = <1>;
> >> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
> >> +                                        <&clk IMX8MP_CLK_SAI1>,
> >> +                                        <&clk IMX8MP_CLK_SAI2>,
> >> +                                        <&clk IMX8MP_CLK_SAI3>,
> >> +                                        <&clk IMX8MP_CLK_SAI5>,
> >> +                                        <&clk IMX8MP_CLK_SAI6>,
> >> +                                        <&clk IMX8MP_CLK_SAI7>;
> >> +                               clock-names = "ahb",
> >> +                                             "sai1", "sai2", "sai3",
> >> +                                             "sai5", "sai6", "sai7";
> >> +                               power-domains = <&pgc_audio>;
> >> +                       };
> >> +               };
> >> +
> >
> > I am trying to plumb in the micfil driver with a PDM microphone on a
> > Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
> > micfil, the PDM clock doesn't get turned on, and the micfil doesn't
> > appear to see anything coming in.  I was curious why the
> > audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
> > one for the PDM nor the ASRC clocks.
>
> I only ever needed SAI, so that was what was tested on the EVK .

That makes sense.

>
> > I added the MICFIL noted to the
> > 8mp in a previous patch [1], and I am trying to customize the MICFIL
> > node as follows:
> >
> > &micfil {
> > #sound-dai-cells = <0>;
> > pinctrl-names = "default";
> > pinctrl-0 = <&pinctrl_pdm>;
> > assigned-clocks = <&clk IMX8MP_CLK_PDM>;
> > assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
> > assigned-clock-rates = <196608000>;
> > status = "okay";
> > };
> >
> > I also noticed in the down-stream kernel, the pdm_ipg_clk and
> > pdm_root_clk are shared gates with separate parents.
> >
> > The PDM tree of the down-stream kernel looks like this:
> >   audio_pll1_ref_sel                0        0        0    24000000
> >       0     0  50000         Y
> >         audio_pll1                     0        0        0   393216000
> >          0     0  50000         Y
> >            audio_pll1_bypass           0        0        0   393216000
> >          0     0  50000         Y
> >               audio_pll1_out           0        0        0   393216000
> >          0     0  50000         N
> >                  pdm                   0        0        0   196608000
> >          0     0  50000         N
> >                     pdm_root           0        0        0   196608000
> >          0     0  50000         N
> >                        pdm_sel         0        0        0   196608000
> >          0     0  50000         Y
> >                           pdm_root_clk       0        0        0
> > 196608000          0     0  50000         N
> >
> > The PDM tree of the mainline looks like this:
> >
> >     audio_pll1_ref_sel                0        0        0    24000000
> >         0     0  50000         Y
> >         audio_pll1                     0        0        0   393216000
> >          0     0  50000         Y
> >            audio_pll1_bypass           0        0        0   393216000
> >          0     0  50000         Y
> >               audio_pll1_out           0        0        0   393216000
> >          0     0  50000         N
> >                  pdm                   0        0        0   196608000
> >          0     0  50000         N
> >                     pdm_root           0        0        0   196608000
> >          0     0  50000         N
> >                        pdm_sel         0        0        0   196608000
> >          0     0  50000         Y
> >
> > It seems like the "pdm_root_clk" generated by the shared audo-blk
> > down-sream driver is missing from the mainline.  I looked up the clock
> > I referenced when I attempted to enable the miffil, but
> > 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
> > either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
> > the macros, but it seems like the pdm_sel should somehow have an
> > additional variable for the shared clock and an additional clock like
> > pdm_root_clk assigned with it.
> >
> > I have similar configurations for Mini and Nano, and both of them are
> > able to record audio, so I think there might be a clock issue
> > somewhere related to the audiomix driver, and not a misconfiguration
> > of the sound-card or the micfil itself.
>
> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
> enable those clock in the driver ?

Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
directory.  I tried making it use pdm_sel, but it threw an error.  I
am not near my system, so I'm sorry I don't have more details.

In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
pdm_sel, but I am not certain as to what the difference between them
was since they appeared to be shared.

adam

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
  2023-08-30 19:59       ` Adam Ford
@ 2023-08-30 20:50         ` Marek Vasut
  -1 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2023-08-30 20:50 UTC (permalink / raw)
  To: Adam Ford
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Richard Leitner, Abel Vesa,
	Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On 8/30/23 21:59, Adam Ford wrote:
> On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 8/30/23 04:44, Adam Ford wrote:
>>
>> Hi,
>>
>>> I have a question about the clocking for eASRC and PDM.
>>>
>>>> +
>>>> +                       audio_blk_ctrl: clock-controller@30e20000 {
>>>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
>>>> +                               reg = <0x30e20000 0x10000>;
>>>> +                               #clock-cells = <1>;
>>>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
>>>> +                                        <&clk IMX8MP_CLK_SAI1>,
>>>> +                                        <&clk IMX8MP_CLK_SAI2>,
>>>> +                                        <&clk IMX8MP_CLK_SAI3>,
>>>> +                                        <&clk IMX8MP_CLK_SAI5>,
>>>> +                                        <&clk IMX8MP_CLK_SAI6>,
>>>> +                                        <&clk IMX8MP_CLK_SAI7>;
>>>> +                               clock-names = "ahb",
>>>> +                                             "sai1", "sai2", "sai3",
>>>> +                                             "sai5", "sai6", "sai7";
>>>> +                               power-domains = <&pgc_audio>;
>>>> +                       };
>>>> +               };
>>>> +
>>>
>>> I am trying to plumb in the micfil driver with a PDM microphone on a
>>> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
>>> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
>>> appear to see anything coming in.  I was curious why the
>>> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
>>> one for the PDM nor the ASRC clocks.
>>
>> I only ever needed SAI, so that was what was tested on the EVK .
> 
> That makes sense.
> 
>>
>>> I added the MICFIL noted to the
>>> 8mp in a previous patch [1], and I am trying to customize the MICFIL
>>> node as follows:
>>>
>>> &micfil {
>>> #sound-dai-cells = <0>;
>>> pinctrl-names = "default";
>>> pinctrl-0 = <&pinctrl_pdm>;
>>> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
>>> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
>>> assigned-clock-rates = <196608000>;
>>> status = "okay";
>>> };
>>>
>>> I also noticed in the down-stream kernel, the pdm_ipg_clk and
>>> pdm_root_clk are shared gates with separate parents.
>>>
>>> The PDM tree of the down-stream kernel looks like this:
>>>    audio_pll1_ref_sel                0        0        0    24000000
>>>        0     0  50000         Y
>>>          audio_pll1                     0        0        0   393216000
>>>           0     0  50000         Y
>>>             audio_pll1_bypass           0        0        0   393216000
>>>           0     0  50000         Y
>>>                audio_pll1_out           0        0        0   393216000
>>>           0     0  50000         N
>>>                   pdm                   0        0        0   196608000
>>>           0     0  50000         N
>>>                      pdm_root           0        0        0   196608000
>>>           0     0  50000         N
>>>                         pdm_sel         0        0        0   196608000
>>>           0     0  50000         Y
>>>                            pdm_root_clk       0        0        0
>>> 196608000          0     0  50000         N
>>>
>>> The PDM tree of the mainline looks like this:
>>>
>>>      audio_pll1_ref_sel                0        0        0    24000000
>>>          0     0  50000         Y
>>>          audio_pll1                     0        0        0   393216000
>>>           0     0  50000         Y
>>>             audio_pll1_bypass           0        0        0   393216000
>>>           0     0  50000         Y
>>>                audio_pll1_out           0        0        0   393216000
>>>           0     0  50000         N
>>>                   pdm                   0        0        0   196608000
>>>           0     0  50000         N
>>>                      pdm_root           0        0        0   196608000
>>>           0     0  50000         N
>>>                         pdm_sel         0        0        0   196608000
>>>           0     0  50000         Y
>>>
>>> It seems like the "pdm_root_clk" generated by the shared audo-blk
>>> down-sream driver is missing from the mainline.  I looked up the clock
>>> I referenced when I attempted to enable the miffil, but
>>> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
>>> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
>>> the macros, but it seems like the pdm_sel should somehow have an
>>> additional variable for the shared clock and an additional clock like
>>> pdm_root_clk assigned with it.
>>>
>>> I have similar configurations for Mini and Nano, and both of them are
>>> able to record audio, so I think there might be a clock issue
>>> somewhere related to the audiomix driver, and not a misconfiguration
>>> of the sound-card or the micfil itself.
>>
>> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
>> enable those clock in the driver ?
> 
> Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
> directory.  I tried making it use pdm_sel, but it threw an error.  I
> am not near my system, so I'm sorry I don't have more details.
> 
> In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
> pdm_sel, but I am not certain as to what the difference between them
> was since they appeared to be shared.

The pdm_sel is definitely a mux . Is there a follow-up gate after the mux ?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
@ 2023-08-30 20:50         ` Marek Vasut
  0 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2023-08-30 20:50 UTC (permalink / raw)
  To: Adam Ford
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Richard Leitner, Abel Vesa,
	Jacky Bai, Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On 8/30/23 21:59, Adam Ford wrote:
> On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 8/30/23 04:44, Adam Ford wrote:
>>
>> Hi,
>>
>>> I have a question about the clocking for eASRC and PDM.
>>>
>>>> +
>>>> +                       audio_blk_ctrl: clock-controller@30e20000 {
>>>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
>>>> +                               reg = <0x30e20000 0x10000>;
>>>> +                               #clock-cells = <1>;
>>>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
>>>> +                                        <&clk IMX8MP_CLK_SAI1>,
>>>> +                                        <&clk IMX8MP_CLK_SAI2>,
>>>> +                                        <&clk IMX8MP_CLK_SAI3>,
>>>> +                                        <&clk IMX8MP_CLK_SAI5>,
>>>> +                                        <&clk IMX8MP_CLK_SAI6>,
>>>> +                                        <&clk IMX8MP_CLK_SAI7>;
>>>> +                               clock-names = "ahb",
>>>> +                                             "sai1", "sai2", "sai3",
>>>> +                                             "sai5", "sai6", "sai7";
>>>> +                               power-domains = <&pgc_audio>;
>>>> +                       };
>>>> +               };
>>>> +
>>>
>>> I am trying to plumb in the micfil driver with a PDM microphone on a
>>> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
>>> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
>>> appear to see anything coming in.  I was curious why the
>>> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
>>> one for the PDM nor the ASRC clocks.
>>
>> I only ever needed SAI, so that was what was tested on the EVK .
> 
> That makes sense.
> 
>>
>>> I added the MICFIL noted to the
>>> 8mp in a previous patch [1], and I am trying to customize the MICFIL
>>> node as follows:
>>>
>>> &micfil {
>>> #sound-dai-cells = <0>;
>>> pinctrl-names = "default";
>>> pinctrl-0 = <&pinctrl_pdm>;
>>> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
>>> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
>>> assigned-clock-rates = <196608000>;
>>> status = "okay";
>>> };
>>>
>>> I also noticed in the down-stream kernel, the pdm_ipg_clk and
>>> pdm_root_clk are shared gates with separate parents.
>>>
>>> The PDM tree of the down-stream kernel looks like this:
>>>    audio_pll1_ref_sel                0        0        0    24000000
>>>        0     0  50000         Y
>>>          audio_pll1                     0        0        0   393216000
>>>           0     0  50000         Y
>>>             audio_pll1_bypass           0        0        0   393216000
>>>           0     0  50000         Y
>>>                audio_pll1_out           0        0        0   393216000
>>>           0     0  50000         N
>>>                   pdm                   0        0        0   196608000
>>>           0     0  50000         N
>>>                      pdm_root           0        0        0   196608000
>>>           0     0  50000         N
>>>                         pdm_sel         0        0        0   196608000
>>>           0     0  50000         Y
>>>                            pdm_root_clk       0        0        0
>>> 196608000          0     0  50000         N
>>>
>>> The PDM tree of the mainline looks like this:
>>>
>>>      audio_pll1_ref_sel                0        0        0    24000000
>>>          0     0  50000         Y
>>>          audio_pll1                     0        0        0   393216000
>>>           0     0  50000         Y
>>>             audio_pll1_bypass           0        0        0   393216000
>>>           0     0  50000         Y
>>>                audio_pll1_out           0        0        0   393216000
>>>           0     0  50000         N
>>>                   pdm                   0        0        0   196608000
>>>           0     0  50000         N
>>>                      pdm_root           0        0        0   196608000
>>>           0     0  50000         N
>>>                         pdm_sel         0        0        0   196608000
>>>           0     0  50000         Y
>>>
>>> It seems like the "pdm_root_clk" generated by the shared audo-blk
>>> down-sream driver is missing from the mainline.  I looked up the clock
>>> I referenced when I attempted to enable the miffil, but
>>> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
>>> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
>>> the macros, but it seems like the pdm_sel should somehow have an
>>> additional variable for the shared clock and an additional clock like
>>> pdm_root_clk assigned with it.
>>>
>>> I have similar configurations for Mini and Nano, and both of them are
>>> able to record audio, so I think there might be a clock issue
>>> somewhere related to the audiomix driver, and not a misconfiguration
>>> of the sound-card or the micfil itself.
>>
>> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
>> enable those clock in the driver ?
> 
> Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
> directory.  I tried making it use pdm_sel, but it threw an error.  I
> am not near my system, so I'm sorry I don't have more details.
> 
> In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
> pdm_sel, but I am not certain as to what the difference between them
> was since they appeared to be shared.

The pdm_sel is definitely a mux . Is there a follow-up gate after the mux ?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
  2023-08-30 20:50         ` Marek Vasut
@ 2023-08-31  4:32           ` Adam Ford
  -1 siblings, 0 replies; 15+ messages in thread
From: Adam Ford @ 2023-08-31  4:32 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Abel Vesa, Jacky Bai,
	Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On Wed, Aug 30, 2023 at 3:50 PM Marek Vasut <marex@denx.de> wrote:
>
> On 8/30/23 21:59, Adam Ford wrote:
> > On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
> >>
> >> On 8/30/23 04:44, Adam Ford wrote:
> >>
> >> Hi,
> >>
> >>> I have a question about the clocking for eASRC and PDM.
> >>>
> >>>> +
> >>>> +                       audio_blk_ctrl: clock-controller@30e20000 {
> >>>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
> >>>> +                               reg = <0x30e20000 0x10000>;
> >>>> +                               #clock-cells = <1>;
> >>>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI1>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI2>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI3>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI5>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI6>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI7>;
> >>>> +                               clock-names = "ahb",
> >>>> +                                             "sai1", "sai2", "sai3",
> >>>> +                                             "sai5", "sai6", "sai7";
> >>>> +                               power-domains = <&pgc_audio>;
> >>>> +                       };
> >>>> +               };
> >>>> +
> >>>
> >>> I am trying to plumb in the micfil driver with a PDM microphone on a
> >>> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
> >>> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
> >>> appear to see anything coming in.  I was curious why the
> >>> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
> >>> one for the PDM nor the ASRC clocks.
> >>
> >> I only ever needed SAI, so that was what was tested on the EVK .
> >
> > That makes sense.
> >
> >>
> >>> I added the MICFIL noted to the
> >>> 8mp in a previous patch [1], and I am trying to customize the MICFIL
> >>> node as follows:
> >>>
> >>> &micfil {
> >>> #sound-dai-cells = <0>;
> >>> pinctrl-names = "default";
> >>> pinctrl-0 = <&pinctrl_pdm>;
> >>> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
> >>> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
> >>> assigned-clock-rates = <196608000>;
> >>> status = "okay";
> >>> };
> >>>
> >>> I also noticed in the down-stream kernel, the pdm_ipg_clk and
> >>> pdm_root_clk are shared gates with separate parents.
> >>>
> >>> The PDM tree of the down-stream kernel looks like this:
> >>>    audio_pll1_ref_sel                0        0        0    24000000
> >>>        0     0  50000         Y
> >>>          audio_pll1                     0        0        0   393216000
> >>>           0     0  50000         Y
> >>>             audio_pll1_bypass           0        0        0   393216000
> >>>           0     0  50000         Y
> >>>                audio_pll1_out           0        0        0   393216000
> >>>           0     0  50000         N
> >>>                   pdm                   0        0        0   196608000
> >>>           0     0  50000         N
> >>>                      pdm_root           0        0        0   196608000
> >>>           0     0  50000         N
> >>>                         pdm_sel         0        0        0   196608000
> >>>           0     0  50000         Y
> >>>                            pdm_root_clk       0        0        0
> >>> 196608000          0     0  50000         N
> >>>
> >>> The PDM tree of the mainline looks like this:
> >>>
> >>>      audio_pll1_ref_sel                0        0        0    24000000
> >>>          0     0  50000         Y
> >>>          audio_pll1                     0        0        0   393216000
> >>>           0     0  50000         Y
> >>>             audio_pll1_bypass           0        0        0   393216000
> >>>           0     0  50000         Y
> >>>                audio_pll1_out           0        0        0   393216000
> >>>           0     0  50000         N
> >>>                   pdm                   0        0        0   196608000
> >>>           0     0  50000         N
> >>>                      pdm_root           0        0        0   196608000
> >>>           0     0  50000         N
> >>>                         pdm_sel         0        0        0   196608000
> >>>           0     0  50000         Y
> >>>
> >>> It seems like the "pdm_root_clk" generated by the shared audo-blk
> >>> down-sream driver is missing from the mainline.  I looked up the clock
> >>> I referenced when I attempted to enable the miffil, but
> >>> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
> >>> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
> >>> the macros, but it seems like the pdm_sel should somehow have an
> >>> additional variable for the shared clock and an additional clock like
> >>> pdm_root_clk assigned with it.
> >>>
> >>> I have similar configurations for Mini and Nano, and both of them are
> >>> able to record audio, so I think there might be a clock issue
> >>> somewhere related to the audiomix driver, and not a misconfiguration
> >>> of the sound-card or the micfil itself.
> >>
> >> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
> >> enable those clock in the driver ?
> >
> > Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
> > IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
> > IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
> > directory.  I tried making it use pdm_sel, but it threw an error.  I
> > am not near my system, so I'm sorry I don't have more details.
> >
> > In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
> > pdm_sel, but I am not certain as to what the difference between them
> > was since they appeared to be shared.
>
> The pdm_sel is definitely a mux . Is there a follow-up gate after the mux ?

Not that I could see.  I think I was just overthinking it.  I saw the
IMX8MP_CLK_AUDIOMIX_PDM_ROOT in mx8mp-clock.h which matched the
reference in the downstream kernel, so I was expecting that to be the
same clock name.  When it didn't work, I thought I was missing
something because I only saw the pdm_sel mux and no direct reason or
reference to IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I have it working now.
Sorry for the noise.  I'll get my series cleaned up and push another
revision to add micfil node to the 8mp, and I'll probably remove the
IMX8MP_CLK_AUDIOMIX_PDM_ROOT imx8mp-clock.h so it doesn't throw
someone else off.

I appreciate your input.

adam

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
@ 2023-08-31  4:32           ` Adam Ford
  0 siblings, 0 replies; 15+ messages in thread
From: Adam Ford @ 2023-08-31  4:32 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Abel Vesa, Jacky Bai,
	Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On Wed, Aug 30, 2023 at 3:50 PM Marek Vasut <marex@denx.de> wrote:
>
> On 8/30/23 21:59, Adam Ford wrote:
> > On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
> >>
> >> On 8/30/23 04:44, Adam Ford wrote:
> >>
> >> Hi,
> >>
> >>> I have a question about the clocking for eASRC and PDM.
> >>>
> >>>> +
> >>>> +                       audio_blk_ctrl: clock-controller@30e20000 {
> >>>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
> >>>> +                               reg = <0x30e20000 0x10000>;
> >>>> +                               #clock-cells = <1>;
> >>>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI1>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI2>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI3>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI5>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI6>,
> >>>> +                                        <&clk IMX8MP_CLK_SAI7>;
> >>>> +                               clock-names = "ahb",
> >>>> +                                             "sai1", "sai2", "sai3",
> >>>> +                                             "sai5", "sai6", "sai7";
> >>>> +                               power-domains = <&pgc_audio>;
> >>>> +                       };
> >>>> +               };
> >>>> +
> >>>
> >>> I am trying to plumb in the micfil driver with a PDM microphone on a
> >>> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
> >>> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
> >>> appear to see anything coming in.  I was curious why the
> >>> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
> >>> one for the PDM nor the ASRC clocks.
> >>
> >> I only ever needed SAI, so that was what was tested on the EVK .
> >
> > That makes sense.
> >
> >>
> >>> I added the MICFIL noted to the
> >>> 8mp in a previous patch [1], and I am trying to customize the MICFIL
> >>> node as follows:
> >>>
> >>> &micfil {
> >>> #sound-dai-cells = <0>;
> >>> pinctrl-names = "default";
> >>> pinctrl-0 = <&pinctrl_pdm>;
> >>> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
> >>> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
> >>> assigned-clock-rates = <196608000>;
> >>> status = "okay";
> >>> };
> >>>
> >>> I also noticed in the down-stream kernel, the pdm_ipg_clk and
> >>> pdm_root_clk are shared gates with separate parents.
> >>>
> >>> The PDM tree of the down-stream kernel looks like this:
> >>>    audio_pll1_ref_sel                0        0        0    24000000
> >>>        0     0  50000         Y
> >>>          audio_pll1                     0        0        0   393216000
> >>>           0     0  50000         Y
> >>>             audio_pll1_bypass           0        0        0   393216000
> >>>           0     0  50000         Y
> >>>                audio_pll1_out           0        0        0   393216000
> >>>           0     0  50000         N
> >>>                   pdm                   0        0        0   196608000
> >>>           0     0  50000         N
> >>>                      pdm_root           0        0        0   196608000
> >>>           0     0  50000         N
> >>>                         pdm_sel         0        0        0   196608000
> >>>           0     0  50000         Y
> >>>                            pdm_root_clk       0        0        0
> >>> 196608000          0     0  50000         N
> >>>
> >>> The PDM tree of the mainline looks like this:
> >>>
> >>>      audio_pll1_ref_sel                0        0        0    24000000
> >>>          0     0  50000         Y
> >>>          audio_pll1                     0        0        0   393216000
> >>>           0     0  50000         Y
> >>>             audio_pll1_bypass           0        0        0   393216000
> >>>           0     0  50000         Y
> >>>                audio_pll1_out           0        0        0   393216000
> >>>           0     0  50000         N
> >>>                   pdm                   0        0        0   196608000
> >>>           0     0  50000         N
> >>>                      pdm_root           0        0        0   196608000
> >>>           0     0  50000         N
> >>>                         pdm_sel         0        0        0   196608000
> >>>           0     0  50000         Y
> >>>
> >>> It seems like the "pdm_root_clk" generated by the shared audo-blk
> >>> down-sream driver is missing from the mainline.  I looked up the clock
> >>> I referenced when I attempted to enable the miffil, but
> >>> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
> >>> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
> >>> the macros, but it seems like the pdm_sel should somehow have an
> >>> additional variable for the shared clock and an additional clock like
> >>> pdm_root_clk assigned with it.
> >>>
> >>> I have similar configurations for Mini and Nano, and both of them are
> >>> able to record audio, so I think there might be a clock issue
> >>> somewhere related to the audiomix driver, and not a misconfiguration
> >>> of the sound-card or the micfil itself.
> >>
> >> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
> >> enable those clock in the driver ?
> >
> > Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
> > IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
> > IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
> > directory.  I tried making it use pdm_sel, but it threw an error.  I
> > am not near my system, so I'm sorry I don't have more details.
> >
> > In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
> > pdm_sel, but I am not certain as to what the difference between them
> > was since they appeared to be shared.
>
> The pdm_sel is definitely a mux . Is there a follow-up gate after the mux ?

Not that I could see.  I think I was just overthinking it.  I saw the
IMX8MP_CLK_AUDIOMIX_PDM_ROOT in mx8mp-clock.h which matched the
reference in the downstream kernel, so I was expecting that to be the
same clock name.  When it didn't work, I thought I was missing
something because I only saw the pdm_sel mux and no direct reason or
reference to IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I have it working now.
Sorry for the noise.  I'll get my series cleaned up and push another
revision to add micfil node to the 8mp, and I'll probably remove the
IMX8MP_CLK_AUDIOMIX_PDM_ROOT imx8mp-clock.h so it doesn't throw
someone else off.

I appreciate your input.

adam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
  2023-08-31  4:32           ` Adam Ford
@ 2023-08-31 13:36             ` Marek Vasut
  -1 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2023-08-31 13:36 UTC (permalink / raw)
  To: Adam Ford
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Abel Vesa, Jacky Bai,
	Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On 8/31/23 06:32, Adam Ford wrote:
> On Wed, Aug 30, 2023 at 3:50 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 8/30/23 21:59, Adam Ford wrote:
>>> On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
>>>>
>>>> On 8/30/23 04:44, Adam Ford wrote:
>>>>
>>>> Hi,
>>>>
>>>>> I have a question about the clocking for eASRC and PDM.
>>>>>
>>>>>> +
>>>>>> +                       audio_blk_ctrl: clock-controller@30e20000 {
>>>>>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
>>>>>> +                               reg = <0x30e20000 0x10000>;
>>>>>> +                               #clock-cells = <1>;
>>>>>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI1>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI2>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI3>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI5>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI6>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI7>;
>>>>>> +                               clock-names = "ahb",
>>>>>> +                                             "sai1", "sai2", "sai3",
>>>>>> +                                             "sai5", "sai6", "sai7";
>>>>>> +                               power-domains = <&pgc_audio>;
>>>>>> +                       };
>>>>>> +               };
>>>>>> +
>>>>>
>>>>> I am trying to plumb in the micfil driver with a PDM microphone on a
>>>>> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
>>>>> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
>>>>> appear to see anything coming in.  I was curious why the
>>>>> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
>>>>> one for the PDM nor the ASRC clocks.
>>>>
>>>> I only ever needed SAI, so that was what was tested on the EVK .
>>>
>>> That makes sense.
>>>
>>>>
>>>>> I added the MICFIL noted to the
>>>>> 8mp in a previous patch [1], and I am trying to customize the MICFIL
>>>>> node as follows:
>>>>>
>>>>> &micfil {
>>>>> #sound-dai-cells = <0>;
>>>>> pinctrl-names = "default";
>>>>> pinctrl-0 = <&pinctrl_pdm>;
>>>>> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
>>>>> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
>>>>> assigned-clock-rates = <196608000>;
>>>>> status = "okay";
>>>>> };
>>>>>
>>>>> I also noticed in the down-stream kernel, the pdm_ipg_clk and
>>>>> pdm_root_clk are shared gates with separate parents.
>>>>>
>>>>> The PDM tree of the down-stream kernel looks like this:
>>>>>     audio_pll1_ref_sel                0        0        0    24000000
>>>>>         0     0  50000         Y
>>>>>           audio_pll1                     0        0        0   393216000
>>>>>            0     0  50000         Y
>>>>>              audio_pll1_bypass           0        0        0   393216000
>>>>>            0     0  50000         Y
>>>>>                 audio_pll1_out           0        0        0   393216000
>>>>>            0     0  50000         N
>>>>>                    pdm                   0        0        0   196608000
>>>>>            0     0  50000         N
>>>>>                       pdm_root           0        0        0   196608000
>>>>>            0     0  50000         N
>>>>>                          pdm_sel         0        0        0   196608000
>>>>>            0     0  50000         Y
>>>>>                             pdm_root_clk       0        0        0
>>>>> 196608000          0     0  50000         N
>>>>>
>>>>> The PDM tree of the mainline looks like this:
>>>>>
>>>>>       audio_pll1_ref_sel                0        0        0    24000000
>>>>>           0     0  50000         Y
>>>>>           audio_pll1                     0        0        0   393216000
>>>>>            0     0  50000         Y
>>>>>              audio_pll1_bypass           0        0        0   393216000
>>>>>            0     0  50000         Y
>>>>>                 audio_pll1_out           0        0        0   393216000
>>>>>            0     0  50000         N
>>>>>                    pdm                   0        0        0   196608000
>>>>>            0     0  50000         N
>>>>>                       pdm_root           0        0        0   196608000
>>>>>            0     0  50000         N
>>>>>                          pdm_sel         0        0        0   196608000
>>>>>            0     0  50000         Y
>>>>>
>>>>> It seems like the "pdm_root_clk" generated by the shared audo-blk
>>>>> down-sream driver is missing from the mainline.  I looked up the clock
>>>>> I referenced when I attempted to enable the miffil, but
>>>>> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
>>>>> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
>>>>> the macros, but it seems like the pdm_sel should somehow have an
>>>>> additional variable for the shared clock and an additional clock like
>>>>> pdm_root_clk assigned with it.
>>>>>
>>>>> I have similar configurations for Mini and Nano, and both of them are
>>>>> able to record audio, so I think there might be a clock issue
>>>>> somewhere related to the audiomix driver, and not a misconfiguration
>>>>> of the sound-card or the micfil itself.
>>>>
>>>> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
>>>> enable those clock in the driver ?
>>>
>>> Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
>>> IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
>>> IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
>>> directory.  I tried making it use pdm_sel, but it threw an error.  I
>>> am not near my system, so I'm sorry I don't have more details.
>>>
>>> In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
>>> pdm_sel, but I am not certain as to what the difference between them
>>> was since they appeared to be shared.
>>
>> The pdm_sel is definitely a mux . Is there a follow-up gate after the mux ?
> 
> Not that I could see.  I think I was just overthinking it.  I saw the
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT in mx8mp-clock.h which matched the
> reference in the downstream kernel, so I was expecting that to be the
> same clock name.  When it didn't work, I thought I was missing
> something because I only saw the pdm_sel mux and no direct reason or
> reference to IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I have it working now.
> Sorry for the noise.  I'll get my series cleaned up and push another
> revision to add micfil node to the 8mp, and I'll probably remove the
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT imx8mp-clock.h so it doesn't throw
> someone else off.

No worries, good thing you found it. Thanks for investigating it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
@ 2023-08-31 13:36             ` Marek Vasut
  0 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2023-08-31 13:36 UTC (permalink / raw)
  To: Adam Ford
  Cc: linux-arm-kernel, Peng Fan, Fabio Estevam, Luca Ceresoli,
	Marco Felsch, Alexander Stein, Abel Vesa, Jacky Bai,
	Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
	Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
	Richard Cochran, Rob Herring, Sascha Hauer, Shawn Guo,
	Stephen Boyd, devicetree, linux-clk

On 8/31/23 06:32, Adam Ford wrote:
> On Wed, Aug 30, 2023 at 3:50 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 8/30/23 21:59, Adam Ford wrote:
>>> On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
>>>>
>>>> On 8/30/23 04:44, Adam Ford wrote:
>>>>
>>>> Hi,
>>>>
>>>>> I have a question about the clocking for eASRC and PDM.
>>>>>
>>>>>> +
>>>>>> +                       audio_blk_ctrl: clock-controller@30e20000 {
>>>>>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
>>>>>> +                               reg = <0x30e20000 0x10000>;
>>>>>> +                               #clock-cells = <1>;
>>>>>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI1>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI2>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI3>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI5>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI6>,
>>>>>> +                                        <&clk IMX8MP_CLK_SAI7>;
>>>>>> +                               clock-names = "ahb",
>>>>>> +                                             "sai1", "sai2", "sai3",
>>>>>> +                                             "sai5", "sai6", "sai7";
>>>>>> +                               power-domains = <&pgc_audio>;
>>>>>> +                       };
>>>>>> +               };
>>>>>> +
>>>>>
>>>>> I am trying to plumb in the micfil driver with a PDM microphone on a
>>>>> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
>>>>> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
>>>>> appear to see anything coming in.  I was curious why the
>>>>> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
>>>>> one for the PDM nor the ASRC clocks.
>>>>
>>>> I only ever needed SAI, so that was what was tested on the EVK .
>>>
>>> That makes sense.
>>>
>>>>
>>>>> I added the MICFIL noted to the
>>>>> 8mp in a previous patch [1], and I am trying to customize the MICFIL
>>>>> node as follows:
>>>>>
>>>>> &micfil {
>>>>> #sound-dai-cells = <0>;
>>>>> pinctrl-names = "default";
>>>>> pinctrl-0 = <&pinctrl_pdm>;
>>>>> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
>>>>> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
>>>>> assigned-clock-rates = <196608000>;
>>>>> status = "okay";
>>>>> };
>>>>>
>>>>> I also noticed in the down-stream kernel, the pdm_ipg_clk and
>>>>> pdm_root_clk are shared gates with separate parents.
>>>>>
>>>>> The PDM tree of the down-stream kernel looks like this:
>>>>>     audio_pll1_ref_sel                0        0        0    24000000
>>>>>         0     0  50000         Y
>>>>>           audio_pll1                     0        0        0   393216000
>>>>>            0     0  50000         Y
>>>>>              audio_pll1_bypass           0        0        0   393216000
>>>>>            0     0  50000         Y
>>>>>                 audio_pll1_out           0        0        0   393216000
>>>>>            0     0  50000         N
>>>>>                    pdm                   0        0        0   196608000
>>>>>            0     0  50000         N
>>>>>                       pdm_root           0        0        0   196608000
>>>>>            0     0  50000         N
>>>>>                          pdm_sel         0        0        0   196608000
>>>>>            0     0  50000         Y
>>>>>                             pdm_root_clk       0        0        0
>>>>> 196608000          0     0  50000         N
>>>>>
>>>>> The PDM tree of the mainline looks like this:
>>>>>
>>>>>       audio_pll1_ref_sel                0        0        0    24000000
>>>>>           0     0  50000         Y
>>>>>           audio_pll1                     0        0        0   393216000
>>>>>            0     0  50000         Y
>>>>>              audio_pll1_bypass           0        0        0   393216000
>>>>>            0     0  50000         Y
>>>>>                 audio_pll1_out           0        0        0   393216000
>>>>>            0     0  50000         N
>>>>>                    pdm                   0        0        0   196608000
>>>>>            0     0  50000         N
>>>>>                       pdm_root           0        0        0   196608000
>>>>>            0     0  50000         N
>>>>>                          pdm_sel         0        0        0   196608000
>>>>>            0     0  50000         Y
>>>>>
>>>>> It seems like the "pdm_root_clk" generated by the shared audo-blk
>>>>> down-sream driver is missing from the mainline.  I looked up the clock
>>>>> I referenced when I attempted to enable the miffil, but
>>>>> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
>>>>> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
>>>>> the macros, but it seems like the pdm_sel should somehow have an
>>>>> additional variable for the shared clock and an additional clock like
>>>>> pdm_root_clk assigned with it.
>>>>>
>>>>> I have similar configurations for Mini and Nano, and both of them are
>>>>> able to record audio, so I think there might be a clock issue
>>>>> somewhere related to the audiomix driver, and not a misconfiguration
>>>>> of the sound-card or the micfil itself.
>>>>
>>>> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
>>>> enable those clock in the driver ?
>>>
>>> Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
>>> IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
>>> IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
>>> directory.  I tried making it use pdm_sel, but it threw an error.  I
>>> am not near my system, so I'm sorry I don't have more details.
>>>
>>> In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
>>> pdm_sel, but I am not certain as to what the difference between them
>>> was since they appeared to be shared.
>>
>> The pdm_sel is definitely a mux . Is there a follow-up gate after the mux ?
> 
> Not that I could see.  I think I was just overthinking it.  I saw the
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT in mx8mp-clock.h which matched the
> reference in the downstream kernel, so I was expecting that to be the
> same clock name.  When it didn't work, I thought I was missing
> something because I only saw the pdm_sel mux and no direct reason or
> reference to IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I have it working now.
> Sorry for the noise.  I'll get my series cleaned up and push another
> revision to add micfil node to the 8mp, and I'll probably remove the
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT imx8mp-clock.h so it doesn't throw
> someone else off.

No worries, good thing you found it. Thanks for investigating it.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-08-31 13:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-08 11:42 [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Marek Vasut
2023-05-08 11:42 ` [PATCH v8 2/2] arm64: dts: imx8mp: Add analog audio output on i.MX8MP EVK Marek Vasut
2023-05-15  1:30 ` [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Shawn Guo
2023-08-30  2:44 ` Adam Ford
2023-08-30  2:44   ` Adam Ford
2023-08-30 19:10   ` Marek Vasut
2023-08-30 19:10     ` Marek Vasut
2023-08-30 19:59     ` Adam Ford
2023-08-30 19:59       ` Adam Ford
2023-08-30 20:50       ` Marek Vasut
2023-08-30 20:50         ` Marek Vasut
2023-08-31  4:32         ` Adam Ford
2023-08-31  4:32           ` Adam Ford
2023-08-31 13:36           ` Marek Vasut
2023-08-31 13:36             ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.