| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * tegra20_wm9712.c - Tegra machine ASoC driver for boards using WM9712 codec. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Partly based on code copyright/by: |
|---|
| 7 | 8 | * Copyright 2011,2012 Toradex Inc. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or |
|---|
| 10 | | - * modify it under the terms of the GNU General Public License |
|---|
| 11 | | - * version 2 as published by the Free Software Foundation. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | | - * General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | 9 | */ |
|---|
| 19 | 10 | |
|---|
| 20 | 11 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 49 | 40 | return snd_soc_dapm_force_enable_pin(&rtd->card->dapm, "Mic Bias"); |
|---|
| 50 | 41 | } |
|---|
| 51 | 42 | |
|---|
| 43 | +SND_SOC_DAILINK_DEFS(hifi, |
|---|
| 44 | + DAILINK_COMP_ARRAY(COMP_EMPTY()), |
|---|
| 45 | + DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-hifi")), |
|---|
| 46 | + DAILINK_COMP_ARRAY(COMP_EMPTY())); |
|---|
| 47 | + |
|---|
| 52 | 48 | static struct snd_soc_dai_link tegra_wm9712_dai = { |
|---|
| 53 | 49 | .name = "AC97 HiFi", |
|---|
| 54 | 50 | .stream_name = "AC97 HiFi", |
|---|
| 55 | | - .codec_dai_name = "wm9712-hifi", |
|---|
| 56 | | - .codec_name = "wm9712-codec", |
|---|
| 57 | 51 | .init = tegra_wm9712_init, |
|---|
| 52 | + SND_SOC_DAILINK_REG(hifi), |
|---|
| 58 | 53 | }; |
|---|
| 59 | 54 | |
|---|
| 60 | 55 | static struct snd_soc_card snd_soc_tegra_wm9712 = { |
|---|
| .. | .. |
|---|
| 102 | 97 | if (ret) |
|---|
| 103 | 98 | goto codec_unregister; |
|---|
| 104 | 99 | |
|---|
| 105 | | - tegra_wm9712_dai.cpu_of_node = of_parse_phandle(np, |
|---|
| 100 | + tegra_wm9712_dai.cpus->of_node = of_parse_phandle(np, |
|---|
| 106 | 101 | "nvidia,ac97-controller", 0); |
|---|
| 107 | | - if (!tegra_wm9712_dai.cpu_of_node) { |
|---|
| 102 | + if (!tegra_wm9712_dai.cpus->of_node) { |
|---|
| 108 | 103 | dev_err(&pdev->dev, |
|---|
| 109 | 104 | "Property 'nvidia,ac97-controller' missing or invalid\n"); |
|---|
| 110 | 105 | ret = -EINVAL; |
|---|
| 111 | 106 | goto codec_unregister; |
|---|
| 112 | 107 | } |
|---|
| 113 | 108 | |
|---|
| 114 | | - tegra_wm9712_dai.platform_of_node = tegra_wm9712_dai.cpu_of_node; |
|---|
| 109 | + tegra_wm9712_dai.platforms->of_node = tegra_wm9712_dai.cpus->of_node; |
|---|
| 115 | 110 | |
|---|
| 116 | 111 | ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); |
|---|
| 117 | 112 | if (ret) |
|---|
| .. | .. |
|---|
| 119 | 114 | |
|---|
| 120 | 115 | ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data); |
|---|
| 121 | 116 | if (ret) |
|---|
| 122 | | - goto asoc_utils_fini; |
|---|
| 117 | + goto codec_unregister; |
|---|
| 123 | 118 | |
|---|
| 124 | 119 | ret = snd_soc_register_card(card); |
|---|
| 125 | 120 | if (ret) { |
|---|
| 126 | 121 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", |
|---|
| 127 | 122 | ret); |
|---|
| 128 | | - goto asoc_utils_fini; |
|---|
| 123 | + goto codec_unregister; |
|---|
| 129 | 124 | } |
|---|
| 130 | 125 | |
|---|
| 131 | 126 | return 0; |
|---|
| 132 | 127 | |
|---|
| 133 | | -asoc_utils_fini: |
|---|
| 134 | | - tegra_asoc_utils_fini(&machine->util_data); |
|---|
| 135 | 128 | codec_unregister: |
|---|
| 136 | 129 | platform_device_del(machine->codec); |
|---|
| 137 | 130 | codec_put: |
|---|
| .. | .. |
|---|
| 145 | 138 | struct tegra_wm9712 *machine = snd_soc_card_get_drvdata(card); |
|---|
| 146 | 139 | |
|---|
| 147 | 140 | snd_soc_unregister_card(card); |
|---|
| 148 | | - |
|---|
| 149 | | - tegra_asoc_utils_fini(&machine->util_data); |
|---|
| 150 | 141 | |
|---|
| 151 | 142 | platform_device_unregister(machine->codec); |
|---|
| 152 | 143 | |
|---|