Re: More Generic Audio Graph Sound Card idea

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux