[PATCHv5,5/5] ARM: dts: omap4-droid4: add soundcard
diff mbox series

Message ID 20180223200254.25685-6-sebastian.reichel@collabora.co.uk
State New
Headers show
Series
  • Motorola Droid 4 Audio Support
Related show

Commit Message

Sebastian Reichel Feb. 23, 2018, 8:02 p.m. UTC
Add sound support to Motorola Droid 4 using simple-soundcard
and CPCAP's audio codec. This does not yet correctly represent
the whole audio routing, since McBSP3 is also connected to
Bluetooth and MDM6600 modem (and probably also 4G modem).
These extra DAI links are not yet supported and have not been
tested.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
 arch/arm/boot/dts/omap4-droid4-xt894.dts | 78 ++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

Comments

Pavel Machek March 22, 2018, 8:48 p.m. UTC | #1
Hi!

> Add sound support to Motorola Droid 4 using simple-soundcard
> and CPCAP's audio codec. This does not yet correctly represent
> the whole audio routing, since McBSP3 is also connected to
> Bluetooth and MDM6600 modem (and probably also 4G modem).
> These extra DAI links are not yet supported and have not been
> tested.

I applied the series on top v4.16-rc5, but I can't seem to get it
to work:

root@devuan:/sys/devices/platform/usb-phy@1# cat /proc/asound/cards
 0 [H58006000encode]: HDMI_58006000_e - HDMI 58006000.encoder
                       HDMI 58006000.encoder
root@devuan:/sys/devices/platform/usb-phy@1#
[   10.819122] ALSA device list:
[   10.832641]   #0: HDMI 58006000.encoder
[   10.842407] Waiting 10 sec before mounting root device...

I think I should have the required options enabled... 

CONFIG_SND_OMAP_SOC=y
CONFIG_SND_OMAP_SOC_DMIC=y
CONFIG_SND_OMAP_SOC_MCBSP=y
CONFIG_SND_OMAP_SOC_MCPDM=y
CONFIG_SND_OMAP_SOC_HDMI_AUDIO=y
# CONFIG_SND_OMAP_SOC_RX51 is not set
# CONFIG_SND_OMAP_SOC_N9 is not set
CONFIG_SND_OMAP_SOC_OMAP_TWL4030=y
CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=y
# CONFIG_SND_SOC_IMG is not set

#
# STMicroelectronics STM32 SOC audio support
#
# CONFIG_SND_SOC_XTFPGA_I2S is not set
# CONFIG_ZX_TDM is not set
CONFIG_SND_SOC_I2C_AND_SPI=y
CONFIG_SND_SOC_CPCAP=y

Any ideas?

Thanks,
							Pavel
Sebastian Reichel March 22, 2018, 11:48 p.m. UTC | #2
Hi Pavel,

On Thu, Mar 22, 2018 at 09:48:05PM +0100, Pavel Machek wrote:
> Hi!
> 
> > Add sound support to Motorola Droid 4 using simple-soundcard
> > and CPCAP's audio codec. This does not yet correctly represent
> > the whole audio routing, since McBSP3 is also connected to
> > Bluetooth and MDM6600 modem (and probably also 4G modem).
> > These extra DAI links are not yet supported and have not been
> > tested.
> 
> I applied the series on top v4.16-rc5, but I can't seem to get it
> to work:
> 
> root@devuan:/sys/devices/platform/usb-phy@1# cat /proc/asound/cards
>  0 [H58006000encode]: HDMI_58006000_e - HDMI 58006000.encoder
>                        HDMI 58006000.encoder
> root@devuan:/sys/devices/platform/usb-phy@1#
> [   10.819122] ALSA device list:
> [   10.832641]   #0: HDMI 58006000.encoder
> [   10.842407] Waiting 10 sec before mounting root device...
> 
> I think I should have the required options enabled... 
> 
> CONFIG_SND_OMAP_SOC=y
> CONFIG_SND_OMAP_SOC_DMIC=y
> CONFIG_SND_OMAP_SOC_MCBSP=y
> CONFIG_SND_OMAP_SOC_MCPDM=y
> CONFIG_SND_OMAP_SOC_HDMI_AUDIO=y

