summaryrefslogtreecommitdiff
path: root/include/sound/pcm_params.h
AgeCommit message (Collapse)Author
2023-11-27ALSA: hda: Upgrade stream-format infrastructureCezary Rojewski
Introduce a set of functions that ultimately facilite SDxFMT-related calculations in atomic manner: First, introduce snd_pcm_subformat_width() and snd_pcm_hw_params_bits() helpers that separate the base functionality from the HDAudio-specific one. snd_hdac_format_normalize() - format converter. S20_LE, S24_LE and their unsigned and BE friends are invalid from HDAudio perspective but still can be specified as function argument due to compatibility reasons. snd_hdac_stream_format_bits() - obtain just the bits-per-sample value. Does not ignore subformat and msbits parameters. snd_hdac_stream_format() and snd_hdac_spdif_stream_format() - obtain the SDxFMT value given the audio format parameters. The former is stripped away of spdif-related information. Useful for users that do not care about them. Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Acked-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20231117120610.1755254-5-cezary.rojewski@intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-09ALSA: pcm: Remove unused inline function snd_mask_sizeofYueHaibing
There is no caller in tree, so can remove it. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20200909135744.33464-1-yuehaibing@huawei.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-02-10ALSA: pcm: More helper macros for reducing snd_pcm_format_t castTakashi Iwai
snd_pcm_format_t is a strong-typed integer and requires the explicit cast with __force if converted or compared with a normal integer value. Since most of use cases do iterate over all formats and test / set the mask, provide a couple of new helper macros that do the explicit cast. Link: https://lore.kernel.org/r/20200206163945.6797-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-29ALSA: pcm: Fix interval evaluation with openmin/maxTakashi Iwai
As addressed in alsa-lib (commit b420056604f0), we need to fix the case where the evaluation of PCM interval "(x x+1]" leading to -EINVAL. After applying rules, such an interval may be translated as "(x x+1)". Fixes: ff2d6acdf6f1 ("ALSA: pcm: Fix snd_interval_refine first/last with open min/max") Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-26ALSA: pcm: Add snd_mask_set_format() helper for standard usagesTakashi Iwai
Many drivers calling snd_mask_set() need to do ugly cast with __force for shutting up the sparse warnings. Actually almost all of them are about setting the format, so it's far better to provide a common helper snd_mask_set_format() to pass SNDRV_PCM_FORMAT_* directly without the cast. There are a few other calls of snd_mask_set(), but they are in the PCM core code, so we leave them for now. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-24ALSA: Add params_set_format helperFang, Yang A
Add a helper to set pcm format directly from params Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-30ALSA: pcm: Replace custom ld2 function with __flsLars-Peter Clausen
__fls has the same semantics as ld2, so there is no need to re-implement it. Furthermore a lot of architectures have custom implementations of __fls that are able to use special hardware instructions to compute the result. This makes the code slightly shorter and faster. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-30ALSA: pcm: Use __ffs() instead of ffs() in snd_mask_min()Lars-Peter Clausen
The difference between __ffs and ffs is that ffs will return a one based index whereas __ffs will return a zero based index. Furthermore ffs will check if the passed value is zero and return zero in that case, whereas __ffs behavior is undefined if the passed parameter is 0. Since we already check if the mask is 0 before calling ffs and also subtract 1 from the result __ffs is the better choice. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-30ALSA: pcm: Simplify params_period_bytes()Lars-Peter Clausen
The hw_params struct has a parameter that contains the period size in bytes. This can be used instead of deriving the value from other parameters. This is similar to e.g. params_buffer_bytes() Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-30ALSA: pcm: Add kernel doc for params_*() functionsLars-Peter Clausen
Add kernel doc for the remaining undocumented params_*() functions. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-30ALSA: pcm: Convert params_* mask helpers to static inline functionsLars-Peter Clausen
Use static inline functions instead of macros for the remaining params_*() helpers that have not been converted yet. This is slightly cleaner and offers better type safety. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-30ALSA: pcm_params: Remove unused add/sub functionsLars-Peter Clausen
Those two functions are not used anywhere and also their name is a bit to generic to be in a global header, so remove them. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-12-30ALSA: Add params_width() helpersMark Brown
Add helpers for obtaining the width of a format directly from params since this is expected to become a common operation in ASoC. Signed-off-by: Mark Brown <broonie@linaro.org> Reviewed-by: Takashi Iwai <tiwai@suse.de>
2012-06-20ALSA: Add missing include of pcm.h to pcm_params.hMark Brown
There's a dependency but no #include. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-26ALSA: Make pcm.h self-containedTakashi Iwai
Move the macros depending on snd_mask_min() and co out of pcm.h into pcm_params.h. Otherwise using some params_*() macros will give comiple errors without inclusion of pcm_params.h. Also use hw_param_interval_c() and hw_param_mask_c() for const pointer. Reported-by: Tim Blechmann <tim@klingt.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-06-22[ALSA] Move OSS-specific hw_params helper to snd-pcm-oss moduleTakashi Iwai
Move EXPORT_SYMBOL()s to places adjacent to functions/variables. Also move OSS-specific hw_params helper functions to pcm_oss.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-06-22[ALSA] Clean up ugly hacks in pcm_params.hTakashi Iwai
Clean up ugly hacks for sync with alsa-lib in pcm_params.h. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2006-01-03[ALSA] Remove xxx_t typedefs: PCMTakashi Iwai
Modules: PCM Midlevel Remove xxx_t typedefs from the core PCM codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-04-16Linux-2.6.12-rc2Linus Torvalds
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!