All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Sameer Pujar <spujar@nvidia.com>
Cc: sharadg@nvidia.com, Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	jonathanh@nvidia.com
Subject: Re: More Generic Audio Graph Sound Card idea
Date: 25 Aug 2020 15:35:18 +0900	[thread overview]
Message-ID: <87mu2jw7zd.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <2d9140c7-7cba-34d9-d4b7-c9f9f395d9e7@nvidia.com>


Hi Sameer

> If we plan to go this way, I think we need to consider board specific
> configuration at init time and one at runtime. In that case there
> could be multiple compatibles that would get added to the driver and
> various other requirements can be managed with behavioral flags
> instead from DT?

This is still just idea though...
But for example, if you want to
	1) basically, DT is almost audio-graph
	2) but want to have customized operation for some part

And if "audio-graph-card2" driver has graph_init() exported function,
you can create your own drviver, and use customized audio-graph
by using .hooks.

This is just idea/sample, but I'm not sure this is enough or not,
and/or if I can do what I want.
But do you think it can solve your issue ?

-- own driver ---
	static const struct of_device_id graph_of_match[] = {
=>		{ .compatible = "sameer-audio-graph" },
		{},
	};

	static audio_graph_hooks hooks = {
		.parse_of_hook_pre  = xxx,
=>		.parse_of_hook_post = sameer_parse_of_post,
		.dai_link_of_pre    = xxx,
		.dai_link_of_post   = xxx,
=>		.init               = sameer_init,
		...
	};

=>	int sameer_init(struct snd_soc_pcm_runtime *rtd)
	{
		/*
		 * This will be called runtime init timing.
		 * Call original asoc_simple_dai_init() first
		 * and do own init, for example.
		 */
		asoc_simple_dai_init(rtd);

		do_something_own_settings(rtd->xxx);
	}

=>	static int sameer_parse_of_post(struct asoc_simple_priv *priv)
	{
		struct sameer_priv *my_priv = graph_priv_to_my_priv(priv);

		/*
		 * This will be called after audio_graph's graph_parse_of()
		 */

		/*
		 * Customize own settings here.
		 *
		 * Special connection ?
		 * Special Setings ?
		 * Calculate something ?
		 * Overwrite something ?
		 */
	}

	static int sameer_probe(...)
	{
		struct sameer_priv *my_priv;
		struct asoc_simple_priv *graph_priv;

		my_priv = zalloc();
		graph_priv = my_priv_to_graph_priv(my_priv);
=>		graph_priv->hooks = hooks

		/*
		 * Basically, it will do same as audio_graph,
		 * but .hooks will be called if you specified
		 */
=>		return graph_init(graph_priv);
	}

--- Kconfig ----

	config SND_SAMEER_AUDIO_GRAPH_CARD
		tristate "Sameer's Audio Graph sound card support"
=>		depends on SND_AUDIO_GRAPH_CARD
		...

---- my-dt ----------

	  /*
	   * DT setting is almost same as audio_graph
	   * which is supporting normal and DPCM.
	   * You can add own property which will be handled under .hook
	   */
	                      *************
	  PCM0 <------------> *           * <----DAI0----->
	                      *  DSP      *
	                      *           * <----DAI1----->
	                      *************
	  PCM1 <------------------------------------------> DAI2

		sound {
			compatible = "sameer-audio-graph";

			dais = <&PCM0,	/* for DPCM */
				&PCM1>  /* for normal*/
		};

		front-end {
			ports {
				PCM0: port@0 { pcm0: endpoint { remote-endpoint = <&dsp_f0>; }; };
				PCM1: port@1 { pcm1: endpoint { remote-endpoint = <&dai2>; }; };
			};
		};

		dsp {
			compatible = "audio-graph-card2-dsp";

			ports {
				/* Front End side */
				port@0 { dsp_f0: endpoint { remote-endpoint = <&pcm0>; }; };

				/* Back End side */
				port@4 { dsp_b0: endpoint { remote-endpoint = <&dai0>; }; };
				port@5 { dsp_b1: endpoint { remote-endpoint = <&dai1>; }; };
			};
		};

		back-end {
			ports {
				port@0 { dai0: endpoint { remote-endpoint = <&dsp_b0>; }; };
				port@1 { dai1: endpoint { remote-endpoint = <&dsp_b1>; }; };
			};
		};

		codec {
			port { dai2: endpoint { remote-endpoint = <&pcm1>; }; };
		};


Thank you for your help !!

Best regards
---
Kuninori Morimoto

  reply	other threads:[~2020-08-25  6:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21  4:15 More Generic Audio Graph Sound Card idea Kuninori Morimoto
2020-08-21  5:26 ` Sameer Pujar
2020-08-21  7:14   ` Kuninori Morimoto
2020-08-21  8:28     ` Sameer Pujar
2020-08-21 13:02       ` Mark Brown
2020-09-25  1:43     ` Kuninori Morimoto
2020-09-25 19:22       ` Mark Brown
2020-09-25 20:04         ` Pierre-Louis Bossart
2020-09-25 20:10           ` Mark Brown
2020-09-25 20:50             ` Pierre-Louis Bossart
2020-08-21  7:11 ` Daniel Baluta
2020-08-21  7:25   ` Kuninori Morimoto
2020-08-21  7:33     ` Daniel Baluta
2020-08-21 11:47     ` Mark Brown
2020-08-21 12:18 ` Mark Brown
2020-08-24  0:25   ` Kuninori Morimoto
2020-08-24  6:25     ` Sameer Pujar
2020-08-25  0:59       ` Kuninori Morimoto
2020-08-25  3:11         ` Sameer Pujar
2020-08-25  5:13           ` Kuninori Morimoto
2020-08-25  5:42             ` Sameer Pujar
2020-08-25  6:35               ` Kuninori Morimoto [this message]
2020-08-26  6:46                 ` Sameer Pujar
2020-08-27  1:18                   ` Kuninori Morimoto
2020-08-27  1:36                   ` Kuninori Morimoto
2020-09-03 23:51     ` Kuninori Morimoto
2020-09-09 11:33       ` Sameer Pujar
2020-08-21 15:49 ` Pierre-Louis Bossart
2020-10-13  4:50 ` Kuninori Morimoto
2020-10-15 14:32   ` Mark Brown
2020-10-15 23:04     ` Kuninori Morimoto

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=87mu2jw7zd.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sharadg@nvidia.com \
    --cc=spujar@nvidia.com \
    /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.