linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/14] ACPI / Video: blacklist some samsung laptops
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20 16:05   ` Matthew Garrett
  2012-03-20  8:53 ` [PATCH 02/14] asus-nb-wmi: ignore useless keys Corentin Chary
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Corentin Chary, Len Brown, linux-acpi, linux-kernel

From: Corentin Chary <corentincj@iksaif.net>

On these laptops, the ACPI video is not functional, and very unlikely
to be fixed by the vendor. Note that intel_backlight works for some
of these laptops, and the backlight from samsung-laptop always work.

The good news is that newer laptops have functional ACPI video device
and won't end up growing this list.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/acpi/video_detect.c |   49 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 45d8097..66be45e 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -132,6 +132,53 @@ 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[] = {
+	{
+	 .callback = video_detect_force_vendor,
+	 .ident = "N150P",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "N150P"),
+		DMI_MATCH(DMI_BOARD_NAME, "N150P"),
+		},
+	},
+	{
+	 .callback = video_detect_force_vendor,
+	 .ident = "N145P/N250P/N260P",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
+		DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
+		},
+	},
+	{
+	 .callback = video_detect_force_vendor,
+	 .ident = "N150/N210/N220",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"),
+		DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"),
+		},
+	},
+	{
+	 .callback = video_detect_force_vendor,
+	 .ident = "NF110/NF210/NF310",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
+		DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
+		},
+	},
+};
+
 /*
  * Returns the video capabilities of a specific ACPI graphics device
  *
@@ -164,6 +211,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.3.4


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

* [PATCH 02/14] asus-nb-wmi: ignore useless keys
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
  2012-03-20  8:53 ` [PATCH 01/14] ACPI / Video: blacklist some samsung laptops Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 03/14] eeepc-wmi: add extra keymaps for EP121 Corentin Chary
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Corentin Chary, acpi4asus-user, linux-kernel

From: Corentin Chary <corentincj@iksaif.net>

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/asus-nb-wmi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index b0859d4..3501127 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -70,6 +70,8 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
 	{ KE_KEY, 0x50, { KEY_EMAIL } },
 	{ KE_KEY, 0x51, { KEY_WWW } },
 	{ KE_KEY, 0x55, { KEY_CALC } },
+	{ KE_IGNORE, 0x57, },  /* Battery mode */
+	{ KE_IGNORE, 0x58, },  /* AC mode */
 	{ KE_KEY, 0x5C, { KEY_F15 } },  /* Power Gear key */
 	{ KE_KEY, 0x5D, { KEY_WLAN } }, /* Wireless console Toggle */
 	{ KE_KEY, 0x5E, { KEY_WLAN } }, /* Wireless console Enable */
-- 
1.7.3.4


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

* [PATCH 03/14] eeepc-wmi: add extra keymaps for EP121
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
  2012-03-20  8:53 ` [PATCH 01/14] ACPI / Video: blacklist some samsung laptops Corentin Chary
  2012-03-20  8:53 ` [PATCH 02/14] asus-nb-wmi: ignore useless keys Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 04/14] asus-wmi: on/off bit is not set when reading the value Corentin Chary
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Chih-Wei Huang, Corentin Chary,
	acpi4asus-user, linux-kernel

From: Chih-Wei Huang <cwhuang@linux.org.tw>

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/eeepc-wmi.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 9f6e643..1d91eb2 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -84,6 +84,9 @@ static const struct key_entry eeepc_wmi_keymap[] = {
 	{ KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
 	{ KE_KEY, 0xee, { KEY_CAMERA_LEFT } },
 	{ KE_KEY, 0xef, { KEY_CAMERA_RIGHT } },
+	{ KE_KEY, 0xf3, { KEY_MENU } },
+	{ KE_KEY, 0xf5, { KEY_HOMEPAGE } },
+	{ KE_KEY, 0xf6, { KEY_ESC } },
 	{ KE_END, 0},
 };
 
-- 
1.7.3.4


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

* [PATCH 04/14] asus-wmi: on/off bit is not set when reading the value
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (2 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 03/14] eeepc-wmi: add extra keymaps for EP121 Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 05/14] drivers, samsung-laptop: fix initialization of sabi_data in sabi_set_commandb Corentin Chary
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Corentin Chary, Corentin Chary,
	acpi4asus-user, linux-kernel

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-wmi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 72d731c..2b88347 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -411,7 +411,7 @@ static int kbd_led_read(struct asus_wmi *asus, int *level, int *env)
 
 	if (retval >= 0) {
 		if (level)
-			*level = retval & 0x80 ? retval & 0x7F : 0;
+			*level = retval & 0x7F;
 		if (env)
 			*env = (retval >> 8) & 0x7F;
 		retval = 0;
-- 
1.7.3.4


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

* [PATCH 05/14] drivers, samsung-laptop: fix initialization of sabi_data in sabi_set_commandb
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (3 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 04/14] asus-wmi: on/off bit is not set when reading the value Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 06/14] drivers, samsung-laptop: fix usage of isalnum Corentin Chary
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, David Rientjes, Corentin Chary, linux-kernel

From: David Rientjes <rientjes@google.com>

Fields d0, d1, d2, and d3 are members of an anonymous struct inside an
anonymous union inside struct sabi_data.  Initialization must be done by
wrapping the anonymous union and structs with brackets to avoid a build
error:

drivers/platform/x86/samsung-laptop.c: In function ‘sabi_set_commandb’:
drivers/platform/x86/samsung-laptop.c:433: error: unknown field ‘d0’ specified in initializer
drivers/platform/x86/samsung-laptop.c:433: warning: missing braces around initializer
drivers/platform/x86/samsung-laptop.c:433: warning: (near initialization for ‘in.<anonymous>’)
...

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/samsung-laptop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 7d7109f..b7c67c8 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -430,7 +430,7 @@ exit:
 static int sabi_set_commandb(struct samsung_laptop *samsung,
 			     u16 command, u8 data)
 {
-	struct sabi_data in = { .d0 = 0, .d1 = 0, .d2 = 0, .d3 = 0 };
+	struct sabi_data in = { { { .d0 = 0, .d1 = 0, .d2 = 0, .d3 = 0 } } };
 
 	in.data[0] = data;
 	return sabi_command(samsung, command, &in, NULL);
-- 
1.7.3.4


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

* [PATCH 06/14] drivers, samsung-laptop: fix usage of isalnum
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (4 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 05/14] drivers, samsung-laptop: fix initialization of sabi_data in sabi_set_commandb Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 07/14] samsung-laptop: cleanup return type: mode_t vs umode_t Corentin Chary
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, David Rientjes, Corentin Chary, linux-kernel

From: David Rientjes <rientjes@google.com>

linux/ctype.h is needed for isalnum() to avoid a build error:

