All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus
@ 2012-06-13  7:32 Corentin Chary
  2012-06-13  7:32 ` [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers Corentin Chary
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-13  7:32 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, Corentin Chary

Hi,

This series should fix a big issue when the vendor backlight is known
to work better than the ACPI backlight (and sometime it's the only
backlight that really works).

It adds a way for vendor drivers to promote themselves, still respecting
acpi_backlight=vendor|video parameters (in case the vendor driver is
wrong, and the ACPI driver works better). This way, acpi_video_register()
still works properly.

The series then add calls to this new functions in appropriates drivers,
and also blacklist a laptop where the ACPI video module is known to
break the backlight untill next reboot.

Thanks,

AceLan Kao (2):
  asus-wmi: control backlight power through WMI, not ACPI
  asus-wmi: enable resume on lid open

Corentin Chary (5):
  acpi: add a way to promote/demote vendor backlight drivers
  drivers-platform-x86: use acpi_video_dmi_promote_vendor()
  samsung-laptop: X360 ACPI backlight device is broken
  acpi/video_detect: blacklist samsung x360
  samsung-laptop: support R40/R41

 Documentation/ABI/testing/sysfs-platform-asus-wmi |    7 +++
 drivers/acpi/video_detect.c                       |   60 ++++++++++++++++++++-
 drivers/platform/x86/acer-wmi.c                   |   16 +++---
 drivers/platform/x86/apple-gmux.c                 |    6 +++
 drivers/platform/x86/asus-wmi.c                   |   16 ++++++
 drivers/platform/x86/asus-wmi.h                   |    1 +
 drivers/platform/x86/eeepc-wmi.c                  |   25 ++++++++-
 drivers/platform/x86/samsung-laptop.c             |   41 ++++++++++----
 include/linux/acpi.h                              |   10 ++++
 9 files changed, 162 insertions(+), 20 deletions(-)

-- 
1.7.9.5


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

* [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers
  2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
@ 2012-06-13  7:32 ` Corentin Chary
  2012-06-26 22:19   ` Mattia Dongili
  2012-06-13  7:32 ` [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor() Corentin Chary
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-06-13  7:32 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, Corentin Chary, linux-kernel

Instead of adding a big blacklist in video_detect.c to set
ACPI_VIDEO_BACKLIGHT_DMI_VENDOR correctly, let external modules
promote or demote themselves when they know the generic video
module won't work.

Currently drivers where using acpi_video_unregister() directly
but:
- That didn't respect any acpi_backlight=[video|vendor] parameter
  provided by the user.
- Any later call to acpi_video_register() would still re-load the
  generic video module (and some gpu drivers are doing that).

This patch fix those two issues.

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/acpi/video_detect.c |   31 +++++++++++++++++++++++++++++--
 include/linux/acpi.h        |   10 ++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 45d8097..942fa2a 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -182,8 +182,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
 }
 EXPORT_SYMBOL(acpi_video_get_capabilities);
 
-/* Returns true if video.ko can do backlight switching */
-int acpi_video_backlight_support(void)
+static void acpi_video_caps_check(void)
 {
 	/*
 	 * We must check whether the ACPI graphics device is physically plugged
@@ -191,6 +190,34 @@ int acpi_video_backlight_support(void)
 	 */
 	if (!acpi_video_caps_checked)
 		acpi_video_get_capabilities(NULL);
+}
+
+/* Promote the vendor interface instead of the generic video module.
+ * This function allow DMI blacklists to be implemented by externals
+ * platform drivers instead of putting a big blacklist in video_detect.c
+ * After calling this function you will probably want to call
+ * acpi_video_unregister() to make sure the video module is not loaded
+ */
+void acpi_video_dmi_promote_vendor(void)
+{
+	acpi_video_caps_check();
+	acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
+}
+EXPORT_SYMBOL(acpi_video_dmi_promote_vendor);
+
+/* To be called when a driver who previously promoted the vendor
+ * interface */
+void acpi_video_dmi_demote_vendor(void)
+{
+	acpi_video_caps_check();
+	acpi_video_support &= ~ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
+}
+EXPORT_SYMBOL(acpi_video_dmi_demote_vendor);
+
+/* Returns true if video.ko can do backlight switching */
+int acpi_video_backlight_support(void)
+{
+	acpi_video_caps_check();
 
 	/* First check for boot param -> highest prio */
 	if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index f421dd8..27ab201 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -190,6 +190,8 @@ extern bool wmi_has_guid(const char *guid);
 
 extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle);
 extern long acpi_is_video_device(struct acpi_device *device);
+extern void acpi_video_dmi_promote_vendor(void);
+extern void acpi_video_dmi_demote_vendor(void);
 extern int acpi_video_backlight_support(void);
 extern int acpi_video_display_switch_support(void);
 
@@ -205,6 +207,14 @@ static inline long acpi_is_video_device(struct acpi_device *device)
 	return 0;
 }
 
+static inline void acpi_video_dmi_promote_vendor(void)
+{
+}
+
+static inline void acpi_video_dmi_demote_vendor(void)
+{
+}
+
 static inline int acpi_video_backlight_support(void)
 {
 	return 0;
-- 
1.7.9.5

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

* [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
  2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
  2012-06-13  7:32 ` [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers Corentin Chary
@ 2012-06-13  7:32 ` Corentin Chary
  2012-06-14  9:58     ` joeyli
  2012-06-13  7:32 ` [PATCH 3/7] samsung-laptop: X360 ACPI backlight device is broken Corentin Chary
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-06-13  7:32 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, Corentin Chary, Joey Lee,
	Matthew Garrett, linux-kernel

Instead of using directly acpi_video_unregister(), use
acpi_video_dmi_promote_vendor() (and make it call
acpi_video_unregister() if needed)

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/acer-wmi.c       |   16 +++++++++-------
 drivers/platform/x86/apple-gmux.c     |    6 ++++++
 drivers/platform/x86/samsung-laptop.c |   22 ++++++++++++----------
 3 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index ce875dc..ffc53df 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void)
 
 	set_quirks();
 
+	if (dmi_check_system(video_vendor_dmi_table))
+		acpi_video_dmi_promote_vendor();
 	if (acpi_video_backlight_support()) {
-		if (dmi_check_system(video_vendor_dmi_table)) {
-			acpi_video_unregister();
-		} else {
-			interface->capability &= ~ACER_CAP_BRIGHTNESS;
-			pr_info("Brightness must be controlled by "
-				"acpi video driver\n");
-		}
+		interface->capability &= ~ACER_CAP_BRIGHTNESS;
+		pr_info("Brightness must be controlled by acpi video driver\n");
+	} else {
+#ifdef CONFIG_ACPI_VIDEO
+		pr_info("Disabling ACPI video driver\n");
+		acpi_video_unregister();
+#endif
 	}
 
 	if (wmi_has_guid(WMID_GUID3)) {
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index 694a15a..905fa01 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -193,7 +193,10 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,
 	 * backlight control and supports more levels than other options.
 	 * Disable the other backlight choices.
 	 */
+	acpi_video_dmi_promote_vendor();
+#ifdef CONFIG_ACPI_VIDEO
 	acpi_video_unregister();
+#endif
 	apple_bl_unregister();
 
 	return 0;
@@ -213,7 +216,10 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)
 	release_region(gmux_data->iostart, gmux_data->iolen);
 	kfree(gmux_data);
 
+	acpi_video_dmi_demote_vendor();
+#ifdef CONFIG_ACPI_VIDEO
 	acpi_video_register();
+#endif
 	apple_bl_register();
 }
 
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index e2a34b4..2cbccc1 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -26,7 +26,7 @@
 #include <linux/seq_file.h>
 #include <linux/debugfs.h>
 #include <linux/ctype.h>
