| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * corgi.c -- SoC audio for Corgi |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Authors: Liam Girdwood <lrg@slimlogic.co.uk> |
|---|
| 8 | 9 | * Richard Purdie <richard@openedhand.com> |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 11 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 12 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 13 | | - * option) any later version. |
|---|
| 14 | 10 | */ |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 100 | 96 | |
|---|
| 101 | 97 | static int corgi_startup(struct snd_pcm_substream *substream) |
|---|
| 102 | 98 | { |
|---|
| 103 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 99 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 104 | 100 | |
|---|
| 105 | 101 | /* check the jack status at stream startup */ |
|---|
| 106 | 102 | corgi_ext_control(&rtd->card->dapm); |
|---|
| .. | .. |
|---|
| 119 | 115 | static int corgi_hw_params(struct snd_pcm_substream *substream, |
|---|
| 120 | 116 | struct snd_pcm_hw_params *params) |
|---|
| 121 | 117 | { |
|---|
| 122 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 123 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 124 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
|---|
| 118 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 119 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 120 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
|---|
| 125 | 121 | unsigned int clk = 0; |
|---|
| 126 | 122 | int ret = 0; |
|---|
| 127 | 123 | |
|---|
| .. | .. |
|---|
| 260 | 256 | }; |
|---|
| 261 | 257 | |
|---|
| 262 | 258 | /* corgi digital audio interface glue - connects codec <--> CPU */ |
|---|
| 259 | +SND_SOC_DAILINK_DEFS(wm8731, |
|---|
| 260 | + DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-i2s")), |
|---|
| 261 | + DAILINK_COMP_ARRAY(COMP_CODEC("wm8731.0-001b", "wm8731-hifi")), |
|---|
| 262 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio"))); |
|---|
| 263 | + |
|---|
| 263 | 264 | static struct snd_soc_dai_link corgi_dai = { |
|---|
| 264 | 265 | .name = "WM8731", |
|---|
| 265 | 266 | .stream_name = "WM8731", |
|---|
| 266 | | - .cpu_dai_name = "pxa2xx-i2s", |
|---|
| 267 | | - .codec_dai_name = "wm8731-hifi", |
|---|
| 268 | | - .platform_name = "pxa-pcm-audio", |
|---|
| 269 | | - .codec_name = "wm8731.0-001b", |
|---|
| 270 | 267 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
|---|
| 271 | 268 | SND_SOC_DAIFMT_CBS_CFS, |
|---|
| 272 | 269 | .ops = &corgi_ops, |
|---|
| 270 | + SND_SOC_DAILINK_REG(wm8731), |
|---|
| 273 | 271 | }; |
|---|
| 274 | 272 | |
|---|
| 275 | 273 | /* corgi audio machine driver */ |
|---|