2014-02-18 05:54:14

by Aaron Lu

[permalink] [raw]
Subject: [PATCH v4] ACPI / video: Add systems that should favour native backlight interface

Some system's ACPI video backlight control interface is broken and the
native backlight control interface should be used by default. This patch
sets the use_native_backlight parameter to true for those systems so
that video backlight control interface will not be created. For detailed
models that are added here, reference the following list.

Note that the user specified kernel cmdline option will always have the
highest priority, i.e. if use_native_backlight=0 is specified and the
system is in the DMI table, the video module will not skip registering
backlight interface for it.

Thinkpad T430s:
Reported-by: Theodore Tso <[email protected]>
Reported-and-tested-by: Peter Weber <[email protected]>
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=51231
Thinkpad X230:
Reported-and-tested-by: Igor Gnatenko <[email protected]>
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=51231
ThinkPad X1 Carbon:
Reported-and-tested-by: Igor Gnatenko <[email protected]>
Lenovo Yoga 13:
Reported-by: Lennart Poettering <[email protected]>
Reported-and-tested-by: Kevin Smith <[email protected]>
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=63811
Dell Inspiron 7520:
Reported-by: Rinat Ibragimov <[email protected]>
Acer Aspire 5733Z:
Reported-by: <[email protected]>
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=62941
Acer Aspire V5-431:
Reported-by: Thomas Christensen <[email protected]>
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=68751
HP ProBook 4340s:
Reported-and-tested-by: Vladimir Sherenkov <[email protected]>
Reference: http://redmine.russianfedora.pro/issues/1258
HP EliteBook/ProBook 2013 models, ZBook and some others:
Provided-by: Takashi Iwai <[email protected]>

Signed-off-by: Aaron Lu <[email protected]>
---
drivers/acpi/blacklist.c | 8 ---
drivers/acpi/video.c | 139 ++++++++++++++++++++++++++++++++++++++++++--
drivers/acpi/video_detect.c | 16 -----
3 files changed, 134 insertions(+), 29 deletions(-)

diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 10e4964d051a..e8e4c3dfaff7 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -260,14 +260,6 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
},
{
.callback = dmi_disable_osi_win8,
- .ident = "Dell Inspiron 15R SE",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
- DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7520"),
- },
- },
- {
- .callback = dmi_disable_osi_win8,
.ident = "ThinkPad Edge E530",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index ea9d914d937a..b6ba88ed31ae 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -81,11 +81,12 @@ static bool allow_duplicates;
module_param(allow_duplicates, bool, 0644);

/*
- * For Windows 8 systems: if set ture and the GPU driver has
- * registered a backlight interface, skip registering ACPI video's.
+ * For Windows 8 systems: used to decide if video module
+ * should skip registering backlight interface of its own.
*/
-static bool use_native_backlight = false;
-module_param(use_native_backlight, bool, 0644);
+static int use_native_backlight_param = -1;
+module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
+static bool use_native_backlight_dmi = false;

static int register_count;
static struct mutex video_list_lock;
@@ -231,9 +232,17 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
static int acpi_video_switch_brightness(struct acpi_video_device *device,
int event);

+static bool acpi_video_use_native_backlight(void)
+{
+ if (use_native_backlight_param != -1)
+ return use_native_backlight_param;
+ else
+ return use_native_backlight_dmi;
+}
+
static bool acpi_video_verify_backlight_support(void)
{
- if (acpi_osi_is_win8() && use_native_backlight &&
+ if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
backlight_device_registered(BACKLIGHT_RAW))
return false;
return acpi_video_backlight_support();
@@ -398,6 +407,12 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
return 0;
}

+static int __init video_set_use_native_backlight(const struct dmi_system_id *d)
+{
+ use_native_backlight_dmi = true;
+ return 0;
+}
+
static struct dmi_system_id video_dmi_table[] __initdata = {
/*
* Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -442,6 +457,120 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"),
},
},
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "ThinkPad T430s",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "ThinkPad X230",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X230"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "ThinkPad X1 Carbon",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X1 Carbon"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "Lenovo Yoga 13",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga 13"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "Dell Inspiron 7520",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Inspiron 7520"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "Acer Aspire 5733Z",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5733Z"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "Acer Aspire V5-431",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-431"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "HP ProBook 4340s",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "HP ProBook 4340s"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "HP ProBook 2013 models",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook "),
+ DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "HP EliteBook 2013 models",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
+ DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "HP ZBook 14",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 14"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "HP ZBook 15",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 15"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "HP ZBook 17",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 17"),
+ },
+ },
+ {
+ .callback = video_set_use_native_backlight,
+ .ident = "HP EliteBook 8780w",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"),
+ },
+ },
{}
};

diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index a697b77b8865..19080c8e2f2a 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -168,22 +168,6 @@ static struct dmi_system_id video_detect_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
},
},
- {
- .callback = video_detect_force_vendor,
- .ident = "HP EliteBook Revolve 810",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
- DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Revolve 810 G1"),
- },
- },
- {
- .callback = video_detect_force_vendor,
- .ident = "Lenovo Yoga 13",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga 13"),
- },
- },
{ },
};

--
1.8.5.3


2014-02-18 10:27:25

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH v4] ACPI / video: Add systems that should favour native backlight interface

On Tue, Feb 18, 2014 at 01:54:20PM +0800, Aaron Lu wrote:
> + {
> + .callback = video_set_use_native_backlight,
> + .ident = "HP EliteBook 2013 models",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
> + DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
> + },
> + },

I see my device is listed here but the above doesn't really use native
backlight because it is still in acpi_osi blacklist. Tried this and I can
see both acpi_video0 and intel_backlight listed under /sys/class/backlight.
Was this the intention?

2014-02-18 13:31:50

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v4] ACPI / video: Add systems that should favour native backlight interface

At Tue, 18 Feb 2014 12:34:42 +0200,
Mika Westerberg wrote:
>
> On Tue, Feb 18, 2014 at 01:54:20PM +0800, Aaron Lu wrote:
> > + {
> > + .callback = video_set_use_native_backlight,
> > + .ident = "HP EliteBook 2013 models",
> > + .matches = {
> > + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
> > + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
> > + DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
> > + },
> > + },
>
> I see my device is listed here but the above doesn't really use native
> backlight because it is still in acpi_osi blacklist. Tried this and I can
> see both acpi_video0 and intel_backlight listed under /sys/class/backlight.
> Was this the intention?

The acpi_osi blacklist commit (2d4054d84224) has to be reverted, as I
mentioned earlier. But the revert can be done individually after
merging this patch. Rafael, could you care?


Takashi

2014-02-18 15:07:42

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v4] ACPI / video: Add systems that should favour native backlight interface

On Tuesday, February 18, 2014 02:31:46 PM Takashi Iwai wrote:
> At Tue, 18 Feb 2014 12:34:42 +0200,
> Mika Westerberg wrote:
> >
> > On Tue, Feb 18, 2014 at 01:54:20PM +0800, Aaron Lu wrote:
> > > + {
> > > + .callback = video_set_use_native_backlight,
> > > + .ident = "HP EliteBook 2013 models",
> > > + .matches = {
> > > + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
> > > + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
> > > + DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
> > > + },
> > > + },
> >
> > I see my device is listed here but the above doesn't really use native
> > backlight because it is still in acpi_osi blacklist. Tried this and I can
> > see both acpi_video0 and intel_backlight listed under /sys/class/backlight.
> > Was this the intention?
>
> The acpi_osi blacklist commit (2d4054d84224) has to be reverted, as I
> mentioned earlier. But the revert can be done individually after
> merging this patch. Rafael, could you care?

Done. Please check the result in linux-pm.git/linux-next.

Thanks,
Rafael

2014-02-18 15:39:18

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH v4] ACPI / video: Add systems that should favour native backlight interface

On Tue, Feb 18, 2014 at 04:22:27PM +0100, Rafael J. Wysocki wrote:
> On Tuesday, February 18, 2014 02:31:46 PM Takashi Iwai wrote:
> > At Tue, 18 Feb 2014 12:34:42 +0200,
> > Mika Westerberg wrote:
> > >
> > > On Tue, Feb 18, 2014 at 01:54:20PM +0800, Aaron Lu wrote:
> > > > + {
> > > > + .callback = video_set_use_native_backlight,
> > > > + .ident = "HP EliteBook 2013 models",
> > > > + .matches = {
> > > > + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
> > > > + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
> > > > + DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
> > > > + },
> > > > + },
> > >
> > > I see my device is listed here but the above doesn't really use native
> > > backlight because it is still in acpi_osi blacklist. Tried this and I can
> > > see both acpi_video0 and intel_backlight listed under /sys/class/backlight.
> > > Was this the intention?
> >
> > The acpi_osi blacklist commit (2d4054d84224) has to be reverted, as I
> > mentioned earlier. But the revert can be done individually after
> > merging this patch. Rafael, could you care?
>
> Done. Please check the result in linux-pm.git/linux-next.

With your revert and this patch from Aaron, backlight on my HP EliteBook
Revolve G1 works fine, thanks!

Tested-by: Mika Westerberg <[email protected]>

2014-02-18 19:28:38

by Igor Gnatenko

[permalink] [raw]
Subject: Re: [PATCH v4] ACPI / video: Add systems that should favour native backlight interface

On Tue, 2014-02-18 at 16:22 +0100, Rafael J. Wysocki wrote:
> On Tuesday, February 18, 2014 02:31:46 PM Takashi Iwai wrote:
> > At Tue, 18 Feb 2014 12:34:42 +0200,
> > Mika Westerberg wrote:
> > >
> > > On Tue, Feb 18, 2014 at 01:54:20PM +0800, Aaron Lu wrote:
> > > > + {
> > > > + .callback = video_set_use_native_backlight,
> > > > + .ident = "HP EliteBook 2013 models",
> > > > + .matches = {
> > > > + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
> > > > + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
> > > > + DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
> > > > + },
> > > > + },
> > >
> > > I see my device is listed here but the above doesn't really use native
> > > backlight because it is still in acpi_osi blacklist. Tried this and I can
> > > see both acpi_video0 and intel_backlight listed under /sys/class/backlight.
> > > Was this the intention?
> >
> > The acpi_osi blacklist commit (2d4054d84224) has to be reverted, as I
> > mentioned earlier. But the revert can be done individually after
> > merging this patch. Rafael, could you care?
>
> Done. Please check the result in linux-pm.git/linux-next.
Is it will merge to 3.14 ?

P.S. why you don't using rafael@ mail ? *joke*
>
> Thanks,
> Rafael
>


--
-Igor Gnatenko

2014-02-18 22:20:27

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v4] ACPI / video: Add systems that should favour native backlight interface

On Tuesday, February 18, 2014 11:28:29 PM Igor Gnatenko wrote:
> On Tue, 2014-02-18 at 16:22 +0100, Rafael J. Wysocki wrote:
> > On Tuesday, February 18, 2014 02:31:46 PM Takashi Iwai wrote:
> > > At Tue, 18 Feb 2014 12:34:42 +0200,
> > > Mika Westerberg wrote:
> > > >
> > > > On Tue, Feb 18, 2014 at 01:54:20PM +0800, Aaron Lu wrote:
> > > > > + {
> > > > > + .callback = video_set_use_native_backlight,
> > > > > + .ident = "HP EliteBook 2013 models",
> > > > > + .matches = {
> > > > > + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
> > > > > + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
> > > > > + DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
> > > > > + },
> > > > > + },
> > > >
> > > > I see my device is listed here but the above doesn't really use native
> > > > backlight because it is still in acpi_osi blacklist. Tried this and I can
> > > > see both acpi_video0 and intel_backlight listed under /sys/class/backlight.
> > > > Was this the intention?
> > >
> > > The acpi_osi blacklist commit (2d4054d84224) has to be reverted, as I
> > > mentioned earlier. But the revert can be done individually after
> > > merging this patch. Rafael, could you care?
> >
> > Done. Please check the result in linux-pm.git/linux-next.
> Is it will merge to 3.14 ?

That's the plan.

> P.S. why you don't using rafael@ mail ? *joke*

Because it is hooked up to gmail. And I actually do use it sometimes.

Thanks,
Rafael

2014-02-19 02:57:06

by Aaron Lu

[permalink] [raw]
Subject: Re: [PATCH v4] ACPI / video: Add systems that should favour native backlight interface

On 02/18/2014 11:46 PM, Mika Westerberg wrote:
> On Tue, Feb 18, 2014 at 04:22:27PM +0100, Rafael J. Wysocki wrote:
>> On Tuesday, February 18, 2014 02:31:46 PM Takashi Iwai wrote:
>>> At Tue, 18 Feb 2014 12:34:42 +0200,
>>> Mika Westerberg wrote:
>>>>
>>>> On Tue, Feb 18, 2014 at 01:54:20PM +0800, Aaron Lu wrote:
>>>>> + {
>>>>> + .callback = video_set_use_native_backlight,
>>>>> + .ident = "HP EliteBook 2013 models",
>>>>> + .matches = {
>>>>> + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
>>>>> + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
>>>>> + DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
>>>>> + },
>>>>> + },
>>>>
>>>> I see my device is listed here but the above doesn't really use native
>>>> backlight because it is still in acpi_osi blacklist. Tried this and I can
>>>> see both acpi_video0 and intel_backlight listed under /sys/class/backlight.
>>>> Was this the intention?
>>>
>>> The acpi_osi blacklist commit (2d4054d84224) has to be reverted, as I
>>> mentioned earlier. But the revert can be done individually after
>>> merging this patch. Rafael, could you care?
>>
>> Done. Please check the result in linux-pm.git/linux-next.
>
> With your revert and this patch from Aaron, backlight on my HP EliteBook
> Revolve G1 works fine, thanks!
>
> Tested-by: Mika Westerberg <[email protected]>

Thanks for the test Mika and sorry for all the confusions caused.

-Aaron