drivers/platform/x86/samsung-laptop.c: In function ‘samsung_sabi_diag’:
drivers/platform/x86/samsung-laptop.c:1306: error: implicit declaration of function ‘isalnum’

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/samsung-laptop.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index b7c67c8..d1142e3 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -25,6 +25,7 @@
 #include <linux/acpi.h>
 #include <linux/seq_file.h>
 #include <linux/debugfs.h>
+#include <linux/ctype.h>
 
 /*
  * This driver is needed because a number of Samsung laptops do not hook
-- 
1.7.3.4


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

* [PATCH 07/14] samsung-laptop: cleanup return type: mode_t vs umode_t
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (5 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 06/14] drivers, samsung-laptop: fix usage of isalnum Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 08/14] asus-wmi: add scalar board brightness adj. support Corentin Chary
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Dan Carpenter, Corentin Chary, linux-kernel

From: Dan Carpenter <dan.carpenter@oracle.com>

This function returns a umode_t (unsigned short) instead of mode_t which
is an unsigned int on some architectures.  Cleaning this up silences a
compile warning:

drivers/platform/x86/samsung-laptop.c:1108:2: warning: initialization
	from incompatible pointer type [enabled by default]

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/samsung-laptop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index d1142e3..4787afd 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1087,7 +1087,7 @@ static int __init samsung_backlight_init(struct samsung_laptop *samsung)
 	return 0;
 }
 
-static mode_t samsung_sysfs_is_visible(struct kobject *kobj,
+static umode_t samsung_sysfs_is_visible(struct kobject *kobj,
 				       struct attribute *attr, int idx)
 {
 	struct device *dev = container_of(kobj, struct device, kobj);
-- 
1.7.3.4


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

* [PATCH 08/14] asus-wmi: add scalar board brightness adj. support
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (6 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 07/14] samsung-laptop: cleanup return type: mode_t vs umode_t Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 09/14] asus-wmi: store backlight power status for AIO machine Corentin Chary
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, AceLan Kao, Corentin Chary, Corentin Chary,
	acpi4asus-user, linux-kernel

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

Some ASUS ET2012E/I All-in-One machines that use a scalar board
to control the brightness, and they only accept brightness up and down
command. So, I introduced a get_scalar_command() function to pass the
command to the scalar board through WMI.

Besides, we have to store the brightness value locally, for we need the
old value to know the brightness value is increasing or decreasing.

BTW, since there is no way to retrieve the actual brightness(it would be
a fixed value), and the max brightness value would be fixed to 1, so we
have to keep passing the brightness up/down command when we reached the
max brightness value or 0.

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-nb-wmi.c |    2 +-
 drivers/platform/x86/asus-wmi.c    |   33 ++++++++++++--
 drivers/platform/x86/asus-wmi.h    |   10 +++-
 drivers/platform/x86/eeepc-wmi.c   |   85 +++++++++++++++++++++++++-----------
 4 files changed, 97 insertions(+), 33 deletions(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 3501127..1aea6b8 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -101,7 +101,7 @@ static struct asus_wmi_driver asus_nb_wmi_driver = {
 	.keymap = asus_nb_wmi_keymap,
 	.input_name = "Asus WMI hotkeys",
 	.input_phys = ASUS_NB_WMI_FILE "/input0",
-	.quirks = asus_nb_wmi_quirks,
+	.detect_quirks = asus_nb_wmi_quirks,
 };
 
 
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 2b88347..eb114f8 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -784,7 +784,8 @@ static int asus_new_rfkill(struct asus_wmi *asus,
 	arfkill->dev_id = dev_id;
 	arfkill->asus = asus;
 
-	if (dev_id == ASUS_WMI_DEVID_WLAN && asus->driver->hotplug_wireless)
+	if (dev_id == ASUS_WMI_DEVID_WLAN &&
+	    asus->driver->quirks->hotplug_wireless)
 		*rfkill = rfkill_alloc(name, &asus->platform_device->dev, type,
 				       &asus_rfkill_wlan_ops, arfkill);
 	else
@@ -895,7 +896,7 @@ static int asus_wmi_rfkill_init(struct asus_wmi *asus)
 	if (result && result != -ENODEV)
 		goto exit;
 
-	if (!asus->driver->hotplug_wireless)
+	if (!asus->driver->quirks->hotplug_wireless)
 		goto exit;
 
 	result = asus_setup_pci_hotplug(asus);
@@ -1116,13 +1117,33 @@ static int read_brightness(struct backlight_device *bd)
 	return retval & ASUS_WMI_DSTS_BRIGHTNESS_MASK;
 }
 
+static u32 get_scalar_command(struct backlight_device *bd)
+{
+	struct asus_wmi *asus = bl_get_data(bd);
+	u32 ctrl_param = 0;
+
+	if ((asus->driver->brightness < bd->props.brightness) ||
+	    bd->props.brightness == bd->props.max_brightness)
+		ctrl_param = 0x00008001;
+	else if ((asus->driver->brightness > bd->props.brightness) ||
+		 bd->props.brightness == 0)
+		ctrl_param = 0x00008000;
+
+	asus->driver->brightness = bd->props.brightness;
+
+	return ctrl_param;
+}
+
 static int update_bl_status(struct backlight_device *bd)
 {
 	struct asus_wmi *asus = bl_get_data(bd);
 	u32 ctrl_param;
 	int power, err;
 
-	ctrl_param = bd->props.brightness;
+	if (asus->driver->quirks->scalar_panel_brightness)
+		ctrl_param = get_scalar_command(bd);
+	else
+		ctrl_param = bd->props.brightness;
 
 	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
 				    ctrl_param, NULL);
@@ -1200,6 +1221,8 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus)
 	bd->props.power = power;
 	backlight_update_status(bd);
 
+	asus->driver->brightness = bd->props.brightness;
+
 	return 0;
 }
 
@@ -1622,8 +1645,8 @@ static int asus_wmi_add(struct platform_device *pdev)
 	wdrv->platform_device = pdev;
 	platform_set_drvdata(asus->platform_device, asus);
 
-	if (wdrv->quirks)
-		wdrv->quirks(asus->driver);
+	if (wdrv->detect_quirks)
+		wdrv->detect_quirks(asus->driver);
 
 	err = asus_wmi_platform_init(asus);
 	if (err)
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index 8147c10..ac7dd4e 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -35,9 +35,14 @@ struct module;
 struct key_entry;
 struct asus_wmi;
 
+struct quirk_entry {
+	bool hotplug_wireless;
+	bool scalar_panel_brightness;
+};
+
 struct asus_wmi_driver {
-	bool			hotplug_wireless;
 	int			wapf;
+	int			brightness;
 
 	const char		*name;
 	struct module		*owner;
@@ -47,13 +52,14 @@ struct asus_wmi_driver {
 	const struct key_entry	*keymap;
 	const char		*input_name;
 	const char		*input_phys;
+	struct quirk_entry	*quirks;
 	/* Returns new code, value, and autorelease values in arguments.
 	 * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */
 	void (*key_filter) (struct asus_wmi_driver *driver, int *code,
 			    unsigned int *value, bool *autorelease);
 
 	int (*probe) (struct platform_device *device);
