From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH v2] ACPI: D3 states cleanup Date: Fri, 20 Apr 2012 13:12:54 +0200 Message-ID: <201204201312.54949.rjw@sisk.pl> References: <1334884749.4927.6.camel@minggr> <1334900255.4927.36.camel@minggr> <20120420074725.GA30140@localhost.amd.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from ogre.sisk.pl ([193.178.161.156]:55038 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754068Ab2DTLIS (ORCPT ); Fri, 20 Apr 2012 07:08:18 -0400 In-Reply-To: <20120420074725.GA30140@localhost.amd.com> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Aaron Lu Cc: Lin Ming , Len Brown , linux-acpi , linux-kernel@vger.kernel.org, Zhang Rui , "Huang, Ying" On Friday, April 20, 2012, Aaron Lu wrote: > Hi, > > On Fri, Apr 20, 2012 at 01:37:35PM +0800, Lin Ming wrote: > > > > > > There are two ACPI D3 states defined now: > > > > > > ACPI_STATE_D3 and ACPI_STATE_D3_COLD. > > > > > > > > > > > > But the uses of these states are not clear/correct in some code. > > > > > > For example, some code refer ACPI_STATE_D3 as D3hot and others refer > > > > > > it as D3cold. > > > > > > > > > > > > This patch introduces ACPI_STATE_D3_HOT to refer to ACPI D3hot state. > > > > > > And changes ACPI_STATE_D3 to refer to ACPI D3cold state only. > > > > > > Also redefines ACPI_STATE_D3_COLD the same as ACPI_STATE_D3. > > > > > > > > > > > > > > > > With this patch now, if a device has _PS3, then we will set its D3hot > > > > > flag valid. This doesn't feel right to me, since per our discussion the > > > > > other day, we should assume _PS3 will put the device into D3cold. > > > > > > > > > > Or do you mean: if _PS3 is available, then both D3hot and D3cold is > > > > > valid from the perspective of acpi, it is the individual driver's > > > > > responsibility to decide which state is actually valid and will be used. > > > > > > > > Right. > > > > > > > > ACPI_STATE_D3(same as ACPI_STATE_D3_COLD now) is always valid. > > > > > > > > > > I mean, if _PS3 is available, can we say D3hot is valid? > > > > Yes. > > > > OK, now I'm confused... > > First, let me try to clarify the meaning of acpi power state's valid > flag. > > By valid, I suppose it means the device can be in that state, instead of > we have a way to program this device to go into that state. > > e.g. D0 is valid means the device can be in D0 state, and D3_cold is > valid means the device can be in D3_cold state. We unconditionally set > these two states as valid, because we know every device supports these > two states. But we might not be able to put the device into that state > in software, since we might not have _PS0 or _PS3 control methods for it. > > And if we do have the _PSx or _PRx control methods, we knows we have a > way to put the device into that state, and hence the device should be > able to support that power state, so we will set that state as valid too. > > Is this correct? > > For D3hot, obviously not all device supports this state, so we will need > to figure it out through the acpi table. > I remembered Rafael said the following words the other day in a reply to > my evaluate_ps3_when_entering_d3_cold_patch: > > ----------------------------------------------------------------------- > I'd rather say that with _PR3 we have the opportunity to avoid removing > power completely from the device. In other words, D3_hot is supported (and > it is supported _only_ in that case). > ----------------------------------------------------------------------- > > So I think here is a problem, that if a device has only _PS3, why should > we say D3hot is supported? Is there a reason for this that I missed? OK, I agree. We need to special case the situation in which _PR3 is not present, but _PS3 is. IOW, we should do something like this in the loop in acpi_bus_get_power_flags(): /* State is valid if we have some power control */ if (ps->resources.count || (ps->flags.explicit_set && i < ACPI_STATE_D3)) ps->flags.valid = 1; Thanks, Rafael