No subject
Wed Mar 28 10:40:43 CEST 2012
static struct snd_pcm_hardware davinci_pcm_hardware =3D {
.info =3D (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE),
.formats =3D (SNDRV_PCM_FMTBIT_S16_LE),
.rates =3D (SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_KNOT),
.rate_min =3D 7200, // Changed to support new rate
.rate_max =3D 192000,
.channels_min =3D 1,//2,
.channels_max =3D 2,
.buffer_bytes_max =3D 256 * 1024,
.period_bytes_min =3D 32,
.period_bytes_max =3D 8 * 1024,
.periods_min =3D 16,
.periods_max =3D 255,
.fifo_size =3D 0,
};
// ADDED: to support rates not defined in sound/pcm.h
static unsigned int rates[] =3D { 7200, 8000, 9600, 12000, 16000, 44100,
48000, 64000,
96000, 128000, 144000, 192000 };
static struct snd_pcm_hw_constraint_list constraints_rates =3D {
.count =3D ARRAY_SIZE(rates),
.list =3D rates,
.mask =3D 0,
};
static int davinci_pcm_open(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime =3D substream->runtime;
struct davinci_runtime_data *prtd;
int ret =3D 0;
snd_soc_set_runtime_hwparams(substream, &davinci_pcm_hardware);
// ADDED: to support rates not supported in sound/pcm.h
ret =3D snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
&constraints_rates);
if (ret < 0)
{
printk(KERN_ERR "ERROR: unable to set HW constraint list!\n");
return -1;
}
prtd =3D kzalloc(sizeof(struct davinci_runtime_data), GFP_KERNEL);
if (prtd =3D=3D NULL)
return -ENOMEM;
spin_lock_init(&prtd->lock);
runtime->private_data =3D prtd;
ret =3D davinci_pcm_dma_request(substream);
if (ret) {
printk(KERN_ERR "davinci_pcm: Failed to get dma channels\n");
kfree(prtd);
}
=09
return ret;
}
Thanks,
Jeremy
On Thu, Apr 19, 2012 at 1:06 PM, Clemens Ladisch <clemens at ladisch.de> wrote=
:
> Jeremy Torres wrote:
>> Thanks for the quick reply! =A0So, I followed Takashi's advice and added
>> the constraint list for the new sample rates and no longer changed
>> pcm.h/pcm_native.c. =A0I can record/play at the new sample rates;
>> however, ALSA is performing rate conversion. =A0For example, to run at
>> 144K, the slave is configured to run 192K, even though my hardware can
>> be configured to support 144K.
>
> This sounds like a bug in the driver.
>
> Unfortunately, my crystal ball is out of order, so you have to actually
> show the source code for me to be able to help you.
>
>
> Regards,
> Clemens
More information about the Alsa-devel
mailing list