diff options
| -rw-r--r-- | drivers/ata/libahci.c | 15 | 
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 8a6835bfd18a..f76b8418e6fb 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -2323,6 +2323,18 @@ int ahci_port_resume(struct ata_port *ap)  EXPORT_SYMBOL_GPL(ahci_port_resume);  #ifdef CONFIG_PM +static void ahci_handle_s2idle(struct ata_port *ap) +{ +	void __iomem *port_mmio = ahci_port_base(ap); +	u32 devslp; + +	if (pm_suspend_via_firmware()) +		return; +	devslp = readl(port_mmio + PORT_DEVSLP); +	if ((devslp & PORT_DEVSLP_ADSE)) +		ata_msleep(ap, devslp_idle_timeout); +} +  static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)  {  	const char *emsg = NULL; @@ -2336,6 +2348,9 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)  		ata_port_freeze(ap);  	} +	if (acpi_storage_d3(ap->host->dev)) +		ahci_handle_s2idle(ap); +  	ahci_rpm_put_port(ap);  	return rc;  }  | 
