.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * bt87x.c - Brooktree Bt878/Bt879 driver for ALSA |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> |
---|
5 | 6 | * |
---|
6 | 7 | * based on btaudio.c by Gerd Knorr <kraxel@bytesex.org> |
---|
7 | | - * |
---|
8 | | - * |
---|
9 | | - * This driver is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - * (at your option) any later version. |
---|
13 | | - * |
---|
14 | | - * This driver is distributed in the hope that it will be useful, |
---|
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - * GNU General Public License for more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License |
---|
20 | | - * along with this program; if not, write to the Free Software |
---|
21 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
22 | 8 | */ |
---|
23 | 9 | |
---|
24 | 10 | #include <linux/init.h> |
---|
.. | .. |
---|
44 | 30 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
---|
45 | 31 | static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ |
---|
46 | 32 | static int digital_rate[SNDRV_CARDS]; /* digital input rate */ |
---|
47 | | -static bool load_all; /* allow to load the non-whitelisted cards */ |
---|
| 33 | +static bool load_all; /* allow to load cards not the allowlist */ |
---|
48 | 34 | |
---|
49 | 35 | module_param_array(index, int, NULL, 0444); |
---|
50 | 36 | MODULE_PARM_DESC(index, "Index value for Bt87x soundcard"); |
---|
.. | .. |
---|
55 | 41 | module_param_array(digital_rate, int, NULL, 0444); |
---|
56 | 42 | MODULE_PARM_DESC(digital_rate, "Digital input rate for Bt87x soundcard"); |
---|
57 | 43 | module_param(load_all, bool, 0444); |
---|
58 | | -MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards"); |
---|
| 44 | +MODULE_PARM_DESC(load_all, "Allow to load cards not on the allowlist"); |
---|
59 | 45 | |
---|
60 | 46 | |
---|
61 | 47 | /* register offsets */ |
---|
.. | .. |
---|
164 | 150 | unsigned no_digital:1; /* No digital input */ |
---|
165 | 151 | }; |
---|
166 | 152 | |
---|
167 | | -static struct snd_bt87x_board snd_bt87x_boards[] = { |
---|
| 153 | +static const struct snd_bt87x_board snd_bt87x_boards[] = { |
---|
168 | 154 | [SND_BT87X_BOARD_UNKNOWN] = { |
---|
169 | 155 | .dig_rate = 32000, /* just a guess */ |
---|
170 | 156 | }, |
---|
.. | .. |
---|
231 | 217 | __le32 *risc; |
---|
232 | 218 | |
---|
233 | 219 | if (chip->dma_risc.area == NULL) { |
---|
234 | | - if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), |
---|
| 220 | + if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev, |
---|
235 | 221 | PAGE_ALIGN(MAX_RISC_SIZE), &chip->dma_risc) < 0) |
---|
236 | 222 | return -ENOMEM; |
---|
237 | 223 | } |
---|
.. | .. |
---|
285 | 271 | |
---|
286 | 272 | static void snd_bt87x_pci_error(struct snd_bt87x *chip, unsigned int status) |
---|
287 | 273 | { |
---|
288 | | - u16 pci_status; |
---|
| 274 | + int pci_status = pci_status_get_and_clear_errors(chip->pci); |
---|
289 | 275 | |
---|
290 | | - pci_read_config_word(chip->pci, PCI_STATUS, &pci_status); |
---|
291 | | - pci_status &= PCI_STATUS_PARITY | PCI_STATUS_SIG_TARGET_ABORT | |
---|
292 | | - PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_REC_MASTER_ABORT | |
---|
293 | | - PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY; |
---|
294 | | - pci_write_config_word(chip->pci, PCI_STATUS, pci_status); |
---|
295 | 276 | if (pci_status != PCI_STATUS_DETECTED_PARITY) |
---|
296 | 277 | dev_err(chip->card->dev, |
---|
297 | 278 | "Aieee - PCI error! status %#08x, PCI status %#04x\n", |
---|
.. | .. |
---|
466 | 447 | struct snd_pcm_hw_params *hw_params) |
---|
467 | 448 | { |
---|
468 | 449 | struct snd_bt87x *chip = snd_pcm_substream_chip(substream); |
---|
469 | | - int err; |
---|
470 | 450 | |
---|
471 | | - err = snd_pcm_lib_malloc_pages(substream, |
---|
472 | | - params_buffer_bytes(hw_params)); |
---|
473 | | - if (err < 0) |
---|
474 | | - return err; |
---|
475 | 451 | return snd_bt87x_create_risc(chip, substream, |
---|
476 | 452 | params_periods(hw_params), |
---|
477 | 453 | params_period_bytes(hw_params)); |
---|
.. | .. |
---|
482 | 458 | struct snd_bt87x *chip = snd_pcm_substream_chip(substream); |
---|
483 | 459 | |
---|
484 | 460 | snd_bt87x_free_risc(chip); |
---|
485 | | - snd_pcm_lib_free_pages(substream); |
---|
486 | 461 | return 0; |
---|
487 | 462 | } |
---|
488 | 463 | |
---|
.. | .. |
---|
553 | 528 | static const struct snd_pcm_ops snd_bt87x_pcm_ops = { |
---|
554 | 529 | .open = snd_bt87x_pcm_open, |
---|
555 | 530 | .close = snd_bt87x_close, |
---|
556 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
557 | 531 | .hw_params = snd_bt87x_hw_params, |
---|
558 | 532 | .hw_free = snd_bt87x_hw_free, |
---|
559 | 533 | .prepare = snd_bt87x_prepare, |
---|
560 | 534 | .trigger = snd_bt87x_trigger, |
---|
561 | 535 | .pointer = snd_bt87x_pointer, |
---|
562 | | - .page = snd_pcm_sgbuf_ops_page, |
---|
563 | 536 | }; |
---|
564 | 537 | |
---|
565 | 538 | static int snd_bt87x_capture_volume_info(struct snd_kcontrol *kcontrol, |
---|
.. | .. |
---|
714 | 687 | pcm->private_data = chip; |
---|
715 | 688 | strcpy(pcm->name, name); |
---|
716 | 689 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_bt87x_pcm_ops); |
---|
717 | | - return snd_pcm_lib_preallocate_pages_for_all(pcm, |
---|
718 | | - SNDRV_DMA_TYPE_DEV_SG, |
---|
719 | | - snd_dma_pci_data(chip->pci), |
---|
720 | | - 128 * 1024, |
---|
721 | | - ALIGN(255 * 4092, 1024)); |
---|
| 690 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
---|
| 691 | + &chip->pci->dev, |
---|
| 692 | + 128 * 1024, |
---|
| 693 | + ALIGN(255 * 4092, 1024)); |
---|
| 694 | + return 0; |
---|
722 | 695 | } |
---|
723 | 696 | |
---|
724 | 697 | static int snd_bt87x_create(struct snd_card *card, |
---|
.. | .. |
---|
727 | 700 | { |
---|
728 | 701 | struct snd_bt87x *chip; |
---|
729 | 702 | int err; |
---|
730 | | - static struct snd_device_ops ops = { |
---|
| 703 | + static const struct snd_device_ops ops = { |
---|
731 | 704 | .dev_free = snd_bt87x_dev_free |
---|
732 | 705 | }; |
---|
733 | 706 | |
---|
.. | .. |
---|
773 | 746 | goto fail; |
---|
774 | 747 | } |
---|
775 | 748 | chip->irq = pci->irq; |
---|
| 749 | + card->sync_irq = chip->irq; |
---|
776 | 750 | pci_set_master(pci); |
---|
777 | | - synchronize_irq(chip->irq); |
---|
778 | 751 | |
---|
779 | 752 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
---|
780 | 753 | if (err < 0) |
---|
.. | .. |
---|
828 | 801 | * (DVB cards use the audio function to transfer MPEG data) */ |
---|
829 | 802 | static struct { |
---|
830 | 803 | unsigned short subvendor, subdevice; |
---|
831 | | -} blacklist[] = { |
---|
| 804 | +} denylist[] = { |
---|
832 | 805 | {0x0071, 0x0101}, /* Nebula Electronics DigiTV */ |
---|
833 | 806 | {0x11bd, 0x001c}, /* Pinnacle PCTV Sat */ |
---|
834 | 807 | {0x11bd, 0x0026}, /* Pinnacle PCTV SAT CI */ |
---|
.. | .. |
---|
844 | 817 | |
---|
845 | 818 | static struct pci_driver driver; |
---|
846 | 819 | |
---|
847 | | -/* return the id of the card, or a negative value if it's blacklisted */ |
---|
| 820 | +/* return the id of the card, or a negative value if it's on the denylist */ |
---|
848 | 821 | static int snd_bt87x_detect_card(struct pci_dev *pci) |
---|
849 | 822 | { |
---|
850 | 823 | int i; |
---|
.. | .. |
---|
854 | 827 | if (supported && supported->driver_data > 0) |
---|
855 | 828 | return supported->driver_data; |
---|
856 | 829 | |
---|
857 | | - for (i = 0; i < ARRAY_SIZE(blacklist); ++i) |
---|
858 | | - if (blacklist[i].subvendor == pci->subsystem_vendor && |
---|
859 | | - blacklist[i].subdevice == pci->subsystem_device) { |
---|
| 830 | + for (i = 0; i < ARRAY_SIZE(denylist); ++i) |
---|
| 831 | + if (denylist[i].subvendor == pci->subsystem_vendor && |
---|
| 832 | + denylist[i].subdevice == pci->subsystem_device) { |
---|
860 | 833 | dev_dbg(&pci->dev, |
---|
861 | 834 | "card %#04x-%#04x:%#04x has no audio\n", |
---|
862 | 835 | pci->device, pci->subsystem_vendor, pci->subsystem_device); |
---|