Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Refactor calculating SDnFMT according to specification
@ 2020-08-24 10:00 Pawel Harlozinski
  2020-08-24 12:16 ` Kai Vehmanen
  0 siblings, 1 reply; 5+ messages in thread
From: Pawel Harlozinski @ 2020-08-24 10:00 UTC (permalink / raw)
  To: alsa-devel
  Cc: cezary.rojewski, patch, tiwai, lgirdwood, pierre-louis.bossart,
	broonie, amadeuszx.slawinski, Pawel Harlozinski

Fix setting SDnFMT based on High Definition Audio Specification Rev. 1.0a page 48.

Bits per Sample (BITS):
000 = 8 bits. The data will be packed in memory in 8-bit containers on 16-bit boundaries.
001 = 16 bits. The data will be packed in memory in 16-bit containers on 16-bit boundaries.
010 = 20 bits. The data will be packed in memory in 32-bit containers on 32-bit boundaries.
011 = 24 bits. The data will be packed in memory in 32-bit containers on 32-bit boundaries.
100 = 32 bits. The data will be packed in memory in 32-bit containers on 32-bit boundaries.
101-111 = Reserved

Set SDnFMT depending on which format was given, as maxbps only describes container size.
Henceforth split cases for formats 20, 24, 32 bits.
For format SNDRV_PCM_FORMAT_FLOAT_LE width is equal 32 so as previously it will end up with mask for 32 bits.

Signed-off-by: Pawel Harlozinski <pawel.harlozinski@linux.intel.com>
---
 sound/hda/hdac_device.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 333220f0f8af..2ccf79866f99 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -762,14 +762,13 @@ unsigned int snd_hdac_calc_stream_format(unsigned int rate,
 		val |= AC_FMT_BITS_16;
 		break;
 	case 20:
+		val |= AC_FMT_BITS_20;
+		break;
 	case 24:
+		val |= AC_FMT_BITS_24;
+		break;
 	case 32:
-		if (maxbps >= 32 || format == SNDRV_PCM_FORMAT_FLOAT_LE)
-			val |= AC_FMT_BITS_32;
-		else if (maxbps >= 24)
-			val |= AC_FMT_BITS_24;
-		else
-			val |= AC_FMT_BITS_20;
+		val |= AC_FMT_BITS_32;
 		break;
 	default:
 		return 0;
-- 
2.17.1


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

end of thread, other threads:[~2020-09-02 13:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-24 10:00 [PATCH] ALSA: hda: Refactor calculating SDnFMT according to specification Pawel Harlozinski
2020-08-24 12:16 ` Kai Vehmanen
2020-08-25  8:25   ` Takashi Iwai
2020-09-02 13:13     ` Harlozinski, Pawel
2020-09-02 13:29       ` Harlozinski, Pawel

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