-	void (*quirks) (struct asus_wmi_driver *driver);
+	void (*detect_quirks) (struct asus_wmi_driver *driver);
 
 	struct platform_driver	platform_driver;
 	struct platform_device *platform_device;
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 1d91eb2..67186e6 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -48,6 +48,7 @@ MODULE_LICENSE("GPL");
 
 MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID);
 
+static struct quirk_entry *quirks;
 static bool hotplug_wireless;
 
 module_param(hotplug_wireless, bool, 0444);
@@ -90,6 +91,60 @@ static const struct key_entry eeepc_wmi_keymap[] = {
 	{ KE_END, 0},
 };
 
+static struct quirk_entry quirk_asus_unknown = {
+};
+
+static struct quirk_entry quirk_asus_1000h = {
+	.hotplug_wireless = true,
+};
+
+static struct quirk_entry quirk_asus_et2012_type3 = {
+	.scalar_panel_brightness = true,
+};
+
+static int dmi_matched(const struct dmi_system_id *dmi)
+{
+	char *model;
+	quirks = dmi->driver_data;
+
+	model = (char *)dmi->matches[1].substr;
+	if (unlikely(strncmp(model, "ET2012", 6) == 0)) {
+		const struct dmi_device *dev = NULL;
+		char oemstring[30];
+		while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL,
+					      dev))) {
+			if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) {
+				if (oemstring[18] == '3')
+					quirks = &quirk_asus_et2012_type3;
+				break;
+			}
+		}
+	}
+	return 1;
+}
+
+static struct dmi_system_id asus_quirks[] = {
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK Computer INC. 1000H",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "1000H"),
+		},
+		.driver_data = &quirk_asus_1000h,
+	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK Computer INC. ET2012E/I",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ET2012"),
+		},
+		.driver_data = &quirk_asus_unknown,
+	},
+	{},
+};
+
 static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
 				 unsigned int *value, bool *autorelease)
 {
@@ -144,33 +199,13 @@ static int eeepc_wmi_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static void eeepc_dmi_check(struct asus_wmi_driver *driver)
-{
-	const char *model;
-
-	model = dmi_get_system_info(DMI_PRODUCT_NAME);
-	if (!model)
-		return;
-
-	/*
-	 * Whitelist for wlan hotplug
-	 *
-	 * Asus 1000H needs the current hotplug code to handle
-	 * Fn+F2 correctly. We may add other Asus here later, but
-	 * it seems that most of the laptops supported by asus-wmi
-	 * don't need to be on this list
-	 */
-	if (strcmp(model, "1000H") == 0) {
-		driver->hotplug_wireless = true;
-		pr_info("wlan hotplug enabled\n");
-	}
-}
-
 static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
 {
-	driver->hotplug_wireless = hotplug_wireless;
 	driver->wapf = -1;
-	eeepc_dmi_check(driver);
+	driver->quirks = &quirk_asus_unknown;
+	driver->quirks->hotplug_wireless = hotplug_wireless;
+	dmi_check_system(asus_quirks);
+	driver->quirks = quirks;
 }
 
 static struct asus_wmi_driver asus_wmi_driver = {
@@ -182,7 +217,7 @@ static struct asus_wmi_driver asus_wmi_driver = {
 	.input_phys = EEEPC_WMI_FILE "/input0",
 	.key_filter = eeepc_wmi_key_filter,
 	.probe = eeepc_wmi_probe,
-	.quirks = eeepc_wmi_quirks,
+	.detect_quirks = eeepc_wmi_quirks,
 };
 
 
-- 
1.7.3.4


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

* [PATCH 09/14] asus-wmi: store backlight power status for AIO machine
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (7 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 08/14] asus-wmi: add scalar board brightness adj. support Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 10/14] asus-wmi: move WAPF variable into quirks_entry Corentin Chary
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, AceLan Kao, Corentin Chary, Corentin Chary,
	acpi4asus-user, linux-kernel

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

Due to some implementation reasons, ASUS ET2012 All-in-One machines
can't report the correct backlight power status, it will always return
1. To track the backlight power status correctly, we have to store the
status by ourselves.

BTW, by the BIOS design, the backlight power will be turn on/off
sequently, no matter what the value of the parameter will be.
More over, the brightness adjustment command will turn on the backlight
power. Those behaviors will make us fail to track the backlight power
status.
For example, While we are trying to turn on the backlight power,
we will send out the brightness adjustment command and then trying to
figure out if we have to turn on the backlight power, then send out
the command. But, the real case is that, the backlight power turns on
while sending the brightness adjustment command, and then we send out
the command to turn on the backlight power, it actually will turn off
the backlight power and the backlight power status we recorded becomes
wrong. So, we have to seperate these two commands by a if statement.

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-wmi.c  |   33 ++++++++++++++++++++-------------
 drivers/platform/x86/asus-wmi.h  |    2 ++
 drivers/platform/x86/eeepc-wmi.c |   15 ++++++++++++---
 3 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index eb114f8..c4ad76e 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1076,7 +1076,12 @@ static int asus_wmi_hwmon_init(struct asus_wmi *asus)
  */
 static int read_backlight_power(struct asus_wmi *asus)
 {
-	int ret = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_BACKLIGHT);
+	int ret;
+	if (asus->driver->quirks->store_backlight_power)
+		ret = !asus->driver->panel_power;
+	else
+		ret = asus_wmi_get_devstate_simple(asus,
+						   ASUS_WMI_DEVID_BACKLIGHT);
 
 	if (ret < 0)
 		return ret;
@@ -1138,24 +1143,23 @@ static int update_bl_status(struct backlight_device *bd)
 {
 	struct asus_wmi *asus = bl_get_data(bd);
 	u32 ctrl_param;
-	int power, err;
-
-	if (asus->driver->quirks->scalar_panel_brightness)
-		ctrl_param = get_scalar_command(bd);
-	else
-		ctrl_param = bd->props.brightness;
-
-	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
-				    ctrl_param, NULL);
-
-	if (err < 0)
-		return err;
+	int power, err = 0;
 
 	power = read_backlight_power(asus);
 	if (power != -ENODEV && bd->props.power != power) {
 		ctrl_param = !!(bd->props.power == FB_BLANK_UNBLANK);
 		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT,
 					    ctrl_param, NULL);
+		if (asus->driver->quirks->store_backlight_power)
+			asus->driver->panel_power = bd->props.power;
+	} else {
+		if (asus->driver->quirks->scalar_panel_brightness)
+			ctrl_param = get_scalar_command(bd);
+		else
+			ctrl_param = bd->props.brightness;
+
+		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
+					    ctrl_param, NULL);
 	}
 	return err;
 }
