linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][ACPI] AC/DC notifier
@ 2009-08-11 20:15 Mark Langsdorf
  2009-08-11 23:49 ` [PATCH]AC/DC notifier Matthew Garrett
  2009-10-06 17:56 ` Len Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Langsdorf @ 2009-08-11 20:15 UTC (permalink / raw)
  To: lenb, linux-acpi, linux-kernel, matthew.tippett, samuel.li

Add an ACPI event notifier for AC/DC connect/disconnect events.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>

---
 drivers/acpi/ac.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 0df8fcb..656b903 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -243,6 +243,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
 		acpi_bus_generate_netlink_event(device->pnp.device_class,
 						  dev_name(&device->dev), event,
 						  (u32) ac->state);
+		acpi_notifier_call_chain(device, event, (u32) ac->state);
 #ifdef CONFIG_ACPI_SYSFS_POWER
 		kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
 #endif
-- 
1.6.0.2

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

* Re: [PATCH]AC/DC notifier
  2009-08-11 20:15 [PATCH][ACPI] AC/DC notifier Mark Langsdorf
@ 2009-08-11 23:49 ` Matthew Garrett
  2009-10-06 17:56 ` Len Brown
  1 sibling, 0 replies; 7+ messages in thread
From: Matthew Garrett @ 2009-08-11 23:49 UTC (permalink / raw)
  To: Mark Langsdorf; +Cc: lenb, linux-acpi, linux-kernel, matthew.tippett, samuel.li

On Tue, Aug 11, 2009 at 03:15:42PM -0500, Mark Langsdorf wrote:
> Add an ACPI event notifier for AC/DC connect/disconnect events.

Not that I inherently disagree with this, but what's it likely to be 
used for?

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

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

* Re: [PATCH][ACPI] AC/DC notifier
  2009-08-12  0:55 ` Matthew Garrett
@ 2009-08-14 16:32   ` Pavel Machek
  2009-08-16  7:40     ` [PATCH]AC/DC notifier Willy Tarreau
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Machek @ 2009-08-14 16:32 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Tippett, Matthew, Langsdorf, Mark, lenb, linux-acpi, linux-kernel,
	Li, Samuel

On Wed 2009-08-12 01:55:32, Matthew Garrett wrote:
> On Tue, Aug 11, 2009 at 08:51:49PM -0400, Tippett, Matthew wrote:
> 
> >    From a graphics perspective (your area of expertise), this will allow KMS
> >    drivers to do some more intelligent actions based on the ac/dc state. 
> >    Some examples of this could be improving the power consumption of the
> >    graphics hardware through adapting clock memory/engine settings for
> >    reduced power consumption, reducing refresh rate of the display to reduce
> >    scanout memory access, adjusting backlight brightness, etc.
> 
> Right. As you say, my concern is that most of this should belong in 
> userspace. Where we risk hardware damage there's an obvious argument for 
> doing this in kernel, but we should ensure that that's limited to 
> whatever coarse-grain handling is absolutely required rather than doing 
> things like touching display brightness.

Yep... Some may want to save power even when AC is online -- like when
running on UPS. Some may want max performmance even on battery. 
								Pavel 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH]AC/DC notifier
  2009-08-11 20:15 [PATCH][ACPI] AC/DC notifier Mark Langsdorf
  2009-08-11 23:49 ` [PATCH]AC/DC notifier Matthew Garrett
@ 2009-10-06 17:56 ` Len Brown
  1 sibling, 0 replies; 7+ messages in thread
From: Len Brown @ 2009-10-06 17:56 UTC (permalink / raw)
  To: Mark Langsdorf; +Cc: linux-acpi, linux-kernel, matthew.tippett, samuel.li

applied

thanks,
Len Brown, Intel Open Source Technology Center


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

* Re: [PATCH][ACPI] AC/DC notifier
  2009-10-06 14:53       ` Tippett, Matthew
@ 2009-10-07  7:31         ` Pavel Machek
  2009-10-07  8:16           ` Dave Airlie
  2009-10-07 17:00           ` Tippett, Matthew
  0 siblings, 2 replies; 7+ messages in thread
From: Pavel Machek @ 2009-10-07  7:31 UTC (permalink / raw)
  To: Tippett, Matthew
  Cc: Willy Tarreau, Matthew Garrett, Langsdorf, Mark, lenb, linux-acpi,
	linux-kernel, Li, Samuel

On Tue 2009-10-06 10:53:22, Tippett, Matthew wrote:
> (Resending as text-only - sorry)
>
> Bringing this item back up again.
>
> I am not suggesting that the application of any particular policy  
> appears within the kernel or userspace or a secondary policy engine.    
> In general I am also against codifying policy within drivers.
>
> I am interested seeing the ACPI notifier mechanism expanded to allow  
> AC/DC state changes propagate to other kernel drivers without requiring  
> a userspace in between.
>
> I can continue to come up with real scenarios that would possibly  
> require kernel-to-kernel notification, but would rather focus this  
> discussion of the pure technical issues associated with adding the  
> notifier to the AC/DC ACPI subsystem. 

Please do. So far you did not show valid use for such notifier.

(Ok, I know of one. Old amd64 notebooks had cpufreq scaling enabled,
with battery unable to supply enough current to feed the CPU at
highest cpufreq setting. At that point, scaling cpufreq down at unplug
is correctness issue, and AC/DC notifier in kernel makes
sense.)

So... what do you want to use it for?
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH][ACPI] AC/DC notifier
  2009-10-07  7:31         ` [PATCH][ACPI] AC/DC notifier Pavel Machek
@ 2009-10-07  8:16           ` Dave Airlie
  2009-10-07 17:00           ` Tippett, Matthew
  1 sibling, 0 replies; 7+ messages in thread
From: Dave Airlie @ 2009-10-07  8:16 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Tippett, Matthew, Willy Tarreau, Matthew Garrett, Langsdorf, Mark,
	lenb, linux-acpi, linux-kernel, Li, Samuel

On Wed, Oct 7, 2009 at 5:31 PM, Pavel Machek <pavel@ucw.cz> wrote:
> On Tue 2009-10-06 10:53:22, Tippett, Matthew wrote:
>> (Resending as text-only - sorry)
>>
>> Bringing this item back up again.
>>
>> I am not suggesting that the application of any particular policy
>> appears within the kernel or userspace or a secondary policy engine.
>> In general I am also against codifying policy within drivers.
>>
>> I am interested seeing the ACPI notifier mechanism expanded to allow
>> AC/DC state changes propagate to other kernel drivers without requiring
>> a userspace in between.
>>
>> I can continue to come up with real scenarios that would possibly
>> require kernel-to-kernel notification, but would rather focus this
>> discussion of the pure technical issues associated with adding the
>> notifier to the AC/DC ACPI subsystem.
>
> Please do. So far you did not show valid use for such notifier.
>
> (Ok, I know of one. Old amd64 notebooks had cpufreq scaling enabled,
> with battery unable to supply enough current to feed the CPU at
> highest cpufreq setting. At that point, scaling cpufreq down at unplug
> is correctness issue, and AC/DC notifier in kernel makes
> sense.)
>
> So... what do you want to use it for?

I'm not sure we have a open driver use case for this, if not I suggest
we remove it and only add it when a user is added to the kernel.

Dave.

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

* Re: [PATCH][ACPI] AC/DC notifier
  2009-10-07  7:31         ` [PATCH][ACPI] AC/DC notifier Pavel Machek
  2009-10-07  8:16           ` Dave Airlie
