platform-drivers-x86: backlight, samsung and asus
Subsystems (5)
Corentin Chary
maintainercover platform-drivers-x86: backlight, samsung and asus
Hi,
This series should fix a big issue when the vendor backlight is known to work better than the ACPI backlight (and sometime it's the only backlight that really works).
It adds a way for vendor drivers to promote themselves, still respecting acpi_backlight=vendor|video parameters (in case the vendor driver is wrong, and the ACPI driver works better). This way, acpi_video_register() still works properly.
The series then add calls to this new functions in appropriates drivers, and also blacklist a laptop where the ACPI video module is known to break the backlight untill next reboot.
Thanks,
AceLan Kao (2):
asus-wmi: control backlight power through WMI, not ACPI
asus-wmi: enable resume on lid open
Corentin Chary (5):
acpi: add a way to promote/demote vendor backlight drivers
drivers-platform-x86: use acpi_video_dmi_promote_vendor()
samsung-laptop: X360 ACPI backlight device is broken acpi/video_detect: blacklist samsung x360
samsung-laptop: support R40/R41
Documentation/ABI/testing/sysfs-platform-asus-wmi | 7 +++ drivers/acpi/video_detect.c | 60 ++++++++++++++++++++- drivers/platform/x86/acer-wmi.c | 16 +++--- drivers/platform/x86/apple-gmux.c | 6 +++ drivers/platform/x86/asus-wmi.c | 16 ++++++ drivers/platform/x86/asus-wmi.h | 1 + drivers/platform/x86/eeepc-wmi.c | 25 ++++++++- drivers/platform/x86/samsung-laptop.c | 41 ++++++++++---- include/linux/acpi.h | 10 ++++ 9 files changed, 162 insertions(+), 20 deletions(-)
Signature · 1 line
1.7.9.5
Corentin Chary
maintainerPATCH 1/7 acpi: add a way to promote/demote vendor backlight drivers
Instead of adding a big blacklist in video_detect.c to set ACPI_VIDEO_BACKLIGHT_DMI_VENDOR correctly, let external modules promote or demote themselves when they know the generic video module won't work.
Currently drivers where using acpi_video_unregister() directly but:
- That didn't respect any acpi_backlight=[video|vendor] parameter provided by the user.
- Any later call to acpi_video_register() would still re-load the generic video module (and some gpu drivers are doing that).
This patch fix those two issues.
--- drivers/acpi/video_detect.c | 31 +++++++++++++++++++++++++++++-- include/linux/acpi.h | 10 ++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-)
drivers/acpi/video_detect.c +29 -2
@@ -182,8 +182,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle) }EXPORT_SYMBOL (acpi_video_get_capabilities); -/* Returns true if video.ko can do backlight switching */ -int acpi_video_backlight_support (void ) +static void acpi_video_caps_check (void ) {/* * We must check whether the ACPI graphics device is physically plugged
@@ -191,6 +190,34 @@ int acpi_video_backlight_support(void)*/ if (!acpi_video_caps_checked)acpi_video_get_capabilities (NULL ); +} + +/* Promote the vendor interface instead of the generic video module. +* This function allow DMI blacklists to be implemented by externals +* platform drivers instead of putting a big blacklist in video_detect.c +* After calling this function you will probably want to call +* acpi_video_unregister() to make sure the video module is not loaded +*/ +void acpi_video_dmi_promote_vendor (void ) +{ +acpi_video_caps_check (); + acpi_video_support |=ACPI_VIDEO_BACKLIGHT_DMI_VENDOR ; +} +EXPORT_SYMBOL (acpi_video_dmi_promote_vendor); + +/* To be called when a driver who previously promoted the vendor +* interface */ +void acpi_video_dmi_demote_vendor (void ) +{ +acpi_video_caps_check (); + acpi_video_support &= ~ACPI_VIDEO_BACKLIGHT_DMI_VENDOR ; +} +EXPORT_SYMBOL (acpi_video_dmi_demote_vendor); + +/* Returns true if video.ko can do backlight switching */ +int acpi_video_backlight_support (void ) +{ +acpi_video_caps_check ();/* First check for boot param -> highest prio */ if (acpi_video_support &ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR )
include/linux/acpi.h +10 -0
@@ -190,6 +190,8 @@ extern bool wmi_has_guid(const char *guid);extern long acpi_video_get_capabilities (acpi_handle graphics_dev_handle);extern long acpi_is_video_device (struct acpi_device *device); +extern void acpi_video_dmi_promote_vendor (void ); +extern void acpi_video_dmi_demote_vendor (void );extern int acpi_video_backlight_support (void );extern int acpi_video_display_switch_support (void );
@@ -205,6 +207,14 @@ static inline long acpi_is_video_device(struct acpi_device *device)return 0 ; } +static inline void acpi_video_dmi_promote_vendor (void ) +{ +} + +static inline void acpi_video_dmi_demote_vendor (void ) +{ +} +static inline int acpi_video_backlight_support (void ) {return 0 ;
Signature · 1 line
1.7.9.5
Corentin Chary
maintainerPATCH 2/7 drivers-platform-x86: use acpi_video_dmi_promote_vendor()
In reply to Corentin CharyInstead of using directly acpi_video_unregister(), use acpi_video_dmi_promote_vendor() (and make it call acpi_video_unregister() if needed)
--- drivers/platform/x86/acer-wmi.c | 16 +++++++++------- drivers/platform/x86/apple-gmux.c | 6 ++++++ drivers/platform/x86/samsung-laptop.c | 22 ++++++++++++---------- 3 files changed, 27 insertions(+), 17 deletions(-)
drivers/platform/x86/acer-wmi.c +9 -7
@@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void)set_quirks (); +if (dmi_check_system (video_vendor_dmi_table)) +acpi_video_dmi_promote_vendor ();if (acpi_video_backlight_support ()) { -if (dmi_check_system (video_vendor_dmi_table)) { -acpi_video_unregister (); - }else { - interface->capability &= ~ACER_CAP_BRIGHTNESS ; -pr_info ("Brightness must be controlled by " -"acpi video driver\n" ); - } + interface->capability &= ~ACER_CAP_BRIGHTNESS ; +pr_info ("Brightness must be controlled by acpi video driver\n" ); + }else { +#ifdef CONFIG_ACPI_VIDEO +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); +#endif }if (wmi_has_guid (WMID_GUID3 )) {
drivers/platform/x86/apple-gmux.c +6 -0
@@ -193,7 +193,10 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,* backlight control and supports more levels than other options. * Disable the other backlight choices. */ +acpi_video_dmi_promote_vendor (); +#ifdef CONFIG_ACPI_VIDEO acpi_video_unregister (); +#endif apple_bl_unregister ();return 0 ;
@@ -213,7 +216,10 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)release_region (gmux_data->iostart, gmux_data->iolen);kfree (gmux_data); +acpi_video_dmi_demote_vendor (); +#ifdef CONFIG_ACPI_VIDEO acpi_video_register (); +#endif apple_bl_register (); }
drivers/platform/x86/samsung-laptop.c +12 -10
@@ -26,7 +26,7 @@#include <linux/seq_file.h> #include <linux/debugfs.h> #include <linux/ctype.h> -#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE ) +#ifdef CONFIG_ACPI_VIDEO #include <acpi/video.h> #endif
@@ -1530,15 +1530,18 @@ static int __init samsung_init(void) samsung->quirks = quirks; -#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE ) +#ifdef CONFIG_ACPI +if (samsung->quirks->broken_acpi_video) +acpi_video_dmi_promote_vendor (); +/* Don't handle backlight here if the acpi video already handle it */ if (acpi_video_backlight_support ()) { -if (samsung->quirks->broken_acpi_video) { -pr_info ("Disabling ACPI video driver\n" ); -acpi_video_unregister (); - }else { - samsung->handle_backlight = false; - } + samsung->handle_backlight = false; + }else if (samsung->quirks->broken_acpi_video) { +pr_info ("Disabling ACPI video driver\n" ); +#ifdef CONFIG_ACPI_VIDEO +acpi_video_unregister (); +#endif }#endif
@@ -1552,8 +1555,7 @@ static int __init samsung_init(void)#ifdef CONFIG_ACPI /* Only log that if we are really on a sabi platform */ -if (acpi_video_backlight_support () && - !samsung->quirks->broken_acpi_video) +if (acpi_video_backlight_support ())pr_info ("Backlight controlled by ACPI video driver\n" );#endif
Signature · 1 line
1.7.9.5
Corentin Chary
maintainerPATCH 3/7 samsung-laptop: X360 ACPI backlight device is broken
In reply to Corentin Chary--- drivers/platform/x86/samsung-laptop.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/platform/x86/samsung-laptop.c +10 -0
@@ -1506,6 +1506,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { }, .driver_data = &samsung_broken_acpi_video, }, + { + .callback = samsung_dmi_matched, + .ident = "X360", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "X360"), + DMI_MATCH(DMI_BOARD_NAME, "X360"), + }, + .driver_data = &samsung_broken_acpi_video, + }, { }, }; MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
Signature · 1 line
1.7.9.5
Corentin Chary
maintainerPATCH 4/7 acpi/video_detect: blacklist samsung x360
In reply to Corentin CharyOn Samsung X360, the BIOS will set a flag (VDRV) if the generic ACPI backlight device is used. This flag will definitively break the backlight interface (even the vendor interface) untill next reboot. It's why we should prevent video.ko from being used here and we can't rely on a later call to acpi_video_unregister().
--- drivers/acpi/video_detect.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/acpi/video_detect.c +29 -0
@@ -132,6 +132,33 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv)return AE_OK ; } +/* Force to use vendor driver when the ACPI device is known to be +* buggy */ +static int video_detect_force_vendor (const struct dmi_system_id *d) +{ + acpi_video_support |=ACPI_VIDEO_BACKLIGHT_DMI_VENDOR ; +return 0 ; +} + +static struct dmi_system_id video_detect_dmi_table[] = { +/* On Samsung X360, the BIOS will set a flag (VDRV) if generic +* ACPI backlight device is used. This flag will definitively break +* the backlight interface (even the vendor interface) untill next +* reboot. It's why we should prevent video.ko from being used here +* and we can't rely on a later call to acpi_video_unregister(). +*/ + { + .callback = video_detect_force_vendor, + .ident ="X360" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"SAMSUNG ELECTRONICS CO., LTD." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"X360" ), +DMI_MATCH (DMI_BOARD_NAME ,"X360" ), + }, + }, + { }, +}; +/* * Returns the video capabilities of a specific ACPI graphics device *
@@ -164,6 +191,8 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)* ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; *} */ + +dmi_check_system (video_detect_dmi_table); }else { status =acpi_bus_get_device (graphics_handle, &tmp_dev);if (ACPI_FAILURE (status)) {
Signature · 1 line
1.7.9.5
Corentin Chary
maintainerPATCH 5/7 samsung-laptop: support R40/R41
In reply to Corentin CharyQuoted 3 lines
Chassis Information
Manufacturer: SAMSUNG ELECTRONICS CO., LTD.
Type: Other
Type should be "Notebook", "Laptop", .. not "Other".
--- drivers/platform/x86/samsung-laptop.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/samsung-laptop.c +9 -0
@@ -1465,6 +1465,15 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */ }, }, +/* DMI ids for laptops with bad Chassis Type */ + { + .ident = "R40/R41", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"SAMSUNG ELECTRONICS CO., LTD." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"R40/R41" ), + DMI_MATCH(DMI_BOARD_NAME, "R40/R41"), + }, + }, /* Specific DMI ids for laptop with quirks */ { .callback = samsung_dmi_matched,
Signature · 1 line
1.7.9.5
Corentin Chary
maintainerPATCH 6/7 asus-wmi: control backlight power through WMI, not ACPI
In reply to Corentin CharyFrom: AceLan Kao <[email protected]>
Some h/w that can adjust screen brightness through ACPI functions, but can't turn on/off the backlight power correctly. So, we list those h/w in quirks and try to turn on/off the backlight power through WMI.
--- drivers/platform/x86/asus-wmi.c | 9 +++++++++ drivers/platform/x86/asus-wmi.h | 1 + drivers/platform/x86/eeepc-wmi.c | 25 ++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +9 -0
@@ -47,6 +47,9 @@#include <linux/thermal.h> #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> +#ifdef CONFIG_ACPI_VIDEO +#include <acpi/video.h> +#endif #include "asus-wmi.h"
@@ -1681,7 +1684,13 @@ static int asus_wmi_add(struct platform_device *pdev)if (err) goto fail_rfkill; +if (asus->driver->quirks->wmi_backlight_power) +acpi_video_dmi_promote_vendor ();if (!acpi_video_backlight_support ()) { +#ifdef CONFIG_ACPI_VIDEO +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); +#endif err =asus_wmi_backlight_init (asus);if (err && err != -ENODEV ) goto fail_backlight;
drivers/platform/x86/asus-wmi.h +1 -0
@@ -39,6 +39,7 @@ struct quirk_entry {bool hotplug_wireless;bool scalar_panel_brightness;bool store_backlight_power; +bool wmi_backlight_power;int wapf; };
drivers/platform/x86/eeepc-wmi.c +24 -1
@@ -79,7 +79,7 @@ static const struct key_entry eeepc_wmi_keymap[] = { { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */ { KE_KEY, HOME_PRESS, { KEY_CONFIG } }, /* Home/Express gate key */ { KE_KEY, 0xe8, { KEY_SCREENLOCK } }, - { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } }, + { KE_KEY, 0xe9, { KEY_DISPLAYTOGGLE } }, { KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } }, { KE_KEY, 0xec, { KEY_CAMERA_UP } }, { KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
@@ -107,6 +107,11 @@ static struct quirk_entry quirk_asus_et2012_type3 = { .store_backlight_power = true, }; +static struct quirk_entry quirk_asus_x101ch = { +/* We need this when ACPI function doesn't do this well */ + .wmi_backlight_power = true, +}; +static struct quirk_entry *quirks;static void et2012_quirks (void )
@@ -157,6 +162,24 @@ static struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_unknown, }, + { + .callback = dmi_matched, + .ident = "ASUSTeK Computer INC. X101CH", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"), + }, + .driver_data = &quirk_asus_x101ch, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK Computer INC. 1015CX", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"), + }, + .driver_data = &quirk_asus_x101ch, + }, {}, };
Signature · 1 line
1.7.9.5
Corentin Chary
maintainerPATCH 7/7 asus-wmi: enable resume on lid open
In reply to Corentin CharyFrom: AceLan Kao <[email protected]>
According to the ASUS WMI spec., to enable resume on lid open should use the device ID(0x00120032), but it doesn't work indeed.
After discussing with ASUS' BIOS engineer, they say wake on lid open doesn't have a uniq device ID(0x00120032) in the BIOS. It shares the same device ID with deep S3(0x00120031), and the deep S3(resume on lid open) is disable by default.
Adding this option in asus wmi sysfs
/sys/devices/platform/<platform>/lid_resume
so that userspace apps can enable/disable this feature by themselves.
--- Documentation/ABI/testing/sysfs-platform-asus-wmi | 7 +++++++ drivers/platform/x86/asus-wmi.c | 7 +++++++ 2 files changed, 14 insertions(+)
Documentation/ABI/testing/sysfs-platform-asus-wmi +7 -0
@@ -29,3 +29,10 @@ KernelVersion: 2.6.39 Contact: "Corentin Chary" <[email protected]> Description: Control the card touchpad. 1 means on, 0 means off. + +What: /sys/devices/platform/<platform>/lid_resume +Date: May 2012 +KernelVersion: 3.5 +Contact: "AceLan Kao" <[email protected]> +Description: + Resume on lid open. 1 means on, 0 means off.
drivers/platform/x86/asus-wmi.c +7 -0
@@ -139,6 +139,9 @@ MODULE_LICENSE("GPL");/* Power */ #define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012 +/* Deep S3 / Resume on LID open */ +#define ASUS_WMI_DEVID_LID_RESUME 0x00120031 +/* DSTS masks */ #define ASUS_WMI_DSTS_STATUS_BIT 0x00000001#define ASUS_WMI_DSTS_UNKNOWN_BIT 0x00000002
@@ -1368,6 +1371,7 @@ static ssize_t show_sys_wmi(struct asus_wmi *asus, int devid, char *buf)ASUS_WMI_CREATE_DEVICE_ATTR (touchpad,0644 ,ASUS_WMI_DEVID_TOUCHPAD );ASUS_WMI_CREATE_DEVICE_ATTR (camera,0644 ,ASUS_WMI_DEVID_CAMERA );ASUS_WMI_CREATE_DEVICE_ATTR (cardr,0644 ,ASUS_WMI_DEVID_CARDREADER ); +ASUS_WMI_CREATE_DEVICE_ATTR (lid_resume,0644 ,ASUS_WMI_DEVID_LID_RESUME );static ssize_t store_cpufv (struct device *dev,struct device_attribute *attr,const char *buf,size_t count)
@@ -1393,6 +1397,7 @@ static struct attribute *platform_attributes[] = { &dev_attr_camera.attr, &dev_attr_cardr.attr, &dev_attr_touchpad.attr, + &dev_attr_lid_resume.attr, NULL };
@@ -1411,6 +1416,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, devid =ASUS_WMI_DEVID_CARDREADER ; else if (attr == &dev_attr_touchpad.attr) devid =ASUS_WMI_DEVID_TOUCHPAD ; + else if (attr == &dev_attr_lid_resume.attr) + devid =ASUS_WMI_DEVID_LID_RESUME ;if (devid !=-1 ) ok = !(asus_wmi_get_devstate_simple (asus, devid) <0 );
Signature · 1 line
1.7.9.5
joeyli
maintainerRe: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
In reply to Corentin CharyHi Corentin,
於 三,2012-06-13 於 09:32 +0200,Corentin Chary 提到:
Quoted 23 lines
Instead of using directly
acpi_video_unregister(), useacpi_video_dmi_promote_vendor()(and make it callacpi_video_unregister()if needed)Signed-off-by Corentin Chary <[email protected]>--- drivers/platform/x86/acer-wmi.c | 16 +++++++++------- drivers/platform/x86/apple-gmux.c | 6 ++++++ drivers/platform/x86/samsung-laptop.c | 22 ++++++++++++---------- 3 files changed, 27 insertions(+), 17 deletions(-)drivers/platform/x86/acer-wmi.c +2
-1@@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void)set_quirks (); +if (dmi_check_system (video_vendor_dmi_table)) +acpi_video_dmi_promote_vendor ();if (acpi_video_backlight_support ()) { -if (dmi_check_system (video_vendor_dmi_table)) {
drivers/platform/x86/acer-wmi.c static int __init acer_wmi_init(void) · line 2069
Quoted 10 lines
drivers/platform/x86/acer-wmi.c +4
-6-acpi_video_unregister (); - }else { - interface->capability &= ~ACER_CAP_BRIGHTNESS ; -pr_info ("Brightness must be controlled by " -"acpi video driver\n" ); - } + interface->capability &= ~ACER_CAP_BRIGHTNESS ; +pr_info ("Brightness must be controlled by acpi video driver\n" ); + }else { +#ifdef CONFIG_ACPI_VIDEO
The 'ifdef CONFIG_ACPI_VIDEO' didn't work on my machine with v3.4 kernel, the acpi video didn't unregister.
My autoconf.h like following:
include/generated/autoconf.h:#define CONFIG_ACPI_VIDEO_MODULE 1
Need use:
-#ifdef CONFIG_ACPI_VIDEO
+#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
pr_info("Disabling ACPI video driver\n");
acpi_video_unregister();#endif
I tested the above change works to me.
Thanks a lot!
Joey Lee
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Corentin Chary
maintainerRe: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
Quoted 53 lines · joeyli
Hi Corentin,
於 三,2012-06-13 於 09:32 +0200,Corentin Chary 提到:
Quoted 23 lines
Instead of using directly
acpi_video_unregister(), useacpi_video_dmi_promote_vendor()(and make it callacpi_video_unregister()if needed)Signed-off-by Corentin Chary <[email protected]>---
drivers/platform/x86/acer-wmi.c | 16 +++++++++-------drivers/platform/x86/apple-gmux.c| 6 ++++++drivers/platform/x86/samsung-laptop.c| 22 ++++++++++++----------3 files changed, 27 insertions(+), 17 deletions(-)drivers/platform/x86/acer-wmi.c +2
-1@@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void) set_quirks(); + if (dmi_check_system(video_vendor_dmi_table)) + acpi_video_dmi_promote_vendor(); if (acpi_video_backlight_support()) { - if (dmi_check_system(video_vendor_dmi_table)) {drivers/platform/x86/acer-wmi.c static int __init acer_wmi_init(void) · line 2069
Quoted 10 lines
drivers/platform/x86/acer-wmi.c +4
-6- acpi_video_unregister(); - } else { - interface->capability &= ~ACER_CAP_BRIGHTNESS; - pr_info("Brightness must be controlled by " - "acpi video driver\n"); - } + interface->capability &= ~ACER_CAP_BRIGHTNESS; + pr_info("Brightness must be controlled by acpi video driver\n"); + } else { +#ifdef CONFIG_ACPI_VIDEO The 'ifdef
CONFIG_ACPI_VIDEO' didn't work on my machine with v3.4 kernel, the acpi video didn't unregister.My
autoconf.hlike following:include/generated/autoconf.h:#define
CONFIG_ACPI_VIDEO_MODULE1Need use:
(quoted diff) +1
-1-#ifdef CONFIG_ACPI_VIDEO +#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)pr_info("Disabling ACPI video driver\n");
acpi_video_unregister();
#endif
Quoted 1 line
I tested the above change works to me.
I checked include/acpi/video.h and I could in fact remove all #ifdef stuff... Thanks ! Will update the patches.
Signature · 6 lines
Corentin Chary http://xf.iksaif.net -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Corentin Chary
maintainerPATCH 2/7 drivers-platform-x86: use acpi_video_dmi_promote_vendor()
Instead of using directly acpi_video_unregister(), use acpi_video_dmi_promote_vendor() (and make it call acpi_video_unregister() if needed)
--- drivers/platform/x86/acer-wmi.c | 14 +++++++------- drivers/platform/x86/apple-gmux.c | 2 ++ drivers/platform/x86/samsung-laptop.c | 20 +++++++++----------- 3 files changed, 18 insertions(+), 18 deletions(-)
drivers/platform/x86/acer-wmi.c +7 -7
@@ -2060,14 +2060,14 @@ static int __init acer_wmi_init(void)set_quirks (); +if (dmi_check_system (video_vendor_dmi_table)) +acpi_video_dmi_promote_vendor ();if (acpi_video_backlight_support ()) { -if (dmi_check_system (video_vendor_dmi_table)) { -acpi_video_unregister (); - }else { - interface->capability &= ~ACER_CAP_BRIGHTNESS ; -pr_info ("Brightness must be controlled by " -"acpi video driver\n" ); - } + interface->capability &= ~ACER_CAP_BRIGHTNESS ; +pr_info ("Brightness must be controlled by acpi video driver\n" ); + }else { +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); }if (wmi_has_guid (WMID_GUID3 )) {
drivers/platform/x86/apple-gmux.c +2 -0
@@ -193,6 +193,7 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,* backlight control and supports more levels than other options. * Disable the other backlight choices. */ +acpi_video_dmi_promote_vendor ();acpi_video_unregister ();apple_bl_unregister ();
@@ -213,6 +214,7 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)release_region (gmux_data->iostart, gmux_data->iolen);kfree (gmux_data); +acpi_video_dmi_demote_vendor ();acpi_video_register ();apple_bl_register (); }
drivers/platform/x86/samsung-laptop.c +9 -11
@@ -26,9 +26,7 @@#include <linux/seq_file.h> #include <linux/debugfs.h> #include <linux/ctype.h> -#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE )#include <acpi/video.h> -#endif /* * This driver is needed because a number of Samsung laptops do not hook
@@ -1530,15 +1528,16 @@ static int __init samsung_init(void) samsung->quirks = quirks; -#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE ) +#ifdef CONFIG_ACPI +if (samsung->quirks->broken_acpi_video) +acpi_video_dmi_promote_vendor (); +/* Don't handle backlight here if the acpi video already handle it */ if (acpi_video_backlight_support ()) { -if (samsung->quirks->broken_acpi_video) { -pr_info ("Disabling ACPI video driver\n" ); -acpi_video_unregister (); - }else { - samsung->handle_backlight = false; - } + samsung->handle_backlight = false; + }else if (samsung->quirks->broken_acpi_video) { +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); }#endif
@@ -1552,8 +1551,7 @@ static int __init samsung_init(void)#ifdef CONFIG_ACPI /* Only log that if we are really on a sabi platform */ -if (acpi_video_backlight_support () && - !samsung->quirks->broken_acpi_video) +if (acpi_video_backlight_support ())pr_info ("Backlight controlled by ACPI video driver\n" );#endif
Signature · 1 line
1.7.9.5
Corentin Chary
maintainerPATCH 6/7 asus-wmi: control backlight power through WMI, not ACPI
In reply to Corentin CharyFrom: AceLan Kao <[email protected]>
Some h/w that can adjust screen brightness through ACPI functions, but can't turn on/off the backlight power correctly. So, we list those h/w in quirks and try to turn on/off the backlight power through WMI.
--- drivers/platform/x86/asus-wmi.c | 5 +++++ drivers/platform/x86/asus-wmi.h | 1 + drivers/platform/x86/eeepc-wmi.c | 25 ++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +5 -0
@@ -47,6 +47,7 @@#include <linux/thermal.h> #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> +#include <acpi/video.h> #include "asus-wmi.h"
@@ -1681,7 +1682,11 @@ static int asus_wmi_add(struct platform_device *pdev)if (err) goto fail_rfkill; +if (asus->driver->quirks->wmi_backlight_power) +acpi_video_dmi_promote_vendor ();if (!acpi_video_backlight_support ()) { +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); err =asus_wmi_backlight_init (asus);if (err && err != -ENODEV ) goto fail_backlight;
drivers/platform/x86/asus-wmi.h +1 -0
@@ -39,6 +39,7 @@ struct quirk_entry {bool hotplug_wireless;bool scalar_panel_brightness;bool store_backlight_power; +bool wmi_backlight_power;int wapf; };
drivers/platform/x86/eeepc-wmi.c +24 -1
@@ -79,7 +79,7 @@ static const struct key_entry eeepc_wmi_keymap[] = { { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */ { KE_KEY, HOME_PRESS, { KEY_CONFIG } }, /* Home/Express gate key */ { KE_KEY, 0xe8, { KEY_SCREENLOCK } }, - { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } }, + { KE_KEY, 0xe9, { KEY_DISPLAYTOGGLE } }, { KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } }, { KE_KEY, 0xec, { KEY_CAMERA_UP } }, { KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
@@ -107,6 +107,11 @@ static struct quirk_entry quirk_asus_et2012_type3 = { .store_backlight_power = true, }; +static struct quirk_entry quirk_asus_x101ch = { +/* We need this when ACPI function doesn't do this well */ + .wmi_backlight_power = true, +}; +static struct quirk_entry *quirks;static void et2012_quirks (void )
@@ -157,6 +162,24 @@ static struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_unknown, }, + { + .callback = dmi_matched, + .ident = "ASUSTeK Computer INC. X101CH", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"), + }, + .driver_data = &quirk_asus_x101ch, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK Computer INC. 1015CX", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"), + }, + .driver_data = &quirk_asus_x101ch, + }, {}, };
Signature · 1 line
1.7.9.5
Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
In reply to Corentin Chary於 四,2012-06-14 於 13:04 +0200,Corentin Chary 提到:
Quoted 5 lines
Instead of using directly
acpi_video_unregister(), useacpi_video_dmi_promote_vendor()(and make it callacpi_video_unregister()if needed)Signed-off-by Corentin Chary <[email protected]>
It's good to me!
Thanks a lot!
Joey Lee
Quoted 91 lines
--- drivers/platform/x86/acer-wmi.c | 14 +++++++------- drivers/platform/x86/apple-gmux.c | 2 ++ drivers/platform/x86/samsung-laptop.c | 20 +++++++++----------- 3 files changed, 18 insertions(+), 18 deletions(-)drivers/platform/x86/acer-wmi.c +7
-7@@ -2060,14 +2060,14 @@ static int __init acer_wmi_init(void)set_quirks (); +if (dmi_check_system (video_vendor_dmi_table)) +acpi_video_dmi_promote_vendor ();if (acpi_video_backlight_support ()) { -if (dmi_check_system (video_vendor_dmi_table)) { -acpi_video_unregister (); - }else { - interface->capability &= ~ACER_CAP_BRIGHTNESS ; -pr_info ("Brightness must be controlled by " -"acpi video driver\n" ); - } + interface->capability &= ~ACER_CAP_BRIGHTNESS ; +pr_info ("Brightness must be controlled by acpi video driver\n" ); + }else { +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); }if (wmi_has_guid (WMID_GUID3 )) {drivers/platform/x86/apple-gmux.c +2
-0@@ -193,6 +193,7 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,* backlight control and supports more levels than other options. * Disable the other backlight choices. */ +acpi_video_dmi_promote_vendor ();acpi_video_unregister ();apple_bl_unregister ();@@ -213,6 +214,7 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)release_region (gmux_data->iostart, gmux_data->iolen);kfree (gmux_data); +acpi_video_dmi_demote_vendor ();acpi_video_register ();apple_bl_register (); }drivers/platform/x86/samsung-laptop.c +8
-9@@ -26,9 +26,7 @@#include <linux/seq_file.h> #include <linux/debugfs.h> #include <linux/ctype.h> -#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE )#include <acpi/video.h> -#endif /* * This driver is needed because a number of Samsung laptops do not hook @@ -1530,15 +1528,16 @@ static int __init samsung_init(void) samsung->quirks = quirks; -#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE ) +#ifdef CONFIG_ACPI +if (samsung->quirks->broken_acpi_video) +acpi_video_dmi_promote_vendor (); +/* Don't handle backlight here if the acpi video already handle it */ if (acpi_video_backlight_support ()) { -if (samsung->quirks->broken_acpi_video) { -pr_info ("Disabling ACPI video driver\n" ); -acpi_video_unregister (); - }else { - samsung->handle_backlight = false; - } + samsung->handle_backlight = false; + }else if (samsung->quirks->broken_acpi_video) { +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); }#endif
drivers/platform/x86/samsung-laptop.c static int __init samsung_init(void) · line 1557
Quoted 9 lines
drivers/platform/x86/samsung-laptop.c +1
-2@@ -1552,8 +1551,7 @@ static int __init samsung_init(void)#ifdef CONFIG_ACPI /* Only log that if we are really on a sabi platform */ -if (acpi_video_backlight_support () && - !samsung->quirks->broken_acpi_video) +if (acpi_video_backlight_support ())pr_info ("Backlight controlled by ACPI video driver\n" );#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()
In reply to Corentin CharyQuoted 5 lines · Corentin Chary
Instead of using directly
acpi_video_unregister(), useacpi_video_dmi_promote_vendor()(and make it callacpi_video_unregister()if needed)Signed-off-by Corentin Chary <[email protected]>
The changes to apple-gmux.c get rid of the acpi_video backlight under EFI boot on the Macbook Pro 8,2. Unfortunately userspace still prefers intel_backlight on this machine, which also doesn't work. I can't help but think that we need a more generic way of specifying the preferred backlight for a machine.
All the same, if this gets picked up feel free to add
Quoted 107 lines
--- drivers/platform/x86/acer-wmi.c | 14 +++++++------- drivers/platform/x86/apple-gmux.c | 2 ++ drivers/platform/x86/samsung-laptop.c | 20 +++++++++----------- 3 files changed, 18 insertions(+), 18 deletions(-)drivers/platform/x86/acer-wmi.c +7
-7@@ -2060,14 +2060,14 @@ static int __init acer_wmi_init(void)set_quirks (); +if (dmi_check_system (video_vendor_dmi_table)) +acpi_video_dmi_promote_vendor ();if (acpi_video_backlight_support ()) { -if (dmi_check_system (video_vendor_dmi_table)) { -acpi_video_unregister (); - }else { - interface->capability &= ~ACER_CAP_BRIGHTNESS ; -pr_info ("Brightness must be controlled by " -"acpi video driver\n" ); - } + interface->capability &= ~ACER_CAP_BRIGHTNESS ; +pr_info ("Brightness must be controlled by acpi video driver\n" ); + }else { +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); }if (wmi_has_guid (WMID_GUID3 )) {drivers/platform/x86/apple-gmux.c +2
-0@@ -193,6 +193,7 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,* backlight control and supports more levels than other options. * Disable the other backlight choices. */ +acpi_video_dmi_promote_vendor ();acpi_video_unregister ();apple_bl_unregister ();@@ -213,6 +214,7 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)release_region (gmux_data->iostart, gmux_data->iolen);kfree (gmux_data); +acpi_video_dmi_demote_vendor ();acpi_video_register ();apple_bl_register (); }drivers/platform/x86/samsung-laptop.c +9
-11@@ -26,9 +26,7 @@#include <linux/seq_file.h> #include <linux/debugfs.h> #include <linux/ctype.h> -#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE )#include <acpi/video.h> -#endif /* * This driver is needed because a number of Samsung laptops do not hook @@ -1530,15 +1528,16 @@ static int __init samsung_init(void) samsung->quirks = quirks; -#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE ) +#ifdef CONFIG_ACPI +if (samsung->quirks->broken_acpi_video) +acpi_video_dmi_promote_vendor (); +/* Don't handle backlight here if the acpi video already handle it */ if (acpi_video_backlight_support ()) { -if (samsung->quirks->broken_acpi_video) { -pr_info ("Disabling ACPI video driver\n" ); -acpi_video_unregister (); - }else { - samsung->handle_backlight = false; - } + samsung->handle_backlight = false; + }else if (samsung->quirks->broken_acpi_video) { +pr_info ("Disabling ACPI video driver\n" ); +acpi_video_unregister (); }#endif @@ -1552,8 +1551,7 @@ static int __init samsung_init(void)#ifdef CONFIG_ACPI /* Only log that if we are really on a sabi platform */ -if (acpi_video_backlight_support () && - !samsung->quirks->broken_acpi_video) +if (acpi_video_backlight_support ())pr_info ("Backlight controlled by ACPI video driver\n" );#endif Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
I think I'm fine with this. Whose tree should it go through?
Signature · 1 line
Matthew Garrett | [email protected]
Re: [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers
In reply to Corentin CharyHi Corentin,
On Wed, Jun 13, 2012 at 09:32:01AM +0200, Corentin Chary wrote:
...
drivers/acpi/video_detect.c int acpi_video_backlight_support(void) · line 206
Quoted 12 lines
drivers/acpi/video_detect.c +12
-0+/* Promote the vendor interface instead of the generic video module. +* This function allow DMI blacklists to be implemented by externals +* platform drivers instead of putting a big blacklist in video_detect.c +* After calling this function you will probably want to call +* acpi_video_unregister() to make sure the video module is not loaded +*/ +void acpi_video_dmi_promote_vendor (void ) +{ +acpi_video_caps_check (); + acpi_video_support |=ACPI_VIDEO_BACKLIGHT_DMI_VENDOR ; +} +EXPORT_SYMBOL (acpi_video_dmi_promote_vendor);
I think having the promote_vendor() function do the sanity check on the acpi_backlight parameter and the unregistering of the acpi_video device may make the code cleaner and more acpi_video-agnostic in the drivers. I.e. (untested sample code):
bool acpi_video_promote_vendor(void)
{
if (acpi_video_backlight_support())
return false;
acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
pr_info("Disabling ACPI video driver\n");
acpi_video_unregister();
return true;
}EXPORT_SYMBOL(acpi_video_promote_vendor);
and in the drivers you do
if (my_drv->broken_acpi_video) {
if (acpi_video_promote_vendor())
do_backlight_init();
} else if (!acpi_video_backlight_support())
do_backlight_init();or something along these lines.
If you give a boolean parameter to acpi_video_promote_vendor to force vendor backlight we could make the drivers' code even simpler but that would change the semantics of the "promotion" to something more of a "take-over".
PS: I will need to promote backlight control in sony-laptop.ko eventually as well but I don't have a DMI based list but rather I should look at a specific handle (or say Method) presence in the SNC Device. I guess I'm just bothered by the function naming here but not a big deal. :)
Signature · 2 lines
mattia :wq!
Corentin Chary
maintainerQuoted 1 line · Matthew Garrett
I think I'm fine with this. Whose tree should it go through?
Yours would probably be easier,
Thanks
Signature · 2 lines
Corentin Chary http://xf.iksaif.net
Corentin Chary
maintainerRe: [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers
In reply to Mattia DongiliQuoted 48 lines · Mattia Dongili
Hi Corentin,
On Wed, Jun 13, 2012 at 09:32:01AM +0200, Corentin Chary wrote:
...drivers/acpi/video_detect.c int acpi_video_backlight_support(void) · line 206
Quoted 12 lines
drivers/acpi/video_detect.c +12
-0+/* Promote the vendor interface instead of the generic video module. +* This function allow DMI blacklists to be implemented by externals +* platform drivers instead of putting a big blacklist in video_detect.c +* After calling this function you will probably want to call +* acpi_video_unregister() to make sure the video module is not loaded +*/ +void acpi_video_dmi_promote_vendor (void ) +{ + acpi_video_caps_check(); + acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; +} +EXPORT_SYMBOL (acpi_video_dmi_promote_vendor);I think having the
promote_vendor()function do the sanity check on theacpi_backlightparameter and the unregistering of theacpi_videodevice may make the code cleaner and more acpi_video-agnostic in the drivers. I.e. (untested sample code):bool
acpi_video_promote_vendor(void)
{
if (acpi_video_backlight_support())
return false;acpi_video_support |=
ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;pr_info("Disabling ACPI video driver\n");acpi_video_unregister();
return true;
}EXPORT_SYMBOL(acpi_video_promote_vendor);and in the drivers you do
if (
my_drv->broken_acpi_video) {
if (acpi_video_promote_vendor())do_backlight_init(); } else if (!acpi_video_backlight_support())do_backlight_init();or something along these lines.
If you give a boolean parameter toacpi_video_promote_vendorto force vendor backlight we could make the drivers' code even simpler but that would change the semantics of the "promotion" to something more of a "take-over".
Quoted 8 lines
PS: I will need to promote backlight control in sony-laptop.ko eventually as well but I don't have a DMI based list but rather I should look at a specific handle (or say Method) presence in the SNC Device. I guess I'm just bothered by the function naming here but not a big deal. :)
--
mattia
:wq!
I had something like that in mind, but it makes acpi.ko use symbols from video.ko, and video.ko already uses symbols from acpi.ko, and I didn't want to mess with circular dependencies. But if you manage to make it work, and if you want to remove dmi_, I'll hapilly Ack it !
Signature · 2 lines
Corentin Chary http://xf.iksaif.net
Corentin Chary
maintainerQuoted 5 lines · Corentin Chary
Quoted 1 line · Matthew Garrett
I think I'm fine with this. Whose tree should it go through?
Yours would probably be easier,
Thanks
Hi Matthew,
Any news on this series ?
Thanks.
Signature · 2 lines
Corentin Chary http://xf.iksaif.net
Quoted 11 lines · Corentin Chary
Quoted 5 lines · Corentin Chary
Quoted 1 line · Matthew Garrett
I think I'm fine with this. Whose tree should it go through?
Yours would probably be easier,
ThanksHi Matthew,
Any news on this series ?
Thanks.
I'll merge these for 3.6.
Signature · 1 line
Matthew Garrett | [email protected]