public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Hack to fix not working spindown over Firewire
@ 2008-04-29 23:26 Tino Keitel
  2008-04-30 13:31 ` Stefan Richter
  0 siblings, 1 reply; 21+ messages in thread
From: Tino Keitel @ 2008-04-29 23:26 UTC (permalink / raw)
  To: linux-kernel, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

Hi folks,

I like the manage_start_stop feature of the SD driver to spin down the
hard disks (SATA and USB) during suspend. However, it didn't work with
my Firewire hard disk.

After some research I found out that I can spin down the disk with
sg_start --pc=2, and spin it up with sg_start --pc=1. I adopted this
into sd_start_stop_device() with the vendor name of the device
hardcoded (see the attached patch) and now my Firewire hard disk spins
down on suspend and spins up on resume.

Is there any chance to get this behaviour without such ugly changes to
the kernel? I had to make it conditional by checking the device as
otherwise the SATA disk reports an error.

Regards,
Tino

[-- Attachment #2: start_stop_unit_set_power_condition_v2.diff --]
[-- Type: text/x-diff, Size: 592 bytes --]

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3cea17d..4d7dbd6 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1788,8 +1788,16 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
 	struct scsi_device *sdp = sdkp->device;
 	int res;
 
-	if (start)
+	if (start) {
 		cmd[4] |= 1;	/* START */
+		if(!strncmp(sdp->vendor, "WDC WD32", 8)) {
+			cmd[4] |= (1 << 4); /* power condition */
+		}
+	} else {
+		if(!strncmp(sdp->vendor, "WDC WD32", 8)) {
+			cmd[4] |= (2 << 4); /* power condition */
+		}
+	}
 
 	if (!scsi_device_online(sdp))
 		return -ENODEV;

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2008-05-19 17:19 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-29 23:26 Hack to fix not working spindown over Firewire Tino Keitel
2008-04-30 13:31 ` Stefan Richter
2008-04-30 13:36   ` Stefan Richter
2008-05-09 20:16     ` Clean patch " Tino Keitel
2008-05-09 21:13       ` Stefan Richter
2008-05-09 22:02         ` Stefan Richter
2008-05-07 18:00   ` Hack " Tino Keitel
2008-05-09 18:32     ` Stefan Richter
2008-05-10 15:31       ` Stefan Richter
2008-05-10 22:32         ` [PATCH 0/5] SCSI and FireWire: fix/add START STOP UNIT for SBP-2 disks Stefan Richter
2008-05-10 22:34           ` [PATCH 1/5] scsi: sd: optionally set power condition in START STOP UNIT Stefan Richter
2008-05-10 22:35             ` [PATCH 2/5] firewire: fw-sbp2: fix spindown for PL-3507 and TSB42AA9 firmwares Stefan Richter
2008-05-10 22:35               ` [PATCH 3/5] ieee1394: sbp2: " Stefan Richter
2008-05-10 22:36                 ` [PATCH 4/5] firewire: fw-sbp2: spin disks down on suspend and shutdown Stefan Richter
2008-05-10 22:37                   ` [PATCH 5/5] ieee1394: sbp2: " Stefan Richter
2008-05-16  6:23           ` [PATCH 0/5] SCSI and FireWire: fix/add START STOP UNIT for SBP-2 disks Tino Keitel
2008-05-16 17:43             ` Stefan Richter
2008-05-18 17:35               ` Tino Keitel
2008-05-18 20:32                 ` Stefan Richter
2008-05-19 17:18                 ` Stefan Richter
2008-05-10 22:53       ` Hack to fix not working spindown over Firewire Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox