linux/sound/pci/vx222/vx222_ops.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Driver for Digigram VX222 V2/Mic soundcards
 *
 * VX222-specific low-level routines
 *
 * Copyright (c) 2002 by Takashi Iwai <[email protected]>
 */

#include <linux/delay.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/mutex.h>
#include <linux/io.h>

#include <sound/core.h>
#include <sound/control.h>
#include <sound/tlv.h>
#include "vx222.h"


static const int vx2_reg_offset[VX_REG_MAX] =;

static const int vx2_reg_index[VX_REG_MAX] =;

static inline unsigned long vx2_reg_addr(struct vx_core *_chip, int reg)
{}

/**
 * vx2_inb - read a byte from the register
 * @chip: VX core instance
 * @offset: register enum
 */
static unsigned char vx2_inb(struct vx_core *chip, int offset)
{}

/**
 * vx2_outb - write a byte on the register
 * @chip: VX core instance
 * @offset: the register offset
 * @val: the value to write
 */
static void vx2_outb(struct vx_core *chip, int offset, unsigned char val)
{}

/**
 * vx2_inl - read a 32bit word from the register
 * @chip: VX core instance
 * @offset: register enum
 */
static unsigned int vx2_inl(struct vx_core *chip, int offset)
{}

/**
 * vx2_outl - write a 32bit word on the register
 * @chip: VX core instance
 * @offset: the register enum
 * @val: the value to write
 */
static void vx2_outl(struct vx_core *chip, int offset, unsigned int val)
{}

/*
 * redefine macros to call directly
 */
#undef vx_inb
#define vx_inb(chip,reg)
#undef vx_outb
#define vx_outb(chip,reg,val)
#undef vx_inl
#define vx_inl(chip,reg)
#undef vx_outl
#define vx_outl(chip,reg,val)


/*
 * vx_reset_dsp - reset the DSP
 */

#define XX_DSP_RESET_WAIT_TIME

static void vx2_reset_dsp(struct vx_core *_chip)
{}


static int vx2_test_xilinx(struct vx_core *_chip)
{}


/**
 * vx2_setup_pseudo_dma - set up the pseudo dma read/write mode.
 * @chip: VX core instance
 * @do_write: 0 = read, 1 = set up for DMA write
 */
static void vx2_setup_pseudo_dma(struct vx_core *chip, int do_write)
{}

/*
 * vx_release_pseudo_dma - disable the pseudo-DMA mode
 */
static inline void vx2_release_pseudo_dma(struct vx_core *chip)
{}



/* pseudo-dma write */
static void vx2_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
			  struct vx_pipe *pipe, int count)
{}


/* pseudo dma read */
static void vx2_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
			 struct vx_pipe *pipe, int count)
{}

#define VX_XILINX_RESET_MASK
#define VX_USERBIT0_MASK
#define VX_USERBIT1_MASK
#define VX_CNTRL_REGISTER_VALUE

/*
 * transfer counts bits to PLX
 */
static int put_xilinx_data(struct vx_core *chip, unsigned int port, unsigned int counts, unsigned char data)
{}

/*
 * load the xilinx image
 */
static int vx2_load_xilinx_binary(struct vx_core *chip, const struct firmware *xilinx)
{}

	
/*
 * load the boot/dsp images
 */
static int vx2_load_dsp(struct vx_core *vx, int index, const struct firmware *dsp)
{}


/*
 * vx_test_and_ack - test and acknowledge interrupt
 *
 * called from irq hander, too
 *
 * spinlock held!
 */
static int vx2_test_and_ack(struct vx_core *chip)
{}


/*
 * vx_validate_irq - enable/disable IRQ
 */
static void vx2_validate_irq(struct vx_core *_chip, int enable)
{}


/*
 * write an AKM codec data (24bit)
 */
static void vx2_write_codec_reg(struct vx_core *chip, unsigned int data)
{}


#define AKM_CODEC_POWER_CONTROL_CMD
#define AKM_CODEC_RESET_ON_CMD
#define AKM_CODEC_RESET_OFF_CMD
#define AKM_CODEC_CLOCK_FORMAT_CMD
#define AKM_CODEC_MUTE_CMD
#define AKM_CODEC_UNMUTE_CMD
#define AKM_CODEC_LEFT_LEVEL_CMD
#define AKM_CODEC_RIGHT_LEVEL_CMD

static const u8 vx2_akm_gains_lut[VX2_AKM_LEVEL_MAX+1] =;      // [147] = -73.500 dB  ->  AKM(0x00) =  mute       error(+infini)

/*
 * pseudo-codec write entry
 */
static void vx2_write_akm(struct vx_core *chip, int reg, unsigned int data)
{}


/*
 * write codec bit for old VX222 board
 */
static void vx2_old_write_codec_bit(struct vx_core *chip, int codec, unsigned int data)
{}


/*
 * reset codec bit
 */
static void vx2_reset_codec(struct vx_core *_chip)
{}


/*
 * change the audio source
 */
static void vx2_change_audio_source(struct vx_core *_chip, int src)
{}


/*
 * set the clock source
 */
static void vx2_set_clock_source(struct vx_core *_chip, int source)
{}

/*
 * reset the board
 */
static void vx2_reset_board(struct vx_core *_chip, int cold_reset)
{}



/*
 * input level controls for VX222 Mic
 */

/* Micro level is specified to be adjustable from -96dB to 63 dB (board coded 0x00 ... 318),
 * 318 = 210 + 36 + 36 + 36   (210 = +9dB variable) (3 * 36 = 3 steps of 18dB pre ampli)
 * as we will mute if less than -110dB, so let's simply use line input coded levels and add constant offset !
 */
#define V2_MICRO_LEVEL_RANGE

static void vx2_set_input_level(struct snd_vx222 *chip)
{}


#define MIC_LEVEL_MAX

static const DECLARE_TLV_DB_SCALE(db_scale_mic, -6450, 50, 0);

/*
 * controls API for input levels
 */

/* input levels */
static int vx_input_level_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}

static int vx_input_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int vx_input_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

/* mic level */
static int vx_mic_level_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}

static int vx_mic_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static const struct snd_kcontrol_new vx_control_input_level =;

static const struct snd_kcontrol_new vx_control_mic_level =;

/*
 * FIXME: compressor/limiter implementation is missing yet...
 */

static int vx2_add_mic_controls(struct vx_core *_chip)
{}


/*
 * callbacks
 */
const struct snd_vx_ops vx222_ops =;

/* for old VX222 board */
const struct snd_vx_ops vx222_old_ops =;