-#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
+#ifdef CONFIG_ACPI_VIDEO
 #include <acpi/video.h>
 #endif
 
@@ -1530,15 +1530,18 @@ static int __init samsung_init(void)
 	samsung->quirks = quirks;
 
 
-#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
+#ifdef CONFIG_ACPI
+	if (samsung->quirks->broken_acpi_video)
+		acpi_video_dmi_promote_vendor();
+
 	/* Don't handle backlight here if the acpi video already handle it */
 	if (acpi_video_backlight_support()) {
-		if (samsung->quirks->broken_acpi_video) {
-			pr_info("Disabling ACPI video driver\n");
-			acpi_video_unregister();
-		} else {
-			samsung->handle_backlight = false;
-		}
+		samsung->handle_backlight = false;
+	} else if (samsung->quirks->broken_acpi_video) {
+		pr_info("Disabling ACPI video driver\n");
+#ifdef CONFIG_ACPI_VIDEO
+		acpi_video_unregister();
+#endif
 	}
 #endif
 
@@ -1552,8 +1555,7 @@ static int __init samsung_init(void)
 
 #ifdef CONFIG_ACPI
 	/* Only log that if we are really on a sabi platform */
-	if (acpi_video_backlight_support() &&
-	    !samsung->quirks->broken_acpi_video)
+	if (acpi_video_backlight_support())
 		pr_info("Backlight controlled by ACPI video driver\n");
 #endif
 
-- 
1.7.9.5

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

* [PATCH 3/7] samsung-laptop: X360 ACPI backlight device is broken
  2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
  2012-06-13  7:32 ` [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers Corentin Chary
  2012-06-13  7:32 ` [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor() Corentin Chary
@ 2012-06-13  7:32 ` Corentin Chary
  2012-06-13  7:32 ` [PATCH 4/7] acpi/video_detect: blacklist samsung x360 Corentin Chary
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-13  7:32 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, Corentin Chary, Matthew Garrett,
	linux-kernel

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/samsung-laptop.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 2cbccc1..98f0758 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1506,6 +1506,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
 		},
 	 .driver_data = &samsung_broken_acpi_video,
 	},
+	{
+	 .callback = samsung_dmi_matched,
+	 .ident = "X360",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
+		DMI_MATCH(DMI_BOARD_NAME, "X360"),
+		},
+	 .driver_data = &samsung_broken_acpi_video,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
-- 
1.7.9.5

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

* [PATCH 4/7] acpi/video_detect: blacklist samsung x360
  2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
                   ` (2 preceding siblings ...)
  2012-06-13  7:32 ` [PATCH 3/7] samsung-laptop: X360 ACPI backlight device is broken Corentin Chary
@ 2012-06-13  7:32 ` Corentin Chary
  2012-06-13  7:32 ` [PATCH 5/7] samsung-laptop: support R40/R41 Corentin Chary
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-13  7:32 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, Corentin Chary, linux-kernel

On Samsung X360, the BIOS will set a flag (VDRV) if the generic
ACPI backlight device is used. This flag will definitively break
the backlight interface (even the vendor interface) untill next
reboot. It's why we should prevent video.ko from being used here
and we can't rely on a later call to acpi_video_unregister().

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/acpi/video_detect.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 942fa2a..b728880 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -132,6 +132,33 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
 	return AE_OK;
 }
 
+/* Force to use vendor driver when the ACPI device is known to be
+ * buggy */
+static int video_detect_force_vendor(const struct dmi_system_id *d)
+{
+	acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
+	return 0;
+}
+
+static struct dmi_system_id video_detect_dmi_table[] = {
+	/* On Samsung X360, the BIOS will set a flag (VDRV) if generic
+	 * ACPI backlight device is used. This flag will definitively break
+	 * the backlight interface (even the vendor interface) untill next
+	 * reboot. It's why we should prevent video.ko from being used here
+	 * and we can't rely on a later call to acpi_video_unregister().
+	 */
+	{
+	 .callback = video_detect_force_vendor,
+	 .ident = "X360",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
+		DMI_MATCH(DMI_BOARD_NAME, "X360"),
+		},
+	},
+	{ },
+};
+
 /*
  * Returns the video capabilities of a specific ACPI graphics device
  *
@@ -164,6 +191,8 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
 		 *		ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
 		 *}
 		 */
+
+		dmi_check_system(video_detect_dmi_table);
 	} else {
 		status = acpi_bus_get_device(graphics_handle, &tmp_dev);
 		if (ACPI_FAILURE(status)) {
-- 
1.7.9.5

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

* [PATCH 5/7] samsung-laptop: support R40/R41
  2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
                   ` (3 preceding siblings ...)
  2012-06-13  7:32 ` [PATCH 4/7] acpi/video_detect: blacklist samsung x360 Corentin Chary
@ 2012-06-13  7:32 ` Corentin Chary
  2012-06-13  7:32 ` [PATCH 6/7] asus-wmi: control backlight power through WMI, not ACPI Corentin Chary
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-13  7:32 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, Corentin Chary, Matthew Garrett,
	linux-kernel

> Chassis Information
> 	Manufacturer: SAMSUNG ELECTRONICS CO., LTD.
>	Type: Other

Type should be "Notebook", "Laptop", .. not "Other".

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/samsung-laptop.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 98f0758..c1ca7bc 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1465,6 +1465,15 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
 			DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
 		},
 	},
+	/* DMI ids for laptops with bad Chassis Type */
+	{
+	  .ident = "R40/R41",
+	  .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "R40/R41"),
+		DMI_MATCH(DMI_BOARD_NAME, "R40/R41"),
+		},
+	},
 	/* Specific DMI ids for laptop with quirks */
 	{
 	 .callback = samsung_dmi_matched,
-- 
1.7.9.5


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

* [PATCH 6/7] asus-wmi: control backlight power through WMI, not ACPI
  2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
                   ` (4 preceding siblings ...)
  2012-06-13  7:32 ` [PATCH 5/7] samsung-laptop: support R40/R41 Corentin Chary
@ 2012-06-13  7:32 ` Corentin Chary
  2012-06-14 11:05   ` Corentin Chary
  2012-06-13  7:32 ` [PATCH 7/7] asus-wmi: enable resume on lid open Corentin Chary
  2012-06-26 18:42 ` [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Matthew Garrett
  7 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-06-13  7:32 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, AceLan Kao, Corentin Chary,
	Matthew Garrett, acpi4asus-user, linux-kernel

From: AceLan Kao <acelan.kao@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1000146

Some h/w that can adjust screen brightness through ACPI functions, but
can't turn on/off the backlight power correctly. So, we list those h/w in
quirks and try to turn on/off the backlight power through WMI.
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-wmi.c  |    9 +++++++++
 drivers/platform/x86/asus-wmi.h  |    1 +
 drivers/platform/x86/eeepc-wmi.c |   25 ++++++++++++++++++++++++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 77aadde..4beded3 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -47,6 +47,9 @@
 #include <linux/thermal.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
+#ifdef CONFIG_ACPI_VIDEO
+#include <acpi/video.h>
+#endif
 
 #include "asus-wmi.h"
 
@@ -1681,7 +1684,13 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_rfkill;
 
+	if (asus->driver->quirks->wmi_backlight_power)
+		acpi_video_dmi_promote_vendor();
 	if (!acpi_video_backlight_support()) {
+#ifdef CONFIG_ACPI_VIDEO
+		pr_info("Disabling ACPI video driver\n");
+		acpi_video_unregister();
+#endif
 		err = asus_wmi_backlight_init(asus);
 		if (err && err != -ENODEV)
 			goto fail_backlight;
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index d43b667..9c1da8b 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -39,6 +39,7 @@ struct quirk_entry {
 	bool hotplug_wireless;
 	bool scalar_panel_brightness;
 	bool store_backlight_power;
+	bool wmi_backlight_power;
 	int wapf;
 };
 
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 6567613..5838332 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -79,7 +79,7 @@ static const struct key_entry eeepc_wmi_keymap[] = {
 	{ KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */
 	{ KE_KEY, HOME_PRESS, { KEY_CONFIG } }, /* Home/Express gate key */
 	{ KE_KEY, 0xe8, { KEY_SCREENLOCK } },
-	{ KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
+	{ KE_KEY, 0xe9, { KEY_DISPLAYTOGGLE } },
 	{ KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } },
 	{ KE_KEY, 0xec, { KEY_CAMERA_UP } },
 	{ KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
@@ -107,6 +107,11 @@ static struct quirk_entry quirk_asus_et2012_type3 = {
 	.store_backlight_power = true,
 };
 
+static struct quirk_entry quirk_asus_x101ch = {
+	/* We need this when ACPI function doesn't do this well */
+	.wmi_backlight_power = true,
+};
+
 static struct quirk_entry *quirks;
 
 static void et2012_quirks(void)
@@ -157,6 +162,24 @@ static struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_asus_unknown,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK Computer INC. X101CH",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"),
+		},
+		.driver_data = &quirk_asus_x101ch,
+	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK Computer INC. 1015CX",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"),
+		},
+		.driver_data = &quirk_asus_x101ch,
+	},
 	{},
 };
 
