Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .

Ticket #201: madwifi-suspend.patch

File madwifi-suspend.patch, 2.2 kB (added by svens@gmx.de, 14 years ago)
  • ath/if_ath_pci.c

    old new  
    154154        pci_read_config_dword(pdev, 0x40, &val); 
    155155        if ((val & 0x0000ff00) != 0) 
    156156                pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); 
    157  
     157        pci_set_power_state(pdev, PCI_D0); 
    158158        phymem = pci_resource_start(pdev, 0); 
    159159        if (!request_mem_region(phymem, pci_resource_len(pdev, 0), "ath")) { 
    160160                printk(KERN_ERR "ath_pci: cannot reserve PCI memory region\n"); 
     
    246246        PCI_SAVE_STATE(pdev, 
    247247                ((struct ath_pci_softc *)dev->priv)->aps_pmstate); 
    248248        pci_disable_device(pdev); 
    249         if (pci_set_power_state(pdev, 3)); /* XXX: what? */ 
     249        pci_set_power_state(pdev, PCI_D3hot); /* XXX: what? */ 
    250250 
    251251        return (0); 
    252252} 
     
    256256{ 
    257257        struct net_device *dev = pci_get_drvdata(pdev); 
    258258        u32 val; 
     259        pci_set_power_state(pdev, PCI_D0); 
    259260 
    260         if (!pci_enable_device(pdev)) 
    261                 return 1; 
    262261        /* XXX - Should this return nonzero on fail? */ 
    263262        PCI_RESTORE_STATE(pdev, 
    264263                ((struct ath_pci_softc *)dev->priv)->aps_pmstate); 
    265         /* 
     264      
     265        pci_enable_device(pdev); 
     266        pci_set_master(pdev); 
     267        /* 
    266268         * Suspend/Resume resets the PCI configuration space, so we have to 
    267269         * re-disable the RETRY_TIMEOUT register (0x41) to keep 
    268270         * PCI Tx retries from interfering with C3 CPU state 
  • ath/if_ath.c

    old new  
    12211224        struct ath_softc *sc = dev->priv; 
    12221225 
    12231226        DPRINTF(sc, ATH_DEBUG_ANY, "%s: flags %x\n", __func__, dev->flags); 
    1224         ath_stop(dev); 
     1227        ath_hal_setpower(sc->sc_ah, HAL_PM_FULL_SLEEP); 
     1228/*      ath_stop(dev);*/ 
    12251229} 
    12261230 
    12271231void 
     
    12301234        struct ath_softc *sc = dev->priv; 
    12311235 
    12321236        DPRINTF(sc, ATH_DEBUG_ANY, "%s: flags %x\n", __func__, dev->flags); 
    1233         ath_init(dev); 
     1237        ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE); 
     1238        ath_reset(dev); 
     1239/*      ath_init(dev);*/ 
    12341240} 
    12351241 
    12361242void 
     
    12391245        struct ath_softc *sc = dev->priv; 
    12401246 
    12411247        DPRINTF(sc, ATH_DEBUG_ANY, "%s: flags %x\n", __func__, dev->flags); 
    1242         ath_stop(dev); 
     1248        ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE); 
     1249/*      ath_stop(dev);*/ 
    12431250} 
    12441251 
    12451252static void