All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: imx6q-cm-fx6: add analog audio support
@ 2017-02-07 20:31 ` christopher.spinrath at rwth-aachen.de
  0 siblings, 0 replies; 6+ messages in thread
From: christopher.spinrath @ 2017-02-07 20:31 UTC (permalink / raw)
  To: shawnguo, kernel
  Cc: mark.rutland, devicetree, christopher.spinrath, linux, robh+dt,
	grinberg, Valentin Raevsky, fabio.estevam, linux-arm-kernel

From: Valentin Raevsky <valentin@compulab.co.il>

The cm-fx6 module has an onboard Wolfson wm8731 codec which is muxed
to the ssi2 controller. Unlike most (all?) supported i.MX6 board/codec
combinations the wm8731 is operated in slave mode and the clock setup
is static.

Add support for it.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
[christopher.spinrath@rwth-aachen.de: enhanced commit message, ported
  to upstream and some cleanup]
Signed-off-by: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
---
 arch/arm/boot/dts/imx6q-cm-fx6.dts | 83 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-cm-fx6.dts b/arch/arm/boot/dts/imx6q-cm-fx6.dts
index d8a5789..8a85862 100644
--- a/arch/arm/boot/dts/imx6q-cm-fx6.dts
+++ b/arch/arm/boot/dts/imx6q-cm-fx6.dts
@@ -43,6 +43,7 @@
 
 /dts-v1/;
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/sound/fsl-imx-audmux.h>
 #include "imx6q.dtsi"
 
 / {
@@ -90,6 +91,34 @@
 		enable-active-high;
 	};
 
+	sound-analog {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "On-board analog audio";
+		simple-audio-card,widgets =
+			"Headphone", "Headphone Jack",
+			"Line", "Line Out",
+			"Microphone", "Mic Jack",
+			"Line", "Line In";
+		simple-audio-card,routing =
+			"Headphone Jack", "RHPOUT",
+			"Headphone Jack", "LHPOUT",
+			"MICIN", "Mic Bias",
+			"Mic Bias", "Mic Jack";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,bitclock-master = <&sound_master>;
+		simple-audio-card,frame-master = <&sound_master>;
+		simple-audio-card,bitclock-inversion;
+
+		sound_master: simple-audio-card,cpu {
+			sound-dai = <&ssi2>;
+			system-clock-frequency = <2822400>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&wm8731>;
+		};
+        };
+
 	sound-spdif {
 		compatible = "fsl,imx-audio-spdif";
 		model = "imx-spdif";
@@ -99,6 +128,36 @@
 	};
 };
 
+&audmux {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_audmux>;
+	status = "okay";
+
+	ssi2 {
+		fsl,audmux-port = <1>;
+		fsl,port-config = <
+			(IMX_AUDMUX_V2_PTCR_RCLKDIR |
+			IMX_AUDMUX_V2_PTCR_RCSEL(3 | 0x8) |
+			IMX_AUDMUX_V2_PTCR_TCLKDIR |
+			IMX_AUDMUX_V2_PTCR_TCSEL(3))
+			IMX_AUDMUX_V2_PDCR_RXDSEL(3)
+		>;
+	};
+
+	pins5 {
+		fsl,audmux-port = <3>;
+		fsl,port-config = <
+			(IMX_AUDMUX_V2_PTCR_TFSDIR |
+			IMX_AUDMUX_V2_PTCR_TFSEL(1) |
+			IMX_AUDMUX_V2_PTCR_RCLKDIR |
+			IMX_AUDMUX_V2_PTCR_RCSEL(1 | 0x8) |
+			IMX_AUDMUX_V2_PTCR_TCLKDIR |
+			IMX_AUDMUX_V2_PTCR_TCSEL(1))
+			IMX_AUDMUX_V2_PDCR_RXDSEL(1)
+		>;
+	};
+};
+
 &cpu0 {
 	/*
 	 * Although the imx6q fuse indicates that 1.2GHz operation is possible,
@@ -160,9 +219,25 @@
 		reg = <0x50>;
 		pagesize = <16>;
 	};
+
+	wm8731: codec@1a {
+		#sound-dai-cells = <0>;
+		compatible = "wlf,wm8731";
+		reg = <0x1a>;
+	};
 };
 
 &iomuxc {
+	pinctrl_audmux: audmuxgrp {
+		fsl,pins = <
+			MX6QDL_PAD_SD2_CMD__AUD4_RXC   0x17059
+			MX6QDL_PAD_SD2_DAT0__AUD4_RXD  0x17059
+			MX6QDL_PAD_SD2_DAT3__AUD4_TXC  0x17059
+			MX6QDL_PAD_SD2_DAT2__AUD4_TXD  0x17059
+			MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x17059
+		>;
+	};
+
 	pinctrl_ecspi1: ecspi1grp {
 		fsl,pins = <
 			MX6QDL_PAD_EIM_D16__ECSPI1_SCLK	0x100b1
@@ -279,6 +354,14 @@
 	status = "okay";
 };
 
+&ssi2 {
+	assigned-clocks = <&clks IMX6QDL_CLK_SSI2_SEL>,
+			<&clks IMX6QDL_CLK_PLL4_AUDIO_DIV>;
+	assigned-clock-parents = <&clks IMX6QDL_CLK_PLL4_AUDIO_DIV>;
+	assigned-clock-rates = <0>, <786432000>;
+	status = "okay";
+};
+
 &uart4 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_uart4>;
-- 
2.10.2

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

* [PATCH] ARM: dts: imx6q-cm-fx6: add analog audio support
@ 2017-02-07 20:31 ` christopher.spinrath at rwth-aachen.de
  0 siblings, 0 replies; 6+ messages in thread
