linux/sound/pci/pcxhr/pcxhr_mix22.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Driver for Digigram pcxhr compatible soundcards
 *
 * mixer interface for stereo cards
 *
 * Copyright (c) 2004 by Digigram <[email protected]>
 */

#include <linux/delay.h>
#include <linux/io.h>
#include <linux/pci.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/tlv.h>
#include <sound/asoundef.h>
#include "pcxhr.h"
#include "pcxhr_core.h"
#include "pcxhr_mix22.h"


/* registers used on the DSP and Xilinx (port 2) : HR stereo cards only */
#define PCXHR_DSP_RESET
#define PCXHR_XLX_CFG
#define PCXHR_XLX_RUER
#define PCXHR_XLX_DATA
#define PCXHR_XLX_STATUS
#define PCXHR_XLX_LOFREQ
#define PCXHR_XLX_HIFREQ
#define PCXHR_XLX_CSUER
#define PCXHR_XLX_SELMIC

#define PCXHR_DSP

/* byte access only ! */
#define PCXHR_INPB(mgr, x)
#define PCXHR_OUTPB(mgr, x, data)


/* values for PCHR_DSP_RESET register */
#define PCXHR_DSP_RESET_DSP
#define PCXHR_DSP_RESET_MUTE
#define PCXHR_DSP_RESET_CODEC
#define PCXHR_DSP_RESET_SMPTE
#define PCXHR_DSP_RESET_GPO_OFFSET
#define PCXHR_DSP_RESET_GPO_MASK

/* values for PCHR_XLX_CFG register */
#define PCXHR_CFG_SYNCDSP_MASK
#define PCXHR_CFG_DEPENDENCY_MASK
#define PCXHR_CFG_INDEPENDANT_SEL
#define PCXHR_CFG_MASTER_SEL
#define PCXHR_CFG_SLAVE_SEL
#define PCXHR_CFG_DATA_UER1_SEL_MASK
#define PCXHR_CFG_DATAIN_SEL_MASK
#define PCXHR_CFG_SRC_MASK
#define PCXHR_CFG_CLOCK_UER1_SEL_MASK
#define PCXHR_CFG_CLOCKIN_SEL_MASK

/* values for PCHR_XLX_DATA register */
#define PCXHR_DATA_CODEC
#define AKM_POWER_CONTROL_CMD
#define AKM_RESET_ON_CMD
#define AKM_RESET_OFF_CMD
#define AKM_CLOCK_INF_55K_CMD
#define AKM_CLOCK_SUP_55K_CMD
#define AKM_MUTE_CMD
#define AKM_UNMUTE_CMD
#define AKM_LEFT_LEVEL_CMD
#define AKM_RIGHT_LEVEL_CMD

/* values for PCHR_XLX_STATUS register - READ */
#define PCXHR_STAT_SRC_LOCK
#define PCXHR_STAT_LEVEL_IN
#define PCXHR_STAT_GPI_OFFSET
#define PCXHR_STAT_GPI_MASK
#define PCXHR_STAT_MIC_CAPS
/* values for PCHR_XLX_STATUS register - WRITE */
#define PCXHR_STAT_FREQ_SYNC_MASK
#define PCXHR_STAT_FREQ_UER1_MASK
#define PCXHR_STAT_FREQ_SAVE_MASK

/* values for PCHR_XLX_CSUER register */
#define PCXHR_SUER1_BIT_U_READ_MASK
#define PCXHR_SUER1_BIT_C_READ_MASK
#define PCXHR_SUER1_DATA_PRESENT_MASK
#define PCXHR_SUER1_CLOCK_PRESENT_MASK
#define PCXHR_SUER_BIT_U_READ_MASK
#define PCXHR_SUER_BIT_C_READ_MASK
#define PCXHR_SUER_DATA_PRESENT_MASK
#define PCXHR_SUER_CLOCK_PRESENT_MASK

#define PCXHR_SUER_BIT_U_WRITE_MASK
#define PCXHR_SUER_BIT_C_WRITE_MASK

/* values for PCXHR_XLX_SELMIC register - WRITE */
#define PCXHR_SELMIC_PREAMPLI_OFFSET
#define PCXHR_SELMIC_PREAMPLI_MASK
#define PCXHR_SELMIC_PHANTOM_ALIM


static const unsigned char g_hr222_p_level[] =;


static void hr222_config_akm(struct pcxhr_mgr *mgr, unsigned short data)
{}


static int hr222_set_hw_playback_level(struct pcxhr_mgr *mgr,
				       int idx, int level)
{}


static int hr222_set_hw_capture_level(struct pcxhr_mgr *mgr,
				      int level_l, int level_r, int level_mic)
{}

static void hr222_micro_boost(struct pcxhr_mgr *mgr, int level);

int hr222_sub_init(struct pcxhr_mgr *mgr)
{}


/* calc PLL register */
/* TODO : there is a very similar fct in pcxhr.c */
static int hr222_pll_freq_register(unsigned int freq,
				   unsigned int *pllreg,
				   unsigned int *realfreq)
{}

int hr222_sub_set_clock(struct pcxhr_mgr *mgr,
			unsigned int rate,
			int *changed)
{}

int hr222_get_external_clock(struct pcxhr_mgr *mgr,
			     enum pcxhr_clock_type clock_type,
			     int *sample_rate)
{}


int hr222_read_gpio(struct pcxhr_mgr *mgr, int is_gpi, int *value)
{}


int hr222_write_gpo(struct pcxhr_mgr *mgr, int value)
{}

int hr222_manage_timecode(struct pcxhr_mgr *mgr, int enable)
{}

int hr222_update_analog_audio_level(struct snd_pcxhr *chip,
				    int is_capture, int channel)
{}


/*texts[5] = {"Line", "Digital", "Digi+SRC", "Mic", "Line+Mic"}*/
#define SOURCE_LINE
#define SOURCE_DIGITAL
#define SOURCE_DIGISRC
#define SOURCE_MIC
#define SOURCE_LINEMIC

int hr222_set_audio_source(struct snd_pcxhr *chip)
{}


int hr222_iec958_capture_byte(struct snd_pcxhr *chip,
			     int aes_idx, unsigned char *aes_bits)
{}


int hr222_iec958_update_byte(struct snd_pcxhr *chip,
			     int aes_idx, unsigned char aes_bits)
{}

static void hr222_micro_boost(struct pcxhr_mgr *mgr, int level)
{}

static void hr222_phantom_power(struct pcxhr_mgr *mgr, int power)
{}


/* mic level */
static const DECLARE_TLV_DB_SCALE(db_scale_mic_hr222, -9850, 50, 650);

static int hr222_mic_vol_info(struct snd_kcontrol *kcontrol,
			      struct snd_ctl_elem_info *uinfo)
{}

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

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

static const struct snd_kcontrol_new hr222_control_mic_level =;


/* mic boost level */
static const DECLARE_TLV_DB_SCALE(db_scale_micboost_hr222, 0, 1800, 5400);

static int hr222_mic_boost_info(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_info *uinfo)
{}

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

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

static const struct snd_kcontrol_new hr222_control_mic_boost =;


/******************* Phantom power switch *******************/
#define hr222_phantom_power_info

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

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

static const struct snd_kcontrol_new hr222_phantom_power_switch =;


int hr222_add_mic_controls(struct snd_pcxhr *chip)
{}