Lines Matching +full:codec +full:- +full:reset

1 // SPDX-License-Identifier: GPL-2.0-or-later
41 return chip->port + vxp_reg_offset[reg]; in vxp_reg_addr()
45 * snd_vx_inb - read a byte from the register
54 * snd_vx_outb - write a byte on the register
73 * vx_check_magic - check the magic word on xilinx
87 dev_err(chip->card->dev, "cannot find xilinx magic word (%x)\n", c); in vx_check_magic()
88 return -EIO; in vx_check_magic()
93 * vx_reset_dsp - reset the DSP
102 /* set the reset dsp bit to 1 */ in vxp_reset_dsp()
103 vx_outb(chip, CDSP, chip->regCDSP | VXP_CDSP_DSP_RESET_MASK); in vxp_reset_dsp()
106 /* reset the bit */ in vxp_reset_dsp()
107 chip->regCDSP &= ~VXP_CDSP_DSP_RESET_MASK; in vxp_reset_dsp()
108 vx_outb(chip, CDSP, chip->regCDSP); in vxp_reset_dsp()
114 * reset codec bit
120 /* Set the reset CODEC bit to 1. */ in vxp_reset_codec()
121 vx_outb(chip, CDSP, chip->regCDSP | VXP_CDSP_CODEC_RESET_MASK); in vxp_reset_codec()
124 /* Set the reset CODEC bit to 0. */ in vxp_reset_codec()
125 chip->regCDSP &= ~VXP_CDSP_CODEC_RESET_MASK; in vxp_reset_codec()
126 vx_outb(chip, CDSP, chip->regCDSP); in vxp_reset_codec()
132 * vx_load_xilinx_binary - load the xilinx binary image
145 chip->regDIALOG |= VXP_DLG_XILINX_REPROG_MASK; in vxp_load_xilinx_binary()
146 vx_outb(chip, DIALOG, chip->regDIALOG); in vxp_load_xilinx_binary()
152 /* reset HF0 and HF1 */ in vxp_load_xilinx_binary()
161 image = fw->data; in vxp_load_xilinx_binary()
162 for (i = 0; i < fw->size; i++, image++) { in vxp_load_xilinx_binary()
172 dev_err(_chip->card->dev, in vxp_load_xilinx_binary()
177 /* reset HF1 */ in vxp_load_xilinx_binary()
192 dev_dbg(_chip->card->dev, in vxp_load_xilinx_binary()
193 "xilinx: dsp size received 0x%x, orig 0x%zx\n", c, fw->size); in vxp_load_xilinx_binary()
208 /* Reset the Xilinx's signal enabling IO access */ in vxp_load_xilinx_binary()
209 chip->regDIALOG |= VXP_DLG_XILINX_REPROG_MASK; in vxp_load_xilinx_binary()
210 vx_outb(chip, DIALOG, chip->regDIALOG); in vxp_load_xilinx_binary()
213 chip->regDIALOG &= ~VXP_DLG_XILINX_REPROG_MASK; in vxp_load_xilinx_binary()
214 vx_outb(chip, DIALOG, chip->regDIALOG); in vxp_load_xilinx_binary()
217 /* Reset of the Codec */ in vxp_load_xilinx_binary()
226 chip->regDIALOG &= ~VXP_DLG_XILINX_REPROG_MASK; in vxp_load_xilinx_binary()
227 vx_outb(chip, DIALOG, chip->regDIALOG); in vxp_load_xilinx_binary()
228 return -EIO; in vxp_load_xilinx_binary()
233 * vxp_load_dsp - load_dsp callback
260 return -EINVAL; in vxp_load_dsp()
266 * vx_test_and_ack - test and acknowledge interrupt
277 if (! (_chip->chip_status & VX_STAT_XILINX_LOADED)) in vxp_test_and_ack()
278 return -ENXIO; in vxp_test_and_ack()
281 return -EIO; in vxp_test_and_ack()
285 vx_outb(chip, DIALOG, chip->regDIALOG | VXP_DLG_ACK_MEMIRQ_MASK); in vxp_test_and_ack()
290 vx_outb(chip, DIALOG, chip->regDIALOG & ~VXP_DLG_ACK_MEMIRQ_MASK); in vxp_test_and_ack()
297 * vx_validate_irq - enable/disable IRQ
305 chip->regCDSP |= VXP_CDSP_VALID_IRQ_MASK; in vxp_validate_irq()
307 chip->regCDSP &= ~VXP_CDSP_VALID_IRQ_MASK; in vxp_validate_irq()
308 vx_outb(chip, CDSP, chip->regCDSP); in vxp_validate_irq()
312 * vx_setup_pseudo_dma - set up the pseudo dma read/write mode.
321 /* Reset the pseudo-dma register */ in vx_setup_pseudo_dma()
325 /* Select DMA in read/write transfer mode and in 16-bit accesses */ in vx_setup_pseudo_dma()
326 chip->regDIALOG |= VXP_DLG_DMA16_SEL_MASK; in vx_setup_pseudo_dma()
327 chip->regDIALOG |= do_write ? VXP_DLG_DMAWRITE_SEL_MASK : VXP_DLG_DMAREAD_SEL_MASK; in vx_setup_pseudo_dma()
328 vx_outb(chip, DIALOG, chip->regDIALOG); in vx_setup_pseudo_dma()
333 * vx_release_pseudo_dma - disable the pseudo-DMA mode
339 /* Disable DMA and 16-bit accesses */ in vx_release_pseudo_dma()
340 chip->regDIALOG &= ~(VXP_DLG_DMAWRITE_SEL_MASK| in vx_release_pseudo_dma()
343 vx_outb(chip, DIALOG, chip->regDIALOG); in vx_release_pseudo_dma()
349 * vx_pseudo_dma_write - write bulk data on pseudo-DMA mode
359 int offset = pipe->hw_ptr; in vxp_dma_write()
360 unsigned short *addr = (unsigned short *)(runtime->dma_area + offset); in vxp_dma_write()
363 if (offset + count >= pipe->buffer_bytes) { in vxp_dma_write()
364 int length = pipe->buffer_bytes - offset; in vxp_dma_write()
365 count -= length; in vxp_dma_write()
367 /* Transfer using pseudo-dma. */ in vxp_dma_write()
368 for (; length > 0; length--) { in vxp_dma_write()
372 addr = (unsigned short *)runtime->dma_area; in vxp_dma_write()
373 pipe->hw_ptr = 0; in vxp_dma_write()
375 pipe->hw_ptr += count; in vxp_dma_write()
377 /* Transfer using pseudo-dma. */ in vxp_dma_write()
378 for (; count > 0; count--) { in vxp_dma_write()
387 * vx_pseudo_dma_read - read bulk data on pseudo DMA mode
399 int offset = pipe->hw_ptr; in vxp_dma_read()
400 unsigned short *addr = (unsigned short *)(runtime->dma_area + offset); in vxp_dma_read()
405 if (offset + count >= pipe->buffer_bytes) { in vxp_dma_read()
406 int length = pipe->buffer_bytes - offset; in vxp_dma_read()
407 count -= length; in vxp_dma_read()
409 /* Transfer using pseudo-dma. */ in vxp_dma_read()
410 for (; length > 0; length--) in vxp_dma_read()
412 addr = (unsigned short *)runtime->dma_area; in vxp_dma_read()
413 pipe->hw_ptr = 0; in vxp_dma_read()
415 pipe->hw_ptr += count; in vxp_dma_read()
417 /* Transfer using pseudo-dma. */ in vxp_dma_read()
418 for (; count > 1; count--) in vxp_dma_read()
421 pchip->regDIALOG &= ~VXP_DLG_DMAREAD_SEL_MASK; in vxp_dma_read()
422 vx_outb(chip, DIALOG, pchip->regDIALOG); in vxp_dma_read()
425 /* Disable 16-bit accesses */ in vxp_dma_read()
426 pchip->regDIALOG &= ~VXP_DLG_DMA16_SEL_MASK; in vxp_dma_read()
427 vx_outb(chip, DIALOG, pchip->regDIALOG); in vxp_dma_read()
434 * write a codec data (24bit)
436 static void vxp_write_codec_reg(struct vx_core *chip, int codec, unsigned int data) in vxp_write_codec_reg() argument
440 /* Activate access to the corresponding codec register */ in vxp_write_codec_reg()
441 if (! codec) in vxp_write_codec_reg()
450 /* Terminate access to codec registers */ in vxp_write_codec_reg()
456 * vx_set_mic_boost - set mic boost level (on vxp440 only)
463 if (chip->chip_status & VX_STAT_IS_STALE) in vx_set_mic_boost()
466 mutex_lock(&chip->lock); in vx_set_mic_boost()
467 if (pchip->regCDSP & P24_CDSP_MICS_SEL_MASK) { in vx_set_mic_boost()
470 pchip->regCDSP &= ~P24_CDSP_MIC20_SEL_MASK; in vx_set_mic_boost()
471 pchip->regCDSP |= P24_CDSP_MIC38_SEL_MASK; in vx_set_mic_boost()
474 pchip->regCDSP |= P24_CDSP_MIC20_SEL_MASK; in vx_set_mic_boost()
475 pchip->regCDSP &= ~P24_CDSP_MIC38_SEL_MASK; in vx_set_mic_boost()
477 vx_outb(chip, CDSP, pchip->regCDSP); in vx_set_mic_boost()
479 mutex_unlock(&chip->lock); in vx_set_mic_boost()
483 * remap the linear value (0-8) to the actual value (0-15)
498 * vx_set_mic_level - set mic level (on vxpocket only)
499 * @level: the mic level = 0 - 8 (max)
505 if (chip->chip_status & VX_STAT_IS_STALE) in vx_set_mic_level()
508 mutex_lock(&chip->lock); in vx_set_mic_level()
509 if (pchip->regCDSP & VXP_CDSP_MIC_SEL_MASK) { in vx_set_mic_level()
513 mutex_unlock(&chip->lock); in vx_set_mic_level()
526 chip->regCDSP |= VXP_CDSP_DATAIN_SEL_MASK; in vxp_change_audio_source()
527 vx_outb(chip, CDSP, chip->regCDSP); in vxp_change_audio_source()
530 chip->regCDSP &= ~VXP_CDSP_DATAIN_SEL_MASK; in vxp_change_audio_source()
531 if (_chip->type == VX_TYPE_VXP440) in vxp_change_audio_source()
532 chip->regCDSP &= ~P24_CDSP_MICS_SEL_MASK; in vxp_change_audio_source()
534 chip->regCDSP &= ~VXP_CDSP_MIC_SEL_MASK; in vxp_change_audio_source()
535 vx_outb(chip, CDSP, chip->regCDSP); in vxp_change_audio_source()
538 chip->regCDSP &= ~VXP_CDSP_DATAIN_SEL_MASK; in vxp_change_audio_source()
539 /* reset mic levels */ in vxp_change_audio_source()
540 if (_chip->type == VX_TYPE_VXP440) { in vxp_change_audio_source()
541 chip->regCDSP &= ~P24_CDSP_MICS_SEL_MASK; in vxp_change_audio_source()
542 if (chip->mic_level) in vxp_change_audio_source()
543 chip->regCDSP |= P24_CDSP_MIC38_SEL_MASK; in vxp_change_audio_source()
545 chip->regCDSP |= P24_CDSP_MIC20_SEL_MASK; in vxp_change_audio_source()
546 vx_outb(chip, CDSP, chip->regCDSP); in vxp_change_audio_source()
548 chip->regCDSP |= VXP_CDSP_MIC_SEL_MASK; in vxp_change_audio_source()
549 vx_outb(chip, CDSP, chip->regCDSP); in vxp_change_audio_source()
550 vx_outb(chip, MICRO, vx_compute_mic_level(chip->mic_level)); in vxp_change_audio_source()
565 chip->regCDSP &= ~VXP_CDSP_CLOCKIN_SEL_MASK; in vxp_set_clock_source()
567 chip->regCDSP |= VXP_CDSP_CLOCKIN_SEL_MASK; in vxp_set_clock_source()
568 vx_outb(chip, CDSP, chip->regCDSP); in vxp_set_clock_source()
573 * reset the board
579 chip->regCDSP = 0; in vxp_reset_board()
580 chip->regDIALOG = 0; in vxp_reset_board()