.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * SoC audio for HTC Magician |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * based on spitz.c, |
---|
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 | | - * |
---|
15 | 10 | */ |
---|
16 | 11 | |
---|
17 | 12 | #include <linux/module.h> |
---|
.. | .. |
---|
73 | 68 | |
---|
74 | 69 | static int magician_startup(struct snd_pcm_substream *substream) |
---|
75 | 70 | { |
---|
76 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
| 71 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
77 | 72 | |
---|
78 | 73 | /* check the jack status at stream startup */ |
---|
79 | 74 | magician_ext_control(&rtd->card->dapm); |
---|
.. | .. |
---|
87 | 82 | static int magician_playback_hw_params(struct snd_pcm_substream *substream, |
---|
88 | 83 | struct snd_pcm_hw_params *params) |
---|
89 | 84 | { |
---|
90 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
91 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
---|
92 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
---|
| 85 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
| 86 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
---|
| 87 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
---|
93 | 88 | unsigned int width; |
---|
94 | 89 | int ret = 0; |
---|
95 | 90 | |
---|
.. | .. |
---|
125 | 120 | static int magician_capture_hw_params(struct snd_pcm_substream *substream, |
---|
126 | 121 | struct snd_pcm_hw_params *params) |
---|
127 | 122 | { |
---|
128 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
129 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
---|
130 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
---|
| 123 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
| 124 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
---|
| 125 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
---|
131 | 126 | int ret = 0; |
---|
132 | 127 | |
---|
133 | 128 | /* set codec DAI configuration */ |
---|
.. | .. |
---|
290 | 285 | }; |
---|
291 | 286 | |
---|
292 | 287 | /* magician digital audio interface glue - connects codec <--> CPU */ |
---|
| 288 | +SND_SOC_DAILINK_DEFS(playback, |
---|
| 289 | + DAILINK_COMP_ARRAY(COMP_CPU("pxa-ssp-dai.0")), |
---|
| 290 | + DAILINK_COMP_ARRAY(COMP_CODEC("uda1380-codec.0-0018", |
---|
| 291 | + "uda1380-hifi-playback")), |
---|
| 292 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio"))); |
---|
| 293 | + |
---|
| 294 | +SND_SOC_DAILINK_DEFS(capture, |
---|
| 295 | + DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-i2s")), |
---|
| 296 | + DAILINK_COMP_ARRAY(COMP_CODEC("uda1380-codec.0-0018", |
---|
| 297 | + "uda1380-hifi-capture")), |
---|
| 298 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio"))); |
---|
| 299 | + |
---|
293 | 300 | static struct snd_soc_dai_link magician_dai[] = { |
---|
294 | 301 | { |
---|
295 | 302 | .name = "uda1380", |
---|
296 | 303 | .stream_name = "UDA1380 Playback", |
---|
297 | | - .cpu_dai_name = "pxa-ssp-dai.0", |
---|
298 | | - .codec_dai_name = "uda1380-hifi-playback", |
---|
299 | | - .platform_name = "pxa-pcm-audio", |
---|
300 | | - .codec_name = "uda1380-codec.0-0018", |
---|
301 | 304 | .ops = &magician_playback_ops, |
---|
| 305 | + SND_SOC_DAILINK_REG(playback), |
---|
302 | 306 | }, |
---|
303 | 307 | { |
---|
304 | 308 | .name = "uda1380", |
---|
305 | 309 | .stream_name = "UDA1380 Capture", |
---|
306 | | - .cpu_dai_name = "pxa2xx-i2s", |
---|
307 | | - .codec_dai_name = "uda1380-hifi-capture", |
---|
308 | | - .platform_name = "pxa-pcm-audio", |
---|
309 | | - .codec_name = "uda1380-codec.0-0018", |
---|
310 | 310 | .ops = &magician_capture_ops, |
---|
| 311 | + SND_SOC_DAILINK_REG(capture), |
---|
311 | 312 | } |
---|
312 | 313 | }; |
---|
313 | 314 | |
---|
.. | .. |
---|
357 | 358 | adapter = i2c_get_adapter(0); |
---|
358 | 359 | if (!adapter) |
---|
359 | 360 | return -ENODEV; |
---|
360 | | - client = i2c_new_device(adapter, i2c_board_info); |
---|
| 361 | + client = i2c_new_client_device(adapter, i2c_board_info); |
---|
361 | 362 | i2c_put_adapter(adapter); |
---|
362 | | - if (!client) |
---|
363 | | - return -ENODEV; |
---|
| 363 | + if (IS_ERR(client)) |
---|
| 364 | + return PTR_ERR(client); |
---|
364 | 365 | |
---|
365 | 366 | ret = gpio_request(EGPIO_MAGICIAN_SPK_POWER, "SPK_POWER"); |
---|
366 | 367 | if (ret) |
---|