| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * pxa2xx-i2s.c -- ALSA Soc Audio Layer |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2005 Wolfson Microelectronics PLC. |
|---|
| 5 | 6 | * Author: Liam Girdwood |
|---|
| 6 | 7 | * lrg@slimlogic.co.uk |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 99 | 95 | static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream, |
|---|
| 100 | 96 | struct snd_soc_dai *dai) |
|---|
| 101 | 97 | { |
|---|
| 102 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 103 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
|---|
| 98 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 99 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
|---|
| 104 | 100 | |
|---|
| 105 | 101 | if (IS_ERR(clk_i2s)) |
|---|
| 106 | 102 | return PTR_ERR(clk_i2s); |
|---|
| 107 | 103 | |
|---|
| 108 | | - if (!cpu_dai->active) |
|---|
| 104 | + if (!snd_soc_dai_active(cpu_dai)) |
|---|
| 109 | 105 | SACR0 = 0; |
|---|
| 110 | 106 | |
|---|
| 111 | 107 | return 0; |
|---|
| .. | .. |
|---|
| 265 | 261 | } |
|---|
| 266 | 262 | |
|---|
| 267 | 263 | #ifdef CONFIG_PM |
|---|
| 268 | | -static int pxa2xx_i2s_suspend(struct snd_soc_dai *dai) |
|---|
| 264 | +static int pxa2xx_soc_pcm_suspend(struct snd_soc_component *component) |
|---|
| 269 | 265 | { |
|---|
| 270 | 266 | /* store registers */ |
|---|
| 271 | 267 | pxa_i2s.sacr0 = SACR0; |
|---|
| .. | .. |
|---|
| 279 | 275 | return 0; |
|---|
| 280 | 276 | } |
|---|
| 281 | 277 | |
|---|
| 282 | | -static int pxa2xx_i2s_resume(struct snd_soc_dai *dai) |
|---|
| 278 | +static int pxa2xx_soc_pcm_resume(struct snd_soc_component *component) |
|---|
| 283 | 279 | { |
|---|
| 284 | 280 | pxa_i2s_wait(); |
|---|
| 285 | 281 | |
|---|
| .. | .. |
|---|
| 294 | 290 | } |
|---|
| 295 | 291 | |
|---|
| 296 | 292 | #else |
|---|
| 297 | | -#define pxa2xx_i2s_suspend NULL |
|---|
| 298 | | -#define pxa2xx_i2s_resume NULL |
|---|
| 293 | +#define pxa2xx_soc_pcm_suspend NULL |
|---|
| 294 | +#define pxa2xx_soc_pcm_resume NULL |
|---|
| 299 | 295 | #endif |
|---|
| 300 | 296 | |
|---|
| 301 | 297 | static int pxa2xx_i2s_probe(struct snd_soc_dai *dai) |
|---|
| .. | .. |
|---|
| 346 | 342 | static struct snd_soc_dai_driver pxa_i2s_dai = { |
|---|
| 347 | 343 | .probe = pxa2xx_i2s_probe, |
|---|
| 348 | 344 | .remove = pxa2xx_i2s_remove, |
|---|
| 349 | | - .suspend = pxa2xx_i2s_suspend, |
|---|
| 350 | | - .resume = pxa2xx_i2s_resume, |
|---|
| 351 | 345 | .playback = { |
|---|
| 352 | 346 | .channels_min = 2, |
|---|
| 353 | 347 | .channels_max = 2, |
|---|
| .. | .. |
|---|
| 364 | 358 | |
|---|
| 365 | 359 | static const struct snd_soc_component_driver pxa_i2s_component = { |
|---|
| 366 | 360 | .name = "pxa-i2s", |
|---|
| 367 | | - .ops = &pxa2xx_pcm_ops, |
|---|
| 368 | | - .pcm_new = pxa2xx_soc_pcm_new, |
|---|
| 369 | | - .pcm_free = pxa2xx_pcm_free_dma_buffers, |
|---|
| 361 | + .pcm_construct = pxa2xx_soc_pcm_new, |
|---|
| 362 | + .pcm_destruct = pxa2xx_soc_pcm_free, |
|---|
| 363 | + .open = pxa2xx_soc_pcm_open, |
|---|
| 364 | + .close = pxa2xx_soc_pcm_close, |
|---|
| 365 | + .hw_params = pxa2xx_soc_pcm_hw_params, |
|---|
| 366 | + .hw_free = pxa2xx_soc_pcm_hw_free, |
|---|
| 367 | + .prepare = pxa2xx_soc_pcm_prepare, |
|---|
| 368 | + .trigger = pxa2xx_soc_pcm_trigger, |
|---|
| 369 | + .pointer = pxa2xx_soc_pcm_pointer, |
|---|
| 370 | + .mmap = pxa2xx_soc_pcm_mmap, |
|---|
| 371 | + .suspend = pxa2xx_soc_pcm_suspend, |
|---|
| 372 | + .resume = pxa2xx_soc_pcm_resume, |
|---|
| 370 | 373 | }; |
|---|
| 371 | 374 | |
|---|
| 372 | 375 | static int pxa2xx_i2s_drv_probe(struct platform_device *pdev) |
|---|