Skip to contentSkip to conversation

ALSA: hda: Refactor calculating SDnFMT according to specification

PATCH Superseded Pawel Harlozinski 3 participants 3 messages Sep 21, 2020 Sound

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ALSA: hda: Refactor calculating SDnFMT according to specification

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. Henceforth split cases for formats 20, 24, 32 bits, but leave constraints to maxbps.

Change-Id I97771b16da14e85b7f35372f5dfc87bb13bb5ce0
---
 sound/hda/hdac_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
sound/hda/hdac_device.c +7 -0
index 3e9e9ac804f6..ccc47a10ba63 100644
@@ -764,7 +764,14 @@ 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:
+		if (maxbps >= 24)
+			val |= AC_FMT_BITS_24;
+		else
+			val |= AC_FMT_BITS_20;
+		break;
 	case 32:
 		if (maxbps >= 32 || format == SNDRV_PCM_FORMAT_FLOAT_LE)
 			val |= AC_FMT_BITS_32;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · 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

Quoted 5 lines

Set SDnFMT depending on which format was given. Henceforth split cases for formats 20, 24, 32 bits, but leave constraints to maxbps.

Change-Id: I97771b16da14e85b7f35372f5dfc87bb13bb5ce0

Hello,

checkpatch script should have notified you about need for removing Change-Id. Please remove for the next version.

Has there been any explanation for why v2 is sent and what changes have been made between v1 and v2?

Czarek

Quoted 25 lines
---
  sound/hda/hdac_device.c | 7 +++++++
  1 file changed, 7 insertions(+)
sound/hda/hdac_device.c +7 -0
index 3e9e9ac804f6..ccc47a10ba63 100644
@@ -764,7 +764,14 @@ 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:
+		if (maxbps >= 24)
+			val |= AC_FMT_BITS_24;
+		else
+			val |= AC_FMT_BITS_20;
+		break;
  	case 32:
  		if (maxbps >= 32 || format == SNDRV_PCM_FORMAT_FLOAT_LE)
  			val |= AC_FMT_BITS_32;
#2 lore raw
In reply to Pawel Harlozinski
Quoted 11 lines · 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

Quoted 3 lines

Set SDnFMT depending on which format was given. Henceforth split cases for formats 20, 24, 32 bits, but leave constraints to maxbps.

As mentioned in the previous thread, practically seen, case 20 and 24 are never met, since HD-audio doesn't accept the SNDRV_PCM_FORMAT_20*
or _24* due to the 32bit container. So this change is superfluous.

I can take the change, but it has to be clarified that it won't affect the behavior on the real hardware but pure theoretical.

Quoted 1 line

Change-Id: I97771b16da14e85b7f35372f5dfc87bb13bb5ce0

Please drop change-id. It's not useful for others.

thanks,

Takashi

Quoted 27 lines
---
 sound/hda/hdac_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
sound/hda/hdac_device.c +7 -0
index 3e9e9ac804f6..ccc47a10ba63 100644
@@ -764,7 +764,14 @@ 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:
+		if (maxbps >= 24)
+			val |= AC_FMT_BITS_24;
+		else
+			val |= AC_FMT_BITS_20;
+		break;
 	case 32:
 		if (maxbps >= 32 || format == SNDRV_PCM_FORMAT_FLOAT_LE)
 			val |= AC_FMT_BITS_32;
Signature · 1 line
2.17.1