-- 
1.7.9.5

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

* [PATCH 7/7] asus-wmi: enable resume on lid open
  2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
                   ` (5 preceding siblings ...)
  2012-06-13  7:32 ` [PATCH 6/7] asus-wmi: control backlight power through WMI, not ACPI Corentin Chary
@ 2012-06-13  7:32 ` Corentin Chary
  2012-06-26 18:42 ` [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Matthew Garrett
  7 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-13  7:32 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, AceLan Kao, Corentin Chary,
	Rob Landley, Matthew Garrett, linux-doc, linux-kernel,
	acpi4asus-user

From: AceLan Kao <acelan.kao@canonical.com>

According to the ASUS WMI spec., to enable resume on lid open should
use the device ID(0x00120032), but it doesn't work indeed.

After discussing with ASUS' BIOS engineer, they say wake on lid open
doesn't have a uniq device ID(0x00120032) in the BIOS. It shares the same
device ID with deep S3(0x00120031), and the deep S3(resume on lid open)
is disable by default.

Adding this option in asus wmi sysfs
   /sys/devices/platform/<platform>/lid_resume
so that userspace apps can enable/disable this feature by themselves.

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 Documentation/ABI/testing/sysfs-platform-asus-wmi |    7 +++++++
 drivers/platform/x86/asus-wmi.c                   |    7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi
index 2e7df91..019e1e2 100644
--- a/Documentation/ABI/testing/sysfs-platform-asus-wmi
+++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi
@@ -29,3 +29,10 @@ KernelVersion:	2.6.39
 Contact:	"Corentin Chary" <corentincj@iksaif.net>
 Description:
 		Control the card touchpad. 1 means on, 0 means off.
+
+What:		/sys/devices/platform/<platform>/lid_resume
+Date:		May 2012
+KernelVersion:	3.5
+Contact:	"AceLan Kao" <acelan.kao@canonical.com>
+Description:
+		Resume on lid open. 1 means on, 0 means off.
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 4beded3..c4d9b0e 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -139,6 +139,9 @@ MODULE_LICENSE("GPL");
 /* Power */
 #define ASUS_WMI_DEVID_PROCESSOR_STATE	0x00120012
 
+/* Deep S3 / Resume on LID open */
+#define ASUS_WMI_DEVID_LID_RESUME	0x00120031
+
 /* DSTS masks */
 #define ASUS_WMI_DSTS_STATUS_BIT	0x00000001
 #define ASUS_WMI_DSTS_UNKNOWN_BIT	0x00000002
@@ -1368,6 +1371,7 @@ static ssize_t show_sys_wmi(struct asus_wmi *asus, int devid, char *buf)
 ASUS_WMI_CREATE_DEVICE_ATTR(touchpad, 0644, ASUS_WMI_DEVID_TOUCHPAD);
 ASUS_WMI_CREATE_DEVICE_ATTR(camera, 0644, ASUS_WMI_DEVID_CAMERA);
 ASUS_WMI_CREATE_DEVICE_ATTR(cardr, 0644, ASUS_WMI_DEVID_CARDREADER);
+ASUS_WMI_CREATE_DEVICE_ATTR(lid_resume, 0644, ASUS_WMI_DEVID_LID_RESUME);
 
 static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
 			   const char *buf, size_t count)
@@ -1393,6 +1397,7 @@ static struct attribute *platform_attributes[] = {
 	&dev_attr_camera.attr,
 	&dev_attr_cardr.attr,
 	&dev_attr_touchpad.attr,
+	&dev_attr_lid_resume.attr,
 	NULL
 };
 
@@ -1411,6 +1416,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
 		devid = ASUS_WMI_DEVID_CARDREADER;
 	else if (attr == &dev_attr_touchpad.attr)
 		devid = ASUS_WMI_DEVID_TOUCHPAD;
+	else if (attr == &dev_attr_lid_resume.attr)
+		devid = ASUS_WMI_DEVID_LID_RESUME;
 
 	if (devid != -1)
 		ok = !(asus_wmi_get_devstate_simple(asus, devid) < 0);
-- 
1.7.9.5


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

* Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
  2012-06-13  7:32 ` [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor() Corentin Chary
@ 2012-06-14  9:58     ` joeyli
  0 siblings, 0 replies; 23+ messages in thread
From: joeyli @ 2012-06-14  9:58 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	Joey Lee, Matthew Garrett, linux-kernel

Hi Corentin, 

