Lines Matching full:chip
93 struct snd_sb *chip = snd_pcm_substream_chip(substream); in snd_sb8_playback_prepare() local
101 switch (chip->hardware) { in snd_sb8_playback_prepare()
104 if (chip->mode & SB_MODE_CAPTURE_16) in snd_sb8_playback_prepare()
107 chip->mode |= SB_MODE_PLAYBACK_16; in snd_sb8_playback_prepare()
109 chip->playback_format = SB_DSP_LO_OUTPUT_AUTO; in snd_sb8_playback_prepare()
116 chip->playback_format = SB_DSP_HI_OUTPUT_AUTO; in snd_sb8_playback_prepare()
122 chip->playback_format = SB_DSP_HI_OUTPUT_AUTO; in snd_sb8_playback_prepare()
127 chip->playback_format = SB_DSP_LO_OUTPUT_AUTO; in snd_sb8_playback_prepare()
130 chip->playback_format = SB_DSP_OUTPUT; in snd_sb8_playback_prepare()
135 if (chip->mode & SB_MODE_PLAYBACK_16) { in snd_sb8_playback_prepare()
137 dma = chip->dma16; in snd_sb8_playback_prepare()
140 chip->mode |= SB_MODE_PLAYBACK_8; in snd_sb8_playback_prepare()
141 dma = chip->dma8; in snd_sb8_playback_prepare()
143 size = chip->p_dma_size = snd_pcm_lib_buffer_bytes(substream); in snd_sb8_playback_prepare()
144 count = chip->p_period_size = snd_pcm_lib_period_bytes(substream); in snd_sb8_playback_prepare()
145 spin_lock_irqsave(&chip->reg_lock, flags); in snd_sb8_playback_prepare()
146 snd_sbdsp_command(chip, SB_DSP_SPEAKER_ON); in snd_sb8_playback_prepare()
147 if (chip->hardware == SB_HW_JAZZ16) in snd_sb8_playback_prepare()
148 snd_sbdsp_command(chip, format); in snd_sb8_playback_prepare()
151 spin_lock(&chip->mixer_lock); in snd_sb8_playback_prepare()
152 mixreg = snd_sbmixer_read(chip, SB_DSP_STEREO_SW); in snd_sb8_playback_prepare()
153 snd_sbmixer_write(chip, SB_DSP_STEREO_SW, mixreg | 0x02); in snd_sb8_playback_prepare()
154 spin_unlock(&chip->mixer_lock); in snd_sb8_playback_prepare()
157 snd_sbdsp_command(chip, SB_DSP_DMA8_EXIT); in snd_sb8_playback_prepare()
161 snd_sbdsp_command(chip, SB_DSP_OUTPUT); in snd_sb8_playback_prepare()
162 snd_sbdsp_command(chip, 0); in snd_sb8_playback_prepare()
163 snd_sbdsp_command(chip, 0); in snd_sb8_playback_prepare()
165 snd_sbdsp_command(chip, SB_DSP_SAMPLE_RATE); in snd_sb8_playback_prepare()
167 snd_sbdsp_command(chip, 256 - runtime->rate_den / 2); in snd_sb8_playback_prepare()
168 spin_lock(&chip->mixer_lock); in snd_sb8_playback_prepare()
170 mixreg = snd_sbmixer_read(chip, SB_DSP_PLAYBACK_FILT); in snd_sb8_playback_prepare()
171 snd_sbmixer_write(chip, SB_DSP_PLAYBACK_FILT, mixreg | 0x20); in snd_sb8_playback_prepare()
172 spin_unlock(&chip->mixer_lock); in snd_sb8_playback_prepare()
174 chip->force_mode16 = mixreg; in snd_sb8_playback_prepare()
176 snd_sbdsp_command(chip, 256 - runtime->rate_den); in snd_sb8_playback_prepare()
178 if (chip->playback_format != SB_DSP_OUTPUT) { in snd_sb8_playback_prepare()
179 if (chip->mode & SB_MODE_PLAYBACK_16) in snd_sb8_playback_prepare()
182 snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE); in snd_sb8_playback_prepare()
183 snd_sbdsp_command(chip, count & 0xff); in snd_sb8_playback_prepare()
184 snd_sbdsp_command(chip, count >> 8); in snd_sb8_playback_prepare()
186 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_sb8_playback_prepare()
196 struct snd_sb *chip = snd_pcm_substream_chip(substream); in snd_sb8_playback_trigger() local
199 spin_lock_irqsave(&chip->reg_lock, flags); in snd_sb8_playback_trigger()
202 snd_sbdsp_command(chip, chip->playback_format); in snd_sb8_playback_trigger()
203 if (chip->playback_format == SB_DSP_OUTPUT) { in snd_sb8_playback_trigger()
204 count = chip->p_period_size - 1; in snd_sb8_playback_trigger()
205 snd_sbdsp_command(chip, count & 0xff); in snd_sb8_playback_trigger()
206 snd_sbdsp_command(chip, count >> 8); in snd_sb8_playback_trigger()
210 if (chip->playback_format == SB_DSP_HI_OUTPUT_AUTO) { in snd_sb8_playback_trigger()
212 snd_sbdsp_reset(chip); in snd_sb8_playback_trigger()
214 spin_lock(&chip->mixer_lock); in snd_sb8_playback_trigger()
216 snd_sbmixer_write(chip, SB_DSP_STEREO_SW, chip->force_mode16 & ~0x02); in snd_sb8_playback_trigger()
217 spin_unlock(&chip->mixer_lock); in snd_sb8_playback_trigger()
220 snd_sbdsp_command(chip, SB_DSP_DMA8_OFF); in snd_sb8_playback_trigger()
222 snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF); in snd_sb8_playback_trigger()
224 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_sb8_playback_trigger()
231 struct snd_sb *chip = snd_pcm_substream_chip(substream); in snd_sb8_capture_prepare() local
239 switch (chip->hardware) { in snd_sb8_capture_prepare()
242 if (chip->mode & SB_MODE_PLAYBACK_16) in snd_sb8_capture_prepare()
245 chip->mode |= SB_MODE_CAPTURE_16; in snd_sb8_capture_prepare()
247 chip->capture_format = SB_DSP_LO_INPUT_AUTO; in snd_sb8_capture_prepare()
254 chip->capture_format = SB_DSP_HI_INPUT_AUTO; in snd_sb8_capture_prepare()
257 chip->capture_format = (rate > 23000) ? SB_DSP_HI_INPUT_AUTO : SB_DSP_LO_INPUT_AUTO; in snd_sb8_capture_prepare()
261 chip->capture_format = SB_DSP_HI_INPUT_AUTO; in snd_sb8_capture_prepare()
266 chip->capture_format = SB_DSP_LO_INPUT_AUTO; in snd_sb8_capture_prepare()
269 chip->capture_format = SB_DSP_INPUT; in snd_sb8_capture_prepare()
274 if (chip->mode & SB_MODE_CAPTURE_16) { in snd_sb8_capture_prepare()
276 dma = chip->dma16; in snd_sb8_capture_prepare()
279 chip->mode |= SB_MODE_CAPTURE_8; in snd_sb8_capture_prepare()
280 dma = chip->dma8; in snd_sb8_capture_prepare()
282 size = chip->c_dma_size = snd_pcm_lib_buffer_bytes(substream); in snd_sb8_capture_prepare()
283 count = chip->c_period_size = snd_pcm_lib_period_bytes(substream); in snd_sb8_capture_prepare()
284 spin_lock_irqsave(&chip->reg_lock, flags); in snd_sb8_capture_prepare()
285 snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF); in snd_sb8_capture_prepare()
286 if (chip->hardware == SB_HW_JAZZ16) in snd_sb8_capture_prepare()
287 snd_sbdsp_command(chip, format); in snd_sb8_capture_prepare()
289 snd_sbdsp_command(chip, SB_DSP_STEREO_8BIT); in snd_sb8_capture_prepare()
290 snd_sbdsp_command(chip, SB_DSP_SAMPLE_RATE); in snd_sb8_capture_prepare()
292 snd_sbdsp_command(chip, 256 - runtime->rate_den / 2); in snd_sb8_capture_prepare()
293 spin_lock(&chip->mixer_lock); in snd_sb8_capture_prepare()
295 mixreg = snd_sbmixer_read(chip, SB_DSP_CAPTURE_FILT); in snd_sb8_capture_prepare()
296 snd_sbmixer_write(chip, SB_DSP_CAPTURE_FILT, mixreg | 0x20); in snd_sb8_capture_prepare()
297 spin_unlock(&chip->mixer_lock); in snd_sb8_capture_prepare()
299 chip->force_mode16 = mixreg; in snd_sb8_capture_prepare()
301 snd_sbdsp_command(chip, 256 - runtime->rate_den); in snd_sb8_capture_prepare()
303 if (chip->capture_format != SB_DSP_INPUT) { in snd_sb8_capture_prepare()
304 if (chip->mode & SB_MODE_PLAYBACK_16) in snd_sb8_capture_prepare()
307 snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE); in snd_sb8_capture_prepare()
308 snd_sbdsp_command(chip, count & 0xff); in snd_sb8_capture_prepare()
309 snd_sbdsp_command(chip, count >> 8); in snd_sb8_capture_prepare()
311 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_sb8_capture_prepare()
321 struct snd_sb *chip = snd_pcm_substream_chip(substream); in snd_sb8_capture_trigger() local
324 spin_lock_irqsave(&chip->reg_lock, flags); in snd_sb8_capture_trigger()
327 snd_sbdsp_command(chip, chip->capture_format); in snd_sb8_capture_trigger()
328 if (chip->capture_format == SB_DSP_INPUT) { in snd_sb8_capture_trigger()
329 count = chip->c_period_size - 1; in snd_sb8_capture_trigger()
330 snd_sbdsp_command(chip, count & 0xff); in snd_sb8_capture_trigger()
331 snd_sbdsp_command(chip, count >> 8); in snd_sb8_capture_trigger()
335 if (chip->capture_format == SB_DSP_HI_INPUT_AUTO) { in snd_sb8_capture_trigger()
337 snd_sbdsp_reset(chip); in snd_sb8_capture_trigger()
340 spin_lock(&chip->mixer_lock); in snd_sb8_capture_trigger()
341 snd_sbmixer_write(chip, SB_DSP_CAPTURE_FILT, chip->force_mode16); in snd_sb8_capture_trigger()
342 spin_unlock(&chip->mixer_lock); in snd_sb8_capture_trigger()
344 snd_sbdsp_command(chip, SB_DSP_MONO_8BIT); in snd_sb8_capture_trigger()
347 snd_sbdsp_command(chip, SB_DSP_DMA8_OFF); in snd_sb8_capture_trigger()
349 snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF); in snd_sb8_capture_trigger()
351 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_sb8_capture_trigger()
355 irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip) in snd_sb8dsp_interrupt() argument
359 snd_sb_ack_8bit(chip); in snd_sb8dsp_interrupt()
360 switch (chip->mode) { in snd_sb8dsp_interrupt()
362 if (chip->hardware != SB_HW_JAZZ16) in snd_sb8dsp_interrupt()
366 substream = chip->playback_substream; in snd_sb8dsp_interrupt()
367 if (chip->playback_format == SB_DSP_OUTPUT) in snd_sb8dsp_interrupt()
372 if (chip->hardware != SB_HW_JAZZ16) in snd_sb8dsp_interrupt()
376 substream = chip->capture_substream; in snd_sb8dsp_interrupt()
377 if (chip->capture_format == SB_DSP_INPUT) in snd_sb8dsp_interrupt()
387 struct snd_sb *chip = snd_pcm_substream_chip(substream); in snd_sb8_playback_pointer() local
391 if (chip->mode & SB_MODE_PLAYBACK_8) in snd_sb8_playback_pointer()
392 dma = chip->dma8; in snd_sb8_playback_pointer()
393 else if (chip->mode & SB_MODE_PLAYBACK_16) in snd_sb8_playback_pointer()
394 dma = chip->dma16; in snd_sb8_playback_pointer()
397 ptr = snd_dma_pointer(dma, chip->p_dma_size); in snd_sb8_playback_pointer()
403 struct snd_sb *chip = snd_pcm_substream_chip(substream); in snd_sb8_capture_pointer() local
407 if (chip->mode & SB_MODE_CAPTURE_8) in snd_sb8_capture_pointer()
408 dma = chip->dma8; in snd_sb8_capture_pointer()
409 else if (chip->mode & SB_MODE_CAPTURE_16) in snd_sb8_capture_pointer()
410 dma = chip->dma16; in snd_sb8_capture_pointer()
413 ptr = snd_dma_pointer(dma, chip->c_dma_size); in snd_sb8_capture_pointer()
465 struct snd_sb *chip = snd_pcm_substream_chip(substream); in snd_sb8_open() local
469 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8_open()
470 if (chip->open) { in snd_sb8_open()
471 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8_open()
474 chip->open |= SB_OPEN_PCM; in snd_sb8_open()
475 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8_open()
477 chip->playback_substream = substream; in snd_sb8_open()
480 chip->capture_substream = substream; in snd_sb8_open()
483 switch (chip->hardware) { in snd_sb8_open()
485 if (chip->dma16 == 5 || chip->dma16 == 7) in snd_sb8_open()
514 if (chip->dma8 > 3 || chip->dma16 >= 0) { in snd_sb8_open()
528 struct snd_sb *chip = snd_pcm_substream_chip(substream); in snd_sb8_close() local
530 chip->playback_substream = NULL; in snd_sb8_close()
531 chip->capture_substream = NULL; in snd_sb8_close()
532 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8_close()
533 chip->open &= ~SB_OPEN_PCM; in snd_sb8_close()
535 chip->mode &= ~SB_MODE_PLAYBACK; in snd_sb8_close()
537 chip->mode &= ~SB_MODE_CAPTURE; in snd_sb8_close()
538 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8_close()
562 int snd_sb8dsp_pcm(struct snd_sb *chip, int device) in snd_sb8dsp_pcm() argument
564 struct snd_card *card = chip->card; in snd_sb8dsp_pcm()
571 sprintf(pcm->name, "DSP v%i.%i", chip->version >> 8, chip->version & 0xff); in snd_sb8dsp_pcm()
573 pcm->private_data = chip; in snd_sb8dsp_pcm()
578 if (chip->dma8 > 3 || chip->dma16 >= 0) in snd_sb8dsp_pcm()