// SPDX-License-Identifier: GPL-2.0-or-later /* * Driver for Digigram VXpocket soundcards * * lowlevel routines for VXpocket soundcards * * Copyright (c) 2002 by Takashi Iwai <[email protected]> */ #include <linux/delay.h> #include <linux/device.h> #include <linux/firmware.h> #include <linux/io.h> #include <sound/core.h> #include "vxpocket.h" static const int vxp_reg_offset[VX_REG_MAX] = …; static inline unsigned long vxp_reg_addr(struct vx_core *_chip, int reg) { … } /* * snd_vx_inb - read a byte from the register * @offset: register offset */ static unsigned char vxp_inb(struct vx_core *chip, int offset) { … } /* * snd_vx_outb - write a byte on the register * @offset: the register offset * @val: the value to write */ static void vxp_outb(struct vx_core *chip, int offset, unsigned char val) { … } /* * redefine macros to call directly */ #undef vx_inb #define vx_inb(chip,reg) … #undef vx_outb #define vx_outb(chip,reg,val) … /* * vx_check_magic - check the magic word on xilinx * * returns zero if a magic word is detected, or a negative error code. */ static int vx_check_magic(struct vx_core *chip) { … } /* * vx_reset_dsp - reset the DSP */ #define XX_DSP_RESET_WAIT_TIME … static void vxp_reset_dsp(struct vx_core *_chip) { … } /* * reset codec bit */ static void vxp_reset_codec(struct vx_core *_chip) { … } /* * vx_load_xilinx_binary - load the xilinx binary image * the binary image is the binary array converted from the bitstream file. */ static int vxp_load_xilinx_binary(struct vx_core *_chip, const struct firmware *fw) { … } /* * vxp_load_dsp - load_dsp callback */ static int vxp_load_dsp(struct vx_core *vx, int index, const struct firmware *fw) { … } /* * vx_test_and_ack - test and acknowledge interrupt * * called from irq hander, too * * spinlock held! */ static int vxp_test_and_ack(struct vx_core *_chip) { … } /* * vx_validate_irq - enable/disable IRQ */ static void vxp_validate_irq(struct vx_core *_chip, int enable) { … } /* * vx_setup_pseudo_dma - set up the pseudo dma read/write mode. * @do_write: 0 = read, 1 = set up for DMA write */ static void vx_setup_pseudo_dma(struct vx_core *_chip, int do_write) { … } /* * vx_release_pseudo_dma - disable the pseudo-DMA mode */ static void vx_release_pseudo_dma(struct vx_core *_chip) { … } /* * vx_pseudo_dma_write - write bulk data on pseudo-DMA mode * @count: data length to transfer in bytes * * data size must be aligned to 6 bytes to ensure the 24bit alignment on DSP. * NB: call with a certain lock! */ static void vxp_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime, struct vx_pipe *pipe, int count) { … } /* * vx_pseudo_dma_read - read bulk data on pseudo DMA mode * @offset: buffer offset in bytes * @count: data length to transfer in bytes * * the read length must be aligned to 6 bytes, as well as write. * NB: call with a certain lock! */ static void vxp_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime, struct vx_pipe *pipe, int count) { … } /* * write a codec data (24bit) */ static void vxp_write_codec_reg(struct vx_core *chip, int codec, unsigned int data) { … } /* * vx_set_mic_boost - set mic boost level (on vxp440 only) * @boost: 0 = 20dB, 1 = +38dB */ void vx_set_mic_boost(struct vx_core *chip, int boost) { … } /* * remap the linear value (0-8) to the actual value (0-15) */ static int vx_compute_mic_level(int level) { … } /* * vx_set_mic_level - set mic level (on vxpocket only) * @level: the mic level = 0 - 8 (max) */ void vx_set_mic_level(struct vx_core *chip, int level) { … } /* * change the input audio source */ static void vxp_change_audio_source(struct vx_core *_chip, int src) { … } /* * change the clock source * source = INTERNAL_QUARTZ or UER_SYNC */ static void vxp_set_clock_source(struct vx_core *_chip, int source) { … } /* * reset the board */ static void vxp_reset_board(struct vx_core *_chip, int cold_reset) { … } /* * callbacks */ /* exported */ const struct snd_vx_ops snd_vxpocket_ops = …;