| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * i2sbus driver -- pcm routines |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> |
|---|
| 5 | | - * |
|---|
| 6 | | - * GPL v2, can be found in COPYING. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | #include <linux/io.h> |
|---|
| .. | .. |
|---|
| 255 | 254 | struct pcm_info *pi) |
|---|
| 256 | 255 | { |
|---|
| 257 | 256 | unsigned long flags; |
|---|
| 258 | | - struct completion done; |
|---|
| 257 | + DECLARE_COMPLETION_ONSTACK(done); |
|---|
| 259 | 258 | long timeout; |
|---|
| 260 | 259 | |
|---|
| 261 | 260 | spin_lock_irqsave(&i2sdev->low_lock, flags); |
|---|
| 262 | 261 | if (pi->dbdma_ring.stopping) { |
|---|
| 263 | | - init_completion(&done); |
|---|
| 264 | 262 | pi->stop_completion = &done; |
|---|
| 265 | 263 | spin_unlock_irqrestore(&i2sdev->low_lock, flags); |
|---|
| 266 | 264 | timeout = wait_for_completion_timeout(&done, HZ); |
|---|
| .. | .. |
|---|
| 295 | 293 | } |
|---|
| 296 | 294 | #endif |
|---|
| 297 | 295 | |
|---|
| 298 | | -static int i2sbus_hw_params(struct snd_pcm_substream *substream, |
|---|
| 299 | | - struct snd_pcm_hw_params *params) |
|---|
| 300 | | -{ |
|---|
| 301 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); |
|---|
| 302 | | -} |
|---|
| 303 | | - |
|---|
| 304 | 296 | static inline int i2sbus_hw_free(struct snd_pcm_substream *substream, int in) |
|---|
| 305 | 297 | { |
|---|
| 306 | 298 | struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); |
|---|
| .. | .. |
|---|
| 309 | 301 | get_pcm_info(i2sdev, in, &pi, NULL); |
|---|
| 310 | 302 | if (pi->dbdma_ring.stopping) |
|---|
| 311 | 303 | i2sbus_wait_for_stop(i2sdev, pi); |
|---|
| 312 | | - snd_pcm_lib_free_pages(substream); |
|---|
| 313 | 304 | return 0; |
|---|
| 314 | 305 | } |
|---|
| 315 | 306 | |
|---|
| .. | .. |
|---|
| 781 | 772 | static const struct snd_pcm_ops i2sbus_playback_ops = { |
|---|
| 782 | 773 | .open = i2sbus_playback_open, |
|---|
| 783 | 774 | .close = i2sbus_playback_close, |
|---|
| 784 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 785 | | - .hw_params = i2sbus_hw_params, |
|---|
| 786 | 775 | .hw_free = i2sbus_playback_hw_free, |
|---|
| 787 | 776 | .prepare = i2sbus_playback_prepare, |
|---|
| 788 | 777 | .trigger = i2sbus_playback_trigger, |
|---|
| .. | .. |
|---|
| 851 | 840 | static const struct snd_pcm_ops i2sbus_record_ops = { |
|---|
| 852 | 841 | .open = i2sbus_record_open, |
|---|
| 853 | 842 | .close = i2sbus_record_close, |
|---|
| 854 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 855 | | - .hw_params = i2sbus_hw_params, |
|---|
| 856 | 843 | .hw_free = i2sbus_record_hw_free, |
|---|
| 857 | 844 | .prepare = i2sbus_record_prepare, |
|---|
| 858 | 845 | .trigger = i2sbus_record_trigger, |
|---|
| .. | .. |
|---|
| 1027 | 1014 | dev->pcm->private_free = i2sbus_private_free; |
|---|
| 1028 | 1015 | |
|---|
| 1029 | 1016 | /* well, we really should support scatter/gather DMA */ |
|---|
| 1030 | | - snd_pcm_lib_preallocate_pages_for_all( |
|---|
| 1017 | + snd_pcm_set_managed_buffer_all( |
|---|
| 1031 | 1018 | dev->pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 1032 | | - snd_dma_pci_data(macio_get_pci_dev(i2sdev->macio)), |
|---|
| 1019 | + &macio_get_pci_dev(i2sdev->macio)->dev, |
|---|
| 1033 | 1020 | 64 * 1024, 64 * 1024); |
|---|
| 1034 | 1021 | |
|---|
| 1035 | 1022 | return 0; |
|---|