From: Jean-Francois Moine <moinejf@free.fr>
To: Lars-Peter Clausen <lars@metafoo.de>,
Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 08/19] ASoC: kirkwood: Don't set unused struct snd_pcm_hardware fields
Date: Mon, 30 Dec 2013 20:42:09 +0100 [thread overview]
Message-ID: <20131230204209.109eca01@armhf> (raw)
> On 12/20/2013 08:13 PM, Jean-Francois Moine wrote:
> > On Fri, 20 Dec 2013 18:18:49 +0100
> > Lars-Peter Clausen <lars@metafoo.de> wrote:
> >
> >> On 12/20/2013 07:05 PM, Jean-Francois Moine wrote:
> >>>> diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c
> >>>> index 4af1936..aac22fc 100644
> >>>> --- a/sound/soc/kirkwood/kirkwood-dma.c
> >>>> +++ b/sound/soc/kirkwood/kirkwood-dma.c
> >>> [snip]
> >>>> @@ -43,12 +33,6 @@ static struct snd_pcm_hardware kirkwood_dma_snd_hw = {
> >>>> SNDRV_PCM_INFO_MMAP_VALID |
> >>>> SNDRV_PCM_INFO_BLOCK_TRANSFER |
> >>>> SNDRV_PCM_INFO_PAUSE),
> >>>> - .formats = KIRKWOOD_FORMATS,
> >>>> - .rates = KIRKWOOD_RATES,
> >>>> - .rate_min = 8000,
> >>>> - .rate_max = 384000,
> >>>> - .channels_min = 1,
> >>>> - .channels_max = 8,
> >>>> .buffer_bytes_max = KIRKWOOD_SND_MAX_BUFFER_BYTES,
> >>>> .period_bytes_min = KIRKWOOD_SND_MIN_PERIOD_BYTES,
> >>>> .period_bytes_max = KIRKWOOD_SND_MAX_PERIOD_BYTES,
> >>>
> >>> Lars,
> >>>
> >>> You removed too many things. The 'formats' field is mandatory.
> >>
> >> No it is not. While snd_soc_set_runtime_hwparams() uses it it is later
> >> overwritten again in soc_pcm_init_runtime_hw().
> >
> > I have a DPCM system and soc_pcm_init_runtime_hw() is not called
> > (either 'dynamic' or 'no_pcm' is set in the DAI links).
>
> Ok, I see dpcm_set_fe_runtime() does things slightly different.
Well, I advanced a bit with DPCM, and I have a problem with this field.
In the driver, the front-end DAI is the audio controller and the
back-ends DAIs are the HDMI and SPDIF outputs. These back-end DAIs
have different rates and formats, as have the audio controller outputs
(I2S and SPDIF). So, I used intermediate DAIs which represent the audio
controller outputs, and they are described in the DAI links:
link 0 (FE): audio controller <-> dummy DAI
link 1 (BE): i2s audio controller output <-> HDMI output
link 2 (BE): spdif audio controller output <-> HDMI output
link 3 (BE): spdif audio controller output <-> SPDIF output
Without any patch in the core, the rates and formats are always the
rates and formats of the audio controller (FE). This is due to the
'goto dynamic' in soc_pcm_open(): as the back-ends are linked to real
DAIs, the rate and format constraints must be checked. So, as a
temporary patch, I replaced:
if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm)
goto dynamic;
by:
if (rtd->dai_link->dynamic)
goto dynamic;
(indeed, this will not work if the back-end is linked to the dummy DAI)
and, I get the correct rates and formats in the runtime hardware
parameters. But these values are lost:
- on DMA open (FE pcm open), when the driver calls
snd_soc_set_runtime_hwparams() (loss of the formats), and
- on dpcm_set_fe_runtime() call (loss of the rates).
The first problem can be fixed in the audio controller by a hack,
saving /restoring the formats on calling snd_soc_set_runtime_hwparams(),
and the second problem is easily fixed moving dpcm_set_fe_runtime() at
the beginning of dpcm_fe_dai_startup(). Are these good solutions?
--
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next reply other threads:[~2013-12-30 19:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-30 19:42 Jean-Francois Moine [this message]
2014-01-01 20:10 ` [PATCH 08/19] ASoC: kirkwood: Don't set unused struct snd_pcm_hardware fields Lars-Peter Clausen
2014-01-02 11:53 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2013-12-20 13:20 [PATCH 01/19] ASoC: atmel: " Lars-Peter Clausen
2013-12-20 13:20 ` [PATCH 08/19] ASoC: kirkwood: " Lars-Peter Clausen
2013-12-20 18:05 ` Jean-Francois Moine
2013-12-20 17:18 ` Lars-Peter Clausen
2013-12-20 19:13 ` Jean-Francois Moine
2013-12-20 18:29 ` Lars-Peter Clausen
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=20131230204209.109eca01@armhf \
--to=moinejf@free.fr \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).