於 三,2012-06-13 於 09:32 +0200,Corentin Chary 提到:
> Instead of using directly acpi_video_unregister(), use
> acpi_video_dmi_promote_vendor() (and make it call
> acpi_video_unregister() if needed)
> 
> Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
> ---
>  drivers/platform/x86/acer-wmi.c       |   16 +++++++++-------
>  drivers/platform/x86/apple-gmux.c     |    6 ++++++
>  drivers/platform/x86/samsung-laptop.c |   22 ++++++++++++----------
>  3 files changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index ce875dc..ffc53df 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void)
>  
>  	set_quirks();
>  
> +	if (dmi_check_system(video_vendor_dmi_table))
> +		acpi_video_dmi_promote_vendor();
>  	if (acpi_video_backlight_support()) {
> -		if (dmi_check_system(video_vendor_dmi_table)) {
> -			acpi_video_unregister();
> -		} else {
> -			interface->capability &= ~ACER_CAP_BRIGHTNESS;
> -			pr_info("Brightness must be controlled by "
> -				"acpi video driver\n");
> -		}
> +		interface->capability &= ~ACER_CAP_BRIGHTNESS;
> +		pr_info("Brightness must be controlled by acpi video driver\n");
> +	} else {
> +#ifdef CONFIG_ACPI_VIDEO

The 'ifdef CONFIG_ACPI_VIDEO' didn't work on my machine with v3.4
kernel, the acpi video didn't unregister. 

My autoconf.h like following:

include/generated/autoconf.h:#define CONFIG_ACPI_VIDEO_MODULE 1


Need use:

-#ifdef CONFIG_ACPI_VIDEO
+#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
	pr_info("Disabling ACPI video driver\n"); 
	acpi_video_unregister();
#endif

I tested the above change works to me.


Thanks a lot!
Joey Lee

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
@ 2012-06-14  9:58     ` joeyli
  0 siblings, 0 replies; 23+ messages in thread
From: joeyli @ 2012-06-14  9:58 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	Joey Lee, Matthew Garrett, linux-kernel

Hi Corentin, 

於 三,2012-06-13 於 09:32 +0200,Corentin Chary 提到:
> Instead of using directly acpi_video_unregister(), use
> acpi_video_dmi_promote_vendor() (and make it call
> acpi_video_unregister() if needed)
> 
> Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
> ---
>  drivers/platform/x86/acer-wmi.c       |   16 +++++++++-------
>  drivers/platform/x86/apple-gmux.c     |    6 ++++++
>  drivers/platform/x86/samsung-laptop.c |   22 ++++++++++++----------
>  3 files changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index ce875dc..ffc53df 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void)
>  
>  	set_quirks();
>  
> +	if (dmi_check_system(video_vendor_dmi_table))
> +		acpi_video_dmi_promote_vendor();
>  	if (acpi_video_backlight_support()) {
> -		if (dmi_check_system(video_vendor_dmi_table)) {
> -			acpi_video_unregister();
> -		} else {
> -			interface->capability &= ~ACER_CAP_BRIGHTNESS;
> -			pr_info("Brightness must be controlled by "
> -				"acpi video driver\n");
> -		}
> +		interface->capability &= ~ACER_CAP_BRIGHTNESS;
> +		pr_info("Brightness must be controlled by acpi video driver\n");
> +	} else {
> +#ifdef CONFIG_ACPI_VIDEO

The 'ifdef CONFIG_ACPI_VIDEO' didn't work on my machine with v3.4
kernel, the acpi video didn't unregister. 

My autoconf.h like following:

include/generated/autoconf.h:#define CONFIG_ACPI_VIDEO_MODULE 1


Need use:

-#ifdef CONFIG_ACPI_VIDEO
+#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
	pr_info("Disabling ACPI video driver\n"); 
	acpi_video_unregister();
#endif

I tested the above change works to me.


Thanks a lot!
Joey Lee


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

* Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
  2012-06-14  9:58     ` joeyli
@ 2012-06-14 10:54       ` Corentin Chary
  -1 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-14 10:54 UTC (permalink / raw)
  To: joeyli
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	Joey Lee, Matthew Garrett, linux-kernel

On Thu, Jun 14, 2012 at 11:58 AM, joeyli <jlee@suse.com> wrote:
> Hi Corentin,
>
> 於 三,2012-06-13 於 09:32 +0200,Corentin Chary 提到:
>> Instead of using directly acpi_video_unregister(), use
>> acpi_video_dmi_promote_vendor() (and make it call
>> acpi_video_unregister() if needed)
>>
>> Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
>> ---
>>  drivers/platform/x86/acer-wmi.c       |   16 +++++++++-------
>>  drivers/platform/x86/apple-gmux.c     |    6 ++++++
>>  drivers/platform/x86/samsung-laptop.c |   22 ++++++++++++----------
>>  3 files changed, 27 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
>> index ce875dc..ffc53df 100644
>> --- a/drivers/platform/x86/acer-wmi.c
>> +++ b/drivers/platform/x86/acer-wmi.c
>> @@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void)
>>
>>       set_quirks();
>>
>> +     if (dmi_check_system(video_vendor_dmi_table))
>> +             acpi_video_dmi_promote_vendor();
>>       if (acpi_video_backlight_support()) {
>> -             if (dmi_check_system(video_vendor_dmi_table)) {
>> -                     acpi_video_unregister();
>> -             } else {
>> -                     interface->capability &= ~ACER_CAP_BRIGHTNESS;
>> -                     pr_info("Brightness must be controlled by "
>> -                             "acpi video driver\n");
>> -             }
>> +             interface->capability &= ~ACER_CAP_BRIGHTNESS;
>> +             pr_info("Brightness must be controlled by acpi video driver\n");
>> +     } else {
>> +#ifdef CONFIG_ACPI_VIDEO
>
> The 'ifdef CONFIG_ACPI_VIDEO' didn't work on my machine with v3.4
> kernel, the acpi video didn't unregister.
>
> My autoconf.h like following:
>
> include/generated/autoconf.h:#define CONFIG_ACPI_VIDEO_MODULE 1
>
>
> Need use:
>
> -#ifdef CONFIG_ACPI_VIDEO
> +#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
>        pr_info("Disabling ACPI video driver\n");
>        acpi_video_unregister();
> #endif
>
> I tested the above change works to me.

I checked include/acpi/video.h and I could in fact remove all #ifdef stuff...
Thanks ! Will update the patches.


-- 
Corentin Chary
http://xf.iksaif.net
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
@ 2012-06-14 10:54       ` Corentin Chary
  0 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-14 10:54 UTC (permalink / raw)
  To: joeyli
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	Joey Lee, Matthew Garrett, linux-kernel

On Thu, Jun 14, 2012 at 11:58 AM, joeyli <jlee@suse.com> wrote:
> Hi Corentin,
>
> 於 三,2012-06-13 於 09:32 +0200,Corentin Chary 提到:
>> Instead of using directly acpi_video_unregister(), use
>> acpi_video_dmi_promote_vendor() (and make it call
>> acpi_video_unregister() if needed)
>>
>> Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
>> ---
>>  drivers/platform/x86/acer-wmi.c       |   16 +++++++++-------
>>  drivers/platform/x86/apple-gmux.c     |    6 ++++++
>>  drivers/platform/x86/samsung-laptop.c |   22 ++++++++++++----------
>>  3 files changed, 27 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
>> index ce875dc..ffc53df 100644
>> --- a/drivers/platform/x86/acer-wmi.c
>> +++ b/drivers/platform/x86/acer-wmi.c
>> @@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void)
>>
>>       set_quirks();
>>
>> +     if (dmi_check_system(video_vendor_dmi_table))
>> +             acpi_video_dmi_promote_vendor();
>>       if (acpi_video_backlight_support()) {
>> -             if (dmi_check_system(video_vendor_dmi_table)) {
>> -                     acpi_video_unregister();
>> -             } else {
>> -                     interface->capability &= ~ACER_CAP_BRIGHTNESS;
>> -                     pr_info("Brightness must be controlled by "
>> -                             "acpi video driver\n");
>> -             }
>> +             interface->capability &= ~ACER_CAP_BRIGHTNESS;
>> +             pr_info("Brightness must be controlled by acpi video driver\n");
>> +     } else {
>> +#ifdef CONFIG_ACPI_VIDEO
>
> The 'ifdef CONFIG_ACPI_VIDEO' didn't work on my machine with v3.4
> kernel, the acpi video didn't unregister.
>
> My autoconf.h like following:
>
> include/generated/autoconf.h:#define CONFIG_ACPI_VIDEO_MODULE 1
>
>
> Need use:
>
> -#ifdef CONFIG_ACPI_VIDEO
> +#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
>        pr_info("Disabling ACPI video driver\n");
>        acpi_video_unregister();
> #endif
>
> I tested the above change works to me.

I checked include/acpi/video.h and I could in fact remove all #ifdef stuff...
Thanks ! Will update the patches.


-- 
Corentin Chary
http://xf.iksaif.net

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

* [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
  2012-06-14 10:54       ` Corentin Chary
  (?)
@ 2012-06-14 11:04       ` Corentin Chary
  2012-06-14 12:53           ` joeyli
  2012-06-14 20:02         ` Seth Forshee
  -1 siblings, 2 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-14 11:04 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, Corentin Chary, Joey Lee,
	Matthew Garrett, Corentin Chary, linux-kernel

Instead of using directly acpi_video_unregister(), use
acpi_video_dmi_promote_vendor() (and make it call
acpi_video_unregister() if needed)

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/acer-wmi.c       |   14 +++++++-------
 drivers/platform/x86/apple-gmux.c     |    2 ++
 drivers/platform/x86/samsung-laptop.c |   20 +++++++++-----------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index ce875dc..7057aef 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -2060,14 +2060,14 @@ static int __init acer_wmi_init(void)
 
 	set_quirks();
 
+	if (dmi_check_system(video_vendor_dmi_table))
+		acpi_video_dmi_promote_vendor();
 	if (acpi_video_backlight_support()) {
-		if (dmi_check_system(video_vendor_dmi_table)) {
-			acpi_video_unregister();
-		} else {
-			interface->capability &= ~ACER_CAP_BRIGHTNESS;
-			pr_info("Brightness must be controlled by "
-				"acpi video driver\n");
-		}
+		interface->capability &= ~ACER_CAP_BRIGHTNESS;
+		pr_info("Brightness must be controlled by acpi video driver\n");
+	} else {
+		pr_info("Disabling ACPI video driver\n");
+		acpi_video_unregister();
 	}
 
 	if (wmi_has_guid(WMID_GUID3)) {
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index 694a15a..fd61502 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -193,6 +193,7 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,
 	 * backlight control and supports more levels than other options.
 	 * Disable the other backlight choices.
 	 */
+	acpi_video_dmi_promote_vendor();
 	acpi_video_unregister();
 	apple_bl_unregister();
 
@@ -213,6 +214,7 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)
 	release_region(gmux_data->iostart, gmux_data->iolen);
 	kfree(gmux_data);
 
+	acpi_video_dmi_demote_vendor();
 	acpi_video_register();
 	apple_bl_register();
 }
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index e2a34b4..b822784 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -26,9 +26,7 @@
 #include <linux/seq_file.h>
 #include <linux/debugfs.h>
 #include <linux/ctype.h>
-#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
 #include <acpi/video.h>
-#endif
 
 /*
  * This driver is needed because a number of Samsung laptops do not hook
@@ -1530,15 +1528,16 @@ static int __init samsung_init(void)
 	samsung->quirks = quirks;
 
 
-#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
+#ifdef CONFIG_ACPI
+	if (samsung->quirks->broken_acpi_video)
+		acpi_video_dmi_promote_vendor();
+
 	/* Don't handle backlight here if the acpi video already handle it */
 	if (acpi_video_backlight_support()) {
-		if (samsung->quirks->broken_acpi_video) {
-			pr_info("Disabling ACPI video driver\n");
-			acpi_video_unregister();
-		} else {
-			samsung->handle_backlight = false;
-		}
+		samsung->handle_backlight = false;
+	} else if (samsung->quirks->broken_acpi_video) {
+		pr_info("Disabling ACPI video driver\n");
+		acpi_video_unregister();
 	}
 #endif
 
@@ -1552,8 +1551,7 @@ static int __init samsung_init(void)
 
 #ifdef CONFIG_ACPI
 	/* Only log that if we are really on a sabi platform */
-	if (acpi_video_backlight_support() &&
-	    !samsung->quirks->broken_acpi_video)
+	if (acpi_video_backlight_support())
 		pr_info("Backlight controlled by ACPI video driver\n");
 #endif
 
-- 
1.7.9.5

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

* [PATCH 6/7] asus-wmi: control backlight power through WMI, not ACPI
  2012-06-13  7:32 ` [PATCH 6/7] asus-wmi: control backlight power through WMI, not ACPI Corentin Chary
@ 2012-06-14 11:05   ` Corentin Chary
  0 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-14 11:05 UTC (permalink / raw)
  To: Len Brown, Matthew Garrett
  Cc: linux-acpi, platform-driver-x86, AceLan Kao, Corentin Chary,
	Corentin Chary, Matthew Garrett, acpi4asus-user, linux-kernel

From: AceLan Kao <acelan.kao@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1000146

Some h/w that can adjust screen brightness through ACPI functions, but
can't turn on/off the backlight power correctly. So, we list those h/w in
quirks and try to turn on/off the backlight power through WMI.
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-wmi.c  |    5 +++++
 drivers/platform/x86/asus-wmi.h  |    1 +
 drivers/platform/x86/eeepc-wmi.c |   25 ++++++++++++++++++++++++-
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 77aadde..7e89e04 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -47,6 +47,7 @@
 #include <linux/thermal.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
+#include <acpi/video.h>
 
 #include "asus-wmi.h"
 
@@ -1681,7 +1682,11 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_rfkill;
 
+	if (asus->driver->quirks->wmi_backlight_power)
+		acpi_video_dmi_promote_vendor();
 	if (!acpi_video_backlight_support()) {
+		pr_info("Disabling ACPI video driver\n");
+		acpi_video_unregister();
 		err = asus_wmi_backlight_init(asus);
 		if (err && err != -ENODEV)
 			goto fail_backlight;
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index d43b667..9c1da8b 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -39,6 +39,7 @@ struct quirk_entry {
 	bool hotplug_wireless;
 	bool scalar_panel_brightness;
 	bool store_backlight_power;
+	bool wmi_backlight_power;
 	int wapf;
 };
 
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 6567613..5838332 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -79,7 +79,7 @@ static const struct key_entry eeepc_wmi_keymap[] = {
 	{ KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */
 	{ KE_KEY, HOME_PRESS, { KEY_CONFIG } }, /* Home/Express gate key */
 	{ KE_KEY, 0xe8, { KEY_SCREENLOCK } },
-	{ KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
+	{ KE_KEY, 0xe9, { KEY_DISPLAYTOGGLE } },
 	{ KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } },
 	{ KE_KEY, 0xec, { KEY_CAMERA_UP } },
 	{ KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
@@ -107,6 +107,11 @@ static struct quirk_entry quirk_asus_et2012_type3 = {
 	.store_backlight_power = true,
 };
 
+static struct quirk_entry quirk_asus_x101ch = {
+	/* We need this when ACPI function doesn't do this well */
+	.wmi_backlight_power = true,
+};
+
 static struct quirk_entry *quirks;
 
 static void et2012_quirks(void)
@@ -157,6 +162,24 @@ static struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_asus_unknown,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK Computer INC. X101CH",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"),
+		},
+		.driver_data = &quirk_asus_x101ch,
+	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK Computer INC. 1015CX",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"),
+		},
+		.driver_data = &quirk_asus_x101ch,
+	},
 	{},
 };
 