@@ -1217,6 +1221,9 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus)
 
 	asus->backlight_device = bd;
 
+	if (asus->driver->quirks->store_backlight_power)
+		asus->driver->panel_power = power;
+
 	bd->props.brightness = read_brightness(bd);
 	bd->props.power = power;
 	backlight_update_status(bd);
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index ac7dd4e..35003e4 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -38,11 +38,13 @@ struct asus_wmi;
 struct quirk_entry {
 	bool hotplug_wireless;
 	bool scalar_panel_brightness;
+	bool store_backlight_power;
 };
 
 struct asus_wmi_driver {
 	int			wapf;
 	int			brightness;
+	int			panel_power;
 
 	const char		*name;
 	struct module		*owner;
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 67186e6..9f8ccf9 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -32,6 +32,7 @@
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
 #include <linux/dmi.h>
+#include <linux/fb.h>
 #include <acpi/acpi_bus.h>
 
 #include "asus-wmi.h"
@@ -98,8 +99,13 @@ static struct quirk_entry quirk_asus_1000h = {
 	.hotplug_wireless = true,
 };
 
+static struct quirk_entry quirk_asus_et2012_type1 = {
+	.store_backlight_power = true,
+};
+
 static struct quirk_entry quirk_asus_et2012_type3 = {
 	.scalar_panel_brightness = true,
+	.store_backlight_power = true,
 };
 
 static int dmi_matched(const struct dmi_system_id *dmi)
@@ -111,10 +117,12 @@ static int dmi_matched(const struct dmi_system_id *dmi)
 	if (unlikely(strncmp(model, "ET2012", 6) == 0)) {
 		const struct dmi_device *dev = NULL;
 		char oemstring[30];
-		while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL,
-					      dev))) {
+		while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
+					      NULL, dev))) {
 			if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) {
-				if (oemstring[18] == '3')
+				if (oemstring[18] == '1')
+					quirks = &quirk_asus_et2012_type1;
+				else if (oemstring[18] == '3')
 					quirks = &quirk_asus_et2012_type3;
 				break;
 			}
@@ -202,6 +210,7 @@ static int eeepc_wmi_probe(struct platform_device *pdev)
 static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
 {
 	driver->wapf = -1;
+	driver->panel_power = FB_BLANK_UNBLANK;
 	driver->quirks = &quirk_asus_unknown;
 	driver->quirks->hotplug_wireless = hotplug_wireless;
 	dmi_check_system(asus_quirks);
-- 
1.7.3.4


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

* [PATCH 10/14] asus-wmi: move WAPF variable into quirks_entry
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (8 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 09/14] asus-wmi: store backlight power status for AIO machine Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 11/14] asus-nb-wmi: set panel_power correctly Corentin Chary
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Corentin Chary, AceLan Kao, Corentin Chary,
	acpi4asus-user, linux-kernel

Some models work better with different values of wapf, so move the
variable into quriks_entry to make it more easy to give a specific
value to different models.

Based on original patch from AceLan Kao <acelan.kao@canonical.com>

Cc: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-nb-wmi.c |    6 +++++-
 drivers/platform/x86/asus-wmi.c    |    4 ++--
 drivers/platform/x86/asus-wmi.h    |    2 +-
 drivers/platform/x86/eeepc-wmi.c   |    2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 1aea6b8..b12038c 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -51,9 +51,13 @@ static uint wapf;
 module_param(wapf, uint, 0444);
 MODULE_PARM_DESC(wapf, "WAPF value");
 
+static struct quirk_entry quirk_asus_unknown = {
+};
+
 static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
 {
-	driver->wapf = wapf;
+	driver->quirks = &quirk_asus_unknown;
+	driver->quirks->wapf = wapf;
 }
 
 static const struct key_entry asus_nb_wmi_keymap[] = {
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index c4ad76e..ff9cfd8 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1471,9 +1471,9 @@ static int asus_wmi_platform_init(struct asus_wmi *asus)
 
 	/* CWAP allow to define the behavior of the Fn+F2 key,
 	 * this method doesn't seems to be present on Eee PCs */
-	if (asus->driver->wapf >= 0)
+	if (asus->driver->quirks->wapf >= 0)
 		asus_wmi_set_devstate(ASUS_WMI_DEVID_CWAP,
-				      asus->driver->wapf, NULL);
+				      asus->driver->quirks->wapf, NULL);
 
 	return asus_wmi_sysfs_init(asus->platform_device);
 }
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index 35003e4..d43b667 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -39,10 +39,10 @@ struct quirk_entry {
 	bool hotplug_wireless;
 	bool scalar_panel_brightness;
 	bool store_backlight_power;
+	int wapf;
 };
 
 struct asus_wmi_driver {
-	int			wapf;
 	int			brightness;
 	int			panel_power;
 
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 9f8ccf9..389ff88 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -209,10 +209,10 @@ static int eeepc_wmi_probe(struct platform_device *pdev)
 
 static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
 {
-	driver->wapf = -1;
 	driver->panel_power = FB_BLANK_UNBLANK;
 	driver->quirks = &quirk_asus_unknown;
 	driver->quirks->hotplug_wireless = hotplug_wireless;
+	driver->quirks->wapf = -1;
 	dmi_check_system(asus_quirks);
 	driver->quirks = quirks;
 }
-- 
1.7.3.4


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

* [PATCH 11/14] asus-nb-wmi: set panel_power correctly
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (9 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 10/14] asus-wmi: move WAPF variable into quirks_entry Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 12/14] eeepc-wmi: refine quirks handling Corentin Chary
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Corentin Chary, Corentin Chary,
	acpi4asus-user, linux-kernel

Even if it's currently unused.

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-nb-wmi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index b12038c..99a30b5 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -25,6 +25,7 @@
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
+#include <linux/fb.h>
 
 #include "asus-wmi.h"
 
