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


Ignore:
Timestamp:
2014-08-26T15:32:19Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9bae8b8
Parents:
c67195c
Message:

Enable interrupt in IRC and max all input and output amps.

File:
1 edited

Legend:

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

    rc67195c r1e92bc3  
    5555};
    5656
     57static void hda_ctl_process_rirb(hda_ctl_t *);
     58
    5759/** Perform set-reset handshake on a 16-bit register.
    5860 *
     
    407409        int wcnt;
    408410
    409         ddf_msg(LVL_NOTE, "hda_solrb_read()");
    410         wcnt = 100;
    411 
    412         ddf_msg(LVL_NOTE, "hda_solrb_read() - lock mutex");
     411        ddf_msg(LVL_DEBUG, "hda_solrb_read()");
     412
    413413        fibril_mutex_lock(&hda->ctl->solrb_lock);
    414414
    415415        while (count > 0) {
    416                 ddf_msg(LVL_NOTE, "hda_solrb_read() - while(1)");
    417416                while (count > 0 && hda->ctl->solrb_rp != hda->ctl->solrb_wp) {
    418                         ddf_msg(LVL_NOTE, "hda_solrb_read() - while(2)");
    419417                        ++hda->ctl->solrb_rp;
    420418                        resp = hda->ctl->solrb[hda->ctl->solrb_rp];
    421419
    422                         ddf_msg(LVL_NOTE, "solrb RESPONSE resp=0x%x respex=0x%x",
     420                        ddf_msg(LVL_DEBUG2, "solrb RESPONSE resp=0x%x respex=0x%x",
    423421                            resp.resp, resp.respex);
    424422                        if ((resp.respex & BIT_V(uint32_t, respex_unsol)) == 0) {
     
    430428
    431429                if (count > 0) {
    432                         ddf_msg(LVL_NOTE, "hda_solrb_read() - count > 0");
     430                        wcnt = 100;
    433431                        while (wcnt > 0 && hda->ctl->solrb_wp == hda->ctl->solrb_rp) {
    434                                 ddf_msg(LVL_NOTE, "hda_solrb_read() - while(3), wcnt=%d", wcnt);
    435432                                fibril_mutex_unlock(&hda->ctl->solrb_lock);
    436                                 ddf_msg(LVL_NOTE, "hda_solrb_read() - sleep");
    437433                                async_usleep(10000);
    438                                 ddf_msg(LVL_NOTE, "hda_solrb_read() - re-lock");
    439434                                fibril_mutex_lock(&hda->ctl->solrb_lock);
    440435                                --wcnt;
     
    442437
    443438                        if (hda->ctl->solrb_wp == hda->ctl->solrb_rp) {
     439                                ddf_msg(LVL_NOTE, "hda_solrb_read() - last ditch effort process RIRB");
     440                                fibril_mutex_unlock(&hda->ctl->solrb_lock);
     441                                hda_ctl_process_rirb(hda->ctl);
     442                                fibril_mutex_lock(&hda->ctl->solrb_lock);
     443                        }
     444
     445                        if (hda->ctl->solrb_wp == hda->ctl->solrb_rp) {
    444446                                ddf_msg(LVL_NOTE, "hda_solrb_read() time out");
    445                                 ddf_msg(LVL_NOTE, "corbwp=%d corbrp=%d",
    446                                     hda_reg16_read(&hda->regs->corbwp),
    447                                     hda_reg16_read(&hda->regs->corbrp));
    448                                 ddf_msg(LVL_NOTE, "corbctl=0x%x, corbsts=0x%x",
    449                                     hda_reg8_read(&hda->regs->corbctl),
    450                                     hda_reg8_read(&hda->regs->corbsts));
    451                                 ddf_msg(LVL_NOTE, "rirbwp=%d",
    452                                     hda_reg16_read(&hda->regs->rirbwp));
    453                                 ddf_msg(LVL_NOTE, "rirbctl=0x%x, rirbsts=0x%x",
    454                                     hda_reg8_read(&hda->regs->rirbctl),
    455                                     hda_reg8_read(&hda->regs->rirbsts));
    456447                                fibril_mutex_unlock(&hda->ctl->solrb_lock);
    457448                                return ETIMEOUT;
     
    461452
    462453        fibril_mutex_unlock(&hda->ctl->solrb_lock);
    463         ddf_msg(LVL_NOTE, "hda_solrb_read() success");
    464454        return EOK;
    465455}
     
    613603}
    614604
    615 void hda_ctl_interrupt(hda_ctl_t *ctl)
     605static void hda_ctl_process_rirb(hda_ctl_t *ctl)
    616606{
    617607        hda_rirb_entry_t resp;
     
    625615                }
    626616
    627                 ddf_msg(LVL_NOTE, "writing to solrb");
     617                ddf_msg(LVL_DEBUG2, "writing to solrb");
    628618                fibril_mutex_lock(&ctl->solrb_lock);
    629619                ctl->solrb_wp = (ctl->solrb_wp + 1) % softrb_entries;
     
    634624}
    635625
     626void hda_ctl_interrupt(hda_ctl_t *ctl)
     627{
     628        hda_ctl_process_rirb(ctl);
     629}
     630
    636631/** @}
    637632 */
Note: See TracChangeset for help on using the changeset viewer.