hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/pci/als300.c
....@@ -1,20 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * als300.c - driver for Avance Logic ALS300/ALS300+ soundcards.
34 * Copyright (C) 2005 by Ash Willis <ashwillis@programmer.net>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
185 *
196 * TODO
207 * 4 channel playback for ALS300+
....@@ -307,7 +294,7 @@
307294 struct snd_ac97_bus *bus;
308295 struct snd_ac97_template ac97;
309296 int err;
310
- static struct snd_ac97_bus_ops ops = {
297
+ static const struct snd_ac97_bus_ops ops = {
311298 .write = snd_als300_ac97_write,
312299 .read = snd_als300_ac97_read,
313300 };
....@@ -391,7 +378,6 @@
391378 data = substream->runtime->private_data;
392379 kfree(data);
393380 chip->playback_substream = NULL;
394
- snd_pcm_lib_free_pages(substream);
395381 return 0;
396382 }
397383
....@@ -420,20 +406,7 @@
420406 data = substream->runtime->private_data;
421407 kfree(data);
422408 chip->capture_substream = NULL;
423
- snd_pcm_lib_free_pages(substream);
424409 return 0;
425
-}
426
-
427
-static int snd_als300_pcm_hw_params(struct snd_pcm_substream *substream,
428
- struct snd_pcm_hw_params *hw_params)
429
-{
430
- return snd_pcm_lib_malloc_pages(substream,
431
- params_buffer_bytes(hw_params));
432
-}
433
-
434
-static int snd_als300_pcm_hw_free(struct snd_pcm_substream *substream)
435
-{
436
- return snd_pcm_lib_free_pages(substream);
437410 }
438411
439412 static int snd_als300_playback_prepare(struct snd_pcm_substream *substream)
....@@ -566,9 +539,6 @@
566539 static const struct snd_pcm_ops snd_als300_playback_ops = {
567540 .open = snd_als300_playback_open,
568541 .close = snd_als300_playback_close,
569
- .ioctl = snd_pcm_lib_ioctl,
570
- .hw_params = snd_als300_pcm_hw_params,
571
- .hw_free = snd_als300_pcm_hw_free,
572542 .prepare = snd_als300_playback_prepare,
573543 .trigger = snd_als300_trigger,
574544 .pointer = snd_als300_pointer,
....@@ -577,9 +547,6 @@
577547 static const struct snd_pcm_ops snd_als300_capture_ops = {
578548 .open = snd_als300_capture_open,
579549 .close = snd_als300_capture_close,
580
- .ioctl = snd_pcm_lib_ioctl,
581
- .hw_params = snd_als300_pcm_hw_params,
582
- .hw_free = snd_als300_pcm_hw_free,
583550 .prepare = snd_als300_capture_prepare,
584551 .trigger = snd_als300_trigger,
585552 .pointer = snd_als300_pointer,
....@@ -604,8 +571,8 @@
604571 &snd_als300_capture_ops);
605572
606573 /* pre-allocation of buffers */
607
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
608
- snd_dma_pci_data(chip->pci), 64*1024, 64*1024);
574
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
575
+ 64*1024, 64*1024);
609576 return 0;
610577 }
611578
....@@ -650,7 +617,7 @@
650617 void *irq_handler;
651618 int err;
652619
653
- static struct snd_device_ops ops = {
620
+ static const struct snd_device_ops ops = {
654621 .dev_free = snd_als300_dev_free,
655622 };
656623 *rchip = NULL;
....@@ -697,7 +664,7 @@
697664 return -EBUSY;
698665 }
699666 chip->irq = pci->irq;
700
-
667
+ card->sync_irq = chip->irq;
701668
702669 snd_als300_init(chip);
703670
....@@ -731,7 +698,6 @@
731698 struct snd_als300 *chip = card->private_data;
732699
733700 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
734
- snd_pcm_suspend_all(chip->pcm);
735701 snd_ac97_suspend(chip->ac97);
736702 return 0;
737703 }