-- 
1.7.9.5

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

* Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
  2012-06-14 11:04       ` Corentin Chary
@ 2012-06-14 12:53           ` joeyli
  2012-06-14 20:02         ` Seth Forshee
  1 sibling, 0 replies; 23+ messages in thread
From: joeyli @ 2012-06-14 12:53 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	Joey Lee, Matthew Garrett, Corentin Chary, linux-kernel

於 四,2012-06-14 於 13:04 +0200,Corentin Chary 提到:
> Instead of using directly acpi_video_unregister(), use
> acpi_video_dmi_promote_vendor() (and make it call
> acpi_video_unregister() if needed)
> 
> Signed-off-by: Corentin Chary <corentin.chary@gmail.com>

It's good to me!

Acked-by: Lee, Chun-Yi <jlee@suse.com>


Thanks a lot!
Joey Lee

> ---
>  drivers/platform/x86/acer-wmi.c       |   14 +++++++-------
>  drivers/platform/x86/apple-gmux.c     |    2 ++
>  drivers/platform/x86/samsung-laptop.c |   20 +++++++++-----------
>  3 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index ce875dc..7057aef 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -2060,14 +2060,14 @@ static int __init acer_wmi_init(void)
>  
>  	set_quirks();
>  
> +	if (dmi_check_system(video_vendor_dmi_table))
> +		acpi_video_dmi_promote_vendor();
>  	if (acpi_video_backlight_support()) {
> -		if (dmi_check_system(video_vendor_dmi_table)) {
> -			acpi_video_unregister();
> -		} else {
> -			interface->capability &= ~ACER_CAP_BRIGHTNESS;
> -			pr_info("Brightness must be controlled by "
> -				"acpi video driver\n");
> -		}
> +		interface->capability &= ~ACER_CAP_BRIGHTNESS;
> +		pr_info("Brightness must be controlled by acpi video driver\n");
> +	} else {
> +		pr_info("Disabling ACPI video driver\n");
> +		acpi_video_unregister();
>  	}
>  
>  	if (wmi_has_guid(WMID_GUID3)) {
> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
> index 694a15a..fd61502 100644
> --- a/drivers/platform/x86/apple-gmux.c
> +++ b/drivers/platform/x86/apple-gmux.c
> @@ -193,6 +193,7 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,
>  	 * backlight control and supports more levels than other options.
>  	 * Disable the other backlight choices.
>  	 */
> +	acpi_video_dmi_promote_vendor();
>  	acpi_video_unregister();
>  	apple_bl_unregister();
>  
> @@ -213,6 +214,7 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)
>  	release_region(gmux_data->iostart, gmux_data->iolen);
>  	kfree(gmux_data);
>  
> +	acpi_video_dmi_demote_vendor();
>  	acpi_video_register();
>  	apple_bl_register();
>  }
> diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
> index e2a34b4..b822784 100644
> --- a/drivers/platform/x86/samsung-laptop.c
> +++ b/drivers/platform/x86/samsung-laptop.c
> @@ -26,9 +26,7 @@
>  #include <linux/seq_file.h>
>  #include <linux/debugfs.h>
>  #include <linux/ctype.h>
> -#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
>  #include <acpi/video.h>
> -#endif
>  
>  /*
>   * This driver is needed because a number of Samsung laptops do not hook
> @@ -1530,15 +1528,16 @@ static int __init samsung_init(void)
>  	samsung->quirks = quirks;
>  
> 
> -#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
> +#ifdef CONFIG_ACPI
> +	if (samsung->quirks->broken_acpi_video)
> +		acpi_video_dmi_promote_vendor();
> +
>  	/* Don't handle backlight here if the acpi video already handle it */
>  	if (acpi_video_backlight_support()) {
> -		if (samsung->quirks->broken_acpi_video) {
> -			pr_info("Disabling ACPI video driver\n");
> -			acpi_video_unregister();
> -		} else {
> -			samsung->handle_backlight = false;
> -		}
> +		samsung->handle_backlight = false;
> +	} else if (samsung->quirks->broken_acpi_video) {
> +		pr_info("Disabling ACPI video driver\n");
> +		acpi_video_unregister();
>  	}
>  #endif
>  
> @@ -1552,8 +1551,7 @@ static int __init samsung_init(void)
>  
>  #ifdef CONFIG_ACPI
>  	/* Only log that if we are really on a sabi platform */
> -	if (acpi_video_backlight_support() &&
> -	    !samsung->quirks->broken_acpi_video)
> +	if (acpi_video_backlight_support())
>  		pr_info("Backlight controlled by ACPI video driver\n");
>  #endif
>  


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
@ 2012-06-14 12:53           ` joeyli
  0 siblings, 0 replies; 23+ messages in thread
