mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: qcom: q6apm-lpass-dais: pass max number of channels to Audioreach
@ 2023-10-17 16:14 Krzysztof Kozlowski
  2023-10-18  8:14 ` Krzysztof Kozlowski
  2023-10-26 15:12 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2023-10-17 16:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel
  Cc: Krzysztof Kozlowski

Using the params_channels() helper when setting hw_params, results in
passing to Audioreach minimum number of channels valid for given
hardware.  This is not valid for any hardware which sets minimum
channels to two and maximum to something bigger, like four channels.

Instead pass the maximum number of supported channels to allow playback
of multi-channel formats.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
index 7ad604b80e25..c5e065a21e27 100644
--- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
+++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
@@ -97,7 +97,7 @@ static int q6hdmi_hw_params(struct snd_pcm_substream *substream,
 {
 	struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev);
 	struct audioreach_module_config *cfg = &dai_data->module_config[dai->id];
-	int channels = params_channels(params);
+	int channels = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max;
 	int ret;
 
 	cfg->bit_width = params_width(params);
@@ -130,7 +130,7 @@ static int q6dma_hw_params(struct snd_pcm_substream *substream,
 
 	cfg->bit_width = params_width(params);
 	cfg->sample_rate = params_rate(params);
-	cfg->num_channels = params_channels(params);
+	cfg->num_channels = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max;
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: qcom: q6apm-lpass-dais: pass max number of channels to Audioreach
  2023-10-17 16:14 [PATCH] ASoC: qcom: q6apm-lpass-dais: pass max number of channels to Audioreach Krzysztof Kozlowski
@ 2023-10-18  8:14 ` Krzysztof Kozlowski
  2023-10-23 15:18   ` Mark Brown
  2023-10-26 15:12 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2023-10-18  8:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel

On 17/10/2023 18:14, Krzysztof Kozlowski wrote:
> Using the params_channels() helper when setting hw_params, results in
> passing to Audioreach minimum number of channels valid for given
> hardware.  This is not valid for any hardware which sets minimum
> channels to two and maximum to something bigger, like four channels.
> 
> Instead pass the maximum number of supported channels to allow playback
> of multi-channel formats.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 4 ++--

I am not sure if this is correct fix. I think sound machine drivers
should just not override channels like:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/qcom/sm8250.c?h=v6.6-rc6#n44

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: qcom: q6apm-lpass-dais: pass max number of channels to Audioreach
  2023-10-18  8:14 ` Krzysztof Kozlowski
@ 2023-10-23 15:18   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-10-23 15:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1530 bytes --]

On Wed, Oct 18, 2023 at 10:14:03AM +0200, Krzysztof Kozlowski wrote:
> On 17/10/2023 18:14, Krzysztof Kozlowski wrote:

> > Using the params_channels() helper when setting hw_params, results in
> > passing to Audioreach minimum number of channels valid for given
> > hardware.  This is not valid for any hardware which sets minimum
> > channels to two and maximum to something bigger, like four channels.
> > 
> > Instead pass the maximum number of supported channels to allow playback
> > of multi-channel formats.

> I am not sure if this is correct fix. I think sound machine drivers
> should just not override channels like:

You *can* get cases where machine specific wiring or clocking limits
mean that even if both ends of a link are capable of some number of
channels the actual limit is lower.

> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/qcom/sm8250.c?h=v6.6-rc6#n44

That's:

| static int sm8250_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|				     struct snd_pcm_hw_params *params)

...

|	rate->min = rate->max = 48000;
|	channels->min = channels->max = 2;

which is DPCM which is it's own special thing - in this case it's saying
that whatever the front end takes in the thing that comes out of the SoC
will have been reformatted to 48kHz stereo (so mono will be turned into
stereo for example) which is a perfectly reasonable thing for a DSP to
do.  See previous discussions of how we should handle this better, DPCM
isn't ideal.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: qcom: q6apm-lpass-dais: pass max number of channels to Audioreach
  2023-10-17 16:14 [PATCH] ASoC: qcom: q6apm-lpass-dais: pass max number of channels to Audioreach Krzysztof Kozlowski
  2023-10-18  8:14 ` Krzysztof Kozlowski
@ 2023-10-26 15:12 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-10-26 15:12 UTC (permalink / raw)
  To: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel,
	Krzysztof Kozlowski

On Tue, 17 Oct 2023 18:14:29 +0200, Krzysztof Kozlowski wrote:
> Using the params_channels() helper when setting hw_params, results in
> passing to Audioreach minimum number of channels valid for given
> hardware.  This is not valid for any hardware which sets minimum
> channels to two and maximum to something bigger, like four channels.
> 
> Instead pass the maximum number of supported channels to allow playback
> of multi-channel formats.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: qcom: q6apm-lpass-dais: pass max number of channels to Audioreach
      commit: e29de7abdaf56f58141b01f74862b320191c9203

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-26 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 16:14 [PATCH] ASoC: qcom: q6apm-lpass-dais: pass max number of channels to Audioreach Krzysztof Kozlowski
2023-10-18  8:14 ` Krzysztof Kozlowski
2023-10-23 15:18   ` Mark Brown
2023-10-26 15:12 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®