summary refs log tree commit diff
path: root/drivers/ata/ahci_platform.c
diff options
context:
space:
mode:
authorSamuel Morris <samorris@lexmark.com>2018-05-29 10:06:12 +0000
committerTejun Heo <tj@kernel.org>2018-06-18 10:58:55 -0700
commitaece27a2f01be4bb7683790f69cd1bed3a0929a2 (patch)
tree7a54d8b35b74fe7df3f2e08755c2f01ef7d5f329 /drivers/ata/ahci_platform.c
parent332c42a9ff7f75a4d9dd263a6e5da32b45de12ec (diff)
downloadlinux-aece27a2f01be4bb7683790f69cd1bed3a0929a2.tar.gz
ata: ahci_platform: allow disabling of hotplug to save power
A number of resources remain powered to support hotplug. On platforms
I've worked with, allowing the ahci_platform to suspend saves about
150mW. This patch enables rpm and allows the device to be auto-suspended
through sysfs.

Signed-off-by: Samuel Morris <samorris@lexmark.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/ahci_platform.c')
-rw-r--r--drivers/ata/ahci_platform.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 99f9a895a459..757729376eda 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -68,8 +68,13 @@ disable_resources:
 	return rc;
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
-			 ahci_platform_resume);
+#ifdef CONFIG_PM_SLEEP
+static const struct dev_pm_ops ahci_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(ahci_platform_suspend, ahci_platform_resume)
+	SET_RUNTIME_PM_OPS(ahci_platform_runtime_suspend,
+			ahci_platform_runtime_resume, NULL)
+};
+#endif
 
 static const struct of_device_id ahci_of_match[] = {
 	{ .compatible = "generic-ahci", },
@@ -98,7 +103,9 @@ static struct platform_driver ahci_driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_of_match,
 		.acpi_match_table = ahci_acpi_match,
+#ifdef CONFIG_PM_SLEEP
 		.pm = &ahci_pm_ops,
+#endif
 	},
 };
 module_platform_driver(ahci_driver);