Changeset 629 for GPL/branches/uniaud32-next/alsa-kernel/drivers/dummy.c
- Timestamp:
- Jan 4, 2021, 10:15:17 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/alsa-kernel/drivers/dummy.c
r615 r629 118 118 struct snd_dummy { 119 119 struct snd_card *card; 120 struct dummy_model *model;120 const struct dummy_model *model; 121 121 struct snd_pcm *pcm; 122 122 struct snd_pcm_hardware pcm_hw; … … 145 145 } 146 146 147 static struct dummy_model model_emu10k1 = {147 static const struct dummy_model model_emu10k1 = { 148 148 .name = "emu10k1", 149 149 .playback_constraints = emu10k1_playback_constraints, … … 151 151 }; 152 152 153 static struct dummy_model model_rme9652 = {153 static const struct dummy_model model_rme9652 = { 154 154 .name = "rme9652", 155 155 .buffer_bytes_max = 26 * 64 * 1024, … … 161 161 }; 162 162 163 static struct dummy_model model_ice1712 = {163 static const struct dummy_model model_ice1712 = { 164 164 .name = "ice1712", 165 165 .buffer_bytes_max = 256 * 1024, … … 171 171 }; 172 172 173 static struct dummy_model model_uda1341 = {173 static const struct dummy_model model_uda1341 = { 174 174 .name = "uda1341", 175 175 .buffer_bytes_max = 16380, … … 181 181 }; 182 182 183 static struct dummy_model model_ac97 = {183 static const struct dummy_model model_ac97 = { 184 184 .name = "ac97", 185 185 .formats = SNDRV_PCM_FMTBIT_S16_LE, … … 191 191 }; 192 192 193 static struct dummy_model model_ca0106 = {193 static const struct dummy_model model_ca0106 = { 194 194 .name = "ca0106", 195 195 .formats = SNDRV_PCM_FMTBIT_S16_LE, … … 205 205 }; 206 206 207 static struct dummy_model *dummy_models[] = {207 static const struct dummy_model *dummy_models[] = { 208 208 &model_emu10k1, 209 209 &model_rme9652, … … 530 530 return 0; 531 531 } 532 return snd_pcm_lib_malloc_pages(substream, 533 params_buffer_bytes(hw_params)); 534 } 535 536 static int dummy_pcm_hw_free(struct snd_pcm_substream *substream) 537 { 538 if (fake_buffer) 539 return 0; 540 return snd_pcm_lib_free_pages(substream); 532 return 0; 541 533 } 542 534 … … 544 536 { 545 537 struct snd_dummy *dummy = snd_pcm_substream_chip(substream); 546 struct dummy_model *model = dummy->model;538 const struct dummy_model *model = dummy->model; 547 539 struct snd_pcm_runtime *runtime = substream->runtime; 548 540 const struct dummy_timer_ops *ops; … … 653 645 } 654 646 655 static struct snd_pcm_ops dummy_pcm_ops = {647 static const struct snd_pcm_ops dummy_pcm_ops = { 656 648 .open = dummy_pcm_open, 657 649 .close = dummy_pcm_close, 658 .ioctl = snd_pcm_lib_ioctl,659 650 .hw_params = dummy_pcm_hw_params, 660 .hw_free = dummy_pcm_hw_free,661 651 .prepare = dummy_pcm_prepare, 662 652 .trigger = dummy_pcm_trigger, … … 664 654 }; 665 655 666 static struct snd_pcm_ops dummy_pcm_ops_no_buf = {656 static const struct snd_pcm_ops dummy_pcm_ops_no_buf = { 667 657 .open = dummy_pcm_open, 668 658 .close = dummy_pcm_close, 669 .ioctl = snd_pcm_lib_ioctl,670 659 .hw_params = dummy_pcm_hw_params, 671 .hw_free = dummy_pcm_hw_free,672 660 .prepare = dummy_pcm_prepare, 673 661 .trigger = dummy_pcm_trigger, … … 683 671 { 684 672 struct snd_pcm *pcm; 685 struct snd_pcm_ops *ops;673 const struct snd_pcm_ops *ops; 686 674 int err; 687 675 … … 701 689 strcpy(pcm->name, "Dummy PCM"); 702 690 if (!fake_buffer) { 703 snd_pcm_ lib_preallocate_pages_for_all(pcm,691 snd_pcm_set_managed_buffer_all(pcm, 704 692 SNDRV_DMA_TYPE_CONTINUOUS, 705 snd_dma_continuous_data(GFP_KERNEL),693 NULL, 706 694 0, 64*1024); 707 695 } … … 862 850 } 863 851 864 static struct snd_kcontrol_new snd_dummy_controls[] = {852 static const struct snd_kcontrol_new snd_dummy_controls[] = { 865 853 DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER), 866 854 DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER), … … 914 902 struct snd_info_buffer *buffer) 915 903 { 916 int i;917 918 for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {919 if (dummy->pcm_hw.formats & (1ULL <<i))904 snd_pcm_format_t i; 905 906 pcm_for_each_format(i) { 907 if (dummy->pcm_hw.formats & pcm_format_to_bits(i)) 920 908 snd_iprintf(buffer, " %s", snd_pcm_format_name(i)); 921 909 } … … 925 913 struct snd_info_buffer *buffer) 926 914 { 927 static int rates[] = {915 static const int rates[] = { 928 916 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 929 917 64000, 88200, 96000, 176400, 192000, … … 957 945 .size = sizeof(dummy_pcm_hardware.item) } 958 946 959 static struct dummy_hw_field fields[] = {947 static const struct dummy_hw_field fields[] = { 960 948 FIELD_ENTRY(formats, "%#llx"), 961 949 FIELD_ENTRY(rates, "%#x"), … … 1035 1023 struct snd_card *card; 1036 1024 struct snd_dummy *dummy; 1037 struct dummy_model *m = NULL, **mdl;1025 const struct dummy_model *m = NULL, **mdl; 1038 1026 int idx, err; 1039 1027 int dev = devptr->id;
Note:
See TracChangeset
for help on using the changeset viewer.