Re: [PATCH v2 02/17] ALSA: pcm: Honor subformat when configuring substream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18. 09. 23 15:39, Cezary Rojewski wrote:
Substream value is currently hardcoded to SNDRV_PCM_SUBFORMAT_STD.
Update the constraint procedure so that subformat selection is not
ignored. Case STD is always supported as most PCMs do not care about
subformat.

Suggested-by: Jaroslav Kysela <perex@xxxxxxxx>

Better Co-developed mark. Also I would move whole code to the first patch. It does not make sense to split the mandatory code.

Another option is to increase the protocol version to the separate patch where all necessary code changes are applied (for MSBITS_MAX). But it may break backports, so the change should be aligned with the SUBFMT defines.

+	struct snd_mask *sfmask;

m_rw -> sfmask renaming. I prefer universal name to allow easy reuse in future.

+		for (sf = hw->subformats; sf->mask && !found; sf++) {

My proposal [1] defined SNDRV_PCM_FORMAT_CONSTRAINT_END value not relying to zero format (which is U8) and zero subformat to skip the MSBIT_MAX setting bellow. After some thought, if the driver sets SNDRV_PCM_SUBFORMAT_MSBITS_STD, the result will be similar, thus the mask can be zero and the code may be reduced. So no objection for this change.

+		if (!found && snd_pcm_format_linear(f))
+			snd_mask_set(&m, (__force unsigned)SNDRV_PCM_SUBFORMAT_MSBITS_MAX);
+	}
+exit:
+	return snd_mask_refine(sfmask, &m);
+}
+
+static int snd_pcm_hw_constraint_subformats(struct snd_pcm_runtime *runtime,
+					   unsigned int cond,
+					   struct snd_pcm_hardware *hw)
+{

Because your change does not assume that this constraint is called from the drivers, the comments and EXPORT_SYMBOL() lines were removed from the original proposal [1]. I believe that the standalone constraint is better at this time - reduce code, the use of the subformat extension is not mandatory.

							Jaroslav

[1] https://lore.kernel.org/alsa-devel/20230912162526.7138-1-perex@xxxxxxxx/
    https://lore.kernel.org/alsa-devel/20230913103716.67315-1-perex@xxxxxxxx/

--
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux