All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Jaroslav Kysela <perex@perex.cz>
Cc: broonie@kernel.org, tiwai@suse.com, alsa-devel@alsa-project.org,
	pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Takashi Iwai" <tiwai@suse.de>
Subject: Re: [RFC PATCH 01/17] ALSA: pcm: Introduce MSBITS subformat interface
Date: Mon, 11 Sep 2023 17:45:39 +0200	[thread overview]
Message-ID: <8d76a1d8-e85c-b699-34a0-ecea6edc2fe1@intel.com> (raw)
In-Reply-To: <cd163597-a15f-a52e-fb24-529f8e855171@intel.com>

On 2023-09-11 10:43 AM, Cezary Rojewski wrote:
> On 2023-09-11 9:35 AM, Jaroslav Kysela wrote:
>> On 08. 09. 23 16:36, Cezary Rojewski wrote:

...

>>> After reading all of this again, I'm fine with rewording MSBITS_32 to
>>> MSBITS_MAX.
>>>
>>> As I do not see any other points to address here and review of v1 has no
>>> points to address either, I'll send v2 with this single change. If I'd
>>> missed anything, let me know.
>>
>> The subformat bitmask should be also refined/updated depending on the 
>> selected format.
>>
>> https://lore.kernel.org/alsa-devel/f97bbbd5-1397-f5d3-5ccf-420ec813deac@perex.cz/
>>
>> It requires new code in pcm_lib.c and ASoC PCM core code.
> 
> Could you help me understand what new code is needed? The 
> get_subformat() example raised more questions than answers. The patchset 
> defines snd_pcm_subformat_width(), perhaps you meant that I should 
> update that function by adding paramter 'format' to its parameters list 
> and handle it accordingly?
> 
> Any guidance would be much appreciated.

What I come up with is a hw_rule for subformat that I add in 
snd_pcm_hw_constraints_init(). That piece, plus both STD and MSBITS_MAX 
ORed into hw->subformats in snd_pcm_hw_constraints_complete() make 
things spin.

static int snd_pcm_hw_rule_subformat(struct snd_pcm_hw_params *params,
				     struct snd_pcm_hw_rule *rule)
{
	struct snd_mask *subformat_mask = hw_param_mask(params, 
SNDRV_PCM_HW_PARAM_SUBFORMAT);
	struct snd_mask *format_mask = hw_param_mask(params, 
SNDRV_PCM_HW_PARAM_FORMAT);
	snd_pcm_format_t f;
	struct snd_mask m;
	int width;

	snd_mask_none(&m);
	snd_mask_set(&m, SNDRV_PCM_SUBFORMAT_STD);
	snd_mask_set(&m, SNDRV_PCM_SUBFORMAT_MSBITS_MAX);

	pcm_for_each_format(f) {
		if (!snd_mask_test_format(format_mask, f))
			continue;

		width = snd_pcm_format_width(f);
		switch (width) {
		case 32:
			snd_mask_set(&m, SNDRV_PCM_SUBFORMAT_MSBITS_20);
			snd_mask_set(&m, SNDRV_PCM_SUBFORMAT_MSBITS_24);
			break;
		default:
			break;
		}
	}

	return snd_mask_refine(subformat_mask, &m);
}


However, this means snd_hdac_query_supported_pcm() becomes confusing as 
you need to MSBITS_MAX regardless of what the codec supports.
After spending additional few hours on this, I'd say I preferred how 
things look with MSBITS_32 instead. STD and MSBITS_MAX existing 
simultaneously is confusing too.

Czarek

  reply	other threads:[~2023-09-11 15:48 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=8d76a1d8-e85c-b699-34a0-ecea6edc2fe1@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.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.