Commit aecf22f1 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] ide: idle disk on resume

From: Jens Axboe <axboe@suse.de>

I need this patch to survive suspend on my powerbook, if the drive is
sleeping when suspend is entered.  Otherwise it freezes on resume when it
tries to read from the drive.

Acked by Ben.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 953a66b9
......@@ -1334,7 +1334,8 @@ enum {
idedisk_pm_flush_cache = ide_pm_state_start_suspend,
idedisk_pm_standby,
idedisk_pm_restore_dma = ide_pm_state_start_resume,
idedisk_pm_idle = ide_pm_state_start_resume,
idedisk_pm_restore_dma,
};
static void idedisk_complete_power_step (ide_drive_t *drive, struct request *rq, u8 stat, u8 error)
......@@ -1349,6 +1350,9 @@ static void idedisk_complete_power_step (ide_drive_t *drive, struct request *rq,
case idedisk_pm_standby: /* Suspend step 2 (standby) complete */
rq->pm->pm_step = ide_pm_state_completed;
break;
case idedisk_pm_idle: /* Resume step 1 (idle) complete */
rq->pm->pm_step = idedisk_pm_restore_dma;
break;
}
}
......@@ -1372,13 +1376,20 @@ static ide_startstop_t idedisk_start_power_step (ide_drive_t *drive, struct requ
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = &task_no_data_intr;
return do_rw_taskfile(drive, args);
case idedisk_pm_standby: /* Suspend step 2 (standby) */
args->tfRegister[IDE_COMMAND_OFFSET] = WIN_STANDBYNOW1;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = &task_no_data_intr;
return do_rw_taskfile(drive, args);
case idedisk_pm_restore_dma: /* Resume step 1 (restore DMA) */
case idedisk_pm_idle: /* Resume step 1 (idle) */
args->tfRegister[IDE_COMMAND_OFFSET] = WIN_IDLEIMMEDIATE;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
args->handler = task_no_data_intr;
return do_rw_taskfile(drive, args);
case idedisk_pm_restore_dma: /* Resume step 2 (restore DMA) */
/*
* Right now, all we do is call hwif->ide_dma_check(drive),
* we could be smarter and check for current xfer_speed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment