]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
libata: check zero power ready status for ZPODD
authorAaron Lu <aaron.lu@intel.com>
Tue, 15 Jan 2013 09:21:00 +0000 (17:21 +0800)
committerJeff Garzik <jgarzik@redhat.com>
Mon, 21 Jan 2013 20:41:34 +0000 (15:41 -0500)
commit3dc67440d99b2c718ef5f1eb1424a9066ffa3fb9
tree4eee59932d2b99daf76f2bca624c05e719a4b004
parentf064a20dded807448669426c9bfb7d03aba5659c
libata: check zero power ready status for ZPODD

Per the Mount Fuji spec, the ODD is considered zero power ready when:
  - For slot type ODD, no media inside;
  - For tray type ODD, no media inside and tray closed.

The information can be retrieved by either the returned information of
command GET_EVENT_STATUS_NOTIFICATION(the command is used to poll for
media event) or sense code.

The information provided by the media status byte is not accurate, it
is possible that after a new disc is just inserted, the status byte
still returns media not present. So this information can not be used as
the deciding factor, we use sense code to decide if zpready status is
true.

When we first sensed the ODD in the zero power ready state, the
zp_sampled will be set and timestamp will be recoreded. And after ODD
stayed in this state for some pre-defined period, the ODD is considered
as power off ready and the zp_ready flag will be set. The zp_ready flag
serves as the deciding factor other code will use to see if power off is
OK for the ODD.

The Mount Fuji spec suggests a delay should be used here, to avoid the
case user ejects the ODD and then instantly inserts a new one again, so
that we can avoid a power transition. And some ODDs may be slow to place
its head to the home position after disc is ejected, so a delay here is
generally a good idea. And the delay time can be changed via the module
param zpodd_poweroff_delay.

The zero power ready status check is performed in the ata port's runtime
suspend code path, when port is not frozen yet, as we need to issue some
IOs to the ODD.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/libata-eh.c
drivers/ata/libata-zpodd.c
drivers/ata/libata.h