| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Handles the Mitac mioa701 SoC system |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2008 Robert Jarzmik |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation in version 2 of the License. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, write to the Free Software |
|---|
| 17 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | 6 | * |
|---|
| 19 | 7 | * This is a little schema of the sound interconnections : |
|---|
| 20 | 8 | * |
|---|
| .. | .. |
|---|
| 63 | 51 | unsigned short reg; |
|---|
| 64 | 52 | |
|---|
| 65 | 53 | if (power) { |
|---|
| 66 | | - reg = snd_soc_component_read32(component, AC97_GPIO_CFG); |
|---|
| 54 | + reg = snd_soc_component_read(component, AC97_GPIO_CFG); |
|---|
| 67 | 55 | snd_soc_component_write(component, AC97_GPIO_CFG, reg | 0x0100); |
|---|
| 68 | | - reg = snd_soc_component_read32(component, AC97_GPIO_PULL); |
|---|
| 56 | + reg = snd_soc_component_read(component, AC97_GPIO_PULL); |
|---|
| 69 | 57 | snd_soc_component_write(component, AC97_GPIO_PULL, reg | (1<<15)); |
|---|
| 70 | 58 | } else { |
|---|
| 71 | | - reg = snd_soc_component_read32(component, AC97_GPIO_CFG); |
|---|
| 59 | + reg = snd_soc_component_read(component, AC97_GPIO_CFG); |
|---|
| 72 | 60 | snd_soc_component_write(component, AC97_GPIO_CFG, reg & ~0x0100); |
|---|
| 73 | | - reg = snd_soc_component_read32(component, AC97_GPIO_PULL); |
|---|
| 61 | + reg = snd_soc_component_read(component, AC97_GPIO_PULL); |
|---|
| 74 | 62 | snd_soc_component_write(component, AC97_GPIO_PULL, reg & ~(1<<15)); |
|---|
| 75 | 63 | } |
|---|
| 76 | 64 | |
|---|
| .. | .. |
|---|
| 84 | 72 | struct snd_soc_pcm_runtime *rtd; |
|---|
| 85 | 73 | struct snd_soc_component *component; |
|---|
| 86 | 74 | |
|---|
| 87 | | - rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); |
|---|
| 88 | | - component = rtd->codec_dai->component; |
|---|
| 75 | + rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); |
|---|
| 76 | + component = asoc_rtd_to_codec(rtd, 0)->component; |
|---|
| 89 | 77 | return rear_amp_power(component, SND_SOC_DAPM_EVENT_ON(event)); |
|---|
| 90 | 78 | } |
|---|
| 91 | 79 | |
|---|
| .. | .. |
|---|
| 129 | 117 | |
|---|
| 130 | 118 | static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd) |
|---|
| 131 | 119 | { |
|---|
| 132 | | - struct snd_soc_component *component = rtd->codec_dai->component; |
|---|
| 120 | + struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; |
|---|
| 133 | 121 | |
|---|
| 134 | 122 | /* Prepare GPIO8 for rear speaker amplifier */ |
|---|
| 135 | 123 | snd_soc_component_update_bits(component, AC97_GPIO_CFG, 0x100, 0x100); |
|---|
| .. | .. |
|---|
| 142 | 130 | |
|---|
| 143 | 131 | static struct snd_soc_ops mioa701_ops; |
|---|
| 144 | 132 | |
|---|
| 133 | +SND_SOC_DAILINK_DEFS(ac97, |
|---|
| 134 | + DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97")), |
|---|
| 135 | + DAILINK_COMP_ARRAY(COMP_CODEC("wm9713-codec", "wm9713-hifi")), |
|---|
| 136 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio"))); |
|---|
| 137 | + |
|---|
| 138 | +SND_SOC_DAILINK_DEFS(ac97_aux, |
|---|
| 139 | + DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97-aux")), |
|---|
| 140 | + DAILINK_COMP_ARRAY(COMP_CODEC("wm9713-codec", "wm9713-aux")), |
|---|
| 141 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio"))); |
|---|
| 142 | + |
|---|
| 145 | 143 | static struct snd_soc_dai_link mioa701_dai[] = { |
|---|
| 146 | 144 | { |
|---|
| 147 | 145 | .name = "AC97", |
|---|
| 148 | 146 | .stream_name = "AC97 HiFi", |
|---|
| 149 | | - .cpu_dai_name = "pxa2xx-ac97", |
|---|
| 150 | | - .codec_dai_name = "wm9713-hifi", |
|---|
| 151 | | - .codec_name = "wm9713-codec", |
|---|
| 152 | 147 | .init = mioa701_wm9713_init, |
|---|
| 153 | | - .platform_name = "pxa-pcm-audio", |
|---|
| 154 | 148 | .ops = &mioa701_ops, |
|---|
| 149 | + SND_SOC_DAILINK_REG(ac97), |
|---|
| 155 | 150 | }, |
|---|
| 156 | 151 | { |
|---|
| 157 | 152 | .name = "AC97 Aux", |
|---|
| 158 | 153 | .stream_name = "AC97 Aux", |
|---|
| 159 | | - .cpu_dai_name = "pxa2xx-ac97-aux", |
|---|
| 160 | | - .codec_dai_name = "wm9713-aux", |
|---|
| 161 | | - .codec_name = "wm9713-codec", |
|---|
| 162 | | - .platform_name = "pxa-pcm-audio", |
|---|
| 163 | 154 | .ops = &mioa701_ops, |
|---|
| 155 | + SND_SOC_DAILINK_REG(ac97_aux), |
|---|
| 164 | 156 | }, |
|---|
| 165 | 157 | }; |
|---|
| 166 | 158 | |
|---|