From: joeyli @ 2012-06-14 12:53 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	Joey Lee, Matthew Garrett, Corentin Chary, linux-kernel

於 四,2012-06-14 於 13:04 +0200,Corentin Chary 提到:
> Instead of using directly acpi_video_unregister(), use
> acpi_video_dmi_promote_vendor() (and make it call
> acpi_video_unregister() if needed)
> 
> Signed-off-by: Corentin Chary <corentin.chary@gmail.com>

It's good to me!

Acked-by: Lee, Chun-Yi <jlee@suse.com>


Thanks a lot!
Joey Lee

> ---
>  drivers/platform/x86/acer-wmi.c       |   14 +++++++-------
>  drivers/platform/x86/apple-gmux.c     |    2 ++
>  drivers/platform/x86/samsung-laptop.c |   20 +++++++++-----------
>  3 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index ce875dc..7057aef 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -2060,14 +2060,14 @@ static int __init acer_wmi_init(void)
>  
>  	set_quirks();
>  
> +	if (dmi_check_system(video_vendor_dmi_table))
> +		acpi_video_dmi_promote_vendor();
>  	if (acpi_video_backlight_support()) {
> -		if (dmi_check_system(video_vendor_dmi_table)) {
> -			acpi_video_unregister();
> -		} else {
> -			interface->capability &= ~ACER_CAP_BRIGHTNESS;
> -			pr_info("Brightness must be controlled by "
> -				"acpi video driver\n");
> -		}
> +		interface->capability &= ~ACER_CAP_BRIGHTNESS;
> +		pr_info("Brightness must be controlled by acpi video driver\n");
> +	} else {
> +		pr_info("Disabling ACPI video driver\n");
> +		acpi_video_unregister();
>  	}
>  
>  	if (wmi_has_guid(WMID_GUID3)) {
> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
> index 694a15a..fd61502 100644
> --- a/drivers/platform/x86/apple-gmux.c
> +++ b/drivers/platform/x86/apple-gmux.c
> @@ -193,6 +193,7 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,
>  	 * backlight control and supports more levels than other options.
>  	 * Disable the other backlight choices.
>  	 */
> +	acpi_video_dmi_promote_vendor();
>  	acpi_video_unregister();
>  	apple_bl_unregister();
>  
> @@ -213,6 +214,7 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)
>  	release_region(gmux_data->iostart, gmux_data->iolen);
>  	kfree(gmux_data);
>  
> +	acpi_video_dmi_demote_vendor();
>  	acpi_video_register();
>  	apple_bl_register();
>  }
> diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
> index e2a34b4..b822784 100644
> --- a/drivers/platform/x86/samsung-laptop.c
> +++ b/drivers/platform/x86/samsung-laptop.c
> @@ -26,9 +26,7 @@
>  #include <linux/seq_file.h>
>  #include <linux/debugfs.h>
>  #include <linux/ctype.h>
> -#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
>  #include <acpi/video.h>
> -#endif
>  
>  /*
>   * This driver is needed because a number of Samsung laptops do not hook
> @@ -1530,15 +1528,16 @@ static int __init samsung_init(void)
>  	samsung->quirks = quirks;
>  
> 
> -#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
> +#ifdef CONFIG_ACPI
> +	if (samsung->quirks->broken_acpi_video)
> +		acpi_video_dmi_promote_vendor();
> +
>  	/* Don't handle backlight here if the acpi video already handle it */
>  	if (acpi_video_backlight_support()) {
> -		if (samsung->quirks->broken_acpi_video) {
> -			pr_info("Disabling ACPI video driver\n");
> -			acpi_video_unregister();
> -		} else {
> -			samsung->handle_backlight = false;
> -		}
> +		samsung->handle_backlight = false;
> +	} else if (samsung->quirks->broken_acpi_video) {
> +		pr_info("Disabling ACPI video driver\n");
> +		acpi_video_unregister();
>  	}
>  #endif
>  
> @@ -1552,8 +1551,7 @@ static int __init samsung_init(void)
>  
>  #ifdef CONFIG_ACPI
>  	/* Only log that if we are really on a sabi platform */
> -	if (acpi_video_backlight_support() &&
> -	    !samsung->quirks->broken_acpi_video)
> +	if (acpi_video_backlight_support())
>  		pr_info("Backlight controlled by ACPI video driver\n");
>  #endif
>  



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

* Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
  2012-06-14 11:04       ` Corentin Chary
  2012-06-14 12:53           ` joeyli
@ 2012-06-14 20:02         ` Seth Forshee
  1 sibling, 0 replies; 23+ messages in thread
From: Seth Forshee @ 2012-06-14 20:02 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	Joey Lee, Matthew Garrett, Corentin Chary, linux-kernel

On Thu, Jun 14, 2012 at 01:04:30PM +0200, Corentin Chary wrote:
> Instead of using directly acpi_video_unregister(), use
> acpi_video_dmi_promote_vendor() (and make it call
> acpi_video_unregister() if needed)
> 
> Signed-off-by: Corentin Chary <corentin.chary@gmail.com>

The changes to apple-gmux.c get rid of the acpi_video backlight under
EFI boot on the Macbook Pro 8,2. Unfortunately userspace still prefers
intel_backlight on this machine, which also doesn't work. I can't help
but think that we need a more generic way of specifying the preferred
backlight for a machine.

All the same, if this gets picked up feel free to add

Tested-by: Seth Forshee <seth.forshee@canonical.com>

> ---
>  drivers/platform/x86/acer-wmi.c       |   14 +++++++-------
>  drivers/platform/x86/apple-gmux.c     |    2 ++
>  drivers/platform/x86/samsung-laptop.c |   20 +++++++++-----------
>  3 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index ce875dc..7057aef 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -2060,14 +2060,14 @@ static int __init acer_wmi_init(void)
>  
>  	set_quirks();
>  
> +	if (dmi_check_system(video_vendor_dmi_table))
> +		acpi_video_dmi_promote_vendor();
>  	if (acpi_video_backlight_support()) {
> -		if (dmi_check_system(video_vendor_dmi_table)) {
> -			acpi_video_unregister();
> -		} else {
> -			interface->capability &= ~ACER_CAP_BRIGHTNESS;
> -			pr_info("Brightness must be controlled by "
> -				"acpi video driver\n");
> -		}
> +		interface->capability &= ~ACER_CAP_BRIGHTNESS;
> +		pr_info("Brightness must be controlled by acpi video driver\n");
> +	} else {
> +		pr_info("Disabling ACPI video driver\n");
> +		acpi_video_unregister();
>  	}
>  
>  	if (wmi_has_guid(WMID_GUID3)) {
> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
> index 694a15a..fd61502 100644
> --- a/drivers/platform/x86/apple-gmux.c
> +++ b/drivers/platform/x86/apple-gmux.c
> @@ -193,6 +193,7 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,
>  	 * backlight control and supports more levels than other options.
>  	 * Disable the other backlight choices.
>  	 */
> +	acpi_video_dmi_promote_vendor();
>  	acpi_video_unregister();
>  	apple_bl_unregister();
>  
> @@ -213,6 +214,7 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)
>  	release_region(gmux_data->iostart, gmux_data->iolen);
>  	kfree(gmux_data);
>  
> +	acpi_video_dmi_demote_vendor();
>  	acpi_video_register();
>  	apple_bl_register();
>  }
> diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
> index e2a34b4..b822784 100644
> --- a/drivers/platform/x86/samsung-laptop.c
> +++ b/drivers/platform/x86/samsung-laptop.c
> @@ -26,9 +26,7 @@
>  #include <linux/seq_file.h>
>  #include <linux/debugfs.h>
>  #include <linux/ctype.h>
> -#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
>  #include <acpi/video.h>
> -#endif
>  
>  /*
>   * This driver is needed because a number of Samsung laptops do not hook
> @@ -1530,15 +1528,16 @@ static int __init samsung_init(void)
>  	samsung->quirks = quirks;
>  
>  
> -#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
> +#ifdef CONFIG_ACPI
> +	if (samsung->quirks->broken_acpi_video)
> +		acpi_video_dmi_promote_vendor();
> +
>  	/* Don't handle backlight here if the acpi video already handle it */
>  	if (acpi_video_backlight_support()) {
> -		if (samsung->quirks->broken_acpi_video) {
> -			pr_info("Disabling ACPI video driver\n");
> -			acpi_video_unregister();
> -		} else {
> -			samsung->handle_backlight = false;
> -		}
> +		samsung->handle_backlight = false;
> +	} else if (samsung->quirks->broken_acpi_video) {
> +		pr_info("Disabling ACPI video driver\n");
> +		acpi_video_unregister();
>  	}
>  #endif
>  
> @@ -1552,8 +1551,7 @@ static int __init samsung_init(void)
>  
>  #ifdef CONFIG_ACPI
>  	/* Only log that if we are really on a sabi platform */
> -	if (acpi_video_backlight_support() &&
> -	    !samsung->quirks->broken_acpi_video)
> +	if (acpi_video_backlight_support())
>  		pr_info("Backlight controlled by ACPI video driver\n");
>  #endif
>  
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus
  2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
                   ` (6 preceding siblings ...)
  2012-06-13  7:32 ` [PATCH 7/7] asus-wmi: enable resume on lid open Corentin Chary
@ 2012-06-26 18:42 ` Matthew Garrett
  2012-06-29 12:16   ` Corentin Chary
  7 siblings, 1 reply; 23+ messages in thread
From: Matthew Garrett @ 2012-06-26 18:42 UTC (permalink / raw)
  To: Corentin Chary; +Cc: Len Brown, linux-acpi, platform-driver-x86

I think I'm fine with this. Whose tree should it go through?

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

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

* Re: [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers
  2012-06-13  7:32 ` [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers Corentin Chary
@ 2012-06-26 22:19   ` Mattia Dongili
  2012-06-29 12:19     ` Corentin Chary
  0 siblings, 1 reply; 23+ messages in thread
From: Mattia Dongili @ 2012-06-26 22:19 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	linux-kernel

Hi Corentin,

On Wed, Jun 13, 2012 at 09:32:01AM +0200, Corentin Chary wrote:
...
> +/* Promote the vendor interface instead of the generic video module.
> + * This function allow DMI blacklists to be implemented by externals
> + * platform drivers instead of putting a big blacklist in video_detect.c
> + * After calling this function you will probably want to call
> + * acpi_video_unregister() to make sure the video module is not loaded
> + */
> +void acpi_video_dmi_promote_vendor(void)
> +{
> +	acpi_video_caps_check();
> +	acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
> +}
> +EXPORT_SYMBOL(acpi_video_dmi_promote_vendor);

I think having the promote_vendor() function do the sanity check on the
acpi_backlight parameter and the unregistering of the acpi_video device
may make the code cleaner and more acpi_video-agnostic in the drivers.
I.e. (untested sample code):

bool acpi_video_promote_vendor(void)
{
	if (acpi_video_backlight_support())
		return false;

	acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
	pr_info("Disabling ACPI video driver\n");
	acpi_video_unregister();
	return true;
}
EXPORT_SYMBOL(acpi_video_promote_vendor);

and in the drivers you do

	if (my_drv->broken_acpi_video) {
		if (acpi_video_promote_vendor())
			do_backlight_init();
	} else if (!acpi_video_backlight_support())
		do_backlight_init();

or something along these lines.
If you give a boolean parameter to acpi_video_promote_vendor to force
vendor backlight we could make the drivers' code even simpler but that
would change the semantics of the "promotion" to something more of a
"take-over".

PS: I will need to promote backlight control in sony-laptop.ko
eventually as well but I don't have a DMI based list but rather I should
look at a specific handle (or say Method) presence in the SNC Device.
I guess I'm just bothered by the function naming here but not a big
deal. :)
-- 
mattia
:wq!

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

