linux/sound/pci/hda/patch_via.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Universal Interface for Intel High Definition Audio Codec
 *
 * HD audio interface patch for VIA VT17xx/VT18xx/VT20xx codec
 *
 *  (C) 2006-2009 VIA Technology, Inc.
 *  (C) 2006-2008 Takashi Iwai <[email protected]>
 */

/* * * * * * * * * * * * * * Release History * * * * * * * * * * * * * * * * */
/*									     */
/* 2006-03-03  Lydia Wang  Create the basic patch to support VT1708 codec    */
/* 2006-03-14  Lydia Wang  Modify hard code for some pin widget nid	     */
/* 2006-08-02  Lydia Wang  Add support to VT1709 codec			     */
/* 2006-09-08  Lydia Wang  Fix internal loopback recording source select bug */
/* 2007-09-12  Lydia Wang  Add EAPD enable during driver initialization	     */
/* 2007-09-17  Lydia Wang  Add VT1708B codec support			    */
/* 2007-11-14  Lydia Wang  Add VT1708A codec HP and CD pin connect config    */
/* 2008-02-03  Lydia Wang  Fix Rear channels and Back channels inverse issue */
/* 2008-03-06  Lydia Wang  Add VT1702 codec and VT1708S codec support	     */
/* 2008-04-09  Lydia Wang  Add mute front speaker when HP plugin	     */
/* 2008-04-09  Lydia Wang  Add Independent HP feature			     */
/* 2008-05-28  Lydia Wang  Add second S/PDIF Out support for VT1702	     */
/* 2008-09-15  Logan Li	   Add VT1708S Mic Boost workaround/backdoor	     */
/* 2009-02-16  Logan Li	   Add support for VT1718S			     */
/* 2009-03-13  Logan Li	   Add support for VT1716S			     */
/* 2009-04-14  Lydai Wang  Add support for VT1828S and VT2020		     */
/* 2009-07-08  Lydia Wang  Add support for VT2002P			     */
/* 2009-07-21  Lydia Wang  Add support for VT1812			     */
/* 2009-09-19  Lydia Wang  Add support for VT1818S			     */
/*									     */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


#include <linux/init.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/asoundef.h>
#include <sound/hda_codec.h>
#include "hda_local.h"
#include "hda_auto_parser.h"
#include "hda_jack.h"
#include "hda_generic.h"

/* Pin Widget NID */
#define VT1708_HP_PIN_NID
#define VT1708_CD_PIN_NID

enum VIA_HDA_CODEC {};

#define VT2002P_COMPATIBLE(spec)

struct via_spec {};

static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec);
static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo,
				  struct hda_codec *codec,
				  struct snd_pcm_substream *substream,
				  int action);

static const struct hda_codec_ops via_patch_ops; /* defined below */

static struct via_spec *via_new_spec(struct hda_codec *codec)
{}

static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec)
{
	u32 vendor_id = codec->core.vendor_id;
	u16 ven_id = vendor_id >> 16;
	u16 dev_id = vendor_id & 0xffff;
	enum VIA_HDA_CODEC codec_type;

	/* get codec type */
	if (ven_id != 0x1106)
		codec_type = UNKNOWN;
	else if (dev_id >= 0x1708 && dev_id <= 0x170b)
		codec_type = VT1708;
	else if (dev_id >= 0xe710 && dev_id <= 0xe713)
		codec_type = VT1709_10CH;
	else if (dev_id >= 0xe714 && dev_id <= 0xe717)
		codec_type = VT1709_6CH;
	else if (dev_id >= 0xe720 && dev_id <= 0xe723) {
		codec_type = VT1708B_8CH;
		if (snd_hda_param_read(codec, 0x16, AC_PAR_CONNLIST_LEN) == 0x7)
			codec_type = VT1708BCE;
	} else if (dev_id >= 0xe724 && dev_id <= 0xe727)
		codec_type = VT1708B_4CH;
	else if ((dev_id & 0xfff) == 0x397
		 && (dev_id >> 12) < 8)
		codec_type = VT1708S;
	else if ((dev_id & 0xfff) == 0x398
		 && (dev_id >> 12) < 8)
		codec_type = VT1702;
	else if ((dev_id & 0xfff) == 0x428
		 && (dev_id >> 12) < 8)
		codec_type = VT1718S;
	else if (dev_id == 0x0433 || dev_id == 0xa721)
		codec_type = VT1716S;
	else if (dev_id == 0x0441 || dev_id == 0x4441)
		codec_type = VT1718S;
	else if (dev_id == 0x0438 || dev_id == 0x4438)
		codec_type = VT2002P;
	else if (dev_id == 0x0448)
		codec_type = VT1812;
	else if (dev_id == 0x0440)
		codec_type = VT1708S;
	else if ((dev_id & 0xfff) == 0x446)
		codec_type = VT1802;
	else if (dev_id == 0x4760)
		codec_type = VT1705CF;
	else if (dev_id == 0x4761 || dev_id == 0x4762)
		codec_type = VT1808;
	else
		codec_type = UNKNOWN;
	return codec_type;
};

