Lines Matching +full:max +full:- +full:channels +full:- +full:clocked
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Abramo Bagnara <abramo@alsa-project.org>
9 * - Sometimes the SPDIF input DSP tasks get's unsynchronized
13 * - On the Hercules Game Theater XP the amplifier are sometimes turned
17 * - Secondary CODEC on some soundcards
18 * - SPDIF input support for other sample rates then 48khz
19 * - Posibility to mix the SPDIF output with analog sources.
20 * - PCM channels for Center and LFE on secondary codec
86 chip->active_ctrl(chip, 1); in snd_cs46xx_codec_read()
94 * 3. Write ACCTL = Control Register = 460h for initiating the write7---55 in snd_cs46xx_codec_read()
104 dev_warn(chip->card->dev, "ACCTL_VFRM not set 0x%x\n", tmp); in snd_cs46xx_codec_read()
118 * set DCV - will clear when process completed in snd_cs46xx_codec_read()
119 * set CRW - Read command in snd_cs46xx_codec_read()
120 * set VFRM - valid frame enabled in snd_cs46xx_codec_read()
121 * set ESYN - ASYNC generation enabled in snd_cs46xx_codec_read()
122 * set RSTN - ARST# inactive, AC97 codec not reset in snd_cs46xx_codec_read()
156 dev_err(chip->card->dev, in snd_cs46xx_codec_read()
169 * VSTS - Valid Status in snd_cs46xx_codec_read()
176 dev_err(chip->card->dev, in snd_cs46xx_codec_read()
188 dev_dbg(chip->card->dev, in snd_cs46xx_codec_read()
197 chip->active_ctrl(chip, -1); in snd_cs46xx_codec_read()
204 struct snd_cs46xx *chip = ac97->private_data; in snd_cs46xx_ac97_read()
206 int codec_index = ac97->num; in snd_cs46xx_ac97_read()
229 chip->active_ctrl(chip, 1); in snd_cs46xx_codec_write()
245 * set DCV - will clear when process completed in snd_cs46xx_codec_write()
246 * reset CRW - Write command in snd_cs46xx_codec_write()
247 * set VFRM - valid frame enabled in snd_cs46xx_codec_write()
248 * set ESYN - ASYNC generation enabled in snd_cs46xx_codec_write()
249 * set RSTN - ARST# inactive, AC97 codec not reset in snd_cs46xx_codec_write()
278 dev_err(chip->card->dev, in snd_cs46xx_codec_write()
282 chip->active_ctrl(chip, -1); in snd_cs46xx_codec_write()
289 struct snd_cs46xx *chip = ac97->private_data; in snd_cs46xx_ac97_write()
290 int codec_index = ac97->num; in snd_cs46xx_ac97_write()
314 return -EINVAL; in snd_cs46xx_download()
315 dst = chip->region.idx[bank+1].remap_addr + offset; in snd_cs46xx_download()
318 /* writel already converts 32-bit value to right endianess */ in snd_cs46xx_download()
319 while (len-- > 0) { in snd_cs46xx_download()
334 while (len-- > 0) in memcpy_le32()
355 kfree(module->module_name); in free_module_desc()
356 kfree(module->symbol_table.symbols); in free_module_desc()
357 if (module->segments) { in free_module_desc()
359 for (i = 0; i < module->nsegments; i++) in free_module_desc()
360 kfree(module->segments[i].data); in free_module_desc()
361 kfree(module->segments); in free_module_desc()
394 err = request_firmware(&fw, fw_path, &chip->pci->dev); in load_firmware()
397 fwsize = fw->size / 4; in load_firmware()
399 err = -EINVAL; in load_firmware()
403 err = -ENOMEM; in load_firmware()
407 module->module_name = kstrdup(fw_name, GFP_KERNEL); in load_firmware()
408 if (!module->module_name) in load_firmware()
412 fwdat = (const __le32 *)fw->data; in load_firmware()
413 nums = module->symbol_table.nsymbols = le32_to_cpu(fwdat[fwlen++]); in load_firmware()
416 module->symbol_table.symbols = in load_firmware()
418 if (!module->symbol_table.symbols) in load_firmware()
422 &module->symbol_table.symbols[i]; in load_firmware()
425 entry->address = le32_to_cpu(fwdat[fwlen++]); in load_firmware()
426 memcpy(entry->symbol_name, &fwdat[fwlen], DSP_MAX_SYMBOL_NAME - 1); in load_firmware()
428 entry->symbol_type = le32_to_cpu(fwdat[fwlen++]); in load_firmware()
433 nums = module->nsegments = le32_to_cpu(fwdat[fwlen++]); in load_firmware()
436 module->segments = in load_firmware()
438 if (!module->segments) in load_firmware()
441 struct dsp_segment_desc *entry = &module->segments[i]; in load_firmware()
444 entry->segment_type = le32_to_cpu(fwdat[fwlen++]); in load_firmware()
445 entry->offset = le32_to_cpu(fwdat[fwlen++]); in load_firmware()
446 entry->size = le32_to_cpu(fwdat[fwlen++]); in load_firmware()
447 if (fwlen + entry->size > fwsize) in load_firmware()
449 entry->data = kmalloc_array(entry->size, 4, GFP_KERNEL); in load_firmware()
450 if (!entry->data) in load_firmware()
452 memcpy_le32(entry->data, &fwdat[fwlen], entry->size * 4); in load_firmware()
453 fwlen += entry->size; in load_firmware()
461 err = -EINVAL; in load_firmware()
477 return -EINVAL; in snd_cs46xx_clear_BA1()
478 dst = chip->region.idx[bank+1].remap_addr + offset; in snd_cs46xx_clear_BA1()
481 /* writel already converts 32-bit value to right endianess */ in snd_cs46xx_clear_BA1()
482 while (len-- > 0) { in snd_cs46xx_clear_BA1()
506 err = request_firmware(&fw, "cs46xx/ba1", &chip->pci->dev); in load_firmware()
509 if (fw->size != sizeof(*chip->ba1)) { in load_firmware()
510 err = -EINVAL; in load_firmware()
514 chip->ba1 = vmalloc(sizeof(*chip->ba1)); in load_firmware()
515 if (!chip->ba1) { in load_firmware()
516 err = -ENOMEM; in load_firmware()
520 memcpy_le32(chip->ba1, fw->data, sizeof(*chip->ba1)); in load_firmware()
525 size += chip->ba1->memory[i].size; in load_firmware()
527 err = -EINVAL; in load_firmware()
538 struct ba1_struct *ba1 = chip->ba1; in snd_cs46xx_download_image()
542 &ba1->map[offset], in snd_cs46xx_download_image()
543 ba1->memory[idx].offset, in snd_cs46xx_download_image()
544 ba1->memory[idx].size); in snd_cs46xx_download_image()
547 offset += ba1->memory[idx].size >> 2; in snd_cs46xx_download_image()
602 dev_err(chip->card->dev, in cs46xx_wait_for_fifo()
604 return -EINVAL; in cs46xx_wait_for_fifo()
640 dev_dbg(chip->card->dev, in snd_cs46xx_clear_serial_FIFOs()
690 dev_err(chip->card->dev, "SPCR_RUNFR never reset\n"); in snd_cs46xx_proc_start()
721 * correctionPerGOF = floor((Fs,in * 2^26 - Fs,out * phiIncr) / in snd_cs46xx_set_play_sample_rate()
723 * ulCorrectionPerSec = Fs,in * 2^26 - Fs,out * phiIncr -M in snd_cs46xx_set_play_sample_rate()
734 tmp1 -= phiIncr * 48000; in snd_cs46xx_set_play_sample_rate()
739 tmp1 -= tmp2 * 48000; in snd_cs46xx_set_play_sample_rate()
741 tmp1 -= correctionPerGOF * GOF_PER_SEC; in snd_cs46xx_set_play_sample_rate()
747 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs46xx_set_play_sample_rate()
751 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs46xx_set_play_sample_rate()
780 * coeffIncr = -floor((Fs,out * 2^23) / Fs,in) in snd_cs46xx_set_capture_sample_rate()
782 * correctionPerGOF = floor((Fs,in * 2^26 - Fs,out * phiIncr) / in snd_cs46xx_set_capture_sample_rate()
784 * correctionPerSec = Fs,in * 2^26 - Fs,out * phiIncr - in snd_cs46xx_set_capture_sample_rate()
794 * initialDelay = dividend(((24 * Fs,in) + Fs,out - 1) / Fs,out) in snd_cs46xx_set_capture_sample_rate()
799 tmp1 -= coeffIncr * 48000; in snd_cs46xx_set_capture_sample_rate()
807 tmp1 -= phiIncr * rate; in snd_cs46xx_set_capture_sample_rate()
812 tmp1 -= tmp2 * rate; in snd_cs46xx_set_capture_sample_rate()
814 tmp1 -= correctionPerGOF * GOF_PER_SEC; in snd_cs46xx_set_capture_sample_rate()
821 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs46xx_set_capture_sample_rate()
828 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs46xx_set_capture_sample_rate()
851 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs46xx_set_capture_sample_rate()
857 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs46xx_set_capture_sample_rate()
867 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_pb_trans_copy()
868 struct snd_cs46xx_pcm * cpcm = runtime->private_data; in snd_cs46xx_pb_trans_copy()
869 memcpy(cpcm->hw_buf.area + rec->hw_data, runtime->dma_area + rec->sw_data, bytes); in snd_cs46xx_pb_trans_copy()
874 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_playback_transfer()
875 struct snd_cs46xx_pcm * cpcm = runtime->private_data; in snd_cs46xx_playback_transfer()
876 return snd_pcm_indirect_playback_transfer(substream, &cpcm->pcm_rec, in snd_cs46xx_playback_transfer()
884 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_cp_trans_copy()
885 memcpy(runtime->dma_area + rec->sw_data, in snd_cs46xx_cp_trans_copy()
886 chip->capt.hw_buf.area + rec->hw_data, bytes); in snd_cs46xx_cp_trans_copy()
892 return snd_pcm_indirect_capture_transfer(substream, &chip->capt.pcm_rec, in snd_cs46xx_capture_transfer()
900 struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data; in snd_cs46xx_playback_direct_pointer()
902 if (snd_BUG_ON(!cpcm->pcm_channel)) in snd_cs46xx_playback_direct_pointer()
903 return -ENXIO; in snd_cs46xx_playback_direct_pointer()
906 ptr = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 2) << 2); in snd_cs46xx_playback_direct_pointer()
910 ptr -= cpcm->hw_buf.addr; in snd_cs46xx_playback_direct_pointer()
911 return ptr >> cpcm->shift; in snd_cs46xx_playback_direct_pointer()
918 struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data; in snd_cs46xx_playback_indirect_pointer()
921 if (snd_BUG_ON(!cpcm->pcm_channel)) in snd_cs46xx_playback_indirect_pointer()
922 return -ENXIO; in snd_cs46xx_playback_indirect_pointer()
923 ptr = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 2) << 2); in snd_cs46xx_playback_indirect_pointer()
927 ptr -= cpcm->hw_buf.addr; in snd_cs46xx_playback_indirect_pointer()
928 return snd_pcm_indirect_playback_pointer(substream, &cpcm->pcm_rec, ptr); in snd_cs46xx_playback_indirect_pointer()
934 size_t ptr = snd_cs46xx_peek(chip, BA1_CBA) - chip->capt.hw_buf.addr; in snd_cs46xx_capture_direct_pointer()
935 return ptr >> chip->capt.shift; in snd_cs46xx_capture_direct_pointer()
941 size_t ptr = snd_cs46xx_peek(chip, BA1_CBA) - chip->capt.hw_buf.addr; in snd_cs46xx_capture_indirect_pointer()
942 return snd_pcm_indirect_capture_pointer(substream, &chip->capt.pcm_rec, ptr); in snd_cs46xx_capture_indirect_pointer()
949 /*struct snd_pcm_runtime *runtime = substream->runtime;*/ in snd_cs46xx_playback_trigger()
953 struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data; in snd_cs46xx_playback_trigger()
954 if (! cpcm->pcm_channel) { in snd_cs46xx_playback_trigger()
955 return -ENXIO; in snd_cs46xx_playback_trigger()
963 snd_cs46xx_poke(chip, (cpcm->pcm_channel->pcm_reader_scb->address + in snd_cs46xx_playback_trigger()
966 if (cpcm->pcm_channel->unlinked) in snd_cs46xx_playback_trigger()
967 cs46xx_dsp_pcm_link(chip,cpcm->pcm_channel); in snd_cs46xx_playback_trigger()
969 if (substream->runtime->periods != CS46XX_FRAGS) in snd_cs46xx_playback_trigger()
972 spin_lock(&chip->reg_lock); in snd_cs46xx_playback_trigger()
973 if (substream->runtime->periods != CS46XX_FRAGS) in snd_cs46xx_playback_trigger()
978 snd_cs46xx_poke(chip, BA1_PCTL, chip->play_ctl | tmp); in snd_cs46xx_playback_trigger()
980 spin_unlock(&chip->reg_lock); in snd_cs46xx_playback_trigger()
987 snd_cs46xx_poke(chip, (cpcm->pcm_channel->pcm_reader_scb->address + in snd_cs46xx_playback_trigger()
990 if (!cpcm->pcm_channel->unlinked) in snd_cs46xx_playback_trigger()
991 cs46xx_dsp_pcm_unlink(chip,cpcm->pcm_channel); in snd_cs46xx_playback_trigger()
993 spin_lock(&chip->reg_lock); in snd_cs46xx_playback_trigger()
999 spin_unlock(&chip->reg_lock); in snd_cs46xx_playback_trigger()
1003 result = -EINVAL; in snd_cs46xx_playback_trigger()
1017 spin_lock(&chip->reg_lock); in snd_cs46xx_capture_trigger()
1023 snd_cs46xx_poke(chip, BA1_CCTL, chip->capt.ctl | tmp); in snd_cs46xx_capture_trigger()
1032 result = -EINVAL; in snd_cs46xx_capture_trigger()
1035 spin_unlock(&chip->reg_lock); in snd_cs46xx_capture_trigger()
1046 if ( cpcm->pcm_channel == NULL) { in _cs46xx_adjust_sample_rate()
1047 cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate, in _cs46xx_adjust_sample_rate()
1048 cpcm, cpcm->hw_buf.addr,cpcm->pcm_channel_id); in _cs46xx_adjust_sample_rate()
1049 if (cpcm->pcm_channel == NULL) { in _cs46xx_adjust_sample_rate()
1050 dev_err(chip->card->dev, in _cs46xx_adjust_sample_rate()
1052 return -ENOMEM; in _cs46xx_adjust_sample_rate()
1054 cpcm->pcm_channel->sample_rate = sample_rate; in _cs46xx_adjust_sample_rate()
1057 if ((int)cpcm->pcm_channel->sample_rate != sample_rate) { in _cs46xx_adjust_sample_rate()
1058 int unlinked = cpcm->pcm_channel->unlinked; in _cs46xx_adjust_sample_rate()
1059 cs46xx_dsp_destroy_pcm_channel (chip,cpcm->pcm_channel); in _cs46xx_adjust_sample_rate()
1061 cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel(chip, sample_rate, cpcm, in _cs46xx_adjust_sample_rate()
1062 cpcm->hw_buf.addr, in _cs46xx_adjust_sample_rate()
1063 cpcm->pcm_channel_id); in _cs46xx_adjust_sample_rate()
1064 if (!cpcm->pcm_channel) { in _cs46xx_adjust_sample_rate()
1065 dev_err(chip->card->dev, in _cs46xx_adjust_sample_rate()
1066 "failed to re-create virtual PCM channel\n"); in _cs46xx_adjust_sample_rate()
1067 return -ENOMEM; in _cs46xx_adjust_sample_rate()
1070 if (!unlinked) cs46xx_dsp_pcm_link (chip,cpcm->pcm_channel); in _cs46xx_adjust_sample_rate()
1071 cpcm->pcm_channel->sample_rate = sample_rate; in _cs46xx_adjust_sample_rate()
1082 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_playback_hw_params()
1090 cpcm = runtime->private_data; in snd_cs46xx_playback_hw_params()
1094 return -ENXIO; in snd_cs46xx_playback_hw_params()
1096 mutex_lock(&chip->spos_mutex); in snd_cs46xx_playback_hw_params()
1099 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_playback_hw_params()
1100 return -ENXIO; in snd_cs46xx_playback_hw_params()
1103 snd_BUG_ON(!cpcm->pcm_channel); in snd_cs46xx_playback_hw_params()
1104 if (!cpcm->pcm_channel) { in snd_cs46xx_playback_hw_params()
1105 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_playback_hw_params()
1106 return -ENXIO; in snd_cs46xx_playback_hw_params()
1110 if (cs46xx_dsp_pcm_channel_set_period (chip,cpcm->pcm_channel,period_size)) { in snd_cs46xx_playback_hw_params()
1111 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_playback_hw_params()
1112 return -EINVAL; in snd_cs46xx_playback_hw_params()
1115 dev_dbg(chip->card->dev, in snd_cs46xx_playback_hw_params()
1122 if (runtime->dma_area != cpcm->hw_buf.area) in snd_cs46xx_playback_hw_params()
1124 snd_pcm_set_runtime_buffer(substream, &cpcm->hw_buf); in snd_cs46xx_playback_hw_params()
1128 if (cpcm->pcm_channel_id == DSP_PCM_MAIN_CHANNEL) { in snd_cs46xx_playback_hw_params()
1129 substream->ops = &snd_cs46xx_playback_ops; in snd_cs46xx_playback_hw_params()
1130 } else if (cpcm->pcm_channel_id == DSP_PCM_REAR_CHANNEL) { in snd_cs46xx_playback_hw_params()
1131 substream->ops = &snd_cs46xx_playback_rear_ops; in snd_cs46xx_playback_hw_params()
1132 } else if (cpcm->pcm_channel_id == DSP_PCM_CENTER_LFE_CHANNEL) { in snd_cs46xx_playback_hw_params()
1133 substream->ops = &snd_cs46xx_playback_clfe_ops; in snd_cs46xx_playback_hw_params()
1134 } else if (cpcm->pcm_channel_id == DSP_IEC958_CHANNEL) { in snd_cs46xx_playback_hw_params()
1135 substream->ops = &snd_cs46xx_playback_iec958_ops; in snd_cs46xx_playback_hw_params()
1140 substream->ops = &snd_cs46xx_playback_ops; in snd_cs46xx_playback_hw_params()
1144 if (runtime->dma_area == cpcm->hw_buf.area) in snd_cs46xx_playback_hw_params()
1149 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_playback_hw_params()
1155 if (cpcm->pcm_channel_id == DSP_PCM_MAIN_CHANNEL) { in snd_cs46xx_playback_hw_params()
1156 substream->ops = &snd_cs46xx_playback_indirect_ops; in snd_cs46xx_playback_hw_params()
1157 } else if (cpcm->pcm_channel_id == DSP_PCM_REAR_CHANNEL) { in snd_cs46xx_playback_hw_params()
1158 substream->ops = &snd_cs46xx_playback_indirect_rear_ops; in snd_cs46xx_playback_hw_params()
1159 } else if (cpcm->pcm_channel_id == DSP_PCM_CENTER_LFE_CHANNEL) { in snd_cs46xx_playback_hw_params()
1160 substream->ops = &snd_cs46xx_playback_indirect_clfe_ops; in snd_cs46xx_playback_hw_params()
1161 } else if (cpcm->pcm_channel_id == DSP_IEC958_CHANNEL) { in snd_cs46xx_playback_hw_params()
1162 substream->ops = &snd_cs46xx_playback_indirect_iec958_ops; in snd_cs46xx_playback_hw_params()
1167 substream->ops = &snd_cs46xx_playback_indirect_ops; in snd_cs46xx_playback_hw_params()
1173 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_playback_hw_params()
1182 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_playback_hw_free()
1185 cpcm = runtime->private_data; in snd_cs46xx_playback_hw_free()
1189 if (!cpcm) return -ENXIO; in snd_cs46xx_playback_hw_free()
1191 if (runtime->dma_area != cpcm->hw_buf.area) in snd_cs46xx_playback_hw_free()
1204 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_playback_prepare()
1207 cpcm = runtime->private_data; in snd_cs46xx_playback_prepare()
1210 if (snd_BUG_ON(!cpcm->pcm_channel)) in snd_cs46xx_playback_prepare()
1211 return -ENXIO; in snd_cs46xx_playback_prepare()
1213 pfie = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 1) << 2 ); in snd_cs46xx_playback_prepare()
1221 cpcm->shift = 2; in snd_cs46xx_playback_prepare()
1223 if (runtime->channels == 1) { in snd_cs46xx_playback_prepare()
1224 cpcm->shift--; in snd_cs46xx_playback_prepare()
1228 if (snd_pcm_format_width(runtime->format) == 8) { in snd_cs46xx_playback_prepare()
1229 cpcm->shift--; in snd_cs46xx_playback_prepare()
1233 if (snd_pcm_format_unsigned(runtime->format)) in snd_cs46xx_playback_prepare()
1237 if (snd_pcm_format_width(runtime->format) != 8) { in snd_cs46xx_playback_prepare()
1239 if (snd_pcm_format_big_endian(runtime->format)) in snd_cs46xx_playback_prepare()
1243 memset(&cpcm->pcm_rec, 0, sizeof(cpcm->pcm_rec)); in snd_cs46xx_playback_prepare()
1244 cpcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_cs46xx_playback_prepare()
1245 cpcm->pcm_rec.hw_buffer_size = runtime->period_size * CS46XX_FRAGS << cpcm->shift; in snd_cs46xx_playback_prepare()
1249 tmp = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address) << 2); in snd_cs46xx_playback_prepare()
1251 tmp |= (4 << cpcm->shift) - 1; in snd_cs46xx_playback_prepare()
1253 snd_cs46xx_poke(chip, (cpcm->pcm_channel->pcm_reader_scb->address) << 2, tmp); in snd_cs46xx_playback_prepare()
1256 …snd_cs46xx_poke(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 1) << 2, pfie | cpcm->pcm_chan… in snd_cs46xx_playback_prepare()
1258 snd_cs46xx_poke(chip, BA1_PBA, cpcm->hw_buf.addr); in snd_cs46xx_playback_prepare()
1261 tmp |= (4 << cpcm->shift) - 1; in snd_cs46xx_playback_prepare()
1264 snd_cs46xx_set_play_sample_rate(chip, runtime->rate); in snd_cs46xx_playback_prepare()
1274 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_capture_hw_params()
1280 if (runtime->periods == CS46XX_FRAGS) { in snd_cs46xx_capture_hw_params()
1281 if (runtime->dma_area != chip->capt.hw_buf.area) in snd_cs46xx_capture_hw_params()
1283 snd_pcm_set_runtime_buffer(substream, &chip->capt.hw_buf); in snd_cs46xx_capture_hw_params()
1284 substream->ops = &snd_cs46xx_capture_ops; in snd_cs46xx_capture_hw_params()
1286 if (runtime->dma_area == chip->capt.hw_buf.area) in snd_cs46xx_capture_hw_params()
1291 substream->ops = &snd_cs46xx_capture_indirect_ops; in snd_cs46xx_capture_hw_params()
1300 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_capture_hw_free()
1302 if (runtime->dma_area != chip->capt.hw_buf.area) in snd_cs46xx_capture_hw_free()
1312 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_capture_prepare()
1314 snd_cs46xx_poke(chip, BA1_CBA, chip->capt.hw_buf.addr); in snd_cs46xx_capture_prepare()
1315 chip->capt.shift = 2; in snd_cs46xx_capture_prepare()
1316 memset(&chip->capt.pcm_rec, 0, sizeof(chip->capt.pcm_rec)); in snd_cs46xx_capture_prepare()
1317 chip->capt.pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); in snd_cs46xx_capture_prepare()
1318 chip->capt.pcm_rec.hw_buffer_size = runtime->period_size * CS46XX_FRAGS << 2; in snd_cs46xx_capture_prepare()
1319 snd_cs46xx_set_capture_sample_rate(chip, runtime->rate); in snd_cs46xx_capture_prepare()
1329 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_interrupt()
1351 if (chip->capt.substream) in snd_cs46xx_interrupt()
1352 snd_pcm_period_elapsed(chip->capt.substream); in snd_cs46xx_interrupt()
1354 if (ins->pcm_channels[i].active && in snd_cs46xx_interrupt()
1355 ins->pcm_channels[i].private_data && in snd_cs46xx_interrupt()
1356 !ins->pcm_channels[i].unlinked) { in snd_cs46xx_interrupt()
1357 cpcm = ins->pcm_channels[i].private_data; in snd_cs46xx_interrupt()
1358 snd_pcm_period_elapsed(cpcm->substream); in snd_cs46xx_interrupt()
1363 if ( status2 & (1 << (i - 16))) { in snd_cs46xx_interrupt()
1364 if (ins->pcm_channels[i].active && in snd_cs46xx_interrupt()
1365 ins->pcm_channels[i].private_data && in snd_cs46xx_interrupt()
1366 !ins->pcm_channels[i].unlinked) { in snd_cs46xx_interrupt()
1367 cpcm = ins->pcm_channels[i].private_data; in snd_cs46xx_interrupt()
1368 snd_pcm_period_elapsed(cpcm->substream); in snd_cs46xx_interrupt()
1376 if ((status1 & HISR_VC0) && chip->playback_pcm) { in snd_cs46xx_interrupt()
1377 if (chip->playback_pcm->substream) in snd_cs46xx_interrupt()
1378 snd_pcm_period_elapsed(chip->playback_pcm->substream); in snd_cs46xx_interrupt()
1380 if ((status1 & HISR_VC1) && chip->pcm) { in snd_cs46xx_interrupt()
1381 if (chip->capt.substream) in snd_cs46xx_interrupt()
1382 snd_pcm_period_elapsed(chip->capt.substream); in snd_cs46xx_interrupt()
1386 if ((status1 & HISR_MIDI) && chip->rmidi) { in snd_cs46xx_interrupt()
1389 spin_lock(&chip->reg_lock); in snd_cs46xx_interrupt()
1392 if ((chip->midcr & MIDCR_RIE) == 0) in snd_cs46xx_interrupt()
1394 snd_rawmidi_receive(chip->midi_input, &c, 1); in snd_cs46xx_interrupt()
1397 if ((chip->midcr & MIDCR_TIE) == 0) in snd_cs46xx_interrupt()
1399 if (snd_rawmidi_transmit(chip->midi_output, &c, 1) != 1) { in snd_cs46xx_interrupt()
1400 chip->midcr &= ~MIDCR_TIE; in snd_cs46xx_interrupt()
1401 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_interrupt()
1406 spin_unlock(&chip->reg_lock); in snd_cs46xx_interrupt()
1474 kfree(runtime->private_data); in snd_cs46xx_pcm_free_substream()
1481 struct snd_pcm_runtime *runtime = substream->runtime; in _cs46xx_playback_open_channel()
1485 return -ENOMEM; in _cs46xx_playback_open_channel()
1486 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev, in _cs46xx_playback_open_channel()
1487 PAGE_SIZE, &cpcm->hw_buf) < 0) { in _cs46xx_playback_open_channel()
1489 return -ENOMEM; in _cs46xx_playback_open_channel()
1492 runtime->hw = snd_cs46xx_playback; in _cs46xx_playback_open_channel()
1493 runtime->private_data = cpcm; in _cs46xx_playback_open_channel()
1494 runtime->private_free = snd_cs46xx_pcm_free_substream; in _cs46xx_playback_open_channel()
1496 cpcm->substream = substream; in _cs46xx_playback_open_channel()
1498 mutex_lock(&chip->spos_mutex); in _cs46xx_playback_open_channel()
1499 cpcm->pcm_channel = NULL; in _cs46xx_playback_open_channel()
1500 cpcm->pcm_channel_id = pcm_channel_id; in _cs46xx_playback_open_channel()
1507 mutex_unlock(&chip->spos_mutex); in _cs46xx_playback_open_channel()
1509 chip->playback_pcm = cpcm; /* HACK */ in _cs46xx_playback_open_channel()
1512 if (chip->accept_valid) in _cs46xx_playback_open_channel()
1513 substream->runtime->hw.info |= SNDRV_PCM_INFO_MMAP_VALID; in _cs46xx_playback_open_channel()
1514 chip->active_ctrl(chip, 1); in _cs46xx_playback_open_channel()
1521 dev_dbg(substream->pcm->card->dev, "open front channel\n"); in snd_cs46xx_playback_open()
1528 dev_dbg(substream->pcm->card->dev, "open rear channel\n"); in snd_cs46xx_playback_open_rear()
1534 dev_dbg(substream->pcm->card->dev, "open center - LFE channel\n"); in snd_cs46xx_playback_open_clfe()
1542 dev_dbg(chip->card->dev, "open raw iec958 channel\n"); in snd_cs46xx_playback_open_iec958()
1544 mutex_lock(&chip->spos_mutex); in snd_cs46xx_playback_open_iec958()
1546 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_playback_open_iec958()
1558 dev_dbg(chip->card->dev, "close raw iec958 channel\n"); in snd_cs46xx_playback_close_iec958()
1562 mutex_lock(&chip->spos_mutex); in snd_cs46xx_playback_close_iec958()
1564 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_playback_close_iec958()
1574 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev, in snd_cs46xx_capture_open()
1575 PAGE_SIZE, &chip->capt.hw_buf) < 0) in snd_cs46xx_capture_open()
1576 return -ENOMEM; in snd_cs46xx_capture_open()
1577 chip->capt.substream = substream; in snd_cs46xx_capture_open()
1578 substream->runtime->hw = snd_cs46xx_capture; in snd_cs46xx_capture_open()
1580 if (chip->accept_valid) in snd_cs46xx_capture_open()
1581 substream->runtime->hw.info |= SNDRV_PCM_INFO_MMAP_VALID; in snd_cs46xx_capture_open()
1583 chip->active_ctrl(chip, 1); in snd_cs46xx_capture_open()
1586 snd_pcm_hw_constraint_list(substream->runtime, 0, in snd_cs46xx_capture_open()
1596 struct snd_pcm_runtime *runtime = substream->runtime; in snd_cs46xx_playback_close()
1599 cpcm = runtime->private_data; in snd_cs46xx_playback_close()
1602 if (!cpcm) return -ENXIO; in snd_cs46xx_playback_close()
1605 mutex_lock(&chip->spos_mutex); in snd_cs46xx_playback_close()
1606 if (cpcm->pcm_channel) { in snd_cs46xx_playback_close()
1607 cs46xx_dsp_destroy_pcm_channel(chip,cpcm->pcm_channel); in snd_cs46xx_playback_close()
1608 cpcm->pcm_channel = NULL; in snd_cs46xx_playback_close()
1610 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_playback_close()
1612 chip->playback_pcm = NULL; in snd_cs46xx_playback_close()
1615 cpcm->substream = NULL; in snd_cs46xx_playback_close()
1616 snd_dma_free_pages(&cpcm->hw_buf); in snd_cs46xx_playback_close()
1617 chip->active_ctrl(chip, -1); in snd_cs46xx_playback_close()
1626 chip->capt.substream = NULL; in snd_cs46xx_capture_close()
1627 snd_dma_free_pages(&chip->capt.hw_buf); in snd_cs46xx_capture_close()
1628 chip->active_ctrl(chip, -1); in snd_cs46xx_capture_close()
1742 #define MAX_PLAYBACK_CHANNELS (DSP_MAX_PCM_CHANNELS - 1)
1752 err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm); in snd_cs46xx_pcm()
1756 pcm->private_data = chip; in snd_cs46xx_pcm()
1762 pcm->info_flags = 0; in snd_cs46xx_pcm()
1763 strcpy(pcm->name, "CS46xx"); in snd_cs46xx_pcm()
1764 chip->pcm = pcm; in snd_cs46xx_pcm()
1767 &chip->pci->dev, in snd_cs46xx_pcm()
1780 err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm); in snd_cs46xx_pcm_rear()
1784 pcm->private_data = chip; in snd_cs46xx_pcm_rear()
1789 pcm->info_flags = 0; in snd_cs46xx_pcm_rear()
1790 strcpy(pcm->name, "CS46xx - Rear"); in snd_cs46xx_pcm_rear()
1791 chip->pcm_rear = pcm; in snd_cs46xx_pcm_rear()
1794 &chip->pci->dev, in snd_cs46xx_pcm_rear()
1805 err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm); in snd_cs46xx_pcm_center_lfe()
1809 pcm->private_data = chip; in snd_cs46xx_pcm_center_lfe()
1814 pcm->info_flags = 0; in snd_cs46xx_pcm_center_lfe()
1815 strcpy(pcm->name, "CS46xx - Center LFE"); in snd_cs46xx_pcm_center_lfe()
1816 chip->pcm_center_lfe = pcm; in snd_cs46xx_pcm_center_lfe()
1819 &chip->pci->dev, in snd_cs46xx_pcm_center_lfe()
1830 err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm); in snd_cs46xx_pcm_iec958()
1834 pcm->private_data = chip; in snd_cs46xx_pcm_iec958()
1839 pcm->info_flags = 0; in snd_cs46xx_pcm_iec958()
1840 strcpy(pcm->name, "CS46xx - IEC958"); in snd_cs46xx_pcm_iec958()
1841 chip->pcm_iec958 = pcm; in snd_cs46xx_pcm_iec958()
1844 &chip->pci->dev, in snd_cs46xx_pcm_iec958()
1856 struct snd_cs46xx *chip = ac97->private_data; in snd_cs46xx_mixer_free_ac97()
1858 if (snd_BUG_ON(ac97 != chip->ac97[CS46XX_PRIMARY_CODEC_INDEX] && in snd_cs46xx_mixer_free_ac97()
1859 ac97 != chip->ac97[CS46XX_SECONDARY_CODEC_INDEX])) in snd_cs46xx_mixer_free_ac97()
1862 if (ac97 == chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]) { in snd_cs46xx_mixer_free_ac97()
1863 chip->ac97[CS46XX_PRIMARY_CODEC_INDEX] = NULL; in snd_cs46xx_mixer_free_ac97()
1864 chip->eapd_switch = NULL; in snd_cs46xx_mixer_free_ac97()
1867 chip->ac97[CS46XX_SECONDARY_CODEC_INDEX] = NULL; in snd_cs46xx_mixer_free_ac97()
1873 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_cs46xx_vol_info()
1874 uinfo->count = 2; in snd_cs46xx_vol_info()
1875 uinfo->value.integer.min = 0; in snd_cs46xx_vol_info()
1876 uinfo->value.integer.max = 0x7fff; in snd_cs46xx_vol_info()
1883 int reg = kcontrol->private_value; in snd_cs46xx_vol_get()
1885 ucontrol->value.integer.value[0] = 0xffff - (val >> 16); in snd_cs46xx_vol_get()
1886 ucontrol->value.integer.value[1] = 0xffff - (val & 0xffff); in snd_cs46xx_vol_get()
1893 int reg = kcontrol->private_value; in snd_cs46xx_vol_put()
1894 unsigned int val = ((0xffff - ucontrol->value.integer.value[0]) << 16 | in snd_cs46xx_vol_put()
1895 (0xffff - ucontrol->value.integer.value[1])); in snd_cs46xx_vol_put()
1912 ucontrol->value.integer.value[0] = chip->dsp_spos_instance->dac_volume_left; in snd_cs46xx_vol_dac_get()
1913 ucontrol->value.integer.value[1] = chip->dsp_spos_instance->dac_volume_right; in snd_cs46xx_vol_dac_get()
1923 if (chip->dsp_spos_instance->dac_volume_right != ucontrol->value.integer.value[0] || in snd_cs46xx_vol_dac_put()
1924 chip->dsp_spos_instance->dac_volume_left != ucontrol->value.integer.value[1]) { in snd_cs46xx_vol_dac_put()
1926 ucontrol->value.integer.value[0], in snd_cs46xx_vol_dac_put()
1927 ucontrol->value.integer.value[1]); in snd_cs46xx_vol_dac_put()
1939 ucontrol->value.integer.value[0] = chip->dsp_spos_instance->spdif_input_volume_left;
1940 ucontrol->value.integer.value[1] = chip->dsp_spos_instance->spdif_input_volume_right;
1949 if (chip->dsp_spos_instance->spdif_input_volume_left != ucontrol->value.integer.value[0] ||
1950 chip->dsp_spos_instance->spdif_input_volume_right!= ucontrol->value.integer.value[1]) {
1952 ucontrol->value.integer.value[0],
1953 ucontrol->value.integer.value[1]);
1967 int reg = kcontrol->private_value; in snd_cs46xx_iec958_get()
1970 …ucontrol->value.integer.value[0] = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_O… in snd_cs46xx_iec958_get()
1972 ucontrol->value.integer.value[0] = chip->dsp_spos_instance->spdif_status_in; in snd_cs46xx_iec958_get()
1983 switch (kcontrol->private_value) { in snd_cs46xx_iec958_put()
1985 mutex_lock(&chip->spos_mutex); in snd_cs46xx_iec958_put()
1986 change = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED); in snd_cs46xx_iec958_put()
1987 if (ucontrol->value.integer.value[0] && !change) in snd_cs46xx_iec958_put()
1989 else if (change && !ucontrol->value.integer.value[0]) in snd_cs46xx_iec958_put()
1992 res = (change != (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED)); in snd_cs46xx_iec958_put()
1993 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_iec958_put()
1996 change = chip->dsp_spos_instance->spdif_status_in; in snd_cs46xx_iec958_put()
1997 if (ucontrol->value.integer.value[0] && !change) { in snd_cs46xx_iec958_put()
2001 else if (change && !ucontrol->value.integer.value[0]) in snd_cs46xx_iec958_put()
2004 res = (change != chip->dsp_spos_instance->spdif_status_in); in snd_cs46xx_iec958_put()
2007 res = -EINVAL; in snd_cs46xx_iec958_put()
2018 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_adc_capture_get()
2020 if (ins->adc_input != NULL) in snd_cs46xx_adc_capture_get()
2021 ucontrol->value.integer.value[0] = 1; in snd_cs46xx_adc_capture_get()
2023 ucontrol->value.integer.value[0] = 0; in snd_cs46xx_adc_capture_get()
2032 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_adc_capture_put()
2035 if (ucontrol->value.integer.value[0] && !ins->adc_input) { in snd_cs46xx_adc_capture_put()
2038 } else if (!ucontrol->value.integer.value[0] && ins->adc_input) { in snd_cs46xx_adc_capture_put()
2049 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_pcm_capture_get()
2051 if (ins->pcm_input != NULL) in snd_cs46xx_pcm_capture_get()
2052 ucontrol->value.integer.value[0] = 1; in snd_cs46xx_pcm_capture_get()
2054 ucontrol->value.integer.value[0] = 0; in snd_cs46xx_pcm_capture_get()
2064 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_pcm_capture_put()
2067 if (ucontrol->value.integer.value[0] && !ins->pcm_input) { in snd_cs46xx_pcm_capture_put()
2070 } else if (!ucontrol->value.integer.value[0] && ins->pcm_input) { in snd_cs46xx_pcm_capture_put()
2086 ucontrol->value.integer.value[0] = 1; in snd_herc_spdif_select_get()
2088 ucontrol->value.integer.value[0] = 0; in snd_herc_spdif_select_get()
2094 * Game Theatre XP card - EGPIO[0] is used to select SPDIF input optical or coaxial.
2103 if (ucontrol->value.integer.value[0]) { in snd_herc_spdif_select_put()
2108 EGPIOPTR_GPPT0 | val2); /* open-drain on output */ in snd_herc_spdif_select_put()
2123 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in snd_cs46xx_spdif_info()
2124 uinfo->count = 1; in snd_cs46xx_spdif_info()
2132 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_spdif_default_get()
2134 mutex_lock(&chip->spos_mutex); in snd_cs46xx_spdif_default_get()
2135 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_default >> 24) & 0xff); in snd_cs46xx_spdif_default_get()
2136 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_default >> 16) & 0xff); in snd_cs46xx_spdif_default_get()
2137 ucontrol->value.iec958.status[2] = 0; in snd_cs46xx_spdif_default_get()
2138 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_default) & 0xff); in snd_cs46xx_spdif_default_get()
2139 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_spdif_default_get()
2148 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_spdif_default_put()
2152 mutex_lock(&chip->spos_mutex); in snd_cs46xx_spdif_default_put()
2153 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) | in snd_cs46xx_spdif_default_put()
2154 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[2]) << 16) | in snd_cs46xx_spdif_default_put()
2155 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) | in snd_cs46xx_spdif_default_put()
2160 change = (unsigned int)ins->spdif_csuv_default != val; in snd_cs46xx_spdif_default_put()
2161 ins->spdif_csuv_default = val; in snd_cs46xx_spdif_default_put()
2163 if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) ) in snd_cs46xx_spdif_default_put()
2166 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_spdif_default_put()
2174 ucontrol->value.iec958.status[0] = 0xff; in snd_cs46xx_spdif_mask_get()
2175 ucontrol->value.iec958.status[1] = 0xff; in snd_cs46xx_spdif_mask_get()
2176 ucontrol->value.iec958.status[2] = 0x00; in snd_cs46xx_spdif_mask_get()
2177 ucontrol->value.iec958.status[3] = 0xff; in snd_cs46xx_spdif_mask_get()
2185 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_spdif_stream_get()
2187 mutex_lock(&chip->spos_mutex); in snd_cs46xx_spdif_stream_get()
2188 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_stream >> 24) & 0xff); in snd_cs46xx_spdif_stream_get()
2189 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_stream >> 16) & 0xff); in snd_cs46xx_spdif_stream_get()
2190 ucontrol->value.iec958.status[2] = 0; in snd_cs46xx_spdif_stream_get()
2191 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_stream) & 0xff); in snd_cs46xx_spdif_stream_get()
2192 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_spdif_stream_get()
2201 struct dsp_spos_instance * ins = chip->dsp_spos_instance; in snd_cs46xx_spdif_stream_put()
2205 mutex_lock(&chip->spos_mutex); in snd_cs46xx_spdif_stream_put()
2206 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) | in snd_cs46xx_spdif_stream_put()
2207 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[1]) << 16) | in snd_cs46xx_spdif_stream_put()
2208 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) | in snd_cs46xx_spdif_stream_put()
2213 change = ins->spdif_csuv_stream != val; in snd_cs46xx_spdif_stream_put()
2214 ins->spdif_csuv_stream = val; in snd_cs46xx_spdif_stream_put()
2216 if ( ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN ) in snd_cs46xx_spdif_stream_put()
2219 mutex_unlock(&chip->spos_mutex); in snd_cs46xx_spdif_stream_put()
2328 val = snd_ac97_read(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX], AC97_CSR_ACMODE); in snd_cs46xx_front_dup_get()
2329 ucontrol->value.integer.value[0] = (val & 0x200) ? 0 : 1; in snd_cs46xx_front_dup_get()
2337 return snd_ac97_update_bits(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX], in snd_cs46xx_front_dup_put()
2339 ucontrol->value.integer.value[0] ? 0 : 0x200); in snd_cs46xx_front_dup_put()
2373 if (ac97->num == CS46XX_PRIMARY_CODEC_INDEX) { in snd_cs46xx_codec_reset()
2374 dev_dbg(ac97->bus->card->dev, "CODEC1 mode %04x\n", 0x0); in snd_cs46xx_codec_reset()
2376 } else if (ac97->num == CS46XX_SECONDARY_CODEC_INDEX) { in snd_cs46xx_codec_reset()
2377 dev_dbg(ac97->bus->card->dev, "CODEC2 mode %04x\n", 0x3); in snd_cs46xx_codec_reset()
2410 dev_err(ac97->bus->card->dev, in snd_cs46xx_codec_reset()
2424 if (chip->amplifier_ctrl == amp_voyetra) in cs46xx_detect_codec()
2431 dev_dbg(chip->card->dev, in cs46xx_detect_codec()
2433 return -ENXIO; in cs46xx_detect_codec()
2440 err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97[codec]); in cs46xx_detect_codec()
2445 dev_dbg(chip->card->dev, "codec %d detection timeout\n", codec); in cs46xx_detect_codec()
2446 return -ENXIO; in cs46xx_detect_codec()
2451 struct snd_card *card = chip->card; in snd_cs46xx_mixer()
2463 chip->nr_ac97_codecs = 0; in snd_cs46xx_mixer()
2464 dev_dbg(chip->card->dev, "detecting primary codec\n"); in snd_cs46xx_mixer()
2465 err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus); in snd_cs46xx_mixer()
2470 return -ENXIO; in snd_cs46xx_mixer()
2471 chip->nr_ac97_codecs = 1; in snd_cs46xx_mixer()
2474 dev_dbg(chip->card->dev, "detecting secondary codec\n"); in snd_cs46xx_mixer()
2477 chip->nr_ac97_codecs = 2; in snd_cs46xx_mixer()
2484 if (kctl && kctl->id.iface == SNDRV_CTL_ELEM_IFACE_PCM) in snd_cs46xx_mixer()
2485 kctl->id.device = spdif_device; in snd_cs46xx_mixer()
2492 chip->eapd_switch = snd_ctl_find_id_mixer(chip->card, in snd_cs46xx_mixer()
2496 if (chip->nr_ac97_codecs == 1) { in snd_cs46xx_mixer()
2497 unsigned int id2 = chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]->id & 0xffff; in snd_cs46xx_mixer()
2502 snd_ac97_write_cache(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX], in snd_cs46xx_mixer()
2507 if (chip->mixer_init) { in snd_cs46xx_mixer()
2508 dev_dbg(chip->card->dev, "calling chip->mixer_init(chip);\n"); in snd_cs46xx_mixer()
2509 chip->mixer_init(chip); in snd_cs46xx_mixer()
2514 chip->amplifier_ctrl(chip, 1); in snd_cs46xx_mixer()
2527 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_reset()
2532 struct snd_cs46xx *chip = substream->rmidi->private_data; in snd_cs46xx_midi_input_open()
2534 chip->active_ctrl(chip, 1); in snd_cs46xx_midi_input_open()
2535 spin_lock_irq(&chip->reg_lock); in snd_cs46xx_midi_input_open()
2536 chip->uartm |= CS46XX_MODE_INPUT; in snd_cs46xx_midi_input_open()
2537 chip->midcr |= MIDCR_RXE; in snd_cs46xx_midi_input_open()
2538 chip->midi_input = substream; in snd_cs46xx_midi_input_open()
2539 if (!(chip->uartm & CS46XX_MODE_OUTPUT)) { in snd_cs46xx_midi_input_open()
2542 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_input_open()
2544 spin_unlock_irq(&chip->reg_lock); in snd_cs46xx_midi_input_open()
2550 struct snd_cs46xx *chip = substream->rmidi->private_data; in snd_cs46xx_midi_input_close()
2552 spin_lock_irq(&chip->reg_lock); in snd_cs46xx_midi_input_close()
2553 chip->midcr &= ~(MIDCR_RXE | MIDCR_RIE); in snd_cs46xx_midi_input_close()
2554 chip->midi_input = NULL; in snd_cs46xx_midi_input_close()
2555 if (!(chip->uartm & CS46XX_MODE_OUTPUT)) { in snd_cs46xx_midi_input_close()
2558 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_input_close()
2560 chip->uartm &= ~CS46XX_MODE_INPUT; in snd_cs46xx_midi_input_close()
2561 spin_unlock_irq(&chip->reg_lock); in snd_cs46xx_midi_input_close()
2562 chip->active_ctrl(chip, -1); in snd_cs46xx_midi_input_close()
2568 struct snd_cs46xx *chip = substream->rmidi->private_data; in snd_cs46xx_midi_output_open()
2570 chip->active_ctrl(chip, 1); in snd_cs46xx_midi_output_open()
2572 spin_lock_irq(&chip->reg_lock); in snd_cs46xx_midi_output_open()
2573 chip->uartm |= CS46XX_MODE_OUTPUT; in snd_cs46xx_midi_output_open()
2574 chip->midcr |= MIDCR_TXE; in snd_cs46xx_midi_output_open()
2575 chip->midi_output = substream; in snd_cs46xx_midi_output_open()
2576 if (!(chip->uartm & CS46XX_MODE_INPUT)) { in snd_cs46xx_midi_output_open()
2579 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_output_open()
2581 spin_unlock_irq(&chip->reg_lock); in snd_cs46xx_midi_output_open()
2587 struct snd_cs46xx *chip = substream->rmidi->private_data; in snd_cs46xx_midi_output_close()
2589 spin_lock_irq(&chip->reg_lock); in snd_cs46xx_midi_output_close()
2590 chip->midcr &= ~(MIDCR_TXE | MIDCR_TIE); in snd_cs46xx_midi_output_close()
2591 chip->midi_output = NULL; in snd_cs46xx_midi_output_close()
2592 if (!(chip->uartm & CS46XX_MODE_INPUT)) { in snd_cs46xx_midi_output_close()
2595 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_output_close()
2597 chip->uartm &= ~CS46XX_MODE_OUTPUT; in snd_cs46xx_midi_output_close()
2598 spin_unlock_irq(&chip->reg_lock); in snd_cs46xx_midi_output_close()
2599 chip->active_ctrl(chip, -1); in snd_cs46xx_midi_output_close()
2606 struct snd_cs46xx *chip = substream->rmidi->private_data; in snd_cs46xx_midi_input_trigger()
2608 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs46xx_midi_input_trigger()
2610 if ((chip->midcr & MIDCR_RIE) == 0) { in snd_cs46xx_midi_input_trigger()
2611 chip->midcr |= MIDCR_RIE; in snd_cs46xx_midi_input_trigger()
2612 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_input_trigger()
2615 if (chip->midcr & MIDCR_RIE) { in snd_cs46xx_midi_input_trigger()
2616 chip->midcr &= ~MIDCR_RIE; in snd_cs46xx_midi_input_trigger()
2617 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_input_trigger()
2620 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs46xx_midi_input_trigger()
2626 struct snd_cs46xx *chip = substream->rmidi->private_data; in snd_cs46xx_midi_output_trigger()
2629 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs46xx_midi_output_trigger()
2631 if ((chip->midcr & MIDCR_TIE) == 0) { in snd_cs46xx_midi_output_trigger()
2632 chip->midcr |= MIDCR_TIE; in snd_cs46xx_midi_output_trigger()
2634 while ((chip->midcr & MIDCR_TIE) && in snd_cs46xx_midi_output_trigger()
2637 chip->midcr &= ~MIDCR_TIE; in snd_cs46xx_midi_output_trigger()
2642 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_output_trigger()
2645 if (chip->midcr & MIDCR_TIE) { in snd_cs46xx_midi_output_trigger()
2646 chip->midcr &= ~MIDCR_TIE; in snd_cs46xx_midi_output_trigger()
2647 snd_cs46xx_pokeBA0(chip, BA0_MIDCR, chip->midcr); in snd_cs46xx_midi_output_trigger()
2650 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs46xx_midi_output_trigger()
2672 err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi); in snd_cs46xx_midi()
2675 strcpy(rmidi->name, "CS46XX"); in snd_cs46xx_midi()
2678 …rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUP… in snd_cs46xx_midi()
2679 rmidi->private_data = chip; in snd_cs46xx_midi()
2680 chip->rmidi = rmidi; in snd_cs46xx_midi()
2697 snd_cs46xx_pokeBA0(chip, BA0_JSPT, 0xFF); //outb(gameport->io, 0xFF); in snd_cs46xx_gameport_trigger()
2706 return snd_cs46xx_peekBA0(chip, BA0_JSPT); //inb(gameport->io); in snd_cs46xx_gameport_read()
2729 if(axes[jst]==0xFFFF) axes[jst] = -1; in snd_cs46xx_gameport_cooked_read()
2741 return -1; in snd_cs46xx_gameport_open()
2750 chip->gameport = gp = gameport_allocate_port(); in snd_cs46xx_gameport()
2752 dev_err(chip->card->dev, in snd_cs46xx_gameport()
2754 return -ENOMEM; in snd_cs46xx_gameport()
2758 gameport_set_phys(gp, "pci%s/gameport0", pci_name(chip->pci)); in snd_cs46xx_gameport()
2759 gameport_set_dev_parent(gp, &chip->pci->dev); in snd_cs46xx_gameport()
2762 gp->open = snd_cs46xx_gameport_open; in snd_cs46xx_gameport()
2763 gp->read = snd_cs46xx_gameport_read; in snd_cs46xx_gameport()
2764 gp->trigger = snd_cs46xx_gameport_trigger; in snd_cs46xx_gameport()
2765 gp->cooked_read = snd_cs46xx_gameport_cooked_read; in snd_cs46xx_gameport()
2777 if (chip->gameport) { in snd_cs46xx_remove_gameport()
2778 gameport_unregister_port(chip->gameport); in snd_cs46xx_remove_gameport()
2779 chip->gameport = NULL; in snd_cs46xx_remove_gameport()
2783 int snd_cs46xx_gameport(struct snd_cs46xx *chip) { return -ENOSYS; } in snd_cs46xx_gameport()
2797 struct snd_cs46xx_region *region = entry->private_data; in snd_cs46xx_io_read()
2799 if (copy_to_user_fromio(buf, region->remap_addr + pos, count)) in snd_cs46xx_io_read()
2800 return -EFAULT; in snd_cs46xx_io_read()
2814 struct snd_cs46xx_region *region = &chip->region.idx[idx]; in snd_cs46xx_proc_init()
2815 if (! snd_card_proc_new(card, region->name, &entry)) { in snd_cs46xx_proc_init()
2816 entry->content = SNDRV_INFO_CONTENT_DATA; in snd_cs46xx_proc_init()
2817 entry->private_data = chip; in snd_cs46xx_proc_init()
2818 entry->c.ops = &snd_cs46xx_proc_io_ops; in snd_cs46xx_proc_init()
2819 entry->size = region->size; in snd_cs46xx_proc_init()
2820 entry->mode = S_IFREG | 0400; in snd_cs46xx_proc_init()
2893 struct snd_cs46xx *chip = card->private_data; in snd_cs46xx_free()
2898 if (chip->active_ctrl) in snd_cs46xx_free()
2899 chip->active_ctrl(chip, 1); in snd_cs46xx_free()
2903 if (chip->amplifier_ctrl) in snd_cs46xx_free()
2904 chip->amplifier_ctrl(chip, -chip->amplifier); /* force to off */ in snd_cs46xx_free()
2910 if (chip->active_ctrl) in snd_cs46xx_free()
2911 chip->active_ctrl(chip, -chip->amplifier); in snd_cs46xx_free()
2914 if (chip->dsp_spos_instance) { in snd_cs46xx_free()
2916 chip->dsp_spos_instance = NULL; in snd_cs46xx_free()
2919 free_module_desc(chip->modules[idx]); in snd_cs46xx_free()
2921 vfree(chip->ba1); in snd_cs46xx_free()
2942 * AC-link. Otherwise, we won't be able to bring up the link. in snd_cs46xx_chip_init()
2993 * SWCE yet (if requested), so that the devices clocked by the output of in snd_cs46xx_chip_init()
2994 * PLL are not clocked until the PLL is stable. in snd_cs46xx_chip_init()
3054 while (timeout-- > 0) { in snd_cs46xx_chip_init()
3065 dev_err(chip->card->dev, in snd_cs46xx_chip_init()
3066 "create - never read codec ready from AC'97\n"); in snd_cs46xx_chip_init()
3067 dev_err(chip->card->dev, in snd_cs46xx_chip_init()
3069 return -EIO; in snd_cs46xx_chip_init()
3086 dev_dbg(chip->card->dev, in snd_cs46xx_chip_init()
3103 * the codec is pumping ADC data across the AC-link. in snd_cs46xx_chip_init()
3106 while (timeout-- > 0) { in snd_cs46xx_chip_init()
3117 dev_err(chip->card->dev, in snd_cs46xx_chip_init()
3118 "create - never read ISV3 & ISV4 from AC'97\n"); in snd_cs46xx_chip_init()
3119 return -EIO; in snd_cs46xx_chip_init()
3125 dev_err(chip->card->dev, "never read ISV3 & ISV4 from AC'97\n"); in snd_cs46xx_chip_init()
3126 dev_err(chip->card->dev, in snd_cs46xx_chip_init()
3128 dev_err(chip->card->dev, in snd_cs46xx_chip_init()
3130 dev_err(chip->card->dev, in snd_cs46xx_chip_init()
3131 "this message please report to alsa-devel@alsa-project.org\n"); in snd_cs46xx_chip_init()
3133 return -EIO; in snd_cs46xx_chip_init()
3198 err = load_firmware(chip, &chip->modules[i], module_names[i]); in snd_cs46xx_start_dsp()
3200 dev_err(chip->card->dev, "firmware load error [%s]\n", in snd_cs46xx_start_dsp()
3204 err = cs46xx_dsp_load_module(chip, chip->modules[i]); in snd_cs46xx_start_dsp()
3206 dev_err(chip->card->dev, "image download error [%s]\n", in snd_cs46xx_start_dsp()
3213 return -EIO; in snd_cs46xx_start_dsp()
3222 dev_err(chip->card->dev, "image download error\n"); in snd_cs46xx_start_dsp()
3230 chip->play_ctl = tmp & 0xffff0000; in snd_cs46xx_start_dsp()
3238 chip->capt.ctl = tmp & 0x0000ffff; in snd_cs46xx_start_dsp()
3261 * AMP control - null AMP
3275 dev_dbg(chip->card->dev, "cs46xx_setup_eapd_slot()+\n"); in voyetra_setup_eapd_slot()
3292 if(chip->nr_ac97_codecs != 2) { in voyetra_setup_eapd_slot()
3293 dev_err(chip->card->dev, in voyetra_setup_eapd_slot()
3294 "cs46xx_setup_eapd_slot() - no secondary codec configured\n"); in voyetra_setup_eapd_slot()
3295 return -EINVAL; in voyetra_setup_eapd_slot()
3335 dev_dbg(chip->card->dev, "FIFO is busy\n"); in voyetra_setup_eapd_slot()
3337 return -EINVAL; in voyetra_setup_eapd_slot()
3356 dev_dbg(chip->card->dev, in voyetra_setup_eapd_slot()
3360 return -EINVAL; in voyetra_setup_eapd_slot()
3398 int old = chip->amplifier; in amp_voyetra()
3402 chip->amplifier += change; in amp_voyetra()
3406 if (chip->amplifier) { in amp_voyetra()
3416 if (chip->eapd_switch) in amp_voyetra()
3417 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in amp_voyetra()
3418 &chip->eapd_switch->id); in amp_voyetra()
3422 if (chip->amplifier && !old) { in amp_voyetra()
3437 * Game Theatre XP card - EGPIO[2] is used to enable the external amp.
3441 int old = chip->amplifier; in amp_hercules()
3445 chip->amplifier += change; in amp_hercules()
3446 if (chip->amplifier && !old) { in amp_hercules()
3447 dev_dbg(chip->card->dev, "Hercules amplifier ON\n"); in amp_hercules()
3452 EGPIOPTR_GPPT2 | val2); /* open-drain on output */ in amp_hercules()
3453 } else if (old && !chip->amplifier) { in amp_hercules()
3454 dev_dbg(chip->card->dev, "Hercules amplifier OFF\n"); in amp_hercules()
3462 dev_dbg(chip->card->dev, "initializing Voyetra mixer\n"); in voyetra_mixer_init()
3474 struct snd_card *card = chip->card; in hercules_mixer_init()
3480 dev_dbg(chip->card->dev, "initializing Hercules mixer\n"); in hercules_mixer_init()
3483 if (chip->in_suspend) in hercules_mixer_init()
3492 dev_err(card->dev, in hercules_mixer_init()
3509 chip->amplifier += change;
3511 if (chip->amplifier) {
3541 if (!chip->acpi_port) in clkrun_hack()
3544 chip->amplifier += change; in clkrun_hack()
3547 nval = control = inw(chip->acpi_port + 0x10); in clkrun_hack()
3550 if (! chip->amplifier) in clkrun_hack()
3555 outw(nval, chip->acpi_port + 0x10); in clkrun_hack()
3567 chip->acpi_port = 0; in clkrun_init()
3576 chip->acpi_port = pp << 8; in clkrun_init()
3721 struct snd_cs46xx *chip = card->private_data; in snd_cs46xx_suspend()
3725 chip->in_suspend = 1; in snd_cs46xx_suspend()
3726 // chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL); in snd_cs46xx_suspend()
3727 // chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE); in snd_cs46xx_suspend()
3729 snd_ac97_suspend(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]); in snd_cs46xx_suspend()
3730 snd_ac97_suspend(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]); in snd_cs46xx_suspend()
3734 chip->saved_regs[i] = snd_cs46xx_peekBA0(chip, saved_regs[i]); in snd_cs46xx_suspend()
3736 amp_saved = chip->amplifier; in snd_cs46xx_suspend()
3738 chip->amplifier_ctrl(chip, -chip->amplifier); in snd_cs46xx_suspend()
3741 chip->active_ctrl(chip, -chip->amplifier); in snd_cs46xx_suspend()
3742 chip->amplifier = amp_saved; /* restore the status */ in snd_cs46xx_suspend()
3749 struct snd_cs46xx *chip = card->private_data; in snd_cs46xx_resume()
3756 amp_saved = chip->amplifier; in snd_cs46xx_resume()
3757 chip->amplifier = 0; in snd_cs46xx_resume()
3758 chip->active_ctrl(chip, 1); /* force to on */ in snd_cs46xx_resume()
3767 snd_cs46xx_pokeBA0(chip, saved_regs[i], chip->saved_regs[i]); in snd_cs46xx_resume()
3774 chip->ac97_general_purpose); in snd_cs46xx_resume()
3776 chip->ac97_powerdown); in snd_cs46xx_resume()
3779 chip->ac97_powerdown); in snd_cs46xx_resume()
3783 snd_ac97_resume(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]); in snd_cs46xx_resume()
3784 snd_ac97_resume(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]); in snd_cs46xx_resume()
3790 chip->capt.ctl = tmp & 0x0000ffff; in snd_cs46xx_resume()
3803 chip->amplifier_ctrl(chip, 1); /* turn amp on */ in snd_cs46xx_resume()
3805 chip->active_ctrl(chip, -1); /* disable CLKRUN */ in snd_cs46xx_resume()
3806 chip->amplifier = amp_saved; in snd_cs46xx_resume()
3807 chip->in_suspend = 0; in snd_cs46xx_resume()
3823 struct snd_cs46xx *chip = card->private_data; in snd_cs46xx_create()
3834 spin_lock_init(&chip->reg_lock); in snd_cs46xx_create()
3836 mutex_init(&chip->spos_mutex); in snd_cs46xx_create()
3838 chip->card = card; in snd_cs46xx_create()
3839 chip->pci = pci; in snd_cs46xx_create()
3840 chip->irq = -1; in snd_cs46xx_create()
3845 chip->ba0_addr = pci_resource_start(pci, 0); in snd_cs46xx_create()
3846 chip->ba1_addr = pci_resource_start(pci, 1); in snd_cs46xx_create()
3847 if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 || in snd_cs46xx_create()
3848 chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) { in snd_cs46xx_create()
3849 dev_err(chip->card->dev, in snd_cs46xx_create()
3850 "wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n", in snd_cs46xx_create()
3851 chip->ba0_addr, chip->ba1_addr); in snd_cs46xx_create()
3852 return -ENOMEM; in snd_cs46xx_create()
3855 region = &chip->region.name.ba0; in snd_cs46xx_create()
3856 strcpy(region->name, "CS46xx_BA0"); in snd_cs46xx_create()
3857 region->base = chip->ba0_addr; in snd_cs46xx_create()
3858 region->size = CS46XX_BA0_SIZE; in snd_cs46xx_create()
3860 region = &chip->region.name.data0; in snd_cs46xx_create()
3861 strcpy(region->name, "CS46xx_BA1_data0"); in snd_cs46xx_create()
3862 region->base = chip->ba1_addr + BA1_SP_DMEM0; in snd_cs46xx_create()
3863 region->size = CS46XX_BA1_DATA0_SIZE; in snd_cs46xx_create()
3865 region = &chip->region.name.data1; in snd_cs46xx_create()
3866 strcpy(region->name, "CS46xx_BA1_data1"); in snd_cs46xx_create()
3867 region->base = chip->ba1_addr + BA1_SP_DMEM1; in snd_cs46xx_create()
3868 region->size = CS46XX_BA1_DATA1_SIZE; in snd_cs46xx_create()
3870 region = &chip->region.name.pmem; in snd_cs46xx_create()
3871 strcpy(region->name, "CS46xx_BA1_pmem"); in snd_cs46xx_create()
3872 region->base = chip->ba1_addr + BA1_SP_PMEM; in snd_cs46xx_create()
3873 region->size = CS46XX_BA1_PRG_SIZE; in snd_cs46xx_create()
3875 region = &chip->region.name.reg; in snd_cs46xx_create()
3876 strcpy(region->name, "CS46xx_BA1_reg"); in snd_cs46xx_create()
3877 region->base = chip->ba1_addr + BA1_SP_REG; in snd_cs46xx_create()
3878 region->size = CS46XX_BA1_REG_SIZE; in snd_cs46xx_create()
3884 for (cp = &cards[0]; cp->name; cp++) { in snd_cs46xx_create()
3885 if (cp->vendor == ss_vendor && cp->id == ss_card) { in snd_cs46xx_create()
3886 dev_dbg(chip->card->dev, "hack for %s enabled\n", in snd_cs46xx_create()
3887 cp->name); in snd_cs46xx_create()
3889 chip->amplifier_ctrl = cp->amp; in snd_cs46xx_create()
3890 chip->active_ctrl = cp->active; in snd_cs46xx_create()
3891 chip->mixer_init = cp->mixer_init; in snd_cs46xx_create()
3893 if (cp->init) in snd_cs46xx_create()
3894 cp->init(chip); in snd_cs46xx_create()
3900 dev_info(chip->card->dev, in snd_cs46xx_create()
3902 chip->amplifier_ctrl = amp_voyetra; in snd_cs46xx_create()
3906 dev_info(chip->card->dev, in snd_cs46xx_create()
3908 chip->active_ctrl = clkrun_hack; in snd_cs46xx_create()
3912 if (chip->amplifier_ctrl == NULL) in snd_cs46xx_create()
3913 chip->amplifier_ctrl = amp_none; in snd_cs46xx_create()
3914 if (chip->active_ctrl == NULL) in snd_cs46xx_create()
3915 chip->active_ctrl = amp_none; in snd_cs46xx_create()
3917 chip->active_ctrl(chip, 1); /* enable CLKRUN */ in snd_cs46xx_create()
3922 region = &chip->region.idx[idx]; in snd_cs46xx_create()
3923 region->remap_addr = devm_ioremap(&pci->dev, region->base, in snd_cs46xx_create()
3924 region->size); in snd_cs46xx_create()
3925 if (region->remap_addr == NULL) { in snd_cs46xx_create()
3926 dev_err(chip->card->dev, in snd_cs46xx_create()
3927 "%s ioremap problem\n", region->name); in snd_cs46xx_create()
3928 return -ENOMEM; in snd_cs46xx_create()
3932 if (devm_request_irq(&pci->dev, pci->irq, snd_cs46xx_interrupt, in snd_cs46xx_create()
3934 dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq); in snd_cs46xx_create()
3935 return -EBUSY; in snd_cs46xx_create()
3937 chip->irq = pci->irq; in snd_cs46xx_create()
3938 card->sync_irq = chip->irq; in snd_cs46xx_create()
3939 card->private_free = snd_cs46xx_free; in snd_cs46xx_create()
3942 chip->dsp_spos_instance = cs46xx_dsp_spos_create(chip); in snd_cs46xx_create()
3943 if (!chip->dsp_spos_instance) in snd_cs46xx_create()
3944 return -ENOMEM; in snd_cs46xx_create()
3954 chip->saved_regs = devm_kmalloc_array(&pci->dev, in snd_cs46xx_create()
3956 sizeof(*chip->saved_regs), in snd_cs46xx_create()
3958 if (!chip->saved_regs) in snd_cs46xx_create()
3959 return -ENOMEM; in snd_cs46xx_create()
3962 chip->active_ctrl(chip, -1); /* disable CLKRUN */ in snd_cs46xx_create()