aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-05-25 20:30:46 -0400
committerTakashi Iwai <tiwai@suse.de>2017-05-26 02:38:14 -0400
commit2c4842d3b6b3cf6db0f21e487da7e9bd3aa23090 (patch)
tree43a861b3b2041b687ad38927ea79cb87eef76ccc
parent9027c4639ef1e3254779e3033f229133222445f7 (diff)
ALSA: pcm: add local header file for snd-pcm module
Several files are used to construct PCM core module, a.k.a snd-pcm. Although available APIs are described in 'include/sound/pcm.h', some of them are not exported as symbols in kernel space. Such APIs are just for module local usage. This commit adds module local header file and move some function prototypes into it so that scopes of them are controlled properly and developers get no confusion from unavailable symbols. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/pcm.h32
-rw-r--r--sound/core/pcm.c2
-rw-r--r--sound/core/pcm_lib.c2
-rw-r--r--sound/core/pcm_local.h51
-rw-r--r--sound/core/pcm_misc.c3
-rw-r--r--sound/core/pcm_native.c2
6 files changed, 60 insertions, 32 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index c609b891c4c2..79fedf517070 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -969,12 +969,6 @@ static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p
969} 969}
970 970
971int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); 971int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
972void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
973void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
974void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,
975 unsigned int k, struct snd_interval *c);
976void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
977 const struct snd_interval *b, struct snd_interval *c);
978int snd_interval_list(struct snd_interval *i, unsigned int count, 972int snd_interval_list(struct snd_interval *i, unsigned int count,
979 const unsigned int *list, unsigned int mask); 973 const unsigned int *list, unsigned int mask);
980int snd_interval_ranges(struct snd_interval *i, unsigned int count, 974int snd_interval_ranges(struct snd_interval *i, unsigned int count,
@@ -985,15 +979,9 @@ int snd_interval_ratnum(struct snd_interval *i,
985 979
986void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params); 980void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params);
987void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var); 981void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
988int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
989 982
990int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); 983int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
991 984
992int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);
993int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);
994
995int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
996 u_int32_t mask);
997int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, 985int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
998 u_int64_t mask); 986 u_int64_t mask);
999int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, 987int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
@@ -1081,10 +1069,6 @@ void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,
1081void snd_pcm_set_sync(struct snd_pcm_substream *substream); 1069void snd_pcm_set_sync(struct snd_pcm_substream *substream);
1082int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, 1070int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
1083 unsigned int cmd, void *arg); 1071 unsigned int cmd, void *arg);
1084int snd_pcm_update_state(struct snd_pcm_substream *substream,
1085 struct snd_pcm_runtime *runtime);
1086int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
1087void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);
1088void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); 1072void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
1089snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, 1073snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,
1090 const void __user *buf, 1074 const void __user *buf,
@@ -1096,8 +1080,6 @@ snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
1096snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, 1080snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,
1097 void __user **bufs, snd_pcm_uframes_t frames); 1081 void __user **bufs, snd_pcm_uframes_t frames);
1098 1082
1099extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates;
1100
1101int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); 1083int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);
1102unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate); 1084unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate);
1103unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); 1085unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit);
@@ -1131,20 +1113,6 @@ static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substrea
1131 } 1113 }
1132} 1114}
1133 1115
1134/*
1135 * Timer interface
1136 */
1137
1138#ifdef CONFIG_SND_PCM_TIMER
1139void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
1140void snd_pcm_timer_init(struct snd_pcm_substream *substream);
1141void snd_pcm_timer_done(struct snd_pcm_substream *substream);
1142#else
1143static inline void
1144snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) {}
1145static inline void snd_pcm_timer_init(struct snd_pcm_substream *substream) {}
1146static inline void snd_pcm_timer_done(struct snd_pcm_substream *substream) {}
1147#endif
1148/** 1116/**
1149 * snd_pcm_gettime - Fill the timespec depending on the timestamp mode 1117 * snd_pcm_gettime - Fill the timespec depending on the timestamp mode
1150 * @runtime: PCM runtime instance 1118 * @runtime: PCM runtime instance
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index d30dba0ee688..4b3290447398 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -31,6 +31,8 @@
31#include <sound/control.h> 31#include <sound/control.h>
32#include <sound/info.h> 32#include <sound/info.h>
33 33
34#include "pcm_local.h"
35
34MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Abramo Bagnara <abramo@alsa-project.org>"); 36MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Abramo Bagnara <abramo@alsa-project.org>");
35MODULE_DESCRIPTION("Midlevel PCM code for ALSA."); 37MODULE_DESCRIPTION("Midlevel PCM code for ALSA.");
36MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index ab4b1d1e44ee..e50548af4004 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -33,6 +33,8 @@
33#include <sound/pcm_params.h> 33#include <sound/pcm_params.h>
34#include <sound/timer.h> 34#include <sound/timer.h>
35 35
36#include "pcm_local.h"
37
36#ifdef CONFIG_SND_PCM_XRUN_DEBUG 38#ifdef CONFIG_SND_PCM_XRUN_DEBUG
37#define CREATE_TRACE_POINTS 39#define CREATE_TRACE_POINTS
38#include "pcm_trace.h" 40#include "pcm_trace.h"
diff --git a/sound/core/pcm_local.h b/sound/core/pcm_local.h
new file mode 100644
index 000000000000..34c66decaaf2
--- /dev/null
+++ b/sound/core/pcm_local.h
@@ -0,0 +1,51 @@
1/*
2 * pcm_local.h - a local header file for snd-pcm module.
3 *
4 * Copyright (c) Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 *
6 * Licensed under the terms of the GNU General Public License, version 2.
7 */
8
9#ifndef __SOUND_CORE_PCM_LOCAL_H
10#define __SOUND_CORE_PCM_LOCAL_H
11
12extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates;
13
14void snd_interval_mul(const struct snd_interval *a,
15 const struct snd_interval *b, struct snd_interval *c);
16void snd_interval_div(const struct snd_interval *a,
17 const struct snd_interval *b, struct snd_interval *c);
18void snd_interval_muldivk(const struct snd_interval *a,
19 const struct snd_interval *b,
20 unsigned int k, struct snd_interval *c);
21void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
22 const struct snd_interval *b, struct snd_interval *c);
23
24int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);
25int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);
26
27int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream,
28 struct snd_pcm_hw_params *params);
29
30int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime,
31 snd_pcm_hw_param_t var, u_int32_t mask);
32
33int snd_pcm_update_state(struct snd_pcm_substream *substream,
34 struct snd_pcm_runtime *runtime);
35int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
36
37void snd_pcm_playback_silence(struct snd_pcm_substream *substream,
38 snd_pcm_uframes_t new_hw_ptr);
39
40#ifdef CONFIG_SND_PCM_TIMER
41void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
42void snd_pcm_timer_init(struct snd_pcm_substream *substream);
43void snd_pcm_timer_done(struct snd_pcm_substream *substream);
44#else
45static inline void
46snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) {}
47static inline void snd_pcm_timer_init(struct snd_pcm_substream *substream) {}
48static inline void snd_pcm_timer_done(struct snd_pcm_substream *substream) {}
49#endif
50
51#endif /* __SOUND_CORE_PCM_LOCAL_H */
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index 53dc37357bca..dd8383e29315 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -23,6 +23,9 @@
23#include <linux/export.h> 23#include <linux/export.h>
24#include <sound/core.h> 24#include <sound/core.h>
25#include <sound/pcm.h> 25#include <sound/pcm.h>
26
27#include "pcm_local.h"
28
26#define SND_PCM_FORMAT_UNKNOWN (-1) 29#define SND_PCM_FORMAT_UNKNOWN (-1)
27 30
28/* NOTE: "signed" prefix must be given below since the default char is 31/* NOTE: "signed" prefix must be given below since the default char is
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 5be549cf91e5..bf5d0f2acfb9 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -37,6 +37,8 @@
37#include <sound/minors.h> 37#include <sound/minors.h>
38#include <linux/uio.h> 38#include <linux/uio.h>
39 39
40#include "pcm_local.h"
41
40/* 42/*
41 * Compatibility 43 * Compatibility
42 */ 44 */