aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-acpi.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2007-11-01 21:32:38 -0400
committerJeff Garzik <jeff@garzik.org>2008-01-23 05:24:09 -0500
commitbd3adca52bc43b72c75db3e4c7809d47923b154c (patch)
treeec42456926e50a4b0adf916ac1c5f39f76e057f8 /drivers/ata/libata-acpi.c
parentae8d4ee7ff429136c8b482c3b38ed994c021d3fc (diff)
libata-acpi: add ACPI _PSx method
ACPI spec (ver 3.0a, p289) requires IDE power on/off executes ACPI _PSx methods. As recently most PATA drivers use libata, this patch adds _PSx method support in libata. ACPI spec doesn't mention if SATA requires the same _PSx method. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Acked-by: Len Brown <len.brown@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-acpi.c')
-rw-r--r--drivers/ata/libata-acpi.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 7bf4befd96bc..ebc4dfcf2f19 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -776,6 +776,36 @@ void ata_acpi_on_resume(struct ata_port *ap)
776} 776}
777 777
778/** 778/**
779 * ata_acpi_set_state - set the port power state
780 * @ap: target ATA port
781 * @state: state, on/off
782 *
783 * This function executes the _PS0/_PS3 ACPI method to set the power state.
784 * ACPI spec requires _PS0 when IDE power on and _PS3 when power off
785 */
786void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
787{
788 struct ata_device *dev;
789
790 if (!ap->acpi_handle || (ap->flags & ATA_FLAG_ACPI_SATA))
791 return;
792
793 /* channel first and then drives for power on and vica versa
794 for power off */
795 if (state.event == PM_EVENT_ON)
796 acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D0);
797
798 ata_link_for_each_dev(dev, &ap->link) {
799 if (dev->acpi_handle && ata_dev_enabled(dev))
800 acpi_bus_set_power(dev->acpi_handle,
801 state.event == PM_EVENT_ON ?
802 ACPI_STATE_D0 : ACPI_STATE_D3);
803 }
804 if (state.event != PM_EVENT_ON)
805 acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D3);
806}
807
808/**
779 * ata_acpi_on_devcfg - ATA ACPI hook called on device donfiguration 809 * ata_acpi_on_devcfg - ATA ACPI hook called on device donfiguration
780 * @dev: target ATA device 810 * @dev: target ATA device
781 * 811 *