]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ASoC: soc-compress: add snd_compress_ops
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 20 Apr 2020 07:07:50 +0000 (16:07 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 21 Apr 2020 18:01:54 +0000 (19:01 +0100)
commitc6cb522c1461eee41f086839bd3c9cb622cd26ca
tree8348fc70c5053d5c022d45064ec8daeb7f6bc26b
parente48e83d15bd98b15f7f9eb69f10e4ec595b3f69e
ASoC: soc-compress: add snd_compress_ops

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@renesas.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87v9luvdmh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-component.h
sound/soc/soc-compress.c