X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fide%2Fide-acpi.c;h=89df48fdc69d7b6109098153813524862fe4bff1;hb=df762464ad0fad721f9fc5724e85b3df0d550acd;hp=17aea65d7dd2af7dcc3a5ffce10fc9d3ec08dd7e;hpb=fe6af6faec078ec8137631f24cb541f9918244f0;p=linux-2.6-omap-h63xx.git diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 17aea65d7dd..89df48fdc69 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -350,7 +350,7 @@ static int taskfile_load_raw(ide_drive_t *drive, memset(&args, 0, sizeof(ide_task_t)); args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.data_phase = TASKFILE_IN; + args.data_phase = TASKFILE_NO_DATA; args.handler = &task_no_data_intr; /* convert gtf to IDE Taskfile */ @@ -611,6 +611,45 @@ void ide_acpi_push_timing(ide_hwif_t *hwif) } EXPORT_SYMBOL_GPL(ide_acpi_push_timing); +/** + * ide_acpi_set_state - set the channel power state + * @hwif: target IDE interface + * @on: state, on/off + * + * This function executes the _PS0/_PS3 ACPI method to set the power state. + * ACPI spec requires _PS0 when IDE power on and _PS3 when power off + */ +void ide_acpi_set_state(ide_hwif_t *hwif, int on) +{ + int unit; + + if (ide_noacpi) + return; + + DEBPRINT("ENTER:\n"); + + if (!hwif->acpidata) { + DEBPRINT("no ACPI data for %s\n", hwif->name); + return; + } + /* channel first and then drives for power on and verse versa for power off */ + if (on) + acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0); + for (unit = 0; unit < MAX_DRIVES; ++unit) { + ide_drive_t *drive = &hwif->drives[unit]; + + if (!drive->acpidata->obj_handle) + drive->acpidata->obj_handle = ide_acpi_drive_get_handle(drive); + + if (drive->acpidata->obj_handle && drive->present) { + acpi_bus_set_power(drive->acpidata->obj_handle, + on? ACPI_STATE_D0: ACPI_STATE_D3); + } + } + if (!on) + acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D3); +} + /** * ide_acpi_init - initialize the ACPI link for an IDE interface * @hwif: target IDE interface (channel) @@ -679,6 +718,8 @@ void ide_acpi_init(ide_hwif_t *hwif) return; } + /* ACPI _PS0 before _STM */ + ide_acpi_set_state(hwif, 1); /* * ACPI requires us to call _STM on startup */