From: christopher.spinrath at rwth-aachen.de @ 2017-02-07 20:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Valentin Raevsky <valentin@compulab.co.il>

The cm-fx6 module has an onboard Wolfson wm8731 codec which is muxed
to the ssi2 controller. Unlike most (all?) supported i.MX6 board/codec
combinations the wm8731 is operated in slave mode and the clock setup
is static.

Add support for it.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
[christopher.spinrath at rwth-aachen.de: enhanced commit message, ported
  to upstream and some cleanup]
Signed-off-by: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
---
 arch/arm/boot/dts/imx6q-cm-fx6.dts | 83 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-cm-fx6.dts b/arch/arm/boot/dts/imx6q-cm-fx6.dts
index d8a5789..8a85862 100644
--- a/arch/arm/boot/dts/imx6q-cm-fx6.dts
+++ b/arch/arm/boot/dts/imx6q-cm-fx6.dts
@@ -43,6 +43,7 @@
 
 /dts-v1/;
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/sound/fsl-imx-audmux.h>
 #include "imx6q.dtsi"
 
 / {
@@ -90,6 +91,34 @@
 		enable-active-high;
 	};
 
+	sound-analog {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "On-board analog audio";
+		simple-audio-card,widgets =
+			"Headphone", "Headphone Jack",
+			"Line", "Line Out",
+			"Microphone", "Mic Jack",
+			"Line", "Line In";
+		simple-audio-card,routing =
+			"Headphone Jack", "RHPOUT",
+			"Headphone Jack", "LHPOUT",
+			"MICIN", "Mic Bias",
+			"Mic Bias", "Mic Jack";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,bitclock-master = <&sound_master>;
+		simple-audio-card,frame-master = <&sound_master>;
+		simple-audio-card,bitclock-inversion;
+
+		sound_master: simple-audio-card,cpu {
+			sound-dai = <&ssi2>;
+			system-clock-frequency = <2822400>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&wm8731>;
+		};
+        };
+
 	sound-spdif {
 		compatible = "fsl,imx-audio-spdif";
 		model = "imx-spdif";
@@ -99,6 +128,36 @@
 	};
 };
 
