Lines Matching refs:p
78 static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
80 static int snd_sb_csp_unload(struct snd_sb_csp * p);
81 static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, i…
82 static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode);
83 static int snd_sb_csp_check_version(struct snd_sb_csp * p);
85 static int snd_sb_csp_use(struct snd_sb_csp * p);
86 static int snd_sb_csp_unuse(struct snd_sb_csp * p);
87 static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channels);
88 static int snd_sb_csp_stop(struct snd_sb_csp * p);
89 static int snd_sb_csp_pause(struct snd_sb_csp * p);
90 static int snd_sb_csp_restart(struct snd_sb_csp * p);
92 static int snd_sb_qsound_build(struct snd_sb_csp * p);
93 static void snd_sb_qsound_destroy(struct snd_sb_csp * p);
94 static int snd_sb_csp_qsound_transfer(struct snd_sb_csp * p);
96 static int init_proc_entry(struct snd_sb_csp * p, int device);
104 struct snd_sb_csp *p; in snd_sb_csp_new() local
119 p = kzalloc(sizeof(*p), GFP_KERNEL); in snd_sb_csp_new()
120 if (!p) { in snd_sb_csp_new()
124 p->chip = chip; in snd_sb_csp_new()
125 p->version = version; in snd_sb_csp_new()
128 p->ops.csp_use = snd_sb_csp_use; in snd_sb_csp_new()
129 p->ops.csp_unuse = snd_sb_csp_unuse; in snd_sb_csp_new()
130 p->ops.csp_autoload = snd_sb_csp_autoload; in snd_sb_csp_new()
131 p->ops.csp_start = snd_sb_csp_start; in snd_sb_csp_new()
132 p->ops.csp_stop = snd_sb_csp_stop; in snd_sb_csp_new()
133 p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer; in snd_sb_csp_new()
135 mutex_init(&p->access_mutex); in snd_sb_csp_new()
138 hw->private_data = p; in snd_sb_csp_new()
147 init_proc_entry(p, device); in snd_sb_csp_new()
159 struct snd_sb_csp *p = hwdep->private_data; in snd_sb_csp_free() local
160 if (p) { in snd_sb_csp_free()
161 if (p->running & SNDRV_SB_CSP_ST_RUNNING) in snd_sb_csp_free()
162 snd_sb_csp_stop(p); in snd_sb_csp_free()
163 for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i) in snd_sb_csp_free()
164 release_firmware(p->csp_programs[i]); in snd_sb_csp_free()
165 kfree(p); in snd_sb_csp_free()
176 struct snd_sb_csp *p = hw->private_data; in snd_sb_csp_open() local
177 return (snd_sb_csp_use(p)); in snd_sb_csp_open()
185 struct snd_sb_csp *p = hw->private_data; in snd_sb_csp_ioctl() local
190 if (snd_BUG_ON(!p)) in snd_sb_csp_ioctl()
193 if (snd_sb_csp_check_version(p)) in snd_sb_csp_ioctl()
200 *info.codec_name = *p->codec_name; in snd_sb_csp_ioctl()
201 info.func_nr = p->func_nr; in snd_sb_csp_ioctl()
202 info.acc_format = p->acc_format; in snd_sb_csp_ioctl()
203 info.acc_channels = p->acc_channels; in snd_sb_csp_ioctl()
204 info.acc_width = p->acc_width; in snd_sb_csp_ioctl()
205 info.acc_rates = p->acc_rates; in snd_sb_csp_ioctl()
206 info.csp_mode = p->mode; in snd_sb_csp_ioctl()
207 info.run_channels = p->run_channels; in snd_sb_csp_ioctl()
208 info.run_width = p->run_width; in snd_sb_csp_ioctl()
209 info.version = p->version; in snd_sb_csp_ioctl()
210 info.state = p->running; in snd_sb_csp_ioctl()
219 err = (p->running & SNDRV_SB_CSP_ST_RUNNING ? in snd_sb_csp_ioctl()
220 -EBUSY : snd_sb_csp_riff_load(p, (struct snd_sb_csp_microcode __user *) arg)); in snd_sb_csp_ioctl()
223 err = (p->running & SNDRV_SB_CSP_ST_RUNNING ? in snd_sb_csp_ioctl()
224 -EBUSY : snd_sb_csp_unload(p)); in snd_sb_csp_ioctl()
232 err = snd_sb_csp_start(p, start_info.sample_width, start_info.channels); in snd_sb_csp_ioctl()
235 err = snd_sb_csp_stop(p); in snd_sb_csp_ioctl()
238 err = snd_sb_csp_pause(p); in snd_sb_csp_ioctl()
241 err = snd_sb_csp_restart(p); in snd_sb_csp_ioctl()
256 struct snd_sb_csp *p = hw->private_data; in snd_sb_csp_release() local
257 return (snd_sb_csp_unuse(p)); in snd_sb_csp_release()
265 static int snd_sb_csp_use(struct snd_sb_csp * p) in snd_sb_csp_use() argument
267 mutex_lock(&p->access_mutex); in snd_sb_csp_use()
268 if (p->used) { in snd_sb_csp_use()
269 mutex_unlock(&p->access_mutex); in snd_sb_csp_use()
272 p->used++; in snd_sb_csp_use()
273 mutex_unlock(&p->access_mutex); in snd_sb_csp_use()
282 static int snd_sb_csp_unuse(struct snd_sb_csp * p) in snd_sb_csp_unuse() argument
284 mutex_lock(&p->access_mutex); in snd_sb_csp_unuse()
285 p->used--; in snd_sb_csp_unuse()
286 mutex_unlock(&p->access_mutex); in snd_sb_csp_unuse()
295 static int snd_sb_csp_riff_load(struct snd_sb_csp * p, in snd_sb_csp_riff_load() argument
354 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_riff_load()
355 snd_sb_qsound_destroy(p); in snd_sb_csp_riff_load()
358 p->running = 0; in snd_sb_csp_riff_load()
359 p->mode = 0; in snd_sb_csp_riff_load()
372 err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len), in snd_sb_csp_riff_load()
387 err = snd_sb_csp_load_user(p, data_ptr, in snd_sb_csp_riff_load()
393 strscpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); in snd_sb_csp_riff_load()
394 p->func_nr = func_nr; in snd_sb_csp_riff_load()
395 p->mode = le16_to_cpu(funcdesc_h.flags_play_rec); in snd_sb_csp_riff_load()
399 if (snd_sb_qsound_build(p) == 0) in snd_sb_csp_riff_load()
401 p->mode = SNDRV_SB_CSP_MODE_QSOUND; in snd_sb_csp_riff_load()
403 p->acc_format = 0; in snd_sb_csp_riff_load()
406 p->acc_format = SNDRV_PCM_FMTBIT_A_LAW; in snd_sb_csp_riff_load()
409 p->acc_format = SNDRV_PCM_FMTBIT_MU_LAW; in snd_sb_csp_riff_load()
413 p->acc_format = SNDRV_PCM_FMTBIT_IMA_ADPCM; in snd_sb_csp_riff_load()
417 p->acc_format = 0; in snd_sb_csp_riff_load()
421 p->acc_format = SNDRV_PCM_FMTBIT_SPECIAL; in snd_sb_csp_riff_load()
424 p->acc_format = p->acc_width = p->acc_rates = 0; in snd_sb_csp_riff_load()
425 p->mode = 0; in snd_sb_csp_riff_load()
431 p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono); in snd_sb_csp_riff_load()
432 p->acc_width = le16_to_cpu(funcdesc_h.flags_16bit_8bit); in snd_sb_csp_riff_load()
433 p->acc_rates = le16_to_cpu(funcdesc_h.flags_rates); in snd_sb_csp_riff_load()
436 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_riff_load()
437 set_mode_register(p->chip, 0xfc); in snd_sb_csp_riff_load()
438 set_mode_register(p->chip, 0x00); in snd_sb_csp_riff_load()
439 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_riff_load()
442 p->running = SNDRV_SB_CSP_ST_LOADED; /* set LOADED flag */ in snd_sb_csp_riff_load()
453 static int snd_sb_csp_unload(struct snd_sb_csp * p) in snd_sb_csp_unload() argument
455 if (p->running & SNDRV_SB_CSP_ST_RUNNING) in snd_sb_csp_unload()
457 if (!(p->running & SNDRV_SB_CSP_ST_LOADED)) in snd_sb_csp_unload()
461 p->acc_format = 0; in snd_sb_csp_unload()
462 p->acc_channels = p->acc_width = p->acc_rates = 0; in snd_sb_csp_unload()
464 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_unload()
465 snd_sb_qsound_destroy(p); in snd_sb_csp_unload()
468 p->running = 0; in snd_sb_csp_unload()
469 p->mode = 0; in snd_sb_csp_unload()
597 static int snd_sb_csp_check_version(struct snd_sb_csp * p) in snd_sb_csp_check_version() argument
599 if (p->version < 0x10 || p->version > 0x1f) { in snd_sb_csp_check_version()
600 snd_printd("%s: Invalid CSP version: 0x%x\n", __func__, p->version); in snd_sb_csp_check_version()
609 static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int size, int load_flag… in snd_sb_csp_load() argument
616 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_load()
617 snd_sbdsp_command(p->chip, 0x01); /* CSP download command */ in snd_sb_csp_load()
618 if (snd_sbdsp_get_byte(p->chip)) { in snd_sb_csp_load()
623 snd_sbdsp_command(p->chip, (unsigned char)(size - 1)); in snd_sb_csp_load()
625 snd_sbdsp_command(p->chip, (unsigned char)((size - 1) >> 8)); in snd_sb_csp_load()
629 if (!snd_sbdsp_command(p->chip, *buf++)) in snd_sb_csp_load()
632 if (snd_sbdsp_get_byte(p->chip)) in snd_sb_csp_load()
639 snd_sbdsp_command(p->chip, 0x03); in snd_sb_csp_load()
640 status = snd_sbdsp_get_byte(p->chip); in snd_sb_csp_load()
655 spin_lock(&p->chip->mixer_lock); in snd_sb_csp_load()
656 status = snd_sbmixer_read(p->chip, SB_DSP4_DMASETUP); in snd_sb_csp_load()
657 spin_unlock(&p->chip->mixer_lock); in snd_sb_csp_load()
659 err = (set_codec_parameter(p->chip, 0xaa, 0x00) || in snd_sb_csp_load()
660 set_codec_parameter(p->chip, 0xff, 0x00)); in snd_sb_csp_load()
661 snd_sbdsp_reset(p->chip); /* really! */ in snd_sb_csp_load()
664 set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_load()
665 set_mode_register(p->chip, 0x70); /* 70 = RUN */ in snd_sb_csp_load()
671 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_load()
675 static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, i… in snd_sb_csp_load_user() argument
684 err = snd_sb_csp_load(p, kbuf, size, load_flags); in snd_sb_csp_load_user()
690 static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags) in snd_sb_csp_firmware_load() argument
702 program = p->csp_programs[index]; in snd_sb_csp_firmware_load()
705 p->chip->card->dev); in snd_sb_csp_firmware_load()
708 p->csp_programs[index] = program; in snd_sb_csp_firmware_load()
710 return snd_sb_csp_load(p, program->data, program->size, flags); in snd_sb_csp_firmware_load()
717 static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode) in snd_sb_csp_autoload() argument
723 if (p->running & (SNDRV_SB_CSP_ST_RUNNING | SNDRV_SB_CSP_ST_LOADED)) in snd_sb_csp_autoload()
727 if (((1U << (__force int)pcm_sfmt) & p->acc_format) && (play_rec_mode & p->mode)) { in snd_sb_csp_autoload()
728 p->running = SNDRV_SB_CSP_ST_AUTO; in snd_sb_csp_autoload()
732 err = snd_sb_csp_firmware_load(p, CSP_PROGRAM_MULAW, 0); in snd_sb_csp_autoload()
733 p->acc_format = SNDRV_PCM_FMTBIT_MU_LAW; in snd_sb_csp_autoload()
734 p->mode = SNDRV_SB_CSP_MODE_DSP_READ | SNDRV_SB_CSP_MODE_DSP_WRITE; in snd_sb_csp_autoload()
737 err = snd_sb_csp_firmware_load(p, CSP_PROGRAM_ALAW, 0); in snd_sb_csp_autoload()
738 p->acc_format = SNDRV_PCM_FMTBIT_A_LAW; in snd_sb_csp_autoload()
739 p->mode = SNDRV_SB_CSP_MODE_DSP_READ | SNDRV_SB_CSP_MODE_DSP_WRITE; in snd_sb_csp_autoload()
742 err = snd_sb_csp_firmware_load(p, CSP_PROGRAM_ADPCM_INIT, in snd_sb_csp_autoload()
748 (p, CSP_PROGRAM_ADPCM_PLAYBACK, 0); in snd_sb_csp_autoload()
749 p->mode = SNDRV_SB_CSP_MODE_DSP_WRITE; in snd_sb_csp_autoload()
752 (p, CSP_PROGRAM_ADPCM_CAPTURE, 0); in snd_sb_csp_autoload()
753 p->mode = SNDRV_SB_CSP_MODE_DSP_READ; in snd_sb_csp_autoload()
755 p->acc_format = SNDRV_PCM_FMTBIT_IMA_ADPCM; in snd_sb_csp_autoload()
759 if (p->running & SNDRV_SB_CSP_ST_AUTO) { in snd_sb_csp_autoload()
760 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_autoload()
761 set_mode_register(p->chip, 0xfc); in snd_sb_csp_autoload()
762 set_mode_register(p->chip, 0x00); in snd_sb_csp_autoload()
763 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_autoload()
764 p->running = 0; /* clear autoloaded flag */ in snd_sb_csp_autoload()
769 p->acc_format = 0; in snd_sb_csp_autoload()
770 p->acc_channels = p->acc_width = p->acc_rates = 0; in snd_sb_csp_autoload()
772 p->running = 0; /* clear autoloaded flag */ in snd_sb_csp_autoload()
773 p->mode = 0; in snd_sb_csp_autoload()
776 p->running = SNDRV_SB_CSP_ST_AUTO; /* set autoloaded flag */ in snd_sb_csp_autoload()
777 p->acc_width = SNDRV_SB_CSP_SAMPLE_16BIT; /* only 16 bit data */ in snd_sb_csp_autoload()
778 p->acc_channels = SNDRV_SB_CSP_MONO | SNDRV_SB_CSP_STEREO; in snd_sb_csp_autoload()
779 p->acc_rates = SNDRV_SB_CSP_RATE_ALL; /* HW codecs accept all rates */ in snd_sb_csp_autoload()
783 return (p->running & SNDRV_SB_CSP_ST_AUTO) ? 0 : -ENXIO; in snd_sb_csp_autoload()
789 static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channels) in snd_sb_csp_start() argument
796 if (!(p->running & (SNDRV_SB_CSP_ST_LOADED | SNDRV_SB_CSP_ST_AUTO))) { in snd_sb_csp_start()
800 if (p->running & SNDRV_SB_CSP_ST_RUNNING) { in snd_sb_csp_start()
804 if (!(sample_width & p->acc_width)) { in snd_sb_csp_start()
808 if (!(channels & p->acc_channels)) { in snd_sb_csp_start()
814 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
815 mixL = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV); in snd_sb_csp_start()
816 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); in snd_sb_csp_start()
817 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); in snd_sb_csp_start()
818 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); in snd_sb_csp_start()
819 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
821 spin_lock(&p->chip->reg_lock); in snd_sb_csp_start()
822 set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_start()
823 set_mode_register(p->chip, 0x70); /* 70 = RUN */ in snd_sb_csp_start()
831 if (set_codec_parameter(p->chip, 0x81, s_type)) { in snd_sb_csp_start()
835 if (set_codec_parameter(p->chip, 0x80, 0x00)) { in snd_sb_csp_start()
839 p->run_width = sample_width; in snd_sb_csp_start()
840 p->run_channels = channels; in snd_sb_csp_start()
842 p->running |= SNDRV_SB_CSP_ST_RUNNING; in snd_sb_csp_start()
844 if (p->mode & SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_start()
845 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_start()
847 set_codec_parameter(p->chip, 0x00, 0xff); in snd_sb_csp_start()
848 set_codec_parameter(p->chip, 0x01, 0xff); in snd_sb_csp_start()
849 p->running |= SNDRV_SB_CSP_ST_QSOUND; in snd_sb_csp_start()
851 snd_sb_csp_qsound_transfer(p); in snd_sb_csp_start()
856 spin_unlock(&p->chip->reg_lock); in snd_sb_csp_start()
859 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
860 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); in snd_sb_csp_start()
861 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); in snd_sb_csp_start()
862 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
870 static int snd_sb_csp_stop(struct snd_sb_csp * p) in snd_sb_csp_stop() argument
876 if (!(p->running & SNDRV_SB_CSP_ST_RUNNING)) in snd_sb_csp_stop()
880 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
881 mixL = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV); in snd_sb_csp_stop()
882 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); in snd_sb_csp_stop()
883 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); in snd_sb_csp_stop()
884 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); in snd_sb_csp_stop()
885 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
887 spin_lock(&p->chip->reg_lock); in snd_sb_csp_stop()
888 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in snd_sb_csp_stop()
889 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_stop()
891 set_codec_parameter(p->chip, 0x00, 0x00); in snd_sb_csp_stop()
892 set_codec_parameter(p->chip, 0x01, 0x00); in snd_sb_csp_stop()
894 p->running &= ~SNDRV_SB_CSP_ST_QSOUND; in snd_sb_csp_stop()
896 result = set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_stop()
897 spin_unlock(&p->chip->reg_lock); in snd_sb_csp_stop()
900 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
901 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); in snd_sb_csp_stop()
902 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); in snd_sb_csp_stop()
903 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
906 p->running &= ~(SNDRV_SB_CSP_ST_PAUSED | SNDRV_SB_CSP_ST_RUNNING); in snd_sb_csp_stop()
913 static int snd_sb_csp_pause(struct snd_sb_csp * p) in snd_sb_csp_pause() argument
918 if (!(p->running & SNDRV_SB_CSP_ST_RUNNING)) in snd_sb_csp_pause()
921 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_pause()
922 result = set_codec_parameter(p->chip, 0x80, 0xff); in snd_sb_csp_pause()
923 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_pause()
925 p->running |= SNDRV_SB_CSP_ST_PAUSED; in snd_sb_csp_pause()
933 static int snd_sb_csp_restart(struct snd_sb_csp * p) in snd_sb_csp_restart() argument
938 if (!(p->running & SNDRV_SB_CSP_ST_PAUSED)) in snd_sb_csp_restart()
941 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_restart()
942 result = set_codec_parameter(p->chip, 0x80, 0x00); in snd_sb_csp_restart()
943 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_restart()
945 p->running &= ~SNDRV_SB_CSP_ST_PAUSED; in snd_sb_csp_restart()
960 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_switch_get() local
962 ucontrol->value.integer.value[0] = p->q_enabled ? 1 : 0; in snd_sb_qsound_switch_get()
968 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_switch_put() local
974 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_switch_put()
975 change = p->q_enabled != nval; in snd_sb_qsound_switch_put()
976 p->q_enabled = nval; in snd_sb_qsound_switch_put()
977 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_switch_put()
992 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_space_get() local
995 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_space_get()
996 ucontrol->value.integer.value[0] = p->qpos_left; in snd_sb_qsound_space_get()
997 ucontrol->value.integer.value[1] = p->qpos_right; in snd_sb_qsound_space_get()
998 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_space_get()
1004 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_space_put() local
1015 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_space_put()
1016 change = p->qpos_left != nval1 || p->qpos_right != nval2; in snd_sb_qsound_space_put()
1017 p->qpos_left = nval1; in snd_sb_qsound_space_put()
1018 p->qpos_right = nval2; in snd_sb_qsound_space_put()
1019 p->qpos_changed = change; in snd_sb_qsound_space_put()
1020 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_space_put()
1040 static int snd_sb_qsound_build(struct snd_sb_csp * p) in snd_sb_qsound_build() argument
1046 if (snd_BUG_ON(!p)) in snd_sb_qsound_build()
1049 card = p->chip->card; in snd_sb_qsound_build()
1050 p->qpos_left = p->qpos_right = SNDRV_SB_CSP_QSOUND_MAX_RIGHT / 2; in snd_sb_qsound_build()
1051 p->qpos_changed = 0; in snd_sb_qsound_build()
1053 spin_lock_init(&p->q_lock); in snd_sb_qsound_build()
1055 kctl = snd_ctl_new1(&snd_sb_qsound_switch, p); in snd_sb_qsound_build()
1059 p->qsound_switch = kctl; in snd_sb_qsound_build()
1060 kctl = snd_ctl_new1(&snd_sb_qsound_space, p); in snd_sb_qsound_build()
1064 p->qsound_space = kctl; in snd_sb_qsound_build()
1069 snd_sb_qsound_destroy(p); in snd_sb_qsound_build()
1073 static void snd_sb_qsound_destroy(struct snd_sb_csp * p) in snd_sb_qsound_destroy() argument
1078 if (snd_BUG_ON(!p)) in snd_sb_qsound_destroy()
1081 card = p->chip->card; in snd_sb_qsound_destroy()
1083 if (p->qsound_switch) { in snd_sb_qsound_destroy()
1084 snd_ctl_remove(card, p->qsound_switch); in snd_sb_qsound_destroy()
1085 p->qsound_switch = NULL; in snd_sb_qsound_destroy()
1087 if (p->qsound_space) { in snd_sb_qsound_destroy()
1088 snd_ctl_remove(card, p->qsound_space); in snd_sb_qsound_destroy()
1089 p->qsound_space = NULL; in snd_sb_qsound_destroy()
1093 spin_lock_irqsave (&p->q_lock, flags); in snd_sb_qsound_destroy()
1094 p->qpos_changed = 0; in snd_sb_qsound_destroy()
1095 spin_unlock_irqrestore (&p->q_lock, flags); in snd_sb_qsound_destroy()
1102 static int snd_sb_csp_qsound_transfer(struct snd_sb_csp * p) in snd_sb_csp_qsound_transfer() argument
1106 spin_lock(&p->q_lock); in snd_sb_csp_qsound_transfer()
1107 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in snd_sb_csp_qsound_transfer()
1108 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_qsound_transfer()
1110 set_codec_parameter(p->chip, 0x00, p->qpos_left); in snd_sb_csp_qsound_transfer()
1111 set_codec_parameter(p->chip, 0x02, 0x00); in snd_sb_csp_qsound_transfer()
1113 set_codec_parameter(p->chip, 0x00, p->qpos_right); in snd_sb_csp_qsound_transfer()
1114 set_codec_parameter(p->chip, 0x03, 0x00); in snd_sb_csp_qsound_transfer()
1117 p->qpos_changed = 0; in snd_sb_csp_qsound_transfer()
1118 spin_unlock(&p->q_lock); in snd_sb_csp_qsound_transfer()
1127 static int init_proc_entry(struct snd_sb_csp * p, int device) in init_proc_entry() argument
1132 snd_card_ro_proc_new(p->chip->card, name, p, info_read); in init_proc_entry()
1138 struct snd_sb_csp *p = entry->private_data; in info_read() local
1140 …snd_iprintf(buffer, "Creative Signal Processor [v%d.%d]\n", (p->version >> 4), (p->version & 0x0f)… in info_read()
1141 snd_iprintf(buffer, "State: %cx%c%c%c\n", ((p->running & SNDRV_SB_CSP_ST_QSOUND) ? 'Q' : '-'), in info_read()
1142 ((p->running & SNDRV_SB_CSP_ST_PAUSED) ? 'P' : '-'), in info_read()
1143 ((p->running & SNDRV_SB_CSP_ST_RUNNING) ? 'R' : '-'), in info_read()
1144 ((p->running & SNDRV_SB_CSP_ST_LOADED) ? 'L' : '-')); in info_read()
1145 if (p->running & SNDRV_SB_CSP_ST_LOADED) { in info_read()
1146 snd_iprintf(buffer, "Codec: %s [func #%d]\n", p->codec_name, p->func_nr); in info_read()
1148 if (p->acc_rates == SNDRV_SB_CSP_RATE_ALL) { in info_read()
1152 ((p->acc_rates & SNDRV_SB_CSP_RATE_8000) ? "8000Hz " : ""), in info_read()
1153 ((p->acc_rates & SNDRV_SB_CSP_RATE_11025) ? "11025Hz " : ""), in info_read()
1154 ((p->acc_rates & SNDRV_SB_CSP_RATE_22050) ? "22050Hz " : ""), in info_read()
1155 ((p->acc_rates & SNDRV_SB_CSP_RATE_44100) ? "44100Hz" : "")); in info_read()
1157 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in info_read()
1159 p->q_enabled ? "en" : "dis"); in info_read()
1162 p->acc_format, in info_read()
1163 ((p->acc_width & SNDRV_SB_CSP_SAMPLE_16BIT) ? "16bit" : "-"), in info_read()
1164 ((p->acc_width & SNDRV_SB_CSP_SAMPLE_8BIT) ? "8bit" : "-"), in info_read()
1165 ((p->acc_channels & SNDRV_SB_CSP_MONO) ? "mono" : "-"), in info_read()
1166 ((p->acc_channels & SNDRV_SB_CSP_STEREO) ? "stereo" : "-"), in info_read()
1167 ((p->mode & SNDRV_SB_CSP_MODE_DSP_WRITE) ? "playback" : "-"), in info_read()
1168 ((p->mode & SNDRV_SB_CSP_MODE_DSP_READ) ? "capture" : "-")); in info_read()
1171 if (p->running & SNDRV_SB_CSP_ST_AUTO) { in info_read()
1174 if (p->running & SNDRV_SB_CSP_ST_RUNNING) { in info_read()
1176 ((p->run_width & SNDRV_SB_CSP_SAMPLE_16BIT) ? 16 : 8), in info_read()
1177 ((p->run_channels & SNDRV_SB_CSP_MONO) ? "mono" : "stereo")); in info_read()
1179 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in info_read()
1181 p->qpos_left, p->qpos_right); in info_read()