Re: [PATCH RFC] support sata odd zero power

su henry
2010-06-28T07:35:03Z

On Fri, Jun 25, 2010 at 10:01 PM, James Bottomley
<James.Bottomley@suse.de> wrote:
> On Fri, 2010-06-25 at 18:15 +0800, su henry wrote:
>> From b221e73b802ccfe5338b575dc0ff3b687acdd6fa Mon Sep 17 00:00:00 2001
>> From: henry su <henry.su.ati@gmail.com>
>> Date: Fri, 25 Jun 2010 00:08:42 +0800
>> Subject: [PATCH RFC] support sata odd zero power
>>
>> In order to extend the battery life of Mobile PC system, the host should remove
>> the power supply to the Optical Disc Drive (logical unit) when it detects the
>> logical unit with no media and tray closed, and the host starts the power
>> supply to the logical unit when it detects user action to the logical unit that
>> the power supply is omitted.
>
>> The patch evaluates the _PS3 method to remove the power supply to the ODD if
>> the host detects MEDIUM NOT PRESENT - TRAY CLOSED is reported by REQUEST SENSE
>> command for a Drawer, Tray or Pop-up type drive, or MEDIUM NOT PRESENT -
>> TRAY CLOSED for a slot/caddy type drive; on the other hand, the patch evaluates
>> the _PS0 method to restart the power supply to the ODD when the user
>> presses the
>> button on a tray type drive or inserts a CD to a slot/caddy type drive.
>>
>> PLDS DS-8A5S, pansonic UJ892 and UJ897 are the ODD samples used to test
>> the patch on AMD SB800 platforms.
>>
>> Signed-off-by: Henry Su <henry.su.ati@gmail.com>
>
> The first observation I'd have is a big meta one:  This all needs to
> work on non ACPI systems ... given that it relies on unstubbed ACPI
> functions, I don't think it does, does it?
>
> What I'd suggest is confining it all to sr_acpi.c and hooking it in to
> the test unit ready and init/exit ... that way the code only need be
> present if ACPI is.

Yes, it only works on a systems that supports ACPI functions, and that
system BIOS provides the _PS0/_PS3 method to start/stop the power
supply.

Besides a new driver to support the zero power odd, another suggestion
is adding the "#ifdef CONFIG_ACPI" in sr.c to separate the code.

>
> [...]
>> @@ -786,6 +853,7 @@ static void get_capabilities(struct scsi_cd *cd)
>>       }
>>
>>       n = data.header_length + data.block_descriptor_length;
>> +     sr_zpodd_device.mechtype = buffer[n + 6] >> 5;
>>       cd->cdi.speed = ((buffer[n + 8] << 8) + buffer[n + 9]) / 176;
>>       cd->readcd_known = 1;
>>       cd->readcd_cdda = buffer[n + 5] & 0x01;
>
> This piece of data should probably be added to struct scsi_cd .. we
> already use it in the routine anyway for printing out the tray type.

Agree. It is fine to add the mechanism type to scsi_cd or cdrom_device_info.

>
> James
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html