Skip to contentSkip to conversation

ACPI4Asus + samsung-laptop patches for 3.4

PATCH In review Corentin Chary 4 participants 25 messages Mar 20, 2012 – Apr 17, 2012

Subsystems (4)
lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/14 ACPI / Video: blacklist some samsung laptops

In reply to Corentin Chary

From: Corentin Chary <[email protected]>

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.

---
 drivers/acpi/video_detect.c |   49 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)
drivers/acpi/video_detect.c +49 -0
index 45d8097..66be45e 100644
@@ -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)) {
Signature · 1 line
1.7.3.4
author maintainer
#11 lore raw

PATCH 2/14 asus-nb-wmi: ignore useless keys

In reply to Corentin Chary

From: Corentin Chary <[email protected]>

---
 drivers/platform/x86/asus-nb-wmi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/platform/x86/asus-nb-wmi.c +2 -0
index b0859d4..3501127 100644
@@ -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 */
Signature · 1 line
1.7.3.4
author maintainer
#12 lore raw

PATCH 3/14 eeepc-wmi: add extra keymaps for EP121

In reply to Corentin Chary

From: Chih-Wei Huang <[email protected]>

---
 drivers/platform/x86/eeepc-wmi.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/platform/x86/eeepc-wmi.c +3 -0
index 9f6e643..1d91eb2 100644
@@ -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},
 };
 
Signature · 1 line
1.7.3.4
author maintainer
#13 lore raw

PATCH 4/14 asus-wmi: on/off bit is not set when reading the value

In reply to Corentin Chary
---
 drivers/platform/x86/asus-wmi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/asus-wmi.c +1 -1
index 72d731c..2b88347 100644
@@ -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;
Signature · 1 line
1.7.3.4
author maintainer
#14 lore raw

PATCH 5/14 drivers, samsung-laptop: fix initialization of sabi_data in sabi_set_commandb

In reply to Corentin Chary

From: David Rientjes <[email protected]>

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

---
 drivers/platform/x86/samsung-laptop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/samsung-laptop.c +1 -1
index 7d7109f..b7c67c8 100644
@@ -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);
Signature · 1 line
1.7.3.4
author maintainer
#15 lore raw

PATCH 6/14 drivers, samsung-laptop: fix usage of isalnum

In reply to Corentin Chary

From: David Rientjes <[email protected]>

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’

---
 drivers/platform/x86/samsung-laptop.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/platform/x86/samsung-laptop.c +1 -0
index b7c67c8..d1142e3 100644
@@ -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
Signature · 1 line
1.7.3.4
author maintainer
#16 lore raw

PATCH 7/14 samsung-laptop: cleanup return type: mode_t vs umode_t

In reply to Corentin Chary

From: Dan Carpenter <[email protected]>

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]

---
 drivers/platform/x86/samsung-laptop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/samsung-laptop.c +1 -1
index d1142e3..4787afd 100644
@@ -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);
Signature · 1 line
1.7.3.4
author maintainer
#17 lore raw

PATCH 8/14 asus-wmi: add scalar board brightness adj. support

In reply to Corentin Chary

From: AceLan Kao <[email protected]>

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.

---
 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(-)
drivers/platform/x86/asus-nb-wmi.c +1 -1
index 3501127..1aea6b8 100644
@@ -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,
 };
 
 
drivers/platform/x86/asus-wmi.c +28 -5
index 2b88347..eb114f8 100644
@@ -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)
drivers/platform/x86/asus-wmi.h +8 -2
index 8147c10..ac7dd4e 100644
@@ -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;
drivers/platform/x86/eeepc-wmi.c +60 -25

112 lines not on this page · raw message

Signature · 1 line
1.7.3.4
author maintainer
#18 lore raw

PATCH 9/14 asus-wmi: store backlight power status for AIO machine

In reply to Corentin Chary

From: AceLan Kao <[email protected]>

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.

---
 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(-)
drivers/platform/x86/asus-wmi.c +20 -13
index eb114f8..c4ad76e 100644
@@ -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);
drivers/platform/x86/asus-wmi.h +2 -0
index ac7dd4e..35003e4 100644
@@ -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;
drivers/platform/x86/eeepc-wmi.c +12 -3
index 67186e6..9f8ccf9 100644
@@ -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);
Signature · 1 line
1.7.3.4
author maintainer
#19 lore raw

PATCH 10/14 asus-wmi: move WAPF variable into quirks_entry

In reply to Corentin Chary

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 <[email protected]>

---
 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(-)
drivers/platform/x86/asus-nb-wmi.c +5 -1
index 1aea6b8..b12038c 100644
@@ -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[] = {
drivers/platform/x86/asus-wmi.c +2 -2
index c4ad76e..ff9cfd8 100644
@@ -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);
 }
drivers/platform/x86/asus-wmi.h +1 -1
index 35003e4..d43b667 100644
@@ -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;
 
drivers/platform/x86/eeepc-wmi.c +1 -1
index 9f8ccf9..389ff88 100644
@@ -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;
 }
Signature · 1 line
1.7.3.4
author maintainer
#20 lore raw

PATCH 11/14 asus-nb-wmi: set panel_power correctly

In reply to Corentin Chary

Even if it's currently unused.

---
 drivers/platform/x86/asus-nb-wmi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/platform/x86/asus-nb-wmi.c +2 -0
index b12038c..99a30b5 100644
@@ -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[] = {
Signature · 1 line
1.7.3.4
author maintainer
#21 lore raw

PATCH 12/14 eeepc-wmi: refine quirks handling

In reply to Corentin Chary
---
 drivers/platform/x86/eeepc-wmi.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/platform/x86/eeepc-wmi.c +8 -5
index 389ff88..0bb0aaf 100644
@@ -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 = {
Signature · 1 line
1.7.3.4
author maintainer
#22 lore raw

PATCH 13/14 eeepc-wmi: split et2012 specific hacks

In reply to Corentin Chary
---
 drivers/platform/x86/eeepc-wmi.c |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)
drivers/platform/x86/eeepc-wmi.c +20 -14
index 0bb0aaf..6567613 100644
@@ -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;
 }
 