+&audmux {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_audmux>;
+	status = "okay";
+
+	ssi2 {
+		fsl,audmux-port = <1>;
+		fsl,port-config = <
+			(IMX_AUDMUX_V2_PTCR_RCLKDIR |
+			IMX_AUDMUX_V2_PTCR_RCSEL(3 | 0x8) |
+			IMX_AUDMUX_V2_PTCR_TCLKDIR |
+			IMX_AUDMUX_V2_PTCR_TCSEL(3))
+			IMX_AUDMUX_V2_PDCR_RXDSEL(3)
+		>;
+	};
+
+	pins5 {
+		fsl,audmux-port = <3>;
+		fsl,port-config = <
+			(IMX_AUDMUX_V2_PTCR_TFSDIR |
+			IMX_AUDMUX_V2_PTCR_TFSEL(1) |
+			IMX_AUDMUX_V2_PTCR_RCLKDIR |
+			IMX_AUDMUX_V2_PTCR_RCSEL(1 | 0x8) |
+			IMX_AUDMUX_V2_PTCR_TCLKDIR |
+			IMX_AUDMUX_V2_PTCR_TCSEL(1))
+			IMX_AUDMUX_V2_PDCR_RXDSEL(1)
+		>;
+	};
+};
+
 &cpu0 {
 	/*
 	 * Although the imx6q fuse indicates that 1.2GHz operation is possible,
@@ -160,9 +219,25 @@
 		reg = <0x50>;
 		pagesize = <16>;
 	};
+
+	wm8731: codec at 1a {
+		#sound-dai-cells = <0>;
+		compatible = "wlf,wm8731";
+		reg = <0x1a>;
+	};
 };
 
 &iomuxc {
+	pinctrl_audmux: audmuxgrp {
+		fsl,pins = <
+			MX6QDL_PAD_SD2_CMD__AUD4_RXC   0x17059
+			MX6QDL_PAD_SD2_DAT0__AUD4_RXD  0x17059
+			MX6QDL_PAD_SD2_DAT3__AUD4_TXC  0x17059
+			MX6QDL_PAD_SD2_DAT2__AUD4_TXD  0x17059
+			MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x17059
+		>;
+	};
+
 	pinctrl_ecspi1: ecspi1grp {
 		fsl,pins = <
 			MX6QDL_PAD_EIM_D16__ECSPI1_SCLK	0x100b1
@@ -279,6 +354,14 @@
 	status = "okay";
 };
 
+&ssi2 {
+	assigned-clocks = <&clks IMX6QDL_CLK_SSI2_SEL>,
+			<&clks IMX6QDL_CLK_PLL4_AUDIO_DIV>;
+	assigned-clock-parents = <&clks IMX6QDL_CLK_PLL4_AUDIO_DIV>;
+	assigned-clock-rates = <0>, <786432000>;
+	status = "okay";
+};
+
 &uart4 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_uart4>;
-- 
2.10.2

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

* Re: [PATCH] ARM: dts: imx6q-cm-fx6: add analog audio support
  2017-02-07 20:31 ` christopher.spinrath at rwth-aachen.de
@ 2017-02-07 22:39     ` Fabio Estevam
  -1 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2017-02-07 22:39 UTC (permalink / raw)
  To: Christopher Spinrath
  Cc: Shawn Guo, Sascha Hauer, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	Mark Rutland, Russell King - ARM Linux,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Igor Grinberg, Fabio Estevam,
	Valentin Raevsky

On Tue, Feb 7, 2017 at 6:31 PM,  <christopher.spinrath-vA1bhqPz9FBZXbeN9DUtxg@public.gmane.org> wrote:

> +&audmux {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_audmux>;
> +       status = "okay";
> +
> +       ssi2 {
> +               fsl,audmux-port = <1>;
> +               fsl,port-config = <
> +                       (IMX_AUDMUX_V2_PTCR_RCLKDIR |
> +                       IMX_AUDMUX_V2_PTCR_RCSEL(3 | 0x8) |
> +                       IMX_AUDMUX_V2_PTCR_TCLKDIR |
> +                       IMX_AUDMUX_V2_PTCR_TCSEL(3))
> +                       IMX_AUDMUX_V2_PDCR_RXDSEL(3)
> +               >;
> +       };
> +
> +       pins5 {

Just one minor nit: maybe pins4 since you are using AUD4 pins. Or
maybe 'audmux4' as pins4 is too vague ?

Reviewed-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] ARM: dts: imx6q-cm-fx6: add analog audio support
@ 2017-02-07 22:39     ` Fabio Estevam
  0 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2017-02-07 22:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Feb 7, 2017 at 6:31 PM,  <christopher.spinrath@rwth-aachen.de> wrote:

> +&audmux {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_audmux>;
> +       status = "okay";
> +
> +       ssi2 {
> +               fsl,audmux-port = <1>;
> +               fsl,port-config = <
> +                       (IMX_AUDMUX_V2_PTCR_RCLKDIR |
> +                       IMX_AUDMUX_V2_PTCR_RCSEL(3 | 0x8) |
> +                       IMX_AUDMUX_V2_PTCR_TCLKDIR |
> +                       IMX_AUDMUX_V2_PTCR_TCSEL(3))
> +                       IMX_AUDMUX_V2_PDCR_RXDSEL(3)
> +               >;
> +       };
> +
> +       pins5 {

Just one minor nit: maybe pins4 since you are using AUD4 pins. Or
maybe 'audmux4' as pins4 is too vague ?

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

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

* Re: [PATCH] ARM: dts: imx6q-cm-fx6: add analog audio support
       [not found] ` <38d5ebe36b5142fd84f19ecbcc5a018d@rwthex-w1-b.rwth-ad.de>
@ 2017-02-08 20:30       ` Christopher Spinrath
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Spinrath @ 2017-02-08 20:30 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Shawn Guo, Sascha Hauer, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	Mark Rutland, Russell King - ARM Linux,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Igor Grinberg, Fabio Estevam,
	Valentin Raevsky, christopher.spinrath-vA1bhqPz9FBZXbeN9DUtxg

Hi Fabio,

thanks for the review!

On 02/07/2017 11:39 PM, Fabio Estevam wrote:
> On Tue, Feb 7, 2017 at 6:31 PM,  <christopher.spinrath-vA1bhqPz9FBZXbeN9DUtxg@public.gmane.org> wrote:
>
>> +&audmux {
>> +       pinctrl-names = "default";
>> +       pinctrl-0 = <&pinctrl_audmux>;
>> +       status = "okay";
>> +
>> +       ssi2 {
>> +               fsl,audmux-port = <1>;
>> +               fsl,port-config = <
>> +                       (IMX_AUDMUX_V2_PTCR_RCLKDIR |
>> +                       IMX_AUDMUX_V2_PTCR_RCSEL(3 | 0x8) |
>> +                       IMX_AUDMUX_V2_PTCR_TCLKDIR |
>> +                       IMX_AUDMUX_V2_PTCR_TCSEL(3))
>> +                       IMX_AUDMUX_V2_PDCR_RXDSEL(3)
>> +               >;
>> +       };
>> +
>> +       pins5 {
>
> Just one minor nit: maybe pins4 since you are using AUD4 pins. Or
> maybe 'audmux4' as pins4 is too vague ?

Sounds good. Actually, CompuLab uses the term audmux4 themselves in the 
block diagram of the board.

Cheers,
Christopher

> Reviewed-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] ARM: dts: imx6q-cm-fx6: add analog audio support
@ 2017-02-08 20:30       ` Christopher Spinrath
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Spinrath @ 2017-02-08 20:30 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio,

thanks for the review!

On 02/07/2017 11:39 PM, Fabio Estevam wrote:
> On Tue, Feb 7, 2017 at 6:31 PM,  <christopher.spinrath@rwth-aachen.de> wrote:
>
>> +&audmux {
>> +       pinctrl-names = "default";
>> +       pinctrl-0 = <&pinctrl_audmux>;
>> +       status = "okay";
>> +
>> +       ssi2 {
>> +               fsl,audmux-port = <1>;
>> +               fsl,port-config = <
>> +                       (IMX_AUDMUX_V2_PTCR_RCLKDIR |
>> +                       IMX_AUDMUX_V2_PTCR_RCSEL(3 | 0x8) |
>> +                       IMX_AUDMUX_V2_PTCR_TCLKDIR |
>> +                       IMX_AUDMUX_V2_PTCR_TCSEL(3))
>> +                       IMX_AUDMUX_V2_PDCR_RXDSEL(3)
>> +               >;
>> +       };
>> +
>> +       pins5 {
>
> Just one minor nit: maybe pins4 since you are using AUD4 pins. Or
> maybe 'audmux4' as pins4 is too vague ?

Sounds good. Actually, CompuLab uses the term audmux4 themselves in the 
block diagram of the board.

Cheers,
Christopher

> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
>

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

end of thread, other threads:[~2017-02-08 20:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 20:31 [PATCH] ARM: dts: imx6q-cm-fx6: add analog audio support christopher.spinrath
2017-02-07 20:31 ` christopher.spinrath at rwth-aachen.de
     [not found] ` <b6776a0aa8484faf816a238705ed6d22-gtPewvpZjL8umhiu9RXYRl5UTUQ924AY@public.gmane.org>
2017-02-07 22:39   ` Fabio Estevam
2017-02-07 22:39     ` Fabio Estevam
     [not found] ` <38d5ebe36b5142fd84f19ecbcc5a018d@rwthex-w1-b.rwth-ad.de>
     [not found]   ` <38d5ebe36b5142fd84f19ecbcc5a018d-cBaz+nnMw18umhiu9RXYRl5UTUQ924AY@public.gmane.org>
2017-02-08 20:30     ` Christopher Spinrath
2017-02-08 20:30       ` Christopher Spinrath

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.