diff options
-rw-r--r-- | include/sound/soc-dapm.h | 17 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 72 |
2 files changed, 73 insertions, 16 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 1f30616afe71..bf4cf0c1d37f 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -193,6 +193,7 @@ struct snd_soc_dapm_widget; | |||
193 | enum snd_soc_dapm_type; | 193 | enum snd_soc_dapm_type; |
194 | struct snd_soc_dapm_path; | 194 | struct snd_soc_dapm_path; |
195 | struct snd_soc_dapm_pin; | 195 | struct snd_soc_dapm_pin; |
196 | struct snd_soc_dapm_route; | ||
196 | 197 | ||
197 | /* dapm controls */ | 198 | /* dapm controls */ |
198 | int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | 199 | int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, |
@@ -210,10 +211,12 @@ int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, | |||
210 | int num); | 211 | int num); |
211 | 212 | ||
212 | /* dapm path setup */ | 213 | /* dapm path setup */ |
213 | int snd_soc_dapm_connect_input(struct snd_soc_codec *codec, | 214 | int __deprecated snd_soc_dapm_connect_input(struct snd_soc_codec *codec, |
214 | const char *sink_name, const char *control_name, const char *src_name); | 215 | const char *sink_name, const char *control_name, const char *src_name); |
215 | int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); | 216 | int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); |
216 | void snd_soc_dapm_free(struct snd_soc_device *socdev); | 217 | void snd_soc_dapm_free(struct snd_soc_device *socdev); |
218 | int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, | ||
219 | const struct snd_soc_dapm_route *route, int num); | ||
217 | 220 | ||
218 | /* dapm events */ | 221 | /* dapm events */ |
219 | int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, | 222 | int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, |
@@ -250,6 +253,18 @@ enum snd_soc_dapm_type { | |||
250 | snd_soc_dapm_post, /* machine specific post widget - exec last */ | 253 | snd_soc_dapm_post, /* machine specific post widget - exec last */ |
251 | }; | 254 | }; |
252 | 255 | ||
256 | /* | ||
257 | * DAPM audio route definition. | ||
258 | * | ||
259 | * Defines an audio route originating at source via control and finishing | ||
260 | * at sink. | ||
261 | */ | ||
262 | struct snd_soc_dapm_route { | ||
263 | const char *sink; | ||
264 | const char *control; | ||
265 | const char *source; | ||
266 | }; | ||
267 | |||
253 | /* dapm audio path between two widgets */ | 268 | /* dapm audio path between two widgets */ |
254 | struct snd_soc_dapm_path { | 269 | struct snd_soc_dapm_path { |
255 | char *name; | 270 | char *name; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 811d65271012..1ef6d94b8357 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -841,21 +841,8 @@ int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec) | |||
841 | } | 841 | } |
842 | EXPORT_SYMBOL_GPL(snd_soc_dapm_sync_endpoints); | 842 | EXPORT_SYMBOL_GPL(snd_soc_dapm_sync_endpoints); |
843 | 843 | ||
844 | /** | 844 | static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, |
845 | * snd_soc_dapm_connect_input - connect dapm widgets | 845 | const char *sink, const char *control, const char *source) |
846 | * @codec: audio codec | ||
847 | * @sink: name of target widget | ||
848 | * @control: mixer control name | ||
849 | * @source: name of source name | ||
850 | * | ||
851 | * Connects 2 dapm widgets together via a named audio path. The sink is | ||
852 | * the widget receiving the audio signal, whilst the source is the sender | ||
853 | * of the audio signal. | ||
854 | * | ||
855 | * Returns 0 for success else error. | ||
856 | */ | ||
857 | int snd_soc_dapm_connect_input(struct snd_soc_codec *codec, const char *sink, | ||
858 | const char * control, const char *source) | ||
859 | { | 846 | { |
860 | struct snd_soc_dapm_path *path; | 847 | struct snd_soc_dapm_path *path; |
861 | struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; | 848 | struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; |
@@ -957,9 +944,64 @@ err: | |||
957 | kfree(path); | 944 | kfree(path); |
958 | return ret; | 945 | return ret; |
959 | } | 946 | } |
947 | |||
948 | /** | ||
949 | * snd_soc_dapm_connect_input - connect dapm widgets | ||
950 | * @codec: audio codec | ||
951 | * @sink: name of target widget | ||
952 | * @control: mixer control name | ||
953 | * @source: name of source name | ||
954 | * | ||
955 | * Connects 2 dapm widgets together via a named audio path. The sink is | ||
956 | * the widget receiving the audio signal, whilst the source is the sender | ||
957 | * of the audio signal. | ||
958 | * | ||
959 | * This function has been deprecated in favour of snd_soc_dapm_add_routes(). | ||
960 | * | ||
961 | * Returns 0 for success else error. | ||
962 | */ | ||
963 | int snd_soc_dapm_connect_input(struct snd_soc_codec *codec, const char *sink, | ||
964 | const char *control, const char *source) | ||
965 | { | ||
966 | return snd_soc_dapm_add_route(codec, sink, control, source); | ||
967 | } | ||
960 | EXPORT_SYMBOL_GPL(snd_soc_dapm_connect_input); | 968 | EXPORT_SYMBOL_GPL(snd_soc_dapm_connect_input); |
961 | 969 | ||
962 | /** | 970 | /** |
971 | * snd_soc_dapm_add_routes - Add routes between DAPM widgets | ||
972 | * @codec: codec | ||
973 | * @route: audio routes | ||
974 | * @num: number of routes | ||
975 | * | ||
976 | * Connects 2 dapm widgets together via a named audio path. The sink is | ||
977 | * the widget receiving the audio signal, whilst the source is the sender | ||
978 | * of the audio signal. | ||
979 | * | ||
980 | * Returns 0 for success else error. On error all resources can be freed | ||
981 | * with a call to snd_soc_card_free(). | ||
982 | */ | ||
983 | int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, | ||
984 | const struct snd_soc_dapm_route *route, int num) | ||
985 | { | ||
986 | int i, ret; | ||
987 | |||
988 | for (i = 0; i < num; i++) { | ||
989 | ret = snd_soc_dapm_add_route(codec, route->sink, | ||
990 | route->control, route->source); | ||
991 | if (ret < 0) { | ||
992 | printk(KERN_ERR "Failed to add route %s->%s\n", | ||
993 | route->source, | ||
994 | route->sink); | ||
995 | return ret; | ||
996 | } | ||
997 | route++; | ||
998 | } | ||
999 | |||
1000 | return 0; | ||
1001 | } | ||
1002 | EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes); | ||
1003 | |||
1004 | /** | ||
963 | * snd_soc_dapm_new_widgets - add new dapm widgets | 1005 | * snd_soc_dapm_new_widgets - add new dapm widgets |
964 | * @codec: audio codec | 1006 | * @codec: audio codec |
965 | * | 1007 | * |