forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/sound/pci/rme9652/rme9652.c
....@@ -1,23 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ALSA driver for RME Digi9652 audio interfaces
34 *
45 * Copyright (c) 1999 IEM - Winfried Ritsch
56 * 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
- *
217 */
228
239 #include <linux/delay.h>
....@@ -243,7 +229,7 @@
243229 int last_spdif_sample_rate; /* so that we can catch externally ... */
244230 int last_adat_sample_rate; /* ... induced rate changes */
245231
246
- char *channel_map;
232
+ const signed char *channel_map;
247233
248234 struct snd_card *card;
249235 struct snd_pcm *pcm;
....@@ -260,12 +246,12 @@
260246 where the data for that channel can be read/written from/to.
261247 */
262248
263
-static char channel_map_9652_ss[26] = {
249
+static const signed char channel_map_9652_ss[26] = {
264250 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
265251 18, 19, 20, 21, 22, 23, 24, 25
266252 };
267253
268
-static char channel_map_9636_ss[26] = {
254
+static const signed char channel_map_9636_ss[26] = {
269255 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
270256 /* channels 16 and 17 are S/PDIF */
271257 24, 25,
....@@ -273,7 +259,7 @@
273259 -1, -1, -1, -1, -1, -1, -1, -1
274260 };
275261
276
-static char channel_map_9652_ds[26] = {
262
+static const signed char channel_map_9652_ds[26] = {
277263 /* ADAT channels are remapped */
278264 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
279265 /* channels 12 and 13 are S/PDIF */
....@@ -282,7 +268,7 @@
282268 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
283269 };
284270
285
-static char channel_map_9636_ds[26] = {
271
+static const signed char channel_map_9636_ds[26] = {
286272 /* ADAT channels are remapped */
287273 1, 3, 5, 7, 9, 11, 13, 15,
288274 /* channels 8 and 9 are S/PDIF */
....@@ -293,12 +279,7 @@
293279
294280 static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer *dmab, size_t size)
295281 {
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);
302283 }
303284
304285 static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci)
....@@ -1473,7 +1454,7 @@
14731454
14741455 #endif /* ALSA_HAS_STANDARD_WAY_OF_RETURNING_TIMECODE */
14751456
1476
-static struct snd_kcontrol_new snd_rme9652_controls[] = {
1457
+static const struct snd_kcontrol_new snd_rme9652_controls[] = {
14771458 {
14781459 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
14791460 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
....@@ -1528,10 +1509,10 @@
15281509 RME9652_PASSTHRU("Passthru", 0)
15291510 };
15301511
1531
-static struct snd_kcontrol_new snd_rme9652_adat3_check =
1512
+static const struct snd_kcontrol_new snd_rme9652_adat3_check =
15321513 RME9652_ADAT_SYNC("ADAT3 Sync Check", 0, 2);
15331514
1534
-static struct snd_kcontrol_new snd_rme9652_adat1_input =
1515
+static const struct snd_kcontrol_new snd_rme9652_adat1_input =
15351516 RME9652_ADAT1_IN("ADAT1 Input Source", 0);
15361517
15371518 static int snd_rme9652_create_controls(struct snd_card *card, struct snd_rme9652 *rme9652)
....@@ -1737,10 +1718,8 @@
17371718
17381719 static void snd_rme9652_proc_init(struct snd_rme9652 *rme9652)
17391720 {
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);
17441723 }
17451724
17461725 static void snd_rme9652_free_buffers(struct snd_rme9652 *rme9652)
....@@ -1862,7 +1841,7 @@
18621841 return rme9652_hw_pointer(rme9652);
18631842 }
18641843
1865
-static char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
1844
+static signed char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
18661845 int stream,
18671846 int channel)
18681847
....@@ -1890,7 +1869,7 @@
18901869 void __user *src, unsigned long count)
18911870 {
18921871 struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1893
- char *channel_buf;
1872
+ signed char *channel_buf;
18941873
18951874 if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES))
18961875 return -EINVAL;
....@@ -1910,7 +1889,7 @@
19101889 void *src, unsigned long count)
19111890 {
19121891 struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1913
- char *channel_buf;
1892
+ signed char *channel_buf;
19141893
19151894 channel_buf = rme9652_channel_buffer_location(rme9652,
19161895 substream->pstr->stream,
....@@ -1926,7 +1905,7 @@
19261905 void __user *dst, unsigned long count)
19271906 {
19281907 struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1929
- char *channel_buf;
1908
+ signed char *channel_buf;
19301909
19311910 if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES))
19321911 return -EINVAL;
....@@ -1946,7 +1925,7 @@
19461925 void *dst, unsigned long count)
19471926 {
19481927 struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1949
- char *channel_buf;
1928
+ signed char *channel_buf;
19501929
19511930 channel_buf = rme9652_channel_buffer_location(rme9652,
19521931 substream->pstr->stream,
....@@ -1962,7 +1941,7 @@
19621941 unsigned long count)
19631942 {
19641943 struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
1965
- char *channel_buf;
1944
+ signed char *channel_buf;
19661945
19671946 channel_buf = rme9652_channel_buffer_location (rme9652,
19681947 substream->pstr->stream,
....@@ -2175,13 +2154,12 @@
21752154 {
21762155 struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
21772156 unsigned long flags;
2178
- int result = 0;
21792157
21802158 spin_lock_irqsave(&rme9652->lock, flags);
21812159 if (!rme9652->running)
21822160 rme9652_reset_hw_pointer(rme9652);
21832161 spin_unlock_irqrestore(&rme9652->lock, flags);
2184
- return result;
2162
+ return 0;
21852163 }
21862164
21872165 static const struct snd_pcm_hardware snd_rme9652_playback_subinfo =
....@@ -2489,7 +2467,7 @@
24892467 if ((err = pci_request_regions(pci, "rme9652")) < 0)
24902468 return err;
24912469 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);
24932471 if (rme9652->iobase == NULL) {
24942472 dev_err(card->dev, "unable to remap region 0x%lx-0x%lx\n",
24952473 rme9652->port, rme9652->port + RME9652_IO_EXTENT - 1);
....@@ -2502,6 +2480,7 @@
25022480 return -EBUSY;
25032481 }
25042482 rme9652->irq = pci->irq;
2483
+ card->sync_irq = rme9652->irq;
25052484 rme9652->precise_ptr = precise_ptr;
25062485
25072486 /* Determine the h/w rev level of the card. This seems like