linux/sound/pci/oxygen/xonar_pcm179x.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * card driver for models with PCM1796 DACs (Xonar D2/D2X/HDAV1.3/ST/STX)
 *
 * Copyright (c) Clemens Ladisch <[email protected]>
 */

/*
 * Xonar D2/D2X
 * ------------
 *
 * CMI8788:
 *
 *   SPI 0 -> 1st PCM1796 (front)
 *   SPI 1 -> 2nd PCM1796 (surround)
 *   SPI 2 -> 3rd PCM1796 (center/LFE)
 *   SPI 4 -> 4th PCM1796 (back)
 *
 *   GPIO 2 -> M0 of CS5381
 *   GPIO 3 -> M1 of CS5381
 *   GPIO 5 <- external power present (D2X only)
 *   GPIO 7 -> ALT
 *   GPIO 8 -> enable output to speakers
 *
 * CM9780:
 *
 *   LINE_OUT -> input of ADC
 *
 *   AUX_IN   <- aux
 *   VIDEO_IN <- CD
 *   FMIC_IN  <- mic
 *
 *   GPO 0 -> route line-in (0) or AC97 output (1) to CS5381 input
 */

/*
 * Xonar HDAV1.3 (Deluxe)
 * ----------------------
 *
 * CMI8788:
 *
 *   I²C <-> PCM1796 (addr 1001100) (front)
 *
 *   GPI 0 <- external power present
 *
 *   GPIO 0 -> enable HDMI (0) or speaker (1) output
 *   GPIO 2 -> M0 of CS5381
 *   GPIO 3 -> M1 of CS5381
 *   GPIO 4 <- daughterboard detection
 *   GPIO 5 <- daughterboard detection
 *   GPIO 6 -> ?
 *   GPIO 7 -> ?
 *   GPIO 8 -> route input jack to line-in (0) or mic-in (1)
 *
 *   UART <-> HDMI controller
 *
 * CM9780:
 *
 *   LINE_OUT -> input of ADC
 *
 *   AUX_IN <- aux
 *   CD_IN  <- CD
 *   MIC_IN <- mic
 *
 *   GPO 0 -> route line-in (0) or AC97 output (1) to CS5381 input
 *
 * no daughterboard
 * ----------------
 *
 *   GPIO 4 <- 1
 *
 * H6 daughterboard
 * ----------------
 *
 *   GPIO 4 <- 0
 *   GPIO 5 <- 0
 *
 *   I²C <-> PCM1796 (addr 1001101) (surround)
 *       <-> PCM1796 (addr 1001110) (center/LFE)
 *       <-> PCM1796 (addr 1001111) (back)
 *
 * unknown daughterboard
 * ---------------------
 *
 *   GPIO 4 <- 0
 *   GPIO 5 <- 1
 *
 *   I²C <-> CS4362A (addr 0011000) (surround, center/LFE, back)
 */

/*
 * Xonar Essence ST (Deluxe)/STX (II)
 * ----------------------------------
 *
 * CMI8788:
 *
 *   I²C <-> PCM1792A (addr 1001100)
 *       <-> CS2000 (addr 1001110) (ST only)
 *
 *   ADC1 MCLK -> REF_CLK of CS2000 (ST only)
 *
 *   GPI 0 <- external power present (STX only)
 *
 *   GPIO 0 -> enable output to speakers
 *   GPIO 1 -> route HP to front panel (0) or rear jack (1)
 *   GPIO 2 -> M0 of CS5381
 *   GPIO 3 -> M1 of CS5381
 *   GPIO 4 <- daughterboard detection
 *   GPIO 5 <- daughterboard detection
 *   GPIO 6 -> ?
 *   GPIO 7 -> route output to speaker jacks (0) or HP (1)
 *   GPIO 8 -> route input jack to line-in (0) or mic-in (1)
 *
 * PCM1792A:
 *
 *   SCK <- CLK_OUT of CS2000 (ST only)
 *
 * CM9780:
 *
 *   LINE_OUT -> input of ADC
 *
 *   AUX_IN <- aux
 *   MIC_IN <- mic
 *
 *   GPO 0 -> route line-in (0) or AC97 output (1) to CS5381 input
 *
 * H6 daughterboard
 * ----------------
 *
 * GPIO 4 <- 0
 * GPIO 5 <- 0
 */