That's the SoC (OMAP) side.

> # CONFIG_SND_OMAP_SOC_RX51 is not set
> # CONFIG_SND_OMAP_SOC_N9 is not set
> CONFIG_SND_OMAP_SOC_OMAP_TWL4030=y
> CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=y

That's not needed (but does not hurt). The Droid 4
has no TWL companion chip and uses CPCAP instead.

> # CONFIG_SND_SOC_IMG is not set
> 
> #
> # STMicroelectronics STM32 SOC audio support
> #
> # CONFIG_SND_SOC_XTFPGA_I2S is not set
> # CONFIG_ZX_TDM is not set
> CONFIG_SND_SOC_I2C_AND_SPI=y
> CONFIG_SND_SOC_CPCAP=y

That's the codec side.

> Any ideas?

You probably did not enable the soundcard driver, that binds against
"audio-graph-card" compatible and connects the codec driver with the
SoC driver: CONFIG_SND_AUDIO_GRAPH_CARD

-- Sebastian
Pavel Machek March 23, 2018, 10:09 a.m. UTC | #3
Hi!

> > # CONFIG_SND_OMAP_SOC_RX51 is not set
> > # CONFIG_SND_OMAP_SOC_N9 is not set
> > CONFIG_SND_OMAP_SOC_OMAP_TWL4030=y
> > CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=y
> 
> That's not needed (but does not hurt). The Droid 4
> has no TWL companion chip and uses CPCAP instead.

Aha, thanks. I was doing wild experiments to get something that
boots... I turned them off.

> > Any ideas?
> 
> You probably did not enable the soundcard driver, that binds against
> "audio-graph-card" compatible and connects the codec driver with the
> SoC driver: CONFIG_SND_AUDIO_GRAPH_CARD

Ok, that certainly changed things; I am now getting this:

Mar 23 08:39:17 devuan kernel: [   11.633605] asoc-audio-graph-card soundcard: GPIO lookup for
 consumer pa
Mar 23 08:39:17 devuan kernel: [   11.644958] asoc-audio-graph-card soundcard: using device tr
ee for GPIO lookup
Mar 23 08:39:17 devuan kernel: [   11.656677] of_get_named_gpiod_flags: can't parse 'pa-gpios'
 property of node '/soundcard[0]'
Mar 23 08:39:17 devuan kernel: [   11.669738] of_get_named_gpiod_flags: can't parse 'pa-gpio' 
property of node '/soundcard[0]'
Mar 23 08:39:17 devuan kernel: [   11.682617] asoc-audio-graph-card soundcard: using lookup ta
bles for GPIO lookup
Mar 23 08:39:17 devuan kernel: [   11.694427] asoc-audio-graph-card soundcard: lookup for GPIO
 pa failed

Indeed the dts does not seem to contain any gpios

        soundcard {
                compatible = "audio-graph-card";
                label = "Droid 4 Audio";

                simple-graph-card,widgets =
                        "Speaker", "Earpiece",
                        "Speaker", "Loudspeaker",
	                "Headphone", "Headphone Jack",
	                "Microphone", "Internal Mic";

                simple-graph-card,routing =
	                "Earpiece", "EP",
		        "Loudspeaker", "SPKR",
                        "Headphone Jack", "HSL",
                        "Headphone Jack", "HSR",
	                "MICR", "Internal Mic";

                dais = <&mcbsp2_port>, <&mcbsp3_port>;
	};

Any more ideas? :-)

Thanks,

									Pavel
Sebastian Reichel March 23, 2018, 10:30 a.m. UTC | #4
Hi,

