| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for ESS Maestro3/Allegro (ES1988) soundcards. |
|---|
| 3 | 4 | * Copyright (c) 2000 by Zach Brown <zab@zabbo.net> |
|---|
| .. | .. |
|---|
| 6 | 7 | * Most of the hardware init stuffs are based on maestro3 driver for |
|---|
| 7 | 8 | * OSS/Free by Zach Brown. Many thanks to Zach! |
|---|
| 8 | 9 | * |
|---|
| 9 | | - * This program 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 22 | | - * |
|---|
| 23 | | - * |
|---|
| 24 | 10 | * ChangeLog: |
|---|
| 25 | 11 | * Aug. 27, 2001 |
|---|
| 26 | 12 | * - Fixed deadlock on capture |
|---|
| 27 | 13 | * - Added Canyon3D-2 support by Rob Riggs <rob@pangalactic.org> |
|---|
| 28 | | - * |
|---|
| 29 | 14 | */ |
|---|
| 30 | 15 | |
|---|
| 31 | 16 | #define CARD_NAME "ESS Maestro3/Allegro/Canyon3D-2" |
|---|
| .. | .. |
|---|
| 822 | 807 | |
|---|
| 823 | 808 | MODULE_DEVICE_TABLE(pci, snd_m3_ids); |
|---|
| 824 | 809 | |
|---|
| 825 | | -static struct snd_pci_quirk m3_amp_quirk_list[] = { |
|---|
| 810 | +static const struct snd_pci_quirk m3_amp_quirk_list[] = { |
|---|
| 826 | 811 | SND_PCI_QUIRK(0x0E11, 0x0094, "Compaq Evo N600c", 0x0c), |
|---|
| 827 | 812 | SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d), |
|---|
| 828 | 813 | SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d), |
|---|
| .. | .. |
|---|
| 831 | 816 | { } /* END */ |
|---|
| 832 | 817 | }; |
|---|
| 833 | 818 | |
|---|
| 834 | | -static struct snd_pci_quirk m3_irda_quirk_list[] = { |
|---|
| 819 | +static const struct snd_pci_quirk m3_irda_quirk_list[] = { |
|---|
| 835 | 820 | SND_PCI_QUIRK(0x1028, 0x00b0, "Dell Inspiron 4000", 1), |
|---|
| 836 | 821 | SND_PCI_QUIRK(0x1028, 0x00a4, "Dell Inspiron 8000", 1), |
|---|
| 837 | 822 | SND_PCI_QUIRK(0x1028, 0x00e6, "Dell Inspiron 8100", 1), |
|---|
| .. | .. |
|---|
| 839 | 824 | }; |
|---|
| 840 | 825 | |
|---|
| 841 | 826 | /* hardware volume quirks */ |
|---|
| 842 | | -static struct snd_pci_quirk m3_hv_quirk_list[] = { |
|---|
| 827 | +static const struct snd_pci_quirk m3_hv_quirk_list[] = { |
|---|
| 843 | 828 | /* Allegro chips */ |
|---|
| 844 | 829 | SND_PCI_QUIRK(0x0E11, 0x002E, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD), |
|---|
| 845 | 830 | SND_PCI_QUIRK(0x0E11, 0x0094, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD), |
|---|
| .. | .. |
|---|
| 917 | 902 | }; |
|---|
| 918 | 903 | |
|---|
| 919 | 904 | /* HP Omnibook quirks */ |
|---|
| 920 | | -static struct snd_pci_quirk m3_omnibook_quirk_list[] = { |
|---|
| 905 | +static const struct snd_pci_quirk m3_omnibook_quirk_list[] = { |
|---|
| 921 | 906 | SND_PCI_QUIRK_ID(0x103c, 0x0010), /* HP OmniBook 6000 */ |
|---|
| 922 | 907 | SND_PCI_QUIRK_ID(0x103c, 0x0011), /* HP OmniBook 500 */ |
|---|
| 923 | 908 | { } /* END */ |
|---|
| .. | .. |
|---|
| 1396 | 1381 | struct snd_pcm_hw_params *hw_params) |
|---|
| 1397 | 1382 | { |
|---|
| 1398 | 1383 | struct m3_dma *s = substream->runtime->private_data; |
|---|
| 1399 | | - int err; |
|---|
| 1400 | 1384 | |
|---|
| 1401 | | - if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) |
|---|
| 1402 | | - return err; |
|---|
| 1403 | 1385 | /* set buffer address */ |
|---|
| 1404 | 1386 | s->buffer_addr = substream->runtime->dma_addr; |
|---|
| 1405 | 1387 | if (s->buffer_addr & 0x3) { |
|---|
| .. | .. |
|---|
| 1416 | 1398 | if (substream->runtime->private_data == NULL) |
|---|
| 1417 | 1399 | return 0; |
|---|
| 1418 | 1400 | s = substream->runtime->private_data; |
|---|
| 1419 | | - snd_pcm_lib_free_pages(substream); |
|---|
| 1420 | 1401 | s->buffer_addr = 0; |
|---|
| 1421 | 1402 | return 0; |
|---|
| 1422 | 1403 | } |
|---|
| .. | .. |
|---|
| 1837 | 1818 | static const struct snd_pcm_ops snd_m3_playback_ops = { |
|---|
| 1838 | 1819 | .open = snd_m3_playback_open, |
|---|
| 1839 | 1820 | .close = snd_m3_playback_close, |
|---|
| 1840 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 1841 | 1821 | .hw_params = snd_m3_pcm_hw_params, |
|---|
| 1842 | 1822 | .hw_free = snd_m3_pcm_hw_free, |
|---|
| 1843 | 1823 | .prepare = snd_m3_pcm_prepare, |
|---|
| .. | .. |
|---|
| 1848 | 1828 | static const struct snd_pcm_ops snd_m3_capture_ops = { |
|---|
| 1849 | 1829 | .open = snd_m3_capture_open, |
|---|
| 1850 | 1830 | .close = snd_m3_capture_close, |
|---|
| 1851 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 1852 | 1831 | .hw_params = snd_m3_pcm_hw_params, |
|---|
| 1853 | 1832 | .hw_free = snd_m3_pcm_hw_free, |
|---|
| 1854 | 1833 | .prepare = snd_m3_pcm_prepare, |
|---|
| .. | .. |
|---|
| 1875 | 1854 | strcpy(pcm->name, chip->card->driver); |
|---|
| 1876 | 1855 | chip->pcm = pcm; |
|---|
| 1877 | 1856 | |
|---|
| 1878 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 1879 | | - snd_dma_pci_data(chip->pci), 64*1024, 64*1024); |
|---|
| 1857 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 1858 | + &chip->pci->dev, 64*1024, 64*1024); |
|---|
| 1880 | 1859 | |
|---|
| 1881 | 1860 | return 0; |
|---|
| 1882 | 1861 | } |
|---|
| .. | .. |
|---|
| 2057 | 2036 | struct snd_ctl_elem_id elem_id; |
|---|
| 2058 | 2037 | #endif |
|---|
| 2059 | 2038 | int err; |
|---|
| 2060 | | - static struct snd_ac97_bus_ops ops = { |
|---|
| 2039 | + static const struct snd_ac97_bus_ops ops = { |
|---|
| 2061 | 2040 | .write = snd_m3_ac97_write, |
|---|
| 2062 | 2041 | .read = snd_m3_ac97_read, |
|---|
| 2063 | 2042 | }; |
|---|
| .. | .. |
|---|
| 2422 | 2401 | chip->in_suspend = 1; |
|---|
| 2423 | 2402 | cancel_work_sync(&chip->hwvol_work); |
|---|
| 2424 | 2403 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
|---|
| 2425 | | - snd_pcm_suspend_all(chip->pcm); |
|---|
| 2426 | 2404 | snd_ac97_suspend(chip->ac97); |
|---|
| 2427 | 2405 | |
|---|
| 2428 | 2406 | msleep(10); /* give the assp a chance to idle.. */ |
|---|
| .. | .. |
|---|
| 2544 | 2522 | struct snd_m3 *chip; |
|---|
| 2545 | 2523 | int i, err; |
|---|
| 2546 | 2524 | const struct snd_pci_quirk *quirk; |
|---|
| 2547 | | - static struct snd_device_ops ops = { |
|---|
| 2525 | + static const struct snd_device_ops ops = { |
|---|
| 2548 | 2526 | .dev_free = snd_m3_dev_free, |
|---|
| 2549 | 2527 | }; |
|---|
| 2550 | 2528 | |
|---|
| .. | .. |
|---|
| 2655 | 2633 | goto free_chip; |
|---|
| 2656 | 2634 | } |
|---|
| 2657 | 2635 | chip->irq = pci->irq; |
|---|
| 2636 | + card->sync_irq = chip->irq; |
|---|
| 2658 | 2637 | |
|---|
| 2659 | 2638 | #ifdef CONFIG_PM_SLEEP |
|---|
| 2660 | 2639 | chip->suspend_mem = |
|---|