Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/sound/hda/codecs/realtek/alc861vd.c
26530 views
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
//
3
// Realtek ALC861-VD codec
4
// Based on ALC882
5
// In addition, an independent DAC
6
//
7
8
#include <linux/init.h>
9
#include <linux/module.h>
10
#include "realtek.h"
11
12
static int alc861vd_parse_auto_config(struct hda_codec *codec)
13
{
14
static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15
static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
16
return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
17
}
18
19
enum {
20
ALC660VD_FIX_ASUS_GPIO1,
21
ALC861VD_FIX_DALLAS,
22
};
23
24
/* exclude VREF80 */
25
static void alc861vd_fixup_dallas(struct hda_codec *codec,
26
const struct hda_fixup *fix, int action)
27
{
28
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
29
snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
30
snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
31
}
32
}
33
34
/* reset GPIO1 */
35
static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
36
const struct hda_fixup *fix, int action)
37
{
38
struct alc_spec *spec = codec->spec;
39
40
if (action == HDA_FIXUP_ACT_PRE_PROBE)
41
spec->gpio_mask |= 0x02;
42
alc_fixup_gpio(codec, action, 0x01);
43
}
44
45
static const struct hda_fixup alc861vd_fixups[] = {
46
[ALC660VD_FIX_ASUS_GPIO1] = {
47
.type = HDA_FIXUP_FUNC,
48
.v.func = alc660vd_fixup_asus_gpio1,
49
},
50
[ALC861VD_FIX_DALLAS] = {
51
.type = HDA_FIXUP_FUNC,
52
.v.func = alc861vd_fixup_dallas,
53
},
54
};
55
56
static const struct hda_quirk alc861vd_fixup_tbl[] = {
57
SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
58
SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
59
SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
60
{}
61
};
62
63
/*
64
*/
65
static int alc861vd_probe(struct hda_codec *codec, const struct hda_device_id *id)
66
{
67
struct alc_spec *spec;
68
int err;
69
70
err = alc_alloc_spec(codec, 0x0b);
71
if (err < 0)
72
return err;
73
74
spec = codec->spec;
75
if (has_cdefine_beep(codec))
76
spec->gen.beep_nid = 0x23;
77
78
spec->shutup = alc_eapd_shutup;
79
80
alc_pre_init(codec);
81
82
snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
83
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
84
85
/* automatic parse from the BIOS config */
86
err = alc861vd_parse_auto_config(codec);
87
if (err < 0)
88
goto error;
89
90
if (!spec->gen.no_analog) {
91
err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
92
if (err < 0)
93
goto error;
94
}
95
96
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
97
98
return 0;
99
100
error:
101
snd_hda_gen_remove(codec);
102
return err;
103
}
104
105
static const struct hda_codec_ops alc861vd_codec_ops = {
106
.probe = alc861vd_probe,
107
.remove = snd_hda_gen_remove,
108
.build_controls = alc_build_controls,
109
.build_pcms = snd_hda_gen_build_pcms,
110
.init = alc_init,
111
.unsol_event = snd_hda_jack_unsol_event,
112
.resume = alc_resume,
113
.suspend = alc_suspend,
114
.check_power_status = snd_hda_gen_check_power_status,
115
.stream_pm = snd_hda_gen_stream_pm,
116
};
117
118
/*
119
* driver entries
120
*/
121
static const struct hda_device_id snd_hda_id_alc861vd[] = {
122
HDA_CODEC_ID(0x10ec0660, "ALC660-VD"),
123
HDA_CODEC_ID(0x10ec0862, "ALC861-VD"),
124
{} /* terminator */
125
};
126
MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_alc861vd);
127
128
MODULE_LICENSE("GPL");
129
MODULE_DESCRIPTION("Realtek ALC861-VD HD-audio codec");
130
MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");
131
132
static struct hda_codec_driver alc861vd_driver = {
133
.id = snd_hda_id_alc861vd,
134
.ops = &alc861vd_codec_ops,
135
};
136
137
module_hda_codec_driver(alc861vd_driver);
138
139