@@ -58,6 +59,7 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
 {
 	driver->quirks = &quirk_asus_unknown;
 	driver->quirks->wapf = wapf;
+	driver->panel_power = FB_BLANK_UNBLANK;
 }
 
 static const struct key_entry asus_nb_wmi_keymap[] = {
-- 
1.7.3.4


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

* [PATCH 12/14] eeepc-wmi: refine quirks handling
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (10 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 11/14] asus-nb-wmi: set panel_power correctly Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 13/14] eeepc-wmi: split et2012 specific hacks Corentin Chary
  2012-03-20  8:53 ` [PATCH 14/14] asus-wmi: don't update power and brightness when using scalar Corentin Chary
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Corentin Chary, Corentin Chary,
	acpi4asus-user, linux-kernel

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/eeepc-wmi.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 389ff88..0bb0aaf 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -49,7 +49,6 @@ MODULE_LICENSE("GPL");
 
 MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID);
 
-static struct quirk_entry *quirks;
 static bool hotplug_wireless;
 
 module_param(hotplug_wireless, bool, 0444);
@@ -108,6 +107,8 @@ static struct quirk_entry quirk_asus_et2012_type3 = {
 	.store_backlight_power = true,
 };
 
+static struct quirk_entry *quirks;
+
 static int dmi_matched(const struct dmi_system_id *dmi)
 {
 	char *model;
@@ -209,12 +210,14 @@ static int eeepc_wmi_probe(struct platform_device *pdev)
 
 static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
 {
-	driver->panel_power = FB_BLANK_UNBLANK;
-	driver->quirks = &quirk_asus_unknown;
-	driver->quirks->hotplug_wireless = hotplug_wireless;
-	driver->quirks->wapf = -1;
+	quirks = &quirk_asus_unknown;
+	quirks->hotplug_wireless = hotplug_wireless;
+
 	dmi_check_system(asus_quirks);
+
 	driver->quirks = quirks;
+	driver->quirks->wapf = -1;
+	driver->panel_power = FB_BLANK_UNBLANK;
 }
 
 static struct asus_wmi_driver asus_wmi_driver = {
-- 
1.7.3.4


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

* [PATCH 13/14] eeepc-wmi: split et2012 specific hacks
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (11 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 12/14] eeepc-wmi: refine quirks handling Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  2012-03-20  8:53 ` [PATCH 14/14] asus-wmi: don't update power and brightness when using scalar Corentin Chary
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Corentin Chary, Corentin Chary,
	acpi4asus-user, linux-kernel

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/eeepc-wmi.c |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 0bb0aaf..6567613 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -109,26 +109,32 @@ static struct quirk_entry quirk_asus_et2012_type3 = {
 
 static struct quirk_entry *quirks;
 
+static void et2012_quirks(void)
+{
+	const struct dmi_device *dev = NULL;
+	char oemstring[30];
+
+	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
+		if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) {
+			if (oemstring[18] == '1')
+				quirks = &quirk_asus_et2012_type1;
+			else if (oemstring[18] == '3')
+				quirks = &quirk_asus_et2012_type3;
+			break;
+		}
+	}
+}
+
 static int dmi_matched(const struct dmi_system_id *dmi)
 {
 	char *model;
+
 	quirks = dmi->driver_data;
 
 	model = (char *)dmi->matches[1].substr;
-	if (unlikely(strncmp(model, "ET2012", 6) == 0)) {
-		const struct dmi_device *dev = NULL;
-		char oemstring[30];
-		while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
-					      NULL, dev))) {
-			if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) {
-				if (oemstring[18] == '1')
-					quirks = &quirk_asus_et2012_type1;
-				else if (oemstring[18] == '3')
-					quirks = &quirk_asus_et2012_type3;
-				break;
-			}
-		}
-	}
+	if (unlikely(strncmp(model, "ET2012", 6) == 0))
+		et2012_quirks();
+
 	return 1;
 }
 
-- 
1.7.3.4


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

