.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
---|
3 | 4 | * Abramo Bagnara <abramo@alsa-project.org> |
---|
.. | .. |
---|
28 | 29 | * references to be able to implement all fancy feutures |
---|
29 | 30 | * supported by the cs46xx DSP's. |
---|
30 | 31 | * Benny <benny@hostmobility.com> |
---|
31 | | - * |
---|
32 | | - * This program is free software; you can redistribute it and/or modify |
---|
33 | | - * it under the terms of the GNU General Public License as published by |
---|
34 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
35 | | - * (at your option) any later version. |
---|
36 | | - * |
---|
37 | | - * This program is distributed in the hope that it will be useful, |
---|
38 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
39 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
40 | | - * GNU General Public License for more details. |
---|
41 | | - * |
---|
42 | | - * You should have received a copy of the GNU General Public License |
---|
43 | | - * along with this program; if not, write to the Free Software |
---|
44 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
45 | | - * |
---|
46 | 32 | */ |
---|
47 | 33 | |
---|
48 | 34 | #include <linux/delay.h> |
---|
.. | .. |
---|
1443 | 1429 | .info = (SNDRV_PCM_INFO_MMAP | |
---|
1444 | 1430 | SNDRV_PCM_INFO_INTERLEAVED | |
---|
1445 | 1431 | SNDRV_PCM_INFO_BLOCK_TRANSFER /*|*/ |
---|
1446 | | - /*SNDRV_PCM_INFO_RESUME*/), |
---|
| 1432 | + /*SNDRV_PCM_INFO_RESUME*/ | |
---|
| 1433 | + SNDRV_PCM_INFO_SYNC_APPLPTR), |
---|
1447 | 1434 | .formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | |
---|
1448 | 1435 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | |
---|
1449 | 1436 | SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE), |
---|
.. | .. |
---|
1465 | 1452 | .info = (SNDRV_PCM_INFO_MMAP | |
---|
1466 | 1453 | SNDRV_PCM_INFO_INTERLEAVED | |
---|
1467 | 1454 | SNDRV_PCM_INFO_BLOCK_TRANSFER /*|*/ |
---|
1468 | | - /*SNDRV_PCM_INFO_RESUME*/), |
---|
| 1455 | + /*SNDRV_PCM_INFO_RESUME*/ | |
---|
| 1456 | + SNDRV_PCM_INFO_SYNC_APPLPTR), |
---|
1469 | 1457 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
---|
1470 | 1458 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
---|
1471 | 1459 | .rate_min = 5500, |
---|
.. | .. |
---|
1506 | 1494 | cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL); |
---|
1507 | 1495 | if (cpcm == NULL) |
---|
1508 | 1496 | return -ENOMEM; |
---|
1509 | | - if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), |
---|
| 1497 | + if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev, |
---|
1510 | 1498 | PAGE_SIZE, &cpcm->hw_buf) < 0) { |
---|
1511 | 1499 | kfree(cpcm); |
---|
1512 | 1500 | return -ENOMEM; |
---|
.. | .. |
---|
1594 | 1582 | { |
---|
1595 | 1583 | struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); |
---|
1596 | 1584 | |
---|
1597 | | - if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), |
---|
| 1585 | + if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev, |
---|
1598 | 1586 | PAGE_SIZE, &chip->capt.hw_buf) < 0) |
---|
1599 | 1587 | return -ENOMEM; |
---|
1600 | 1588 | chip->capt.substream = substream; |
---|
.. | .. |
---|
1657 | 1645 | static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops = { |
---|
1658 | 1646 | .open = snd_cs46xx_playback_open_rear, |
---|
1659 | 1647 | .close = snd_cs46xx_playback_close, |
---|
1660 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1661 | 1648 | .hw_params = snd_cs46xx_playback_hw_params, |
---|
1662 | 1649 | .hw_free = snd_cs46xx_playback_hw_free, |
---|
1663 | 1650 | .prepare = snd_cs46xx_playback_prepare, |
---|
.. | .. |
---|
1668 | 1655 | static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = { |
---|
1669 | 1656 | .open = snd_cs46xx_playback_open_rear, |
---|
1670 | 1657 | .close = snd_cs46xx_playback_close, |
---|
1671 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1672 | 1658 | .hw_params = snd_cs46xx_playback_hw_params, |
---|
1673 | 1659 | .hw_free = snd_cs46xx_playback_hw_free, |
---|
1674 | 1660 | .prepare = snd_cs46xx_playback_prepare, |
---|
.. | .. |
---|
1680 | 1666 | static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = { |
---|
1681 | 1667 | .open = snd_cs46xx_playback_open_clfe, |
---|
1682 | 1668 | .close = snd_cs46xx_playback_close, |
---|
1683 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1684 | 1669 | .hw_params = snd_cs46xx_playback_hw_params, |
---|
1685 | 1670 | .hw_free = snd_cs46xx_playback_hw_free, |
---|
1686 | 1671 | .prepare = snd_cs46xx_playback_prepare, |
---|
.. | .. |
---|
1691 | 1676 | static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = { |
---|
1692 | 1677 | .open = snd_cs46xx_playback_open_clfe, |
---|
1693 | 1678 | .close = snd_cs46xx_playback_close, |
---|
1694 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1695 | 1679 | .hw_params = snd_cs46xx_playback_hw_params, |
---|
1696 | 1680 | .hw_free = snd_cs46xx_playback_hw_free, |
---|
1697 | 1681 | .prepare = snd_cs46xx_playback_prepare, |
---|
.. | .. |
---|
1703 | 1687 | static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = { |
---|
1704 | 1688 | .open = snd_cs46xx_playback_open_iec958, |
---|
1705 | 1689 | .close = snd_cs46xx_playback_close_iec958, |
---|
1706 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1707 | 1690 | .hw_params = snd_cs46xx_playback_hw_params, |
---|
1708 | 1691 | .hw_free = snd_cs46xx_playback_hw_free, |
---|
1709 | 1692 | .prepare = snd_cs46xx_playback_prepare, |
---|
.. | .. |
---|
1714 | 1697 | static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = { |
---|
1715 | 1698 | .open = snd_cs46xx_playback_open_iec958, |
---|
1716 | 1699 | .close = snd_cs46xx_playback_close_iec958, |
---|
1717 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1718 | 1700 | .hw_params = snd_cs46xx_playback_hw_params, |
---|
1719 | 1701 | .hw_free = snd_cs46xx_playback_hw_free, |
---|
1720 | 1702 | .prepare = snd_cs46xx_playback_prepare, |
---|
.. | .. |
---|
1728 | 1710 | static const struct snd_pcm_ops snd_cs46xx_playback_ops = { |
---|
1729 | 1711 | .open = snd_cs46xx_playback_open, |
---|
1730 | 1712 | .close = snd_cs46xx_playback_close, |
---|
1731 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1732 | 1713 | .hw_params = snd_cs46xx_playback_hw_params, |
---|
1733 | 1714 | .hw_free = snd_cs46xx_playback_hw_free, |
---|
1734 | 1715 | .prepare = snd_cs46xx_playback_prepare, |
---|
.. | .. |
---|
1739 | 1720 | static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = { |
---|
1740 | 1721 | .open = snd_cs46xx_playback_open, |
---|
1741 | 1722 | .close = snd_cs46xx_playback_close, |
---|
1742 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1743 | 1723 | .hw_params = snd_cs46xx_playback_hw_params, |
---|
1744 | 1724 | .hw_free = snd_cs46xx_playback_hw_free, |
---|
1745 | 1725 | .prepare = snd_cs46xx_playback_prepare, |
---|
.. | .. |
---|
1751 | 1731 | static const struct snd_pcm_ops snd_cs46xx_capture_ops = { |
---|
1752 | 1732 | .open = snd_cs46xx_capture_open, |
---|
1753 | 1733 | .close = snd_cs46xx_capture_close, |
---|
1754 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1755 | 1734 | .hw_params = snd_cs46xx_capture_hw_params, |
---|
1756 | 1735 | .hw_free = snd_cs46xx_capture_hw_free, |
---|
1757 | 1736 | .prepare = snd_cs46xx_capture_prepare, |
---|
.. | .. |
---|
1762 | 1741 | static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = { |
---|
1763 | 1742 | .open = snd_cs46xx_capture_open, |
---|
1764 | 1743 | .close = snd_cs46xx_capture_close, |
---|
1765 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1766 | 1744 | .hw_params = snd_cs46xx_capture_hw_params, |
---|
1767 | 1745 | .hw_free = snd_cs46xx_capture_hw_free, |
---|
1768 | 1746 | .prepare = snd_cs46xx_capture_prepare, |
---|
.. | .. |
---|
1796 | 1774 | chip->pcm = pcm; |
---|
1797 | 1775 | |
---|
1798 | 1776 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
1799 | | - snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
---|
| 1777 | + &chip->pci->dev, |
---|
| 1778 | + 64*1024, 256*1024); |
---|
1800 | 1779 | |
---|
1801 | 1780 | return 0; |
---|
1802 | 1781 | } |
---|
.. | .. |
---|
1821 | 1800 | chip->pcm_rear = pcm; |
---|
1822 | 1801 | |
---|
1823 | 1802 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
1824 | | - snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
---|
| 1803 | + &chip->pci->dev, |
---|
| 1804 | + 64*1024, 256*1024); |
---|
1825 | 1805 | |
---|
1826 | 1806 | return 0; |
---|
1827 | 1807 | } |
---|
.. | .. |
---|
1844 | 1824 | chip->pcm_center_lfe = pcm; |
---|
1845 | 1825 | |
---|
1846 | 1826 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
1847 | | - snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
---|
| 1827 | + &chip->pci->dev, |
---|
| 1828 | + 64*1024, 256*1024); |
---|
1848 | 1829 | |
---|
1849 | 1830 | return 0; |
---|
1850 | 1831 | } |
---|
.. | .. |
---|
1867 | 1848 | chip->pcm_iec958 = pcm; |
---|
1868 | 1849 | |
---|
1869 | 1850 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
1870 | | - snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
---|
| 1851 | + &chip->pci->dev, |
---|
| 1852 | + 64*1024, 256*1024); |
---|
1871 | 1853 | |
---|
1872 | 1854 | return 0; |
---|
1873 | 1855 | } |
---|
.. | .. |
---|
2256 | 2238 | #endif /* CONFIG_SND_CS46XX_NEW_DSP */ |
---|
2257 | 2239 | |
---|
2258 | 2240 | |
---|
2259 | | -static struct snd_kcontrol_new snd_cs46xx_controls[] = { |
---|
| 2241 | +static const struct snd_kcontrol_new snd_cs46xx_controls[] = { |
---|
2260 | 2242 | { |
---|
2261 | 2243 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
---|
2262 | 2244 | .name = "DAC Volume", |
---|
.. | .. |
---|
2382 | 2364 | |
---|
2383 | 2365 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
---|
2384 | 2366 | /* Only available on the Hercules Game Theater XP soundcard */ |
---|
2385 | | -static struct snd_kcontrol_new snd_hercules_controls[] = { |
---|
| 2367 | +static const struct snd_kcontrol_new snd_hercules_controls[] = { |
---|
2386 | 2368 | { |
---|
2387 | 2369 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
---|
2388 | 2370 | .name = "Optical/Coaxial SPDIF Input Switch", |
---|
.. | .. |
---|
2483 | 2465 | struct snd_ctl_elem_id id; |
---|
2484 | 2466 | int err; |
---|
2485 | 2467 | unsigned int idx; |
---|
2486 | | - static struct snd_ac97_bus_ops ops = { |
---|
| 2468 | + static const struct snd_ac97_bus_ops ops = { |
---|
2487 | 2469 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
---|
2488 | 2470 | .reset = snd_cs46xx_codec_reset, |
---|
2489 | 2471 | #endif |
---|
.. | .. |
---|
2833 | 2815 | return count; |
---|
2834 | 2816 | } |
---|
2835 | 2817 | |
---|
2836 | | -static struct snd_info_entry_ops snd_cs46xx_proc_io_ops = { |
---|
| 2818 | +static const struct snd_info_entry_ops snd_cs46xx_proc_io_ops = { |
---|
2837 | 2819 | .read = snd_cs46xx_io_read, |
---|
2838 | 2820 | }; |
---|
2839 | 2821 | |
---|
.. | .. |
---|
3763 | 3745 | * APM support |
---|
3764 | 3746 | */ |
---|
3765 | 3747 | #ifdef CONFIG_PM_SLEEP |
---|
3766 | | -static unsigned int saved_regs[] = { |
---|
| 3748 | +static const unsigned int saved_regs[] = { |
---|
3767 | 3749 | BA0_ACOSV, |
---|
3768 | 3750 | /*BA0_ASER_FADDR,*/ |
---|
3769 | 3751 | BA0_ASER_MASTER, |
---|
.. | .. |
---|
3779 | 3761 | |
---|
3780 | 3762 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
---|
3781 | 3763 | chip->in_suspend = 1; |
---|
3782 | | - snd_pcm_suspend_all(chip->pcm); |
---|
3783 | | -#ifdef CONFIG_SND_CS46XX_NEW_DSP |
---|
3784 | | - snd_pcm_suspend_all(chip->pcm_rear); |
---|
3785 | | - snd_pcm_suspend_all(chip->pcm_center_lfe); |
---|
3786 | | - snd_pcm_suspend_all(chip->pcm_iec958); |
---|
3787 | | -#endif |
---|
3788 | 3764 | // chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL); |
---|
3789 | 3765 | // chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE); |
---|
3790 | 3766 | |
---|
.. | .. |
---|
3888 | 3864 | struct snd_cs46xx_region *region; |
---|
3889 | 3865 | struct cs_card_type *cp; |
---|
3890 | 3866 | u16 ss_card, ss_vendor; |
---|
3891 | | - static struct snd_device_ops ops = { |
---|
| 3867 | + static const struct snd_device_ops ops = { |
---|
3892 | 3868 | .dev_free = snd_cs46xx_dev_free, |
---|
3893 | 3869 | }; |
---|
3894 | 3870 | |
---|
.. | .. |
---|
3997 | 3973 | snd_cs46xx_free(chip); |
---|
3998 | 3974 | return -EBUSY; |
---|
3999 | 3975 | } |
---|
4000 | | - region->remap_addr = ioremap_nocache(region->base, region->size); |
---|
| 3976 | + region->remap_addr = ioremap(region->base, region->size); |
---|
4001 | 3977 | if (region->remap_addr == NULL) { |
---|
4002 | 3978 | dev_err(chip->card->dev, |
---|
4003 | 3979 | "%s ioremap problem\n", region->name); |
---|
.. | .. |
---|
4013 | 3989 | return -EBUSY; |
---|
4014 | 3990 | } |
---|
4015 | 3991 | chip->irq = pci->irq; |
---|
| 3992 | + card->sync_irq = chip->irq; |
---|
4016 | 3993 | |
---|
4017 | 3994 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
---|
4018 | 3995 | chip->dsp_spos_instance = cs46xx_dsp_spos_create(chip); |
---|