.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * ALSA driver for ICEnsemble ICE1712 (Envy24) |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program; if not, write to the Free Software |
---|
18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
19 | | - * |
---|
20 | 6 | */ |
---|
21 | 7 | |
---|
22 | 8 | /* |
---|
.. | .. |
---|
494 | 480 | |
---|
495 | 481 | |
---|
496 | 482 | /* |
---|
497 | | - * PCM part - misc |
---|
498 | | - */ |
---|
499 | | - |
---|
500 | | -static int snd_ice1712_hw_params(struct snd_pcm_substream *substream, |
---|
501 | | - struct snd_pcm_hw_params *hw_params) |
---|
502 | | -{ |
---|
503 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
---|
504 | | -} |
---|
505 | | - |
---|
506 | | -static int snd_ice1712_hw_free(struct snd_pcm_substream *substream) |
---|
507 | | -{ |
---|
508 | | - return snd_pcm_lib_free_pages(substream); |
---|
509 | | -} |
---|
510 | | - |
---|
511 | | -/* |
---|
512 | 483 | * PCM part - consumer I/O |
---|
513 | 484 | */ |
---|
514 | 485 | |
---|
.. | .. |
---|
850 | 821 | static const struct snd_pcm_ops snd_ice1712_playback_ops = { |
---|
851 | 822 | .open = snd_ice1712_playback_open, |
---|
852 | 823 | .close = snd_ice1712_playback_close, |
---|
853 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
854 | | - .hw_params = snd_ice1712_hw_params, |
---|
855 | | - .hw_free = snd_ice1712_hw_free, |
---|
856 | 824 | .prepare = snd_ice1712_playback_prepare, |
---|
857 | 825 | .trigger = snd_ice1712_playback_trigger, |
---|
858 | 826 | .pointer = snd_ice1712_playback_pointer, |
---|
.. | .. |
---|
861 | 829 | static const struct snd_pcm_ops snd_ice1712_playback_ds_ops = { |
---|
862 | 830 | .open = snd_ice1712_playback_ds_open, |
---|
863 | 831 | .close = snd_ice1712_playback_ds_close, |
---|
864 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
865 | | - .hw_params = snd_ice1712_hw_params, |
---|
866 | | - .hw_free = snd_ice1712_hw_free, |
---|
867 | 832 | .prepare = snd_ice1712_playback_ds_prepare, |
---|
868 | 833 | .trigger = snd_ice1712_playback_ds_trigger, |
---|
869 | 834 | .pointer = snd_ice1712_playback_ds_pointer, |
---|
.. | .. |
---|
872 | 837 | static const struct snd_pcm_ops snd_ice1712_capture_ops = { |
---|
873 | 838 | .open = snd_ice1712_capture_open, |
---|
874 | 839 | .close = snd_ice1712_capture_close, |
---|
875 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
876 | | - .hw_params = snd_ice1712_hw_params, |
---|
877 | | - .hw_free = snd_ice1712_hw_free, |
---|
878 | 840 | .prepare = snd_ice1712_capture_prepare, |
---|
879 | 841 | .trigger = snd_ice1712_capture_trigger, |
---|
880 | 842 | .pointer = snd_ice1712_capture_pointer, |
---|
.. | .. |
---|
897 | 859 | strcpy(pcm->name, "ICE1712 consumer"); |
---|
898 | 860 | ice->pcm = pcm; |
---|
899 | 861 | |
---|
900 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
901 | | - snd_dma_pci_data(ice->pci), 64*1024, 64*1024); |
---|
| 862 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
| 863 | + &ice->pci->dev, 64*1024, 64*1024); |
---|
902 | 864 | |
---|
903 | 865 | dev_warn(ice->card->dev, |
---|
904 | 866 | "Consumer PCM code does not work well at the moment --jk\n"); |
---|
.. | .. |
---|
922 | 884 | strcpy(pcm->name, "ICE1712 consumer (DS)"); |
---|
923 | 885 | ice->pcm_ds = pcm; |
---|
924 | 886 | |
---|
925 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
926 | | - snd_dma_pci_data(ice->pci), 64*1024, 128*1024); |
---|
| 887 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
| 888 | + &ice->pci->dev, 64*1024, 128*1024); |
---|
927 | 889 | |
---|
928 | 890 | return 0; |
---|
929 | 891 | } |
---|
.. | .. |
---|
1075 | 1037 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
---|
1076 | 1038 | |
---|
1077 | 1039 | snd_ice1712_set_pro_rate(ice, params_rate(hw_params), 0); |
---|
1078 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
---|
| 1040 | + return 0; |
---|
1079 | 1041 | } |
---|
1080 | 1042 | |
---|
1081 | 1043 | static int snd_ice1712_capture_pro_prepare(struct snd_pcm_substream *substream) |
---|
.. | .. |
---|
1097 | 1059 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
---|
1098 | 1060 | |
---|
1099 | 1061 | snd_ice1712_set_pro_rate(ice, params_rate(hw_params), 0); |
---|
1100 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
---|
| 1062 | + return 0; |
---|
1101 | 1063 | } |
---|
1102 | 1064 | |
---|
1103 | 1065 | static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substream *substream) |
---|
.. | .. |
---|
1231 | 1193 | static const struct snd_pcm_ops snd_ice1712_playback_pro_ops = { |
---|
1232 | 1194 | .open = snd_ice1712_playback_pro_open, |
---|
1233 | 1195 | .close = snd_ice1712_playback_pro_close, |
---|
1234 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1235 | 1196 | .hw_params = snd_ice1712_playback_pro_hw_params, |
---|
1236 | | - .hw_free = snd_ice1712_hw_free, |
---|
1237 | 1197 | .prepare = snd_ice1712_playback_pro_prepare, |
---|
1238 | 1198 | .trigger = snd_ice1712_pro_trigger, |
---|
1239 | 1199 | .pointer = snd_ice1712_playback_pro_pointer, |
---|
.. | .. |
---|
1242 | 1202 | static const struct snd_pcm_ops snd_ice1712_capture_pro_ops = { |
---|
1243 | 1203 | .open = snd_ice1712_capture_pro_open, |
---|
1244 | 1204 | .close = snd_ice1712_capture_pro_close, |
---|
1245 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1246 | 1205 | .hw_params = snd_ice1712_capture_pro_hw_params, |
---|
1247 | | - .hw_free = snd_ice1712_hw_free, |
---|
1248 | 1206 | .prepare = snd_ice1712_capture_pro_prepare, |
---|
1249 | 1207 | .trigger = snd_ice1712_pro_trigger, |
---|
1250 | 1208 | .pointer = snd_ice1712_capture_pro_pointer, |
---|
.. | .. |
---|
1266 | 1224 | pcm->info_flags = 0; |
---|
1267 | 1225 | strcpy(pcm->name, "ICE1712 multi"); |
---|
1268 | 1226 | |
---|
1269 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
1270 | | - snd_dma_pci_data(ice->pci), 256*1024, 256*1024); |
---|
| 1227 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
| 1228 | + &ice->pci->dev, 256*1024, 256*1024); |
---|
1271 | 1229 | |
---|
1272 | 1230 | ice->pcm_pro = pcm; |
---|
1273 | 1231 | |
---|
.. | .. |
---|
1377 | 1335 | |
---|
1378 | 1336 | static const DECLARE_TLV_DB_SCALE(db_scale_playback, -14400, 150, 0); |
---|
1379 | 1337 | |
---|
1380 | | -static struct snd_kcontrol_new snd_ice1712_multi_playback_ctrls[] = { |
---|
| 1338 | +static const struct snd_kcontrol_new snd_ice1712_multi_playback_ctrls[] = { |
---|
1381 | 1339 | { |
---|
1382 | 1340 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
---|
1383 | 1341 | .name = "Multi Playback Switch", |
---|
.. | .. |
---|
1506 | 1464 | int err, bus_num = 0; |
---|
1507 | 1465 | struct snd_ac97_template ac97; |
---|
1508 | 1466 | struct snd_ac97_bus *pbus; |
---|
1509 | | - static struct snd_ac97_bus_ops con_ops = { |
---|
| 1467 | + static const struct snd_ac97_bus_ops con_ops = { |
---|
1510 | 1468 | .write = snd_ice1712_ac97_write, |
---|
1511 | 1469 | .read = snd_ice1712_ac97_read, |
---|
1512 | 1470 | }; |
---|
1513 | | - static struct snd_ac97_bus_ops pro_ops = { |
---|
| 1471 | + static const struct snd_ac97_bus_ops pro_ops = { |
---|
1514 | 1472 | .write = snd_ice1712_pro_ac97_write, |
---|
1515 | 1473 | .read = snd_ice1712_pro_ac97_read, |
---|
1516 | 1474 | }; |
---|
.. | .. |
---|
1603 | 1561 | |
---|
1604 | 1562 | static void snd_ice1712_proc_init(struct snd_ice1712 *ice) |
---|
1605 | 1563 | { |
---|
1606 | | - struct snd_info_entry *entry; |
---|
1607 | | - |
---|
1608 | | - if (!snd_card_proc_new(ice->card, "ice1712", &entry)) |
---|
1609 | | - snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read); |
---|
| 1564 | + snd_card_ro_proc_new(ice->card, "ice1712", ice, snd_ice1712_proc_read); |
---|
1610 | 1565 | } |
---|
1611 | 1566 | |
---|
1612 | 1567 | /* |
---|
.. | .. |
---|
2263 | 2218 | /* |
---|
2264 | 2219 | * list of available boards |
---|
2265 | 2220 | */ |
---|
2266 | | -static struct snd_ice1712_card_info *card_tables[] = { |
---|
| 2221 | +static const struct snd_ice1712_card_info *card_tables[] = { |
---|
2267 | 2222 | snd_ice1712_hoontech_cards, |
---|
2268 | 2223 | snd_ice1712_delta_cards, |
---|
2269 | 2224 | snd_ice1712_ews_cards, |
---|
.. | .. |
---|
2287 | 2242 | { |
---|
2288 | 2243 | int dev = ICE_I2C_EEPROM_ADDR; /* I2C EEPROM device address */ |
---|
2289 | 2244 | unsigned int i, size; |
---|
2290 | | - struct snd_ice1712_card_info * const *tbl, *c; |
---|
| 2245 | + const struct snd_ice1712_card_info * const *tbl, *c; |
---|
2291 | 2246 | |
---|
2292 | 2247 | if (!modelname || !*modelname) { |
---|
2293 | 2248 | ice->eeprom.subvendor = 0; |
---|
.. | .. |
---|
2520 | 2475 | { |
---|
2521 | 2476 | struct snd_ice1712 *ice; |
---|
2522 | 2477 | int err; |
---|
2523 | | - static struct snd_device_ops ops = { |
---|
| 2478 | + static const struct snd_device_ops ops = { |
---|
2524 | 2479 | .dev_free = snd_ice1712_dev_free, |
---|
2525 | 2480 | }; |
---|
2526 | 2481 | |
---|
.. | .. |
---|
2574 | 2529 | pci_write_config_word(ice->pci, 0x40, 0x807f); |
---|
2575 | 2530 | pci_write_config_word(ice->pci, 0x42, 0x0006); |
---|
2576 | 2531 | snd_ice1712_proc_init(ice); |
---|
2577 | | - synchronize_irq(pci->irq); |
---|
2578 | 2532 | |
---|
2579 | 2533 | card->private_data = ice; |
---|
2580 | 2534 | |
---|
.. | .. |
---|
2597 | 2551 | } |
---|
2598 | 2552 | |
---|
2599 | 2553 | ice->irq = pci->irq; |
---|
| 2554 | + card->sync_irq = ice->irq; |
---|
2600 | 2555 | |
---|
2601 | 2556 | if (snd_ice1712_read_eeprom(ice, modelname) < 0) { |
---|
2602 | 2557 | snd_ice1712_free(ice); |
---|
.. | .. |
---|
2633 | 2588 | struct snd_card *card; |
---|
2634 | 2589 | struct snd_ice1712 *ice; |
---|
2635 | 2590 | int pcm_dev = 0, err; |
---|
2636 | | - struct snd_ice1712_card_info * const *tbl, *c; |
---|
| 2591 | + const struct snd_ice1712_card_info * const *tbl, *c; |
---|
2637 | 2592 | |
---|
2638 | 2593 | if (dev >= SNDRV_CARDS) |
---|
2639 | 2594 | return -ENODEV; |
---|
.. | .. |
---|
2793 | 2748 | |
---|
2794 | 2749 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
---|
2795 | 2750 | |
---|
2796 | | - snd_pcm_suspend_all(ice->pcm); |
---|
2797 | | - snd_pcm_suspend_all(ice->pcm_pro); |
---|
2798 | | - snd_pcm_suspend_all(ice->pcm_ds); |
---|
2799 | 2751 | snd_ac97_suspend(ice->ac97); |
---|
2800 | 2752 | |
---|
2801 | 2753 | spin_lock_irq(&ice->reg_lock); |
---|