* [PATCH 14/14] asus-wmi: don't update power and brightness when using scalar
       [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
                   ` (12 preceding siblings ...)
  2012-03-20  8:53 ` [PATCH 13/14] eeepc-wmi: split et2012 specific hacks Corentin Chary
@ 2012-03-20  8:53 ` Corentin Chary
  13 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-03-20  8:53 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Corentin Chary, Corentin Chary,
	acpi4asus-user, linux-kernel

But we can still do it on other boards, as this might happen
if the backlight driver change when update_bl is called.

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-wmi.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index ff9cfd8..7d1684b 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1152,15 +1152,21 @@ static int update_bl_status(struct backlight_device *bd)
 					    ctrl_param, NULL);
 		if (asus->driver->quirks->store_backlight_power)
 			asus->driver->panel_power = bd->props.power;
-	} else {
-		if (asus->driver->quirks->scalar_panel_brightness)
-			ctrl_param = get_scalar_command(bd);
-		else
-			ctrl_param = bd->props.brightness;
 
-		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
-					    ctrl_param, NULL);
+		/* When using scalar brightness, updating the brightness
+		 * will mess with the backlight power */
+		if (asus->driver->quirks->scalar_panel_brightness)
+			return err;
 	}
+
+	if (asus->driver->quirks->scalar_panel_brightness)
+		ctrl_param = get_scalar_command(bd);
+	else
+		ctrl_param = bd->props.brightness;
+
+	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
+				    ctrl_param, NULL);
+
 	return err;
 }
 
-- 
1.7.3.4


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

* Re: [PATCH 01/14] ACPI / Video: blacklist some samsung laptops
  2012-03-20  8:53 ` [PATCH 01/14] ACPI / Video: blacklist some samsung laptops Corentin Chary
@ 2012-03-20 16:05   ` Matthew Garrett
  2012-03-20 16:28     ` Corentin Chary
  0 siblings, 1 reply; 23+ messages in thread
From: Matthew Garrett @ 2012-03-20 16:05 UTC (permalink / raw)
  To: Corentin Chary
  Cc: platform-driver-x86, Corentin Chary, Len Brown, linux-acpi, linux-kernel

On Tue, Mar 20, 2012 at 09:53:01AM +0100, Corentin Chary wrote:
> From: Corentin Chary <corentincj@iksaif.net>
> 
> On these laptops, the ACPI video is not functional, and very unlikely
> to be fixed by the vendor. Note that intel_backlight works for some
> of these laptops, and the backlight from samsung-laptop always work.
> 
> The good news is that newer laptops have functional ACPI video device
> and won't end up growing this list.

Are the hotkeys delivered via ACPI or via the Samsung device? If the 
latter, you can just do unregister_acpi_video() instead in the samsung 
driver and avoid having more machine-specific quirks in the ACPi code.

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

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

* Re: [PATCH 01/14] ACPI / Video: blacklist some samsung laptops
  2012-03-20 16:05   ` Matthew Garrett
@ 2012-03-20 16:28     ` Corentin Chary
  2012-03-20 16:30       ` Matthew Garrett
  0 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-03-20 16:28 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Len Brown, linux-acpi, linux-kernel

On Tue, Mar 20, 2012 at 5:05 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Tue, Mar 20, 2012 at 09:53:01AM +0100, Corentin Chary wrote:
>> From: Corentin Chary <corentincj@iksaif.net>
>>
>> On these laptops, the ACPI video is not functional, and very unlikely
>> to be fixed by the vendor. Note that intel_backlight works for some
>> of these laptops, and the backlight from samsung-laptop always work.
>>
>> The good news is that newer laptops have functional ACPI video device
>> and won't end up growing this list.
>
> Are the hotkeys delivered via ACPI or via the Samsung device? If the
> latter, you can just do unregister_acpi_video() instead in the samsung
> driver and avoid having more machine-specific quirks in the ACPi code.

I wasn't aware of acpi_video_unregister(). The issue with that
solution is that it makes it harder to respect acpi_video= parameter.

On these machines, the ACPI Video device is broken (I don't know how,
I don't have the hardware, I just know it doesn't work at all), and I
want the default to be acpi_backlight=vendor, but it is still a good
idea to let users force acpi_backlight=video.

But if the policy is to use acpi_video_unregister() when the video
module is known to be broken, let's do that.

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

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

* Re: [PATCH 01/14] ACPI / Video: blacklist some samsung laptops
  2012-03-20 16:28     ` Corentin Chary
@ 2012-03-20 16:30       ` Matthew Garrett
  2012-03-22 13:08         ` [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops Corentin Chary
  0 siblings, 1 reply; 23+ messages in thread
From: Matthew Garrett @ 2012-03-20 16:30 UTC (permalink / raw)
  To: Corentin Chary; +Cc: platform-driver-x86, Len Brown, linux-acpi, linux-kernel

On Tue, Mar 20, 2012 at 05:28:06PM +0100, Corentin Chary wrote:
> On Tue, Mar 20, 2012 at 5:05 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > Are the hotkeys delivered via ACPI or via the Samsung device? If the
> > latter, you can just do unregister_acpi_video() instead in the samsung
> > driver and avoid having more machine-specific quirks in the ACPi code.
> 
> I wasn't aware of acpi_video_unregister(). The issue with that
> solution is that it makes it harder to respect acpi_video= parameter.
> 
> On these machines, the ACPI Video device is broken (I don't know how,
> I don't have the hardware, I just know it doesn't work at all), and I
> want the default to be acpi_backlight=vendor, but it is still a good
> idea to let users force acpi_backlight=video.

If it's broken then I don't think there's a great argument for providing 
an argument just to let people re-break their kernel :)

> But if the policy is to use acpi_video_unregister() when the video
> module is known to be broken, let's do that.

As long as ACPI isn't being used to deliver brightness keys, then this 
is fine.

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

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

* [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops
  2012-03-20 16:30       ` Matthew Garrett
@ 2012-03-22 13:08         ` Corentin Chary
  2012-03-27  9:11           ` Corentin Chary
  0 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-03-22 13:08 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Corentin Chary, Matthew Garrett, platform-driver-x86, linux-kernel

On these laptops, the ACPI video is not functional, and very unlikely
to be fixed by the vendor. Note that intel_backlight works for some
of these laptops, and the backlight from samsung-laptop always work.

The good news is that newer laptops have functional ACPI video device
and won't end up growing this list.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/samsung-laptop.c |   80 +++++++++++++++++++++++++++++++--
 1 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 4787afd..e2a34b4 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -26,6 +26,9 @@
 #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
@@ -336,6 +339,7 @@ struct samsung_laptop {
 	struct work_struct kbd_led_work;
 
 	struct samsung_laptop_debug debug;
+	struct samsung_quirks *quirks;
 
 	bool handle_backlight;
 	bool has_stepping_quirk;
@@ -343,7 +347,15 @@ struct samsung_laptop {
 	char sdiag[64];
 };
 
+struct samsung_quirks {
+	bool broken_acpi_video;
+};
+
+static struct samsung_quirks samsung_unknown = {};
 
+static struct samsung_quirks samsung_broken_acpi_video = {
+	.broken_acpi_video = true,
+};
 
 static bool force;
 module_param(force, bool, 0);
@@ -1416,6 +1428,14 @@ static int __init samsung_platform_init(struct samsung_laptop *samsung)
 	return 0;
 }
 
+static struct samsung_quirks *quirks;
+
+static int __init samsung_dmi_matched(const struct dmi_system_id *d)
+{
+	quirks = d->driver_data;
+	return 0;
+}
+
 static struct dmi_system_id __initdata samsung_dmi_table[] = {
 	{
 		.matches = {
@@ -1445,6 +1465,47 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
 			DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
 		},
 	},
+	/* Specific DMI ids for laptop with quirks */
+	{
+	 .callback = samsung_dmi_matched,
+	 .ident = "N150P",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "N150P"),
+		DMI_MATCH(DMI_BOARD_NAME, "N150P"),
+		},
+	 .driver_data = &samsung_broken_acpi_video,
+	},
+	{
+	 .callback = samsung_dmi_matched,
+	 .ident = "N145P/N250P/N260P",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
+		DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
+		},
+	 .driver_data = &samsung_broken_acpi_video,
+	},
+	{
+	 .callback = samsung_dmi_matched,
+	 .ident = "N150/N210/N220",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"),
+		DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"),
+		},
+	 .driver_data = &samsung_broken_acpi_video,
+	},
+	{
+	 .callback = samsung_dmi_matched,
+	 .ident = "NF110/NF210/NF310",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
+		DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
+		},
+	 .driver_data = &samsung_broken_acpi_video,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
@@ -1456,6 +1517,7 @@ static int __init samsung_init(void)
 	struct samsung_laptop *samsung;
 	int ret;
 
+	quirks = &samsung_unknown;
 	if (!force && !dmi_check_system(samsung_dmi_table))
 		return -ENODEV;
 
@@ -1465,12 +1527,21 @@ static int __init samsung_init(void)
 
 	mutex_init(&samsung->sabi_mutex);
 	samsung->handle_backlight = true;
+	samsung->quirks = quirks;
 
-#ifdef CONFIG_ACPI
+
+#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
 	/* Don't handle backlight here if the acpi video already handle it */
-	if (acpi_video_backlight_support())
-		samsung->handle_backlight = false;
+	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;
+		}
+	}
 #endif
+
 	ret = samsung_platform_init(samsung);
 	if (ret)
 		goto error_platform;
@@ -1481,7 +1552,8 @@ 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())
+	if (acpi_video_backlight_support() &&
+	    !samsung->quirks->broken_acpi_video)
 		pr_info("Backlight controlled by ACPI video driver\n");
 #endif
 
-- 
1.7.3.4


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

* Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops
  2012-03-22 13:08         ` [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops Corentin Chary
@ 2012-03-27  9:11           ` Corentin Chary
  2012-03-27 11:21             ` Matthew Garrett
  0 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-03-27  9:11 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Corentin Chary, Matthew Garrett, platform-driver-x86, linux-kernel

On Thu, Mar 22, 2012 at 2:08 PM, Corentin Chary <corentincj@iksaif.net> wrote:
> On these laptops, the ACPI video is not functional, and very unlikely
> to be fixed by the vendor. Note that intel_backlight works for some
> of these laptops, and the backlight from samsung-laptop always work.
>
> The good news is that newer laptops have functional ACPI video device
> and won't end up growing this list.
>
> Signed-off-by: Corentin Chary <corentincj@iksaif.net>
> ---
>  drivers/platform/x86/samsung-laptop.c |   80 +++++++++++++++++++++++++++++++--
>  1 files changed, 76 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
> index 4787afd..e2a34b4 100644
> --- a/drivers/platform/x86/samsung-laptop.c
> +++ b/drivers/platform/x86/samsung-laptop.c
> @@ -26,6 +26,9 @@
>  #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
> @@ -336,6 +339,7 @@ struct samsung_laptop {
>        struct work_struct kbd_led_work;
>
>        struct samsung_laptop_debug debug;
> +       struct samsung_quirks *quirks;
>
>        bool handle_backlight;
>        bool has_stepping_quirk;
> @@ -343,7 +347,15 @@ struct samsung_laptop {
>        char sdiag[64];
>  };
>
> +struct samsung_quirks {
> +       bool broken_acpi_video;
> +};
> +
> +static struct samsung_quirks samsung_unknown = {};
>
> +static struct samsung_quirks samsung_broken_acpi_video = {
> +       .broken_acpi_video = true,
> +};
>
>  static bool force;
>  module_param(force, bool, 0);
> @@ -1416,6 +1428,14 @@ static int __init samsung_platform_init(struct samsung_laptop *samsung)
>        return 0;
>  }
>
> +static struct samsung_quirks *quirks;
> +
> +static int __init samsung_dmi_matched(const struct dmi_system_id *d)
> +{
> +       quirks = d->driver_data;
> +       return 0;
> +}
> +
>  static struct dmi_system_id __initdata samsung_dmi_table[] = {
>        {
>                .matches = {
> @@ -1445,6 +1465,47 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
>                        DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
>                },
>        },
> +       /* Specific DMI ids for laptop with quirks */
> +       {
> +        .callback = samsung_dmi_matched,
> +        .ident = "N150P",
> +        .matches = {
> +               DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
> +               DMI_MATCH(DMI_PRODUCT_NAME, "N150P"),
> +               DMI_MATCH(DMI_BOARD_NAME, "N150P"),
> +               },
> +        .driver_data = &samsung_broken_acpi_video,
> +       },
> +       {
> +        .callback = samsung_dmi_matched,
> +        .ident = "N145P/N250P/N260P",
> +        .matches = {
> +               DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
> +               DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
> +               DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
> +               },
> +        .driver_data = &samsung_broken_acpi_video,
> +       },
> +       {
> +        .callback = samsung_dmi_matched,
> +        .ident = "N150/N210/N220",
> +        .matches = {
> +               DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
> +               DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"),
> +               DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"),
> +               },
> +        .driver_data = &samsung_broken_acpi_video,
> +       },
> +       {
> +        .callback = samsung_dmi_matched,
> +        .ident = "NF110/NF210/NF310",
> +        .matches = {
> +               DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
> +               DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
> +               DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
> +               },
> +        .driver_data = &samsung_broken_acpi_video,
> +       },
>        { },
>  };
>  MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
> @@ -1456,6 +1517,7 @@ static int __init samsung_init(void)
>        struct samsung_laptop *samsung;
>        int ret;
>
> +       quirks = &samsung_unknown;
>        if (!force && !dmi_check_system(samsung_dmi_table))
>                return -ENODEV;
>
> @@ -1465,12 +1527,21 @@ static int __init samsung_init(void)
>
>        mutex_init(&samsung->sabi_mutex);
>        samsung->handle_backlight = true;
> +       samsung->quirks = quirks;
>
> -#ifdef CONFIG_ACPI
> +
> +#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
>        /* Don't handle backlight here if the acpi video already handle it */
> -       if (acpi_video_backlight_support())
> -               samsung->handle_backlight = false;
> +       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;
> +               }
> +       }
>  #endif
> +
>        ret = samsung_platform_init(samsung);
>        if (ret)
>                goto error_platform;
> @@ -1481,7 +1552,8 @@ 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())
> +       if (acpi_video_backlight_support() &&
> +           !samsung->quirks->broken_acpi_video)
>                pr_info("Backlight controlled by ACPI video driver\n");
>  #endif
>
> --
> 1.7.3.4
>

