.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * ALSA driver for RME Digi9652 audio interfaces |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 1999 IEM - Winfried Ritsch |
---|
5 | 6 | * Copyright (c) 1999-2001 Paul Davis |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify |
---|
8 | | - * it under the terms of the GNU General Public License as published by |
---|
9 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
10 | | - * (at your option) any later version. |
---|
11 | | - * |
---|
12 | | - * This program is distributed in the hope that it will be useful, |
---|
13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | | - * GNU General Public License for more details. |
---|
16 | | - * |
---|
17 | | - * You should have received a copy of the GNU General Public License |
---|
18 | | - * along with this program; if not, write to the Free Software |
---|
19 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
20 | | - * |
---|
21 | 7 | */ |
---|
22 | 8 | |
---|
23 | 9 | #include <linux/delay.h> |
---|
.. | .. |
---|
243 | 229 | int last_spdif_sample_rate; /* so that we can catch externally ... */ |
---|
244 | 230 | int last_adat_sample_rate; /* ... induced rate changes */ |
---|
245 | 231 | |
---|
246 | | - char *channel_map; |
---|
| 232 | + const signed char *channel_map; |
---|
247 | 233 | |
---|
248 | 234 | struct snd_card *card; |
---|
249 | 235 | struct snd_pcm *pcm; |
---|
.. | .. |
---|
260 | 246 | where the data for that channel can be read/written from/to. |
---|
261 | 247 | */ |
---|
262 | 248 | |
---|
263 | | -static char channel_map_9652_ss[26] = { |
---|
| 249 | +static const signed char channel_map_9652_ss[26] = { |
---|
264 | 250 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
---|
265 | 251 | 18, 19, 20, 21, 22, 23, 24, 25 |
---|
266 | 252 | }; |
---|
267 | 253 | |
---|
268 | | -static char channel_map_9636_ss[26] = { |
---|
| 254 | +static const signed char channel_map_9636_ss[26] = { |
---|
269 | 255 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
---|
270 | 256 | /* channels 16 and 17 are S/PDIF */ |
---|
271 | 257 | 24, 25, |
---|
.. | .. |
---|
273 | 259 | -1, -1, -1, -1, -1, -1, -1, -1 |
---|
274 | 260 | }; |
---|
275 | 261 | |
---|
276 | | -static char channel_map_9652_ds[26] = { |
---|
| 262 | +static const signed char channel_map_9652_ds[26] = { |
---|
277 | 263 | /* ADAT channels are remapped */ |
---|
278 | 264 | 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, |
---|
279 | 265 | /* channels 12 and 13 are S/PDIF */ |
---|
.. | .. |
---|
282 | 268 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 |
---|
283 | 269 | }; |
---|
284 | 270 | |
---|
285 | | -static char channel_map_9636_ds[26] = { |
---|
| 271 | +static const signed char channel_map_9636_ds[26] = { |
---|
286 | 272 | /* ADAT channels are remapped */ |
---|
287 | 273 | 1, 3, 5, 7, 9, 11, 13, 15, |
---|
288 | 274 | /* channels 8 and 9 are S/PDIF */ |
---|
.. | .. |
---|
293 | 279 | |
---|
294 | 280 | static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer *dmab, size_t size) |
---|
295 | 281 | { |
---|
296 | | - dmab->dev.type = SNDRV_DMA_TYPE_DEV; |
---|
297 | | - dmab->dev.dev = snd_dma_pci_data(pci); |
---|
298 | | - if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), |
---|
299 | | - size, dmab) < 0) |
---|
300 | | - return -ENOMEM; |
---|
301 | | - return 0; |
---|
| 282 | + return snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, size, dmab); |
---|
302 | 283 | } |
---|
303 | 284 | |
---|
304 | 285 | static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci) |
---|
.. | .. |
---|
1473 | 1454 | |
---|
1474 | 1455 | #endif /* ALSA_HAS_STANDARD_WAY_OF_RETURNING_TIMECODE */ |
---|
1475 | 1456 | |
---|
1476 | | -static struct snd_kcontrol_new snd_rme9652_controls[] = { |
---|
| 1457 | +static const struct snd_kcontrol_new snd_rme9652_controls[] = { |
---|
1477 | 1458 | { |
---|
1478 | 1459 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
---|
1479 | 1460 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), |
---|
.. | .. |
---|
1528 | 1509 | RME9652_PASSTHRU("Passthru", 0) |
---|
1529 | 1510 | }; |
---|
1530 | 1511 | |
---|
1531 | | -static struct snd_kcontrol_new snd_rme9652_adat3_check = |
---|
| 1512 | +static const struct snd_kcontrol_new snd_rme9652_adat3_check = |
---|
1532 | 1513 | RME9652_ADAT_SYNC("ADAT3 Sync Check", 0, 2); |
---|
1533 | 1514 | |
---|
1534 | | -static struct snd_kcontrol_new snd_rme9652_adat1_input = |
---|
| 1515 | +static const struct snd_kcontrol_new snd_rme9652_adat1_input = |
---|
1535 | 1516 | RME9652_ADAT1_IN("ADAT1 Input Source", 0); |
---|
1536 | 1517 | |
---|
1537 | 1518 | static int snd_rme9652_create_controls(struct snd_card *card, struct snd_rme9652 *rme9652) |
---|
.. | .. |
---|
1737 | 1718 | |
---|
1738 | 1719 | static void snd_rme9652_proc_init(struct snd_rme9652 *rme9652) |
---|
1739 | 1720 | { |
---|
1740 | | - struct snd_info_entry *entry; |
---|
1741 | | - |
---|
1742 | | - if (! snd_card_proc_new(rme9652->card, "rme9652", &entry)) |
---|
1743 | | - snd_info_set_text_ops(entry, rme9652, snd_rme9652_proc_read); |
---|
| 1721 | + snd_card_ro_proc_new(rme9652->card, "rme9652", rme9652, |
---|
| 1722 | + snd_rme9652_proc_read); |
---|
1744 | 1723 | } |
---|
1745 | 1724 | |
---|
1746 | 1725 | static void snd_rme9652_free_buffers(struct snd_rme9652 *rme9652) |
---|
.. | .. |
---|
1862 | 1841 | return rme9652_hw_pointer(rme9652); |
---|
1863 | 1842 | } |
---|
1864 | 1843 | |
---|
1865 | | -static char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652, |
---|
| 1844 | +static signed char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652, |
---|
1866 | 1845 | int stream, |
---|
1867 | 1846 | int channel) |
---|
1868 | 1847 | |
---|
.. | .. |
---|
1890 | 1869 | void __user *src, unsigned long count) |
---|
1891 | 1870 | { |
---|
1892 | 1871 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
---|
1893 | | - char *channel_buf; |
---|
| 1872 | + signed char *channel_buf; |
---|
1894 | 1873 | |
---|
1895 | 1874 | if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES)) |
---|
1896 | 1875 | return -EINVAL; |
---|
.. | .. |
---|
1910 | 1889 | void *src, unsigned long count) |
---|
1911 | 1890 | { |
---|
1912 | 1891 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
---|
1913 | | - char *channel_buf; |
---|
| 1892 | + signed char *channel_buf; |
---|
1914 | 1893 | |
---|
1915 | 1894 | channel_buf = rme9652_channel_buffer_location(rme9652, |
---|
1916 | 1895 | substream->pstr->stream, |
---|
.. | .. |
---|
1926 | 1905 | void __user *dst, unsigned long count) |
---|
1927 | 1906 | { |
---|
1928 | 1907 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
---|
1929 | | - char *channel_buf; |
---|
| 1908 | + signed char *channel_buf; |
---|
1930 | 1909 | |
---|
1931 | 1910 | if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES)) |
---|
1932 | 1911 | return -EINVAL; |
---|
.. | .. |
---|
1946 | 1925 | void *dst, unsigned long count) |
---|
1947 | 1926 | { |
---|
1948 | 1927 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
---|
1949 | | - char *channel_buf; |
---|
| 1928 | + signed char *channel_buf; |
---|
1950 | 1929 | |
---|
1951 | 1930 | channel_buf = rme9652_channel_buffer_location(rme9652, |
---|
1952 | 1931 | substream->pstr->stream, |
---|
.. | .. |
---|
1962 | 1941 | unsigned long count) |
---|
1963 | 1942 | { |
---|
1964 | 1943 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
---|
1965 | | - char *channel_buf; |
---|
| 1944 | + signed char *channel_buf; |
---|
1966 | 1945 | |
---|
1967 | 1946 | channel_buf = rme9652_channel_buffer_location (rme9652, |
---|
1968 | 1947 | substream->pstr->stream, |
---|
.. | .. |
---|
2175 | 2154 | { |
---|
2176 | 2155 | struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); |
---|
2177 | 2156 | unsigned long flags; |
---|
2178 | | - int result = 0; |
---|
2179 | 2157 | |
---|
2180 | 2158 | spin_lock_irqsave(&rme9652->lock, flags); |
---|
2181 | 2159 | if (!rme9652->running) |
---|
2182 | 2160 | rme9652_reset_hw_pointer(rme9652); |
---|
2183 | 2161 | spin_unlock_irqrestore(&rme9652->lock, flags); |
---|
2184 | | - return result; |
---|
| 2162 | + return 0; |
---|
2185 | 2163 | } |
---|
2186 | 2164 | |
---|
2187 | 2165 | static const struct snd_pcm_hardware snd_rme9652_playback_subinfo = |
---|
.. | .. |
---|
2489 | 2467 | if ((err = pci_request_regions(pci, "rme9652")) < 0) |
---|
2490 | 2468 | return err; |
---|
2491 | 2469 | rme9652->port = pci_resource_start(pci, 0); |
---|
2492 | | - rme9652->iobase = ioremap_nocache(rme9652->port, RME9652_IO_EXTENT); |
---|
| 2470 | + rme9652->iobase = ioremap(rme9652->port, RME9652_IO_EXTENT); |
---|
2493 | 2471 | if (rme9652->iobase == NULL) { |
---|
2494 | 2472 | dev_err(card->dev, "unable to remap region 0x%lx-0x%lx\n", |
---|
2495 | 2473 | rme9652->port, rme9652->port + RME9652_IO_EXTENT - 1); |
---|
.. | .. |
---|
2502 | 2480 | return -EBUSY; |
---|
2503 | 2481 | } |
---|
2504 | 2482 | rme9652->irq = pci->irq; |
---|
| 2483 | + card->sync_irq = rme9652->irq; |
---|
2505 | 2484 | rme9652->precise_ptr = precise_ptr; |
---|
2506 | 2485 | |
---|
2507 | 2486 | /* Determine the h/w rev level of the card. This seems like |
---|