hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/pci/ad1889.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* Analog Devices 1889 audio driver
23 *
34 * This is a driver for the AD1889 PCI audio chipset found
....@@ -6,19 +7,6 @@
67 * Copyright (C) 2004-2005, Kyle McMartin <kyle@parisc-linux.org>
78 * Copyright (C) 2005, Thibaut Varene <varenet@parisc-linux.org>
89 * Based on the OSS AD1889 driver by Randolph Chung <tausq@debian.org>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License, version 2, as
12
- * published by the Free Software Foundation.
13
- *
14
- * This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.
2210 *
2311 * TODO:
2412 * Do we need to take care of CCS register?
....@@ -267,20 +255,6 @@
267255 dev_dbg(chip->card->dev, "[%s] ready after %d ms\n", __func__, 400 - retry);
268256
269257 return 0;
270
-}
271
-
272
-static int
273
-snd_ad1889_hw_params(struct snd_pcm_substream *substream,
274
- struct snd_pcm_hw_params *hw_params)
275
-{
276
- return snd_pcm_lib_malloc_pages(substream,
277
- params_buffer_bytes(hw_params));
278
-}
279
-
280
-static int
281
-snd_ad1889_hw_free(struct snd_pcm_substream *substream)
282
-{
283
- return snd_pcm_lib_free_pages(substream);
284258 }
285259
286260 static const struct snd_pcm_hardware snd_ad1889_playback_hw = {
....@@ -574,9 +548,6 @@
574548 static const struct snd_pcm_ops snd_ad1889_playback_ops = {
575549 .open = snd_ad1889_playback_open,
576550 .close = snd_ad1889_playback_close,
577
- .ioctl = snd_pcm_lib_ioctl,
578
- .hw_params = snd_ad1889_hw_params,
579
- .hw_free = snd_ad1889_hw_free,
580551 .prepare = snd_ad1889_playback_prepare,
581552 .trigger = snd_ad1889_playback_trigger,
582553 .pointer = snd_ad1889_playback_pointer,
....@@ -585,9 +556,6 @@
585556 static const struct snd_pcm_ops snd_ad1889_capture_ops = {
586557 .open = snd_ad1889_capture_open,
587558 .close = snd_ad1889_capture_close,
588
- .ioctl = snd_pcm_lib_ioctl,
589
- .hw_params = snd_ad1889_hw_params,
590
- .hw_free = snd_ad1889_hw_free,
591559 .prepare = snd_ad1889_capture_prepare,
592560 .trigger = snd_ad1889_capture_trigger,
593561 .pointer = snd_ad1889_capture_pointer,
....@@ -644,16 +612,9 @@
644612 chip->psubs = NULL;
645613 chip->csubs = NULL;
646614
647
- err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
648
- snd_dma_pci_data(chip->pci),
649
- BUFFER_BYTES_MAX / 2,
650
- BUFFER_BYTES_MAX);
615
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
616
+ BUFFER_BYTES_MAX / 2, BUFFER_BYTES_MAX);
651617
652
- if (err < 0) {
653
- dev_err(chip->card->dev, "buffer allocation error: %d\n", err);
654
- return err;
655
- }
656
-
657618 return 0;
658619 }
659620
....@@ -741,10 +702,8 @@
741702 static void
742703 snd_ad1889_proc_init(struct snd_ad1889 *chip)
743704 {
744
- struct snd_info_entry *entry;
745
-
746
- if (!snd_card_proc_new(chip->card, chip->card->driver, &entry))
747
- snd_info_set_text_ops(entry, chip, snd_ad1889_proc_read);
705
+ snd_card_ro_proc_new(chip->card, chip->card->driver,
706
+ chip, snd_ad1889_proc_read);
748707 }
749708
750709 static const struct ac97_quirk ac97_quirks[] = {
....@@ -801,7 +760,7 @@
801760 {
802761 int err;
803762 struct snd_ac97_template ac97;
804
- static struct snd_ac97_bus_ops ops = {
763
+ static const struct snd_ac97_bus_ops ops = {
805764 .write = snd_ad1889_ac97_write,
806765 .read = snd_ad1889_ac97_read,
807766 };
....@@ -888,7 +847,7 @@
888847 int err;
889848
890849 struct snd_ad1889 *chip;
891
- static struct snd_device_ops ops = {
850
+ static const struct snd_device_ops ops = {
892851 .dev_free = snd_ad1889_dev_free,
893852 };
894853
....@@ -940,7 +899,7 @@
940899 }
941900
942901 chip->irq = pci->irq;
943
- synchronize_irq(chip->irq);
902
+ card->sync_irq = chip->irq;
944903
945904 /* (2) initialization of the chip hardware */
946905 if ((err = snd_ad1889_init(chip)) < 0) {