ata: ahci: Support state with min power but Partial low power state
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fri, 27 Jul 2018 20:47:02 +0000 (13:47 -0700)
committerTejun Heo <tj@kernel.org>
Mon, 30 Jul 2018 14:09:10 +0000 (07:09 -0700)
Currently when min_power policy is selected, the partial low power state
is not entered and link will try aggressively enter to only slumber state.
Add a new policy which still enable DEVSLP but also try to enter partial
low power state. This policy is presented as "min_power_with_partial".

For information the difference between partial and slumber
Partial – PHY logic is powered up, and in a reduced power state. The link
PM exit latency to active state maximum is 10 ns.
Slumber – PHY logic is powered up, and in a reduced power state. The link
PM exit latency to active state maximum is 10 ms.
Devslp – PHY logic is powered down. The link PM exit latency from this
state to active state maximum is 20 ms, unless otherwise specified by
DETO.

Suggested-and-reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/libahci.c
drivers/ata/libata-core.c
drivers/ata/libata-scsi.c
include/linux/libata.h

index 5038cee..f79dce6 100644 (file)
@@ -800,6 +800,8 @@ static int ahci_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
                        cmd |= PORT_CMD_ALPE;
                        if (policy == ATA_LPM_MIN_POWER)
                                cmd |= PORT_CMD_ASP;
+                       else if (policy == ATA_LPM_MIN_POWER_WITH_PARTIAL)
+                               cmd &= ~PORT_CMD_ASP;
 
                        /* write out new cmd value */
                        writel(cmd, port_mmio + PORT_CMD);
@@ -810,7 +812,8 @@ static int ahci_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
        if ((hpriv->cap2 & HOST_CAP2_SDS) &&
            (hpriv->cap2 & HOST_CAP2_SADM) &&
            (link->device->flags & ATA_DFLAG_DEVSLP)) {
-               if (policy == ATA_LPM_MIN_POWER)
+               if (policy == ATA_LPM_MIN_POWER ||
+                   policy == ATA_LPM_MIN_POWER_WITH_PARTIAL)
                        ahci_set_aggressive_devslp(ap, true);
                else
                        ahci_set_aggressive_devslp(ap, false);
index 1e28d05..f1b1be1 100644 (file)
@@ -3967,6 +3967,7 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
                scontrol |= (0x6 << 8);
                break;
        case ATA_LPM_MED_POWER_WITH_DIPM:
+       case ATA_LPM_MIN_POWER_WITH_PARTIAL:
        case ATA_LPM_MIN_POWER:
                if (ata_link_nr_enabled(link) > 0)
                        /* no restrictions on LPM transitions */
index 980190c..63c25f1 100644 (file)
@@ -110,6 +110,7 @@ static const char *ata_lpm_policy_names[] = {
        [ATA_LPM_MAX_POWER]             = "max_performance",
        [ATA_LPM_MED_POWER]             = "medium_power",
        [ATA_LPM_MED_POWER_WITH_DIPM]   = "med_power_with_dipm",
+       [ATA_LPM_MIN_POWER_WITH_PARTIAL] = "min_power_with_partial",
        [ATA_LPM_MIN_POWER]             = "min_power",
 };
 
index aa85836..80c2bd2 100644 (file)
@@ -522,7 +522,8 @@ enum ata_lpm_policy {
        ATA_LPM_MAX_POWER,
        ATA_LPM_MED_POWER,
        ATA_LPM_MED_POWER_WITH_DIPM, /* Med power + DIPM as win IRST does */
-       ATA_LPM_MIN_POWER,
+       ATA_LPM_MIN_POWER_WITH_PARTIAL, /* Min Power + partial and slumber */
+       ATA_LPM_MIN_POWER, /* Min power + no partial (slumber only) */
 };
 
 enum ata_lpm_hints {