Changes in uspace/drv/audio/hdaudio/hdactl.c [09ab0a9a:cf78637] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/hdactl.c
r09ab0a9a rcf78637 154 154 errno_t rc; 155 155 156 ddf_msg(LVL_ NOTE, "hda_corb_init()");156 ddf_msg(LVL_DEBUG, "hda_corb_init()"); 157 157 158 158 /* Stop CORB if not stopped */ 159 159 ctl = hda_reg8_read(&hda->regs->corbctl); 160 160 if ((ctl & BIT_V(uint8_t, corbctl_run)) != 0) { 161 ddf_msg(LVL_ NOTE, "CORB is enabled, disabling first.");161 ddf_msg(LVL_DEBUG, "CORB is enabled, disabling first."); 162 162 hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t, 163 163 corbctl_run)); … … 176 176 corbsz = corbsz | selsz; 177 177 178 ddf_msg(LVL_ NOTE, "Setting CORB Size register to 0x%x", corbsz);178 ddf_msg(LVL_DEBUG, "Setting CORB Size register to 0x%x", corbsz); 179 179 hda_reg8_write(&hda->regs->corbsize, corbsz); 180 180 hda->ctl->corb_entries = hda_rb_entries(selsz); … … 190 190 if (rc != EOK) { 191 191 hda->ctl->corb_virt = NULL; 192 ddf_msg(LVL_ NOTE, "Failed allocating DMA memory for CORB");193 goto error; 194 } 195 196 ddf_msg(LVL_ NOTE, "Set CORB base registers");192 ddf_msg(LVL_ERROR, "Failed allocating DMA memory for CORB"); 193 goto error; 194 } 195 196 ddf_msg(LVL_DEBUG, "Set CORB base registers"); 197 197 198 198 /* Update CORB base registers */ … … 200 200 hda_reg32_write(&hda->regs->corbubase, UPPER32(hda->ctl->corb_phys)); 201 201 202 ddf_msg(LVL_ NOTE, "Reset CORB Read/Write pointers");202 ddf_msg(LVL_DEBUG, "Reset CORB Read/Write pointers"); 203 203 204 204 /* Reset CORB Read Pointer */ … … 206 206 BIT_V(uint16_t, corbrp_rst)); 207 207 if (rc != EOK) { 208 ddf_msg(LVL_ NOTE, "Failed resetting CORBRP");208 ddf_msg(LVL_ERROR, "Failed resetting CORBRP"); 209 209 goto error; 210 210 } … … 215 215 /* Start CORB */ 216 216 ctl = hda_reg8_read(&hda->regs->corbctl); 217 ddf_msg(LVL_ NOTE, "CORBctl (0x%x) = 0x%x",217 ddf_msg(LVL_DEBUG, "CORBctl (0x%x) = 0x%x", 218 218 (unsigned)((void *)&hda->regs->corbctl - (void *)hda->regs), ctl | BIT_V(uint8_t, corbctl_run)); 219 219 hda_reg8_write(&hda->regs->corbctl, ctl | BIT_V(uint8_t, corbctl_run)); 220 220 221 ddf_msg(LVL_ NOTE, "CORB initialized");221 ddf_msg(LVL_DEBUG, "CORB initialized"); 222 222 return EOK; 223 223 error: … … 251 251 errno_t rc; 252 252 253 ddf_msg(LVL_ NOTE, "hda_rirb_init()");253 ddf_msg(LVL_DEBUG, "hda_rirb_init()"); 254 254 255 255 /* Stop RIRB if not stopped */ 256 256 ctl = hda_reg8_read(&hda->regs->rirbctl); 257 257 if ((ctl & BIT_V(uint8_t, rirbctl_run)) != 0) { 258 ddf_msg(LVL_ NOTE, "RIRB is enabled, disabling first.");258 ddf_msg(LVL_DEBUG, "RIRB is enabled, disabling first."); 259 259 hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t, 260 260 rirbctl_run)); … … 273 273 rirbsz = rirbsz | (selsz << rirbsize_size_l); 274 274 275 ddf_msg(LVL_ NOTE, "Setting RIRB Size register to 0x%x", rirbsz);275 ddf_msg(LVL_DEBUG, "Setting RIRB Size register to 0x%x", rirbsz); 276 276 hda_reg8_write(&hda->regs->rirbsize, rirbsz); 277 277 hda->ctl->rirb_entries = hda_rb_entries(selsz); … … 287 287 if (rc != EOK) { 288 288 hda->ctl->rirb_virt = NULL; 289 ddf_msg(LVL_ NOTE, "Failed allocating DMA memory for RIRB");290 goto error; 291 } 292 293 ddf_msg(LVL_ NOTE, "Set RIRB base registers");289 ddf_msg(LVL_ERROR, "Failed allocating DMA memory for RIRB"); 290 goto error; 291 } 292 293 ddf_msg(LVL_DEBUG, "Set RIRB base registers"); 294 294 295 295 /* Update RIRB base registers */ … … 297 297 hda_reg32_write(&hda->regs->rirbubase, UPPER32(hda->ctl->rirb_phys)); 298 298 299 ddf_msg(LVL_ NOTE, "Reset RIRB Write pointer");299 ddf_msg(LVL_DEBUG, "Reset RIRB Write pointer"); 300 300 301 301 /* Reset RIRB Write Pointer */ … … 309 309 /* Start RIRB and enable RIRB interrupt */ 310 310 ctl = hda_reg8_read(&hda->regs->rirbctl); 311 ddf_msg(LVL_ NOTE, "RIRBctl (0x%x) = 0x%x",311 ddf_msg(LVL_DEBUG, "RIRBctl (0x%x) = 0x%x", 312 312 (unsigned)((void *)&hda->regs->rirbctl - (void *)hda->regs), ctl | BIT_V(uint8_t, rirbctl_run)); 313 313 hda_reg8_write(&hda->regs->rirbctl, ctl | BIT_V(uint8_t, rirbctl_run) | 314 314 BIT_V(uint8_t, rirbctl_int)); 315 315 316 ddf_msg(LVL_ NOTE, "RIRB initialized");316 ddf_msg(LVL_DEBUG, "RIRB initialized"); 317 317 return EOK; 318 318 error: … … 479 479 480 480 if (hda->ctl->solrb_wp == hda->ctl->solrb_rp) { 481 ddf_msg(LVL_ NOTE, "hda_solrb_read() - last ditch effort process RIRB");481 ddf_msg(LVL_DEBUG, "hda_solrb_read() - last ditch effort process RIRB"); 482 482 fibril_mutex_unlock(&hda->ctl->solrb_lock); 483 483 hda_ctl_process_rirb(hda->ctl); … … 486 486 487 487 if (hda->ctl->solrb_wp == hda->ctl->solrb_rp) { 488 ddf_msg(LVL_ NOTE, "hda_solrb_read() time out");488 ddf_msg(LVL_DEBUG, "hda_solrb_read() time out"); 489 489 fibril_mutex_unlock(&hda->ctl->solrb_lock); 490 490 return ETIMEOUT; … … 525 525 } 526 526 527 ddf_msg(LVL_ NOTE, "reg 0x%zx STATESTS = 0x%x",527 ddf_msg(LVL_DEBUG, "reg 0x%zx STATESTS = 0x%x", 528 528 (void *)&hda->regs->statests - (void *)hda->regs, 529 529 hda_reg16_read(&hda->regs->statests)); … … 534 534 hda_reg16_write(&hda->regs->statests, 0x7f); 535 535 536 ddf_msg(LVL_ NOTE, "after clearing reg 0x%zx STATESTS = 0x%x",536 ddf_msg(LVL_DEBUG, "after clearing reg 0x%zx STATESTS = 0x%x", 537 537 (void *)&hda->regs->statests - (void *)hda->regs, 538 538 hda_reg16_read(&hda->regs->statests)); … … 540 540 gctl = hda_reg32_read(&hda->regs->gctl); 541 541 if ((gctl & BIT_V(uint32_t, gctl_crst)) != 0) { 542 ddf_msg(LVL_ NOTE, "Controller not in reset. Resetting.");542 ddf_msg(LVL_DEBUG, "Controller not in reset. Resetting."); 543 543 hda_reg32_write(&hda->regs->gctl, gctl & ~BIT_V(uint32_t, gctl_crst)); 544 544 } 545 545 546 ddf_msg(LVL_ NOTE, "Taking controller out of reset.");546 ddf_msg(LVL_DEBUG, "Taking controller out of reset."); 547 547 hda_reg32_write(&hda->regs->gctl, gctl | BIT_V(uint32_t, gctl_crst)); 548 548 … … 552 552 gctl = hda_reg32_read(&hda->regs->gctl); 553 553 if ((gctl & BIT_V(uint32_t, gctl_crst)) != 0) { 554 ddf_msg(LVL_ NOTE, "gctl=0x%x", gctl);554 ddf_msg(LVL_DEBUG, "gctl=0x%x", gctl); 555 555 break; 556 556 } 557 557 558 ddf_msg(LVL_ NOTE, "Waiting for controller to initialize.");558 ddf_msg(LVL_DEBUG, "Waiting for controller to initialize."); 559 559 fibril_usleep(100 * 1000); 560 560 --cnt; … … 566 566 } 567 567 568 ddf_msg(LVL_ NOTE, "Controller is out of reset.");569 570 ddf_msg(LVL_ NOTE, "Read GCAP");568 ddf_msg(LVL_DEBUG, "Controller is out of reset."); 569 570 ddf_msg(LVL_DEBUG, "Read GCAP"); 571 571 uint16_t gcap = hda_reg16_read(&hda->regs->gcap); 572 572 ctl->ok64bit = (gcap & BIT_V(uint16_t, gcap_64ok)) != 0; … … 574 574 ctl->iss = BIT_RANGE_EXTRACT(uint16_t, gcap_iss_h, gcap_iss_l, gcap); 575 575 ctl->bss = BIT_RANGE_EXTRACT(uint16_t, gcap_bss_h, gcap_bss_l, gcap); 576 ddf_msg(LVL_ NOTE, "GCAP: 0x%x (64OK=%d)", gcap, ctl->ok64bit);577 ddf_msg(LVL_ NOTE, "iss: %d, oss: %d, bss: %d\n",576 ddf_msg(LVL_DEBUG, "GCAP: 0x%x (64OK=%d)", gcap, ctl->ok64bit); 577 ddf_msg(LVL_DEBUG, "iss: %d, oss: %d, bss: %d\n", 578 578 ctl->iss, ctl->oss, ctl->bss); 579 579 /* Give codecs enough time to enumerate themselves */ 580 580 fibril_usleep(codec_enum_wait_us); 581 581 582 ddf_msg(LVL_ NOTE, "STATESTS = 0x%x",582 ddf_msg(LVL_DEBUG, "STATESTS = 0x%x", 583 583 hda_reg16_read(&hda->regs->statests)); 584 584 585 585 /* Enable interrupts */ 586 586 intctl = hda_reg32_read(&hda->regs->intctl); 587 ddf_msg(LVL_ NOTE, "intctl (0x%x) := 0x%x",587 ddf_msg(LVL_DEBUG, "intctl (0x%x) := 0x%x", 588 588 (unsigned)((void *)&hda->regs->intctl - (void *)hda->regs), 589 589 intctl | BIT_V(uint32_t, intctl_gie) | BIT_V(uint32_t, intctl_cie)); … … 600 600 goto error; 601 601 602 ddf_msg(LVL_ NOTE, "call hda_codec_init()");602 ddf_msg(LVL_DEBUG, "call hda_codec_init()"); 603 603 hda->ctl->codec = hda_codec_init(hda, 0); 604 604 if (hda->ctl->codec == NULL) { 605 ddf_msg(LVL_ NOTE, "hda_codec_init() failed");606 goto error; 607 } 608 609 ddf_msg(LVL_ NOTE, "intsts=0x%x", hda_reg32_read(&hda->regs->intsts));610 ddf_msg(LVL_ NOTE, "sdesc[%d].sts=0x%x",605 ddf_msg(LVL_DEBUG, "hda_codec_init() failed"); 606 goto error; 607 } 608 609 ddf_msg(LVL_DEBUG, "intsts=0x%x", hda_reg32_read(&hda->regs->intsts)); 610 ddf_msg(LVL_DEBUG, "sdesc[%d].sts=0x%x", 611 611 hda->ctl->iss, hda_reg8_read(&hda->regs->sdesc[hda->ctl->iss].sts)); 612 612 … … 622 622 void hda_ctl_fini(hda_ctl_t *ctl) 623 623 { 624 ddf_msg(LVL_ NOTE, "hda_ctl_fini()");624 ddf_msg(LVL_DEBUG, "hda_ctl_fini()"); 625 625 hda_rirb_fini(ctl->hda); 626 626 hda_corb_fini(ctl->hda); … … 677 677 void hda_ctl_dump_info(hda_ctl_t *ctl) 678 678 { 679 ddf_msg(LVL_ NOTE, "corbwp=%d, corbrp=%d",679 ddf_msg(LVL_DEBUG, "corbwp=%d, corbrp=%d", 680 680 hda_reg16_read(&ctl->hda->regs->corbwp), 681 681 hda_reg16_read(&ctl->hda->regs->corbrp)); 682 ddf_msg(LVL_ NOTE, "corbctl=0x%x, corbsts=0x%x",682 ddf_msg(LVL_DEBUG, "corbctl=0x%x, corbsts=0x%x", 683 683 hda_reg8_read(&ctl->hda->regs->corbctl), 684 684 hda_reg8_read(&ctl->hda->regs->corbsts)); 685 ddf_msg(LVL_ NOTE, "rirbwp=0x%x, soft-rirbrp=0x%zx",685 ddf_msg(LVL_DEBUG, "rirbwp=0x%x, soft-rirbrp=0x%zx", 686 686 hda_reg16_read(&ctl->hda->regs->rirbwp), 687 687 ctl->rirb_rp); 688 ddf_msg(LVL_ NOTE, "solrb_wp=0x%zx, solrb_rp=0x%zx",688 ddf_msg(LVL_DEBUG, "solrb_wp=0x%zx, solrb_rp=0x%zx", 689 689 ctl->solrb_wp, ctl->solrb_wp); 690 690 }
Note:
See TracChangeset
for help on using the changeset viewer.