Changeset a9be4d2 in mainline
- Timestamp:
- 2014-08-27T15:11:48Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 149dd52d
- Parents:
- cc91ab4
- Location:
- uspace/drv/audio/hdaudio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/codec.c
rcc91ab4 ra9be4d2 139 139 } 140 140 141 static int hda_get_eapd_btl_enable(hda_codec_t *codec, int node, uint32_t *resp) 142 { 143 return hda_ccmd(codec, node, hda_eapd_btl_enable_get, 0, resp); 144 } 145 146 static int hda_set_eapd_btl_enable(hda_codec_t *codec, int node, uint8_t payload) 147 { 148 return hda_ccmd(codec, node, hda_eapd_btl_enable_set, payload, NULL); 149 } 150 141 151 /** Get Suppported PCM Size, Rates */ 142 152 static int hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates) … … 180 190 181 191 return EOK; 192 } 193 194 /** Get Pin Capabilities */ 195 static int hda_get_pin_caps(hda_codec_t *codec, int node, uint32_t *caps) 196 { 197 return hda_get_parameter(codec, node, hda_pin_caps, caps); 198 } 199 200 /** Get Power State */ 201 static int hda_get_power_state(hda_codec_t *codec, int node, uint32_t *pstate) 202 { 203 return hda_ccmd(codec, node, hda_power_state_get, 0, pstate); 182 204 } 183 205 … … 347 369 } 348 370 371 static int hda_pin_init(hda_codec_t *codec, uint8_t aw) 372 { 373 int rc; 374 uint32_t cfgdef; 375 uint32_t pcaps; 376 uint32_t eapd; 377 378 rc = hda_get_cfg_def(codec, aw, &cfgdef); 379 if (rc != EOK) 380 goto error; 381 ddf_msg(LVL_NOTE, "aw %d: PIN cdfgef=0x%x", 382 aw, cfgdef); 383 384 rc = hda_get_pin_caps(codec, aw, &pcaps); 385 if (rc != EOK) 386 goto error; 387 ddf_msg(LVL_NOTE, "aw %d : PIN caps=0x%x", 388 aw, pcaps); 389 390 if ((pcaps & BIT_V(uint32_t, pwc_eapd)) != 0) { 391 rc = hda_get_eapd_btl_enable(codec, aw, &eapd); 392 if (rc != EOK) 393 goto error; 394 395 ddf_msg(LVL_NOTE, "PIN %d had EAPD value=0x%x", aw, eapd); 396 397 rc = hda_set_eapd_btl_enable(codec, aw, eapd | 2); 398 if (rc != EOK) 399 goto error; 400 401 rc = hda_get_eapd_btl_enable(codec, aw, &eapd); 402 if (rc != EOK) 403 goto error; 404 405 ddf_msg(LVL_NOTE, "PIN %d now has EAPD value=0x%x", aw, eapd); 406 } 407 408 return EOK; 409 error: 410 return rc; 411 } 412 413 /** Init power-control in wiget capable of doing so. */ 414 static int hda_power_ctl_init(hda_codec_t *codec, uint8_t aw) 415 { 416 int rc; 417 uint32_t pwrstate; 418 419 ddf_msg(LVL_NOTE, "aw %d is power control-capable", aw); 420 421 rc = hda_get_power_state(codec, aw, &pwrstate); 422 if (rc != EOK) 423 goto error; 424 ddf_msg(LVL_NOTE, "aw %d: power state = 0x%x", aw, pwrstate); 425 426 return EOK; 427 error: 428 return rc; 429 } 430 349 431 hda_codec_t *hda_codec_init(hda_t *hda, uint8_t address) 350 432 { … … 358 440 hda_awidget_type_t awtype; 359 441 uint32_t awcaps; 360 uint32_t cfgdef;361 442 uint32_t rates; 362 443 uint32_t formats; … … 399 480 ddf_msg(LVL_NOTE, "aw %d: type=0x%x caps=0x%x", 400 481 aw, awtype, awcaps); 482 483 if ((awcaps & BIT_V(uint32_t, awc_power_cntrl)) != 0) { 484 rc = hda_power_ctl_init(codec, aw); 485 if (rc != EOK) 486 goto error; 487 } 401 488 402 489 switch (awtype) { … … 415 502 416 503 if (awtype == awt_pin_complex) { 417 rc = hda_ get_cfg_def(codec, aw, &cfgdef);504 rc = hda_pin_init(codec, aw); 418 505 if (rc != EOK) 419 506 goto error; 420 ddf_msg(LVL_NOTE, "aw %d: PIN cdfgef=0x%x",421 aw, cfgdef);422 423 507 } else if (awtype == awt_audio_output) { 424 508 codec->out_aw_list[codec->out_aw_num++] = aw; -
uspace/drv/audio/hdaudio/spec/codec.h
rcc91ab4 ra9be4d2 324 324 } hda_awidget_caps_bits_t; 325 325 326 typedef enum { 327 /** High Bit Rate */ 328 pwc_hbr = 27, 329 /** Display Port */ 330 pwc_dp = 24, 331 /** EAPD Capable */ 332 pwc_eapd = 16, 333 /** VRef Control (H) */ 334 pwc_vrefctl_h = 15, 335 /** VRef Control (L) */ 336 pwc_vrefctl_l = 8, 337 /** HDMI */ 338 pwc_hdmi = 7, 339 /** Balanced I/O Pins */ 340 pwc_bal_io = 6, 341 /** Input Capable */ 342 pwc_input = 5, 343 /** Output Capable */ 344 pwc_output = 4, 345 /** Headphone Drive Capable */ 346 pwc_hpd = 3, 347 /** Presence Detect Capable */ 348 pwc_presence = 2, 349 /** Trigger Required */ 350 pwc_trigger_reqd = 1, 351 /** Impedance Sense Capable */ 352 pwc_imp_sense = 0 353 } hda_pin_caps_bits_t; 354 326 355 /** Audio Widget Type */ 327 356 typedef enum {
Note:
See TracChangeset
for help on using the changeset viewer.