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
299 struct device *dev = p->chip->card->dev; in snd_sb_csp_riff_load()
355 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_riff_load()
356 snd_sb_qsound_destroy(p); in snd_sb_csp_riff_load()
359 p->running = 0; in snd_sb_csp_riff_load()
360 p->mode = 0; in snd_sb_csp_riff_load()
373 err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len), in snd_sb_csp_riff_load()
388 err = snd_sb_csp_load_user(p, data_ptr, in snd_sb_csp_riff_load()
394 strscpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); in snd_sb_csp_riff_load()
395 p->func_nr = func_nr; in snd_sb_csp_riff_load()
396 p->mode = le16_to_cpu(funcdesc_h.flags_play_rec); in snd_sb_csp_riff_load()
400 if (snd_sb_qsound_build(p) == 0) in snd_sb_csp_riff_load()
402 p->mode = SNDRV_SB_CSP_MODE_QSOUND; in snd_sb_csp_riff_load()
404 p->acc_format = 0; in snd_sb_csp_riff_load()
407 p->acc_format = SNDRV_PCM_FMTBIT_A_LAW; in snd_sb_csp_riff_load()
410 p->acc_format = SNDRV_PCM_FMTBIT_MU_LAW; in snd_sb_csp_riff_load()
414 p->acc_format = SNDRV_PCM_FMTBIT_IMA_ADPCM; in snd_sb_csp_riff_load()
418 p->acc_format = 0; in snd_sb_csp_riff_load()
422 p->acc_format = SNDRV_PCM_FMTBIT_SPECIAL; in snd_sb_csp_riff_load()
425 p->acc_format = p->acc_width = p->acc_rates = 0; in snd_sb_csp_riff_load()
426 p->mode = 0; in snd_sb_csp_riff_load()
432 p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono); in snd_sb_csp_riff_load()
433 p->acc_width = le16_to_cpu(funcdesc_h.flags_16bit_8bit); in snd_sb_csp_riff_load()
434 p->acc_rates = le16_to_cpu(funcdesc_h.flags_rates); in snd_sb_csp_riff_load()
437 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_riff_load()
438 set_mode_register(p->chip, 0xfc); in snd_sb_csp_riff_load()
439 set_mode_register(p->chip, 0x00); in snd_sb_csp_riff_load()
440 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_riff_load()
443 p->running = SNDRV_SB_CSP_ST_LOADED; /* set LOADED flag */ in snd_sb_csp_riff_load()
454 static int snd_sb_csp_unload(struct snd_sb_csp * p) in snd_sb_csp_unload() argument
456 if (p->running & SNDRV_SB_CSP_ST_RUNNING) in snd_sb_csp_unload()
458 if (!(p->running & SNDRV_SB_CSP_ST_LOADED)) in snd_sb_csp_unload()
462 p->acc_format = 0; in snd_sb_csp_unload()
463 p->acc_channels = p->acc_width = p->acc_rates = 0; in snd_sb_csp_unload()
465 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_unload()
466 snd_sb_qsound_destroy(p); in snd_sb_csp_unload()
469 p->running = 0; in snd_sb_csp_unload()
470 p->mode = 0; in snd_sb_csp_unload()
598 static int snd_sb_csp_check_version(struct snd_sb_csp * p) in snd_sb_csp_check_version() argument
600 if (p->version < 0x10 || p->version > 0x1f) { in snd_sb_csp_check_version()
601 dev_dbg(p->chip->card->dev, in snd_sb_csp_check_version()
603 __func__, p->version); in snd_sb_csp_check_version()
612 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
619 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_load()
620 snd_sbdsp_command(p->chip, 0x01); /* CSP download command */ in snd_sb_csp_load()
621 if (snd_sbdsp_get_byte(p->chip)) { in snd_sb_csp_load()
622 dev_dbg(p->chip->card->dev, "%s: Download command failed\n", __func__); in snd_sb_csp_load()
626 snd_sbdsp_command(p->chip, (unsigned char)(size - 1)); in snd_sb_csp_load()
628 snd_sbdsp_command(p->chip, (unsigned char)((size - 1) >> 8)); in snd_sb_csp_load()
632 if (!snd_sbdsp_command(p->chip, *buf++)) in snd_sb_csp_load()
635 if (snd_sbdsp_get_byte(p->chip)) in snd_sb_csp_load()
642 snd_sbdsp_command(p->chip, 0x03); in snd_sb_csp_load()
643 status = snd_sbdsp_get_byte(p->chip); in snd_sb_csp_load()
649 dev_dbg(p->chip->card->dev, in snd_sb_csp_load()
660 spin_lock(&p->chip->mixer_lock); in snd_sb_csp_load()
661 status = snd_sbmixer_read(p->chip, SB_DSP4_DMASETUP); in snd_sb_csp_load()
662 spin_unlock(&p->chip->mixer_lock); in snd_sb_csp_load()
664 err = (set_codec_parameter(p->chip, 0xaa, 0x00) || in snd_sb_csp_load()
665 set_codec_parameter(p->chip, 0xff, 0x00)); in snd_sb_csp_load()
666 snd_sbdsp_reset(p->chip); /* really! */ in snd_sb_csp_load()
669 set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_load()
670 set_mode_register(p->chip, 0x70); /* 70 = RUN */ in snd_sb_csp_load()
676 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_load()
680 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
689 err = snd_sb_csp_load(p, kbuf, size, load_flags); in snd_sb_csp_load_user()
695 static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags) in snd_sb_csp_firmware_load() argument
707 program = p->csp_programs[index]; in snd_sb_csp_firmware_load()
710 p->chip->card->dev); in snd_sb_csp_firmware_load()
713 p->csp_programs[index] = program; in snd_sb_csp_firmware_load()
715 return snd_sb_csp_load(p, program->data, program->size, flags); in snd_sb_csp_firmware_load()
722 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
728 if (p->running & (SNDRV_SB_CSP_ST_RUNNING | SNDRV_SB_CSP_ST_LOADED)) in snd_sb_csp_autoload()
732 if (((1U << (__force int)pcm_sfmt) & p->acc_format) && (play_rec_mode & p->mode)) { in snd_sb_csp_autoload()
733 p->running = SNDRV_SB_CSP_ST_AUTO; in snd_sb_csp_autoload()
737 err = snd_sb_csp_firmware_load(p, CSP_PROGRAM_MULAW, 0); in snd_sb_csp_autoload()
738 p->acc_format = SNDRV_PCM_FMTBIT_MU_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_ALAW, 0); in snd_sb_csp_autoload()
743 p->acc_format = SNDRV_PCM_FMTBIT_A_LAW; in snd_sb_csp_autoload()
744 p->mode = SNDRV_SB_CSP_MODE_DSP_READ | SNDRV_SB_CSP_MODE_DSP_WRITE; in snd_sb_csp_autoload()
747 err = snd_sb_csp_firmware_load(p, CSP_PROGRAM_ADPCM_INIT, in snd_sb_csp_autoload()
753 (p, CSP_PROGRAM_ADPCM_PLAYBACK, 0); in snd_sb_csp_autoload()
754 p->mode = SNDRV_SB_CSP_MODE_DSP_WRITE; in snd_sb_csp_autoload()
757 (p, CSP_PROGRAM_ADPCM_CAPTURE, 0); in snd_sb_csp_autoload()
758 p->mode = SNDRV_SB_CSP_MODE_DSP_READ; in snd_sb_csp_autoload()
760 p->acc_format = SNDRV_PCM_FMTBIT_IMA_ADPCM; in snd_sb_csp_autoload()
764 if (p->running & SNDRV_SB_CSP_ST_AUTO) { in snd_sb_csp_autoload()
765 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_autoload()
766 set_mode_register(p->chip, 0xfc); in snd_sb_csp_autoload()
767 set_mode_register(p->chip, 0x00); in snd_sb_csp_autoload()
768 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_autoload()
769 p->running = 0; /* clear autoloaded flag */ in snd_sb_csp_autoload()
774 p->acc_format = 0; in snd_sb_csp_autoload()
775 p->acc_channels = p->acc_width = p->acc_rates = 0; in snd_sb_csp_autoload()
777 p->running = 0; /* clear autoloaded flag */ in snd_sb_csp_autoload()
778 p->mode = 0; in snd_sb_csp_autoload()
781 p->running = SNDRV_SB_CSP_ST_AUTO; /* set autoloaded flag */ in snd_sb_csp_autoload()
782 p->acc_width = SNDRV_SB_CSP_SAMPLE_16BIT; /* only 16 bit data */ in snd_sb_csp_autoload()
783 p->acc_channels = SNDRV_SB_CSP_MONO | SNDRV_SB_CSP_STEREO; in snd_sb_csp_autoload()
784 p->acc_rates = SNDRV_SB_CSP_RATE_ALL; /* HW codecs accept all rates */ in snd_sb_csp_autoload()
788 return (p->running & SNDRV_SB_CSP_ST_AUTO) ? 0 : -ENXIO; in snd_sb_csp_autoload()
794 static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channels) in snd_sb_csp_start() argument
796 struct device *dev = p->chip->card->dev; in snd_sb_csp_start()
802 if (!(p->running & (SNDRV_SB_CSP_ST_LOADED | SNDRV_SB_CSP_ST_AUTO))) { in snd_sb_csp_start()
806 if (p->running & SNDRV_SB_CSP_ST_RUNNING) { in snd_sb_csp_start()
810 if (!(sample_width & p->acc_width)) { in snd_sb_csp_start()
814 if (!(channels & p->acc_channels)) { in snd_sb_csp_start()
820 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
821 mixL = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV); in snd_sb_csp_start()
822 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); in snd_sb_csp_start()
823 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); in snd_sb_csp_start()
824 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); in snd_sb_csp_start()
825 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
827 spin_lock(&p->chip->reg_lock); in snd_sb_csp_start()
828 set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_start()
829 set_mode_register(p->chip, 0x70); /* 70 = RUN */ in snd_sb_csp_start()
837 if (set_codec_parameter(p->chip, 0x81, s_type)) { in snd_sb_csp_start()
841 if (set_codec_parameter(p->chip, 0x80, 0x00)) { in snd_sb_csp_start()
845 p->run_width = sample_width; in snd_sb_csp_start()
846 p->run_channels = channels; in snd_sb_csp_start()
848 p->running |= SNDRV_SB_CSP_ST_RUNNING; in snd_sb_csp_start()
850 if (p->mode & SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_start()
851 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_start()
853 set_codec_parameter(p->chip, 0x00, 0xff); in snd_sb_csp_start()
854 set_codec_parameter(p->chip, 0x01, 0xff); in snd_sb_csp_start()
855 p->running |= SNDRV_SB_CSP_ST_QSOUND; in snd_sb_csp_start()
857 snd_sb_csp_qsound_transfer(p); in snd_sb_csp_start()
862 spin_unlock(&p->chip->reg_lock); in snd_sb_csp_start()
865 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
866 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); in snd_sb_csp_start()
867 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); in snd_sb_csp_start()
868 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
876 static int snd_sb_csp_stop(struct snd_sb_csp * p) in snd_sb_csp_stop() argument
882 if (!(p->running & SNDRV_SB_CSP_ST_RUNNING)) in snd_sb_csp_stop()
886 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
887 mixL = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV); in snd_sb_csp_stop()
888 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); in snd_sb_csp_stop()
889 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); in snd_sb_csp_stop()
890 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); in snd_sb_csp_stop()
891 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
893 spin_lock(&p->chip->reg_lock); in snd_sb_csp_stop()
894 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in snd_sb_csp_stop()
895 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_stop()
897 set_codec_parameter(p->chip, 0x00, 0x00); in snd_sb_csp_stop()
898 set_codec_parameter(p->chip, 0x01, 0x00); in snd_sb_csp_stop()
900 p->running &= ~SNDRV_SB_CSP_ST_QSOUND; in snd_sb_csp_stop()
902 result = set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_stop()
903 spin_unlock(&p->chip->reg_lock); in snd_sb_csp_stop()
906 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
907 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); in snd_sb_csp_stop()
908 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); in snd_sb_csp_stop()
909 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
912 p->running &= ~(SNDRV_SB_CSP_ST_PAUSED | SNDRV_SB_CSP_ST_RUNNING); in snd_sb_csp_stop()
919 static int snd_sb_csp_pause(struct snd_sb_csp * p) in snd_sb_csp_pause() argument
924 if (!(p->running & SNDRV_SB_CSP_ST_RUNNING)) in snd_sb_csp_pause()
927 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_pause()
928 result = set_codec_parameter(p->chip, 0x80, 0xff); in snd_sb_csp_pause()
929 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_pause()
931 p->running |= SNDRV_SB_CSP_ST_PAUSED; in snd_sb_csp_pause()
939 static int snd_sb_csp_restart(struct snd_sb_csp * p) in snd_sb_csp_restart() argument
944 if (!(p->running & SNDRV_SB_CSP_ST_PAUSED)) in snd_sb_csp_restart()
947 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_restart()
948 result = set_codec_parameter(p->chip, 0x80, 0x00); in snd_sb_csp_restart()
949 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_restart()
951 p->running &= ~SNDRV_SB_CSP_ST_PAUSED; in snd_sb_csp_restart()
966 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_switch_get() local
968 ucontrol->value.integer.value[0] = p->q_enabled ? 1 : 0; in snd_sb_qsound_switch_get()
974 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_switch_put() local
980 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_switch_put()
981 change = p->q_enabled != nval; in snd_sb_qsound_switch_put()
982 p->q_enabled = nval; in snd_sb_qsound_switch_put()
983 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_switch_put()
998 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_space_get() local
1001 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_space_get()
1002 ucontrol->value.integer.value[0] = p->qpos_left; in snd_sb_qsound_space_get()
1003 ucontrol->value.integer.value[1] = p->qpos_right; in snd_sb_qsound_space_get()
1004 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_space_get()
1010 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_space_put() local
1021 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_space_put()
1022 change = p->qpos_left != nval1 || p->qpos_right != nval2; in snd_sb_qsound_space_put()
1023 p->qpos_left = nval1; in snd_sb_qsound_space_put()
1024 p->qpos_right = nval2; in snd_sb_qsound_space_put()
1025 p->qpos_changed = change; in snd_sb_qsound_space_put()
1026 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_space_put()
1046 static int snd_sb_qsound_build(struct snd_sb_csp * p) in snd_sb_qsound_build() argument
1052 if (snd_BUG_ON(!p)) in snd_sb_qsound_build()
1055 card = p->chip->card; in snd_sb_qsound_build()
1056 p->qpos_left = p->qpos_right = SNDRV_SB_CSP_QSOUND_MAX_RIGHT / 2; in snd_sb_qsound_build()
1057 p->qpos_changed = 0; in snd_sb_qsound_build()
1059 spin_lock_init(&p->q_lock); in snd_sb_qsound_build()
1061 kctl = snd_ctl_new1(&snd_sb_qsound_switch, p); in snd_sb_qsound_build()
1065 p->qsound_switch = kctl; in snd_sb_qsound_build()
1066 kctl = snd_ctl_new1(&snd_sb_qsound_space, p); in snd_sb_qsound_build()
1070 p->qsound_space = kctl; in snd_sb_qsound_build()
1075 snd_sb_qsound_destroy(p); in snd_sb_qsound_build()
1079 static void snd_sb_qsound_destroy(struct snd_sb_csp * p) in snd_sb_qsound_destroy() argument
1084 if (snd_BUG_ON(!p)) in snd_sb_qsound_destroy()
1087 card = p->chip->card; in snd_sb_qsound_destroy()
1089 snd_ctl_remove(card, p->qsound_switch); in snd_sb_qsound_destroy()
1090 p->qsound_switch = NULL; in snd_sb_qsound_destroy()
1091 snd_ctl_remove(card, p->qsound_space); in snd_sb_qsound_destroy()
1092 p->qsound_space = NULL; in snd_sb_qsound_destroy()
1095 spin_lock_irqsave (&p->q_lock, flags); in snd_sb_qsound_destroy()
1096 p->qpos_changed = 0; in snd_sb_qsound_destroy()
1097 spin_unlock_irqrestore (&p->q_lock, flags); in snd_sb_qsound_destroy()
1104 static int snd_sb_csp_qsound_transfer(struct snd_sb_csp * p) in snd_sb_csp_qsound_transfer() argument
1108 spin_lock(&p->q_lock); in snd_sb_csp_qsound_transfer()
1109 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in snd_sb_csp_qsound_transfer()
1110 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_qsound_transfer()
1112 set_codec_parameter(p->chip, 0x00, p->qpos_left); in snd_sb_csp_qsound_transfer()
1113 set_codec_parameter(p->chip, 0x02, 0x00); in snd_sb_csp_qsound_transfer()
1115 set_codec_parameter(p->chip, 0x00, p->qpos_right); in snd_sb_csp_qsound_transfer()
1116 set_codec_parameter(p->chip, 0x03, 0x00); in snd_sb_csp_qsound_transfer()
1119 p->qpos_changed = 0; in snd_sb_csp_qsound_transfer()
1120 spin_unlock(&p->q_lock); in snd_sb_csp_qsound_transfer()
1129 static int init_proc_entry(struct snd_sb_csp * p, int device) in init_proc_entry() argument
1134 snd_card_ro_proc_new(p->chip->card, name, p, info_read); in init_proc_entry()
1140 struct snd_sb_csp *p = entry->private_data; in info_read() local
1142 …snd_iprintf(buffer, "Creative Signal Processor [v%d.%d]\n", (p->version >> 4), (p->version & 0x0f)… in info_read()
1143 snd_iprintf(buffer, "State: %cx%c%c%c\n", ((p->running & SNDRV_SB_CSP_ST_QSOUND) ? 'Q' : '-'), in info_read()
1144 ((p->running & SNDRV_SB_CSP_ST_PAUSED) ? 'P' : '-'), in info_read()
1145 ((p->running & SNDRV_SB_CSP_ST_RUNNING) ? 'R' : '-'), in info_read()
1146 ((p->running & SNDRV_SB_CSP_ST_LOADED) ? 'L' : '-')); in info_read()
1147 if (p->running & SNDRV_SB_CSP_ST_LOADED) { in info_read()
1148 snd_iprintf(buffer, "Codec: %s [func #%d]\n", p->codec_name, p->func_nr); in info_read()
1150 if (p->acc_rates == SNDRV_SB_CSP_RATE_ALL) { in info_read()
1154 ((p->acc_rates & SNDRV_SB_CSP_RATE_8000) ? "8000Hz " : ""), in info_read()
1155 ((p->acc_rates & SNDRV_SB_CSP_RATE_11025) ? "11025Hz " : ""), in info_read()
1156 ((p->acc_rates & SNDRV_SB_CSP_RATE_22050) ? "22050Hz " : ""), in info_read()
1157 ((p->acc_rates & SNDRV_SB_CSP_RATE_44100) ? "44100Hz" : "")); in info_read()
1159 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in info_read()
1161 p->q_enabled ? "en" : "dis"); in info_read()
1164 p->acc_format, in info_read()
1165 ((p->acc_width & SNDRV_SB_CSP_SAMPLE_16BIT) ? "16bit" : "-"), in info_read()
1166 ((p->acc_width & SNDRV_SB_CSP_SAMPLE_8BIT) ? "8bit" : "-"), in info_read()
1167 ((p->acc_channels & SNDRV_SB_CSP_MONO) ? "mono" : "-"), in info_read()
1168 ((p->acc_channels & SNDRV_SB_CSP_STEREO) ? "stereo" : "-"), in info_read()
1169 ((p->mode & SNDRV_SB_CSP_MODE_DSP_WRITE) ? "playback" : "-"), in info_read()
1170 ((p->mode & SNDRV_SB_CSP_MODE_DSP_READ) ? "capture" : "-")); in info_read()
1173 if (p->running & SNDRV_SB_CSP_ST_AUTO) { in info_read()
1176 if (p->running & SNDRV_SB_CSP_ST_RUNNING) { in info_read()
1178 ((p->run_width & SNDRV_SB_CSP_SAMPLE_16BIT) ? 16 : 8), in info_read()
1179 ((p->run_channels & SNDRV_SB_CSP_MONO) ? "mono" : "stereo")); in info_read()
1181 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in info_read()
1183 p->qpos_left, p->qpos_right); in info_read()