Ticket #14581: diff_linux-inspired_patch.txt

File diff_linux-inspired_patch.txt, 5.5 KB (added by ttcoder, 5 years ago)

modified hda_codec.cpp as advised, added tracing

Line 
1Index: hda/hda_codec.cpp
2==================================================================
3--- hda/hda_codec.cpp
4+++ hda/hda_codec.cpp
5@@ -840,11 +840,33 @@
6 }
7
8 verbs[0] = MAKE_VERB(audioGroup->codec->addr, nodeID,
9 VID_GET_CONFIGURATION_DEFAULT, 0);
10 if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) {
11+ /*****************/
12+ TRACE( "Pinconfig T- for %ld is 0x%8.8lx ====\n", nodeID, resp[0] );
13+ switch( nodeID )
14+ {
15+ case 0x19: // widget 25
16+ resp[0] = 0x042140ff;
17+ //xxxx the sequence number is still "15", before and after
18+ // the patch ?
19+ // ask korli what the sequence is supposed to be/do..
20+ break;
21+
22+ case 0x1a:
23+ resp[0] = 0x21a190f0;
24+ break;
25+
26+ case 0x1c:
27+ resp[0] = 0x212140ff;
28+ break;
29+ }
30+ TRACE( "Pinconfig T+ for %ld is 0x%8.8lx\n", nodeID, resp[0] );
31+
32 widget.d.pin.config = resp[0];
33+
34 const char* location =
35 get_widget_location(CONF_DEFAULT_LOCATION(resp[0]));
36 TRACE("\t%s, %s%s%s, %s, %s, Association:%ld\n",
37 kPortConnector[CONF_DEFAULT_CONNECTIVITY(resp[0])],
38 location ? location : "",
39@@ -875,10 +897,47 @@
40 dump_widget_inputs(widget);
41 }
42
43 hda_widget_get_associations(audioGroup);
44
45+#if 1
46+ //+ if T410 thinkpad, then do this:
47+ if( widget.node_id == 31 )
48+ {
49+ /* The linux driver does both "set-control" and "select-mux":
50+ // Port G: internal speakers
51+ {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
52+ {0x1f, AC_VERB_SET_CONNECT_SEL, 0x00}, // DAC1
53+ The haiku driver is missing that second part! So let's try below:
54+
55+ Also tried: widget 16: send verb offset "0" (instead of huge decibel offset "74", aka 0x4a)
56+
57+ ....And what about this:??
58+ //EAPD:
59+ {0x1d, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, // default on
60+ */
61+
62+ uint32 mux = 0;
63+ uint32 verb = MAKE_VERB(
64+ audioGroup->codec->addr,
65+ widget.node_id,
66+ VID_SET_CONNECTION_SELECT,
67+ mux
68+ );
69+ if (hda_send_verbs(audioGroup->codec, &verb, NULL, 1) != B_OK) {
70+ dprintf("** send-verb failure: hda: Setting output selector %" B_PRId32 " failed on "
71+ "widget %" B_PRIu32 "!\n",
72+ mux,
73+ widget.node_id
74+ );
75+ }
76+ TRACE("-- T410 patch: widget %" B_PRId32 " will feed from selector: %" B_PRIu32 "\n",
77+ widget.node_id,
78+ mux
79+ );
80+ }
81+#endif
82 // init the codecs
83 switch (codec_id) {
84 case 0x10ec0888: {
85 hda_verb_write(codec, 0x20, VID_SET_COEFFICIENT_INDEX, 0x0);
86 uint32 tmp;
87@@ -886,12 +945,23 @@
88 hda_verb_write(codec, 0x20, VID_SET_COEFFICIENT_INDEX, 0x7);
89 hda_verb_write(codec, 0x20, VID_SET_PROCESSING_COEFFICIENT,
90 (tmp & 0xf0) == 0x20 ? 0x830 : 0x3030);
91 break;
92 }
93+ default: {
94+ /*
95+ ----> "case 0x17aa215e:"...
96+ */
97+ }
98+ break;
99 }
100-
101+ TRACE("\n==== subsys: 0x%x\n", codec->controller->pci_info.u.h0.subsystem_id);
102+ TRACE("\n==== subsys vendor: 0x%x\n", codec->controller->pci_info.u.h0.subsystem_vendor_id);
103+ //yields this:
104+ //KERN: ==== subsys: 0x215e
105+ //KERN: ==== subsys vendor: 0x17aa
106+
107 return B_OK;
108 }
109
110
111 /*! Find output path for widget */
112@@ -1351,10 +1421,16 @@
113 corb_t verb = MAKE_VERB(audioGroup->codec->addr,
114 widget.node_id,
115 VID_SET_PIN_WIDGET_CONTROL, ctrl);
116 hda_send_verbs(audioGroup->codec, &verb, NULL, 1);
117
118+#if 1
119+ //+ if T410 thinkpad, then do this:
120+ if( widget.node_id == 31 )
121+ ..
122+ moved up to where advised, as per ticket #14581
123+#endif
124 if (PIN_CAP_IS_EAPD_CAP(widget.d.pin.capabilities)) {
125 uint32 result;
126 verb = MAKE_VERB(audioGroup->codec->addr,
127 widget.node_id, VID_GET_EAPDBTL_EN, 0);
128 if (hda_send_verbs(audioGroup->codec, &verb,
129
130Index: hda/hda_codec_defs.h
131==================================================================
132--- hda/hda_codec_defs.h
133+++ hda/hda_codec_defs.h
134@@ -49,10 +49,14 @@
135
136
137 /* Verb Helper Macro */
138 #define MAKE_VERB(cad, nid, vid, payload) \
139 (((cad) << 28) | ((nid) << 20) | (vid) | (payload))
140+
141+// [x] [xx] [xxx] [xx]
142+// (as hex digit slots)
143+
144
145 /* Verb IDs */
146 #define VID_GET_PARAMETER 0xf0000
147 #define VID_GET_CONNECTION_SELECT 0xf0100
148 #define VID_SET_CONNECTION_SELECT 0x70100
149
150Index: hda/hda_multi_audio.cpp
151==================================================================
152--- hda/hda_multi_audio.cpp
153+++ hda/hda_multi_audio.cpp
154@@ -18,11 +18,11 @@
155
156 #ifdef TRACE
157 # undef TRACE
158 #endif
159
160-//#define TRACE_MULTI_AUDIO
161+#define TRACE_MULTI_AUDIO
162 #ifdef TRACE_MULTI_AUDIO
163 # define TRACE(a...) dprintf("hda: " a)
164 #else
165 # define TRACE(a...) ;
166 #endif
167@@ -761,10 +761,33 @@
168
169
170 static status_t
171 set_mix(hda_audio_group* audioGroup, multi_mix_value_info * mmvi)
172 {
173+ /*
174+ Add support for X220: xxx
175+ Add support for T410:
176+ 8086/3b56 (17aa/215e)
177+ Codec 0 Vendor: 14f1 Product: 5069
178+ ++ or we could add a haiku "quirk" for hda_codec_get_quirks() ?
179+ */
180+ /*
181+ ======= ROADMAP (on my own): =======
182+ [x] apply the 3 "patch pin config" lines
183+ [x] test on COLD boot
184+ [.] apply the "thinkpad acpi" line
185+ => I need to find the "tpacpi_led_set" symbol.. it's not in the hda/ folder :-(
186+ [.] look into "Sequence 0xf", seems this critical part of the patch did not make the intended difference ; FWIW, hda_auto_parser.c has this little nugget: " The real HPs should have the sequence 0x0f " ANd this one: "sort by sequence"
187+ [ ] could be *another* problem in the hda driver, that just happens to be exposed on the T410 ..etc ?
188+ ======= ROADMAP (tickets): =======
189+ - ask tidux for "tracing-enabled dmesg" ? (as per bookmarks on R61)
190+ */