On Fri, Mar 23, 2018 at 11:09:30AM +0100, Pavel Machek wrote:
> Hi!
> 
> > > # CONFIG_SND_OMAP_SOC_RX51 is not set
> > > # CONFIG_SND_OMAP_SOC_N9 is not set
> > > CONFIG_SND_OMAP_SOC_OMAP_TWL4030=y
> > > CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=y
> > 
> > That's not needed (but does not hurt). The Droid 4
> > has no TWL companion chip and uses CPCAP instead.
> 
> Aha, thanks. I was doing wild experiments to get something that
> boots... I turned them off.
> 
> > > Any ideas?
> > 
> > You probably did not enable the soundcard driver, that binds against
> > "audio-graph-card" compatible and connects the codec driver with the
> > SoC driver: CONFIG_SND_AUDIO_GRAPH_CARD
> 
> Ok, that certainly changed things; I am now getting this:
> 
> Mar 23 08:39:17 devuan kernel: [   11.633605] asoc-audio-graph-card soundcard: GPIO lookup for
>  consumer pa
> Mar 23 08:39:17 devuan kernel: [   11.644958] asoc-audio-graph-card soundcard: using device tr
> ee for GPIO lookup
> Mar 23 08:39:17 devuan kernel: [   11.656677] of_get_named_gpiod_flags: can't parse 'pa-gpios'
>  property of node '/soundcard[0]'
> Mar 23 08:39:17 devuan kernel: [   11.669738] of_get_named_gpiod_flags: can't parse 'pa-gpio' 
> property of node '/soundcard[0]'
> Mar 23 08:39:17 devuan kernel: [   11.682617] asoc-audio-graph-card soundcard: using lookup ta
> bles for GPIO lookup
> Mar 23 08:39:17 devuan kernel: [   11.694427] asoc-audio-graph-card soundcard: lookup for GPIO
>  pa failed

That's not an error, but just some debug messages. Consider
disabling CONFIG_DEBUG_GPIO to get rid of them.

> Indeed the dts does not seem to contain any gpios

It's optional and does not exist on Droid 4.

>         soundcard {
>                 compatible = "audio-graph-card";
>                 label = "Droid 4 Audio";
> 
>                 simple-graph-card,widgets =
>                         "Speaker", "Earpiece",
>                         "Speaker", "Loudspeaker",
> 	                "Headphone", "Headphone Jack",
> 	                "Microphone", "Internal Mic";
> 
>                 simple-graph-card,routing =
> 	                "Earpiece", "EP",
> 		        "Loudspeaker", "SPKR",
>                         "Headphone Jack", "HSL",
>                         "Headphone Jack", "HSR",
> 	                "MICR", "Internal Mic";
> 
>                 dais = <&mcbsp2_port>, <&mcbsp3_port>;
> 	};
> 
> Any more ideas? :-)

Make sure, that the device was not proped properly (cat
/proc/asound/cards) and post the real error? :)

-- Sebastian
Pavel Machek March 23, 2018, 11:06 a.m. UTC | #5
Hi!

