* ASoC : question about custom rate
@ 2014-09-09 8:43 Matt Flax
2014-09-09 10:44 ` Lars-Peter Clausen
0 siblings, 1 reply; 4+ messages in thread
From: Matt Flax @ 2014-09-09 8:43 UTC (permalink / raw)
To: alsa-devel
Hi there,
I have an ASIC running on an ASoC with a custom rate @ 18750 Hz.
I would like ALSA to report the correct rate.
If I do nothing, then the following reports 16000 Hz :
cat /proc/asound/card0/pcm0c/sub0/hw_params
I have verified that the hardware is running at the expected 18750 Hz.
I am wondering what/where is the correct place to setup the actual rate ?
I am trying to set the rates at startup like so but ALSA will not work
with the driver when I do this :
static int implant_startup(struct snd_pcm_substream *substream, struct
snd_soc_dai *dai)
{
snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_RATE, 18750, 18750);
snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2);
snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 16, 16);
return 0;
}
static const struct snd_soc_dai_ops implant_dai_ops = {
.set_fmt = implant_set_dai_fmt,
.startup = implant_startup,
};
thanks
Matt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ASoC : question about custom rate
2014-09-09 8:43 ASoC : question about custom rate Matt Flax
@ 2014-09-09 10:44 ` Lars-Peter Clausen
2014-09-09 23:45 ` Matt Flax
0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2014-09-09 10:44 UTC (permalink / raw)
To: Matt Flax, alsa-devel
On 09/09/2014 10:43 AM, Matt Flax wrote:
> Hi there,
>
> I have an ASIC running on an ASoC with a custom rate @ 18750 Hz.
> I would like ALSA to report the correct rate.
>
> If I do nothing, then the following reports 16000 Hz :
> cat /proc/asound/card0/pcm0c/sub0/hw_params
>
> I have verified that the hardware is running at the expected 18750 Hz.
> I am wondering what/where is the correct place to setup the actual rate ?
>
> I am trying to set the rates at startup like so but ALSA will not work with
> the driver when I do this :
>
> static int implant_startup(struct snd_pcm_substream *substream, struct
> snd_soc_dai *dai)
> {
> snd_pcm_hw_constraint_minmax(substream->runtime,
> SNDRV_PCM_HW_PARAM_RATE, 18750, 18750);
This is the correct approach. But it is quite likely that your I2S driver
will set additional constraints (e.g. just 16k, 32k, etc.) that results in
an empty list for the rate constraints. If the I2S driver works fine maybe
change the constraints to only set a minimum and maximum rate instead of
specific rates.
- Lars
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ASoC : question about custom rate
2014-09-09 10:44 ` Lars-Peter Clausen
@ 2014-09-09 23:45 ` Matt Flax
2014-09-10 6:22 ` Lars-Peter Clausen
0 siblings, 1 reply; 4+ messages in thread
From: Matt Flax @ 2014-09-09 23:45 UTC (permalink / raw)
To: Lars-Peter Clausen, alsa-devel
On 09/09/14 20:44, Lars-Peter Clausen wrote:
> On 09/09/2014 10:43 AM, Matt Flax wrote:
>> Hi there,
>>
>> I have an ASIC running on an ASoC with a custom rate @ 18750 Hz.
>> I would like ALSA to report the correct rate.
>>
>> If I do nothing, then the following reports 16000 Hz :
>> cat /proc/asound/card0/pcm0c/sub0/hw_params
>>
>> I have verified that the hardware is running at the expected 18750 Hz.
>> I am wondering what/where is the correct place to setup the actual
>> rate ?
>>
>> I am trying to set the rates at startup like so but ALSA will not
>> work with
>> the driver when I do this :
>>
>> static int implant_startup(struct snd_pcm_substream *substream, struct
>> snd_soc_dai *dai)
>> {
>> snd_pcm_hw_constraint_minmax(substream->runtime,
>> SNDRV_PCM_HW_PARAM_RATE, 18750, 18750);
>
>
> This is the correct approach. But it is quite likely that your I2S
> driver will set additional constraints (e.g. just 16k, 32k, etc.) that
> results in an empty list for the rate constraints. If the I2S driver
> works fine maybe change the constraints to only set a minimum and
> maximum rate instead of specific rates.
Yes, you are right, the i2s driver uses the macro SNDRV_PCM_RATE_8000_96000.
I have used your advice to test by manually setting the i2s rates to
SNDRV_PCM_RATE_CONTINUOUS in the i2s driver's src code.
Now the rate is reported correctly in software. Thank you.
Is there a way to access the underlying i2s driver from within my
codec's startup file so that I don't need to alter the core driver
source code ?
thanks
Matt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ASoC : question about custom rate
2014-09-09 23:45 ` Matt Flax
@ 2014-09-10 6:22 ` Lars-Peter Clausen
0 siblings, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2014-09-10 6:22 UTC (permalink / raw)
To: Matt Flax, alsa-devel
On 09/10/2014 01:45 AM, Matt Flax wrote:
> On 09/09/14 20:44, Lars-Peter Clausen wrote:
>> On 09/09/2014 10:43 AM, Matt Flax wrote:
>>> Hi there,
>>>
>>> I have an ASIC running on an ASoC with a custom rate @ 18750 Hz.
>>> I would like ALSA to report the correct rate.
>>>
>>> If I do nothing, then the following reports 16000 Hz :
>>> cat /proc/asound/card0/pcm0c/sub0/hw_params
>>>
>>> I have verified that the hardware is running at the expected 18750 Hz.
>>> I am wondering what/where is the correct place to setup the actual rate ?
>>>
>>> I am trying to set the rates at startup like so but ALSA will not work with
>>> the driver when I do this :
>>>
>>> static int implant_startup(struct snd_pcm_substream *substream, struct
>>> snd_soc_dai *dai)
>>> {
>>> snd_pcm_hw_constraint_minmax(substream->runtime,
>>> SNDRV_PCM_HW_PARAM_RATE, 18750, 18750);
>>
>>
>> This is the correct approach. But it is quite likely that your I2S driver
>> will set additional constraints (e.g. just 16k, 32k, etc.) that results in
>> an empty list for the rate constraints. If the I2S driver works fine maybe
>> change the constraints to only set a minimum and maximum rate instead of
>> specific rates.
>
> Yes, you are right, the i2s driver uses the macro SNDRV_PCM_RATE_8000_96000.
>
> I have used your advice to test by manually setting the i2s rates to
> SNDRV_PCM_RATE_CONTINUOUS in the i2s driver's src code.
> Now the rate is reported correctly in software. Thank you.
>
> Is there a way to access the underlying i2s driver from within my codec's
> startup file so that I don't need to alter the core driver source code ?
No, that would be a layering violation. If the I2S driver supports more than
just the currently advertised rates it should be updated.
- Lars
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-10 6:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-09 8:43 ASoC : question about custom rate Matt Flax
2014-09-09 10:44 ` Lars-Peter Clausen
2014-09-09 23:45 ` Matt Flax
2014-09-10 6:22 ` Lars-Peter Clausen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.