All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/17] ALSA/ASoC: hda: Address format selection limitations and ambiguity
@ 2023-08-11 16:48 Cezary Rojewski
  2023-08-11 16:48 ` [RFC PATCH 01/17] ALSA: pcm: Introduce MSBITS subformat interface Cezary Rojewski
                   ` (16 more replies)
  0 siblings, 17 replies; 53+ messages in thread
From: Cezary Rojewski @ 2023-08-11 16:48 UTC (permalink / raw)
  To: broonie, tiwai, perex
  Cc: alsa-devel, amadeuszx.slawinski, pierre-louis.bossart, hdegoede,
	Cezary Rojewski

Patchset aims to address format selection restrictions present currently
in the HDAudio library. Formats which we are concerned about are 20 and
24 valid bits per sample within 32 bit depth container. One may identify
them as S20_LE and S24_LE except that those, according to comments found
in include/uapi/sound/asound.h, are for LSB-aligned scenarios. HDAudio
streams expect MSB-aligned data, no matter if we are speaking of HOST
(SDxFMT) or LINK (PPLCxFMT) side - chapter 4.5.1 of the public HDAudio
specification. In short, S20_LE and S24_LE are invalid options.

Right now, given the implementation of snd_hdac_query_supported_pcm() 
within sound/hda/hdac_device.c, even if a codec responds with: "I
support all possible formats specified within HDAudio specification",
there will be no option to open a 20/32 or 24/32 stream. The kernel will
force the stream to be opened using the highest available bit depth.

After discussing subject initially with Jaroslav and Takashi, suggestion
was made to utilize 'subformat' option to address the problem. The
eye-opening discussion begun much earlier though, in 2019 [1].

Paired with PRs for alsa-utils [2] and alsa-lib [3].


Flow of changes:

The very first patch adds MSBITS subformat options to allow for granular
20/32, 24/32 and 32/32 format selection. The next three make sure
subformat is actually honored during runtime. Most of that code is based
on format-related API.

Follow up is upgrade to the hda stream-format interface - several
functions are added to make the granular format selection simple in the
HDAudio world. Core of the implementation is based on the existing
snd_hdac_calc_stream_format(). The next ten patches are straightforward
switch from one interface to another with cleanup of now-unsed function
as a finishing touch.

Last but not least - the avs-driver, on which the problem analyzed and
debugged, is updated to no longer acknowledge S24_LE as a valid format
option.

Note: No testing done on other drivers yet. First results from
snd_hda_intel and snd_soc_skl will be here on Monday. Will trigger SOF
cycle through github PR.


[1]: https://lore.kernel.org/alsa-devel/20190905053302.9262-1-pawel.harlozinski@linux.intel.com/
[2]: https://github.com/alsa-project/alsa-utils/pull/228
[3]: https://github.com/alsa-project/alsa-lib/pull/342

Cezary Rojewski (17):
  ALSA: pcm: Introduce MSBITS subformat interface
  ALSA: pcm: Honor subformat when configuring substream
  ALSA: hda: Honor subformat when querying PCMs
  ASoC: pcm: Honor subformat when configuring runtime
  ALSA: hda: Upgrade stream-format infrastructure
  ALSA: hda: Switch to new stream-format interface
  ALSA: hda/hdmi: Switch to new stream-format interface
  ALSA: hda/ca0132: Switch to new stream-format interface
  ASoC: codecs: hda: Switch to new stream-format interface
  ASoC: codecs: hdac_hda: Switch to new stream-format interface
  ASoC: codecs: hdac_hdmi: Switch to new stream-format interface
  ASoC: Intel Skylake: Switch to new stream-format interface
  ASoC: SOF: Intel: Switch to new stream-format interface
  ASoC: Intel: avs: Switch to new stream-format interface
  ALSA: hda: Drop snd_hdac_calc_stream_format()
  ASoC: Intel: avs: Unhardcode HDAudio BE DAI drivers description
  ASoC: Intel: avs: Kill S24_LE in HDAudio streaming

 include/sound/hda_codec.h         |   5 +-
 include/sound/hdaudio.h           |  12 +--
 include/sound/pcm.h               |   8 ++
 include/sound/pcm_params.h        |   2 +
 include/sound/soc.h               |   1 +
 include/uapi/sound/asound.h       |   5 +-
 sound/core/pcm_lib.c              |  30 ++++++
 sound/core/pcm_misc.c             |  23 +++++
 sound/core/pcm_native.c           |   5 +-
 sound/hda/hdac_device.c           | 153 +++++++++++++++++++++---------
 sound/pci/hda/hda_codec.c         |   2 +
 sound/pci/hda/hda_controller.c    |  10 +-
 sound/pci/hda/patch_ca0132.c      |   3 +-
 sound/pci/hda/patch_hdmi.c        |   6 +-
 sound/soc/codecs/hda-dai.c        |   6 +-
 sound/soc/codecs/hda.c            |   2 +
 sound/soc/codecs/hdac_hda.c       |   8 +-
 sound/soc/codecs/hdac_hdmi.c      |  10 +-
 sound/soc/intel/avs/loader.c      |   4 +-
 sound/soc/intel/avs/path.c        |   2 +-
 sound/soc/intel/avs/pcm.c         |  60 ++++++------
 sound/soc/intel/avs/probes.c      |   3 +-
 sound/soc/intel/avs/topology.c    |   9 +-
 sound/soc/intel/skylake/skl-pcm.c |  11 ++-
 sound/soc/soc-pcm.c               |  17 ++++
 sound/soc/sof/intel/hda-dai-ops.c |   5 +-
 tools/include/uapi/sound/asound.h |   5 +-
 27 files changed, 290 insertions(+), 117 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2023-09-13  8:07 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 16:48 [RFC PATCH 00/17] ALSA/ASoC: hda: Address format selection limitations and ambiguity Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 01/17] ALSA: pcm: Introduce MSBITS subformat interface Cezary Rojewski
