From: Jeff Garzik <jgarzik@pobox.com>
To: Aaron Lu <aaron.lu@intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Oliver Neukum <oliver@neukum.org>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org,
Aaron Lu <aaron.lwe@gmail.com>
Subject: Re: [PATCH v7 3/6] scsi: sr: support zero power ODD(ZPODD)
Date: Mon, 24 Sep 2012 17:55:04 -0400 [thread overview]
Message-ID: <5060D6B8.9030006@pobox.com> (raw)
In-Reply-To: <1347438597-5903-4-git-send-email-aaron.lu@intel.com>
On 09/12/2012 04:29 AM, Aaron Lu wrote:
> When ODD is runtime suspended, we will check if it is OK to remove
> its power:
> 1 For tray type, no medium inside and tray closed;
> 2 For slot type, no medium inside.
> And if yes, we will set the ready_to_power_off flag as an indication to
> ATA layer that it is safe to place this device into ACPI D3 cold power
> state.
>
> And when it is powered off, we will set the powered_off flag so that the
> periodically running check_events will not bother this device by simply
> return.
>
> Signed-off-by: Aaron Lu <aaron.lu@intel.com>
> ---
> drivers/ata/libata-acpi.c | 27 +++++++++++++++--------
> drivers/scsi/sr.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++
> drivers/scsi/sr.h | 1 +
> drivers/scsi/sr_ioctl.c | 7 +++++-
> include/scsi/scsi_device.h | 3 +++
> 5 files changed, 81 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
> index 902b5a4..9aca057 100644
> --- a/drivers/ata/libata-acpi.c
> +++ b/drivers/ata/libata-acpi.c
> @@ -854,7 +854,7 @@ void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
> {
> struct ata_device *dev;
> acpi_handle handle;
> - int acpi_state;
> + int acpi_state, ret;
>
> /* channel first and then drives for power on and vica versa
> for power off */
> @@ -869,17 +869,24 @@ void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
>
> if (state.event != PM_EVENT_ON) {
> acpi_state = acpi_pm_device_sleep_state(
> - &dev->sdev->sdev_gendev, NULL, ACPI_STATE_D3);
> - if (acpi_state > 0)
> - acpi_bus_set_power(handle, acpi_state);
> - /* TBD: need to check if it's runtime pm request */
> - acpi_pm_device_run_wake(
> - &dev->sdev->sdev_gendev, true);
> + &dev->sdev->sdev_gendev, NULL,
> + dev->sdev->ready_to_power_off ?
> + ACPI_STATE_D3 : ACPI_STATE_D3_HOT);
> + if (acpi_state > 0) {
> + ret = acpi_bus_set_power(handle, acpi_state);
> + if (!ret && acpi_state == ACPI_STATE_D3)
> + dev->sdev->powered_off = 1;
> +
> + /* TODO: check if it's runtime pm request */
> + acpi_pm_device_run_wake(
> + &dev->sdev->sdev_gendev, true);
> + }
> } else {
> /* Ditto */
> acpi_pm_device_run_wake(
> &dev->sdev->sdev_gendev, false);
> acpi_bus_set_power(handle, ACPI_STATE_D0);
> + dev->sdev->powered_off = 0;
> }
> }
>
> @@ -985,8 +992,10 @@ static void ata_acpi_wake_dev(acpi_handle handle, u32 event, void *context)
> struct ata_device *ata_dev = context;
>
> if (event == ACPI_NOTIFY_DEVICE_WAKE && ata_dev &&
> - pm_runtime_suspended(&ata_dev->sdev->sdev_gendev))
> - scsi_autopm_get_device(ata_dev->sdev);
> + ata_dev->sdev->powered_off) {
> + ata_dev->sdev->need_eject = 1;
> + pm_runtime_resume(&ata_dev->sdev->sdev_gendev);
> + }
> }
>
these bits are Acked-by: Jeff Garzik <jgarzik@redhat.com>
but obviously that is contingent upon acceptance of the upper level SCSI
and ACPI changes.
next prev parent reply other threads:[~2012-09-24 21:55 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 8:29 [PATCH v7 0/6] ZPODD patches Aaron Lu
2012-09-12 8:29 ` [PATCH v7 1/6] block: genhd: add an interface to set disk poll interval Aaron Lu
2012-09-20 20:35 ` Rafael J. Wysocki
2012-09-12 8:29 ` [PATCH v7 2/6] scsi: sr: support runtime pm Aaron Lu
2012-09-20 20:48 ` Rafael J. Wysocki
2012-09-20 20:54 ` Alan Stern
2012-09-21 1:02 ` Aaron Lu
2012-09-21 20:49 ` Rafael J. Wysocki
2012-09-24 1:20 ` Aaron Lu
2012-09-24 12:55 ` Rafael J. Wysocki
2012-09-24 14:52 ` Aaron Lu
2012-09-24 21:40 ` Rafael J. Wysocki
2012-09-25 8:01 ` Aaron Lu
2012-09-25 11:47 ` Rafael J. Wysocki
2012-09-25 14:20 ` Aaron Lu
2012-09-25 14:23 ` Oliver Neukum
2012-09-25 14:46 ` Aaron Lu
2012-09-25 21:45 ` Rafael J. Wysocki
2012-09-26 1:03 ` Aaron Lu
2012-09-26 11:18 ` Rafael J. Wysocki
2012-09-26 14:52 ` Aaron Lu
2012-09-26 7:20 ` Oliver Neukum
2012-09-27 10:46 ` Oliver Neukum
2012-09-28 8:20 ` Aaron Lu
2012-09-12 8:29 ` [PATCH v7 3/6] scsi: sr: support zero power ODD(ZPODD) Aaron Lu
2012-09-20 22:07 ` Rafael J. Wysocki
2012-09-21 1:39 ` Aaron Lu
2012-09-21 21:02 ` Rafael J. Wysocki
2012-09-27 9:26 ` Aaron Lu
2012-09-27 14:42 ` Alan Stern
2012-09-27 14:55 ` Aaron Lu
2012-09-27 23:29 ` Rafael J. Wysocki
2012-09-24 21:55 ` Jeff Garzik [this message]
2012-09-12 8:29 ` [PATCH v7 4/6] scsi: pm: add may_power_off flag Aaron Lu
2012-09-12 8:29 ` [PATCH v7 5/6] scsi: sr: use may_power_off Aaron Lu
2012-09-12 8:29 ` [PATCH v7 6/6] libata: acpi: respect may_power_off flag Aaron Lu
2012-09-24 21:55 ` Jeff Garzik
2012-09-19 8:03 ` [PATCH v7 0/6] ZPODD patches Aaron Lu
2012-09-19 12:27 ` James Bottomley
2012-09-19 12:50 ` Rafael J. Wysocki
2012-09-19 14:19 ` Aaron Lu
2012-09-20 20:00 ` Rafael J. Wysocki
2012-09-21 5:48 ` Aaron Lu
2012-09-21 21:18 ` Rafael J. Wysocki
2012-09-22 7:32 ` Oliver Neukum
2012-09-22 11:28 ` Rafael J. Wysocki
2012-09-22 15:38 ` Alan Stern
2012-09-22 19:46 ` Rafael J. Wysocki
2012-09-22 20:23 ` Alan Stern
2012-09-22 21:48 ` Rafael J. Wysocki
2012-09-24 2:55 ` Aaron Lu
2012-09-24 13:06 ` Rafael J. Wysocki
2012-09-24 15:04 ` Aaron Lu
2012-09-24 21:46 ` Rafael J. Wysocki
2012-09-25 8:18 ` Aaron Lu
2012-09-25 11:02 ` James Bottomley
2012-09-25 13:56 ` Aaron Lu
2012-09-27 9:43 ` Aaron Lu
2012-09-24 15:47 ` Alan Stern
2012-09-19 14:52 ` James Bottomley
2012-09-20 21:46 ` Rafael J. Wysocki
2012-09-19 13:05 ` Oliver Neukum
2012-09-19 15:19 ` David Woodhouse
2012-09-20 0:34 ` Jack Wang
[not found] ` <201209280115.06964.rjw@sisk.pl>
[not found] ` <5064FA08.6030005@intel.com>
[not found] ` <201209282346.15872.rjw@sisk.pl>
2012-09-29 2:10 ` [PATCH v7 2/6] scsi: sr: support runtime pm Aaron Lu
2012-09-29 14:29 ` Alan Stern
2012-09-29 15:03 ` Aaron Lu
2012-09-29 22:44 ` Rafael J. Wysocki
2012-09-30 12:32 ` Aaron Lu
2012-09-30 14:47 ` Alan Stern
2012-09-30 15:39 ` Aaron Lu
2012-09-30 19:15 ` Jeff Garzik
2012-09-30 19:08 ` Jeff Garzik
2012-09-29 22:31 ` Rafael J. Wysocki
2012-09-30 19:03 ` Jeff Garzik
2012-09-30 19:43 ` Alan Stern
2012-10-01 4:57 ` Jeff Garzik
2012-10-08 9:27 ` Aaron Lu
2012-10-08 10:21 ` James Bottomley
2012-10-09 7:20 ` Aaron Lu
2012-10-09 14:58 ` James Bottomley
2012-10-11 7:49 ` Aaron Lu
2012-10-09 23:26 ` Rafael J. Wysocki
2012-09-29 22:27 ` Rafael J. Wysocki
2012-09-30 12:38 ` Aaron Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5060D6B8.9030006@pobox.com \
--to=jgarzik@pobox.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=aaron.lu@intel.com \
--cc=aaron.lwe@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.