linux/sound/pci/oxygen/xonar_wm87x6.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * card driver for models with WM8776/WM8766 DACs (Xonar DS/HDAV1.3 Slim)
 *
 * Copyright (c) Clemens Ladisch <[email protected]>
 */

/*
 * Xonar DS
 * --------
 *
 * CMI8788:
 *
 *   SPI 0 -> WM8766 (surround, center/LFE, back)
 *   SPI 1 -> WM8776 (front, input)
 *
 *   GPIO 4 <- headphone detect, 0 = plugged
 *   GPIO 6 -> route input jack to mic-in (0) or line-in (1)
 *   GPIO 7 -> enable output to front L/R speaker channels
 *   GPIO 8 -> enable output to other speaker channels and front panel headphone
 *
 * WM8776:
 *
 *   input 1 <- line
 *   input 2 <- mic
 *   input 3 <- front mic
 *   input 4 <- aux
 */

/*
 * Xonar HDAV1.3 Slim
 * ------------------
 *
 * CMI8788:
 *
 *   I²C <-> WM8776 (addr 0011010)
 *
 *   GPIO 0  -> disable HDMI output
 *   GPIO 1  -> enable HP output
 *   GPIO 6  -> firmware EEPROM I²C clock
 *   GPIO 7 <-> firmware EEPROM I²C data
 *
 *   UART <-> HDMI controller
 *
 * WM8776:
 *
 *   input 1 <- mic
 *   input 2 <- aux
 */

#include <linux/pci.h>
#include <linux/delay.h>
#include <sound/control.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include "xonar.h"
#include "wm8776.h"
#include "wm8766.h"

#define GPIO_DS_HP_DETECT
#define GPIO_DS_INPUT_ROUTE
#define GPIO_DS_OUTPUT_FRONTLR
#define GPIO_DS_OUTPUT_ENABLE

#define GPIO_SLIM_HDMI_DISABLE
#define GPIO_SLIM_OUTPUT_ENABLE
#define GPIO_SLIM_FIRMWARE_CLK
#define GPIO_SLIM_FIRMWARE_DATA

#define I2C_DEVICE_WM8776

#define LC_CONTROL_LIMITER
#define LC_CONTROL_ALC

struct xonar_wm87x6 {};

static void wm8776_write_spi(struct oxygen *chip,
			     unsigned int reg, unsigned int value)
{}

static void wm8776_write_i2c(struct oxygen *chip,
			     unsigned int reg, unsigned int value)
{}

static void wm8776_write(struct oxygen *chip,
			 unsigned int reg, unsigned int value)
{}

static void wm8776_write_cached(struct oxygen *chip,
				unsigned int reg, unsigned int value)
{}

static void wm8766_write(struct oxygen *chip,
			 unsigned int reg, unsigned int value)
{}

static void wm8766_write_cached(struct oxygen *chip,
				unsigned int reg, unsigned int value)
{}

static void wm8776_registers_init(struct oxygen *chip)
{}

static void wm8766_registers_init(struct oxygen *chip)
{}

static void wm8776_init(struct oxygen *chip)
{}

static void wm8766_init(struct oxygen *chip)
{}

static void xonar_ds_handle_hp_jack(struct oxygen *chip)
{}

static void xonar_ds_init(struct oxygen *chip)
{}

static void xonar_hdav_slim_init(struct oxygen *chip)
{}

static void xonar_ds_cleanup(struct oxygen *chip)
{}

static void xonar_hdav_slim_cleanup(struct oxygen *chip)
{}

static void xonar_ds_suspend(struct oxygen *chip)
{}

static void xonar_hdav_slim_suspend(struct oxygen *chip)
{}

static void xonar_ds_resume(struct oxygen *chip)
{}

static void xonar_hdav_slim_resume(struct oxygen *chip)
{}

static void wm8776_adc_hardware_filter(unsigned int channel,
				       struct snd_pcm_hardware *hardware)
{}

static void xonar_hdav_slim_hardware_filter(unsigned int channel,
					    struct snd_pcm_hardware *hardware)
{}

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

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

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

static void update_wm8776_volume(struct oxygen *chip)
{}

static void update_wm87x6_volume(struct oxygen *chip)
{}

static void update_wm8776_mute(struct oxygen *chip)
{}

static void update_wm87x6_mute(struct oxygen *chip)
{}

static void update_wm8766_center_lfe_mix(struct oxygen *chip, bool mixed)
{}

static void xonar_ds_gpio_changed(struct oxygen *chip)
{}

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

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

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

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

static void wm8776_field_set_from_ctl(struct snd_kcontrol *ctl)
{}

static int wm8776_field_set(struct snd_kcontrol *ctl, unsigned int value)
{}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static void activate_control(struct oxygen *chip,
			     struct snd_kcontrol *ctl, unsigned int mode)
{}

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

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

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

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

#define WM8776_BIT_SWITCH(xname, reg, bit, invert, flags)
#define _WM8776_FIELD_CTL(xname, reg, shift, initval, min, max, mask, flags)
#define WM8776_FIELD_CTL_ENUM(xname, reg, shift, init, min, max, mask, flags)
#define WM8776_FIELD_CTL_VOLUME(a, b, c, d, e, f, g, h, tlv_p)

static const DECLARE_TLV_DB_SCALE(wm87x6_dac_db_scale, -6000, 50, 0);
static const DECLARE_TLV_DB_SCALE(wm8776_adc_db_scale, -2100, 50, 0);
static const DECLARE_TLV_DB_SCALE(wm8776_hp_db_scale, -6000, 100, 0);
static const DECLARE_TLV_DB_SCALE(wm8776_lct_db_scale, -1600, 100, 0);
static const DECLARE_TLV_DB_SCALE(wm8776_maxgain_db_scale, 0, 400, 0);
static const DECLARE_TLV_DB_SCALE(wm8776_ngth_db_scale, -7800, 600, 0);
static const DECLARE_TLV_DB_SCALE(wm8776_maxatten_lim_db_scale, -1200, 100, 0);
static const DECLARE_TLV_DB_SCALE(wm8776_maxatten_alc_db_scale, -2100, 400, 0);

static const struct snd_kcontrol_new ds_controls[] =;
static const struct snd_kcontrol_new hdav_slim_controls[] =;
static const struct snd_kcontrol_new lc_controls[] =;

static int add_lc_controls(struct oxygen *chip)
{}

static int xonar_ds_mixer_init(struct oxygen *chip)
{}

static int xonar_hdav_slim_mixer_init(struct oxygen *chip)
{}

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

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

static const struct oxygen_model model_xonar_ds =;

static const struct oxygen_model model_xonar_hdav_slim =;

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