.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for Digigram pcxhr compatible soundcards |
---|
3 | 4 | * |
---|
4 | 5 | * main file with alsa callbacks |
---|
5 | 6 | * |
---|
6 | 7 | * Copyright (c) 2004 by Digigram <alsa@digigram.com> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
11 | | - * (at your option) any later version. |
---|
12 | | - * |
---|
13 | | - * This program is distributed in the hope that it will be useful, |
---|
14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | | - * GNU General Public License for more details. |
---|
17 | | - * |
---|
18 | | - * You should have received a copy of the GNU General Public License |
---|
19 | | - * along with this program; if not, write to the Free Software |
---|
20 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
21 | 8 | */ |
---|
22 | 9 | |
---|
23 | 10 | |
---|
.. | .. |
---|
149 | 136 | short fw_file_set; |
---|
150 | 137 | short firmware_num; |
---|
151 | 138 | }; |
---|
152 | | -static struct board_parameters pcxhr_board_params[] = { |
---|
| 139 | +static const struct board_parameters pcxhr_board_params[] = { |
---|
153 | 140 | [PCI_ID_VX882HR] = { "VX882HR", 4, 4, 0, 41 }, |
---|
154 | 141 | [PCI_ID_PCX882HR] = { "PCX882HR", 4, 4, 0, 41 }, |
---|
155 | 142 | [PCI_ID_VX881HR] = { "VX881HR", 4, 4, 0, 41 }, |
---|
.. | .. |
---|
953 | 940 | struct snd_pcxhr *chip = snd_pcm_substream_chip(subs); |
---|
954 | 941 | struct pcxhr_mgr *mgr = chip->mgr; |
---|
955 | 942 | struct pcxhr_stream *stream = subs->runtime->private_data; |
---|
956 | | - snd_pcm_format_t format; |
---|
957 | | - int err; |
---|
958 | | - int channels; |
---|
959 | | - |
---|
960 | | - /* set up channels */ |
---|
961 | | - channels = params_channels(hw); |
---|
962 | | - |
---|
963 | | - /* set up format for the stream */ |
---|
964 | | - format = params_format(hw); |
---|
965 | 943 | |
---|
966 | 944 | mutex_lock(&mgr->setup_mutex); |
---|
967 | 945 | |
---|
968 | | - stream->channels = channels; |
---|
969 | | - stream->format = format; |
---|
970 | | - |
---|
971 | | - /* allocate buffer */ |
---|
972 | | - err = snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw)); |
---|
| 946 | + /* set up channels */ |
---|
| 947 | + stream->channels = params_channels(hw); |
---|
| 948 | + /* set up format for the stream */ |
---|
| 949 | + stream->format = params_format(hw); |
---|
973 | 950 | |
---|
974 | 951 | mutex_unlock(&mgr->setup_mutex); |
---|
975 | 952 | |
---|
976 | | - return err; |
---|
977 | | -} |
---|
978 | | - |
---|
979 | | -static int pcxhr_hw_free(struct snd_pcm_substream *subs) |
---|
980 | | -{ |
---|
981 | | - snd_pcm_lib_free_pages(subs); |
---|
982 | 953 | return 0; |
---|
983 | 954 | } |
---|
984 | 955 | |
---|
.. | .. |
---|
1149 | 1120 | static const struct snd_pcm_ops pcxhr_ops = { |
---|
1150 | 1121 | .open = pcxhr_open, |
---|
1151 | 1122 | .close = pcxhr_close, |
---|
1152 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1153 | 1123 | .prepare = pcxhr_prepare, |
---|
1154 | 1124 | .hw_params = pcxhr_hw_params, |
---|
1155 | | - .hw_free = pcxhr_hw_free, |
---|
1156 | 1125 | .trigger = pcxhr_trigger, |
---|
1157 | 1126 | .pointer = pcxhr_stream_pointer, |
---|
1158 | 1127 | }; |
---|
.. | .. |
---|
1183 | 1152 | pcm->nonatomic = true; |
---|
1184 | 1153 | strcpy(pcm->name, name); |
---|
1185 | 1154 | |
---|
1186 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
1187 | | - snd_dma_pci_data(chip->mgr->pci), |
---|
1188 | | - 32*1024, 32*1024); |
---|
| 1155 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
| 1156 | + &chip->mgr->pci->dev, |
---|
| 1157 | + 32*1024, 32*1024); |
---|
1189 | 1158 | chip->pcm = pcm; |
---|
1190 | 1159 | return 0; |
---|
1191 | 1160 | } |
---|
.. | .. |
---|
1210 | 1179 | { |
---|
1211 | 1180 | int err; |
---|
1212 | 1181 | struct snd_pcxhr *chip; |
---|
1213 | | - static struct snd_device_ops ops = { |
---|
| 1182 | + static const struct snd_device_ops ops = { |
---|
1214 | 1183 | .dev_free = pcxhr_chip_dev_free, |
---|
1215 | 1184 | }; |
---|
1216 | 1185 | |
---|
.. | .. |
---|
1221 | 1190 | chip->card = card; |
---|
1222 | 1191 | chip->chip_idx = idx; |
---|
1223 | 1192 | chip->mgr = mgr; |
---|
| 1193 | + card->sync_irq = mgr->irq; |
---|
1224 | 1194 | |
---|
1225 | 1195 | if (idx < mgr->playback_chips) |
---|
1226 | 1196 | /* stereo or mono streams */ |
---|
.. | .. |
---|
1454 | 1424 | |
---|
1455 | 1425 | static void pcxhr_proc_init(struct snd_pcxhr *chip) |
---|
1456 | 1426 | { |
---|
1457 | | - struct snd_info_entry *entry; |
---|
1458 | | - |
---|
1459 | | - if (! snd_card_proc_new(chip->card, "info", &entry)) |
---|
1460 | | - snd_info_set_text_ops(entry, chip, pcxhr_proc_info); |
---|
1461 | | - if (! snd_card_proc_new(chip->card, "sync", &entry)) |
---|
1462 | | - snd_info_set_text_ops(entry, chip, pcxhr_proc_sync); |
---|
| 1427 | + snd_card_ro_proc_new(chip->card, "info", chip, pcxhr_proc_info); |
---|
| 1428 | + snd_card_ro_proc_new(chip->card, "sync", chip, pcxhr_proc_sync); |
---|
1463 | 1429 | /* gpio available on stereo sound cards only */ |
---|
1464 | | - if (chip->mgr->is_hr_stereo && |
---|
1465 | | - !snd_card_proc_new(chip->card, "gpio", &entry)) { |
---|
1466 | | - snd_info_set_text_ops(entry, chip, pcxhr_proc_gpio_read); |
---|
1467 | | - entry->c.text.write = pcxhr_proc_gpo_write; |
---|
1468 | | - entry->mode |= 0200; |
---|
1469 | | - } |
---|
1470 | | - if (!snd_card_proc_new(chip->card, "ltc", &entry)) |
---|
1471 | | - snd_info_set_text_ops(entry, chip, pcxhr_proc_ltc); |
---|
| 1430 | + if (chip->mgr->is_hr_stereo) |
---|
| 1431 | + snd_card_rw_proc_new(chip->card, "gpio", chip, |
---|
| 1432 | + pcxhr_proc_gpio_read, |
---|
| 1433 | + pcxhr_proc_gpo_write); |
---|
| 1434 | + snd_card_ro_proc_new(chip->card, "ltc", chip, pcxhr_proc_ltc); |
---|
1472 | 1435 | } |
---|
1473 | 1436 | /* end of proc interface */ |
---|
1474 | 1437 | |
---|
.. | .. |
---|
1664 | 1627 | |
---|
1665 | 1628 | /* create hostport purgebuffer */ |
---|
1666 | 1629 | size = PAGE_ALIGN(sizeof(struct pcxhr_hostport)); |
---|
1667 | | - if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), |
---|
| 1630 | + if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, |
---|
1668 | 1631 | size, &mgr->hostport) < 0) { |
---|
1669 | 1632 | pcxhr_free(mgr); |
---|
1670 | 1633 | return -ENOMEM; |
---|