aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/asound.h12
-rw-r--r--include/sound/pcm.h32
2 files changed, 20 insertions, 24 deletions
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 0309da2f11d3..3eaf155b850d 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -302,8 +302,6 @@ typedef int __bitwise snd_pcm_hw_param_t;
302#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */ 302#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */
303#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS 303#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
304#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT 304#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
305#define SNDRV_PCM_HW_PARAM_MASK_INDEX(var) \
306 ((__force int)(var) - (__force int)SNDRV_PCM_HW_PARAM_FIRST_MASK)
307 305
308#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */ 306#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */
309#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */ 307#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */
@@ -319,8 +317,6 @@ typedef int __bitwise snd_pcm_hw_param_t;
319#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */ 317#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */
320#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS 318#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
321#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME 319#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
322#define SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var) \
323 ((__force int)(var) - (__force int)SNDRV_PCM_HW_PARAM_FIRST_INTERVAL)
324 320
325#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ 321#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
326 322
@@ -340,11 +336,11 @@ struct snd_mask {
340 336
341struct snd_pcm_hw_params { 337struct snd_pcm_hw_params {
342 unsigned int flags; 338 unsigned int flags;
343 struct snd_mask masks[ 339 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
344 SNDRV_PCM_HW_PARAM_MASK_INDEX(SNDRV_PCM_HW_PARAM_LAST_MASK) + 1]; 340 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
345 struct snd_mask mres[5]; /* reserved masks */ 341 struct snd_mask mres[5]; /* reserved masks */
346 struct snd_interval intervals[ 342 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
347 SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(SNDRV_PCM_HW_PARAM_LAST_INTERVAL) + 1]; 343 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
348 struct snd_interval ires[9]; /* reserved intervals */ 344 struct snd_interval ires[9]; /* reserved intervals */
349 unsigned int rmask; /* W: requested masks */ 345 unsigned int rmask; /* W: requested masks */
350 unsigned int cmask; /* R: changed masks */ 346 unsigned int cmask; /* R: changed masks */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 5315b53f9b07..51d58ccda2d8 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -209,10 +209,10 @@ struct snd_pcm_hw_rule {
209}; 209};
210 210
211struct snd_pcm_hw_constraints { 211struct snd_pcm_hw_constraints {
212 struct snd_mask masks[ 212 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
213 SNDRV_PCM_HW_PARAM_MASK_INDEX(SNDRV_PCM_HW_PARAM_LAST_MASK) + 1]; 213 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
214 struct snd_interval intervals[ 214 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
215 SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(SNDRV_PCM_HW_PARAM_LAST_INTERVAL) + 1]; 215 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
216 unsigned int rules_num; 216 unsigned int rules_num;
217 unsigned int rules_all; 217 unsigned int rules_all;
218 struct snd_pcm_hw_rule *rules; 218 struct snd_pcm_hw_rule *rules;
@@ -221,13 +221,13 @@ struct snd_pcm_hw_constraints {
221static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs, 221static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs,
222 snd_pcm_hw_param_t var) 222 snd_pcm_hw_param_t var)
223{ 223{
224 return &constrs->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)]; 224 return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
225} 225}
226 226
227static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs, 227static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs,
228 snd_pcm_hw_param_t var) 228 snd_pcm_hw_param_t var)
229{ 229{
230 return &constrs->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)]; 230 return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
231} 231}
232 232
233struct snd_ratnum { 233struct snd_ratnum {
@@ -761,40 +761,40 @@ static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
761 substream->runtime->trigger_master = master; 761 substream->runtime->trigger_master = master;
762} 762}
763 763
764static inline int hw_is_mask(snd_pcm_hw_param_t var) 764static inline int hw_is_mask(int var)
765{ 765{
766 return (__force int)var >= (__force int)SNDRV_PCM_HW_PARAM_FIRST_MASK && 766 return var >= SNDRV_PCM_HW_PARAM_FIRST_MASK &&
767 (__force int)var <= (__force int)SNDRV_PCM_HW_PARAM_LAST_MASK; 767 var <= SNDRV_PCM_HW_PARAM_LAST_MASK;
768} 768}
769 769
770static inline int hw_is_interval(snd_pcm_hw_param_t var) 770static inline int hw_is_interval(int var)
771{ 771{
772 return (__force int)var >= (__force int)SNDRV_PCM_HW_PARAM_FIRST_INTERVAL && 772 return var >= SNDRV_PCM_HW_PARAM_FIRST_INTERVAL &&
773 (__force int)var <= (__force int)SNDRV_PCM_HW_PARAM_LAST_INTERVAL; 773 var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
774} 774}
775 775
776static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params, 776static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,
777 snd_pcm_hw_param_t var) 777 snd_pcm_hw_param_t var)
778{ 778{
779 return &params->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)]; 779 return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
780} 780}
781 781
782static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params, 782static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,
783 snd_pcm_hw_param_t var) 783 snd_pcm_hw_param_t var)
784{ 784{
785 return &params->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)]; 785 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
786} 786}
787 787
788static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params, 788static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,
789 snd_pcm_hw_param_t var) 789 snd_pcm_hw_param_t var)
790{ 790{
791 return &params->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)]; 791 return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
792} 792}
793 793
794static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params, 794static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,
795 snd_pcm_hw_param_t var) 795 snd_pcm_hw_param_t var)
796{ 796{
797 return &params->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)]; 797 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
798} 798}
799 799
800#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) 800#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))