mbox series

[0/6] ASoC: improve codec to codec link support

Message ID 20190724162405.6574-1-jbrunet@baylibre.com
Headers show
Series ASoC: improve codec to codec link support | expand

Message

Jerome Brunet July 24, 2019, 4:23 p.m. UTC
As explained in this previous series [0], on Amlogic, we are using codec to
codec links to deal with the glue which is between the i2s backends and the
synopsys hdmi controller.

This worked well until I tried to .get_eld() support in the dw-hdmi-i2s
driver.  Doing so adds channel mapping controls to the codec. This shown
several problem

1) .pcm_new() is not called on codec to codec links.
   struct snd_soc_pcm_runtime do not even have a valid .pcm
2) struct snd_pcm_substream and struct snd_pcm_runtime are ephemeral
   This is a problem if a control needs to access them

The goal of this patchset is to resolve the above issues and improve the
codec to codec link support enough to correctly handle the hdmi-codec

The support of these codec to codec links could probably be improved in the
future to behave like any other link and use soc_pcm_open(),
soc_pcm_hw_params(), etc...

The challenge lies in the dapm mutex. The soc_pcm call dapm function locking
this mutex but the dapm mutex is already held in snd_soc_dai_link_event()

[0]: https://lkml.kernel.org/r/20190515131858.32130-1-jbrunet@baylibre.com

Jerome Brunet (6):
  ASoC: codec2codec: run callbacks in order
  ASoC: codec2codec: name link using stream direction
  ASoC: codec2codec: deal with params when necessary
  ASoC: create pcm for codec2codec links as well
  ASoC: codec2codec: remove ephemeral variables
  ASoC: codec2codec: fill some of the runtime stream parameters

 sound/soc/soc-core.c |  42 +++-------
 sound/soc/soc-dapm.c | 186 +++++++++++++++++++++++++++----------------
 sound/soc/soc-pcm.c  |  35 +++++++-
 3 files changed, 162 insertions(+), 101 deletions(-)

-- 
2.21.0

Comments

Mark Brown July 25, 2019, 1 p.m. UTC | #1
On Wed, Jul 24, 2019 at 06:24:00PM +0200, Jerome Brunet wrote:
> When handling dai_link events on codec to codec links, run all .startup()

> callbacks on sinks and sources before running any .hw_params(). Same goes

> for hw_free() and shutdown(). This is closer to the behavior of regular

> dai links


This looks good but needs rebasing against -next due to Morimoto-san's
recent DAI changes:

  CC      sound/soc/soc-dapm.o
sound/soc/soc-dapm.c: In function ‘snd_soc_dai_link_event’:
sound/soc/soc-dapm.c:3857:10: error: implicit declaration of function ‘soc_dai_hw_params’; did you mean ‘snd_soc_dai_hw_params’? [-Werror=implicit-function-declaration]
    ret = soc_dai_hw_params(&substream, params, source);
          ^~~~~~~~~~~~~~~~~
          snd_soc_dai_hw_params
Jerome Brunet July 25, 2019, 1:21 p.m. UTC | #2
On Thu 25 Jul 2019 at 14:00, Mark Brown <broonie@kernel.org> wrote:

> On Wed, Jul 24, 2019 at 06:24:00PM +0200, Jerome Brunet wrote:

>> When handling dai_link events on codec to codec links, run all .startup()

>> callbacks on sinks and sources before running any .hw_params(). Same goes

>> for hw_free() and shutdown(). This is closer to the behavior of regular

>> dai links

>

> This looks good but needs rebasing against -next due to Morimoto-san's

> recent DAI changes:

>

>   CC      sound/soc/soc-dapm.o

> sound/soc/soc-dapm.c: In function ‘snd_soc_dai_link_event’:

> sound/soc/soc-dapm.c:3857:10: error: implicit declaration of function ‘soc_dai_hw_params’; did you mean ‘snd_soc_dai_hw_params’? [-Werror=implicit-function-declaration]

>     ret = soc_dai_hw_params(&substream, params, source);

>           ^~~~~~~~~~~~~~~~~

>           snd_soc_dai_hw_params


I did rebase against next and saw Morimoto-san's patchset. I must have
messed up when formatting the patches, sorry about that. I'll resend.