1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 524ff26..9ca0533 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -197,6 +197,7 @@ enum {
 	ALC272_DELL,
 	ALC272_DELL_ZM1,
 	ALC272_SAMSUNG_NC10,
+	ALC892_CLEVO_P170HM,
 	ALC662_AUTO,
 	ALC662_MODEL_LAST,
 };
@@ -17506,9 +17507,9 @@ static int patch_alc861vd(struct hda_codec *codec)
 #define ALC662_DIGOUT_NID	0x06
 #define ALC662_DIGIN_NID	0x0a
 
-static const hda_nid_t alc662_dac_nids[3] = {
-	/* front, rear, clfe */
-	0x02, 0x03, 0x04
+static const hda_nid_t alc662_dac_nids[4] = {
+	/* front, rear, clfe, side */
+	0x02, 0x03, 0x04, 0x05
 };
 
 static const hda_nid_t alc272_dac_nids[2] = {
@@ -17643,6 +17644,39 @@ static const struct hda_channel_mode alc662_5stack_modes[2] = {
 	{ 6, alc662_sixstack_ch8_init },
 };
 
+/*
+ * 6ch mode
+ */
+static const struct hda_verb alc892_clevo_p170hm_ch6_init[] = {
+	{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+	{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ } /* end */
+};
+
+/*
+ * 8ch mode
+ */
+static const struct hda_verb alc892_clevo_p170hm_ch8_init[] = {
+	{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+	{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ } /* end */
+};
+
+static const struct hda_channel_mode alc892_clevo_p170hm_modes[2] = {
+	{ 6, alc892_clevo_p170hm_ch6_init },
+	{ 8, alc892_clevo_p170hm_ch8_init },
+};
+
 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
  *                 Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
  */
@@ -18018,6 +18052,12 @@ static const struct hda_verb alc662_eeepc_sue_init_verbs[] = {
 	{}
 };
 
+static const struct hda_verb alc892_clevo_p170hm_init_verbs[] = {
+	{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
+	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
+	{}
+};
+
 /* Set Unsolicited Event*/
 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
 	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -18490,6 +18530,7 @@ static const char * const alc662_models[ALC662_MODEL_LAST] = {
 	[ALC272_DELL]		= "dell",
 	[ALC272_DELL_ZM1]	= "dell-zm1",
 	[ALC272_SAMSUNG_NC10]	= "samsung-nc10",
+	[ALC892_CLEVO_P170HM]   = "clevo-p170hm",
 	[ALC662_AUTO]		= "auto",
 };
 
@@ -18906,6 +18947,18 @@ static const struct alc_config_preset alc662_presets[] = {
 		.setup = alc663_mode4_setup,
 		.init_hook = alc_inithook,
 	},
+	[ALC892_CLEVO_P170HM] = {
+		.mixers = { alc662_base_mixer, alc662_chmode_mixer },
+		.init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs, alc892_clevo_p170hm_init_verbs },
+		.num_dacs = ARRAY_SIZE(alc662_dac_nids),
+		.dac_nids = alc662_dac_nids,
+		.dig_out_nid = ALC662_DIGOUT_NID,
+		.dig_in_nid = ALC662_DIGIN_NID,
+		.num_channel_mode = ARRAY_SIZE(alc892_clevo_p170hm_modes),
+		.channel_mode = alc892_clevo_p170hm_modes,
+		.input_mux = &alc662_capture_source,
+		.init_hook = alc_inithook,
+	},
 };