All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Harlozinski <pawel.harlozinski@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: cezary.rojewski@intel.com, patch@alsa-project.org,
	kai.vehmanen@linux.intel.com, tiwai@suse.de, lgirdwood@gmail.com,
	pierre-louis.bossart@linux.intel.com, broonie@kernel.org,
	amadeuszx.slawinski@linux.intel.com,
	Pawel Harlozinski <pawel.harlozinski@linux.intel.com>
Subject: [PATCH v3 1/1] ALSA: hda: Refactor calculating SDnFMT according to specification
Date: Tue, 22 Sep 2020 17:33:32 +0200	[thread overview]
Message-ID: <20200922153332.4919-1-pawel.harlozinski@linux.intel.com> (raw)

Fix setting SDnFMT based on :wq
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.

Signed-off-by: Pawel Harlozinski <pawel.harlozinski@linux.intel.com>

---

 v3: drop gerrit Change-Id
 v2: leave constraints to maxbps
 
 sound/hda/hdac_device.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 3e9e9ac804f6..ccc47a10ba63 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -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.17.1


             reply	other threads:[~2020-09-22 15:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 15:33 Pawel Harlozinski [this message]
2020-09-22 15:58 ` [PATCH v3 1/1] ALSA: hda: Refactor calculating SDnFMT according to specification Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200922153332.4919-1-pawel.harlozinski@linux.intel.com \
    --to=pawel.harlozinski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=patch@alsa-project.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.