Re: [PATCH v2 1/8] ASoC: soc-compress: add snd_compress_ops

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

 



On Mon, Apr 20, 2020 at 04:07:50PM +0900, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
> 
> Current snd_soc_component_driver has compr_ops, and each driver can
> have callback via it. But, it is mainly created for ALSA, thus, it
> doesn't have "component" as parameter.
> Thus, each callback can't know it is called for which component.
> Each callback currently is getting "component" by using
> snd_soc_rtdcom_lookup() with driver name.
> 
> 	--- ALSA SoC  ---
> 	...
> 	if (component->driver->compr_ops &&
> 	    component->driver->compr_ops->open)
> =>		return component->driver->compr_ops->open(stream);
> 	...
> 
> 	--- driver ---
> 	static int xxx_open(struct snd_compr_stream *stream)
> 	{
> 		struct snd_soc_pcm_runtime *rtd = stream->private_data;
> =>		struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
> 		...
> 	}
> 
> It works today, but, will not work in the future if we support multi
> CPU/Codec/Platform, because 1 rtd might have multiple same driver
> name component.
> 
> To solve this issue, each callback need to be called with component.
> We already have many component driver callbacks.
> This patch adds new snd_compress_ops, and call it with "component".
> 
> 	--- ALSA SoC  ---
> 	...
> 	if (component->driver->compress_ops->open)
> =>		return component->driver->compress_ops->open(
> 			component, substream);
> 			~~~~~~~~~
> 	...
> 
> 	--- driver ---
> 	static int xxx_open(struct snd_soc_component *component,
> 			    struct snd_compr_stream *stream)
> 	{
> =>		/* it don't need to use snd_soc_rtdcom_lookup() */
> 		...
> 	}
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
> ---

Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
Tested-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

Thanks,
Charles



[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