From: Liam Girdwood <lrg@slimlogic.co.uk>
To: "Koul, Vinod" <vinod.koul@intel.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
Mark <broonie@opensource.wolfsonmicro.com>,
Aisheng Dong <dongas86@gmail.com>
Subject: Re: ALSA hw sample rate conversion support
Date: Wed, 30 Mar 2011 20:09:53 +0100 [thread overview]
Message-ID: <1301512193.3375.31.camel@odin> (raw)
In-Reply-To: <438BB0150E931F4B9CE701519A44630108516FF552@bgsmsx502.gar.corp.intel.com>
On Wed, 2011-03-30 at 21:02 +0530, Koul, Vinod wrote:
> Aisheng Dong wrote:
> > Hi ALL,
> >
> > Does ALSA core support hw sample rate conversion now?
> > Our soc has a HW sample rate converter module inside,
> > I wonder if current ALSA core provide interface to support hw sample
> > rate conversion?
> >
> Assuming the SRC is inside SoC and you are converting sampling rate of stream
> and sending at different rate, then I have a patch for you.
> Basically the soc side hw_params should call a new API which call
> codec_set_params() and sets the matching rate.
>
> Something like this in soc-core
>
> +int snd_soc_codec_set_params(struct snd_soc_codec *codec, unsigned int param)
> +{
> + if (codec->driver->set_params)
> + return codec->driver->set_params(codec, param);
> + else
> + return -EINVAL;
> +}
> +EXPORT_SYMBOL_GPL(snd_soc_codec_set_params);
>
> Mark,
> Would you okay with such a patch where DSP is doing some conversion and codec
> will get different params from what stream is set up? And we make sure
> conversion is synced
Fwiw, I've already implemented a hw_params() fixup between the DSP and
CODEC drivers. This is in my dsp branch atm here :-
http://git.kernel.org/?p=linux/kernel/git/lrg/asoc-2.6.git;a=shortlog;h=refs/heads/topic/dsp-upstream
This allows us to rewrite channels, rates, formats etc. depending on the
use case and can be part of the machine driver e.g. (from sdp4430.c)
static int mcbsp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS);
unsigned int be_id = rtd->dai_link->be_id;
if (be_id == OMAP_ABE_DAI_MM_FM)
channels->min = 2;
else if (be_id == OMAP_ABE_DAI_BT_VX)
channels->min = 1;
snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT -
SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
return 0;
}
static int dmic_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
struct snd_interval *rate = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_RATE);
/* The ABE will covert the FE rate to 96k */
rate->min = rate->max = 96000;
snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT -
SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S32_LE);
return 0;
}
I intend to start upstreaming all this stuff when I return from holiday
on the 11th April (in time for 2.6.40).
Liam
next prev parent reply other threads:[~2011-03-30 19:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-30 11:17 ALSA hw sample rate conversion support Aisheng Dong
2011-03-30 13:27 ` Clemens Ladisch
2011-03-30 15:32 ` Koul, Vinod
2011-03-30 19:09 ` Liam Girdwood [this message]
2011-03-31 17:45 ` Question about your DSP topic branch - hw param fix up query Patrick Lai
2011-03-31 21:35 ` Liam Girdwood
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=1301512193.3375.31.camel@odin \
--to=lrg@slimlogic.co.uk \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dongas86@gmail.com \
--cc=vinod.koul@intel.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).