/*
 * Xonar Xense
 * -----------
 *
 * CMI8788:
 *
 *   I²C <-> PCM1796 (addr 1001100) (front)
 *       <-> CS4362A (addr 0011000) (surround, center/LFE, back)
 *       <-> CS2000 (addr 1001110)
 *
 *   ADC1 MCLK -> REF_CLK of CS2000
 *
 *   GPI 0 <- external power present
 *
 *   GPIO 0 -> enable output
 *   GPIO 1 -> route HP to front panel (0) or rear jack (1)
 *   GPIO 2 -> M0 of CS5381
 *   GPIO 3 -> M1 of CS5381
 *   GPIO 4 -> enable output
 *   GPIO 5 -> enable output
 *   GPIO 6 -> ?
 *   GPIO 7 -> route output to HP (0) or speaker (1)
 *   GPIO 8 -> route input jack to mic-in (0) or line-in (1)
 *
 * CM9780:
 *
 *   LINE_OUT -> input of ADC
 *
 *   AUX_IN   <- aux
 *   VIDEO_IN <- ?
 *   FMIC_IN  <- mic
 *
 *   GPO 0 -> route line-in (0) or AC97 output (1) to CS5381 input
 *   GPO 1 -> route mic-in from input jack (0) or front panel header (1)
 */

#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <sound/ac97_codec.h>
#include <sound/control.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include "xonar.h"
#include "cm9780.h"
#include "pcm1796.h"
#include "cs2000.h"


#define GPIO_D2X_EXT_POWER
#define GPIO_D2_ALT
#define GPIO_D2_OUTPUT_ENABLE

#define GPI_EXT_POWER
#define GPIO_INPUT_ROUTE

#define GPIO_HDAV_OUTPUT_ENABLE
#define GPIO_HDAV_MAGIC

#define GPIO_DB_MASK
#define GPIO_DB_H6

#define GPIO_ST_OUTPUT_ENABLE
#define GPIO_ST_HP_REAR
#define GPIO_ST_MAGIC
#define GPIO_ST_HP

#define GPIO_XENSE_OUTPUT_ENABLE
#define GPIO_XENSE_SPEAKERS

#define I2C_DEVICE_PCM1796(i)
#define I2C_DEVICE_CS2000

#define PCM1796_REG_BASE


struct xonar_pcm179x {};

struct xonar_hdav {};


static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
				     u8 reg, u8 value)
{}

static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
				     u8 reg, u8 value)
{}

static void pcm1796_write(struct oxygen *chip, unsigned int codec,
			  u8 reg, u8 value)
{}

static void pcm1796_write_cached(struct oxygen *chip, unsigned int codec,
				 u8 reg, u8 value)
{}

static void cs2000_write(struct oxygen *chip, u8 reg, u8 value)
{}

static void cs2000_write_cached(struct oxygen *chip, u8 reg, u8 value)
{}

static void pcm1796_registers_init(struct oxygen *chip)
{}

static void pcm1796_init(struct oxygen *chip)
{}

static void xonar_d2_init(struct oxygen *chip)
{}

static void xonar_d2x_init(struct oxygen *chip)
{}

static void xonar_hdav_init(struct oxygen *chip)
{}

static void xonar_st_init_i2c(struct oxygen *chip)
{}

static void xonar_st_init_common(struct oxygen *chip)
{}

static void cs2000_registers_init(struct oxygen *chip)
{}

static void xonar_st_init(struct oxygen *chip)
{}

static void xonar_stx_init(struct oxygen *chip)
{}

static void xonar_xense_init(struct oxygen *chip)
{}

static void xonar_d2_cleanup(struct oxygen *chip)
{}

static void xonar_hdav_cleanup(struct oxygen *chip)
{}

static void xonar_st_cleanup(struct oxygen *chip)
{}

static void xonar_d2_suspend(struct oxygen *chip)
{}

static void xonar_hdav_suspend(struct oxygen *chip)
{}

static void xonar_st_suspend(struct oxygen *chip)
{}

static void xonar_d2_resume(struct oxygen *chip)
{}

