Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rate limitation in a SectionDevice #253

Closed
fchiby opened this issue Dec 19, 2022 · 2 comments
Closed

Add rate limitation in a SectionDevice #253

fchiby opened this issue Dec 19, 2022 · 2 comments

Comments

@fchiby
Copy link

fchiby commented Dec 19, 2022

Hello @perexg,

I created an alsa-ucm configuration to my board i350-evk (mt8365-evk).
Here my configuration files:

mt8365-evk.conf.txt
HiFi.conf.txt

However pulseaudio initialization failed because of hw:mt8365evk,2, this pcm device is connected to jack_mic and Amic.

D: [pulseaudio] alsa-util.c: _buffer_size:4408 ,   _period_size:1102
I: [pulseaudio] pcm_hw.c: SNDRV_PCM_IOCTL_PREPARE failed (-22)
D: [pulseaudio] alsa-util.c: _buffer_size:4408 ,   _period_size:1102
I: [pulseaudio] pcm_hw.c: SNDRV_PCM_IOCTL_PREPARE failed (-22)
D: [pulseaudio] alsa-util.c: _buffer_size:4408 ,   _period_size:1102
I: [pulseaudio] pcm_hw.c: SNDRV_PCM_IOCTL_PREPARE failed (-22)
D: [pulseaudio] alsa-util.c: Set neither period nor buffer size.
I: [pulseaudio] pcm_hw.c: SNDRV_PCM_IOCTL_PREPARE failed (-22)
I: [pulseaudio] alsa-util.c: snd_pcm_hw_params failed: Invalid argument
D: [pulseaudio] alsa-util.c: Trying plug:SLAVE='_ucm0006.hw:mt8365evk,2' with SND_PCM_NO_AUTO_FORMAT ...
I: [pulseaudio] pcm.c: Unknown PCM _ucm0006.hw:mt8365evk,2
I: [pulseaudio] alsa-util.c: Error opening PCM device plug:SLAVE='_ucm0006.hw:mt8365evk,2': No such file or directory
D: [pulseaudio] alsa-mixer.c: Profile set 0xaaab0a13a700, auto_profiles=no, probed=yes, n_mappings=0, n_profiles=0, n_decibel_fixes=0
E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="0" name="platform-sound" card_name="alsa_card.platform-sound" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.

Whith dmesg I got more details about pulseaudio failure:

[  160.295717] mt8365-afe-pcm 11220000.audio-controller: mt8365_afe_fe_hw_params AWB period = 1102 rate = 44100 channels = 1
[  160.295865] mt8365-afe-pcm 11220000.audio-controller: mt8365_afe_int_adda_prepare 'Capture' rate = 44100
[  160.295881] mt8365-afe-pcm 11220000.audio-controller: ASoC: error at snd_soc_pcm_dai_prepare on INT ADDA: -22
[  160.295891]  MTK Codec: ASoC: soc_pcm_prepare() failed (-22)
[  160.295900]  AWB_FE: ASoC: dpcm_be_dai_prepare() failed (-22)
[  160.295908]  AWB_FE: ASoC: dpcm_fe_dai_prepare() failed (-22)
[  160.296395] mt8365-afe-pcm 11220000.audio-controller: mt8365_afe_fe_hw_params AWB period = 512 rate = 44100 channels = 1
[  160.296543] mt8365-afe-pcm 11220000.audio-controller: mt8365_afe_int_adda_prepare 'Capture' rate = 44100
[  160.296559] mt8365-afe-pcm 11220000.audio-controller: ASoC: error at snd_soc_pcm_dai_prepare on INT ADDA: -22
[  160.296569]  MTK Codec: ASoC: soc_pcm_prepare() failed (-22)
[  160.296577]  AWB_FE: ASoC: dpcm_be_dai_prepare() failed (-22)
[  160.296585]  AWB_FE: ASoC: dpcm_fe_dai_prepare() failed (-22)

When I checked the machine driver, hw:mt8365evk,2 FE (AWB) has 8000_192000, while hw:mt8365evk,2 BE (INT_ADDA) has only [8000, 16000, 32000, 48000] as sample rates.
Actually, the rate limitation is not on afe dai, it's on PMIC. So we prefer to not restrict hw:mt8365evk,2 FE AWB rates.

My question is, is it possible to specify the rate limitation in a SectionDevice ? I checked the alsa-ucm-conf documentation and did not find any section for this :/ alsa-ucm-conf docs

Thanks a bunch !

@perexg
Copy link
Member

perexg commented Dec 19, 2022

Why BE params does not limit FE params for ASoC? It breaks the PCM user space API - if something is not supported for the given configuration at RUNTIME, it should not be advertised to the user space. The fixed rate setup in UCM is possible, but I would fix the driver at first.

@fchiby
Copy link
Author

fchiby commented Dec 22, 2022

This issue is fixed by adding this flag https://elixir.bootlin.com/linux/latest/source/include/sound/soc.h#L738

@fchiby fchiby closed this as completed Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants