All of lore.kernel.org
 help / color / mirror / Atom feed
* any way to evaluate a device's _PS0 method when its power state is at D0?
@ 2011-05-19 10:06 aaron lwe
  2011-05-19 12:42 ` Matthew Garrett
  0 siblings, 1 reply; 6+ messages in thread
From: aaron lwe @ 2011-05-19 10:06 UTC (permalink / raw)
  To: linux-acpi

Hi,

On init, a device's power state is set by acpi_bus_init_power, it got
the information either via power_resources or via _PSC.

My BIOS vendor here did this simply as follows:

Device (xx)
{
        Name (ABPS, 0)

        Method (_PSC, 0, NotSerialized)
        {
                Return (ABPS)
        }
}

So on init, this device's power state will be set to D0 due to ABPS is
0, but its _PS0 never get called.
If later I want to evaluate its _PS0 control method, what should I do?
acpi_bus_set_power will return if it found the set state is the same
with the current state.

Thanks,
Aaron

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

* Re: any way to evaluate a device's _PS0 method when its power state is at D0?
  2011-05-19 10:06 any way to evaluate a device's _PS0 method when its power state is at D0? aaron lwe
@ 2011-05-19 12:42 ` Matthew Garrett
  2011-05-19 15:05   ` aaron lwe
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Garrett @ 2011-05-19 12:42 UTC (permalink / raw)
  To: aaron lwe; +Cc: linux-acpi

On Thu, May 19, 2011 at 06:06:47PM +0800, aaron lwe wrote:

> So on init, this device's power state will be set to D0 due to ABPS is
> 0, but its _PS0 never get called.
> If later I want to evaluate its _PS0 control method, what should I do?
> acpi_bus_set_power will return if it found the set state is the same
> with the current state.

Why do you want to evaluate its _PS0 method?

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

* Re: any way to evaluate a device's _PS0 method when its power state is at D0?
  2011-05-19 12:42 ` Matthew Garrett
@ 2011-05-19 15:05   ` aaron lwe
  2011-05-19 15:14     ` Matthew Garrett
  0 siblings, 1 reply; 6+ messages in thread
From: aaron lwe @ 2011-05-19 15:05 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: linux-acpi

On Thu, May 19, 2011 at 8:42 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Thu, May 19, 2011 at 06:06:47PM +0800, aaron lwe wrote:
>
>> So on init, this device's power state will be set to D0 due to ABPS is
>> 0, but its _PS0 never get called.
>> If later I want to evaluate its _PS0 control method, what should I do?
>> acpi_bus_set_power will return if it found the set state is the same
>> with the current state.
>
> Why do you want to evaluate its _PS0 method?

Hi Matthew,

The following is a simplified code that this device did by
disassembling the DSDT table.
When I put the device to D3, and later changed its state back to D0, I
got a problem due to HASD is never set to 1:
Device (xx)
{
        Name (ABPS, 0)
	Name (HASD, 0)

        Method (_PSC, 0, NotSerialized)
        {
                Return (ABPS)
        }

	Method (_PS0, 0, NotSerialized)
	{
		If (LOr (LEqual (HASD, 1), LAnd(LEqual(HASD, 0), LEqual(PORT, 1))))
		{
			// do things to re-power this device
			Store (1, HASD)
		}
	}
}

PORT is a bit field defined in an operation region, it's an io port
value which is used to detect if a device is there.
HASD is used to store if a device is there.

First I put the device to D3, and then put it back to D0, due to _PS0
is never evaluated before, HASD is 0.
And since the device is powered off, the PORT will also be 0. And
thus, I can't re-power this device.

This control method depends on it being evaluated once during boot, so
that it can set HASD to 1.

Since this device's state is set to D0 in acpi_bus_init_power without
evaluating _PS0 control method, and I need HASD to be set to 1 for
_PS0 to be evaluated effectively when I put the device back to D0 from
D3, I'll need to evaluate _PS0 when this device's power state is at
D0.

Thanks,
Aaron

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

* Re: any way to evaluate a device's _PS0 method when its power state is at D0?
  2011-05-19 15:05   ` aaron lwe
@ 2011-05-19 15:14     ` Matthew Garrett
  2011-05-19 15:28       ` aaron lwe
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Garrett @ 2011-05-19 15:14 UTC (permalink / raw)
  To: aaron lwe; +Cc: linux-acpi

On Thu, May 19, 2011 at 11:05:24PM +0800, aaron lwe wrote:

> Since this device's state is set to D0 in acpi_bus_init_power without
> evaluating _PS0 control method, and I need HASD to be set to 1 for
> _PS0 to be evaluated effectively when I put the device back to D0 from
> D3, I'll need to evaluate _PS0 when this device's power state is at
> D0.

Ok, so that sounds like we need to call _PS0 on initial device setup. 
It'd be better to do that than to try to figure out a way for oyu to 
call it later.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

* Re: any way to evaluate a device's _PS0 method when its power state is at D0?
  2011-05-19 15:14     ` Matthew Garrett
@ 2011-05-19 15:28       ` aaron lwe
  2011-05-19 15:45         ` Matthew Garrett
  0 siblings, 1 reply; 6+ messages in thread
From: aaron lwe @ 2011-05-19 15:28 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: linux-acpi

On Thu, May 19, 2011 at 11:14 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Thu, May 19, 2011 at 11:05:24PM +0800, aaron lwe wrote:
>
>> Since this device's state is set to D0 in acpi_bus_init_power without
>> evaluating _PS0 control method, and I need HASD to be set to 1 for
>> _PS0 to be evaluated effectively when I put the device back to D0 from
>> D3, I'll need to evaluate _PS0 when this device's power state is at
>> D0.
>
> Ok, so that sounds like we need to call _PS0 on initial device setup.
> It'd be better to do that than to try to figure out a way for oyu to
> call it later.

Totally agree ;-)
So are you going to write a patch for this?

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

* Re: any way to evaluate a device's _PS0 method when its power state is at D0?
  2011-05-19 15:28       ` aaron lwe
@ 2011-05-19 15:45         ` Matthew Garrett
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Garrett @ 2011-05-19 15:45 UTC (permalink / raw)
  To: aaron lwe; +Cc: linux-acpi

On Thu, May 19, 2011 at 11:28:45PM +0800, aaron lwe wrote:
> On Thu, May 19, 2011 at 11:14 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > Ok, so that sounds like we need to call _PS0 on initial device setup.
> > It'd be better to do that than to try to figure out a way for oyu to
> > call it later.
> 
> Totally agree ;-)
> So are you going to write a patch for this?

I've a pile of other things that I need to fix at the moment, but with 
luck someone will...

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

end of thread, other threads:[~2011-05-19 15:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 10:06 any way to evaluate a device's _PS0 method when its power state is at D0? aaron lwe
2011-05-19 12:42 ` Matthew Garrett
2011-05-19 15:05   ` aaron lwe
2011-05-19 15:14     ` Matthew Garrett
2011-05-19 15:28       ` aaron lwe
2011-05-19 15:45         ` Matthew Garrett

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.