aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2007-10-11 17:53:58 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:53:58 -0400
commit5e32132befa5d2cefadf3141fee0bbb40cd11f0e (patch)
tree7bf2002e49b169d24b87a8fe71364875e04d1e90 /drivers/ide/ide.c
parent8cb1f567f4c0a2fde9cbf77c2af888a28cab3423 (diff)
ide: hook ACPI _PSx method to IDE power on/off
ACPI spec defines the sequence of IDE power on/off: Powering down: Call _GTM. Power down drive (calls _PS3 method and turns off power planes). Powering up: Power up drive (calls _PS0 method if present and turns on power planes). Call _STM passing info from _GTM (possibly modified), with ID data from each drive. Initialize the channel. May modify the results of _GTF. For each drive: Call _GTF. Execute task file (possibly modified). This patch adds the missed _PS0/_PS3 methods call. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Acked-by: Len Brown <len.brown@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r--drivers/ide/ide.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index de54306789a1..9fdc1fe1b299 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -915,6 +915,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
915 struct request rq; 915 struct request rq;
916 struct request_pm_state rqpm; 916 struct request_pm_state rqpm;
917 ide_task_t args; 917 ide_task_t args;
918 int ret;
918 919
919 /* Call ACPI _GTM only once */ 920 /* Call ACPI _GTM only once */
920 if (!(drive->dn % 2)) 921 if (!(drive->dn % 2))
@@ -931,7 +932,14 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
931 mesg.event = PM_EVENT_FREEZE; 932 mesg.event = PM_EVENT_FREEZE;
932 rqpm.pm_state = mesg.event; 933 rqpm.pm_state = mesg.event;
933 934
934 return ide_do_drive_cmd(drive, &rq, ide_wait); 935 ret = ide_do_drive_cmd(drive, &rq, ide_wait);
936 /* only call ACPI _PS3 after both drivers are suspended */
937 if (!ret && (((drive->dn % 2) && hwif->drives[0].present
938 && hwif->drives[1].present)
939 || !hwif->drives[0].present
940 || !hwif->drives[1].present))
941 ide_acpi_set_state(hwif, 0);
942 return ret;
935} 943}
936 944
937static int generic_ide_resume(struct device *dev) 945static int generic_ide_resume(struct device *dev)
@@ -944,8 +952,10 @@ static int generic_ide_resume(struct device *dev)
944 int err; 952 int err;
945 953
946 /* Call ACPI _STM only once */ 954 /* Call ACPI _STM only once */
947 if (!(drive->dn % 2)) 955 if (!(drive->dn % 2)) {
956 ide_acpi_set_state(hwif, 1);
948 ide_acpi_push_timing(hwif); 957 ide_acpi_push_timing(hwif);
958 }
949 959
950 ide_acpi_exec_tfs(drive); 960 ide_acpi_exec_tfs(drive);
951 961