* [PATCH 1/1] bat: Fix buffer time configuration
@ 2025-04-10 11:01 Alexander Stein
2025-05-16 8:41 ` Alexander Stein
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Stein @ 2025-04-10 11:01 UTC (permalink / raw)
To: alsa-devel; +Cc: Takashi Iwai, Jaroslav Kysela, Alexander Stein
By swapping time configuration some hardware constraints can be supported.
Fixes the error: Set parameter to device error: buffer time: 500000
hw:tqmtlv320aic32: Invalid argument(-22)
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Our common 'alsabat -Dhw:tqmtlv320aic32 -f S16_LE -c 2 -r 44100 -F 997:500'
failed ona i.MX95 based platform, while it worked flawlessly on others,
e.g. i.MX8M Plus. Upon searching I stumbled across [1], which this patch
is inspired/based on.
[1] https://github.com/arkq/bluez-alsa/pull/290/commits/da78b82ff77310093b4b4a914d31e69b8ebb49eb
---
bat/alsa.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/bat/alsa.c b/bat/alsa.c
index 67489c4..457e79a 100644
--- a/bat/alsa.c
+++ b/bat/alsa.c
@@ -221,23 +221,23 @@ static int set_snd_pcm_params(struct bat *bat, struct pcm_container *sndpcm)
period_time = buffer_time / DIV_BUFFERTIME;
- /* Set buffer time and period time */
- err = snd_pcm_hw_params_set_buffer_time_near(sndpcm->handle,
- params, &buffer_time, 0);
+ /* Set period time and buffer time */
+ err = snd_pcm_hw_params_set_period_time_near(sndpcm->handle,
+ params, &period_time, 0);
if (err < 0) {
fprintf(bat->err, _("Set parameter to device error: "));
- fprintf(bat->err, _("buffer time: %d %s: %s(%d)\n"),
- buffer_time,
+ fprintf(bat->err, _("period time: %d %s: %s(%d)\n"),
+ period_time,
device_name, snd_strerror(err), err);
return err;
}
- err = snd_pcm_hw_params_set_period_time_near(sndpcm->handle,
- params, &period_time, 0);
+ err = snd_pcm_hw_params_set_buffer_time_near(sndpcm->handle,
+ params, &buffer_time, 0);
if (err < 0) {
fprintf(bat->err, _("Set parameter to device error: "));
- fprintf(bat->err, _("period time: %d %s: %s(%d)\n"),
- period_time,
+ fprintf(bat->err, _("buffer time: %d %s: %s(%d)\n"),
+ buffer_time,
device_name, snd_strerror(err), err);
return err;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] bat: Fix buffer time configuration
2025-04-10 11:01 [PATCH 1/1] bat: Fix buffer time configuration Alexander Stein
@ 2025-05-16 8:41 ` Alexander Stein
2025-05-16 9:17 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Stein @ 2025-05-16 8:41 UTC (permalink / raw)
To: alsa-devel; +Cc: Takashi Iwai, Jaroslav Kysela
Hi,
Am Donnerstag, 10. April 2025, 13:01:19 CEST schrieb Alexander Stein:
> By swapping time configuration some hardware constraints can be supported.
> Fixes the error: Set parameter to device error: buffer time: 500000
> hw:tqmtlv320aic32: Invalid argument(-22)
>
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Any feedback here? Or should I create a PR on github instead?
Thanks and best regards
Alexander
> ---
> Our common 'alsabat -Dhw:tqmtlv320aic32 -f S16_LE -c 2 -r 44100 -F 997:500'
> failed ona i.MX95 based platform, while it worked flawlessly on others,
> e.g. i.MX8M Plus. Upon searching I stumbled across [1], which this patch
> is inspired/based on.
>
> [1] https://github.com/arkq/bluez-alsa/pull/290/commits/da78b82ff77310093b4b4a914d31e69b8ebb49eb
> ---
> bat/alsa.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/bat/alsa.c b/bat/alsa.c
> index 67489c4..457e79a 100644
> --- a/bat/alsa.c
> +++ b/bat/alsa.c
> @@ -221,23 +221,23 @@ static int set_snd_pcm_params(struct bat *bat, struct pcm_container *sndpcm)
>
> period_time = buffer_time / DIV_BUFFERTIME;
>
> - /* Set buffer time and period time */
> - err = snd_pcm_hw_params_set_buffer_time_near(sndpcm->handle,
> - params, &buffer_time, 0);
> + /* Set period time and buffer time */
> + err = snd_pcm_hw_params_set_period_time_near(sndpcm->handle,
> + params, &period_time, 0);
> if (err < 0) {
> fprintf(bat->err, _("Set parameter to device error: "));
> - fprintf(bat->err, _("buffer time: %d %s: %s(%d)\n"),
> - buffer_time,
> + fprintf(bat->err, _("period time: %d %s: %s(%d)\n"),
> + period_time,
> device_name, snd_strerror(err), err);
> return err;
> }
>
> - err = snd_pcm_hw_params_set_period_time_near(sndpcm->handle,
> - params, &period_time, 0);
> + err = snd_pcm_hw_params_set_buffer_time_near(sndpcm->handle,
> + params, &buffer_time, 0);
> if (err < 0) {
> fprintf(bat->err, _("Set parameter to device error: "));
> - fprintf(bat->err, _("period time: %d %s: %s(%d)\n"),
> - period_time,
> + fprintf(bat->err, _("buffer time: %d %s: %s(%d)\n"),
> + buffer_time,
> device_name, snd_strerror(err), err);
> return err;
> }
>
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] bat: Fix buffer time configuration
2025-05-16 8:41 ` Alexander Stein
@ 2025-05-16 9:17 ` Takashi Iwai
0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2025-05-16 9:17 UTC (permalink / raw)
To: Alexander Stein; +Cc: alsa-devel, Jaroslav Kysela
On Fri, 16 May 2025 10:41:05 +0200,
Alexander Stein wrote:
>
> Hi,
>
> Am Donnerstag, 10. April 2025, 13:01:19 CEST schrieb Alexander Stein:
> > By swapping time configuration some hardware constraints can be supported.
> > Fixes the error: Set parameter to device error: buffer time: 500000
> > hw:tqmtlv320aic32: Invalid argument(-22)
> >
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
>
> Any feedback here? Or should I create a PR on github instead?
Sorry, it was just overlooked.
Now applied the patch. Thanks!
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-16 9:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 11:01 [PATCH 1/1] bat: Fix buffer time configuration Alexander Stein
2025-05-16 8:41 ` Alexander Stein
2025-05-16 9:17 ` Takashi Iwai
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.