Signature · 1 line
1.7.3.4
author maintainer
#23 lore raw

PATCH 14/14 asus-wmi: don't update power and brightness when using scalar

In reply to Corentin Chary

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

---
 drivers/platform/x86/asus-wmi.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
drivers/platform/x86/asus-wmi.c +13 -7
index ff9cfd8..7d1684b 100644
@@ -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;
 }
 
Signature · 1 line
1.7.3.4

Corentin Chary

author maintainer
#0 lore raw

cover ACPI4Asus + samsung-laptop patches for 3.4

Hello Matthew,

Here are some patches for Asus and Samsung X86 platform drivers. You can also pull them from:
git://github.com/iksaif/platform-drivers-x86.git acpi4asus

Thanks,

AceLan Kao (2):
asus-wmi: add scalar board brightness adj. support
asus-wmi: store backlight power status for AIO machine

Chih-Wei Huang (1):
eeepc-wmi: add extra keymaps for EP121

Corentin Chary (8):
ACPI / Video: blacklist some samsung laptops
asus-nb-wmi: ignore useless keys
asus-wmi: on/off bit is not set when reading the value
asus-wmi: move WAPF variable into quirks_entry
asus-nb-wmi: set panel_power correctly
eeepc-wmi: refine quirks handling
eeepc-wmi: split et2012 specific hacks
asus-wmi: don't update power and brightness when using scalar

Dan Carpenter (1):
samsung-laptop: cleanup return type: mode_t vs umode_t

David Rientjes (2):
drivers, samsung-laptop: fix initialization of sabi_data in
sabi_set_commandb
drivers, samsung-laptop: fix usage of isalnum

 drivers/acpi/video_detect.c           |   49 +++++++++++++++
 drivers/platform/x86/asus-nb-wmi.c    |   12 +++-
 drivers/platform/x86/asus-wmi.c       |   68 ++++++++++++++++-----
 drivers/platform/x86/asus-wmi.h       |   14 +++-
 drivers/platform/x86/eeepc-wmi.c      |  108 +++++++++++++++++++++++++--------
 drivers/platform/x86/samsung-laptop.c |    5 +-
 6 files changed, 207 insertions(+), 49 deletions(-)
Signature · 1 line
1.7.3.4
#2 lore raw

Re: [PATCH 01/14] ACPI / Video: blacklist some samsung laptops

In reply to Corentin Chary
Quoted 8 lines · Corentin Chary

From: Corentin Chary <[email protected]>

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.

Signature · 1 line
Matthew Garrett | [email protected]
author maintainer
#3 lore raw

Re: [PATCH 01/14] ACPI / Video: blacklist some samsung laptops

In reply to Matthew Garrett
Quoted 7 lines · Matthew Garrett
Quoted 6 lines · Corentin Chary

From: Corentin Chary <[email protected]>

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.

Quoted 6 lines
Quoted 2 lines

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.

Signature · 2 lines
Corentin Chary
http://xf.iksaif.net
#4 lore raw

Re: [PATCH 01/14] ACPI / Video: blacklist some samsung laptops

Quoted 5 lines · Corentin Chary
Quoted 3 lines · Matthew Garrett

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.

Quoted 7 lines

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

Quoted 2 lines

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.

Signature · 1 line
Matthew Garrett | [email protected]
#5 lore raw

PATCH 1/1 samsung-laptop: unregister ACPI video module for some well known laptops

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.

---
 drivers/platform/x86/samsung-laptop.c |   80 +++++++++++++++++++++++++++++++--
 1 files changed, 76 insertions(+), 4 deletions(-)
drivers/platform/x86/samsung-laptop.c +76 -4
index 4787afd..e2a34b4 100644
@@ -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
 
Signature · 1 line
1.7.3.4
author maintainer
#6 lore raw

Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops

Quoted 157 lines · Corentin Chary

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.

---
 drivers/platform/x86/samsung-laptop.c |   80 +++++++++++++++++++++++++++++++--

 1 files changed, 76 insertions(+), 4 deletions(-)
drivers/platform/x86/samsung-laptop.c +20 -0
index 4787afd..e2a34b4 100644
@@ -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);

drivers/platform/x86/samsung-laptop.c +15 -5
@@ -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
 
--
Quoted 2 lines

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,

Signature · 2 lines
Corentin Chary
http://xf.iksaif.net
#7 lore raw

Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops

Quoted 2 lines · Corentin Chary

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,

Signature · 1 line
Matthew Garrett | [email protected]
author maintainer
#8 lore raw

Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops

Quoted 7 lines · Matthew Garrett
Quoted 2 lines · Corentin Chary

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 ?

Signature · 2 lines
Corentin Chary
http://xf.iksaif.net
#9 lore raw

Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops

Quoted 22 lines · Corentin Chary
Quoted 7 lines · Matthew Garrett
Quoted 2 lines · Corentin Chary

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.

Quoted 2 lines

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

author maintainer
#10 lore raw

Re: [PATCH] samsung-laptop: unregister ACPI video module for some well known laptops

Quoted 32 lines · Seth Forshee
Quoted 22 lines · Corentin Chary
Quoted 7 lines · Matthew Garrett
Quoted 2 lines · Corentin Chary

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.

Quoted 2 lines

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

Quoted 6 lines

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 ?

Signature · 2 lines
Corentin Chary
http://xf.iksaif.net