From c219c80929ca942c38334aad38b7582aed4e038e Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 20 Jul 2011 19:42:20 +0100 Subject: ASoC: dapm - add DAPM macro for external enum widgets Add a convenience macro for external enumerated widgets. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- include/sound/soc-dapm.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/sound') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index e09505c5a49..e0583b7769c 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -266,6 +266,12 @@ .get = snd_soc_dapm_get_enum_virt, \ .put = snd_soc_dapm_put_enum_virt, \ .private_value = (unsigned long)&xenum } +#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .info = snd_soc_info_enum_double, \ + .get = xget, \ + .put = xput, \ + .private_value = (unsigned long)&xenum } #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = snd_soc_info_enum_double, \ -- cgit v1.2.2 From acb03d440b8a723181e1d45e3517e43cb0792f8a Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Sat, 23 Jul 2011 12:36:25 +1200 Subject: ALSA: Make snd_pcm_debug_name usable outside pcm_lib Formatting a PCM name is useful for module debug too. Add snd_prefix when making function public. [minor coding-style fixes by tiwai] Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- include/sound/pcm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/sound') diff --git a/include/sound/pcm.h b/include/sound/pcm.h index e1bad113061..ccf3a6e14f9 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -507,6 +507,18 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream); void snd_pcm_vma_notify_data(void *client, void *data); int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); + +#ifdef CONFIG_SND_DEBUG +void snd_pcm_debug_name(struct snd_pcm_substream *substream, + char *name, size_t len); +#else +static inline void +snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) +{ + *buf = 0; +} +#endif + /* * PCM library */ -- cgit v1.2.2 From b51beb756aaf0770e4fa8bb2cb142888051aa356 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 26 Jul 2011 12:02:56 +0200 Subject: ALSA: Make pcm.h self-contained 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 Signed-off-by: Takashi Iwai --- include/sound/pcm.h | 23 ++++++++++++----------- include/sound/pcm_params.h | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 12 deletions(-) (limited to 'include/sound') diff --git a/include/sound/pcm.h b/include/sound/pcm.h index ccf3a6e14f9..57e71fa33f7 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -761,17 +761,18 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; } -#define params_access(p) ((__force snd_pcm_access_t)snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))) -#define params_format(p) ((__force snd_pcm_format_t)snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT))) -#define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) -#define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min -#define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min -#define params_period_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min -#define params_period_bytes(p) ((params_period_size(p)*snd_pcm_format_physical_width(params_format(p))*params_channels(p))/8) -#define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min -#define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min -#define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min - +#define params_channels(p) \ + (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min) +#define params_rate(p) \ + (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_RATE)->min) +#define params_period_size(p) \ + (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min) +#define params_periods(p) \ + (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_PERIODS)->min) +#define params_buffer_size(p) \ + (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min) +#define params_buffer_bytes(p) \ + (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min) int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 85cf1cf4f31..f494f1e3c90 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -337,5 +337,19 @@ static inline unsigned int sub(unsigned int a, unsigned int b) return 0; } -#endif /* __SOUND_PCM_PARAMS_H */ +#define params_access(p) ((__force snd_pcm_access_t)\ + snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_ACCESS))) +#define params_format(p) ((__force snd_pcm_format_t)\ + snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_FORMAT))) +#define params_subformat(p) \ + snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) +static inline unsigned int +params_period_bytes(const struct snd_pcm_hw_params *p) +{ + return (params_period_size(p) * + snd_pcm_format_physical_width(params_format(p)) * + params_channels(p)) / 8; +} + +#endif /* __SOUND_PCM_PARAMS_H */ -- cgit v1.2.2