@ 2009-10-07 17:00           ` Tippett, Matthew
  1 sibling, 0 replies; 7+ messages in thread
From: Tippett, Matthew @ 2009-10-07 17:00 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Willy Tarreau, Matthew Garrett, Langsdorf, Mark, lenb, linux-acpi,
	linux-kernel, Li, Samuel

(Resending in text-only  sorry for the noise to the individual recipients)

Comments below.

-------- Original Message  --------
Subject: Re: [PATCH][ACPI] AC/DC notifier
From: Pavel Machek <pavel@ucw.cz>
To: Tippett, Matthew <matthew.tippett@amd.com>
Cc: "Willy Tarreau" <w@1wt.eu>, "Matthew Garrett" <mjg59@srcf.ucam.org>, 
"Langsdorf, Mark" <mark.langsdorf@amd.com>, lenb@kernel.org, 
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Li, Samuel" 
<Samuel.Li@amd.com>
Date: 10/07/2009 03:31 AM
>
> On Tue 2009-10-06 10:53:22, Tippett, Matthew wrote:
>
> Please do. So far you did not show valid use for such notifier.
>
> (Ok, I know of one. Old amd64 notebooks had cpufreq scaling enabled,
> with battery unable to supply enough current to feed the CPU at
> highest cpufreq setting. At that point, scaling cpufreq down at unplug
> is correctness issue, and AC/DC notifier in kernel makes
> sense.)
>
> So... what do you want to use it for?
>
We have a general requirement from OEMs and consequently our shared 
Windows/Linux components that the AC/DC state is accurately known.

The concrete examples of use include at least the following.

    1) Automatic frequency scaling has an AC-mode and a DC-mode in 
Powerplay tables in the GPU BIOS ensures that the highest permitted 
clocks fit the system design. This allows at least
        i) system level thermals and power consumption to be managed 
(eg: you shouldn't have the clocks up high if the system fan has been 
asked to slow down). 
        ii) protection of hardware high clocks with a low-current 
battery is a bad idea.
    2) The pixel clock can only drive certain modes with certain engine 
and memory clocks, in DC-mode you will have lower clocks and 
consequently you will need to change the pixel clock and hence the mode 
to something that fits within the budget, otherwise the 3D or display 
engine may not be able to get the bandwidth required to operate effectively.
    3) OEM OS equivalency.  Some OEMs care that Linux has the same 
thermal, power and performance characteristics as other operating 
systems.  This requires that the software act in a similar way and 
reduces OEM/ODM/IHV/OSV validation and deployment costs.

In particular 1 and 2 are very relevant for KMS based drivers.

1 is most likely relevant for other ACPI/SBIOS related hardware 
components that rely on co-operating components doing what is expected 
by the system design.  If a device doesn't change it's behaviour in sync 
with other devices when AC/DC changes, then bad (or at the very least 
annoying) things may happen.  When there is a SBIOS/ACPI/Driver stack in 
place, the driver should honor the system design as well.

3 is only really relevant for the commercial side of things, but is a 
real issue that takes up more engineering effort than the first 2 - my 
cross to bear so to speak.

Regards,

Matthew

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

end of thread, other threads:[~2009-10-07 17:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-11 20:15 [PATCH][ACPI] AC/DC notifier Mark Langsdorf
2009-08-11 23:49 ` [PATCH]AC/DC notifier Matthew Garrett
2009-10-06 17:56 ` Len Brown
     [not found] <FFAE0590FF35E441901B67BD8BA62E950245ABD9@storexmb3.amd.com>
2009-08-12  0:55 ` Matthew Garrett
2009-08-14 16:32   ` [PATCH][ACPI] AC/DC notifier Pavel Machek
2009-08-16  7:40     ` [PATCH]AC/DC notifier Willy Tarreau
2009-10-06 14:53       ` Tippett, Matthew
2009-10-07  7:31         ` [PATCH][ACPI] AC/DC notifier Pavel Machek
2009-10-07  8:16           ` Dave Airlie
2009-10-07 17:00           ` Tippett, Matthew

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).