Skip to contentSkip to conversation

dell-laptop: add parameter to disable the backlight device.

PATCH In review Alex Davis 2 participants 4 messages Dec 8, 2013

lore
Share & tools
lore

Alex Davis

author
#0 lore raw

PATCH 1/1 dell-laptop: add parameter to disable the backlight device.

I have a Dell Inspiron N7010 Laptop with Intel graphics. When the dell-laptop module is loaded, two backlight device devices are created; dell_backlight, and intel_backlight from the Intel graphics driver. The dell_backlight device is non-functional, but the graphics subsystem uses it instead of the functioning intel_backlight device. The result is that, when running KDE, screen brightness cannot be controlled. I've added a module parameter, disable_backlight which, when true, will disable the dell_backlight device, and leave only the intel_backlight:
with this, screen brightness can be controlled.

This patch is against 3.10.

dell-laptop.c    2013-12-01 17:29:27.613372482 -0500 renamed from dell-laptop.c.orig    2013-12-01 19:05:39.693149050 -0500 +0 -0
@@ -35,6 +35,9 @@

 /* This structure will be modified by the firmware when we enter
  * system management mode, hence the volatiles */

+static bool disable_backlight; +module_param(disable_backlight, bool, 0644);
+
 struct calling_interface_buffer {
     u16 class;
     u16 select;
@@ -561,6 +564,9 @@ static int __init dell_init(void)

     dell_laptop_dir = debugfs_create_dir("dell_laptop", NULL);
+    if (disable_backlight)
+        return 0;
+
 #ifdef CONFIG_ACPI
     /* In the event of an ACPI backlight being available, don't
      * register the platform controller.


I code, therefore I am

#1 lore raw

2013-12-08 14:40, Alex Davis:

Quoted 8 lines

I have a Dell Inspiron N7010 Laptop with Intel graphics. When the dell-laptop module is loaded, two backlight device devices are created; dell_backlight, and intel_backlight from the Intel graphics driver. The dell_backlight device is non-functional, but the graphics subsystem uses it instead of the functioning intel_backlight device. The result is that, when running KDE, screen brightness cannot be controlled. I've added a module parameter, disable_backlight which, when true, will disable the dell_backlight device, and leave only the intel_backlight:
with this, screen brightness can be controlled.

Hi,

I think it would be better if we could figure out why the dell_blacklight device is not working rather than disabling it.

Regarding your patch, it creates a memory leak as you:
* allocate a platform device
* you add it
* you allocated a page for SMI

Your if(disable_blacklight) code should go
where it checks the DMI.

Signature · 2 lines
Regards,
Levente Kurusa
author
#2 lore raw

--------------------------------------------

Quoted 7 lines · Levente Kurusa

Subject: Re: [PATCH] dell-laptop: add parameter to disable the backlight device.
To: "Alex Davis" <[email protected]>, "[email protected]" <[email protected]>, >"linux->[email protected]" <[email protected]>
Date: Sunday, December 8, 2013, 9:06 AM

Quoted 2 lines

2013-12-08 14:40, Alex Davis:
I have a Dell Inspiron N7010 Laptop with Intel

graphics. When the dell-laptop module is loaded,

Quoted 1 line
Quoted 1 line

two backlight device devices are created;

dell_backlight, and intel_backlight from the Intel

Quoted 1 line
Quoted 1 line

graphics driver. The dell_backlight device is

non-functional, but the graphics subsystem uses

Quoted 1 line
Quoted 1 line

it instead of the functioning intel_backlight device.

The result is that, when running KDE,

Quoted 1 line
Quoted 1 line

screen brightness cannot be controlled. I've added a

module parameter, disable_backlight

Quoted 1 line
Quoted 1 line

which, when true, will disable the dell_backlight

device, and leave only the intel_backlight:

Quoted 15 lines
Quoted 2 lines

with this, screen brightness can be controlled.

Hi,

I think it would be better if we could figure out why the dell_blacklight device is not working rather than disabling it.

Regarding your patch, it creates a memory leak as you:
* allocate a platform device
* you add it
* you allocated a page for SMI

Quoted 5 lines

Your if(disable_blacklight) code should go
where it checks the DMI.

-- Regards,
Levente Kurusa

Levante,

You are correct. The existing code also has a memory leak. I will submit a patch for that.

author
#3 lore raw

I code, therefore I am

--------------------------------------------
On Sun, 12/8/13, Alex Davis <[email protected]> wrote:

Subject: Re: [PATCH] dell-laptop: add parameter to disable the backlight device.
To: "[email protected]" <[email protected]>, "[email protected]" <[email protected]>, "Levente Kurusa" <[email protected]>
Date: Sunday, December 8, 2013, 3:38 PM

--------------------------------------------

Quoted 1 line · Levente Kurusa

Subject: Re: [PATCH] dell-laptop: add parameter to

disable the backlight device.

Quoted 1 line

To: "Alex Davis" <[email protected]>,

"[email protected]"
<[email protected]>,

Quoted 1 line

"linux->[email protected]"

<[email protected]>

Quoted 5 lines

Date: Sunday, December 8, 2013, 9:06 AM

Quoted 2 lines

2013-12-08 14:40, Alex Davis:
I have a Dell Inspiron N7010 Laptop with Intel

graphics. When the dell-laptop module is loaded,

Quoted 1 line
Quoted 1 line

two backlight device devices are created;

dell_backlight, and intel_backlight from the Intel

Quoted 1 line
Quoted 1 line

graphics driver. The dell_backlight device is

non-functional, but the graphics subsystem uses

Quoted 1 line
Quoted 1 line

it instead of the functioning intel_backlight

device.
The result is that, when running KDE,

Quoted 1 line
Quoted 1 line

screen brightness cannot be controlled. I've added

a
module parameter, disable_backlight

Quoted 1 line
Quoted 1 line

which, when true, will disable the dell_backlight

device, and leave only the intel_backlight:

Quoted 6 lines
Quoted 2 lines

with this, screen brightness can be controlled.

Hi,

I think it would be better if we could figure out why

the

Quoted 1 line

dell_blacklight device is not working rather than

disabling

Quoted 8 lines

it.

Regarding your patch, it creates a memory leak as you:
  * allocate a platform device
  * you add it
  * you allocated a page for SMI

Quoted 5 lines

Your if(disable_blacklight) code should go
where it checks the DMI.

-- Regards,
Levente Kurusa

Levante,

Quoted 2 lines

You are correct. The existing code also has a memory leak. I will submit a patch for that.

Upon further investigation, I'm not seeing the memory leak. I see the objects being allocated, but they are deallocated in the dell_exit method.