Skip to contentSkip to conversation

Why no Marco definitions for rate 24000 and 12000?

DISCUSSION cocala 3 participants 5 messages Nov 14, 2008

lore
Share & tools
lore

cocala

author
#0 lore raw

Who can tell me why not define add SNDRV_PCM_RATE_24000 and SNDRV_PCM_RATE_12000?

#1 lore raw

At Fri, 14 Nov 2008 16:32:42 +0800,

Quoted 3 lines · cocala

Who can tell me why not define add SNDRV_PCM_RATE_24000 and SNDRV_PCM_RATE_12000?

Just because they are rarely used.
You can add a list of supported sample rates explicitly via snd_pcm_hw_hw_constraint_list() even if they are not defined in SNDRV_PCM_RATE_* bits.

Takashi

author
#2 lore raw
In reply to cocala

Yes, that can add supported sample rates.

but the macro definitions are still needed, actually 12000 and 24000 are supported by most audio codecs.

in soc-core.c

runtime->hw.rates =
codec_dai->capture->rates & cpu_dai->capture->rates;

in wm8350.c
#define WM8350_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | \

  SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | \
        SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_32000 | \
        SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | \
        SNDRV_PCM_RATE_96000)

static const struct snd_soc_pcm_stream wm8350_hifi_dai_playback = {
.stream_name = "Playback",
.channels_min = 2,
.channels_max = 2,
.rates = WM8350_RATES,
.formats = WM8350_FORMATS,
};
Without the mcaro defintions, it is hard to handle the 12000 and 24000 sample rates.

2008/11/14 cocala <[email protected]>

Quoted 2 lines

Who can tell me why not define add SNDRV_PCM_RATE_24000 and SNDRV_PCM_RATE_12000?

#3 lore raw

At Fri, 14 Nov 2008 17:01:08 +0800,

Quoted 5 lines · cocala

Yes, that can add supported sample rates.

but the macro definitions are still needed, actually 12000 and 24000 are supported by most audio codecs.

Simply pass SNDRV_PCM_RATE_KNOT instead of explicit rate bits.

Takashi

#4 lore raw
Quoted 6 lines · Takashi Iwai
Quoted 2 lines · cocala

but the macro definitions are still needed, actually 12000 and 24000 are supported by most audio codecs.

Simply pass SNDRV_PCM_RATE_KNOT instead of explicit rate bits.

This is with ASoC - due to the way the core does rate matching it'll also require the platform side to support SNDDRV_PCM_RATE_KNOT (but should work otherwise, both drivers will get the chance to define extra constraints).