Skip to contentSkip to conversation

ALSA: Add params_width() helpers

PATCH In review Mark Brown 2 participants 2 messages Dec 24, 2013 Sound

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ALSA: Add params_width() helpers

From: Mark Brown <[email protected]>

Add helpers for obtaining the width of a format directly from params since this is expected to become a common operation in ASoC.

---
 include/sound/pcm_params.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/sound/pcm_params.h +12 -0
index 37ae12e..6b1c78f 100644
@@ -354,4 +354,16 @@ params_period_bytes(const struct snd_pcm_hw_params *p)
 		params_channels(p)) / 8;
 }
 
+static inline int
+params_width(const struct snd_pcm_hw_params *p)
+{
+	return snd_pcm_format_width(params_format(p));
+}
+
+static inline int
+params_physical_width(const struct snd_pcm_hw_params *p)
+{
+	return snd_pcm_format_physical_width(params_format(p));
+}
+
 #endif /* __SOUND_PCM_PARAMS_H */
Signature · 1 line
1.8.5.2
Reviewed-by on v1 1/1
#1 lore raw

At Tue, 24 Dec 2013 12:24:28 +0000,

Quoted 7 lines · Mark Brown

From: Mark Brown <[email protected]>

Add helpers for obtaining the width of a format directly from params since this is expected to become a common operation in ASoC.

Looks good. Since you seem to have already codes using these helpers, feel free to take it via your tree with my ack, then I'll pull yours later.

thanks,

Takashi

Quoted 28 lines
---
 include/sound/pcm_params.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/sound/pcm_params.h +12 -0
index 37ae12e..6b1c78f 100644
@@ -354,4 +354,16 @@ params_period_bytes(const struct snd_pcm_hw_params *p)
 		params_channels(p)) / 8;
 }
 
+static inline int
+params_width(const struct snd_pcm_hw_params *p)
+{
+	return snd_pcm_format_width(params_format(p));
+}
+
+static inline int
+params_physical_width(const struct snd_pcm_hw_params *p)
+{
+	return snd_pcm_format_physical_width(params_format(p));
+}
+
 #endif /* __SOUND_PCM_PARAMS_H */
Signature · 1 line
1.8.5.2