static void analog_low_current_mode(struct hda_codec *codec);
static bool is_aa_path_mute(struct hda_codec *codec);

#define hp_detect_with_aa(codec)

static void vt1708_stop_hp_work(struct hda_codec *codec)
{}

static void vt1708_update_hp_work(struct hda_codec *codec)
{}

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

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

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

static const struct snd_kcontrol_new via_pin_power_ctl_enum =;

#ifdef CONFIG_SND_HDA_INPUT_BEEP
/* additional beep mixers; the actual parameters are overwritten at build */
static const struct snd_kcontrol_new via_beep_mixer[] =;

static int set_beep_amp(struct via_spec *spec, hda_nid_t nid,
			int idx, int dir)
{}

static int auto_parse_beep(struct hda_codec *codec)
{}
#else
#define auto_parse_beep
#endif

/* check AA path's mute status */
static bool is_aa_path_mute(struct hda_codec *codec)
{}

/* enter/exit analog low-current mode */
static void __analog_low_current_mode(struct hda_codec *codec, bool force)
{}

static void analog_low_current_mode(struct hda_codec *codec)
{}

static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo,
				  struct hda_codec *codec,
				  struct snd_pcm_substream *substream,
				  int action)
{}

static void via_free(struct hda_codec *codec)
{}

static int via_suspend(struct hda_codec *codec)
{}

static int via_resume(struct hda_codec *codec)
{}

static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid)
{}

/*
 */

static int via_init(struct hda_codec *codec);

static const struct hda_codec_ops via_patch_ops =;


static const struct hda_verb vt1708_init_verbs[] =;
static void vt1708_set_pinconfig_connect(struct hda_codec *codec, hda_nid_t nid)
{}

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

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

static const struct snd_kcontrol_new vt1708_jack_detect_ctl =;

static const struct badness_table via_main_out_badness =;
static const struct badness_table via_extra_out_badness =;

static int via_parse_auto_config(struct hda_codec *codec)
{}

static int via_init(struct hda_codec *codec)
{}

static int vt1708_build_controls(struct hda_codec *codec)
{}

static int vt1708_build_pcms(struct hda_codec *codec)
{}

static int patch_vt1708(struct hda_codec *codec)
{}

static int patch_vt1709(struct hda_codec *codec)
{}

static int patch_vt1708S(struct hda_codec *codec);
static int patch_vt1708B(struct hda_codec *codec)
{}

/* Patch for VT1708S */
static const struct hda_verb vt1708S_init_verbs[] =;

static void override_mic_boost(struct hda_codec *codec, hda_nid_t pin,
			       int offset, int num_steps, int step_size)
{}

static int patch_vt1708S(struct hda_codec *codec)
{}

/* Patch for VT1702 */

static const struct hda_verb vt1702_init_verbs[] =;

static int patch_vt1702(struct hda_codec *codec)
{}

/* Patch for VT1718S */

static const struct hda_verb vt1718S_init_verbs[] =;

/* Add a connection to the primary DAC from AA-mixer for some codecs
 * This isn't listed from the raw info, but the chip has a secret connection.
 */
static int add_secret_dac_path(struct hda_codec *codec)
{}


static int patch_vt1718S(struct hda_codec *codec)
{}

/* Patch for VT1716S */

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

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

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

static const struct snd_kcontrol_new vt1716s_dmic_mixer_vol =;
static const struct snd_kcontrol_new vt1716s_dmic_mixer_sw =;


/* mono-out mixer elements */
static const struct snd_kcontrol_new vt1716S_mono_out_mixer =;

static const struct hda_verb vt1716S_init_verbs[] =;

static int patch_vt1716S(struct hda_codec *codec)
{}

/* for vt2002P */

static const struct hda_verb vt2002P_init_verbs[] =;

static const struct hda_verb vt1802_init_verbs[] =;

/*
 * pin fix-up
 */
enum {};

static void via_fixup_intmic_boost(struct hda_codec *codec,
				  const struct hda_fixup *fix, int action)
{}

static void via_fixup_power_save(struct hda_codec *codec,
				 const struct hda_fixup *fix, int action)
{}

static const struct hda_fixup via_fixups[] =;

static const struct snd_pci_quirk vt2002p_fixups[] =;

/* NIDs 0x24 and 0x33 on VT1802 have connections to non-existing NID 0x3e
 * Replace this with mixer NID 0x1c
 */
static void fix_vt1802_connections(struct hda_codec *codec)
{}

/* patch for vt2002P */
static int patch_vt2002P(struct hda_codec *codec)
{}

/* for vt1812 */

static const struct hda_verb vt1812_init_verbs[] =;

/* patch for vt1812 */
static int patch_vt1812(struct hda_codec *codec)
{}

/* patch for vt3476 */

static const struct hda_verb vt3476_init_verbs[] =;

static int patch_vt3476(struct hda_codec *codec)
{}

/*
 * patch entries
 */
static const struct hda_device_id snd_hda_id_via[] =;
MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_via);

static struct hda_codec_driver via_driver =;

MODULE_LICENSE();
MODULE_DESCRIPTION();

module_hda_codec_driver();