Changeset cf78637 in mainline for uspace/drv/audio/hdaudio/hdactl.c


Ignore:
Timestamp:
2019-12-15T11:57:25Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9e45a41
Parents:
894afff
Message:

Fix logging level of HD Audio driver messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/hdaudio/hdactl.c

    r894afff rcf78637  
    154154        errno_t rc;
    155155
    156         ddf_msg(LVL_NOTE, "hda_corb_init()");
     156        ddf_msg(LVL_DEBUG, "hda_corb_init()");
    157157
    158158        /* Stop CORB if not stopped */
    159159        ctl = hda_reg8_read(&hda->regs->corbctl);
    160160        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.");
    162162                hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t,
    163163                    corbctl_run));
     
    176176        corbsz = corbsz | selsz;
    177177
    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);
    179179        hda_reg8_write(&hda->regs->corbsize, corbsz);
    180180        hda->ctl->corb_entries = hda_rb_entries(selsz);
     
    190190        if (rc != EOK) {
    191191                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");
    197197
    198198        /* Update CORB base registers */
     
    200200        hda_reg32_write(&hda->regs->corbubase, UPPER32(hda->ctl->corb_phys));
    201201
    202         ddf_msg(LVL_NOTE, "Reset CORB Read/Write pointers");
     202        ddf_msg(LVL_DEBUG, "Reset CORB Read/Write pointers");
    203203
    204204        /* Reset CORB Read Pointer */
     
    206206            BIT_V(uint16_t, corbrp_rst));
    207207        if (rc != EOK) {
    208                 ddf_msg(LVL_NOTE, "Failed resetting CORBRP");
     208                ddf_msg(LVL_ERROR, "Failed resetting CORBRP");
    209209                goto error;
    210210        }
     
    215215        /* Start CORB */
    216216        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",
    218218            (unsigned)((void *)&hda->regs->corbctl - (void *)hda->regs), ctl | BIT_V(uint8_t, corbctl_run));
    219219        hda_reg8_write(&hda->regs->corbctl, ctl | BIT_V(uint8_t, corbctl_run));
    220220
    221         ddf_msg(LVL_NOTE, "CORB initialized");
     221        ddf_msg(LVL_DEBUG, "CORB initialized");
    222222        return EOK;
    223223error:
     
    251251        errno_t rc;
    252252
    253         ddf_msg(LVL_NOTE, "hda_rirb_init()");
     253        ddf_msg(LVL_DEBUG, "hda_rirb_init()");
    254254
    255255        /* Stop RIRB if not stopped */
    256256        ctl = hda_reg8_read(&hda->regs->rirbctl);
    257257        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.");
    259259                hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t,
    260260                    rirbctl_run));
     
    273273        rirbsz = rirbsz | (selsz << rirbsize_size_l);
    274274
    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);
    276276        hda_reg8_write(&hda->regs->rirbsize, rirbsz);
    277277        hda->ctl->rirb_entries = hda_rb_entries(selsz);
     
    287287        if (rc != EOK) {
    288288                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");
    294294
    295295        /* Update RIRB base registers */
     
    297297        hda_reg32_write(&hda->regs->rirbubase, UPPER32(hda->ctl->rirb_phys));
    298298
    299         ddf_msg(LVL_NOTE, "Reset RIRB Write pointer");
     299        ddf_msg(LVL_DEBUG, "Reset RIRB Write pointer");
    300300
    301301        /* Reset RIRB Write Pointer */
     
    309309        /* Start RIRB and enable RIRB interrupt */
    310310        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",
    312312            (unsigned)((void *)&hda->regs->rirbctl - (void *)hda->regs), ctl | BIT_V(uint8_t, rirbctl_run));
    313313        hda_reg8_write(&hda->regs->rirbctl, ctl | BIT_V(uint8_t, rirbctl_run) |
    314314            BIT_V(uint8_t, rirbctl_int));
    315315
    316         ddf_msg(LVL_NOTE, "RIRB initialized");
     316        ddf_msg(LVL_DEBUG, "RIRB initialized");
    317317        return EOK;
    318318error:
     
    479479
    480480                        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");
    482482                                fibril_mutex_unlock(&hda->ctl->solrb_lock);
    483483                                hda_ctl_process_rirb(hda->ctl);
     
    486486
    487487                        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");
    489489                                fibril_mutex_unlock(&hda->ctl->solrb_lock);
    490490                                return ETIMEOUT;
     
    525525        }
    526526
    527         ddf_msg(LVL_NOTE, "reg 0x%zx STATESTS = 0x%x",
     527        ddf_msg(LVL_DEBUG, "reg 0x%zx STATESTS = 0x%x",
    528528            (void *)&hda->regs->statests - (void *)hda->regs,
    529529            hda_reg16_read(&hda->regs->statests));
     
    534534        hda_reg16_write(&hda->regs->statests, 0x7f);
    535535
    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",
    537537            (void *)&hda->regs->statests - (void *)hda->regs,
    538538            hda_reg16_read(&hda->regs->statests));
     
    540540        gctl = hda_reg32_read(&hda->regs->gctl);
    541541        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.");
    543543                hda_reg32_write(&hda->regs->gctl, gctl & ~BIT_V(uint32_t, gctl_crst));
    544544        }
    545545
    546         ddf_msg(LVL_NOTE, "Taking controller out of reset.");
     546        ddf_msg(LVL_DEBUG, "Taking controller out of reset.");
    547547        hda_reg32_write(&hda->regs->gctl, gctl | BIT_V(uint32_t, gctl_crst));
    548548
     
    552552                gctl = hda_reg32_read(&hda->regs->gctl);
    553553                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);
    555555                        break;
    556556                }
    557557
    558                 ddf_msg(LVL_NOTE, "Waiting for controller to initialize.");
     558                ddf_msg(LVL_DEBUG, "Waiting for controller to initialize.");
    559559                fibril_usleep(100 * 1000);
    560560                --cnt;
     
    566566        }
    567567
    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");
    571571        uint16_t gcap = hda_reg16_read(&hda->regs->gcap);
    572572        ctl->ok64bit = (gcap & BIT_V(uint16_t, gcap_64ok)) != 0;
     
    574574        ctl->iss = BIT_RANGE_EXTRACT(uint16_t, gcap_iss_h, gcap_iss_l, gcap);
    575575        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",
    578578            ctl->iss, ctl->oss, ctl->bss);
    579579        /* Give codecs enough time to enumerate themselves */
    580580        fibril_usleep(codec_enum_wait_us);
    581581
    582         ddf_msg(LVL_NOTE, "STATESTS = 0x%x",
     582        ddf_msg(LVL_DEBUG, "STATESTS = 0x%x",
    583583            hda_reg16_read(&hda->regs->statests));
    584584
    585585        /* Enable interrupts */
    586586        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",
    588588            (unsigned)((void *)&hda->regs->intctl - (void *)hda->regs),
    589589            intctl | BIT_V(uint32_t, intctl_gie) | BIT_V(uint32_t, intctl_cie));
     
    600600                goto error;
    601601
    602         ddf_msg(LVL_NOTE, "call hda_codec_init()");
     602        ddf_msg(LVL_DEBUG, "call hda_codec_init()");
    603603        hda->ctl->codec = hda_codec_init(hda, 0);
    604604        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",
    611611            hda->ctl->iss, hda_reg8_read(&hda->regs->sdesc[hda->ctl->iss].sts));
    612612
     
    622622void hda_ctl_fini(hda_ctl_t *ctl)
    623623{
    624         ddf_msg(LVL_NOTE, "hda_ctl_fini()");
     624        ddf_msg(LVL_DEBUG, "hda_ctl_fini()");
    625625        hda_rirb_fini(ctl->hda);
    626626        hda_corb_fini(ctl->hda);
     
    677677void hda_ctl_dump_info(hda_ctl_t *ctl)
    678678{
    679         ddf_msg(LVL_NOTE, "corbwp=%d, corbrp=%d",
     679        ddf_msg(LVL_DEBUG, "corbwp=%d, corbrp=%d",
    680680            hda_reg16_read(&ctl->hda->regs->corbwp),
    681681            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",
    683683            hda_reg8_read(&ctl->hda->regs->corbctl),
    684684            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",
    686686            hda_reg16_read(&ctl->hda->regs->rirbwp),
    687687            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",
    689689            ctl->solrb_wp, ctl->solrb_wp);
    690690}
Note: See TracChangeset for help on using the changeset viewer.