2012-06-13 07:32:21

by Corentin Chary

[permalink] [raw]
Subject: [PATCH 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)

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

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index ce875dc..ffc53df 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -2060,14 +2060,16 @@ static int __init acer_wmi_init(void)

set_quirks();

+ if (dmi_check_system(video_vendor_dmi_table))
+ acpi_video_dmi_promote_vendor();
if (acpi_video_backlight_support()) {
- if (dmi_check_system(video_vendor_dmi_table)) {
- acpi_video_unregister();
- } else {
- interface->capability &= ~ACER_CAP_BRIGHTNESS;
- pr_info("Brightness must be controlled by "
- "acpi video driver\n");
- }
+ interface->capability &= ~ACER_CAP_BRIGHTNESS;
+ pr_info("Brightness must be controlled by acpi video driver\n");
+ } else {
+#ifdef CONFIG_ACPI_VIDEO
+ pr_info("Disabling ACPI video driver\n");
+ acpi_video_unregister();
+#endif
}

if (wmi_has_guid(WMID_GUID3)) {
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index 694a15a..905fa01 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -193,7 +193,10 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,
* backlight control and supports more levels than other options.
* Disable the other backlight choices.
*/
+ acpi_video_dmi_promote_vendor();
+#ifdef CONFIG_ACPI_VIDEO
acpi_video_unregister();
+#endif
apple_bl_unregister();

return 0;
@@ -213,7 +216,10 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)
release_region(gmux_data->iostart, gmux_data->iolen);
kfree(gmux_data);

+ acpi_video_dmi_demote_vendor();
+#ifdef CONFIG_ACPI_VIDEO
acpi_video_register();
+#endif
apple_bl_register();
}

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index e2a34b4..2cbccc1 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -26,7 +26,7 @@
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <linux/ctype.h>
-#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
+#ifdef CONFIG_ACPI_VIDEO
#include <acpi/video.h>
#endif

@@ -1530,15 +1530,18 @@ static int __init samsung_init(void)
samsung->quirks = quirks;


-#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
+#ifdef CONFIG_ACPI
+ if (samsung->quirks->broken_acpi_video)
+ acpi_video_dmi_promote_vendor();
+
/* Don't handle backlight here if the acpi video already handle it */
if (acpi_video_backlight_support()) {
- if (samsung->quirks->broken_acpi_video) {
- pr_info("Disabling ACPI video driver\n");
- acpi_video_unregister();
- } else {
- samsung->handle_backlight = false;
- }
+ samsung->handle_backlight = false;
+ } else if (samsung->quirks->broken_acpi_video) {
+ pr_info("Disabling ACPI video driver\n");
+#ifdef CONFIG_ACPI_VIDEO
+ acpi_video_unregister();
+#endif
}
#endif

@@ -1552,8 +1555,7 @@ static int __init samsung_init(void)

#ifdef CONFIG_ACPI
/* Only log that if we are really on a sabi platform */
- if (acpi_video_backlight_support() &&
- !samsung->quirks->broken_acpi_video)
+ if (acpi_video_backlight_support())
pr_info("Backlight controlled by ACPI video driver\n");
#endif

--
1.7.9.5


2012-06-14 10:04:04

by joeyli

[permalink] [raw]
Subject: Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()

Hi Corentin,

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

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

My autoconf.h like following:

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


Need use:

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

I tested the above change works to me.


Thanks a lot!
Joey Lee

2012-06-14 10:54:09

by Corentin Chary

[permalink] [raw]
Subject: Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()

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

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


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

2012-06-14 11:04:49

by Corentin Chary

[permalink] [raw]
Subject: [PATCH 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)

Signed-off-by: Corentin Chary <[email protected]>
---
drivers/platform/x86/acer-wmi.c | 14 +++++++-------
drivers/platform/x86/apple-gmux.c | 2 ++
drivers/platform/x86/samsung-laptop.c | 20 +++++++++-----------
3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index ce875dc..7057aef 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -2060,14 +2060,14 @@ static int __init acer_wmi_init(void)

set_quirks();

+ if (dmi_check_system(video_vendor_dmi_table))
+ acpi_video_dmi_promote_vendor();
if (acpi_video_backlight_support()) {
- if (dmi_check_system(video_vendor_dmi_table)) {
- acpi_video_unregister();
- } else {
- interface->capability &= ~ACER_CAP_BRIGHTNESS;
- pr_info("Brightness must be controlled by "
- "acpi video driver\n");
- }
+ interface->capability &= ~ACER_CAP_BRIGHTNESS;
+ pr_info("Brightness must be controlled by acpi video driver\n");
+ } else {
+ pr_info("Disabling ACPI video driver\n");
+ acpi_video_unregister();
}

if (wmi_has_guid(WMID_GUID3)) {
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index 694a15a..fd61502 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -193,6 +193,7 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,
* backlight control and supports more levels than other options.
* Disable the other backlight choices.
*/
+ acpi_video_dmi_promote_vendor();
acpi_video_unregister();
apple_bl_unregister();

@@ -213,6 +214,7 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)
release_region(gmux_data->iostart, gmux_data->iolen);
kfree(gmux_data);

+ acpi_video_dmi_demote_vendor();
acpi_video_register();
apple_bl_register();
}
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index e2a34b4..b822784 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -26,9 +26,7 @@
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <linux/ctype.h>
-#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
#include <acpi/video.h>
-#endif

/*
* This driver is needed because a number of Samsung laptops do not hook
@@ -1530,15 +1528,16 @@ static int __init samsung_init(void)
samsung->quirks = quirks;


-#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
+#ifdef CONFIG_ACPI
+ if (samsung->quirks->broken_acpi_video)
+ acpi_video_dmi_promote_vendor();
+
/* Don't handle backlight here if the acpi video already handle it */
if (acpi_video_backlight_support()) {
- if (samsung->quirks->broken_acpi_video) {
- pr_info("Disabling ACPI video driver\n");
- acpi_video_unregister();
- } else {
- samsung->handle_backlight = false;
- }
+ samsung->handle_backlight = false;
+ } else if (samsung->quirks->broken_acpi_video) {
+ pr_info("Disabling ACPI video driver\n");
+ acpi_video_unregister();
}
#endif

@@ -1552,8 +1551,7 @@ static int __init samsung_init(void)

#ifdef CONFIG_ACPI
/* Only log that if we are really on a sabi platform */
- if (acpi_video_backlight_support() &&
- !samsung->quirks->broken_acpi_video)
+ if (acpi_video_backlight_support())
pr_info("Backlight controlled by ACPI video driver\n");
#endif

--
1.7.9.5

2012-06-14 12:58:50

by joeyli

[permalink] [raw]
Subject: Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()

於 四,2012-06-14 於 13:04 +0200,Corentin Chary 提到:
> Instead of using directly acpi_video_unregister(), use
> acpi_video_dmi_promote_vendor() (and make it call
> acpi_video_unregister() if needed)
>
> Signed-off-by: Corentin Chary <[email protected]>

It's good to me!

Acked-by: Lee, Chun-Yi <[email protected]>


Thanks a lot!
Joey Lee

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

2012-06-14 20:02:19

by Seth Forshee

[permalink] [raw]
Subject: Re: [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor()

On Thu, Jun 14, 2012 at 01:04:30PM +0200, Corentin Chary wrote:
> Instead of using directly acpi_video_unregister(), use
> acpi_video_dmi_promote_vendor() (and make it call
> acpi_video_unregister() if needed)
>
> Signed-off-by: Corentin Chary <[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

Tested-by: Seth Forshee <[email protected]>

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