* Re: [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus
  2012-06-26 18:42 ` [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Matthew Garrett
@ 2012-06-29 12:16   ` Corentin Chary
  2012-07-16  5:45     ` Corentin Chary
  0 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-06-29 12:16 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Len Brown, linux-acpi, platform-driver-x86

On Tue, Jun 26, 2012 at 8:42 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> I think I'm fine with this. Whose tree should it go through?

Yours would probably be easier,
Thanks


-- 
Corentin Chary
http://xf.iksaif.net

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

* Re: [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers
  2012-06-26 22:19   ` Mattia Dongili
@ 2012-06-29 12:19     ` Corentin Chary
  0 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-06-29 12:19 UTC (permalink / raw)
  To: Mattia Dongili
  Cc: Len Brown, Matthew Garrett, linux-acpi, platform-driver-x86,
	linux-kernel

On Wed, Jun 27, 2012 at 12:19 AM, Mattia Dongili <malattia@linux.it> wrote:
> Hi Corentin,
>
> On Wed, Jun 13, 2012 at 09:32:01AM +0200, Corentin Chary wrote:
> ...
>> +/* Promote the vendor interface instead of the generic video module.
>> + * This function allow DMI blacklists to be implemented by externals
>> + * platform drivers instead of putting a big blacklist in video_detect.c
>> + * After calling this function you will probably want to call
>> + * acpi_video_unregister() to make sure the video module is not loaded
>> + */
>> +void acpi_video_dmi_promote_vendor(void)
>> +{
>> +     acpi_video_caps_check();
>> +     acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
>> +}
>> +EXPORT_SYMBOL(acpi_video_dmi_promote_vendor);
>
> I think having the promote_vendor() function do the sanity check on the
> acpi_backlight parameter and the unregistering of the acpi_video device
> may make the code cleaner and more acpi_video-agnostic in the drivers.
> I.e. (untested sample code):
>
> bool acpi_video_promote_vendor(void)
> {
>        if (acpi_video_backlight_support())
>                return false;
>
>        acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
>        pr_info("Disabling ACPI video driver\n");
>        acpi_video_unregister();
>        return true;
> }
> EXPORT_SYMBOL(acpi_video_promote_vendor);
>
> and in the drivers you do
>
>        if (my_drv->broken_acpi_video) {
>                if (acpi_video_promote_vendor())
>                        do_backlight_init();
>        } else if (!acpi_video_backlight_support())
>                do_backlight_init();
>
> or something along these lines.
> If you give a boolean parameter to acpi_video_promote_vendor to force
> vendor backlight we could make the drivers' code even simpler but that
> would change the semantics of the "promotion" to something more of a
> "take-over".
>
> PS: I will need to promote backlight control in sony-laptop.ko
> eventually as well but I don't have a DMI based list but rather I should
> look at a specific handle (or say Method) presence in the SNC Device.
> I guess I'm just bothered by the function naming here but not a big
> deal. :)
> --
> mattia
> :wq!

I had something like that in mind, but it makes acpi.ko use symbols
from video.ko, and video.ko already uses symbols from acpi.ko, and I
didn't want to mess with circular dependencies. But if you manage to
make it work, and if you want to remove dmi_, I'll hapilly Ack it !



-- 
Corentin Chary
http://xf.iksaif.net

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

* Re: [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus
  2012-06-29 12:16   ` Corentin Chary
@ 2012-07-16  5:45     ` Corentin Chary
  2012-07-23 13:35       ` Matthew Garrett
  0 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-07-16  5:45 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Len Brown, linux-acpi, platform-driver-x86

On Fri, Jun 29, 2012 at 2:16 PM, Corentin Chary
<corentin.chary@gmail.com> wrote:
> On Tue, Jun 26, 2012 at 8:42 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
>> I think I'm fine with this. Whose tree should it go through?
>
> Yours would probably be easier,
> Thanks

Hi Matthew,
Any news on this series ?
Thanks.

-- 
Corentin Chary
http://xf.iksaif.net

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

* Re: [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus
  2012-07-16  5:45     ` Corentin Chary
@ 2012-07-23 13:35       ` Matthew Garrett
  0 siblings, 0 replies; 23+ messages in thread
From: Matthew Garrett @ 2012-07-23 13:35 UTC (permalink / raw)
  To: Corentin Chary; +Cc: Len Brown, linux-acpi, platform-driver-x86

On Mon, Jul 16, 2012 at 07:45:37AM +0200, Corentin Chary wrote:
> On Fri, Jun 29, 2012 at 2:16 PM, Corentin Chary
> <corentin.chary@gmail.com> wrote:
> > On Tue, Jun 26, 2012 at 8:42 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> >> I think I'm fine with this. Whose tree should it go through?
> >
> > Yours would probably be easier,
> > Thanks
> 
> Hi Matthew,
> Any news on this series ?
> Thanks.

I'll merge these for 3.6.

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

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

end of thread, other threads:[~2012-07-23 13:35 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
2012-06-13  7:32 ` [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers Corentin Chary
2012-06-26 22:19   ` Mattia Dongili
2012-06-29 12:19     ` Corentin Chary
2012-06-13  7:32 ` [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor() Corentin Chary
2012-06-14  9:58   ` joeyli
2012-06-14  9:58     ` joeyli
2012-06-14 10:54     ` Corentin Chary
2012-06-14 10:54       ` Corentin Chary
2012-06-14 11:04       ` Corentin Chary
2012-06-14 12:53         ` joeyli
2012-06-14 12:53           ` joeyli
2012-06-14 20:02         ` Seth Forshee
2012-06-13  7:32 ` [PATCH 3/7] samsung-laptop: X360 ACPI backlight device is broken Corentin Chary
2012-06-13  7:32 ` [PATCH 4/7] acpi/video_detect: blacklist samsung x360 Corentin Chary
2012-06-13  7:32 ` [PATCH 5/7] samsung-laptop: support R40/R41 Corentin Chary
2012-06-13  7:32 ` [PATCH 6/7] asus-wmi: control backlight power through WMI, not ACPI Corentin Chary
2012-06-14 11:05   ` Corentin Chary
2012-06-13  7:32 ` [PATCH 7/7] asus-wmi: enable resume on lid open Corentin Chary
2012-06-26 18:42 ` [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Matthew Garrett
2012-06-29 12:16   ` Corentin Chary
2012-07-16  5:45     ` Corentin Chary
2012-07-23 13:35       ` 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.