Matthew, is this one ok ? I really hope this patch can go in 3.4 so we
don't introduce a regression for old laptops.
Thanks,

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

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

* Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops
  2012-03-27  9:11           ` Corentin Chary
@ 2012-03-27 11:21             ` Matthew Garrett
  2012-04-06  9:42               ` Corentin Chary
  0 siblings, 1 reply; 23+ messages in thread
From: Matthew Garrett @ 2012-03-27 11:21 UTC (permalink / raw)
  To: Corentin Chary; +Cc: Corentin Chary, platform-driver-x86, linux-kernel

On Tue, Mar 27, 2012 at 11:11:18AM +0200, Corentin Chary wrote:
> Matthew, is this one ok ? I really hope this patch can go in 3.4 so we
> don't introduce a regression for old laptops.

Yes, I've got this now.

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

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

* Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops
  2012-03-27 11:21             ` Matthew Garrett
@ 2012-04-06  9:42               ` Corentin Chary
  2012-04-06 14:34                 ` Seth Forshee
  0 siblings, 1 reply; 23+ messages in thread
From: Corentin Chary @ 2012-04-06  9:42 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, linux-kernel, linux acpi, Len Brown

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

On Tue, Mar 27, 2012 at 1:21 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Tue, Mar 27, 2012 at 11:11:18AM +0200, Corentin Chary wrote:
>> Matthew, is this one ok ? I really hope this patch can go in 3.4 so we
>> don't introduce a regression for old laptops.
>
> Yes, I've got this now.
>
> Thanks,


A user just found a DSDT which is broken by this way of doing things
(this is not really a regression since it was also broken before).

_BCL contains a wierd "Or (VDRV, 0x02, VDRV)".
So if you call _BLC once (video.ko will), it set a flag that affect
the behavior of all backlight related stuff, and it breaks
samsung-laptop's backlight even if samsung-laptop unload the acpi
backlight.
Using acpi_backlight=vendor solves that since it prevents the module
from being loaded. My previous patch also fix that since it use
acpi_backlight= mechanism.

Do you think using acpi_backlight=vendor is a good enought solution
here ? Should we use my first patch instead ?


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

