Skip to contentSkip to conversation

AC'97 recording on AT91sam9263

DISCUSSION Sedji Gaouaou 1 participant 1 message May 21, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I am trying to write the AC'97 driver(recording) and I encounter some problems.
I would like to set up some constraints but if I do so I will have a seg fault when running arecord.

here is my open function:

/* define the constraints */

static unsigned int rates[] = {
	8000, 44100,
};
static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
	.count	= ARRAY_SIZE(rates),
	.list	= rates,
	.mask	= 0,
};

...

static int snd_at91_ac97_capture_open(struct snd_pcm_substream *substream)

{
	at91_ac97_t *chip = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	int err;

	runtime->hw = snd_at91_ac97_capture_hw;
	chip->capture_substream = substream;
	chip->period = 0;

	if ((err = snd_pcm_hw_constraint_list(runtime, 0, 
SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates)) < 0)
		return err;

	snd_printd(KERN_DEBUG "%s : snd_at91_ac97_capture_open\n\r", driver_name);

	return 0;
}

I have another problem if I try to set up some constraint on the format. Indeed I do exactly the same as for the rate, but then it will fail in aplay.c in the function set_params, returning the error message:"Broken configuration for this PCM: no configuration available."

Do I miss something when trying to set up the constraints? Is there any particular way for setting the format constraints?

Regards,
Sedji