All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Watts <contact@jookia.org>
To: alsa-devel@alsa-project.org
Subject: Re: How do I set up multiple codecs on one I2S - without TDM?
Date: Wed, 2 Aug 2023 03:55:08 +1000	[thread overview]
Message-ID: <ZMlG_AyRJhmHnLI8@titan> (raw)
In-Reply-To: <ZMBRMnv0GQF4wyfQ@titan>

I return days later with an answer, so I shall try and answer my own email.

On Wed, Jul 26, 2023 at 08:48:18AM +1000, John Watts wrote:
> So my questions are: 
> - How do I express this in terms of ALSA and sound card concepts?
> - How do I express this in the device tree?

After reading the following links:

https://lore.kernel.org/all/87fsw124wn.wl-kuninori.morimoto.gx@renesas.com/
https://lore.kernel.org/r/87ilbx1kh3.wl-kuninori.morimoto.gx@renesas.com

I found that this is a case of 1:N cpus to codecs, and this can be
solved using audio-graph-card2.

So I set up a device tree like this:

	wm8782_1: stereo-adc-1 {
		compatible = "wlf,wm8782";
		Vdda-supply = <&reg_vcc>;
		Vdd-supply = <&reg_vcc>;
		#sound-dai-cells = <0>;
		port {
			wm8782_1_ep: endpoint {
				remote-endpoint = <&card_ep_1>;
			};
		};
	};

	wm8782_2: stereo-adc-2 {
		compatible = "wlf,wm8782";
		Vdda-supply = <&reg_vcc>;
		Vdd-supply = <&reg_vcc>;
		#sound-dai-cells = <0>;
		port {
			wm8782_2_ep: endpoint {
				remote-endpoint = <&card_ep_2>;
			};
		};
	};

	wm8782_3: stereo-adc-3 {
		compatible = "wlf,wm8782";
		Vdda-supply = <&reg_vcc>;
		Vdd-supply = <&reg_vcc>;
		#sound-dai-cells = <0>;
		port {
			wm8782_3_ep: endpoint {
				remote-endpoint = <&card_ep_3>;
			};
		};
	};

	sound {
		compatible = "audio-graph-card2";
		links = <&i2s2_port>;
		multi {
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					card_ep_0: endpoint {
						remote-endpoint = <&i2s2_ep>;
					};
				};
				port@1 {
					card_ep_1: endpoint {
						remote-endpoint = <&wm8782_1_ep>;
					};
				};
				port@2 {
					card_ep_2: endpoint {
						remote-endpoint = <&wm8782_2_ep>;
					};
				};
				port@3 {
					card_ep_3: endpoint {
						remote-endpoint = <&wm8782_3_ep>;
					};
				};
			};
		};
	};

	&i2s2 {
		pinctrl-0 = <&i2s2_pins>, <&i2s2_din_pins>;
		pinctrl-names = "default";
		status = "okay";
		i2s2_port: port {
			format = "i2s";
			mclk-fs = <128>;
			bitclock-master;
			frame-master;
			i2s2_ep: endpoint {
				remote-endpoint = <&card_ep_0>;
			};
		};
	};

Immediately I was able to record from the needed channels!
After tinkering with the driver registers I was even able to get it to
read the channels properly :)

I hope this helps somebody else in my situation.
John.

      parent reply	other threads:[~2023-08-04  9:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 22:48 How do I set up multiple codecs on one I2S - without TDM? John Watts
2023-07-27  9:45 ` Pierre-Louis Bossart
2023-07-27  9:50   ` John Watts
2023-08-01 17:55 ` John Watts [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMlG_AyRJhmHnLI8@titan \
    --to=contact@jookia.org \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.