Commit dea8b6ee authored by Stephen Warren's avatar Stephen Warren Committed by Mark Brown

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: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent a7393623
...@@ -294,28 +294,6 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) ...@@ -294,28 +294,6 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
gpio_direction_output(pdata->gpio_ext_mic_en, 0); gpio_direction_output(pdata->gpio_ext_mic_en, 0);
} }
ret = snd_soc_add_controls(codec, tegra_wm8903_controls,
ARRAY_SIZE(tegra_wm8903_controls));
if (ret < 0)
return ret;
snd_soc_dapm_new_controls(dapm, tegra_wm8903_dapm_widgets,
ARRAY_SIZE(tegra_wm8903_dapm_widgets));
if (machine_is_harmony() || machine_is_ventana()) {
snd_soc_dapm_add_routes(dapm, harmony_audio_map,
ARRAY_SIZE(harmony_audio_map));
} else if (machine_is_seaboard()) {
snd_soc_dapm_add_routes(dapm, seaboard_audio_map,
ARRAY_SIZE(seaboard_audio_map));
} else if (machine_is_kaen()) {
snd_soc_dapm_add_routes(dapm, kaen_audio_map,
ARRAY_SIZE(kaen_audio_map));
} else {
snd_soc_dapm_add_routes(dapm, aebl_audio_map,
ARRAY_SIZE(aebl_audio_map));
}
if (gpio_is_valid(pdata->gpio_hp_det)) { if (gpio_is_valid(pdata->gpio_hp_det)) {
tegra_wm8903_hp_jack_gpio.gpio = pdata->gpio_hp_det; tegra_wm8903_hp_jack_gpio.gpio = pdata->gpio_hp_det;
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
...@@ -379,6 +357,11 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = { ...@@ -379,6 +357,11 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = {
.name = "tegra-wm8903", .name = "tegra-wm8903",
.dai_link = &tegra_wm8903_dai, .dai_link = &tegra_wm8903_dai,
.num_links = 1, .num_links = 1,
.controls = tegra_wm8903_controls,
.num_controls = ARRAY_SIZE(tegra_wm8903_controls),
.dapm_widgets = tegra_wm8903_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(tegra_wm8903_dapm_widgets),
}; };
static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) 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) ...@@ -410,6 +393,20 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, card); platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, machine); snd_soc_card_set_drvdata(card, machine);
if (machine_is_harmony() || machine_is_ventana()) {
card->dapm_routes = harmony_audio_map;
card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map);
} else if (machine_is_seaboard()) {
card->dapm_routes = seaboard_audio_map;
card->num_dapm_routes = ARRAY_SIZE(seaboard_audio_map);
} else if (machine_is_kaen()) {
card->dapm_routes = kaen_audio_map;
card->num_dapm_routes = ARRAY_SIZE(kaen_audio_map);
} else {
card->dapm_routes = aebl_audio_map;
card->num_dapm_routes = ARRAY_SIZE(aebl_audio_map);
}
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment