• Home
  • Raw
  • Download

Lines Matching full:p

38 #define CSP__HEADER	CSP_HDR_VALUE('C', 'S', '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
118 if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) { in snd_sb_csp_new()
122 p->chip = chip; in snd_sb_csp_new()
123 p->version = version; in snd_sb_csp_new()
126 p->ops.csp_use = snd_sb_csp_use; in snd_sb_csp_new()
127 p->ops.csp_unuse = snd_sb_csp_unuse; in snd_sb_csp_new()
128 p->ops.csp_autoload = snd_sb_csp_autoload; in snd_sb_csp_new()
129 p->ops.csp_start = snd_sb_csp_start; in snd_sb_csp_new()
130 p->ops.csp_stop = snd_sb_csp_stop; in snd_sb_csp_new()
131 p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer; in snd_sb_csp_new()
133 mutex_init(&p->access_mutex); in snd_sb_csp_new()
136 hw->private_data = p; in snd_sb_csp_new()
145 init_proc_entry(p, device); in snd_sb_csp_new()
157 struct snd_sb_csp *p = hwdep->private_data; in snd_sb_csp_free() local
158 if (p) { in snd_sb_csp_free()
159 if (p->running & SNDRV_SB_CSP_ST_RUNNING) in snd_sb_csp_free()
160 snd_sb_csp_stop(p); in snd_sb_csp_free()
161 for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i) in snd_sb_csp_free()
162 release_firmware(p->csp_programs[i]); in snd_sb_csp_free()
163 kfree(p); in snd_sb_csp_free()
174 struct snd_sb_csp *p = hw->private_data; in snd_sb_csp_open() local
175 return (snd_sb_csp_use(p)); in snd_sb_csp_open()
183 struct snd_sb_csp *p = hw->private_data; in snd_sb_csp_ioctl() local
188 if (snd_BUG_ON(!p)) in snd_sb_csp_ioctl()
191 if (snd_sb_csp_check_version(p)) in snd_sb_csp_ioctl()
198 *info.codec_name = *p->codec_name; in snd_sb_csp_ioctl()
199 info.func_nr = p->func_nr; in snd_sb_csp_ioctl()
200 info.acc_format = p->acc_format; in snd_sb_csp_ioctl()
201 info.acc_channels = p->acc_channels; in snd_sb_csp_ioctl()
202 info.acc_width = p->acc_width; in snd_sb_csp_ioctl()
203 info.acc_rates = p->acc_rates; in snd_sb_csp_ioctl()
204 info.csp_mode = p->mode; in snd_sb_csp_ioctl()
205 info.run_channels = p->run_channels; in snd_sb_csp_ioctl()
206 info.run_width = p->run_width; in snd_sb_csp_ioctl()
207 info.version = p->version; in snd_sb_csp_ioctl()
208 info.state = p->running; in snd_sb_csp_ioctl()
217 err = (p->running & SNDRV_SB_CSP_ST_RUNNING ? in snd_sb_csp_ioctl()
218 -EBUSY : snd_sb_csp_riff_load(p, (struct snd_sb_csp_microcode __user *) arg)); in snd_sb_csp_ioctl()
221 err = (p->running & SNDRV_SB_CSP_ST_RUNNING ? in snd_sb_csp_ioctl()
222 -EBUSY : snd_sb_csp_unload(p)); in snd_sb_csp_ioctl()
230 err = snd_sb_csp_start(p, start_info.sample_width, start_info.channels); in snd_sb_csp_ioctl()
233 err = snd_sb_csp_stop(p); in snd_sb_csp_ioctl()
236 err = snd_sb_csp_pause(p); in snd_sb_csp_ioctl()
239 err = snd_sb_csp_restart(p); in snd_sb_csp_ioctl()
254 struct snd_sb_csp *p = hw->private_data; in snd_sb_csp_release() local
255 return (snd_sb_csp_unuse(p)); in snd_sb_csp_release()
263 static int snd_sb_csp_use(struct snd_sb_csp * p) in snd_sb_csp_use() argument
265 mutex_lock(&p->access_mutex); in snd_sb_csp_use()
266 if (p->used) { in snd_sb_csp_use()
267 mutex_unlock(&p->access_mutex); in snd_sb_csp_use()
270 p->used++; in snd_sb_csp_use()
271 mutex_unlock(&p->access_mutex); in snd_sb_csp_use()
280 static int snd_sb_csp_unuse(struct snd_sb_csp * p) in snd_sb_csp_unuse() argument
282 mutex_lock(&p->access_mutex); in snd_sb_csp_unuse()
283 p->used--; in snd_sb_csp_unuse()
284 mutex_unlock(&p->access_mutex); in snd_sb_csp_unuse()
293 static int snd_sb_csp_riff_load(struct snd_sb_csp * p, in snd_sb_csp_riff_load() argument
352 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_riff_load()
353 snd_sb_qsound_destroy(p); in snd_sb_csp_riff_load()
356 p->running = 0; in snd_sb_csp_riff_load()
357 p->mode = 0; in snd_sb_csp_riff_load()
370 err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len), in snd_sb_csp_riff_load()
385 err = snd_sb_csp_load_user(p, data_ptr, in snd_sb_csp_riff_load()
391 strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); in snd_sb_csp_riff_load()
392 p->func_nr = func_nr; in snd_sb_csp_riff_load()
393 p->mode = le16_to_cpu(funcdesc_h.flags_play_rec); in snd_sb_csp_riff_load()
397 if (snd_sb_qsound_build(p) == 0) in snd_sb_csp_riff_load()
399 p->mode = SNDRV_SB_CSP_MODE_QSOUND; in snd_sb_csp_riff_load()
401 p->acc_format = 0; in snd_sb_csp_riff_load()
404 p->acc_format = SNDRV_PCM_FMTBIT_A_LAW; in snd_sb_csp_riff_load()
407 p->acc_format = SNDRV_PCM_FMTBIT_MU_LAW; in snd_sb_csp_riff_load()
411 p->acc_format = SNDRV_PCM_FMTBIT_IMA_ADPCM; in snd_sb_csp_riff_load()
415 p->acc_format = 0; in snd_sb_csp_riff_load()
419 p->acc_format = SNDRV_PCM_FMTBIT_SPECIAL; in snd_sb_csp_riff_load()
422 p->acc_format = p->acc_width = p->acc_rates = 0; in snd_sb_csp_riff_load()
423 p->mode = 0; in snd_sb_csp_riff_load()
429 p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono); in snd_sb_csp_riff_load()
430 p->acc_width = le16_to_cpu(funcdesc_h.flags_16bit_8bit); in snd_sb_csp_riff_load()
431 p->acc_rates = le16_to_cpu(funcdesc_h.flags_rates); in snd_sb_csp_riff_load()
434 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_riff_load()
435 set_mode_register(p->chip, 0xfc); in snd_sb_csp_riff_load()
436 set_mode_register(p->chip, 0x00); in snd_sb_csp_riff_load()
437 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_riff_load()
440 p->running = SNDRV_SB_CSP_ST_LOADED; /* set LOADED flag */ in snd_sb_csp_riff_load()
451 static int snd_sb_csp_unload(struct snd_sb_csp * p) in snd_sb_csp_unload() argument
453 if (p->running & SNDRV_SB_CSP_ST_RUNNING) in snd_sb_csp_unload()
455 if (!(p->running & SNDRV_SB_CSP_ST_LOADED)) in snd_sb_csp_unload()
459 p->acc_format = 0; in snd_sb_csp_unload()
460 p->acc_channels = p->acc_width = p->acc_rates = 0; in snd_sb_csp_unload()
462 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_unload()
463 snd_sb_qsound_destroy(p); in snd_sb_csp_unload()
466 p->running = 0; in snd_sb_csp_unload()
467 p->mode = 0; in snd_sb_csp_unload()
595 static int snd_sb_csp_check_version(struct snd_sb_csp * p) in snd_sb_csp_check_version() argument
597 if (p->version < 0x10 || p->version > 0x1f) { in snd_sb_csp_check_version()
598 snd_printd("%s: Invalid CSP version: 0x%x\n", __func__, p->version); in snd_sb_csp_check_version()
607 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
614 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_load()
615 snd_sbdsp_command(p->chip, 0x01); /* CSP download command */ in snd_sb_csp_load()
616 if (snd_sbdsp_get_byte(p->chip)) { in snd_sb_csp_load()
621 snd_sbdsp_command(p->chip, (unsigned char)(size - 1)); in snd_sb_csp_load()
623 snd_sbdsp_command(p->chip, (unsigned char)((size - 1) >> 8)); in snd_sb_csp_load()
627 if (!snd_sbdsp_command(p->chip, *buf++)) in snd_sb_csp_load()
630 if (snd_sbdsp_get_byte(p->chip)) in snd_sb_csp_load()
637 snd_sbdsp_command(p->chip, 0x03); in snd_sb_csp_load()
638 status = snd_sbdsp_get_byte(p->chip); in snd_sb_csp_load()
653 spin_lock(&p->chip->mixer_lock); in snd_sb_csp_load()
654 status = snd_sbmixer_read(p->chip, SB_DSP4_DMASETUP); in snd_sb_csp_load()
655 spin_unlock(&p->chip->mixer_lock); in snd_sb_csp_load()
657 err = (set_codec_parameter(p->chip, 0xaa, 0x00) || in snd_sb_csp_load()
658 set_codec_parameter(p->chip, 0xff, 0x00)); in snd_sb_csp_load()
659 snd_sbdsp_reset(p->chip); /* really! */ in snd_sb_csp_load()
662 set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_load()
663 set_mode_register(p->chip, 0x70); /* 70 = RUN */ in snd_sb_csp_load()
669 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_load()
673 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
682 err = snd_sb_csp_load(p, kbuf, size, load_flags); in snd_sb_csp_load_user()
688 static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags) in snd_sb_csp_firmware_load() argument
700 program = p->csp_programs[index]; in snd_sb_csp_firmware_load()
703 p->chip->card->dev); in snd_sb_csp_firmware_load()
706 p->csp_programs[index] = program; in snd_sb_csp_firmware_load()
708 return snd_sb_csp_load(p, program->data, program->size, flags); in snd_sb_csp_firmware_load()
713 * return 0 if CSP is loaded and ready to run (p->running != 0)
715 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
721 if (p->running & (SNDRV_SB_CSP_ST_RUNNING | SNDRV_SB_CSP_ST_LOADED)) in snd_sb_csp_autoload()
725 if (((1U << (__force int)pcm_sfmt) & p->acc_format) && (play_rec_mode & p->mode)) { in snd_sb_csp_autoload()
726 p->running = SNDRV_SB_CSP_ST_AUTO; in snd_sb_csp_autoload()
730 err = snd_sb_csp_firmware_load(p, CSP_PROGRAM_MULAW, 0); in snd_sb_csp_autoload()
731 p->acc_format = SNDRV_PCM_FMTBIT_MU_LAW; in snd_sb_csp_autoload()
732 p->mode = SNDRV_SB_CSP_MODE_DSP_READ | SNDRV_SB_CSP_MODE_DSP_WRITE; in snd_sb_csp_autoload()
735 err = snd_sb_csp_firmware_load(p, CSP_PROGRAM_ALAW, 0); in snd_sb_csp_autoload()
736 p->acc_format = SNDRV_PCM_FMTBIT_A_LAW; in snd_sb_csp_autoload()
737 p->mode = SNDRV_SB_CSP_MODE_DSP_READ | SNDRV_SB_CSP_MODE_DSP_WRITE; in snd_sb_csp_autoload()
740 err = snd_sb_csp_firmware_load(p, CSP_PROGRAM_ADPCM_INIT, in snd_sb_csp_autoload()
746 (p, CSP_PROGRAM_ADPCM_PLAYBACK, 0); in snd_sb_csp_autoload()
747 p->mode = SNDRV_SB_CSP_MODE_DSP_WRITE; in snd_sb_csp_autoload()
750 (p, CSP_PROGRAM_ADPCM_CAPTURE, 0); in snd_sb_csp_autoload()
751 p->mode = SNDRV_SB_CSP_MODE_DSP_READ; in snd_sb_csp_autoload()
753 p->acc_format = SNDRV_PCM_FMTBIT_IMA_ADPCM; in snd_sb_csp_autoload()
757 if (p->running & SNDRV_SB_CSP_ST_AUTO) { in snd_sb_csp_autoload()
758 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_autoload()
759 set_mode_register(p->chip, 0xfc); in snd_sb_csp_autoload()
760 set_mode_register(p->chip, 0x00); in snd_sb_csp_autoload()
761 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_autoload()
762 p->running = 0; /* clear autoloaded flag */ in snd_sb_csp_autoload()
767 p->acc_format = 0; in snd_sb_csp_autoload()
768 p->acc_channels = p->acc_width = p->acc_rates = 0; in snd_sb_csp_autoload()
770 p->running = 0; /* clear autoloaded flag */ in snd_sb_csp_autoload()
771 p->mode = 0; in snd_sb_csp_autoload()
774 p->running = SNDRV_SB_CSP_ST_AUTO; /* set autoloaded flag */ in snd_sb_csp_autoload()
775 p->acc_width = SNDRV_SB_CSP_SAMPLE_16BIT; /* only 16 bit data */ in snd_sb_csp_autoload()
776 p->acc_channels = SNDRV_SB_CSP_MONO | SNDRV_SB_CSP_STEREO; in snd_sb_csp_autoload()
777 p->acc_rates = SNDRV_SB_CSP_RATE_ALL; /* HW codecs accept all rates */ in snd_sb_csp_autoload()
781 return (p->running & SNDRV_SB_CSP_ST_AUTO) ? 0 : -ENXIO; in snd_sb_csp_autoload()
787 static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channels) in snd_sb_csp_start() argument
794 if (!(p->running & (SNDRV_SB_CSP_ST_LOADED | SNDRV_SB_CSP_ST_AUTO))) { in snd_sb_csp_start()
798 if (p->running & SNDRV_SB_CSP_ST_RUNNING) { in snd_sb_csp_start()
802 if (!(sample_width & p->acc_width)) { in snd_sb_csp_start()
806 if (!(channels & p->acc_channels)) { in snd_sb_csp_start()
812 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
813 mixL = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV); in snd_sb_csp_start()
814 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); in snd_sb_csp_start()
815 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); in snd_sb_csp_start()
816 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); in snd_sb_csp_start()
817 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
819 spin_lock(&p->chip->reg_lock); in snd_sb_csp_start()
820 set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_start()
821 set_mode_register(p->chip, 0x70); /* 70 = RUN */ in snd_sb_csp_start()
829 if (set_codec_parameter(p->chip, 0x81, s_type)) { in snd_sb_csp_start()
833 if (set_codec_parameter(p->chip, 0x80, 0x00)) { in snd_sb_csp_start()
837 p->run_width = sample_width; in snd_sb_csp_start()
838 p->run_channels = channels; in snd_sb_csp_start()
840 p->running |= SNDRV_SB_CSP_ST_RUNNING; in snd_sb_csp_start()
842 if (p->mode & SNDRV_SB_CSP_MODE_QSOUND) { in snd_sb_csp_start()
843 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_start()
845 set_codec_parameter(p->chip, 0x00, 0xff); in snd_sb_csp_start()
846 set_codec_parameter(p->chip, 0x01, 0xff); in snd_sb_csp_start()
847 p->running |= SNDRV_SB_CSP_ST_QSOUND; in snd_sb_csp_start()
849 snd_sb_csp_qsound_transfer(p); in snd_sb_csp_start()
854 spin_unlock(&p->chip->reg_lock); in snd_sb_csp_start()
857 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
858 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); in snd_sb_csp_start()
859 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); in snd_sb_csp_start()
860 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_start()
868 static int snd_sb_csp_stop(struct snd_sb_csp * p) in snd_sb_csp_stop() argument
874 if (!(p->running & SNDRV_SB_CSP_ST_RUNNING)) in snd_sb_csp_stop()
878 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
879 mixL = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV); in snd_sb_csp_stop()
880 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); in snd_sb_csp_stop()
881 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); in snd_sb_csp_stop()
882 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); in snd_sb_csp_stop()
883 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
885 spin_lock(&p->chip->reg_lock); in snd_sb_csp_stop()
886 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in snd_sb_csp_stop()
887 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_stop()
889 set_codec_parameter(p->chip, 0x00, 0x00); in snd_sb_csp_stop()
890 set_codec_parameter(p->chip, 0x01, 0x00); in snd_sb_csp_stop()
892 p->running &= ~SNDRV_SB_CSP_ST_QSOUND; in snd_sb_csp_stop()
894 result = set_mode_register(p->chip, 0xc0); /* c0 = STOP */ in snd_sb_csp_stop()
895 spin_unlock(&p->chip->reg_lock); in snd_sb_csp_stop()
898 spin_lock_irqsave(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
899 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); in snd_sb_csp_stop()
900 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); in snd_sb_csp_stop()
901 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); in snd_sb_csp_stop()
904 p->running &= ~(SNDRV_SB_CSP_ST_PAUSED | SNDRV_SB_CSP_ST_RUNNING); in snd_sb_csp_stop()
911 static int snd_sb_csp_pause(struct snd_sb_csp * p) in snd_sb_csp_pause() argument
916 if (!(p->running & SNDRV_SB_CSP_ST_RUNNING)) in snd_sb_csp_pause()
919 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_pause()
920 result = set_codec_parameter(p->chip, 0x80, 0xff); in snd_sb_csp_pause()
921 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_pause()
923 p->running |= SNDRV_SB_CSP_ST_PAUSED; in snd_sb_csp_pause()
931 static int snd_sb_csp_restart(struct snd_sb_csp * p) in snd_sb_csp_restart() argument
936 if (!(p->running & SNDRV_SB_CSP_ST_PAUSED)) in snd_sb_csp_restart()
939 spin_lock_irqsave(&p->chip->reg_lock, flags); in snd_sb_csp_restart()
940 result = set_codec_parameter(p->chip, 0x80, 0x00); in snd_sb_csp_restart()
941 spin_unlock_irqrestore(&p->chip->reg_lock, flags); in snd_sb_csp_restart()
943 p->running &= ~SNDRV_SB_CSP_ST_PAUSED; in snd_sb_csp_restart()
958 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_switch_get() local
960 ucontrol->value.integer.value[0] = p->q_enabled ? 1 : 0; in snd_sb_qsound_switch_get()
966 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_switch_put() local
972 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_switch_put()
973 change = p->q_enabled != nval; in snd_sb_qsound_switch_put()
974 p->q_enabled = nval; in snd_sb_qsound_switch_put()
975 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_switch_put()
990 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_space_get() local
993 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_space_get()
994 ucontrol->value.integer.value[0] = p->qpos_left; in snd_sb_qsound_space_get()
995 ucontrol->value.integer.value[1] = p->qpos_right; in snd_sb_qsound_space_get()
996 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_space_get()
1002 struct snd_sb_csp *p = snd_kcontrol_chip(kcontrol); in snd_sb_qsound_space_put() local
1013 spin_lock_irqsave(&p->q_lock, flags); in snd_sb_qsound_space_put()
1014 change = p->qpos_left != nval1 || p->qpos_right != nval2; in snd_sb_qsound_space_put()
1015 p->qpos_left = nval1; in snd_sb_qsound_space_put()
1016 p->qpos_right = nval2; in snd_sb_qsound_space_put()
1017 p->qpos_changed = change; in snd_sb_qsound_space_put()
1018 spin_unlock_irqrestore(&p->q_lock, flags); in snd_sb_qsound_space_put()
1038 static int snd_sb_qsound_build(struct snd_sb_csp * p) in snd_sb_qsound_build() argument
1043 if (snd_BUG_ON(!p)) in snd_sb_qsound_build()
1046 card = p->chip->card; in snd_sb_qsound_build()
1047 p->qpos_left = p->qpos_right = SNDRV_SB_CSP_QSOUND_MAX_RIGHT / 2; in snd_sb_qsound_build()
1048 p->qpos_changed = 0; in snd_sb_qsound_build()
1050 spin_lock_init(&p->q_lock); in snd_sb_qsound_build()
1052 if ((err = snd_ctl_add(card, p->qsound_switch = snd_ctl_new1(&snd_sb_qsound_switch, p))) < 0) { in snd_sb_qsound_build()
1053 p->qsound_switch = NULL; in snd_sb_qsound_build()
1056 if ((err = snd_ctl_add(card, p->qsound_space = snd_ctl_new1(&snd_sb_qsound_space, p))) < 0) { in snd_sb_qsound_build()
1057 p->qsound_space = NULL; in snd_sb_qsound_build()
1064 snd_sb_qsound_destroy(p); in snd_sb_qsound_build()
1068 static void snd_sb_qsound_destroy(struct snd_sb_csp * p) in snd_sb_qsound_destroy() argument
1073 if (snd_BUG_ON(!p)) in snd_sb_qsound_destroy()
1076 card = p->chip->card; in snd_sb_qsound_destroy()
1079 if (p->qsound_switch) { in snd_sb_qsound_destroy()
1080 snd_ctl_remove(card, p->qsound_switch); in snd_sb_qsound_destroy()
1081 p->qsound_switch = NULL; in snd_sb_qsound_destroy()
1083 if (p->qsound_space) { in snd_sb_qsound_destroy()
1084 snd_ctl_remove(card, p->qsound_space); in snd_sb_qsound_destroy()
1085 p->qsound_space = NULL; in snd_sb_qsound_destroy()
1090 spin_lock_irqsave (&p->q_lock, flags); in snd_sb_qsound_destroy()
1091 p->qpos_changed = 0; in snd_sb_qsound_destroy()
1092 spin_unlock_irqrestore (&p->q_lock, flags); in snd_sb_qsound_destroy()
1099 static int snd_sb_csp_qsound_transfer(struct snd_sb_csp * p) in snd_sb_csp_qsound_transfer() argument
1103 spin_lock(&p->q_lock); in snd_sb_csp_qsound_transfer()
1104 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in snd_sb_csp_qsound_transfer()
1105 set_codec_parameter(p->chip, 0xe0, 0x01); in snd_sb_csp_qsound_transfer()
1107 set_codec_parameter(p->chip, 0x00, p->qpos_left); in snd_sb_csp_qsound_transfer()
1108 set_codec_parameter(p->chip, 0x02, 0x00); in snd_sb_csp_qsound_transfer()
1110 set_codec_parameter(p->chip, 0x00, p->qpos_right); in snd_sb_csp_qsound_transfer()
1111 set_codec_parameter(p->chip, 0x03, 0x00); in snd_sb_csp_qsound_transfer()
1114 p->qpos_changed = 0; in snd_sb_csp_qsound_transfer()
1115 spin_unlock(&p->q_lock); in snd_sb_csp_qsound_transfer()
1124 static int init_proc_entry(struct snd_sb_csp * p, int device) in init_proc_entry() argument
1129 snd_card_ro_proc_new(p->chip->card, name, p, info_read); in init_proc_entry()
1135 struct snd_sb_csp *p = entry->private_data; in info_read() local
1137 …snd_iprintf(buffer, "Creative Signal Processor [v%d.%d]\n", (p->version >> 4), (p->version & 0x0f)… in info_read()
1138 snd_iprintf(buffer, "State: %cx%c%c%c\n", ((p->running & SNDRV_SB_CSP_ST_QSOUND) ? 'Q' : '-'), in info_read()
1139 ((p->running & SNDRV_SB_CSP_ST_PAUSED) ? 'P' : '-'), in info_read()
1140 ((p->running & SNDRV_SB_CSP_ST_RUNNING) ? 'R' : '-'), in info_read()
1141 ((p->running & SNDRV_SB_CSP_ST_LOADED) ? 'L' : '-')); in info_read()
1142 if (p->running & SNDRV_SB_CSP_ST_LOADED) { in info_read()
1143 snd_iprintf(buffer, "Codec: %s [func #%d]\n", p->codec_name, p->func_nr); in info_read()
1145 if (p->acc_rates == SNDRV_SB_CSP_RATE_ALL) { in info_read()
1149 ((p->acc_rates & SNDRV_SB_CSP_RATE_8000) ? "8000Hz " : ""), in info_read()
1150 ((p->acc_rates & SNDRV_SB_CSP_RATE_11025) ? "11025Hz " : ""), in info_read()
1151 ((p->acc_rates & SNDRV_SB_CSP_RATE_22050) ? "22050Hz " : ""), in info_read()
1152 ((p->acc_rates & SNDRV_SB_CSP_RATE_44100) ? "44100Hz" : "")); in info_read()
1154 if (p->mode == SNDRV_SB_CSP_MODE_QSOUND) { in info_read()
1156 p->q_enabled ? "en" : "dis"); in info_read()
1159 p->acc_format, in info_read()
1160 ((p->acc_width & SNDRV_SB_CSP_SAMPLE_16BIT) ? "16bit" : "-"), in info_read()
1161 ((p->acc_width & SNDRV_SB_CSP_SAMPLE_8BIT) ? "8bit" : "-"), in info_read()
1162 ((p->acc_channels & SNDRV_SB_CSP_MONO) ? "mono" : "-"), in info_read()
1163 ((p->acc_channels & SNDRV_SB_CSP_STEREO) ? "stereo" : "-"), in info_read()
1164 ((p->mode & SNDRV_SB_CSP_MODE_DSP_WRITE) ? "playback" : "-"), in info_read()
1165 ((p->mode & SNDRV_SB_CSP_MODE_DSP_READ) ? "capture" : "-")); in info_read()
1168 if (p->running & SNDRV_SB_CSP_ST_AUTO) { in info_read()
1171 if (p->running & SNDRV_SB_CSP_ST_RUNNING) { in info_read()
1173 ((p->run_width & SNDRV_SB_CSP_SAMPLE_16BIT) ? 16 : 8), in info_read()
1174 ((p->run_channels & SNDRV_SB_CSP_MONO) ? "mono" : "stereo")); in info_read()
1176 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { in info_read()
1178 p->qpos_left, p->qpos_right); in info_read()