linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [patch 1/2] allow user to power off unused ports via sysfs
@ 2008-09-28 21:58 Jeffrey W. Baker
  2008-09-29 23:49 ` Kristen Carlson Accardi
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey W. Baker @ 2008-09-28 21:58 UTC (permalink / raw)
  To: linux-ide; +Cc: kristen.c.accardi

I tried this patch and it doesn't work on ICH8 because it violates AHCI
protocol.

kristen.c.accardi@intel.com wrote:
> --- linux-ahci-phy.orig/drivers/ata/libata-core.c	2008-06-27 13:32:51.000000000 -0700
> +++ linux-ahci-phy/drivers/ata/libata-core.c	2008-07-01 16:33:00.000000000 -0700
> @@ -162,6 +162,19 @@ MODULE_DESCRIPTION("Library module for A
>  MODULE_LICENSE("GPL");
>  MODULE_VERSION(DRV_VERSION);
>  
> +static void ata_phy_offline(struct ata_link *link)
> +{
> +	u32 scontrol;
> +	int rc;
> +
> +	/* set DET to 4 */
> +	rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
> +	if (rc)
> +		return;
> +	scontrol &= ~0xf;
> +	scontrol |= (1 << 2);
> +	sata_scr_write(link, SCR_CONTROL, scontrol);
> +}

On AHCI, you can't change SCTL.DET when the port is running.  This
version of ata_phy_offline changes SCTL.DET without regard to CMD.ST.

I would propose something more like this:

static void ata_port_offline(struct ata_port *ap)
{
        u32 scontrol;
        int rc;
        struct ata_link *link = &ap->link;

        if (ap->ops->port_stop)
                ap->ops->port_stop(ap);

        rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
        if (rc)
                return;

        scontrol &= ~0xf;
        scontrol |= (1<<2);

        sata_scr_write(link, SCR_CONTROL, scontrol);
}

I tried the above on ICH8 and by poking around in /dev/mem I believe it
works.  After I set the ALPM to power_off in sysfs, the port shows
CMD.ST == 0, CMD.FRE == 0, and SSTS.DET == 4.  So I think this is the
way to go, at least with respect to AHCI.  I can't say whether this
makes sense generally for the other users of libata-core.

The problem is I didn't save any power this way :(  ThinkPad X61t was
using minimum 7.6W on a one-minute average before power_off, and same
power after power_off.  I'd been led to believe that disabling these
ports would have a substantial power saving effect.

-jwb


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

end of thread, other threads:[~2008-10-15 16:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080702225743.518230210@intel.com>
2008-07-02 23:14 ` [patch 1/2] allow user to power off unused ports via sysfs kristen.c.accardi
2008-07-04 12:58   ` Jeff Garzik
2008-07-11 13:50   ` Jeff Garzik
2008-07-02 23:14 ` [patch 2/2] set default of ahci driver to power off unused ports kristen.c.accardi
2008-07-04 13:02   ` Jeff Garzik
2008-09-28 21:58 [patch 1/2] allow user to power off unused ports via sysfs Jeffrey W. Baker
2008-09-29 23:49 ` Kristen Carlson Accardi
2008-10-15 16:43   ` Kristen Carlson Accardi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).