| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2015 VanguardiaSur - www.vanguardiasur.com.ar |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 7 | 8 | * Based on: |
|---|
| 8 | 9 | * Driver for Intersil|Techwell TW6869 based DVR cards |
|---|
| 9 | 10 | * (c) 2011-12 liran <jli11@intersil.com> [Intersil|Techwell China] |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 12 | | - * under the terms of version 2 of the GNU General Public License |
|---|
| 13 | | - * as published by the Free Software Foundation. |
|---|
| 14 | 11 | */ |
|---|
| 15 | 12 | |
|---|
| 16 | 13 | #include <linux/types.h> |
|---|
| .. | .. |
|---|
| 79 | 76 | ac->ptr = done->dma - ac->buf[0].dma; |
|---|
| 80 | 77 | snd_pcm_period_elapsed(ac->ss); |
|---|
| 81 | 78 | } |
|---|
| 82 | | -} |
|---|
| 83 | | - |
|---|
| 84 | | -static int tw686x_pcm_hw_params(struct snd_pcm_substream *ss, |
|---|
| 85 | | - struct snd_pcm_hw_params *hw_params) |
|---|
| 86 | | -{ |
|---|
| 87 | | - return snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw_params)); |
|---|
| 88 | | -} |
|---|
| 89 | | - |
|---|
| 90 | | -static int tw686x_pcm_hw_free(struct snd_pcm_substream *ss) |
|---|
| 91 | | -{ |
|---|
| 92 | | - return snd_pcm_lib_free_pages(ss); |
|---|
| 93 | 79 | } |
|---|
| 94 | 80 | |
|---|
| 95 | 81 | /* |
|---|
| .. | .. |
|---|
| 272 | 258 | static const struct snd_pcm_ops tw686x_pcm_ops = { |
|---|
| 273 | 259 | .open = tw686x_pcm_open, |
|---|
| 274 | 260 | .close = tw686x_pcm_close, |
|---|
| 275 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 276 | | - .hw_params = tw686x_pcm_hw_params, |
|---|
| 277 | | - .hw_free = tw686x_pcm_hw_free, |
|---|
| 278 | 261 | .prepare = tw686x_pcm_prepare, |
|---|
| 279 | 262 | .trigger = tw686x_pcm_trigger, |
|---|
| 280 | 263 | .pointer = tw686x_pcm_pointer, |
|---|
| .. | .. |
|---|
| 295 | 278 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &tw686x_pcm_ops); |
|---|
| 296 | 279 | snd_pcm_chip(pcm) = dev; |
|---|
| 297 | 280 | pcm->info_flags = 0; |
|---|
| 298 | | - strlcpy(pcm->name, "tw686x PCM", sizeof(pcm->name)); |
|---|
| 281 | + strscpy(pcm->name, "tw686x PCM", sizeof(pcm->name)); |
|---|
| 299 | 282 | |
|---|
| 300 | 283 | for (i = 0, ss = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
|---|
| 301 | 284 | ss; ss = ss->next, i++) |
|---|
| 302 | 285 | snprintf(ss->name, sizeof(ss->name), "vch%u audio", i); |
|---|
| 303 | 286 | |
|---|
| 304 | | - return snd_pcm_lib_preallocate_pages_for_all(pcm, |
|---|
| 287 | + snd_pcm_set_managed_buffer_all(pcm, |
|---|
| 305 | 288 | SNDRV_DMA_TYPE_DEV, |
|---|
| 306 | | - snd_dma_pci_data(dev->pci_dev), |
|---|
| 289 | + &dev->pci_dev->dev, |
|---|
| 307 | 290 | TW686X_AUDIO_PAGE_MAX * AUDIO_DMA_SIZE_MAX, |
|---|
| 308 | 291 | TW686X_AUDIO_PAGE_MAX * AUDIO_DMA_SIZE_MAX); |
|---|
| 292 | + return 0; |
|---|
| 309 | 293 | } |
|---|
| 310 | 294 | |
|---|
| 311 | 295 | static void tw686x_audio_dma_free(struct tw686x_dev *dev, |
|---|
| .. | .. |
|---|
| 390 | 374 | return err; |
|---|
| 391 | 375 | |
|---|
| 392 | 376 | dev->snd_card = card; |
|---|
| 393 | | - strlcpy(card->driver, "tw686x", sizeof(card->driver)); |
|---|
| 394 | | - strlcpy(card->shortname, "tw686x", sizeof(card->shortname)); |
|---|
| 395 | | - strlcpy(card->longname, pci_name(pci_dev), sizeof(card->longname)); |
|---|
| 377 | + strscpy(card->driver, "tw686x", sizeof(card->driver)); |
|---|
| 378 | + strscpy(card->shortname, "tw686x", sizeof(card->shortname)); |
|---|
| 379 | + strscpy(card->longname, pci_name(pci_dev), sizeof(card->longname)); |
|---|
| 396 | 380 | snd_card_set_dev(card, &pci_dev->dev); |
|---|
| 397 | 381 | |
|---|
| 398 | 382 | for (ch = 0; ch < max_channels(dev); ch++) { |
|---|