Changeset 679 for GPL/trunk/alsa-kernel/pci/cs46xx
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (5 years ago)
- Location:
- GPL/trunk
- Files:
-
- 7 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *5 *6 * This program is free software; you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation; either version 2 of the License, or9 * (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 of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with this program; if not, write to the Free Software18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19 *20 5 */ 21 6 … … 26 11 */ 27 12 13 #ifdef TARGET_OS2 14 #define KBUILD_MODNAME "cs46xx" 15 #endif 28 16 #include <linux/pci.h> 29 17 #include <linux/time.h> 30 18 #include <linux/init.h> 31 #include <linux/module param.h>19 #include <linux/module.h> 32 20 #include <sound/core.h> 33 #include <sound/cs46xx.h>21 #include "cs46xx.h" 34 22 #include <sound/initval.h> 35 23 … … 47 35 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48 36 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */50 static intexternal_amp[SNDRV_CARDS];51 static intthinkpad[SNDRV_CARDS];37 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 38 static bool external_amp[SNDRV_CARDS]; 39 static bool thinkpad[SNDRV_CARDS]; 52 40 #ifndef TARGET_OS2 53 static intmmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};41 static bool mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 54 42 #else 55 static intmmap_valid[SNDRV_CARDS] = {1,1,1,1,1,1,1,1};43 static bool mmap_valid[SNDRV_CARDS] = {1,1,1,1,1,1,1,1}; 56 44 #endif 45 57 46 module_param_array(index, int, NULL, 0444); 58 47 MODULE_PARM_DESC(index, "Index value for the CS46xx soundcard."); … … 62 51 MODULE_PARM_DESC(enable, "Enable CS46xx soundcard."); 63 52 module_param_array(external_amp, bool, NULL, 0444); 64 MODULE_PARM_DESC(external_amp, "Force to enable external amplif er.");53 MODULE_PARM_DESC(external_amp, "Force to enable external amplifier."); 65 54 module_param_array(thinkpad, bool, NULL, 0444); 66 55 MODULE_PARM_DESC(thinkpad, "Force to enable Thinkpad's CLKRUN control."); … … 68 57 MODULE_PARM_DESC(mmap_valid, "Support OSS mmap."); 69 58 70 static DEFINE_PCI_DEVICE_TABLE(snd_cs46xx_ids)= {59 static const struct pci_device_id snd_cs46xx_ids[] = { 71 60 { PCI_VDEVICE(CIRRUS, 0x6001), 0, }, /* CS4280 */ 72 61 { PCI_VDEVICE(CIRRUS, 0x6003), 0, }, /* CS4612 */ … … 77 66 MODULE_DEVICE_TABLE(pci, snd_cs46xx_ids); 78 67 79 static int __devinitsnd_card_cs46xx_probe(struct pci_dev *pci,80 68 static int snd_card_cs46xx_probe(struct pci_dev *pci, 69 const struct pci_device_id *pci_id) 81 70 { 82 71 static int dev; … … 92 81 } 93 82 94 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 83 err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 84 0, &card); 95 85 if (err < 0) 96 86 return err; … … 103 93 card->private_data = chip; 104 94 chip->accept_valid = mmap_valid[dev]; 105 if ((err = snd_cs46xx_pcm(chip, 0 , NULL)) < 0) {95 if ((err = snd_cs46xx_pcm(chip, 0)) < 0) { 106 96 snd_card_free(card); 107 97 return err; 108 98 } 109 99 #ifdef CONFIG_SND_CS46XX_NEW_DSP 110 if ((err = snd_cs46xx_pcm_rear(chip, 1, NULL)) < 0) {100 if ((err = snd_cs46xx_pcm_rear(chip, 1)) < 0) { 111 101 snd_card_free(card); 112 102 return err; 113 103 } 114 if ((err = snd_cs46xx_pcm_iec958(chip, 2,NULL)) < 0) {104 if ((err = snd_cs46xx_pcm_iec958(chip, 2)) < 0) { 115 105 snd_card_free(card); 116 106 return err; … … 123 113 #ifdef CONFIG_SND_CS46XX_NEW_DSP 124 114 if (chip->nr_ac97_codecs ==2) { 125 if ((err = snd_cs46xx_pcm_center_lfe(chip, 3,NULL)) < 0) {115 if ((err = snd_cs46xx_pcm_center_lfe(chip, 3)) < 0) { 126 116 snd_card_free(card); 127 117 return err; … … 129 119 } 130 120 #endif 131 if ((err = snd_cs46xx_midi(chip, 0 , NULL)) < 0) {121 if ((err = snd_cs46xx_midi(chip, 0)) < 0) { 132 122 snd_card_free(card); 133 123 return err; … … 159 149 } 160 150 161 static void __devexitsnd_card_cs46xx_remove(struct pci_dev *pci)151 static void snd_card_cs46xx_remove(struct pci_dev *pci) 162 152 { 163 153 snd_card_free(pci_get_drvdata(pci)); 164 pci_set_drvdata(pci, NULL);165 154 } 166 155 167 static struct pci_driver driver = {168 .name = "Sound Fusion CS46xx",156 static struct pci_driver cs46xx_driver = { 157 .name = KBUILD_MODNAME, 169 158 .id_table = snd_cs46xx_ids, 170 159 .probe = snd_card_cs46xx_probe, 171 .remove = __devexit_p(snd_card_cs46xx_remove), 172 #ifdef CONFIG_PM 173 .suspend = snd_cs46xx_suspend, 174 .resume = snd_cs46xx_resume, 160 .remove = snd_card_cs46xx_remove, 161 #ifdef CONFIG_PM_SLEEP 162 .driver = { 163 .pm = &snd_cs46xx_pm, 164 }, 175 165 #endif 176 166 }; 177 167 178 static int __init alsa_card_cs46xx_init(void) 179 { 180 return pci_register_driver(&driver); 181 } 182 183 static void __exit alsa_card_cs46xx_exit(void) 184 { 185 pci_unregister_driver(&driver); 186 } 187 188 module_init(alsa_card_cs46xx_init) 189 module_exit(alsa_card_cs46xx_exit) 168 module_pci_driver(cs46xx_driver); -
GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx_lib.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 29 30 * supported by the cs46xx DSP's. 30 31 * Benny <benny@hostmobility.com> 31 *32 * This program is free software; you can redistribute it and/or modify33 * it under the terms of the GNU General Public License as published by34 * the Free Software Foundation; either version 2 of the License, or35 * (at your option) any later version.36 *37 * This program is distributed in the hope that it will be useful,38 * but WITHOUT ANY WARRANTY; without even the implied warranty of39 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the40 * GNU General Public License for more details.41 *42 * You should have received a copy of the GNU General Public License43 * along with this program; if not, write to the Free Software44 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA45 *46 32 */ 33 34 #ifdef TARGET_OS2 35 #define KBUILD_MODNAME "cs46xx" 36 #endif 47 37 48 38 #include <linux/delay.h> … … 54 44 #include <linux/gameport.h> 55 45 #include <linux/mutex.h> 56 46 #include <linux/export.h> 47 #include <linux/module.h> 48 #include <linux/firmware.h> 49 #include <linux/vmalloc.h> 50 #include <linux/io.h> 57 51 58 52 #include <sound/core.h> … … 61 55 #include <sound/pcm.h> 62 56 #include <sound/pcm_params.h> 63 #include <sound/cs46xx.h> 64 65 #include <asm/io.h> 57 #include "cs46xx.h" 66 58 67 59 #include "cs46xx_lib.h" … … 71 63 72 64 #ifdef CONFIG_SND_CS46XX_NEW_DSP 73 static struct snd_pcm_ops snd_cs46xx_playback_rear_ops;74 static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;75 static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;76 static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;77 static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;78 static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;79 #endif 80 81 static struct snd_pcm_ops snd_cs46xx_playback_ops;82 static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;83 static struct snd_pcm_ops snd_cs46xx_capture_ops;84 static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;65 static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops; 66 static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops; 67 static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops; 68 static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops; 69 static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops; 70 static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops; 71 #endif 72 73 static const struct snd_pcm_ops snd_cs46xx_playback_ops; 74 static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops; 75 static const struct snd_pcm_ops snd_cs46xx_capture_ops; 76 static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops; 85 77 86 78 static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip, … … 94 86 if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX && 95 87 codec_index != CS46XX_SECONDARY_CODEC_INDEX)) 96 return -EINVAL;88 return 0xffff; 97 89 98 90 chip->active_ctrl(chip, 1); … … 114 106 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL); 115 107 if ((tmp & ACCTL_VFRM) == 0) { 116 snd_printk(KERN_WARNING "cs46xx: ACCTL_VFRM not set 0x%x\n",tmp);108 dev_warn(chip->card->dev, "ACCTL_VFRM not set 0x%x\n", tmp); 117 109 snd_cs46xx_pokeBA0(chip, BA0_ACCTL, (tmp & (~ACCTL_ESYN)) | ACCTL_VFRM ); 118 110 msleep(50); … … 166 158 } 167 159 168 snd_printk(KERN_ERR "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg); 160 dev_err(chip->card->dev, 161 "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg); 169 162 result = 0xffff; 170 163 goto end; … … 185 178 } 186 179 187 snd_printk(KERN_ERR "AC'97 read problem (ACSTS_VSTS), codec_index %d, reg = 0x%x\n", codec_index, reg); 180 dev_err(chip->card->dev, 181 "AC'97 read problem (ACSTS_VSTS), codec_index %d, reg = 0x%x\n", 182 codec_index, reg); 188 183 result = 0xffff; 189 184 goto end; … … 195 190 */ 196 191 #if 0 197 printk(KERN_DEBUG "e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg, 192 dev_dbg(chip->card->dev, 193 "e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg, 198 194 snd_cs46xx_peekBA0(chip, BA0_ACSDA), 199 195 snd_cs46xx_peekBA0(chip, BA0_ACCAD)); … … 284 280 } 285 281 } 286 snd_printk(KERN_ERR "AC'97 write problem, codec_index = %d, reg = 0x%x, val = 0x%x\n", codec_index, reg, val); 282 dev_err(chip->card->dev, 283 "AC'97 write problem, codec_index = %d, reg = 0x%x, val = 0x%x\n", 284 codec_index, reg, val); 287 285 end: 288 286 chip->active_ctrl(chip, -1); … … 330 328 } 331 329 332 #ifdef CONFIG_SND_CS46XX_NEW_DSP 333 334 #include "imgs/cwc4630.h" 335 #include "imgs/cwcasync.h" 336 #include "imgs/cwcsnoop.h" 337 #include "imgs/cwcbinhack.h" 338 #include "imgs/cwcdma.h" 330 static inline void memcpy_le32(void *dst, const void *src, unsigned int len) 331 { 332 #ifdef __LITTLE_ENDIAN 333 memcpy(dst, src, len); 334 #else 335 u32 *_dst = dst; 336 const __le32 *_src = src; 337 len /= 4; 338 while (len-- > 0) 339 *_dst++ = le32_to_cpu(*_src++); 340 #endif 341 } 342 343 #ifdef CONFIG_SND_CS46XX_NEW_DSP 344 345 static const char *module_names[CS46XX_DSP_MODULES] = { 346 "cwc4630", "cwcasync", "cwcsnoop", "cwcbinhack", "cwcdma" 347 }; 348 349 MODULE_FIRMWARE("cs46xx/cwc4630"); 350 MODULE_FIRMWARE("cs46xx/cwcasync"); 351 MODULE_FIRMWARE("cs46xx/cwcsnoop"); 352 MODULE_FIRMWARE("cs46xx/cwcbinhack"); 353 MODULE_FIRMWARE("cs46xx/cwcdma"); 354 355 static void free_module_desc(struct dsp_module_desc *module) 356 { 357 if (!module) 358 return; 359 kfree(module->module_name); 360 kfree(module->symbol_table.symbols); 361 if (module->segments) { 362 int i; 363 for (i = 0; i < module->nsegments; i++) 364 kfree(module->segments[i].data); 365 kfree(module->segments); 366 } 367 kfree(module); 368 } 369 370 /* firmware binary format: 371 * le32 nsymbols; 372 * struct { 373 * le32 address; 374 * char symbol_name[DSP_MAX_SYMBOL_NAME]; 375 * le32 symbol_type; 376 * } symbols[nsymbols]; 377 * le32 nsegments; 378 * struct { 379 * le32 segment_type; 380 * le32 offset; 381 * le32 size; 382 * le32 data[size]; 383 * } segments[nsegments]; 384 */ 385 386 static int load_firmware(struct snd_cs46xx *chip, 387 struct dsp_module_desc **module_ret, 388 const char *fw_name) 389 { 390 int i, err; 391 unsigned int nums, fwlen, fwsize; 392 const __le32 *fwdat; 393 struct dsp_module_desc *module = NULL; 394 const struct firmware *fw; 395 char fw_path[32]; 396 397 sprintf(fw_path, "cs46xx/%s", fw_name); 398 err = request_firmware(&fw, fw_path, &chip->pci->dev); 399 if (err < 0) 400 return err; 401 fwsize = fw->size / 4; 402 if (fwsize < 2) { 403 err = -EINVAL; 404 goto error; 405 } 406 407 err = -ENOMEM; 408 module = kzalloc(sizeof(*module), GFP_KERNEL); 409 if (!module) 410 goto error; 411 module->module_name = kstrdup(fw_name, GFP_KERNEL); 412 if (!module->module_name) 413 goto error; 414 415 fwlen = 0; 416 fwdat = (const __le32 *)fw->data; 417 nums = module->symbol_table.nsymbols = le32_to_cpu(fwdat[fwlen++]); 418 if (nums >= 40) 419 goto error_inval; 420 module->symbol_table.symbols = 421 kcalloc(nums, sizeof(struct dsp_symbol_entry), GFP_KERNEL); 422 if (!module->symbol_table.symbols) 423 goto error; 424 for (i = 0; i < nums; i++) { 425 struct dsp_symbol_entry *entry = 426 &module->symbol_table.symbols[i]; 427 if (fwlen + 2 + DSP_MAX_SYMBOL_NAME / 4 > fwsize) 428 goto error_inval; 429 entry->address = le32_to_cpu(fwdat[fwlen++]); 430 memcpy(entry->symbol_name, &fwdat[fwlen], DSP_MAX_SYMBOL_NAME - 1); 431 fwlen += DSP_MAX_SYMBOL_NAME / 4; 432 entry->symbol_type = le32_to_cpu(fwdat[fwlen++]); 433 } 434 435 if (fwlen >= fwsize) 436 goto error_inval; 437 nums = module->nsegments = le32_to_cpu(fwdat[fwlen++]); 438 if (nums > 10) 439 goto error_inval; 440 module->segments = 441 kcalloc(nums, sizeof(struct dsp_segment_desc), GFP_KERNEL); 442 if (!module->segments) 443 goto error; 444 for (i = 0; i < nums; i++) { 445 struct dsp_segment_desc *entry = &module->segments[i]; 446 if (fwlen + 3 > fwsize) 447 goto error_inval; 448 entry->segment_type = le32_to_cpu(fwdat[fwlen++]); 449 entry->offset = le32_to_cpu(fwdat[fwlen++]); 450 entry->size = le32_to_cpu(fwdat[fwlen++]); 451 if (fwlen + entry->size > fwsize) 452 goto error_inval; 453 entry->data = kmalloc_array(entry->size, 4, GFP_KERNEL); 454 if (!entry->data) 455 goto error; 456 memcpy_le32(entry->data, &fwdat[fwlen], entry->size * 4); 457 fwlen += entry->size; 458 } 459 460 *module_ret = module; 461 release_firmware(fw); 462 return 0; 463 464 error_inval: 465 err = -EINVAL; 466 error: 467 free_module_desc(module); 468 release_firmware(fw); 469 return err; 470 } 339 471 340 472 int snd_cs46xx_clear_BA1(struct snd_cs46xx *chip, … … 361 493 #else /* old DSP image */ 362 494 363 #include "cs46xx_image.h" 495 struct ba1_struct { 496 struct { 497 u32 offset; 498 u32 size; 499 } memory[BA1_MEMORY_COUNT]; 500 u32 map[BA1_DWORD_SIZE]; 501 }; 502 503 MODULE_FIRMWARE("cs46xx/ba1"); 504 505 static int load_firmware(struct snd_cs46xx *chip) 506 { 507 const struct firmware *fw; 508 int i, size, err; 509 510 err = request_firmware(&fw, "cs46xx/ba1", &chip->pci->dev); 511 if (err < 0) 512 return err; 513 if (fw->size != sizeof(*chip->ba1)) { 514 err = -EINVAL; 515 goto error; 516 } 517 518 chip->ba1 = vmalloc(sizeof(*chip->ba1)); 519 if (!chip->ba1) { 520 err = -ENOMEM; 521 goto error; 522 } 523 524 memcpy_le32(chip->ba1, fw->data, sizeof(*chip->ba1)); 525 526 /* sanity check */ 527 size = 0; 528 for (i = 0; i < BA1_MEMORY_COUNT; i++) 529 size += chip->ba1->memory[i].size; 530 if (size > BA1_DWORD_SIZE * 4) 531 err = -EINVAL; 532 533 error: 534 release_firmware(fw); 535 return err; 536 } 364 537 365 538 int snd_cs46xx_download_image(struct snd_cs46xx *chip) 366 539 { 367 540 int idx, err; 368 unsigned long offset = 0; 541 unsigned int offset = 0; 542 struct ba1_struct *ba1 = chip->ba1; 369 543 370 544 for (idx = 0; idx < BA1_MEMORY_COUNT; idx++) { 371 if ((err = snd_cs46xx_download(chip, 372 &BA1Struct.map[offset], 373 BA1Struct.memory[idx].offset, 374 BA1Struct.memory[idx].size)) < 0) 545 err = snd_cs46xx_download(chip, 546 &ba1->map[offset], 547 ba1->memory[idx].offset, 548 ba1->memory[idx].size); 549 if (err < 0) 375 550 return err; 376 offset += BA1Struct.memory[idx].size >> 2;551 offset += ba1->memory[idx].size >> 2; 377 552 } 378 553 return 0; … … 429 604 430 605 if(status & SERBST_WBSY) { 431 snd_printk(KERN_ERR "cs46xx: failure waiting for "432 "FIFO command to complete\n");606 dev_err(chip->card->dev, 607 "failure waiting for FIFO command to complete\n"); 433 608 return -EINVAL; 434 609 } … … 467 642 */ 468 643 if (cs46xx_wait_for_fifo(chip,1)) { 469 snd_printdd ("failed waiting for FIFO at addr (%02X)\n",idx); 644 dev_dbg(chip->card->dev, 645 "failed waiting for FIFO at addr (%02X)\n", 646 idx); 470 647 471 648 if (powerdown) … … 515 692 516 693 if (snd_cs46xx_peek(chip, BA1_SPCR) & SPCR_RUNFR) 517 snd_printk(KERN_ERR"SPCR_RUNFR never reset\n");694 dev_err(chip->card->dev, "SPCR_RUNFR never reset\n"); 518 695 } 519 696 … … 594 771 595 772 /* 596 * We can not capture at a trate greater than the Input Rate (48000).773 * We can not capture at a rate greater than the Input Rate (48000). 597 774 * Return an error if an attempt is made to stray outside that limit. 598 775 */ … … 701 878 struct snd_pcm_runtime *runtime = substream->runtime; 702 879 struct snd_cs46xx_pcm * cpcm = runtime->private_data; 703 snd_pcm_indirect_playback_transfer(substream, &cpcm->pcm_rec, snd_cs46xx_pb_trans_copy);704 return 0;880 return snd_pcm_indirect_playback_transfer(substream, &cpcm->pcm_rec, 881 snd_cs46xx_pb_trans_copy); 705 882 } 706 883 … … 717 894 { 718 895 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 719 snd_pcm_indirect_capture_transfer(substream, &chip->capt.pcm_rec, snd_cs46xx_cp_trans_copy);720 return 0;896 return snd_pcm_indirect_capture_transfer(substream, &chip->capt.pcm_rec, 897 snd_cs46xx_cp_trans_copy); 721 898 } 722 899 … … 875 1052 cpcm, cpcm->hw_buf.addr,cpcm->pcm_channel_id); 876 1053 if (cpcm->pcm_channel == NULL) { 877 snd_printk(KERN_ERR "cs46xx: failed to create virtual PCM channel\n"); 1054 dev_err(chip->card->dev, 1055 "failed to create virtual PCM channel\n"); 878 1056 return -ENOMEM; 879 1057 } … … 888 1066 cpcm->hw_buf.addr, 889 1067 cpcm->pcm_channel_id)) == NULL) { 890 snd_printk(KERN_ERR "cs46xx: failed to re-create virtual PCM channel\n"); 1068 dev_err(chip->card->dev, 1069 "failed to re-create virtual PCM channel\n"); 891 1070 return -ENOMEM; 892 1071 } … … 937 1116 } 938 1117 939 snd_printdd ("period_size (%d), periods (%d) buffer_size(%d)\n", 1118 dev_dbg(chip->card->dev, 1119 "period_size (%d), periods (%d) buffer_size(%d)\n", 940 1120 period_size, params_periods(hw_params), 941 1121 params_buffer_bytes(hw_params)); … … 1249 1429 } 1250 1430 1251 static struct snd_pcm_hardware snd_cs46xx_playback =1431 static const struct snd_pcm_hardware snd_cs46xx_playback = 1252 1432 { 1253 1433 .info = (SNDRV_PCM_INFO_MMAP | 1254 1434 SNDRV_PCM_INFO_INTERLEAVED | 1255 1435 SNDRV_PCM_INFO_BLOCK_TRANSFER /*|*/ 1256 /*SNDRV_PCM_INFO_RESUME*/), 1436 /*SNDRV_PCM_INFO_RESUME*/ | 1437 SNDRV_PCM_INFO_SYNC_APPLPTR), 1257 1438 .formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | 1258 1439 SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | … … 1271 1452 }; 1272 1453 1273 static struct snd_pcm_hardware snd_cs46xx_capture =1454 static const struct snd_pcm_hardware snd_cs46xx_capture = 1274 1455 { 1275 1456 .info = (SNDRV_PCM_INFO_MMAP | 1276 1457 SNDRV_PCM_INFO_INTERLEAVED | 1277 1458 SNDRV_PCM_INFO_BLOCK_TRANSFER /*|*/ 1278 /*SNDRV_PCM_INFO_RESUME*/), 1459 /*SNDRV_PCM_INFO_RESUME*/ | 1460 SNDRV_PCM_INFO_SYNC_APPLPTR), 1279 1461 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1280 1462 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, … … 1293 1475 #ifdef CONFIG_SND_CS46XX_NEW_DSP 1294 1476 1295 static unsigned int period_sizes[] = { 32, 64, 128, 256, 512, 1024, 2048 };1296 1297 static struct snd_pcm_hw_constraint_list hw_constraints_period_sizes = {1477 static const unsigned int period_sizes[] = { 32, 64, 128, 256, 512, 1024, 2048 }; 1478 1479 static const struct snd_pcm_hw_constraint_list hw_constraints_period_sizes = { 1298 1480 .count = ARRAY_SIZE(period_sizes), 1299 1481 .list = period_sizes, … … 1317 1499 if (cpcm == NULL) 1318 1500 return -ENOMEM; 1319 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),1501 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev, 1320 1502 PAGE_SIZE, &cpcm->hw_buf) < 0) { 1321 1503 kfree(cpcm); … … 1352 1534 static int snd_cs46xx_playback_open(struct snd_pcm_substream *substream) 1353 1535 { 1354 snd_printdd("open front channel\n");1536 dev_dbg(substream->pcm->card->dev, "open front channel\n"); 1355 1537 return _cs46xx_playback_open_channel(substream,DSP_PCM_MAIN_CHANNEL); 1356 1538 } … … 1359 1541 static int snd_cs46xx_playback_open_rear(struct snd_pcm_substream *substream) 1360 1542 { 1361 snd_printdd("open rear channel\n"); 1362 1543 dev_dbg(substream->pcm->card->dev, "open rear channel\n"); 1363 1544 return _cs46xx_playback_open_channel(substream,DSP_PCM_REAR_CHANNEL); 1364 1545 } … … 1366 1547 static int snd_cs46xx_playback_open_clfe(struct snd_pcm_substream *substream) 1367 1548 { 1368 snd_printdd("open center - LFE channel\n"); 1369 1549 dev_dbg(substream->pcm->card->dev, "open center - LFE channel\n"); 1370 1550 return _cs46xx_playback_open_channel(substream,DSP_PCM_CENTER_LFE_CHANNEL); 1371 1551 } … … 1375 1555 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 1376 1556 1377 snd_printdd("open raw iec958 channel\n");1557 dev_dbg(chip->card->dev, "open raw iec958 channel\n"); 1378 1558 1379 1559 mutex_lock(&chip->spos_mutex); … … 1391 1571 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 1392 1572 1393 snd_printdd("close raw iec958 channel\n");1573 dev_dbg(chip->card->dev, "close raw iec958 channel\n"); 1394 1574 1395 1575 err = snd_cs46xx_playback_close(substream); … … 1407 1587 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 1408 1588 1409 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),1589 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev, 1410 1590 PAGE_SIZE, &chip->capt.hw_buf) < 0) 1411 1591 return -ENOMEM; … … 1467 1647 1468 1648 #ifdef CONFIG_SND_CS46XX_NEW_DSP 1469 static struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {1649 static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops = { 1470 1650 .open = snd_cs46xx_playback_open_rear, 1471 1651 .close = snd_cs46xx_playback_close, 1472 .ioctl = snd_pcm_lib_ioctl,1473 1652 .hw_params = snd_cs46xx_playback_hw_params, 1474 1653 .hw_free = snd_cs46xx_playback_hw_free, … … 1478 1657 }; 1479 1658 1480 static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {1659 static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = { 1481 1660 .open = snd_cs46xx_playback_open_rear, 1482 1661 .close = snd_cs46xx_playback_close, 1483 .ioctl = snd_pcm_lib_ioctl,1484 1662 .hw_params = snd_cs46xx_playback_hw_params, 1485 1663 .hw_free = snd_cs46xx_playback_hw_free, … … 1490 1668 }; 1491 1669 1492 static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {1670 static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = { 1493 1671 .open = snd_cs46xx_playback_open_clfe, 1494 1672 .close = snd_cs46xx_playback_close, 1495 .ioctl = snd_pcm_lib_ioctl,1496 1673 .hw_params = snd_cs46xx_playback_hw_params, 1497 1674 .hw_free = snd_cs46xx_playback_hw_free, … … 1501 1678 }; 1502 1679 1503 static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {1680 static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = { 1504 1681 .open = snd_cs46xx_playback_open_clfe, 1505 1682 .close = snd_cs46xx_playback_close, 1506 .ioctl = snd_pcm_lib_ioctl,1507 1683 .hw_params = snd_cs46xx_playback_hw_params, 1508 1684 .hw_free = snd_cs46xx_playback_hw_free, … … 1513 1689 }; 1514 1690 1515 static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {1691 static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = { 1516 1692 .open = snd_cs46xx_playback_open_iec958, 1517 1693 .close = snd_cs46xx_playback_close_iec958, 1518 .ioctl = snd_pcm_lib_ioctl,1519 1694 .hw_params = snd_cs46xx_playback_hw_params, 1520 1695 .hw_free = snd_cs46xx_playback_hw_free, … … 1524 1699 }; 1525 1700 1526 static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {1701 static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = { 1527 1702 .open = snd_cs46xx_playback_open_iec958, 1528 1703 .close = snd_cs46xx_playback_close_iec958, 1529 .ioctl = snd_pcm_lib_ioctl,1530 1704 .hw_params = snd_cs46xx_playback_hw_params, 1531 1705 .hw_free = snd_cs46xx_playback_hw_free, … … 1538 1712 #endif 1539 1713 1540 static struct snd_pcm_ops snd_cs46xx_playback_ops = {1714 static const struct snd_pcm_ops snd_cs46xx_playback_ops = { 1541 1715 .open = snd_cs46xx_playback_open, 1542 1716 .close = snd_cs46xx_playback_close, 1543 .ioctl = snd_pcm_lib_ioctl,1544 1717 .hw_params = snd_cs46xx_playback_hw_params, 1545 1718 .hw_free = snd_cs46xx_playback_hw_free, … … 1549 1722 }; 1550 1723 1551 static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = {1724 static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = { 1552 1725 .open = snd_cs46xx_playback_open, 1553 1726 .close = snd_cs46xx_playback_close, 1554 .ioctl = snd_pcm_lib_ioctl,1555 1727 .hw_params = snd_cs46xx_playback_hw_params, 1556 1728 .hw_free = snd_cs46xx_playback_hw_free, … … 1561 1733 }; 1562 1734 1563 static struct snd_pcm_ops snd_cs46xx_capture_ops = {1735 static const struct snd_pcm_ops snd_cs46xx_capture_ops = { 1564 1736 .open = snd_cs46xx_capture_open, 1565 1737 .close = snd_cs46xx_capture_close, 1566 .ioctl = snd_pcm_lib_ioctl,1567 1738 .hw_params = snd_cs46xx_capture_hw_params, 1568 1739 .hw_free = snd_cs46xx_capture_hw_free, … … 1572 1743 }; 1573 1744 1574 static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = {1745 static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = { 1575 1746 .open = snd_cs46xx_capture_open, 1576 1747 .close = snd_cs46xx_capture_close, 1577 .ioctl = snd_pcm_lib_ioctl,1578 1748 .hw_params = snd_cs46xx_capture_hw_params, 1579 1749 .hw_free = snd_cs46xx_capture_hw_free, … … 1590 1760 #endif 1591 1761 1592 int __devinit snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm ** rpcm)1762 int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device) 1593 1763 { 1594 1764 struct snd_pcm *pcm; 1595 1765 int err; 1596 1766 1597 if (rpcm)1598 *rpcm = NULL;1599 1767 if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0) 1600 1768 return err; … … 1611 1779 1612 1780 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1613 snd_dma_pci_data(chip->pci), 64*1024, 256*1024); 1614 1615 if (rpcm) 1616 *rpcm = pcm; 1617 1618 return 0; 1619 } 1620 1621 1622 #ifdef CONFIG_SND_CS46XX_NEW_DSP 1623 int __devinit snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm ** rpcm) 1781 &chip->pci->dev, 1782 64*1024, 256*1024); 1783 1784 return 0; 1785 } 1786 1787 1788 #ifdef CONFIG_SND_CS46XX_NEW_DSP 1789 int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device) 1624 1790 { 1625 1791 struct snd_pcm *pcm; 1626 1792 int err; 1627 1628 if (rpcm)1629 *rpcm = NULL;1630 1793 1631 1794 if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) … … 1642 1805 1643 1806 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1644 snd_dma_pci_data(chip->pci), 64*1024, 256*1024); 1645 1646 if (rpcm) 1647 *rpcm = pcm; 1648 1649 return 0; 1650 } 1651 1652 int __devinit snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm ** rpcm) 1807 &chip->pci->dev, 1808 64*1024, 256*1024); 1809 1810 return 0; 1811 } 1812 1813 int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device) 1653 1814 { 1654 1815 struct snd_pcm *pcm; 1655 1816 int err; 1656 1657 if (rpcm)1658 *rpcm = NULL;1659 1817 1660 1818 if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) … … 1671 1829 1672 1830 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1673 snd_dma_pci_data(chip->pci), 64*1024, 256*1024); 1674 1675 if (rpcm) 1676 *rpcm = pcm; 1677 1678 return 0; 1679 } 1680 1681 int __devinit snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm ** rpcm) 1831 &chip->pci->dev, 1832 64*1024, 256*1024); 1833 1834 return 0; 1835 } 1836 1837 int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device) 1682 1838 { 1683 1839 struct snd_pcm *pcm; 1684 1840 int err; 1685 1686 if (rpcm)1687 *rpcm = NULL;1688 1841 1689 1842 if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0) … … 1697 1850 pcm->info_flags = 0; 1698 1851 strcpy(pcm->name, "CS46xx - IEC958"); 1699 chip->pcm_ rear= pcm;1852 chip->pcm_iec958 = pcm; 1700 1853 1701 1854 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1702 snd_dma_pci_data(chip->pci), 64*1024, 256*1024); 1703 1704 if (rpcm) 1705 *rpcm = pcm; 1855 &chip->pci->dev, 1856 64*1024, 256*1024); 1706 1857 1707 1858 return 0; … … 2092 2243 2093 2244 2094 static struct snd_kcontrol_new snd_cs46xx_controls[] __devinitdata= {2245 static const struct snd_kcontrol_new snd_cs46xx_controls[] = { 2095 2246 { 2096 2247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 2207 2358 } 2208 2359 2209 static struct snd_kcontrol_new snd_cs46xx_front_dup_ctl = {2360 static const struct snd_kcontrol_new snd_cs46xx_front_dup_ctl = { 2210 2361 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2211 2362 .name = "Duplicate Front", … … 2218 2369 #ifdef CONFIG_SND_CS46XX_NEW_DSP 2219 2370 /* Only available on the Hercules Game Theater XP soundcard */ 2220 static struct snd_kcontrol_new snd_hercules_controls[] = {2371 static const struct snd_kcontrol_new snd_hercules_controls[] = { 2221 2372 { 2222 2373 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 2239 2390 /* set the desired CODEC mode */ 2240 2391 if (ac97->num == CS46XX_PRIMARY_CODEC_INDEX) { 2241 snd_printdd("cs46xx:CODEC1 mode %04x\n", 0x0);2392 dev_dbg(ac97->bus->card->dev, "CODEC1 mode %04x\n", 0x0); 2242 2393 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x0); 2243 2394 } else if (ac97->num == CS46XX_SECONDARY_CODEC_INDEX) { 2244 snd_printdd("cs46xx:CODEC2 mode %04x\n", 0x3);2395 dev_dbg(ac97->bus->card->dev, "CODEC2 mode %04x\n", 0x3); 2245 2396 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x3); 2246 2397 } else { … … 2274 2425 } while (time_after_eq(end_time, jiffies)); 2275 2426 2276 snd_printk(KERN_ERR "CS46xx secondary codec doesn't respond!\n"); 2277 } 2278 #endif 2279 2280 static int __devinit cs46xx_detect_codec(struct snd_cs46xx *chip, int codec) 2427 dev_err(ac97->bus->card->dev, 2428 "CS46xx secondary codec doesn't respond!\n"); 2429 } 2430 #endif 2431 2432 static int cs46xx_detect_codec(struct snd_cs46xx *chip, int codec) 2281 2433 { 2282 2434 int idx, err; … … 2294 2446 udelay(10); 2295 2447 if (snd_cs46xx_codec_read(chip, AC97_RESET, codec) & 0x8000) { 2296 snd_printdd("snd_cs46xx: seconadry codec not present\n"); 2448 dev_dbg(chip->card->dev, 2449 "secondary codec not present\n"); 2297 2450 return -ENXIO; 2298 2451 } … … 2307 2460 msleep(10); 2308 2461 } 2309 snd_printdd("snd_cs46xx:codec %d detection timeout\n", codec);2462 dev_dbg(chip->card->dev, "codec %d detection timeout\n", codec); 2310 2463 return -ENXIO; 2311 2464 } 2312 2465 2313 int __devinitsnd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)2466 int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device) 2314 2467 { 2315 2468 struct snd_card *card = chip->card; … … 2317 2470 int err; 2318 2471 unsigned int idx; 2319 static struct snd_ac97_bus_ops ops = {2472 static const struct snd_ac97_bus_ops ops = { 2320 2473 #ifdef CONFIG_SND_CS46XX_NEW_DSP 2321 2474 .reset = snd_cs46xx_codec_reset, … … 2327 2480 /* detect primary codec */ 2328 2481 chip->nr_ac97_codecs = 0; 2329 snd_printdd("snd_cs46xx:detecting primary codec\n");2482 dev_dbg(chip->card->dev, "detecting primary codec\n"); 2330 2483 if ((err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus)) < 0) 2331 2484 return err; … … 2337 2490 2338 2491 #ifdef CONFIG_SND_CS46XX_NEW_DSP 2339 snd_printdd("snd_cs46xx: detecting seconadry codec\n");2492 dev_dbg(chip->card->dev, "detecting secondary codec\n"); 2340 2493 /* try detect a secondary codec */ 2341 2494 if (! cs46xx_detect_codec(chip, CS46XX_SECONDARY_CODEC_INDEX)) … … 2362 2515 if (chip->nr_ac97_codecs == 1) { 2363 2516 unsigned int id2 = chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]->id & 0xffff; 2364 if ( id2 == 0x592b || id2 == 0x592d) {2517 if ((id2 & 0xfff0) == 0x5920) { /* CS4294 and CS4298 */ 2365 2518 err = snd_ctl_add(card, snd_ctl_new1(&snd_cs46xx_front_dup_ctl, chip)); 2366 2519 if (err < 0) … … 2372 2525 /* do soundcard specific mixer setup */ 2373 2526 if (chip->mixer_init) { 2374 snd_printdd ("calling chip->mixer_init(chip);\n");2527 dev_dbg(chip->card->dev, "calling chip->mixer_init(chip);\n"); 2375 2528 chip->mixer_init(chip); 2376 2529 } … … 2517 2670 } 2518 2671 2519 static struct snd_rawmidi_ops snd_cs46xx_midi_output =2672 static const struct snd_rawmidi_ops snd_cs46xx_midi_output = 2520 2673 { 2521 2674 .open = snd_cs46xx_midi_output_open, … … 2524 2677 }; 2525 2678 2526 static struct snd_rawmidi_ops snd_cs46xx_midi_input =2679 static const struct snd_rawmidi_ops snd_cs46xx_midi_input = 2527 2680 { 2528 2681 .open = snd_cs46xx_midi_input_open, … … 2531 2684 }; 2532 2685 2533 int __devinit snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rrawmidi)2686 int snd_cs46xx_midi(struct snd_cs46xx *chip, int device) 2534 2687 { 2535 2688 struct snd_rawmidi *rmidi; 2536 2689 int err; 2537 2690 2538 if (rrawmidi)2539 *rrawmidi = NULL;2540 2691 if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0) 2541 2692 return err; … … 2546 2697 rmidi->private_data = chip; 2547 2698 chip->rmidi = rmidi; 2548 if (rrawmidi)2549 *rrawmidi = NULL;2550 2699 return 0; 2551 2700 } … … 2556 2705 */ 2557 2706 2558 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))2707 #if IS_REACHABLE(CONFIG_GAMEPORT) 2559 2708 2560 2709 static void snd_cs46xx_gameport_trigger(struct gameport *gameport) … … 2613 2762 } 2614 2763 2615 int __devinitsnd_cs46xx_gameport(struct snd_cs46xx *chip)2764 int snd_cs46xx_gameport(struct snd_cs46xx *chip) 2616 2765 { 2617 2766 struct gameport *gp; … … 2619 2768 chip->gameport = gp = gameport_allocate_port(); 2620 2769 if (!gp) { 2621 printk(KERN_ERR "cs46xx: cannot allocate memory for gameport\n"); 2770 dev_err(chip->card->dev, 2771 "cannot allocate memory for gameport\n"); 2622 2772 return -ENOMEM; 2623 2773 } … … 2649 2799 } 2650 2800 #else 2651 int __devinitsnd_cs46xx_gameport(struct snd_cs46xx *chip) { return -ENOSYS; }2801 int snd_cs46xx_gameport(struct snd_cs46xx *chip) { return -ENOSYS; } 2652 2802 static inline void snd_cs46xx_remove_gameport(struct snd_cs46xx *chip) { } 2653 2803 #endif /* CONFIG_GAMEPORT */ 2654 2804 2655 #ifdef CONFIG_ PROC_FS2805 #ifdef CONFIG_SND_PROC_FS 2656 2806 /* 2657 2807 * proc interface … … 2670 2820 } 2671 2821 2672 static struct snd_info_entry_ops snd_cs46xx_proc_io_ops = {2822 static const struct snd_info_entry_ops snd_cs46xx_proc_io_ops = { 2673 2823 .read = snd_cs46xx_io_read, 2674 2824 }; 2675 2825 2676 static int __devinitsnd_cs46xx_proc_init(struct snd_card *card, struct snd_cs46xx *chip)2826 static int snd_cs46xx_proc_init(struct snd_card *card, struct snd_cs46xx *chip) 2677 2827 { 2678 2828 struct snd_info_entry *entry; … … 2686 2836 entry->c.ops = &snd_cs46xx_proc_io_ops; 2687 2837 entry->size = region->size; 2688 entry->mode = S_IFREG | S_IRUSR;2838 entry->mode = S_IFREG | 0400; 2689 2839 } 2690 2840 } … … 2702 2852 return 0; 2703 2853 } 2704 #else /* !CONFIG_ PROC_FS */2854 #else /* !CONFIG_SND_PROC_FS */ 2705 2855 #define snd_cs46xx_proc_init(card, chip) 2706 2856 #define snd_cs46xx_proc_done(chip) … … 2785 2935 for (idx = 0; idx < 5; idx++) { 2786 2936 struct snd_cs46xx_region *region = &chip->region.idx[idx]; 2787 if (region->remap_addr) 2788 2937 2938 iounmap(region->remap_addr); 2789 2939 release_and_free_resource(region->resource); 2790 2940 } … … 2795 2945 chip->dsp_spos_instance = NULL; 2796 2946 } 2947 for (idx = 0; idx < CS46XX_DSP_MODULES; idx++) 2948 free_module_desc(chip->modules[idx]); 2949 #else 2950 vfree(chip->ba1); 2797 2951 #endif 2798 2952 2799 #ifdef CONFIG_PM 2953 #ifdef CONFIG_PM_SLEEP 2800 2954 kfree(chip->saved_regs); 2801 2955 #endif … … 2952 3106 2953 3107 2954 snd_printk(KERN_ERR "create - never read codec ready from AC'97\n"); 2955 snd_printk(KERN_ERR "it is not probably bug, try to use CS4236 driver\n"); 3108 dev_err(chip->card->dev, 3109 "create - never read codec ready from AC'97\n"); 3110 dev_err(chip->card->dev, 3111 "it is not probably bug, try to use CS4236 driver\n"); 2956 3112 return -EIO; 2957 3113 ok1: … … 2971 3127 */ 2972 3128 if (!(snd_cs46xx_peekBA0(chip, BA0_ACSTS2) & ACSTS_CRDY)) 2973 snd_printdd("cs46xx: never read card ready from secondary AC'97\n"); 3129 dev_dbg(chip->card->dev, 3130 "never read card ready from secondary AC'97\n"); 2974 3131 } 2975 3132 #endif … … 3001 3158 3002 3159 #ifndef CONFIG_SND_CS46XX_NEW_DSP 3003 snd_printk(KERN_ERR "create - never read ISV3 & ISV4 from AC'97\n"); 3160 dev_err(chip->card->dev, 3161 "create - never read ISV3 & ISV4 from AC'97\n"); 3004 3162 return -EIO; 3005 3163 #else … … 3008 3166 with the same problem I would like to know. (Benny) */ 3009 3167 3010 snd_printk(KERN_ERR "ERROR: snd-cs46xx: never read ISV3 & ISV4 from AC'97\n"); 3011 snd_printk(KERN_ERR " Try reloading the ALSA driver, if you find something\n"); 3012 snd_printk(KERN_ERR " broken or not working on your soundcard upon\n"); 3013 snd_printk(KERN_ERR " this message please report to alsa-devel@alsa-project.org\n"); 3168 dev_err(chip->card->dev, "never read ISV3 & ISV4 from AC'97\n"); 3169 dev_err(chip->card->dev, 3170 "Try reloading the ALSA driver, if you find something\n"); 3171 dev_err(chip->card->dev, 3172 "broken or not working on your soundcard upon\n"); 3173 dev_err(chip->card->dev, 3174 "this message please report to alsa-devel@alsa-project.org\n"); 3014 3175 3015 3176 return -EIO; … … 3061 3222 } 3062 3223 3063 int __devinitsnd_cs46xx_start_dsp(struct snd_cs46xx *chip)3224 int snd_cs46xx_start_dsp(struct snd_cs46xx *chip) 3064 3225 { 3065 3226 unsigned int tmp; 3227 #ifdef CONFIG_SND_CS46XX_NEW_DSP 3228 int i; 3229 #endif 3230 int err; 3231 3066 3232 /* 3067 3233 * Reset the processor. … … 3072 3238 */ 3073 3239 #ifdef CONFIG_SND_CS46XX_NEW_DSP 3074 #if 0 3075 if (cs46xx_dsp_load_module(chip, &cwcemb80_module) < 0) { 3076 snd_printk(KERN_ERR "image download error\n"); 3077 return -EIO; 3078 } 3079 #endif 3080 3081 if (cs46xx_dsp_load_module(chip, &cwc4630_module) < 0) { 3082 snd_printk(KERN_ERR "image download error [cwc4630]\n"); 3083 return -EIO; 3084 } 3085 3086 if (cs46xx_dsp_load_module(chip, &cwcasync_module) < 0) { 3087 snd_printk(KERN_ERR "image download error [cwcasync]\n"); 3088 return -EIO; 3089 } 3090 3091 if (cs46xx_dsp_load_module(chip, &cwcsnoop_module) < 0) { 3092 snd_printk(KERN_ERR "image download error [cwcsnoop]\n"); 3093 return -EIO; 3094 } 3095 3096 if (cs46xx_dsp_load_module(chip, &cwcbinhack_module) < 0) { 3097 snd_printk(KERN_ERR "image download error [cwcbinhack]\n"); 3098 return -EIO; 3099 } 3100 3101 if (cs46xx_dsp_load_module(chip, &cwcdma_module) < 0) { 3102 snd_printk(KERN_ERR "image download error [cwcdma]\n"); 3103 return -EIO; 3240 for (i = 0; i < CS46XX_DSP_MODULES; i++) { 3241 err = load_firmware(chip, &chip->modules[i], module_names[i]); 3242 if (err < 0) { 3243 dev_err(chip->card->dev, "firmware load error [%s]\n", 3244 module_names[i]); 3245 return err; 3246 } 3247 err = cs46xx_dsp_load_module(chip, chip->modules[i]); 3248 if (err < 0) { 3249 dev_err(chip->card->dev, "image download error [%s]\n", 3250 module_names[i]); 3251 return err; 3252 } 3104 3253 } 3105 3254 … … 3107 3256 return -EIO; 3108 3257 #else 3258 err = load_firmware(chip); 3259 if (err < 0) 3260 return err; 3261 3109 3262 /* old image */ 3110 if (snd_cs46xx_download_image(chip) < 0) { 3111 snd_printk(KERN_ERR "image download error\n"); 3112 return -EIO; 3263 err = snd_cs46xx_download_image(chip); 3264 if (err < 0) { 3265 dev_err(chip->card->dev, "image download error\n"); 3266 return err; 3113 3267 } 3114 3268 … … 3162 3316 u16 modem_power,pin_config,logic_type; 3163 3317 3164 snd_printdd ("cs46xx:cs46xx_setup_eapd_slot()+\n");3318 dev_dbg(chip->card->dev, "cs46xx_setup_eapd_slot()+\n"); 3165 3319 3166 3320 /* … … 3180 3334 */ 3181 3335 if(chip->nr_ac97_codecs != 2) { 3182 snd_printk (KERN_ERR "cs46xx: cs46xx_setup_eapd_slot() - no secondary codec configured\n"); 3336 dev_err(chip->card->dev, 3337 "cs46xx_setup_eapd_slot() - no secondary codec configured\n"); 3183 3338 return -EINVAL; 3184 3339 } … … 3221 3376 3222 3377 if ( cs46xx_wait_for_fifo(chip,1) ) { 3223 snd_printdd("FIFO is busy\n");3378 dev_dbg(chip->card->dev, "FIFO is busy\n"); 3224 3379 3225 3380 return -EINVAL; … … 3242 3397 */ 3243 3398 if ( cs46xx_wait_for_fifo(chip,200) ) { 3244 snd_printdd("failed waiting for FIFO at addr (%02X)\n",idx); 3399 dev_dbg(chip->card->dev, 3400 "failed waiting for FIFO at addr (%02X)\n", 3401 idx); 3245 3402 3246 3403 return -EINVAL; … … 3331 3488 chip->amplifier += change; 3332 3489 if (chip->amplifier && !old) { 3333 snd_printdd ("Hercules amplifier ON\n");3490 dev_dbg(chip->card->dev, "Hercules amplifier ON\n"); 3334 3491 3335 3492 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, … … 3338 3495 EGPIOPTR_GPPT2 | val2); /* open-drain on output */ 3339 3496 } else if (old && !chip->amplifier) { 3340 snd_printdd ("Hercules amplifier OFF\n");3497 dev_dbg(chip->card->dev, "Hercules amplifier OFF\n"); 3341 3498 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, val1 & ~EGPIODR_GPOE2); /* disable */ 3342 3499 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR, val2 & ~EGPIOPTR_GPPT2); /* disable */ … … 3346 3503 static void voyetra_mixer_init (struct snd_cs46xx *chip) 3347 3504 { 3348 snd_printdd ("initializing Voyetra mixer\n");3505 dev_dbg(chip->card->dev, "initializing Voyetra mixer\n"); 3349 3506 3350 3507 /* Enable SPDIF out */ … … 3364 3521 hercules_init(chip); 3365 3522 3366 snd_printdd ("initializing Hercules mixer\n");3523 dev_dbg(chip->card->dev, "initializing Hercules mixer\n"); 3367 3524 3368 3525 #ifdef CONFIG_SND_CS46XX_NEW_DSP … … 3375 3532 kctl = snd_ctl_new1(&snd_hercules_controls[idx], chip); 3376 3533 if ((err = snd_ctl_add(card, kctl)) < 0) { 3377 printk (KERN_ERR "cs46xx: failed to initialize Hercules mixer (%d)\n",err); 3534 dev_err(card->dev, 3535 "failed to initialize Hercules mixer (%d)\n", 3536 err); 3378 3537 break; 3379 3538 } … … 3477 3636 }; 3478 3637 3479 static struct cs_card_type __devinitdatacards[] = {3638 static struct cs_card_type cards[] = { 3480 3639 { 3481 3640 .vendor = 0x1489, … … 3590 3749 * APM support 3591 3750 */ 3592 #ifdef CONFIG_PM 3593 static unsigned int saved_regs[] = {3751 #ifdef CONFIG_PM_SLEEP 3752 static const unsigned int saved_regs[] = { 3594 3753 BA0_ACOSV, 3595 3754 /*BA0_ASER_FADDR,*/ … … 3599 3758 }; 3600 3759 3601 int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state)3602 { 3603 struct snd_card *card = pci_get_drvdata(pci);3760 static int snd_cs46xx_suspend(struct device *dev) 3761 { 3762 struct snd_card *card = dev_get_drvdata(dev); 3604 3763 struct snd_cs46xx *chip = card->private_data; 3605 3764 int i, amp_saved; … … 3607 3766 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 3608 3767 chip->in_suspend = 1; 3609 snd_pcm_suspend_all(chip->pcm);3610 3768 // chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL); 3611 3769 // chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE); … … 3625 3783 chip->active_ctrl(chip, -chip->amplifier); 3626 3784 chip->amplifier = amp_saved; /* restore the status */ 3627 3628 pci_disable_device(pci); 3629 pci_save_state(pci); 3630 pci_set_power_state(pci, pci_choose_state(pci, state)); 3631 return 0; 3632 } 3633 3634 int snd_cs46xx_resume(struct pci_dev *pci) 3635 { 3636 struct snd_card *card = pci_get_drvdata(pci); 3785 return 0; 3786 } 3787 3788 static int snd_cs46xx_resume(struct device *dev) 3789 { 3790 struct snd_card *card = dev_get_drvdata(dev); 3637 3791 struct snd_cs46xx *chip = card->private_data; 3638 3792 int amp_saved; … … 3641 3795 #endif 3642 3796 unsigned int tmp; 3643 3644 pci_set_power_state(pci, PCI_D0);3645 pci_restore_state(pci);3646 if (pci_enable_device(pci) < 0) {3647 printk(KERN_ERR "cs46xx: pci_enable_device failed, "3648 "disabling device\n");3649 snd_card_disconnect(card);3650 return -EIO;3651 }3652 pci_set_master(pci);3653 3797 3654 3798 amp_saved = chip->amplifier; … … 3707 3851 return 0; 3708 3852 } 3709 #endif /* CONFIG_PM */ 3853 3854 SIMPLE_DEV_PM_OPS(snd_cs46xx_pm, snd_cs46xx_suspend, snd_cs46xx_resume); 3855 #endif /* CONFIG_PM_SLEEP */ 3710 3856 3711 3857 … … 3713 3859 */ 3714 3860 3715 int __devinitsnd_cs46xx_create(struct snd_card *card,3716 struct pci_dev * 3861 int snd_cs46xx_create(struct snd_card *card, 3862 struct pci_dev *pci, 3717 3863 int external_amp, int thinkpad, 3718 struct snd_cs46xx ** 3864 struct snd_cs46xx **rchip) 3719 3865 { 3720 3866 struct snd_cs46xx *chip; … … 3723 3869 struct cs_card_type *cp; 3724 3870 u16 ss_card, ss_vendor; 3725 static struct snd_device_ops ops = {3871 static const struct snd_device_ops ops = { 3726 3872 .dev_free = snd_cs46xx_dev_free, 3727 3873 }; … … 3749 3895 if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 || 3750 3896 chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) { 3751 snd_printk(KERN_ERR "wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n", 3897 dev_err(chip->card->dev, 3898 "wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n", 3752 3899 chip->ba0_addr, chip->ba1_addr); 3753 3900 snd_cs46xx_free(chip); … … 3786 3933 for (cp = &cards[0]; cp->name; cp++) { 3787 3934 if (cp->vendor == ss_vendor && cp->id == ss_card) { 3788 snd_printdd ("hack for %s enabled\n", cp->name); 3935 dev_dbg(chip->card->dev, "hack for %s enabled\n", 3936 cp->name); 3789 3937 3790 3938 chip->amplifier_ctrl = cp->amp; … … 3799 3947 3800 3948 if (external_amp) { 3801 snd_printk(KERN_INFO "Crystal EAPD support forced on.\n"); 3949 dev_info(chip->card->dev, 3950 "Crystal EAPD support forced on.\n"); 3802 3951 chip->amplifier_ctrl = amp_voyetra; 3803 3952 } 3804 3953 3805 3954 if (thinkpad) { 3806 snd_printk(KERN_INFO "Activating CLKRUN hack for Thinkpad.\n"); 3955 dev_info(chip->card->dev, 3956 "Activating CLKRUN hack for Thinkpad.\n"); 3807 3957 chip->active_ctrl = clkrun_hack; 3808 3958 clkrun_init(chip); … … 3822 3972 if ((region->resource = request_mem_region(region->base, region->size, 3823 3973 region->name)) == NULL) { 3824 snd_printk(KERN_ERR "unable to request memory region 0x%lx-0x%lx\n", 3974 dev_err(chip->card->dev, 3975 "unable to request memory region 0x%lx-0x%lx\n", 3825 3976 region->base, region->base + region->size - 1); 3826 3977 snd_cs46xx_free(chip); 3827 3978 return -EBUSY; 3828 3979 } 3829 region->remap_addr = ioremap _nocache(region->base, region->size);3980 region->remap_addr = ioremap(region->base, region->size); 3830 3981 if (region->remap_addr == NULL) { 3831 snd_printk(KERN_ERR "%s ioremap problem\n", region->name); 3982 dev_err(chip->card->dev, 3983 "%s ioremap problem\n", region->name); 3832 3984 snd_cs46xx_free(chip); 3833 3985 return -ENOMEM; … … 3836 3988 3837 3989 if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_SHARED, 3838 "CS46XX", chip)) {3839 snd_printk(KERN_ERR"unable to grab IRQ %d\n", pci->irq);3990 KBUILD_MODNAME, chip)) { 3991 dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq); 3840 3992 snd_cs46xx_free(chip); 3841 3993 return -EBUSY; 3842 3994 } 3843 3995 chip->irq = pci->irq; 3996 card->sync_irq = chip->irq; 3844 3997 3845 3998 #ifdef CONFIG_SND_CS46XX_NEW_DSP … … 3864 4017 snd_cs46xx_proc_init(card, chip); 3865 4018 3866 #ifdef CONFIG_PM 3867 chip->saved_regs = kmalloc(sizeof(*chip->saved_regs) * 3868 ARRAY_SIZE(saved_regs), GFP_KERNEL); 4019 #ifdef CONFIG_PM_SLEEP 4020 chip->saved_regs = kmalloc_array(ARRAY_SIZE(saved_regs), 4021 sizeof(*chip->saved_regs), 4022 GFP_KERNEL); 3869 4023 if (!chip->saved_regs) { 3870 4024 snd_cs46xx_free(chip); … … 3875 4029 chip->active_ctrl(chip, -1); /* disable CLKRUN */ 3876 4030 3877 snd_card_set_dev(card, &pci->dev);3878 3879 4031 *rchip = chip; 3880 4032 return 0; -
GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx_lib.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *5 *6 * This program is free software; you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation; either version 2 of the License, or9 * (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 of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with this program; if not, write to the Free Software18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19 *20 5 */ 21 6 … … 91 76 void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip); 92 77 int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module); 93 #ifdef CONFIG_PM 78 #ifdef CONFIG_PM_SLEEP 94 79 int cs46xx_dsp_resume(struct snd_cs46xx * chip); 95 80 #endif 96 81 struct dsp_symbol_entry *cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, 97 82 int symbol_type); 98 #ifdef CONFIG_ PROC_FS83 #ifdef CONFIG_SND_PROC_FS 99 84 int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip); 100 85 int cs46xx_dsp_proc_done (struct snd_cs46xx *chip); … … 119 104 struct dsp_scb_descriptor * cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, 120 105 u32 * scb_data, u32 dest); 121 #ifdef CONFIG_ PROC_FS106 #ifdef CONFIG_SND_PROC_FS 122 107 void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb); 123 108 void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, -
GPL/trunk/alsa-kernel/pci/cs46xx/dsp_spos.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 * This program is free software; you can redistribute it and/or modify3 * it under the terms of the GNU General Public License as published by4 * the Free Software Foundation; either version 2 of the License, or5 * (at your option) any later version.6 *7 * This program is distributed in the hope that it will be useful,8 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * GNU General Public License for more details.11 *12 * You should have received a copy of the GNU General Public License13 * along with this program; if not, write to the Free Software14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA15 *16 3 */ 17 4 … … 21 8 22 9 23 #include < asm/io.h>10 #include <linux/io.h> 24 11 #include <linux/delay.h> 25 12 #include <linux/pm.h> … … 33 20 #include <sound/info.h> 34 21 #include <sound/asoundef.h> 35 #include <sound/cs46xx.h>22 #include "cs46xx.h" 36 23 37 24 #include "cs46xx_lib.h" … … 41 28 struct dsp_scb_descriptor * fg_entry); 42 29 43 static enum wide_opcode wide_opcodes[] = {30 static const enum wide_opcode wide_opcodes[] = { 44 31 WIDE_FOR_BEGIN_LOOP, 45 32 WIDE_FOR_BEGIN_LOOP2, … … 86 73 address |= loval >> 15; 87 74 88 snd_printdd("handle_wideop[1]: %05x:%05x addr %04x\n",hival,loval,address); 75 dev_dbg(chip->card->dev, 76 "handle_wideop[1]: %05x:%05x addr %04x\n", 77 hival, loval, address); 89 78 90 79 if ( !(address & 0x8000) ) { 91 80 address += (ins->code.offset / 2) - overlay_begin_address; 92 81 } else { 93 snd_printdd("handle_wideop[1]: ROM symbol not reallocated\n"); 82 dev_dbg(chip->card->dev, 83 "handle_wideop[1]: ROM symbol not reallocated\n"); 94 84 } 95 85 … … 103 93 address |= loval >> 15; 104 94 105 snd_printdd("handle_wideop:[2] %05x:%05x addr %04x\n",hival,loval,address); 106 nreallocated ++; 95 dev_dbg(chip->card->dev, 96 "handle_wideop:[2] %05x:%05x addr %04x\n", 97 hival, loval, address); 98 nreallocated++; 107 99 } /* wide_opcodes[j] == wide_op */ 108 100 } /* for */ … … 114 106 } 115 107 116 snd_printdd("dsp_spos: %d instructions reallocated\n",nreallocated); 108 dev_dbg(chip->card->dev, 109 "dsp_spos: %d instructions reallocated\n", nreallocated); 117 110 return nreallocated; 118 111 } … … 158 151 for (i = 0;i < module->symbol_table.nsymbols; ++i) { 159 152 if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) { 160 snd_printk(KERN_ERR "dsp_spos: symbol table is full\n"); 153 dev_err(chip->card->dev, 154 "dsp_spos: symbol table is full\n"); 161 155 return -ENOMEM; 162 156 } … … 177 171 ins->symbol_table.nsymbols++; 178 172 } else { 179 /* if (0) printk ("dsp_spos: symbol <%s> duplicated, probably nothing wrong with that (Cirrus?)\n", 180 module->symbol_table.symbols[i].symbol_name); */ 173 #if 0 174 dev_dbg(chip->card->dev, 175 "dsp_spos: symbol <%s> duplicated, probably nothing wrong with that (Cirrus?)\n", 176 module->symbol_table.symbols[i].symbol_name); */ 177 #endif 181 178 } 182 179 } … … 193 190 194 191 if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) { 195 snd_printk(KERN_ERR"dsp_spos: symbol table is full\n");192 dev_err(chip->card->dev, "dsp_spos: symbol table is full\n"); 196 193 return NULL; 197 194 } … … 200 197 symbol_name, 201 198 type) != NULL) { 202 snd_printk(KERN_ERR "dsp_spos: symbol <%s> duplicated\n", symbol_name); 199 dev_err(chip->card->dev, 200 "dsp_spos: symbol <%s> duplicated\n", symbol_name); 203 201 return NULL; 204 202 } … … 230 228 231 229 /* better to use vmalloc for this big table */ 232 ins->symbol_table.symbols = vmalloc(sizeof(struct dsp_symbol_entry) * 233 DSP_MAX_SYMBOLS); 230 ins->symbol_table.symbols = 231 vmalloc(array_size(DSP_MAX_SYMBOLS, 232 sizeof(struct dsp_symbol_entry))); 234 233 ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL); 235 ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL); 234 ins->modules = kmalloc_array(DSP_MAX_MODULES, 235 sizeof(struct dsp_module_desc), 236 GFP_KERNEL); 236 237 if (!ins->symbol_table.symbols || !ins->code.data || !ins->modules) { 237 238 cs46xx_dsp_spos_destroy(chip); … … 288 289 289 290 cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); 290 #ifdef CONFIG_PM 291 #ifdef CONFIG_PM_SLEEP 291 292 kfree(ins->scbs[i].data); 292 293 #endif … … 306 307 307 308 if (!parameter) { 308 snd_printdd("dsp_spos: module got no parameter segment\n"); 309 dev_dbg(chip->card->dev, 310 "dsp_spos: module got no parameter segment\n"); 309 311 return 0; 310 312 } … … 313 315 dsize = parameter->size * 4; 314 316 315 snd_printdd("dsp_spos: "316 "downloading parameter data to chip (%08x-%08x)\n",317 dev_dbg(chip->card->dev, 318 "dsp_spos: downloading parameter data to chip (%08x-%08x)\n", 317 319 doffset,doffset + dsize); 318 320 if (snd_cs46xx_download (chip, parameter->data, doffset, dsize)) { 319 snd_printk(KERN_ERR "dsp_spos: "320 "failed to download parameter data to DSP\n");321 dev_err(chip->card->dev, 322 "dsp_spos: failed to download parameter data to DSP\n"); 321 323 return -EINVAL; 322 324 } … … 330 332 331 333 if (!sample) { 332 snd_printdd("dsp_spos: module got no sample segment\n"); 334 dev_dbg(chip->card->dev, 335 "dsp_spos: module got no sample segment\n"); 333 336 return 0; 334 337 } … … 337 340 dsize = sample->size * 4; 338 341 339 snd_printdd("dsp_spos: downloading sample data to chip (%08x-%08x)\n", 342 dev_dbg(chip->card->dev, 343 "dsp_spos: downloading sample data to chip (%08x-%08x)\n", 340 344 doffset,doffset + dsize); 341 345 342 346 if (snd_cs46xx_download (chip,sample->data,doffset,dsize)) { 343 snd_printk(KERN_ERR "dsp_spos: failed to sample data to DSP\n"); 347 dev_err(chip->card->dev, 348 "dsp_spos: failed to sample data to DSP\n"); 344 349 return -EINVAL; 345 350 } … … 355 360 356 361 if (ins->nmodules == DSP_MAX_MODULES - 1) { 357 snd_printk(KERN_ERR "dsp_spos: to many modules loaded into DSP\n"); 362 dev_err(chip->card->dev, 363 "dsp_spos: to many modules loaded into DSP\n"); 358 364 return -ENOMEM; 359 365 } 360 366 361 snd_printdd("dsp_spos: loading module %s into DSP\n", module->module_name); 367 dev_dbg(chip->card->dev, 368 "dsp_spos: loading module %s into DSP\n", module->module_name); 362 369 363 370 if (ins->nmodules == 0) { 364 snd_printdd("dsp_spos: clearing parameter area\n");371 dev_dbg(chip->card->dev, "dsp_spos: clearing parameter area\n"); 365 372 snd_cs46xx_clear_BA1(chip, DSP_PARAMETER_BYTE_OFFSET, DSP_PARAMETER_BYTE_SIZE); 366 373 } … … 372 379 373 380 if (ins->nmodules == 0) { 374 snd_printdd("dsp_spos: clearing sample area\n");381 dev_dbg(chip->card->dev, "dsp_spos: clearing sample area\n"); 375 382 snd_cs46xx_clear_BA1(chip, DSP_SAMPLE_BYTE_OFFSET, DSP_SAMPLE_BYTE_SIZE); 376 383 } … … 382 389 383 390 if (ins->nmodules == 0) { 384 snd_printdd("dsp_spos: clearing code area\n");391 dev_dbg(chip->card->dev, "dsp_spos: clearing code area\n"); 385 392 snd_cs46xx_clear_BA1(chip, DSP_CODE_BYTE_OFFSET, DSP_CODE_BYTE_SIZE); 386 393 } 387 394 388 395 if (code == NULL) { 389 snd_printdd("dsp_spos: module got no code segment\n"); 396 dev_dbg(chip->card->dev, 397 "dsp_spos: module got no code segment\n"); 390 398 } else { 391 399 if (ins->code.offset + code->size > DSP_CODE_BYTE_SIZE) { 392 snd_printk(KERN_ERR "dsp_spos: no space available in DSP\n"); 400 dev_err(chip->card->dev, 401 "dsp_spos: no space available in DSP\n"); 393 402 return -ENOMEM; 394 403 } … … 402 411 return -ENOMEM; 403 412 if (add_symbols(chip,module)) { 404 snd_printk(KERN_ERR "dsp_spos: failed to load symbol table\n"); 413 dev_err(chip->card->dev, 414 "dsp_spos: failed to load symbol table\n"); 405 415 return -ENOMEM; 406 416 } … … 408 418 doffset = (code->offset * 4 + ins->code.offset * 4 + DSP_CODE_BYTE_OFFSET); 409 419 dsize = code->size * 4; 410 snd_printdd("dsp_spos: downloading code to chip (%08x-%08x)\n", 420 dev_dbg(chip->card->dev, 421 "dsp_spos: downloading code to chip (%08x-%08x)\n", 411 422 doffset,doffset + dsize); 412 423 … … 414 425 415 426 if (snd_cs46xx_download (chip,(ins->code.data + ins->code.offset),doffset,dsize)) { 416 snd_printk(KERN_ERR "dsp_spos: failed to download code to DSP\n"); 427 dev_err(chip->card->dev, 428 "dsp_spos: failed to download code to DSP\n"); 417 429 return -EINVAL; 418 430 } … … 448 460 449 461 #if 0 450 printk ("dsp_spos: symbol <%s> type %02x not found\n",462 dev_err(chip->card->dev, "dsp_spos: symbol <%s> type %02x not found\n", 451 463 symbol_name,symbol_type); 452 464 #endif … … 456 468 457 469 458 #ifdef CONFIG_ PROC_FS470 #ifdef CONFIG_SND_PROC_FS 459 471 static struct dsp_symbol_entry * 460 472 cs46xx_dsp_lookup_symbol_addr (struct snd_cs46xx * chip, u32 address, int symbol_type) … … 775 787 ins->snd_card = card; 776 788 777 if ((entry = snd_info_create_card_entry(card, "dsp", card->proc_root)) != NULL) { 778 entry->content = SNDRV_INFO_CONTENT_TEXT; 779 entry->mode = S_IFDIR | S_IRUGO | S_IXUGO; 780 781 if (snd_info_register(entry) < 0) { 782 snd_info_free_entry(entry); 783 entry = NULL; 784 } 785 } 786 789 entry = snd_info_create_card_entry(card, "dsp", card->proc_root); 790 if (entry) 791 entry->mode = S_IFDIR | 0555; 787 792 ins->proc_dsp_dir = entry; 788 793 … … 790 795 return -ENOMEM; 791 796 792 if ((entry = snd_info_create_card_entry(card, "spos_symbols", ins->proc_dsp_dir)) != NULL) { 793 entry->content = SNDRV_INFO_CONTENT_TEXT; 794 entry->private_data = chip; 795 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; 796 entry->c.text.read = cs46xx_dsp_proc_symbol_table_read; 797 if (snd_info_register(entry) < 0) { 798 snd_info_free_entry(entry); 799 entry = NULL; 800 } 801 } 802 ins->proc_sym_info_entry = entry; 797 entry = snd_info_create_card_entry(card, "spos_symbols", 798 ins->proc_dsp_dir); 799 if (entry) 800 snd_info_set_text_ops(entry, chip, 801 cs46xx_dsp_proc_symbol_table_read); 803 802 804 if ((entry = snd_info_create_card_entry(card, "spos_modules", ins->proc_dsp_dir)) != NULL) { 805 entry->content = SNDRV_INFO_CONTENT_TEXT; 806 entry->private_data = chip; 807 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; 808 entry->c.text.read = cs46xx_dsp_proc_modules_read; 809 if (snd_info_register(entry) < 0) { 810 snd_info_free_entry(entry); 811 entry = NULL; 812 } 813 } 814 ins->proc_modules_info_entry = entry; 815 816 if ((entry = snd_info_create_card_entry(card, "parameter", ins->proc_dsp_dir)) != NULL) { 817 entry->content = SNDRV_INFO_CONTENT_TEXT; 818 entry->private_data = chip; 819 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; 820 entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read; 821 if (snd_info_register(entry) < 0) { 822 snd_info_free_entry(entry); 823 entry = NULL; 824 } 825 } 826 ins->proc_parameter_dump_info_entry = entry; 827 828 if ((entry = snd_info_create_card_entry(card, "sample", ins->proc_dsp_dir)) != NULL) { 829 entry->content = SNDRV_INFO_CONTENT_TEXT; 830 entry->private_data = chip; 831 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; 832 entry->c.text.read = cs46xx_dsp_proc_sample_dump_read; 833 if (snd_info_register(entry) < 0) { 834 snd_info_free_entry(entry); 835 entry = NULL; 836 } 837 } 838 ins->proc_sample_dump_info_entry = entry; 839 840 if ((entry = snd_info_create_card_entry(card, "task_tree", ins->proc_dsp_dir)) != NULL) { 841 entry->content = SNDRV_INFO_CONTENT_TEXT; 842 entry->private_data = chip; 843 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; 844 entry->c.text.read = cs46xx_dsp_proc_task_tree_read; 845 if (snd_info_register(entry) < 0) { 846 snd_info_free_entry(entry); 847 entry = NULL; 848 } 849 } 850 ins->proc_task_info_entry = entry; 851 852 if ((entry = snd_info_create_card_entry(card, "scb_info", ins->proc_dsp_dir)) != NULL) { 853 entry->content = SNDRV_INFO_CONTENT_TEXT; 854 entry->private_data = chip; 855 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; 856 entry->c.text.read = cs46xx_dsp_proc_scb_read; 857 if (snd_info_register(entry) < 0) { 858 snd_info_free_entry(entry); 859 entry = NULL; 860 } 861 } 862 ins->proc_scb_info_entry = entry; 803 entry = snd_info_create_card_entry(card, "spos_modules", 804 ins->proc_dsp_dir); 805 if (entry) 806 snd_info_set_text_ops(entry, chip, 807 cs46xx_dsp_proc_modules_read); 808 809 entry = snd_info_create_card_entry(card, "parameter", 810 ins->proc_dsp_dir); 811 if (entry) 812 snd_info_set_text_ops(entry, chip, 813 cs46xx_dsp_proc_parameter_dump_read); 814 815 entry = snd_info_create_card_entry(card, "sample", 816 ins->proc_dsp_dir); 817 if (entry) 818 snd_info_set_text_ops(entry, chip, 819 cs46xx_dsp_proc_sample_dump_read); 820 821 entry = snd_info_create_card_entry(card, "task_tree", 822 ins->proc_dsp_dir); 823 if (entry) 824 snd_info_set_text_ops(entry, chip, 825 cs46xx_dsp_proc_task_tree_read); 826 827 entry = snd_info_create_card_entry(card, "scb_info", 828 ins->proc_dsp_dir); 829 if (entry) 830 snd_info_set_text_ops(entry, chip, 831 cs46xx_dsp_proc_scb_read); 863 832 864 833 mutex_lock(&chip->spos_mutex); … … 879 848 int i; 880 849 881 snd_info_free_entry(ins->proc_sym_info_entry); 882 ins->proc_sym_info_entry = NULL; 883 884 snd_info_free_entry(ins->proc_modules_info_entry); 885 ins->proc_modules_info_entry = NULL; 886 887 snd_info_free_entry(ins->proc_parameter_dump_info_entry); 888 ins->proc_parameter_dump_info_entry = NULL; 889 890 snd_info_free_entry(ins->proc_sample_dump_info_entry); 891 ins->proc_sample_dump_info_entry = NULL; 892 893 snd_info_free_entry(ins->proc_scb_info_entry); 894 ins->proc_scb_info_entry = NULL; 895 896 snd_info_free_entry(ins->proc_task_info_entry); 897 ins->proc_task_info_entry = NULL; 850 if (!ins) 851 return 0; 898 852 899 853 mutex_lock(&chip->spos_mutex); … … 909 863 return 0; 910 864 } 911 #endif /* CONFIG_PROC_FS */ 912 913 static int debug_tree; 865 #endif /* CONFIG_SND_PROC_FS */ 866 914 867 static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data, 915 868 u32 dest, int size) … … 920 873 921 874 for (i = 0; i < size; ++i) { 922 if (debug_tree) printk ("addr %p, val %08x\n",spdst,task_data[i]); 875 dev_dbg(chip->card->dev, "addr %p, val %08x\n", 876 spdst, task_data[i]); 923 877 writel(task_data[i],spdst); 924 878 spdst += sizeof(u32); … … 926 880 } 927 881 928 static int debug_scb;929 882 static void _dsp_create_scb (struct snd_cs46xx *chip, u32 * scb_data, u32 dest) 930 883 { … … 934 887 935 888 for (i = 0; i < 0x10; ++i) { 936 if (debug_scb) printk ("addr %p, val %08x\n",spdst,scb_data[i]); 889 dev_dbg(chip->card->dev, "addr %p, val %08x\n", 890 spdst, scb_data[i]); 937 891 writel(scb_data[i],spdst); 938 892 spdst += sizeof(u32); … … 961 915 962 916 if (ins->nscb == DSP_MAX_SCB_DESC - 1) { 963 snd_printk(KERN_ERR "dsp_spos: got no place for other SCB\n"); 917 dev_err(chip->card->dev, 918 "dsp_spos: got no place for other SCB\n"); 964 919 return NULL; 965 920 } … … 992 947 993 948 if (ins->ntask == DSP_MAX_TASK_DESC - 1) { 994 snd_printk(KERN_ERR "dsp_spos: got no place for other TASK\n"); 949 dev_err(chip->card->dev, 950 "dsp_spos: got no place for other TASK\n"); 995 951 return NULL; 996 952 } … … 1020 976 struct dsp_scb_descriptor * desc; 1021 977 1022 #ifdef CONFIG_PM 978 #ifdef CONFIG_PM_SLEEP 1023 979 /* copy the data for resume */ 1024 980 scb_data = kmemdup(scb_data, SCB_BYTES, GFP_KERNEL); … … 1032 988 _dsp_create_scb(chip,scb_data,dest); 1033 989 } else { 1034 snd_printk(KERN_ERR"dsp_spos: failed to map SCB\n");1035 #ifdef CONFIG_PM 990 dev_err(chip->card->dev, "dsp_spos: failed to map SCB\n"); 991 #ifdef CONFIG_PM_SLEEP 1036 992 kfree(scb_data); 1037 993 #endif … … 1053 1009 _dsp_create_task_tree(chip,task_data,dest,size); 1054 1010 } else { 1055 snd_printk(KERN_ERR"dsp_spos: failed to map TASK\n");1011 dev_err(chip->card->dev, "dsp_spos: failed to map TASK\n"); 1056 1012 } 1057 1013 … … 1083 1039 int fifo_addr, fifo_span, valid_slots; 1084 1040 1085 static struct dsp_spos_control_block sposcb = {1041 static const struct dsp_spos_control_block sposcb = { 1086 1042 /* 0 */ HFG_TREE_SCB,HFG_STACK, 1087 1043 /* 1 */ SPOSCB_ADDR,BG_TREE_SCB_ADDR, … … 1106 1062 null_algorithm = cs46xx_dsp_lookup_symbol(chip, "NULLALGORITHM", SYMBOL_CODE); 1107 1063 if (null_algorithm == NULL) { 1108 snd_printk(KERN_ERR "dsp_spos: symbol NULLALGORITHM not found\n"); 1064 dev_err(chip->card->dev, 1065 "dsp_spos: symbol NULLALGORITHM not found\n"); 1109 1066 return -EIO; 1110 1067 } … … 1112 1069 fg_task_tree_header_code = cs46xx_dsp_lookup_symbol(chip, "FGTASKTREEHEADERCODE", SYMBOL_CODE); 1113 1070 if (fg_task_tree_header_code == NULL) { 1114 snd_printk(KERN_ERR "dsp_spos: symbol FGTASKTREEHEADERCODE not found\n"); 1071 dev_err(chip->card->dev, 1072 "dsp_spos: symbol FGTASKTREEHEADERCODE not found\n"); 1115 1073 return -EIO; 1116 1074 } … … 1118 1076 task_tree_header_code = cs46xx_dsp_lookup_symbol(chip, "TASKTREEHEADERCODE", SYMBOL_CODE); 1119 1077 if (task_tree_header_code == NULL) { 1120 snd_printk(KERN_ERR "dsp_spos: symbol TASKTREEHEADERCODE not found\n"); 1078 dev_err(chip->card->dev, 1079 "dsp_spos: symbol TASKTREEHEADERCODE not found\n"); 1121 1080 return -EIO; 1122 1081 } … … 1124 1083 task_tree_thread = cs46xx_dsp_lookup_symbol(chip, "TASKTREETHREAD", SYMBOL_CODE); 1125 1084 if (task_tree_thread == NULL) { 1126 snd_printk(KERN_ERR "dsp_spos: symbol TASKTREETHREAD not found\n"); 1085 dev_err(chip->card->dev, 1086 "dsp_spos: symbol TASKTREETHREAD not found\n"); 1127 1087 return -EIO; 1128 1088 } … … 1130 1090 magic_snoop_task = cs46xx_dsp_lookup_symbol(chip, "MAGICSNOOPTASK", SYMBOL_CODE); 1131 1091 if (magic_snoop_task == NULL) { 1132 snd_printk(KERN_ERR "dsp_spos: symbol MAGICSNOOPTASK not found\n"); 1092 dev_err(chip->card->dev, 1093 "dsp_spos: symbol MAGICSNOOPTASK not found\n"); 1133 1094 return -EIO; 1134 1095 } … … 1414 1375 if (chip->nr_ac97_codecs == 2) { 1415 1376 /* create CODEC tasklet for rear Center/LFE output 1416 slot 6 and 9 on secon adry CODEC */1377 slot 6 and 9 on secondary CODEC */ 1417 1378 clfe_codec_out_scb = cs46xx_dsp_create_codec_out_scb(chip,"CodecOutSCB_CLFE",0x0030,0x0030, 1418 1379 CLFE_MIXER_SCB_ADDR, … … 1477 1438 1478 1439 _fail_end: 1479 snd_printk(KERN_ERR"dsp_spos: failed to setup SCB's in DSP\n");1440 dev_err(chip->card->dev, "dsp_spos: failed to setup SCB's in DSP\n"); 1480 1441 return -EINVAL; 1481 1442 } … … 1492 1453 s16_async_codec_input_task = cs46xx_dsp_lookup_symbol(chip, "S16_ASYNCCODECINPUTTASK", SYMBOL_CODE); 1493 1454 if (s16_async_codec_input_task == NULL) { 1494 snd_printk(KERN_ERR "dsp_spos: symbol S16_ASYNCCODECINPUTTASK not found\n"); 1455 dev_err(chip->card->dev, 1456 "dsp_spos: symbol S16_ASYNCCODECINPUTTASK not found\n"); 1495 1457 return -EIO; 1496 1458 } 1497 1459 spdifo_task = cs46xx_dsp_lookup_symbol(chip, "SPDIFOTASK", SYMBOL_CODE); 1498 1460 if (spdifo_task == NULL) { 1499 snd_printk(KERN_ERR "dsp_spos: symbol SPDIFOTASK not found\n"); 1461 dev_err(chip->card->dev, 1462 "dsp_spos: symbol SPDIFOTASK not found\n"); 1500 1463 return -EIO; 1501 1464 } … … 1503 1466 spdifi_task = cs46xx_dsp_lookup_symbol(chip, "SPDIFITASK", SYMBOL_CODE); 1504 1467 if (spdifi_task == NULL) { 1505 snd_printk(KERN_ERR "dsp_spos: symbol SPDIFITASK not found\n"); 1468 dev_err(chip->card->dev, 1469 "dsp_spos: symbol SPDIFITASK not found\n"); 1506 1470 return -EIO; 1507 1471 } … … 1884 1848 1885 1849 if (i == 25) { 1886 snd_printk(KERN_ERR "dsp_spos: SPIOWriteTask not responding\n"); 1850 dev_err(chip->card->dev, 1851 "dsp_spos: SPIOWriteTask not responding\n"); 1887 1852 return -EBUSY; 1888 1853 } … … 1938 1903 } 1939 1904 1940 #ifdef CONFIG_PM 1905 #ifdef CONFIG_PM_SLEEP 1941 1906 int cs46xx_dsp_resume(struct snd_cs46xx * chip) 1942 1907 { -
GPL/trunk/alsa-kernel/pci/cs46xx/dsp_spos.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *5 *6 * This program is free software; you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation; either version 2 of the License, or9 * (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 of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with this program; if not, write to the Free Software18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19 *20 5 */ 21 6 -
GPL/trunk/alsa-kernel/pci/cs46xx/dsp_spos_scb_lib.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 *3 * This program is free software; you can redistribute it and/or modify4 * it under the terms of the GNU General Public License as published by5 * the Free Software Foundation; either version 2 of the License, or6 * (at your option) any later version.7 *8 * This program is distributed in the hope that it will be useful,9 * but WITHOUT ANY WARRANTY; without even the implied warranty of10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11 * GNU General Public License for more details.12 *13 * You should have received a copy of the GNU General Public License14 * along with this program; if not, write to the Free Software15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA16 *17 3 */ 18 4 … … 22 8 23 9 24 #include < asm/io.h>10 #include <linux/io.h> 25 11 #include <linux/delay.h> 26 12 #include <linux/pm.h> … … 32 18 #include <sound/control.h> 33 19 #include <sound/info.h> 34 #include <sound/cs46xx.h>20 #include "cs46xx.h" 35 21 36 22 #include "cs46xx_lib.h" … … 68 54 } 69 55 70 #ifdef CONFIG_ PROC_FS56 #ifdef CONFIG_SND_PROC_FS 71 57 static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry, 72 58 struct snd_info_buffer *buffer) … … 74 60 struct proc_scb_info * scb_info = entry->private_data; 75 61 struct dsp_scb_descriptor * scb = scb_info->scb_desc; 76 struct dsp_spos_instance * ins;77 62 struct snd_cs46xx *chip = scb_info->chip; 78 63 int j,col; 79 64 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; 80 81 ins = chip->dsp_spos_instance;82 65 83 66 mutex_lock(&chip->spos_mutex); … … 204 187 205 188 ins->scbs[scb->index].deleted = 1; 206 #ifdef CONFIG_PM 189 #ifdef CONFIG_PM_SLEEP 207 190 kfree(ins->scbs[scb->index].data); 208 191 ins->scbs[scb->index].data = NULL; … … 229 212 230 213 231 #ifdef CONFIG_ PROC_FS214 #ifdef CONFIG_SND_PROC_FS 232 215 void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb) 233 216 { 234 217 if (scb->proc_info) { 235 218 struct proc_scb_info * scb_info = scb->proc_info->private_data; 236 237 snd_printdd("cs46xx_dsp_proc_free_scb_desc: freeing %s\n",scb->scb_name); 219 struct snd_cs46xx *chip = scb_info->chip; 220 221 dev_dbg(chip->card->dev, 222 "cs46xx_dsp_proc_free_scb_desc: freeing %s\n", 223 scb->scb_name); 238 224 239 225 snd_info_free_entry(scb->proc_info); … … 255 241 scb->proc_info == NULL) { 256 242 257 if ((entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, 258 ins->proc_dsp_dir)) != NULL) { 243 entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, 244 ins->proc_dsp_dir); 245 if (entry) { 259 246 scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL); 260 247 if (!scb_info) { … … 266 253 scb_info->chip = chip; 267 254 scb_info->scb_desc = scb; 268 269 entry->content = SNDRV_INFO_CONTENT_TEXT; 270 entry->private_data = scb_info; 271 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; 272 273 entry->c.text.read = cs46xx_dsp_proc_scb_info_read; 274 275 if (snd_info_register(entry) < 0) { 276 snd_info_free_entry(entry); 277 kfree (scb_info); 278 entry = NULL; 279 } 255 snd_info_set_text_ops(entry, scb_info, 256 cs46xx_dsp_proc_scb_info_read); 280 257 } 281 258 out: … … 283 260 } 284 261 } 285 #endif /* CONFIG_ PROC_FS */262 #endif /* CONFIG_SND_PROC_FS */ 286 263 287 264 static struct dsp_scb_descriptor * … … 306 283 scb_data[SCBfuncEntryPtr] |= task_entry->address; 307 284 308 snd_printdd("dsp_spos: creating SCB <%s>\n",name);285 dev_dbg(chip->card->dev, "dsp_spos: creating SCB <%s>\n", name); 309 286 310 287 scb = cs46xx_dsp_create_scb(chip,name,scb_data,dest); … … 321 298 if (scb->parent_scb_ptr) { 322 299 #if 0 323 printk ("scb->parent_scb_ptr = %s\n",scb->parent_scb_ptr->scb_name); 324 printk ("scb->parent_scb_ptr->next_scb_ptr = %s\n",scb->parent_scb_ptr->next_scb_ptr->scb_name); 325 printk ("scb->parent_scb_ptr->sub_list_ptr = %s\n",scb->parent_scb_ptr->sub_list_ptr->scb_name); 300 dev_dbg(chip->card->dev, 301 "scb->parent_scb_ptr = %s\n", 302 scb->parent_scb_ptr->scb_name); 303 dev_dbg(chip->card->dev, 304 "scb->parent_scb_ptr->next_scb_ptr = %s\n", 305 scb->parent_scb_ptr->next_scb_ptr->scb_name); 306 dev_dbg(chip->card->dev, 307 "scb->parent_scb_ptr->sub_list_ptr = %s\n", 308 scb->parent_scb_ptr->sub_list_ptr->scb_name); 326 309 #endif 327 310 /* link to parent SCB */ … … 369 352 370 353 if (task_entry == NULL) { 371 snd_printk (KERN_ERR "dsp_spos: symbol %s not found\n",task_entry_name); 354 dev_err(chip->card->dev, 355 "dsp_spos: symbol %s not found\n", task_entry_name); 372 356 return NULL; 373 357 } … … 583 567 584 568 if (ins->null_algorithm == NULL) { 585 snd_printk (KERN_ERR "dsp_spos: symbol NULLALGORITHM not found\n"); 569 dev_err(chip->card->dev, 570 "dsp_spos: symbol NULLALGORITHM not found\n"); 586 571 return NULL; 587 572 } … … 613 598 unsigned int correctionPerGOF, correctionPerSec; 614 599 615 snd_printdd( "dsp_spos: setting %s rate to %u\n",scb_name,rate); 600 dev_dbg(chip->card->dev, "dsp_spos: setting %s rate to %u\n", 601 scb_name, rate); 616 602 617 603 /* … … 671 657 672 658 if (ins->s16_up == NULL) { 673 snd_printk (KERN_ERR "dsp_spos: symbol S16_UPSRC not found\n"); 659 dev_err(chip->card->dev, 660 "dsp_spos: symbol S16_UPSRC not found\n"); 674 661 return NULL; 675 662 } … … 1159 1146 } 1160 1147 1161 static u32 pcm_reader_buffer_addr[DSP_MAX_PCM_CHANNELS] = {1148 static const u32 pcm_reader_buffer_addr[DSP_MAX_PCM_CHANNELS] = { 1162 1149 0x0600, /* 1 */ 1163 1150 0x1500, /* 2 */ … … 1194 1181 }; 1195 1182 1196 static u32 src_output_buffer_addr[DSP_MAX_SRC_NR] = {1183 static const u32 src_output_buffer_addr[DSP_MAX_SRC_NR] = { 1197 1184 0x2B80, 1198 1185 0x2BA0, … … 1211 1198 }; 1212 1199 1213 static u32 src_delay_buffer_addr[DSP_MAX_SRC_NR] = {1200 static const u32 src_delay_buffer_addr[DSP_MAX_SRC_NR] = { 1214 1201 0x2480, 1215 1202 0x2500, … … 1266 1253 alter the raw data stream ...) */ 1267 1254 if (sample_rate == 48000) { 1268 snd_printdd ("IEC958 pass through\n");1255 dev_dbg(chip->card->dev, "IEC958 pass through\n"); 1269 1256 /* Hack to bypass creating a new SRC */ 1270 1257 pass_through = 1; … … 1300 1287 1301 1288 if (pcm_index == -1) { 1302 snd_printk (KERN_ERR"dsp_spos: no free PCM channel\n");1289 dev_err(chip->card->dev, "dsp_spos: no free PCM channel\n"); 1303 1290 return NULL; 1304 1291 } … … 1306 1293 if (src_scb == NULL) { 1307 1294 if (ins->nsrc_scb >= DSP_MAX_SRC_NR) { 1308 snd_printk(KERN_ERR "dsp_spos: to many SRC instances\n!"); 1295 dev_err(chip->card->dev, 1296 "dsp_spos: too many SRC instances\n!"); 1309 1297 return NULL; 1310 1298 } … … 1332 1320 snprintf (scb_name,DSP_MAX_SCB_NAME,"SrcTask_SCB%d",src_index); 1333 1321 1334 snd_printdd( "dsp_spos: creating SRC \"%s\"\n",scb_name); 1322 dev_dbg(chip->card->dev, 1323 "dsp_spos: creating SRC \"%s\"\n", scb_name); 1335 1324 src_scb = cs46xx_dsp_create_src_task_scb(chip,scb_name, 1336 1325 sample_rate, … … 1344 1333 1345 1334 if (!src_scb) { 1346 snd_printk (KERN_ERR "dsp_spos: failed to create SRCtaskSCB\n"); 1335 dev_err(chip->card->dev, 1336 "dsp_spos: failed to create SRCtaskSCB\n"); 1347 1337 return NULL; 1348 1338 } … … 1356 1346 snprintf (scb_name,DSP_MAX_SCB_NAME,"PCMReader_SCB%d",pcm_index); 1357 1347 1358 snd_printdd( "dsp_spos: creating PCM \"%s\" (%d)\n",scb_name,1359 1348 dev_dbg(chip->card->dev, "dsp_spos: creating PCM \"%s\" (%d)\n", 1349 scb_name, pcm_channel_id); 1360 1350 1361 1351 pcm_scb = cs46xx_dsp_create_pcm_reader_scb(chip,scb_name, … … 1370 1360 1371 1361 if (!pcm_scb) { 1372 snd_printk (KERN_ERR "dsp_spos: failed to create PCMreaderSCB\n"); 1362 dev_err(chip->card->dev, 1363 "dsp_spos: failed to create PCMreaderSCB\n"); 1373 1364 return NULL; 1374 1365 } … … 1420 1411 break; 1421 1412 default: 1422 snd_printdd ("period size (%d) not supported by HW\n", period_size); 1413 dev_dbg(chip->card->dev, 1414 "period size (%d) not supported by HW\n", period_size); 1423 1415 return -EINVAL; 1424 1416 } … … 1458 1450 break; 1459 1451 default: 1460 snd_printdd ("period size (%d) not supported by HW\n", period_size); 1452 dev_dbg(chip->card->dev, 1453 "period size (%d) not supported by HW\n", period_size); 1461 1454 return -EINVAL; 1462 1455 } … … 1724 1717 1725 1718 if ( ins->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED ) { 1726 /* remove AsynchFGTxSCB and andPCMSerialInput_II */1719 /* remove AsynchFGTxSCB and PCMSerialInput_II */ 1727 1720 cs46xx_dsp_disable_spdif_out (chip); 1728 1721
Note:
See TracChangeset
for help on using the changeset viewer.