[-- Attachment #2: acpidump.bin.gz --]
[-- Type: application/x-gzip, Size: 45898 bytes --]

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

* Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops
  2012-04-06  9:42               ` Corentin Chary
@ 2012-04-06 14:34                 ` Seth Forshee
  2012-04-17  8:31                   ` Corentin Chary
  0 siblings, 1 reply; 23+ messages in thread
From: Seth Forshee @ 2012-04-06 14:34 UTC (permalink / raw)
  To: Matthew Garrett, Corentin Chary
  Cc: platform-driver-x86, linux-kernel, linux acpi, Len Brown

On Fri, Apr 06, 2012 at 11:42:18AM +0200, Corentin Chary wrote:
> On Tue, Mar 27, 2012 at 1:21 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > On Tue, Mar 27, 2012 at 11:11:18AM +0200, Corentin Chary wrote:
> >> Matthew, is this one ok ? I really hope this patch can go in 3.4 so we
> >> don't introduce a regression for old laptops.
> >
> > Yes, I've got this now.
> >
> > Thanks,
> 
> 
> A user just found a DSDT which is broken by this way of doing things
> (this is not really a regression since it was also broken before).
> 
> _BCL contains a wierd "Or (VDRV, 0x02, VDRV)".
> So if you call _BLC once (video.ko will), it set a flag that affect
> the behavior of all backlight related stuff, and it breaks
> samsung-laptop's backlight even if samsung-laptop unload the acpi
> backlight.
> Using acpi_backlight=vendor solves that since it prevents the module
> from being loaded. My previous patch also fix that since it use
> acpi_backlight= mechanism.
> 
> Do you think using acpi_backlight=vendor is a good enought solution
> here ? Should we use my first patch instead ?

I've recently noticed another problem with using acpi_video_unregister()
to disable known broken backlights -- another module might call
acpi_video_register() and make it reappear. i915 does this, so when I
EFI boot the MacBook Pro 8,2 the acpi backlights reappear (under a BIOS
compatible boot the Intel GPU doesn't show up on the bus).

So Corentin's solution does seem like a better way to go, or else
something similar that forces the ACPI video driver to behave as with
acpi_video=vendor.

Seth


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

* Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops
  2012-04-06 14:34                 ` Seth Forshee
@ 2012-04-17  8:31                   ` Corentin Chary
  0 siblings, 0 replies; 23+ messages in thread
From: Corentin Chary @ 2012-04-17  8:31 UTC (permalink / raw)
  To: Matthew Garrett, Corentin Chary, platform-driver-x86,
	linux-kernel, linux acpi, Len Brown

On Fri, Apr 6, 2012 at 4:34 PM, Seth Forshee <seth.forshee@canonical.com> wrote:
> On Fri, Apr 06, 2012 at 11:42:18AM +0200, Corentin Chary wrote:
>> On Tue, Mar 27, 2012 at 1:21 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
>> > On Tue, Mar 27, 2012 at 11:11:18AM +0200, Corentin Chary wrote:
>> >> Matthew, is this one ok ? I really hope this patch can go in 3.4 so we
>> >> don't introduce a regression for old laptops.
>> >
>> > Yes, I've got this now.
>> >
>> > Thanks,
>>
>>
>> A user just found a DSDT which is broken by this way of doing things
>> (this is not really a regression since it was also broken before).
>>
>> _BCL contains a wierd "Or (VDRV, 0x02, VDRV)".
>> So if you call _BLC once (video.ko will), it set a flag that affect
>> the behavior of all backlight related stuff, and it breaks
>> samsung-laptop's backlight even if samsung-laptop unload the acpi
>> backlight.
>> Using acpi_backlight=vendor solves that since it prevents the module
>> from being loaded. My previous patch also fix that since it use
>> acpi_backlight= mechanism.
>>
>> Do you think using acpi_backlight=vendor is a good enought solution
>> here ? Should we use my first patch instead ?
>
> I've recently noticed another problem with using acpi_video_unregister()
> to disable known broken backlights -- another module might call
> acpi_video_register() and make it reappear. i915 does this, so when I
> EFI boot the MacBook Pro 8,2 the acpi backlights reappear (under a BIOS
> compatible boot the Intel GPU doesn't show up on the bus).
>
> So Corentin's solution does seem like a better way to go, or else
> something similar that forces the ACPI video driver to behave as with
> acpi_video=vendor.
>
> Seth
>

Matthew, Len, any input on that ? Should we keep the current code even
if broken with some (also broken) hardware or should we move the
blacklist in acpi/video.c ?


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

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

end of thread, other threads:[~2012-04-17  8:31 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1332233594-13099-1-git-send-email-corentin.chary@gmail.com>
2012-03-20  8:53 ` [PATCH 01/14] ACPI / Video: blacklist some samsung laptops Corentin Chary
2012-03-20 16:05   ` Matthew Garrett
2012-03-20 16:28     ` Corentin Chary
2012-03-20 16:30       ` Matthew Garrett
2012-03-22 13:08         ` [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops Corentin Chary
2012-03-27  9:11           ` Corentin Chary
2012-03-27 11:21             ` Matthew Garrett
2012-04-06  9:42               ` Corentin Chary
2012-04-06 14:34                 ` Seth Forshee
2012-04-17  8:31                   ` Corentin Chary
2012-03-20  8:53 ` [PATCH 02/14] asus-nb-wmi: ignore useless keys Corentin Chary
2012-03-20  8:53 ` [PATCH 03/14] eeepc-wmi: add extra keymaps for EP121 Corentin Chary
2012-03-20  8:53 ` [PATCH 04/14] asus-wmi: on/off bit is not set when reading the value Corentin Chary
2012-03-20  8:53 ` [PATCH 05/14] drivers, samsung-laptop: fix initialization of sabi_data in sabi_set_commandb Corentin Chary
2012-03-20  8:53 ` [PATCH 06/14] drivers, samsung-laptop: fix usage of isalnum Corentin Chary
2012-03-20  8:53 ` [PATCH 07/14] samsung-laptop: cleanup return type: mode_t vs umode_t Corentin Chary
2012-03-20  8:53 ` [PATCH 08/14] asus-wmi: add scalar board brightness adj. support Corentin Chary
2012-03-20  8:53 ` [PATCH 09/14] asus-wmi: store backlight power status for AIO machine Corentin Chary
2012-03-20  8:53 ` [PATCH 10/14] asus-wmi: move WAPF variable into quirks_entry Corentin Chary
2012-03-20  8:53 ` [PATCH 11/14] asus-nb-wmi: set panel_power correctly Corentin Chary
2012-03-20  8:53 ` [PATCH 12/14] eeepc-wmi: refine quirks handling Corentin Chary
2012-03-20  8:53 ` [PATCH 13/14] eeepc-wmi: split et2012 specific hacks Corentin Chary
2012-03-20  8:53 ` [PATCH 14/14] asus-wmi: don't update power and brightness when using scalar Corentin Chary

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