#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"
#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;
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;
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
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
static bool is_aa_path_mute(struct hda_codec *codec)
{ … }
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)
{ … }
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)
{ … }
static const struct hda_verb vt1702_init_verbs[] = …;
static int patch_vt1702(struct hda_codec *codec)
{ … }
static const struct hda_verb vt1718S_init_verbs[] = …;
static int add_secret_dac_path(struct hda_codec *codec)
{ … }
static int patch_vt1718S(struct hda_codec *codec)
{ … }
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 = …;
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)
{ … }
static const struct hda_verb vt2002P_init_verbs[] = …;
static const struct hda_verb vt1802_init_verbs[] = …;
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[] = …;
static void fix_vt1802_connections(struct hda_codec *codec)
{ … }
static int patch_vt2002P(struct hda_codec *codec)
{ … }
static const struct hda_verb vt1812_init_verbs[] = …;
static int patch_vt1812(struct hda_codec *codec)
{ … }
static const struct hda_verb vt3476_init_verbs[] = …;
static int patch_vt3476(struct hda_codec *codec)
{ … }
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(…) …;