Changeset 9bae8b8 in mainline
- Timestamp:
- 2014-08-26T19:42:40Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2f6b916
- Parents:
- 1e92bc3
- Location:
- uspace/drv/audio/hdaudio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/codec.c
r1e92bc3 r9bae8b8 49 49 { 50 50 uint32_t verb; 51 uint32_t myresp; 52 53 if (resp == NULL) 54 resp = &myresp; 51 55 52 56 verb = (codec->address << 28) | (node << 20) | (vid << 8) | payload; 53 return hda_cmd(codec->hda, verb, resp); 57 int rc = hda_cmd(codec->hda, verb, resp); 58 if (resp != NULL) { 59 ddf_msg(LVL_NOTE, "verb 0x%" PRIx32 " -> 0x%" PRIx32, verb, 60 *resp); 61 } else { 62 ddf_msg(LVL_NOTE, "verb 0x%" PRIx32, verb); 63 } 64 return rc; 54 65 } 55 66 … … 95 106 } 96 107 108 static int hda_get_clist_len(hda_codec_t *codec, int node, bool *longform, 109 int *items) 110 { 111 int rc; 112 uint32_t resp; 113 114 rc = hda_get_parameter(codec, node, hda_clist_len, &resp); 115 if (rc != EOK) 116 return rc; 117 118 // ddf_msg(LVL_NOTE, "hda_get_clist_len: resp=0x%x", resp); 119 *longform = resp & BIT_V(uint32_t, cll_longform); 120 *items = resp & BIT_RANGE_EXTRACT(uint32_t, cll_len_h, cll_len_l, resp); 121 return EOK; 122 } 123 124 static int hda_get_clist_entry(hda_codec_t *codec, int node, int n, uint32_t *resp) 125 { 126 return hda_ccmd(codec, node, hda_clist_entry_get, n, resp); 127 } 128 97 129 /** Get Suppported PCM Size, Rates */ 98 130 static int hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates) … … 144 176 } 145 177 178 static int hda_get_conn_sel(hda_codec_t *codec, int node, uint32_t *conn) 179 { 180 return hda_ccmd(codec, node, hda_conn_sel_get, 0, conn); 181 } 182 146 183 /** Get Amplifier Gain / Mute */ 147 184 static int hda_get_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload, 148 185 uint32_t *resp) 149 186 { 150 return hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp); 187 // ddf_msg(LVL_NOTE, "hda_get_amp_gain_mute(codec, %d, %x)", 188 // node, payload); 189 int rc = hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp); 190 // ddf_msg(LVL_NOTE, "hda_get_amp_gain_mute(codec, %d, %x, resp=%x)", 191 // node, payload, *resp); 192 return rc; 151 193 } 152 194 153 195 static int hda_set_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload) 154 196 { 197 // ddf_msg(LVL_NOTE, "hda_set_amp_gain_mute(codec, %d, %x)", 198 // node, payload); 155 199 return hda_ccmd(codec, node, hda_amp_gain_mute_set, payload, NULL); 156 200 } … … 176 220 goto error; 177 221 178 ddf_msg(LVL_NOTE, "out amp caps 0x%x " 222 offset = ampcaps & 0x7f; 223 ddf_msg(LVL_NOTE, "out amp caps 0x%x (offset=0x%x)" 179 224 "gain/mute: L:0x%x R:0x%x", 180 ampcaps, gmleft, gmright); 181 offset = ampcaps & 0x7f; 225 ampcaps, offset, gmleft, gmright); 182 226 183 227 rc = hda_set_amp_gain_mute(codec, aw, 0xb000 + offset); … … 203 247 goto error; 204 248 205 ddf_msg(LVL_NOTE, "in amp caps 0x%x ", ampcaps);206 249 offset = ampcaps & 0x7f; 250 ddf_msg(LVL_NOTE, "in amp caps 0x%x (offset=0x%x)", ampcaps, offset); 207 251 208 252 for (i = 0; i < 15; i++) { … … 225 269 return EOK; 226 270 error: 271 return rc; 272 } 273 274 static int hda_clist_dump(hda_codec_t *codec, uint8_t aw) 275 { 276 int rc; 277 bool longform; 278 int len; 279 uint32_t resp; 280 uint32_t mask; 281 uint32_t cidx; 282 int shift; 283 int epresp; 284 int i, j; 285 286 ddf_msg(LVL_NOTE, "Connections for widget %d:", aw); 287 288 rc = hda_get_clist_len(codec, aw, &longform, &len); 289 if (rc != EOK) { 290 ddf_msg(LVL_ERROR, "Failed getting connection list length."); 291 return rc; 292 } 293 294 if (len > 1) { 295 rc = hda_get_conn_sel(codec, aw, &cidx); 296 if (rc != EOK) { 297 ddf_msg(LVL_ERROR, "Failed getting connection select"); 298 return rc; 299 } 300 } else { 301 cidx = 0; 302 } 303 304 // ddf_msg(LVL_NOTE, "longform:%d len:%d", longform, len); 305 306 if (longform) { 307 epresp = 2; 308 mask = 0xffff; 309 shift = 16; 310 } else { 311 epresp = 4; 312 mask = 0xff; 313 shift = 8; 314 } 315 316 i = 0; 317 while (i < len) { 318 rc = hda_get_clist_entry(codec, aw, i, &resp); 319 if (rc != EOK) { 320 ddf_msg(LVL_ERROR, "Failed getting connection list entry."); 321 return rc; 322 } 323 324 for (j = 0; j < epresp && i < len; j++) { 325 ddf_msg(LVL_NOTE, "<- %d%s", resp & mask, 326 (int)cidx == i ? " *** current *** " : ""); 327 resp = resp << shift; 328 ++i; 329 } 330 331 } 332 227 333 return rc; 228 334 } … … 281 387 aw, awtype, awcaps); 282 388 389 switch (awtype) { 390 case awt_audio_input: 391 case awt_audio_mixer: 392 case awt_audio_selector: 393 case awt_pin_complex: 394 case awt_power_widget: 395 rc = hda_clist_dump(codec, aw); 396 if (rc != EOK) 397 goto error; 398 break; 399 default: 400 break; 401 } 402 283 403 if (awtype == awt_pin_complex) { 284 404 rc = hda_get_cfg_def(codec, aw, &cfgdef); … … 293 413 } 294 414 415 if (0) { 295 416 if ((awcaps & BIT_V(uint32_t, awc_out_amp_present)) != 0) 296 417 hda_set_out_amp_max(codec, aw); … … 298 419 if ((awcaps & BIT_V(uint32_t, awc_in_amp_present)) != 0) 299 420 hda_set_in_amp_max(codec, aw); 421 } 300 422 } 301 423 } -
uspace/drv/audio/hdaudio/hdaudio.ma
r1e92bc3 r9bae8b8 2 2 10 pci/ven=8086&dev=1e20 3 3 10 pci/ven=8086&dev=2668 4 10 pci/ven=8086&dev=284b 5 10 pci/ven=8086&dev=1c20 6 10 pci/ven=8086&dev=293e -
uspace/drv/audio/hdaudio/spec/codec.h
r1e92bc3 r9bae8b8 235 235 hda_out_amp_caps = 0x12, 236 236 /** Connection List Length */ 237 hda_clist_len = 0x e,237 hda_clist_len = 0x0e, 238 238 /** Supported Power States */ 239 239 hda_supp_pwr_states = 0x0f, … … 275 275 fgrp_vdmfg = 0x02 276 276 } hda_fgrp_type_t; 277 278 /** Connection List Length Response bits */ 279 typedef enum { 280 /** Long Form */ 281 cll_longform = 7, 282 /** Connection List Length (H) */ 283 cll_len_h = 6, 284 /** Connection List Length (L) */ 285 cll_len_l = 0 286 } hda_clist_len_bits_t; 277 287 278 288 /** Audio Widget Capabilities Bits */
Note:
See TracChangeset
for help on using the changeset viewer.