> > > > Any ideas?
> > > 
> > > You probably did not enable the soundcard driver, that binds against
> > > "audio-graph-card" compatible and connects the codec driver with the
> > > SoC driver: CONFIG_SND_AUDIO_GRAPH_CARD
> > 
> > Ok, that certainly changed things; I am now getting this:
> > 
> > Mar 23 08:39:17 devuan kernel: [   11.633605] asoc-audio-graph-card soundcard: GPIO lookup for
> >  consumer pa
> > Mar 23 08:39:17 devuan kernel: [   11.644958] asoc-audio-graph-card soundcard: using device tr
> > ee for GPIO lookup
> > Mar 23 08:39:17 devuan kernel: [   11.656677] of_get_named_gpiod_flags: can't parse 'pa-gpios'
> >  property of node '/soundcard[0]'
> > Mar 23 08:39:17 devuan kernel: [   11.669738] of_get_named_gpiod_flags: can't parse 'pa-gpio' 
> > property of node '/soundcard[0]'
> > Mar 23 08:39:17 devuan kernel: [   11.682617] asoc-audio-graph-card soundcard: using lookup ta
> > bles for GPIO lookup
> > Mar 23 08:39:17 devuan kernel: [   11.694427] asoc-audio-graph-card soundcard: lookup for GPIO
> >  pa failed
> 
> That's not an error, but just some debug messages. Consider
> disabling CONFIG_DEBUG_GPIO to get rid of them.
> 
> > Indeed the dts does not seem to contain any gpios
> 
> It's optional and does not exist on Droid 4.
> 
> >         soundcard {
> >                 compatible = "audio-graph-card";
> >                 label = "Droid 4 Audio";
> > 
> >                 simple-graph-card,widgets =
> >                         "Speaker", "Earpiece",
> >                         "Speaker", "Loudspeaker",
> > 	                "Headphone", "Headphone Jack",
> > 	                "Microphone", "Internal Mic";
> > 
> >                 simple-graph-card,routing =
> > 	                "Earpiece", "EP",
> > 		        "Loudspeaker", "SPKR",
> >                         "Headphone Jack", "HSL",
> >                         "Headphone Jack", "HSR",
> > 	                "MICR", "Internal Mic";
> > 
> >                 dais = <&mcbsp2_port>, <&mcbsp3_port>;
> > 	};
> > 
> > Any more ideas? :-)
> 
> Make sure, that the device was not proped properly (cat
> /proc/asound/cards) and post the real error? :)

Unfortunately, that are last messages from asoc-audio-graph-card

Mar 23 08:39:17 devuan kernel: [   11.694427] asoc-audio-graph-card
soundcard: lookup for GPIO pa failed

and no, it is not detected:

root@devuan:/home/user# cat /proc/asound/cards
 0 [H58006000encode]: HDMI_58006000_e - HDMI 58006000.encoder
                       HDMI 58006000.encoder
root@devuan:/home/user#

Hmm. Is it possible that EPROBEDEFFER is playing with me again?

									Pavel
Pavel Machek March 23, 2018, 11:08 a.m. UTC | #6
Hi!

> Make sure, that the device was not proped properly (cat
> /proc/asound/cards) and post the real error? :)

Standby... looks like I cleaned up too much of "unused" config.
Pavel Machek March 23, 2018, 2:09 p.m. UTC | #7
Hi!

> That's not an error, but just some debug messages. Consider
> disabling CONFIG_DEBUG_GPIO to get rid of them.
> 
> > Indeed the dts does not seem to contain any gpios
> 
> It's optional and does not exist on Droid 4.
> 
> >         soundcard {
...
> > 	};
> > 
> > Any more ideas? :-)
> 
> Make sure, that the device was not proped properly (cat
> /proc/asound/cards) and post the real error? :)

Thanks, it is indeed a config problem. When I disabled "unrelated"
options, these got disabled, too:

They can be only selected, and there's nothing to select them in Droid
4 case.
								Pavel

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 2772414..7860b6e 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -4,13 +4,13 @@ config SND_OMAP_SOC
 	select SND_DMAENGINE_PCM
 
 config SND_OMAP_SOC_DMIC
-	tristate
+	tristate "dmic"
 
 config SND_OMAP_SOC_MCBSP
-	tristate
+	tristate "mcbsp"
 
 config SND_OMAP_SOC_MCPDM
-	tristate
+	tristate "mcpdm"
 
 config SND_OMAP_SOC_HDMI_AUDIO
 	tristate "HDMI audio support for OMAP4+ based SoCs"
Pavel Machek March 23, 2018, 2:11 p.m. UTC | #8
Hi!

> > Any more ideas? :-)
> 
> Make sure, that the device was not proped properly (cat
> /proc/asound/cards) and post the real error? :)

Oh and, audio now works for me, so