static void xonar_hdav_resume(struct oxygen *chip)
{}

static void xonar_stx_resume(struct oxygen *chip)
{}

static void xonar_st_resume(struct oxygen *chip)
{}

static void update_pcm1796_oversampling(struct oxygen *chip)
{}

static void update_pcm1796_deemph(struct oxygen *chip)
{}

static void set_pcm1796_params(struct oxygen *chip,
			       struct snd_pcm_hw_params *params)
{}

static void update_pcm1796_volume(struct oxygen *chip)
{}

static void update_pcm1796_mute(struct oxygen *chip)
{}

static void update_cs2000_rate(struct oxygen *chip, unsigned int rate)
{}

static void set_st_params(struct oxygen *chip,
			  struct snd_pcm_hw_params *params)
{}

static void set_hdav_params(struct oxygen *chip,
			    struct snd_pcm_hw_params *params)
{}

static const struct snd_kcontrol_new alt_switch =;

static int rolloff_info(struct snd_kcontrol *ctl,
			struct snd_ctl_elem_info *info)
{}

static int rolloff_get(struct snd_kcontrol *ctl,
		       struct snd_ctl_elem_value *value)
{}

static int rolloff_put(struct snd_kcontrol *ctl,
		       struct snd_ctl_elem_value *value)
{}

static const struct snd_kcontrol_new rolloff_control =;

static int deemph_get(struct snd_kcontrol *ctl,
		       struct snd_ctl_elem_value *value)
{}

static int deemph_put(struct snd_kcontrol *ctl,
		       struct snd_ctl_elem_value *value)
{}

static const struct snd_kcontrol_new deemph_control =;

static const struct snd_kcontrol_new hdav_hdmi_control =;

static int st_output_switch_info(struct snd_kcontrol *ctl,
				 struct snd_ctl_elem_info *info)
{}

static int st_output_switch_get(struct snd_kcontrol *ctl,
				struct snd_ctl_elem_value *value)
{}


static int st_output_switch_put(struct snd_kcontrol *ctl,
				struct snd_ctl_elem_value *value)
{}

static int st_hp_volume_offset_info(struct snd_kcontrol *ctl,
				    struct snd_ctl_elem_info *info)
{}

static int st_hp_volume_offset_get(struct snd_kcontrol *ctl,
				   struct snd_ctl_elem_value *value)
{}


static int st_hp_volume_offset_put(struct snd_kcontrol *ctl,
				   struct snd_ctl_elem_value *value)
{}

static const struct snd_kcontrol_new st_controls[] =;

static int xense_output_switch_get(struct snd_kcontrol *ctl,
				   struct snd_ctl_elem_value *value)
{}

static int xense_output_switch_put(struct snd_kcontrol *ctl,
				   struct snd_ctl_elem_value *value)
{}

static const struct snd_kcontrol_new xense_controls[] =;

static void xonar_line_mic_ac97_switch(struct oxygen *chip,
				       unsigned int reg, unsigned int mute)
{}

static const DECLARE_TLV_DB_SCALE(pcm1796_db_scale, -6000, 50, 0);

static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
{}

static int xonar_st_h6_control_filter(struct snd_kcontrol_new *template)
{}

static int add_pcm1796_controls(struct oxygen *chip)
{}

static int xonar_d2_mixer_init(struct oxygen *chip)
{}

static int xonar_hdav_mixer_init(struct oxygen *chip)
{}

static int xonar_st_mixer_init(struct oxygen *chip)
{}

static int xonar_xense_mixer_init(struct oxygen *chip)
{}

static void dump_pcm1796_registers(struct oxygen *chip,
				   struct snd_info_buffer *buffer)
{}

static void dump_cs2000_registers(struct oxygen *chip,
				  struct snd_info_buffer *buffer)
{}

static void dump_st_registers(struct oxygen *chip,
			      struct snd_info_buffer *buffer)
{}

static const struct oxygen_model model_xonar_d2 =;

static const struct oxygen_model model_xonar_hdav =;

static const struct oxygen_model model_xonar_st =;

int get_xonar_pcm179x_model(struct oxygen *chip,
			    const struct pci_device_id *id)
{}