[alsa-devel] [PATCH 01/10] ASoC: build fix for snd_soc_info_bool_ext
From: Philipp Zabel philipp.zabel@gmail.com
I suspect that snd_ctl_boolean_mono should have been snd_ctl_boolean_mono_info instead. This fixes the build for magician.
Signed-off-by: Philipp Zabel philipp.zabel@gmail.com Signed-off-by: Liam Girdwood lg@opensource.wolfsonmicro.com --- include/sound/soc.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index e6ea6f7..d3c8c03 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -238,7 +238,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); -#define snd_soc_info_bool_ext snd_ctl_boolean_mono +#define snd_soc_info_bool_ext snd_ctl_boolean_mono_info int snd_soc_get_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
Most SoC drivers cut'n'paste a loop iterating over an array to register their DAPM controls. Provide a function they can call instead.
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Graeme Gregory graeme@openmoko.org Cc: Frank Mandarino fmandarino@endrelia.com Cc: Jarkko Nikula jarkko.nikula@nokia.com Cc: Richard Purdie rpurdie@rpsys.net --- include/sound/soc-dapm.h | 3 +++ sound/soc/soc-dapm.c | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 40cc695..1f30616 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -205,6 +205,9 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); int snd_soc_dapm_new_control(struct snd_soc_codec *codec, const struct snd_soc_dapm_widget *widget); +int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, + const struct snd_soc_dapm_widget *widget, + int num);
/* dapm path setup */ int snd_soc_dapm_connect_input(struct snd_soc_codec *codec, diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c60200c..811d652 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1234,6 +1234,33 @@ int snd_soc_dapm_new_control(struct snd_soc_codec *codec, EXPORT_SYMBOL_GPL(snd_soc_dapm_new_control);
/** + * snd_soc_dapm_new_controls - create new dapm controls + * @codec: audio codec + * @widget: widget array + * @num: number of widgets + * + * Creates new DAPM controls based upon the templates. + * + * Returns 0 for success else error. + */ +int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, + const struct snd_soc_dapm_widget *widget, + int num) +{ + int i, ret; + + for (i = 0; i < num; i++) { + ret = snd_soc_dapm_new_control(codec, widget); + if (ret < 0) + return ret; + widget++; + } + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls); + + +/** * snd_soc_dapm_stream_event - send a stream event to the dapm core * @codec: audio codec * @stream: stream name
ASoC codecs and machine drivers that use DAPM routes all cut'n'paste a loop iterating over a null terminated array of routes. Factor out this into a bulk registration function, improving the error reporting for most users, and deprecate the old API to help out of tree users pick up the changes.
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Graeme Gregory graeme@openmoko.org Cc: Frank Mandarino fmandarino@endrelia.com Cc: Jarkko Nikula jarkko.nikula@nokia.com Cc: Richard Purdie rpurdie@rpsys.net --- include/sound/soc-dapm.h | 17 ++++++++++- 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 1f30616..bf4cf0c 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -193,6 +193,7 @@ struct snd_soc_dapm_widget; enum snd_soc_dapm_type; struct snd_soc_dapm_path; struct snd_soc_dapm_pin; +struct snd_soc_dapm_route;
/* dapm controls */ 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, int num);
/* dapm path setup */ -int snd_soc_dapm_connect_input(struct snd_soc_codec *codec, +int __deprecated snd_soc_dapm_connect_input(struct snd_soc_codec *codec, const char *sink_name, const char *control_name, const char *src_name); int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); void snd_soc_dapm_free(struct snd_soc_device *socdev); +int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, + const struct snd_soc_dapm_route *route, int num);
/* dapm events */ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, @@ -250,6 +253,18 @@ enum snd_soc_dapm_type { snd_soc_dapm_post, /* machine specific post widget - exec last */ };
+/* + * DAPM audio route definition. + * + * Defines an audio route originating at source via control and finishing + * at sink. + */ +struct snd_soc_dapm_route { + const char *sink; + const char *control; + const char *source; +}; + /* dapm audio path between two widgets */ struct snd_soc_dapm_path { char *name; diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 811d652..1ef6d94 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) } EXPORT_SYMBOL_GPL(snd_soc_dapm_sync_endpoints);
-/** - * snd_soc_dapm_connect_input - connect dapm widgets - * @codec: audio codec - * @sink: name of target widget - * @control: mixer control name - * @source: name of source name - * - * Connects 2 dapm widgets together via a named audio path. The sink is - * the widget receiving the audio signal, whilst the source is the sender - * of the audio signal. - * - * Returns 0 for success else error. - */ -int snd_soc_dapm_connect_input(struct snd_soc_codec *codec, const char *sink, - const char * control, const char *source) +static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, + const char *sink, const char *control, const char *source) { struct snd_soc_dapm_path *path; struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; @@ -957,9 +944,64 @@ err: kfree(path); return ret; } + +/** + * snd_soc_dapm_connect_input - connect dapm widgets + * @codec: audio codec + * @sink: name of target widget + * @control: mixer control name + * @source: name of source name + * + * Connects 2 dapm widgets together via a named audio path. The sink is + * the widget receiving the audio signal, whilst the source is the sender + * of the audio signal. + * + * This function has been deprecated in favour of snd_soc_dapm_add_routes(). + * + * Returns 0 for success else error. + */ +int snd_soc_dapm_connect_input(struct snd_soc_codec *codec, const char *sink, + const char *control, const char *source) +{ + return snd_soc_dapm_add_route(codec, sink, control, source); +} EXPORT_SYMBOL_GPL(snd_soc_dapm_connect_input);
/** + * snd_soc_dapm_add_routes - Add routes between DAPM widgets + * @codec: codec + * @route: audio routes + * @num: number of routes + * + * Connects 2 dapm widgets together via a named audio path. The sink is + * the widget receiving the audio signal, whilst the source is the sender + * of the audio signal. + * + * Returns 0 for success else error. On error all resources can be freed + * with a call to snd_soc_card_free(). + */ +int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, + const struct snd_soc_dapm_route *route, int num) +{ + int i, ret; + + for (i = 0; i < num; i++) { + ret = snd_soc_dapm_add_route(codec, route->sink, + route->control, route->source); + if (ret < 0) { + printk(KERN_ERR "Failed to add route %s->%s\n", + route->source, + route->sink); + return ret; + } + route++; + } + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes); + +/** * snd_soc_dapm_new_widgets - add new dapm widgets * @codec: audio codec *
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com --- sound/soc/codecs/wm8731.c | 16 ++++------------ sound/soc/codecs/wm8750.c | 16 ++++------------ sound/soc/codecs/wm8753.c | 17 ++++------------- sound/soc/codecs/wm9712.c | 17 ++++------------- sound/soc/codecs/wm9713.c | 15 ++++----------- 5 files changed, 20 insertions(+), 61 deletions(-)
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 0cf9265..006923b 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -193,7 +193,7 @@ SND_SOC_DAPM_INPUT("RLINEIN"), SND_SOC_DAPM_INPUT("LLINEIN"), };
-static const char *intercon[][3] = { +static const struct snd_soc_dapm_route intercon[] = { /* output mixer */ {"Output Mixer", "Line Bypass Switch", "Line Input"}, {"Output Mixer", "HiFi Playback Switch", "DAC"}, @@ -214,22 +214,14 @@ static const char *intercon[][3] = { {"Line Input", NULL, "LLINEIN"}, {"Line Input", NULL, "RLINEIN"}, {"Mic Bias", NULL, "MICIN"}, - - /* terminator */ - {NULL, NULL, NULL}, };
static int wm8731_add_widgets(struct snd_soc_codec *codec) { - int i; - - for (i = 0; i < ARRAY_SIZE(wm8731_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &wm8731_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, + ARRAY_SIZE(wm8731_dapm_widgets));
- /* set up audio path interconnects */ - for (i = 0; intercon[i][0] != NULL; i++) - snd_soc_dapm_connect_input(codec, intercon[i][0], - intercon[i][1], intercon[i][2]); + snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon));
snd_soc_dapm_new_widgets(codec); return 0; diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index 16cd5d4..9c7b0e8 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -378,7 +378,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { SND_SOC_DAPM_INPUT("RINPUT3"), };
-static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route audio_map[] = { /* left mixer */ {"Left Mixer", "Playback Switch", "Left DAC"}, {"Left Mixer", "Left Bypass Switch", "Left Line Mux"}, @@ -470,22 +470,14 @@ static const char *audio_map[][3] = { /* ADC */ {"Left ADC", NULL, "Left ADC Mux"}, {"Right ADC", NULL, "Right ADC Mux"}, - - /* terminator */ - {NULL, NULL, NULL}, };
static int wm8750_add_widgets(struct snd_soc_codec *codec) { - int i; - - for (i = 0; i < ARRAY_SIZE(wm8750_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &wm8750_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, + ARRAY_SIZE(wm8750_dapm_widgets));
- /* set up audio path audio_mapnects */ - for (i = 0; audio_map[i][0] != NULL; i++) - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_new_widgets(codec); return 0; diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index fb41826..2bc49ab 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -523,7 +523,7 @@ SND_SOC_DAPM_INPUT("MIC2"), SND_SOC_DAPM_VMID("VREF"), };
-static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route audio_map[] = { /* left mixer */ {"Left Mixer", "Left Playback Switch", "Left DAC"}, {"Left Mixer", "Voice Playback Switch", "Voice DAC"}, @@ -674,23 +674,14 @@ static const char *audio_map[][3] = {
/* ACOP */ {"ACOP", NULL, "ALC Mixer"}, - - /* terminator */ - {NULL, NULL, NULL}, };
static int wm8753_add_widgets(struct snd_soc_codec *codec) { - int i; + snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, + ARRAY_SIZE(wm8753_dapm_widgets));
- for (i = 0; i < ARRAY_SIZE(wm8753_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &wm8753_dapm_widgets[i]); - - /* set up the WM8753 audio map */ - for (i = 0; audio_map[i][0] != NULL; i++) { - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); - } + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_new_widgets(codec); return 0; diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index d2d79e1..d205e6c 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -350,7 +350,7 @@ SND_SOC_DAPM_INPUT("MIC1"), SND_SOC_DAPM_INPUT("MIC2"), };
-static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route audio_map[] = { /* virtual mixer - mixes left & right channels for spk and mono */ {"AC97 Mixer", NULL, "Left DAC"}, {"AC97 Mixer", NULL, "Right DAC"}, @@ -446,23 +446,14 @@ static const char *audio_map[][3] = { {"Speaker PGA", NULL, "Speaker Mux"}, {"LOUT2", NULL, "Speaker PGA"}, {"ROUT2", NULL, "Speaker PGA"}, - - {NULL, NULL, NULL}, };
static int wm9712_add_widgets(struct snd_soc_codec *codec) { - int i; - - for(i = 0; i < ARRAY_SIZE(wm9712_dapm_widgets); i++) { - snd_soc_dapm_new_control(codec, &wm9712_dapm_widgets[i]); - } + snd_soc_dapm_new_controls(codec, wm9712_dapm_widgets, + ARRAY_SIZE(wm9712_dapm_widgets));
- /* set up audio path audio_mapnects */ - for(i = 0; audio_map[i][0] != NULL; i++) { - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); - } + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_new_widgets(codec); return 0; diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 1f24116..1d292e7 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -456,7 +456,7 @@ SND_SOC_DAPM_INPUT("MIC2B"), SND_SOC_DAPM_VMID("VMID"), };
-static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route audio_map[] = { /* left HP mixer */ {"Left HP Mixer", "PC Beep Playback Switch", "PCBEEP"}, {"Left HP Mixer", "Voice Playback Switch", "Voice DAC"}, @@ -607,21 +607,14 @@ static const char *audio_map[][3] = { {"Capture Mono Mux", "Stereo", "Capture Mixer"}, {"Capture Mono Mux", "Left", "Left Capture Source"}, {"Capture Mono Mux", "Right", "Right Capture Source"}, - - {NULL, NULL, NULL}, };
static int wm9713_add_widgets(struct snd_soc_codec *codec) { - int i; - - for (i = 0; i < ARRAY_SIZE(wm9713_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &wm9713_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, wm9713_dapm_widgets, + ARRAY_SIZE(wm9713_dapm_widgets));
- /* set up audio path audio_mapnects */ - for (i = 0; audio_map[i][0] != NULL; i++) - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_new_widgets(codec); return 0;
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Jarkko Nikula jarkko.nikula@nokia.com --- sound/soc/codecs/tlv320aic3x.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 957996e..cb8365a 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -497,7 +497,7 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { SND_SOC_DAPM_INPUT("LINE2R"), };
-static const char *intercon[][3] = { +static const struct snd_soc_dapm_route intercon[] = { /* Left Output */ {"Left DAC Mux", "DAC_L1", "Left DAC"}, {"Left DAC Mux", "DAC_L2", "Left DAC"}, @@ -641,22 +641,15 @@ static const char *intercon[][3] = { {"Right Line Out", NULL, "Right Line2 Bypass Mixer"}, {"Mono Out", NULL, "Right Line2 Bypass Mixer"}, {"Right HP Out", NULL, "Right Line2 Bypass Mixer"}, - - /* terminator */ - {NULL, NULL, NULL}, };
static int aic3x_add_widgets(struct snd_soc_codec *codec) { - int i; - - for (i = 0; i < ARRAY_SIZE(aic3x_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &aic3x_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, + ARRAY_SIZE(aic3x_dapm_widgets));
/* set up audio path interconnects */ - for (i = 0; intercon[i][0] != NULL; i++) - snd_soc_dapm_connect_input(codec, intercon[i][0], - intercon[i][1], intercon[i][2]); + snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon));
snd_soc_dapm_new_widgets(codec); return 0;
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Richard Purdie rpurdie@rpsys.net --- sound/soc/pxa/corgi.c | 12 ++++-------- sound/soc/pxa/poodle.c | 14 +++++--------- sound/soc/pxa/spitz.c | 14 +++++--------- sound/soc/pxa/tosa.c | 14 ++++---------- 4 files changed, 18 insertions(+), 36 deletions(-)
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 7f32a11..852f16d 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c @@ -247,7 +247,7 @@ SND_SOC_DAPM_HP("Headset Jack", NULL), };
/* Corgi machine audio map (connections to the codec pins) */ -static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route audio_map[] = {
/* headset Jack - in = micin, out = LHPOUT*/ {"Headset Jack", NULL, "LHPOUT"}, @@ -265,8 +265,6 @@ static const char *audio_map[][3] = {
/* Same as the above but no mic bias for line signals */ {"MICIN", NULL, "Line Jack"}, - - {NULL, NULL, NULL}, };
static const char *jack_function[] = {"Headphone", "Mic", "Line", "Headset", @@ -303,13 +301,11 @@ static int corgi_wm8731_init(struct snd_soc_codec *codec) }
/* Add corgi specific widgets */ - for (i = 0; i < ARRAY_SIZE(wm8731_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &wm8731_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, + ARRAY_SIZE(wm8731_dapm_widgets));
/* Set up corgi specific audio path audio_map */ - for (i = 0; audio_map[i][0] != NULL; i++) - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync_endpoints(codec); return 0; diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 7e830b2..810f1fe 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -215,8 +215,8 @@ SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_SPK("Ext Spk", poodle_amp_event), };
-/* Corgi machine audio_mapnections to the codec pins */ -static const char *audio_map[][3] = { +/* Corgi machine connections to the codec pins */ +static const struct snd_soc_dapm_route audio_map[] = {
/* headphone connected to LHPOUT1, RHPOUT1 */ {"Headphone Jack", NULL, "LHPOUT"}, @@ -225,8 +225,6 @@ static const char *audio_map[][3] = { /* speaker connected to LOUT, ROUT */ {"Ext Spk", NULL, "ROUT"}, {"Ext Spk", NULL, "LOUT"}, - - {NULL, NULL, NULL}, };
static const char *jack_function[] = {"Off", "Headphone"}; @@ -263,13 +261,11 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec) }
/* Add poodle specific widgets */ - for (i = 0; i < ARRAY_SIZE(wm8731_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &wm8731_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, + ARRAY_SIZE(wm8731_dapm_widgets));
/* Set up poodle specific audio path audio_map */ - for (i = 0; audio_map[i][0] != NULL; i++) - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync_endpoints(codec); return 0; diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index d8b8372..73a6df8 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c @@ -250,7 +250,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { };
/* Spitz machine audio_map */ -static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route audio_map[] = {
/* headphone connected to LOUT1, ROUT1 */ {"Headphone Jack", NULL, "LOUT1"}, @@ -269,8 +269,6 @@ static const char *audio_map[][3] = {
/* line is connected to input 1 - no bias */ {"LINPUT1", NULL, "Line Jack"}, - - {NULL, NULL, NULL}, };
static const char *jack_function[] = {"Headphone", "Mic", "Line", "Headset", @@ -313,13 +311,11 @@ static int spitz_wm8750_init(struct snd_soc_codec *codec) }
/* Add spitz specific widgets */ - for (i = 0; i < ARRAY_SIZE(wm8750_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &wm8750_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, + ARRAY_SIZE(wm8750_dapm_widgets));
- /* Set up spitz specific audio path audio_map */ - for (i = 0; audio_map[i][0] != NULL; i++) - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); + /* Set up spitz specific audio paths */ + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync_endpoints(codec); return 0; diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 7346d7e..fda2aa0 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c @@ -154,7 +154,7 @@ SND_SOC_DAPM_SPK("Speaker", NULL), };
/* tosa audio map */ -static const char *audio_map[][3] = { +static const snd_soc_dapm_route audio_map[] = {
/* headphone connected to HPOUTL, HPOUTR */ {"Headphone Jack", NULL, "HPOUTL"}, @@ -173,8 +173,6 @@ static const char *audio_map[][3] = { {"Headset Jack", NULL, "HPOUTR"}, {"LINEINR", NULL, "Mic Bias"}, {"Mic Bias", NULL, "Headset Jack"}, - - {NULL, NULL, NULL}, };
static const char *jack_function[] = {"Headphone", "Mic", "Line", "Headset", @@ -208,15 +206,11 @@ static int tosa_ac97_init(struct snd_soc_codec *codec) }
/* add tosa specific widgets */ - for (i = 0; i < ARRAY_SIZE(tosa_dapm_widgets); i++) { - snd_soc_dapm_new_control(codec, &tosa_dapm_widgets[i]); - } + snd_soc_dapm_new_controls(codec, &tosa_dapm_widgets, + ARRAY_SIZE(tosa_dapm_widgets));
/* set up tosa specific audio path audio_map */ - for (i = 0; audio_map[i][0] != NULL; i++) { - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); - } + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync_endpoints(codec); return 0;
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Frank Mandarino fmandarino@endrelia.com --- sound/soc/at91/eti_b1_wm8731.c | 17 ++++------------- 1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/sound/soc/at91/eti_b1_wm8731.c b/sound/soc/at91/eti_b1_wm8731.c index 1347dcf..4a383a4 100644 --- a/sound/soc/at91/eti_b1_wm8731.c +++ b/sound/soc/at91/eti_b1_wm8731.c @@ -191,7 +191,7 @@ static const struct snd_soc_dapm_widget eti_b1_dapm_widgets[] = { SND_SOC_DAPM_SPK("Ext Spk", NULL), };
-static const char *intercon[][3] = { +static const struct snd_soc_dapm_route intercon[] = {
/* speaker connected to LHPOUT */ {"Ext Spk", NULL, "LHPOUT"}, @@ -199,9 +199,6 @@ static const char *intercon[][3] = { /* mic is connected to Mic Jack, with WM8731 Mic Bias */ {"MICIN", NULL, "Mic Bias"}, {"Mic Bias", NULL, "Int Mic"}, - - /* terminator */ - {NULL, NULL, NULL}, };
/* @@ -209,20 +206,14 @@ static const char *intercon[][3] = { */ static int eti_b1_wm8731_init(struct snd_soc_codec *codec) { - int i; - DBG("eti_b1_wm8731_init() called\n");
/* Add specific widgets */ - for(i = 0; i < ARRAY_SIZE(eti_b1_dapm_widgets); i++) { - snd_soc_dapm_new_control(codec, &eti_b1_dapm_widgets[i]); - } + snd_soc_dapm_new_controls(codec, eti_b1_dapm_widgets, + ARRAY_SIZE(eti_b1_dapm_widgets));
/* Set up specific audio path interconnects */ - for(i = 0; intercon[i][0] != NULL; i++) { - snd_soc_dapm_connect_input(codec, intercon[i][0], - intercon[i][1], intercon[i][2]); - } + snd_soc_dapm_add_route(codec, intercon, ARRAY_SIZE(intercon));
/* not connected */ snd_soc_dapm_set_endpoint(codec, "RLINEIN", 0);
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Graeme Gregory graeme@openmoko.org --- sound/soc/s3c24xx/neo1973_wm8753.c | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index e469186..79c5027 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c @@ -425,8 +425,7 @@ static const struct snd_soc_dapm_widget wm8753_dapm_widgets[] = { };
-/* example machine audio_mapnections */ -static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route dapm_routes[] = {
/* Connections to the lm4857 amp */ {"Audio Out", NULL, "LOUT1"}, @@ -449,8 +448,6 @@ static const char *audio_map[][3] = {
/* Connect the ALC pins */ {"ACIN", NULL, "ACOP"}, - - {NULL, NULL, NULL}, };
static const char *lm4857_mode[] = { @@ -526,8 +523,8 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec) set_scenario_endpoints(codec, NEO_AUDIO_OFF);
/* Add neo1973 specific widgets */ - for (i = 0; i < ARRAY_SIZE(wm8753_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &wm8753_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, + ARRAY_SIZE(wm8753_dapm_widgets));
/* add neo1973 specific controls */ for (i = 0; i < ARRAY_SIZE(wm8753_neo1973_controls); i++) { @@ -538,11 +535,9 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec) return err; }
- /* set up neo1973 specific audio path audio_mapnects */ - for (i = 0; audio_map[i][0] != NULL; i++) { - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); - } + /* set up neo1973 specific audio routes */ + err = snd_soc_dapm_add_routes(codec, dapm_routes, + ARRAY_SIZE(dapm_routes));
snd_soc_dapm_sync_endpoints(codec); return 0;
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com --- sound/soc/davinci/davinci-evm.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index fcd1652..4c70a0e 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -71,7 +71,7 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { };
/* davinci-evm machine audio_mapnections to the codec pins */ -static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route audio_map[] = { /* Headphone connected to HPLOUT, HPROUT */ {"Headphone Jack", NULL, "HPLOUT"}, {"Headphone Jack", NULL, "HPROUT"}, @@ -90,23 +90,17 @@ static const char *audio_map[][3] = { {"LINE2L", NULL, "Line In"}, {"LINE1R", NULL, "Line In"}, {"LINE2R", NULL, "Line In"}, - - {NULL, NULL, NULL}, };
/* Logic for a aic3x as connected on a davinci-evm */ static int evm_aic3x_init(struct snd_soc_codec *codec) { - int i; - /* Add davinci-evm specific widgets */ - for (i = 0; i < ARRAY_SIZE(aic3x_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &aic3x_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, + ARRAY_SIZE(aic3x_dapm_widgets));
/* Set up davinci-evm specific audio path audio_map */ - for (i = 0; audio_map[i][0] != NULL; i++) - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
/* not connected */ snd_soc_dapm_set_endpoint(codec, "MONO_LOUT", 0);
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Jarkko Nikula jarkko.nikula@nokia.com --- sound/soc/omap/n810.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 83b1eb4..1340f73 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c @@ -177,7 +177,7 @@ static const struct snd_soc_dapm_widget aic33_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", n810_jack_event), };
-static const char *audio_map[][3] = { +static const struct snd_soc_dapm_route audio_map[] = { {"Headphone Jack", NULL, "HPLOUT"}, {"Headphone Jack", NULL, "HPROUT"},
@@ -217,13 +217,11 @@ static int n810_aic33_init(struct snd_soc_codec *codec) }
/* Add N810 specific widgets */ - for (i = 0; i < ARRAY_SIZE(aic33_dapm_widgets); i++) - snd_soc_dapm_new_control(codec, &aic33_dapm_widgets[i]); + snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, + ARRAY_SIZE(aic33_dapm_widgets));
/* Set up N810 specific audio path audio_map */ - for (i = 0; i < ARRAY_SIZE(audio_map); i++) - snd_soc_dapm_connect_input(codec, audio_map[i][0], - audio_map[i][1], audio_map[i][2]); + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync_endpoints(codec);
On Tue, 13 May 2008 12:40:10 +0100 "ext Mark Brown" broonie@opensource.wolfsonmicro.com wrote:
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Jarkko Nikula jarkko.nikula@nokia.com
sound/soc/codecs/tlv320aic3x.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-)
Hmm. I applied patches 2, 3, 5 and 10 to my n810-aic33 setup and following codec controls below disappear. Probably I miss some patch from asoc-dev since I build this test on top of linux-omap with two recent aic3x patches from Daniel?
Jarkko
--- curr 2008-05-13 15:18:09.000000000 +0300 +++ new 2008-05-13 15:19:40.000000000 +0300 @@ -20,18 +20,7 @@ Simple mixer control 'Left DAC_L1 Mixer Mono',0 Simple mixer control 'Left HPCOM Mux',0 Simple mixer control 'Left Line1L Mux',0 -Simple mixer control 'Left Line2 Bypass Mixer HP Swit',0 -Simple mixer control 'Left Line2 Bypass Mixer HPCOM S',0 -Simple mixer control 'Left Line2 Bypass Mixer Line Sw',0 -Simple mixer control 'Left Line2 Bypass Mixer Mono Sw',0 Simple mixer control 'Left Line2L Mux',0 -Simple mixer control 'Left PGA Bypass Mixer HP',0 -Simple mixer control 'Left PGA Bypass Mixer HPCOM Swi',0 -Simple mixer control 'Left PGA Bypass Mixer Line Swit',0 -Simple mixer control 'Left PGA Bypass Mixer Mono Swit',0 -Simple mixer control 'Left PGA Mixer Line1L',0 -Simple mixer control 'Left PGA Mixer Line2L',0 -Simple mixer control 'Left PGA Mixer Mic3L',0 Simple mixer control 'PGA',0 Simple mixer control 'Right DAC Mux',0 Simple mixer control 'Right DAC_R1 Mixer HP',0 @@ -40,16 +29,5 @@ Simple mixer control 'Right DAC_R1 Mixer Mono',0 Simple mixer control 'Right HPCOM Mux',0 Simple mixer control 'Right Line1R Mux',0 -Simple mixer control 'Right Line2 Bypass Mixer HP Swi',0 -Simple mixer control 'Right Line2 Bypass Mixer HPCOM ',0 -Simple mixer control 'Right Line2 Bypass Mixer Line S',0 -Simple mixer control 'Right Line2 Bypass Mixer Mono S',0 Simple mixer control 'Right Line2R Mux',0 -Simple mixer control 'Right PGA Bypass Mixer HP Switc',0 -Simple mixer control 'Right PGA Bypass Mixer HPCOM Sw',0 -Simple mixer control 'Right PGA Bypass Mixer Line Swi',0 -Simple mixer control 'Right PGA Bypass Mixer Mono Swi',0 -Simple mixer control 'Right PGA Mixer Line1R',0 -Simple mixer control 'Right PGA Mixer Line2R',0 -Simple mixer control 'Right PGA Mixer Mic3R',0 Simple mixer control 'Speaker Function',0
On Tue, May 13, 2008 at 03:34:19PM +0300, Jarkko Nikula wrote:
Hmm. I applied patches 2, 3, 5 and 10 to my n810-aic33 setup and following codec controls below disappear. Probably I miss some patch from asoc-dev since I build this test on top of linux-omap with two recent aic3x patches from Daniel?
No, there shouldn't be any other dependencies. I'll take a look but I don't have any relevant hardware. Are there any complaints in dmesg?
My own patch [1] fixed this problem. Thanks to new log message "Failed to add route Mono Out->MONOLOUT" :-)
Jarkko
1. http://mailman.alsa-project.org/pipermail/alsa-devel/2008-May/007721.html
On Tue, 13 May 2008 15:34:19 +0300 Jarkko Nikula jarkko.nikula@nokia.com wrote:
On Tue, 13 May 2008 12:40:10 +0100 "ext Mark Brown" broonie@opensource.wolfsonmicro.com wrote:
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Jarkko Nikula jarkko.nikula@nokia.com
sound/soc/codecs/tlv320aic3x.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-)
Hmm. I applied patches 2, 3, 5 and 10 to my n810-aic33 setup and following codec controls below disappear. Probably I miss some patch from asoc-dev since I build this test on top of linux-omap with two recent aic3x patches from Daniel?
Jarkko
--- curr 2008-05-13 15:18:09.000000000 +0300 +++ new 2008-05-13 15:19:40.000000000 +0300 @@ -20,18 +20,7 @@ Simple mixer control 'Left DAC_L1 Mixer Mono',0 Simple mixer control 'Left HPCOM Mux',0 Simple mixer control 'Left Line1L Mux',0 -Simple mixer control 'Left Line2 Bypass Mixer HP Swit',0 -Simple mixer control 'Left Line2 Bypass Mixer HPCOM S',0 -Simple mixer control 'Left Line2 Bypass Mixer Line Sw',0 -Simple mixer control 'Left Line2 Bypass Mixer Mono Sw',0 Simple mixer control 'Left Line2L Mux',0 -Simple mixer control 'Left PGA Bypass Mixer HP',0 -Simple mixer control 'Left PGA Bypass Mixer HPCOM Swi',0 -Simple mixer control 'Left PGA Bypass Mixer Line Swit',0 -Simple mixer control 'Left PGA Bypass Mixer Mono Swit',0 -Simple mixer control 'Left PGA Mixer Line1L',0 -Simple mixer control 'Left PGA Mixer Line2L',0 -Simple mixer control 'Left PGA Mixer Mic3L',0 Simple mixer control 'PGA',0 Simple mixer control 'Right DAC Mux',0 Simple mixer control 'Right DAC_R1 Mixer HP',0 @@ -40,16 +29,5 @@ Simple mixer control 'Right DAC_R1 Mixer Mono',0 Simple mixer control 'Right HPCOM Mux',0 Simple mixer control 'Right Line1R Mux',0 -Simple mixer control 'Right Line2 Bypass Mixer HP Swi',0 -Simple mixer control 'Right Line2 Bypass Mixer HPCOM ',0 -Simple mixer control 'Right Line2 Bypass Mixer Line S',0 -Simple mixer control 'Right Line2 Bypass Mixer Mono S',0 Simple mixer control 'Right Line2R Mux',0 -Simple mixer control 'Right PGA Bypass Mixer HP Switc',0 -Simple mixer control 'Right PGA Bypass Mixer HPCOM Sw',0 -Simple mixer control 'Right PGA Bypass Mixer Line Swi',0 -Simple mixer control 'Right PGA Bypass Mixer Mono Swi',0 -Simple mixer control 'Right PGA Mixer Line1R',0 -Simple mixer control 'Right PGA Mixer Line2R',0 -Simple mixer control 'Right PGA Mixer Mic3R',0 Simple mixer control 'Speaker Function',0
On Tue, May 13, 2008 at 04:20:02PM +0300, Jarkko Nikula wrote:
My own patch [1] fixed this problem. Thanks to new log message "Failed to add route Mono Out->MONOLOUT" :-)
Ah, excellent - that's already in ALSA so the patch series should apply safely. Thanks.
At Tue, 13 May 2008 12:40:06 +0100, Mark Brown wrote:
From: Philipp Zabel philipp.zabel@gmail.com
I suspect that snd_ctl_boolean_mono should have been snd_ctl_boolean_mono_info instead. This fixes the build for magician.
Signed-off-by: Philipp Zabel philipp.zabel@gmail.com Signed-off-by: Liam Girdwood lg@opensource.wolfsonmicro.com
Applied all patches to ALSA tree. The first one was already applied directly to be pushed to the upstream at the next time.
Thanks,
Takashi
On Tue, May 13, 2008 at 03:33:45PM +0200, Takashi Iwai wrote:
Applied all patches to ALSA tree. The first one was already applied directly to be pushed to the upstream at the next time.
Thanks.
FWIW I'm currently basing my patches against the mm branch of:
git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa.git
so I will automagically drop anything that appears in hg. Is there anything better to use?
At Tue, 13 May 2008 14:41:12 +0100, Mark Brown wrote:
On Tue, May 13, 2008 at 03:33:45PM +0200, Takashi Iwai wrote:
Applied all patches to ALSA tree. The first one was already applied directly to be pushed to the upstream at the next time.
Thanks.
FWIW I'm currently basing my patches against the mm branch of:
git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa.git
so I will automagically drop anything that appears in hg. Is there anything better to use?
I'm currently working on my own git: git://git.kernel.orb/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
It's rebased sometimes, but not too often.
Takashi
On Tue, May 13, 2008 at 03:48:46PM +0200, Takashi Iwai wrote:
I'm currently working on my own git: git://git.kernel.orb/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
It's rebased sometimes, but not too often.
The master branch looks like the best one to base things not intended for stable on?
At Tue, 13 May 2008 15:08:50 +0100, Mark Brown wrote:
On Tue, May 13, 2008 at 03:48:46PM +0200, Takashi Iwai wrote:
I'm currently working on my own git: git://git.kernel.orb/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
It's rebased sometimes, but not too often.
The master branch looks like the best one to base things not intended for stable on?
Yes, the master branch is for the next kernel release, and thus good for basing.
Takashi
participants (3)
-
Jarkko Nikula
-
Mark Brown
-
Takashi Iwai