Changeset 25574

Show
Ignore:
Timestamp:
05/20/08 13:07:50 (6 months ago)
Author:
korli
Message:

wait for codec reset before attaching the codec

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c

    r25497 r25574  
    605605        status_t rv; 
    606606        unsigned char cmd; 
     607        int i; 
    607608 
    608609        PRINT(("auich_setup(%p)\n", card)); 
     
    664665                LOG(("cold reset failed\n")); 
    665666        } 
    666  
     667         
     668        for (i = 0; i < 500; i++) { 
     669                rv = auich_reg_read_32(&card->config, AUICH_REG_GLOB_STA); 
     670                if (rv & STA_S0CR) 
     671                        break; 
     672                snooze(1000); 
     673        } 
     674         
     675        if (!(rv & STA_S0CR)) { /* reset failure */ 
     676                /* It never return STA_S0CR in some cases */ 
     677                PRINT(("reset failure\n")); 
     678        } 
     679         
    667680        /* attach the codec */   
    668681        PRINT(("codec attach\n")); 
     
    671684                card->config.subvendor_id, card->config.subsystem_id); 
    672685         
    673         rv = auich_reg_read_32(&card->config, AUICH_REG_GLOB_STA); 
    674         if (!(rv & STA_S0CR)) { /* reset failure */ 
    675                 /* It never return STA_S0CR in some cases */ 
    676                 PRINT(("reset failure\n")); 
    677         } 
    678686        /* Print capabilities though there are no supports for now */ 
    679687        if ((rv & STA_SAMPLE_CAP) == STA_POM20) {