Skip to content

Commit dea8b6e

Browse files
Stephen Warrenbroonie
authored andcommitted
ASoC: Tegra: wm8903: s/code/data/ for control/widget/maps
Replace calls to a variety of registration functions by updating struct snd_soc_card snd_soc_tegra_wm8903 to directly point at the various control/widget/map tables instead. The ASoC core now performs any required registration based on these data fields. (Applying Mark's TrimSlice review comments to the existing driver) Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
1 parent a739362 commit dea8b6e

1 file changed

Lines changed: 19 additions & 22 deletions

File tree

‎sound/soc/tegra/tegra_wm8903.c‎

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -294,28 +294,6 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
294294
gpio_direction_output(pdata->gpio_ext_mic_en, 0);
295295
}
296296

297-
ret = snd_soc_add_controls(codec, tegra_wm8903_controls,
298-
ARRAY_SIZE(tegra_wm8903_controls));
299-
if (ret < 0)
300-
return ret;
301-
302-
snd_soc_dapm_new_controls(dapm, tegra_wm8903_dapm_widgets,
303-
ARRAY_SIZE(tegra_wm8903_dapm_widgets));
304-
305-
if (machine_is_harmony() || machine_is_ventana()) {
306-
snd_soc_dapm_add_routes(dapm, harmony_audio_map,
307-
ARRAY_SIZE(harmony_audio_map));
308-
} else if (machine_is_seaboard()) {
309-
snd_soc_dapm_add_routes(dapm, seaboard_audio_map,
310-
ARRAY_SIZE(seaboard_audio_map));
311-
} else if (machine_is_kaen()) {
312-
snd_soc_dapm_add_routes(dapm, kaen_audio_map,
313-
ARRAY_SIZE(kaen_audio_map));
314-
} else {
315-
snd_soc_dapm_add_routes(dapm, aebl_audio_map,
316-
ARRAY_SIZE(aebl_audio_map));
317-
}
318-
319297
if (gpio_is_valid(pdata->gpio_hp_det)) {
320298
tegra_wm8903_hp_jack_gpio.gpio = pdata->gpio_hp_det;
321299
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
@@ -379,6 +357,11 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = {
379357
.name = "tegra-wm8903",
380358
.dai_link = &tegra_wm8903_dai,
381359
.num_links = 1,
360+
361+
.controls = tegra_wm8903_controls,
362+
.num_controls = ARRAY_SIZE(tegra_wm8903_controls),
363+
.dapm_widgets = tegra_wm8903_dapm_widgets,
364+
.num_dapm_widgets = ARRAY_SIZE(tegra_wm8903_dapm_widgets),
382365
};
383366

384367
static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)
@@ -410,6 +393,20 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)
410393
platform_set_drvdata(pdev, card);
411394
snd_soc_card_set_drvdata(card, machine);
412395

396+
if (machine_is_harmony() || machine_is_ventana()) {
397+
card->dapm_routes = harmony_audio_map;
398+
card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map);
399+
} else if (machine_is_seaboard()) {
400+
card->dapm_routes = seaboard_audio_map;
401+
card->num_dapm_routes = ARRAY_SIZE(seaboard_audio_map);
402+
} else if (machine_is_kaen()) {
403+
card->dapm_routes = kaen_audio_map;
404+
card->num_dapm_routes = ARRAY_SIZE(kaen_audio_map);
405+
} else {
406+
card->dapm_routes = aebl_audio_map;
407+
card->num_dapm_routes = ARRAY_SIZE(aebl_audio_map);
408+
}
409+
413410
ret = snd_soc_register_card(card);
414411
if (ret) {
415412
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",

0 commit comments

Comments
 (0)