linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events
@ 2012-02-03 15:18 Matthew Garrett
  2012-02-03 15:18 ` [PATCH 2/3] ACPI: Provide config option to control automatic brightness switching Matthew Garrett
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matthew Garrett @ 2012-02-03 15:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: Matthew Garrett, linux-acpi, lenb

The default ACPI behaviour is to instruct the BIOS to automatically change
brightness on power events. This may be undesirable for distributions who
manage brightness in userspace. Provide a config option that disables this
behaviour and leaves brightness control up to the OS.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: linux-acpi@vger.kernel.org
Cc: lenb@kernel.org
---
 drivers/acpi/Kconfig |    8 ++++++++
 drivers/acpi/video.c |    9 ++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 7556913..5354290 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -163,6 +163,14 @@ config ACPI_VIDEO
 	  To compile this driver as a module, choose M here:
 	  the module will be called video.
 
+config ACPI_VIDEO_DISABLE_BIOS_POWER_BRIGHTNESS
+        bool "Disable BIOS brightness changes on power events"
+        depends on ACPI_VIDEO
+        default n
+        help
+	  Many laptops will automatically change brightness on AC/battery
+	  status changes. Choose Y here to disable this.
+
 config ACPI_FAN
 	tristate "Fan"
 	select THERMAL
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index eaef02a..4b42938 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -86,6 +86,13 @@ module_param(allow_duplicates, bool, 0644);
 static bool use_bios_initial_backlight = 1;
 module_param(use_bios_initial_backlight, bool, 0644);
 
+#ifdef CONFIG_ACPI_VIDEO_DISABLE_BIOS_POWER_BRIGHTNESS
+static bool disable_bios_power_change = true;
+#else
+static bool disable_bios_power_change;
+#endif
+module_param(disable_bios_power_change, bool, 0644);
+
 static int register_count = 0;
 static int acpi_video_bus_add(struct acpi_device *device);
 static int acpi_video_bus_remove(struct acpi_device *device, int type);
@@ -1421,7 +1428,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
 
 static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
 {
-	return acpi_video_bus_DOS(video, 0, 0);
+	return acpi_video_bus_DOS(video, 0, disable_bios_power_change);
 }
 
 static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
-- 
1.7.7.6


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

* [PATCH 2/3] ACPI: Provide config option to control automatic brightness switching
  2012-02-03 15:18 [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events Matthew Garrett
@ 2012-02-03 15:18 ` Matthew Garrett
  2012-02-03 15:18 ` [PATCH 3/3] pcie: Add support for setting default ASPM policy Matthew Garrett
  2012-02-17 19:27 ` [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events Pavel Machek
  2 siblings, 0 replies; 6+ messages in thread
From: Matthew Garrett @ 2012-02-03 15:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: Matthew Garrett, linux-acpi, lenb

The ACPI backlight driver will optionally automatically respond to ACPI
brightness key events. This is unique amongst backlight drivers and makes
it more difficult for userspace to provide a consistent backlight policy.
Add support for disabling this behaviour by default.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: linux-acpi@vger.kernel.org
Cc: lenb@kernel.org
---
 drivers/acpi/Kconfig |   11 +++++++++++
 drivers/acpi/video.c |    6 +++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5354290..27212e0 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -171,6 +171,17 @@ config ACPI_VIDEO_DISABLE_BIOS_POWER_BRIGHTNESS
 	  Many laptops will automatically change brightness on AC/battery
 	  status changes. Choose Y here to disable this.
 
+config ACPI_VIDEO_BRIGHTNESS_SWITCH_ENABLED
+        bool "Automatically change brightness on ACPI key events"
+	depends on ACPI_VIDEO
+	default y
+	help
+	  If this option is enabled the kernel will change brightness
+	  automatically in response to ACPI video key events. If it is
+	  disabled, the keys will be reported to userspace but no further
+	  action will be taken by the kernel. It is then up to userspace
+	  to respond to the events.
+
 config ACPI_FAN
 	tristate "Fan"
 	select THERMAL
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 4b42938..2b85046 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -69,7 +69,11 @@ MODULE_AUTHOR("Bruno Ducrot");
 MODULE_DESCRIPTION("ACPI Video Driver");
 MODULE_LICENSE("GPL");
 
-static bool brightness_switch_enabled = 1;
+#ifdef CONFIG_ACPI_VIDEO_BRIGHTNESS_SWITCH_ENABLED
+static bool brightness_switch_enabled = true;
+#else
+static bool brightness_switch_enabled;
+#endif
 module_param(brightness_switch_enabled, bool, 0644);
 
 /*
-- 
1.7.7.6


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

* [PATCH 3/3] pcie: Add support for setting default ASPM policy
  2012-02-03 15:18 [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events Matthew Garrett
  2012-02-03 15:18 ` [PATCH 2/3] ACPI: Provide config option to control automatic brightness switching Matthew Garrett
@ 2012-02-03 15:18 ` Matthew Garrett
  2012-02-10 20:31   ` Jesse Barnes
  2012-02-17 19:27 ` [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events Pavel Machek
  2 siblings, 1 reply; 6+ messages in thread
From: Matthew Garrett @ 2012-02-03 15:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: Matthew Garrett, linux-pci, jbarnes

Distributions may wish to provide different defaults for PCIE ASPM
depending on their target audience. Provide a configuration option for
choosing the default policy.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: linux-pci@vger.kernel.org
Cc: jbarnes@virtuousgeek.org
---
 drivers/pci/pcie/Kconfig |   25 +++++++++++++++++++++++++
 drivers/pci/pcie/aspm.c  |    8 ++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig
index 72962cc..6c8bc58 100644
--- a/drivers/pci/pcie/Kconfig
+++ b/drivers/pci/pcie/Kconfig
@@ -55,6 +55,31 @@ config PCIEASPM_DEBUG
 	  This enables PCI Express ASPM debug support. It will add per-device
 	  interface to control ASPM.
 
+choice
+	prompt "Default ASPM policy"
+	default PCIEASPM_DEFAULT
+	depends on PCIEASPM
+
+config PCIEASPM_DEFAULT
+        bool "BIOS default"
+	depends on PCIEASPM
+	help
+	  Use the BIOS defaults for PCI Express ASPM.
+
+config PCIEASPM_POWERSAVE
+        bool "Powersave"
+	depends on PCIEASPM
+	help
+	  Enable PCI Express ASPM L0s and L1 where possible, even if the
+	  BIOS did not.
+
+config PCIEASPM_PERFORMANCE
+        bool "Performance"
+	depends on PCIEASPM
+	help
+	  Disable PCI Express ASPM L0s and L1, even if the BIOS enabled them.
+endchoice
+
 config PCIE_PME
 	def_bool y
 	depends on PCIEPORTBUS && PM_RUNTIME && EXPERIMENTAL && ACPI
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 1cfbf22..a0de5e1 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -76,7 +76,15 @@ static LIST_HEAD(link_list);
 #define POLICY_DEFAULT 0	/* BIOS default setting */
 #define POLICY_PERFORMANCE 1	/* high performance */
 #define POLICY_POWERSAVE 2	/* high power saving */
+
+#ifdef CONFIG_PCIEASPM_PERFORMANCE
+static int aspm_policy = POLICY_PERFORMANCE;
+#elif defined CONFIG_PCIEASPM_POWERSAVE
+static int aspm_policy = POLICY_POWERSAVE;
+#else
 static int aspm_policy;
+#endif
+
 static const char *policy_str[] = {
 	[POLICY_DEFAULT] = "default",
 	[POLICY_PERFORMANCE] = "performance",
-- 
1.7.7.6


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

* Re: [PATCH 3/3] pcie: Add support for setting default ASPM policy
  2012-02-03 15:18 ` [PATCH 3/3] pcie: Add support for setting default ASPM policy Matthew Garrett
@ 2012-02-10 20:31   ` Jesse Barnes
  0 siblings, 0 replies; 6+ messages in thread
From: Jesse Barnes @ 2012-02-10 20:31 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: linux-kernel, linux-pci

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

On Fri,  3 Feb 2012 10:18:13 -0500
Matthew Garrett <mjg@redhat.com> wrote:

> Distributions may wish to provide different defaults for PCIE ASPM
> depending on their target audience. Provide a configuration option for
> choosing the default policy.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> Cc: linux-pci@vger.kernel.org
> Cc: jbarnes@virtuousgeek.org

Applied to -next, thanks.

-- 
Jesse Barnes, Intel Open Source Technology Center

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events
  2012-02-03 15:18 [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events Matthew Garrett
  2012-02-03 15:18 ` [PATCH 2/3] ACPI: Provide config option to control automatic brightness switching Matthew Garrett
  2012-02-03 15:18 ` [PATCH 3/3] pcie: Add support for setting default ASPM policy Matthew Garrett
@ 2012-02-17 19:27 ` Pavel Machek
  2012-02-17 19:37   ` Matthew Garrett
  2 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2012-02-17 19:27 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: linux-kernel, linux-acpi, lenb

Hi!

> The default ACPI behaviour is to instruct the BIOS to automatically change
> brightness on power events. This may be undesirable for distributions who
> manage brightness in userspace. Provide a config option that disables this
> behaviour and leaves brightness control up to the OS.

Should this be configured during runtime?

Like... when userspace power management starts, it disables this?
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events
  2012-02-17 19:27 ` [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events Pavel Machek
@ 2012-02-17 19:37   ` Matthew Garrett
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Garrett @ 2012-02-17 19:37 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel, linux-acpi, lenb

On Fri, Feb 17, 2012 at 08:27:04PM +0100, Pavel Machek wrote:
> Hi!
> 
> > The default ACPI behaviour is to instruct the BIOS to automatically change
> > brightness on power events. This may be undesirable for distributions who
> > manage brightness in userspace. Provide a config option that disables this
> > behaviour and leaves brightness control up to the OS.
> 
> Should this be configured during runtime?
> 
> Like... when userspace power management starts, it disables this?

This is ACPI-specific. It's not emulated by any of the other backlight 
drivers. There's no terribly easy way to have generic userspace handle 
it.

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

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

end of thread, other threads:[~2012-02-17 19:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-03 15:18 [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events Matthew Garrett
2012-02-03 15:18 ` [PATCH 2/3] ACPI: Provide config option to control automatic brightness switching Matthew Garrett
2012-02-03 15:18 ` [PATCH 3/3] pcie: Add support for setting default ASPM policy Matthew Garrett
2012-02-10 20:31   ` Jesse Barnes
2012-02-17 19:27 ` [PATCH 1/3] ACPI: Provide config option to disable BIOS brightness changes on power events Pavel Machek
2012-02-17 19:37   ` Matthew Garrett

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