2023-08-14 14:35   ` Takashi Iwai
2023-08-14 15:04     ` Cezary Rojewski
2023-08-22 15:03   ` Jaroslav Kysela
2023-08-22 15:07     ` Takashi Iwai
2023-08-22 15:29       ` Jaroslav Kysela
2023-08-22 15:38         ` Takashi Iwai
2023-08-22 19:03           ` Jaroslav Kysela
2023-08-23  8:11             ` Cezary Rojewski
2023-08-23  9:10               ` Jaroslav Kysela
2023-08-23  9:53                 ` Takashi Iwai
2023-08-23 10:00                   ` Jaroslav Kysela
2023-08-23 10:20                     ` Amadeusz Sławiński
2023-08-23 10:47                       ` Jaroslav Kysela
2023-08-23 11:08                         ` Takashi Iwai
2023-08-23 13:42                           ` Jaroslav Kysela
2023-08-23 16:29                             ` Amadeusz Sławiński
2023-08-23 17:42                               ` Kai Vehmanen
2023-08-24  7:31                               ` Jaroslav Kysela
2023-09-08 14:36                                 ` Cezary Rojewski
2023-09-11  7:35                                   ` Jaroslav Kysela
2023-09-11  8:43                                     ` Cezary Rojewski
2023-09-11 15:45                                       ` Cezary Rojewski
2023-09-12 16:30                                         ` Jaroslav Kysela
2023-09-13  7:44                                           ` Cezary Rojewski
2023-09-13  8:06                                             ` Jaroslav Kysela
2023-08-22 15:30       ` Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 02/17] ALSA: pcm: Honor subformat when configuring substream Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 03/17] ALSA: hda: Honor subformat when querying PCMs Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 04/17] ASoC: pcm: Honor subformat when configuring runtime Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 05/17] ALSA: hda: Upgrade stream-format infrastructure Cezary Rojewski
2023-08-14 14:41   ` Takashi Iwai
2023-08-14 14:47     ` Cezary Rojewski
2023-08-14 14:59       ` Takashi Iwai
2023-08-11 16:48 ` [RFC PATCH 06/17] ALSA: hda: Switch to new stream-format interface Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 07/17] ALSA: hda/hdmi: " Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 08/17] ALSA: hda/ca0132: " Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 09/17] ASoC: codecs: hda: " Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 10/17] ASoC: codecs: hdac_hda: " Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 11/17] ASoC: codecs: hdac_hdmi: " Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 12/17] ASoC: Intel Skylake: " Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 13/17] ASoC: SOF: Intel: " Cezary Rojewski
2023-08-11 18:21   ` Pierre-Louis Bossart
2023-08-14 10:51     ` Cezary Rojewski
2023-08-14 14:01       ` Pierre-Louis Bossart
2023-08-14 15:02         ` Cezary Rojewski
2023-08-14 17:02           ` Pierre-Louis Bossart
2023-08-11 16:48 ` [RFC PATCH 14/17] ASoC: Intel: avs: " Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 15/17] ALSA: hda: Drop snd_hdac_calc_stream_format() Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 16/17] ASoC: Intel: avs: Unhardcode HDAudio BE DAI drivers description Cezary Rojewski
2023-08-11 16:48 ` [RFC PATCH 17/17] ASoC: Intel: avs: Kill S24_LE in HDAudio streaming Cezary Rojewski
2023-08-21  7:49   ` Amadeusz Sławiński

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.