Tested-by: Pavel Machek <pavel@ucw.cz>

for the series.

Thanks,
									Pavel

Patch
diff mbox series

diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts
index e11a24397163..fc30d375883a 100644
--- a/arch/arm/boot/dts/omap4-droid4-xt894.dts
+++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts
@@ -118,6 +118,26 @@ 
 
 		};
 	};
+
+	soundcard {
+		compatible = "audio-graph-card";
+		label = "Droid 4 Audio";
+
+		simple-graph-card,widgets =
+			"Speaker", "Earpiece",
+			"Speaker", "Loudspeaker",
+			"Headphone", "Headphone Jack",
+			"Microphone", "Internal Mic";
+
+		simple-graph-card,routing =
+			"Earpiece", "EP",
+			"Loudspeaker", "SPKR",
+			"Headphone Jack", "HSL",
+			"Headphone Jack", "HSR",
+			"MICR", "Internal Mic";
+
+		dais = <&mcbsp2_port>, <&mcbsp3_port>;
+	};
 };
 
 &dss {
@@ -515,6 +535,24 @@ 
 		OMAP4_IOPAD(0x112, PIN_OUTPUT_PULLUP | MUX_MODE5)	/* uart4_rts */
 		>;
 	};
+
+	mcbsp2_pins: pinmux_mcbsp2_pins {
+		pinctrl-single,pins = <
+		OMAP4_IOPAD(0x0f6, PIN_INPUT | MUX_MODE0)	/* abe_mcbsp2_clkx */
+		OMAP4_IOPAD(0x0f8, PIN_INPUT | MUX_MODE0)	/* abe_mcbsp2_dr */
+		OMAP4_IOPAD(0x0fa, PIN_OUTPUT | MUX_MODE0)	/* abe_mcbsp2_dx */
+		OMAP4_IOPAD(0x0fc, PIN_INPUT | MUX_MODE0)	/* abe_mcbsp2_fsx */
+		>;
+	};
+
+	mcbsp3_pins: pinmux_mcbsp3_pins {
+		pinctrl-single,pins = <
+		OMAP4_IOPAD(0x106, PIN_INPUT | MUX_MODE1)	/* abe_mcbsp3_dr */
+		OMAP4_IOPAD(0x108, PIN_OUTPUT | MUX_MODE1)	/* abe_mcbsp3_dx */
+		OMAP4_IOPAD(0x10a, PIN_INPUT | MUX_MODE1)	/* abe_mcbsp3_clkx */
+		OMAP4_IOPAD(0x10c, PIN_INPUT | MUX_MODE1)	/* abe_mcbsp3_fsx */
+		>;
+	};
 };
 
 &omap4_pmx_wkup {
@@ -600,3 +638,43 @@ 
 				  "0", "0", "1";
 	};
 };
+
+&mcbsp2 {
+	#sound-dai-cells = <0>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&mcbsp2_pins>;
+	status = "okay";
+
+	mcbsp2_port: port {
+		cpu_dai2: endpoint {
+			dai-format = "i2s";
+			remote-endpoint = <&cpcap_audio_codec0>;
+			frame-master = <&cpcap_audio_codec0>;
+			bitclock-master = <&cpcap_audio_codec0>;
+		};
+	};
+};
+
+&mcbsp3 {
+	#sound-dai-cells = <0>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&mcbsp3_pins>;
+	status = "okay";
+
+	mcbsp3_port: port {
+		cpu_dai3: endpoint {
+			dai-format = "dsp_a";
+			frame-master = <&cpcap_audio_codec1>;
+			bitclock-master = <&cpcap_audio_codec1>;
+			remote-endpoint = <&cpcap_audio_codec1>;
+		};
+	};
+};
+
+&cpcap_audio_codec0 {
+	remote-endpoint = <&cpu_dai2>;
+};
+
+&cpcap_audio_codec1 {
+	remote-endpoint = <&cpu_dai3>;
+};