Skip to contentSkip to conversation

acpi: add backlight support to the sony_acpi driver

PATCH In review Alessandro Guido 13 participants 37 messages Sep 30, 2006 – Oct 30, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi: add backlight support to the sony_acpi driver

Make the sony_acpi use the backlight subsystem to adjust brightness value instead of using the /proc/sony/brightness file.
(Other settings will still have a /proc/sony/... entry)

---
 drivers/acpi/Kconfig     |    1 
 drivers/acpi/sony_acpi.c |   59 +++++++++++++++++++++++++++++++++++++----------
 2 files changed, 48 insertions(+), 12 deletions(-)
drivers/acpi/Kconfig +1 -0
Index: linux-2.6.18/drivers/acpi/Kconfig
===================================================================
@@ -258,6 +258,7 @@ config ACPI_TOSHIBA
 config ACPI_SONY
 	tristate "Sony Laptop Extras"
 	depends on X86 && ACPI
+	select BACKLIGHT_CLASS_DEVICE
 	default m
 	  ---help---
 	  This mini-driver drives the ACPI SNC device present in the
drivers/acpi/sony_acpi.c +47 -12

112 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · On Sat, 30 Sep 2006 19:08:10 +0200 Alessandro Guido…

Make the sony_acpi use the backlight subsystem to adjust brightness value instead of using the /proc/sony/brightness file.
(Other settings will still have a /proc/sony/... entry)

I meant /proc/acpi/sony/brightness and /proc/acpi/sony/...

sorry

#2 lore raw
Quoted 6 lines
Quoted 4 lines

Make the sony_acpi use the backlight subsystem to adjust brightness value instead of using the /proc/sony/brightness file.
(Other settings will still have a /proc/sony/... entry)

I meant /proc/acpi/sony/brightness and /proc/acpi/sony/...

Hm spicctrl needs to be updated then. (Or maybe not if it does not use /proc)

Jan Engelhardt

#3 lore raw
In reply to Alessandro Guido
Quoted 3 lines · On Sat, 30 Sep 2006 19:08:10 +0200 Alessandro Guido…

Make the sony_acpi use the backlight subsystem to adjust brightness value instead of using the /proc/sony/brightness file.
(Other settings will still have a /proc/sony/... entry)

umm, OK, but now how do I adjust my screen brightness? ;)

I assume that cute userspace applications for controlling backlight brightness via the generic backlight driver either exist or are in progress? What is the status of that?

Thanks.

#4 lore raw
Quoted 7 lines · Andrew Morton
Quoted 3 lines · On Sat, 30 Sep 2006 19:08:10 +0200 Alessandro Guido…

Make the sony_acpi use the backlight subsystem to adjust brightness value instead of using the /proc/sony/brightness file.
(Other settings will still have a /proc/sony/... entry)

Quoted 5 lines

umm, OK, but now how do I adjust my screen brightness? ;)

I assume that cute userspace applications for controlling backlight brightness via the generic backlight driver either exist or are in progress? What is the status of that?

For Dell laptops, the dellLcdBrightness app is included in the libsmbios-bin package (http://linux.dell.com/libsmbios/main/ and
http://linux.dell.com/libsmbios/main/yum.html for the yum repo). It's entirely userspace.

Signature · 4 lines
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
#5 lore raw
Quoted 11 lines · Matt Domsch
Quoted 5 lines · Andrew Morton

umm, OK, but now how do I adjust my screen brightness? ;)

I assume that cute userspace applications for controlling backlight brightness via the generic backlight driver either exist or are in progress? What is the status of that?

For Dell laptops, the dellLcdBrightness app is included in the libsmbios-bin package (http://linux.dell.com/libsmbios/main/ and
http://linux.dell.com/libsmbios/main/yum.html for the yum repo). It's entirely userspace.

Which is to say, if a system-agnostic userspace app exists, please advise, as we'd like to incorporate dellLcdBrightness functionality into it.

Thanks,
Matt

Signature · 4 lines
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
#6 lore raw
In reply to Matt Domsch

Hi!

Quoted 8 lines
Quoted 3 lines

I assume that cute userspace applications for controlling backlight brightness via the generic backlight driver either exist or are in progress? What is the status of that?

For Dell laptops, the dellLcdBrightness app is included in the libsmbios-bin package (http://linux.dell.com/libsmbios/main/ and
http://linux.dell.com/libsmbios/main/yum.html for the yum repo). It's entirely userspace.

Please move it into the kernel where it belongs, and use lcd brightness subsystem like everyone else.
Pavel

Signature · 1 line
Thanks for all the (sleeping) penguins.
#7 lore raw
Quoted 6 lines · Pavel Machek

Hi!

Quoted 4 lines
Quoted 3 lines

I assume that cute userspace applications for controlling backlight brightness via the generic backlight driver either exist or are in progress? What is the status of that?

Quoted 7 lines
Quoted 4 lines

For Dell laptops, the dellLcdBrightness app is included in the libsmbios-bin package (http://linux.dell.com/libsmbios/main/ and
http://linux.dell.com/libsmbios/main/yum.html for the yum repo). It's entirely userspace.

Please move it into the kernel where it belongs, and use lcd brightness subsystem like everyone else.

We've been through this before.
http://marc.theaimsgroup.com/?l=linux-kernel&m=114067198323596&w=2

In addition, the SMI call used to change the backlight level *may* require (if configured by the sysadmin in BIOS), a password be entered.

This begs for a common userspace app that can grok libsmbios and kernel interfaces both, and use the appropriate method on each, rather than just putting it all in the kernel.

Thanks,
Matt

Signature · 4 lines
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
#8 lore raw

Hi!

Quoted 9 lines
Quoted 2 lines

Please move it into the kernel where it belongs, and use lcd brightness subsystem like everyone else.

We've been through this before.
http://marc.theaimsgroup.com/?l=linux-kernel&m=114067198323596&w=2

In addition, the SMI call used to change the backlight level *may* require (if configured by the sysadmin in BIOS), a password be entered.

This is crazy, password-protected backlight level?

Can you make sure this crazyness does not infect newer models?

Quoted 3 lines

This begs for a common userspace app that can grok libsmbios and kernel interfaces both, and use the appropriate method on each, rather than just putting it all in the kernel.

Kernel is expected to provide hardware abstraction. libsmbios will mean person able to change backlight will be able to do lots of strange stuff...
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#9 lore raw
In reply to Matt Domsch
Quoted 10 lines
Quoted 2 lines

Please move it into the kernel where it belongs, and use lcd brightness subsystem like everyone else.

We've been through this before.
http://marc.theaimsgroup.com/?l=linux-kernel&m=114067198323596&w=2

In addition, the SMI call used to change the backlight level *may* require (if configured by the sysadmin in BIOS), a password be entered.

Quoted 5 lines

This begs for a common userspace app that can grok libsmbios and kernel interfaces both, and use the appropriate method on each, rather than just putting it all in the kernel

From my understanding, a cute userspace App shouldn't have this kind

of logic:
if (is DELL )
invoke libsmbios
if (is foo)
invoke libfoo,
if (is bar)
invoke libbar,
....
else
operate on /sys/class/backlight/ ,.,..

It should be:
just write/read file in /sys/class/backlight ,....

Right?

Thanks,
Luming

#10 lore raw
Quoted 11 lines · Yu Luming
Quoted 1 line

From my understanding, a cute userspace App shouldn't have this kind

of logic:
if (is DELL )
invoke libsmbios
if (is foo)
invoke libfoo,
if (is bar)
invoke libbar,
....
else
operate on /sys/class/backlight/ ,.,..

This is what HAL has at the moment[1]. And it's hell to maintain, but works for a lot of users.

Quoted 2 lines

It should be:
just write/read file in /sys/class/backlight ,....

That would make things much easier IMO.

Richard.

[1]
http://gitweb.freedesktop.org/?p=hal.git;a=blob;h=3ff9284be440a7197b0de9b5f0234761c3397cb1;hb=dbffafacbf7b9143d82547b9eabe61d1a5b8fffc;f=tools/linux/hal-system-lcd-get-brightness-linux

#11 lore raw
Quoted 13 lines · Richard Hughes
Quoted 11 lines · Yu Luming
Quoted 1 line

From my understanding, a cute userspace App shouldn't have this kind

of logic:
if (is DELL )
invoke libsmbios
if (is foo)
invoke libfoo,
if (is bar)
invoke libbar,
....
else
operate on /sys/class/backlight/ ,.,..

Quoted 2 lines

This is what HAL has at the moment[1]. And it's hell to maintain, but works for a lot of users.

This is slightly different. This shows that there are a number of slightly different kernel implementations:

/proc/acpi/toshiba/lcd
/proc/acpi/asus/brn
/proc/acpi/pcc/brightness
/proc/acpi/ibm/brightness
/proc/acpi/sony/brightness
/proc/omnibook/lcd

which is indeed nasty. I'd agree all in-kernel solutions should use the same kernel<->user interface. I'd also expect the kernel to have a generic ACPI driver that exports the _BCL and _BCM method implementations via that same interface, so that systems providing that will "just work". drivers/acpi/video.c currently exports this via /proc/acpi/video/$DEVICE/brightness, which isn't the same as /sys/class/backlight. :-(

There's also at least one more userspace option for the sonypi using spiictrl. This is where I expected libsmbios to plug in also, as a fallback to the ACPI _BCL/_BCM methods above.

Thanks,
Matt

Signature · 4 lines
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
#12 lore raw
Quoted 28 lines · Matt Domsch
Quoted 14 lines · Richard Hughes
Quoted 12 lines · Yu Luming
Quoted 1 line

From my understanding, a cute userspace App shouldn't have this kind

of logic:
if (is DELL )
invoke libsmbios
if (is foo)
invoke libfoo,
if (is bar)
invoke libbar,
....
else
operate on /sys/class/backlight/ ,.,..

Quoted 2 lines

This is what HAL has at the moment[1]. And it's hell to maintain, but works for a lot of users.

This is slightly different. This shows that there are a number of slightly different kernel implementations:

/proc/acpi/toshiba/lcd
/proc/acpi/asus/brn
/proc/acpi/pcc/brightness
/proc/acpi/ibm/brightness
/proc/acpi/sony/brightness
/proc/omnibook/lcd

Quoted 2 lines

which is indeed nasty. I'd agree all in-kernel solutions should use the same kernel<->user interface. I'd also expect the kernel to have

Yes, we all seem to agree we need to throw away /proc/acpi just after we have solid sysfs interface for acpi.

Quoted 5 lines

a generic ACPI driver that exports the _BCL and _BCM method implementations via that same interface, so that systems providing that will "just work". drivers/acpi/video.c currently exports this via /proc/acpi/video/$DEVICE/brightness, which isn't the same as /sys/class/backlight. :-(

Yes, I'm working on acpi video driver transition , and have posted a patch to user backlight for acpi video driver.
http://marc.theaimsgroup.com/?l=linux-acpi&m=115574087203605&w=2

Quoted 4 lines

There's also at least one more userspace option for the sonypi using spiictrl. This is where I expected libsmbios to plug in also, as a fallback to the ACPI _BCL/_BCM methods above.

I think spiictrl would be thrown away just after we have solid sysfs support.

Thanks,
Luming

#13 lore raw
Quoted 9 lines
Quoted 5 lines

a generic ACPI driver that exports the _BCL and _BCM method implementations via that same interface, so that systems providing that will "just work". drivers/acpi/video.c currently exports this via /proc/acpi/video/$DEVICE/brightness, which isn't the same as /sys/class/backlight. :-(

Yes, I'm working on acpi video driver transition , and have posted a patch to user backlight for acpi video driver.
http://marc.theaimsgroup.com/?l=linux-acpi&m=115574087203605&w=2

Just updated the backlight and output sysfs support for ACPI Video driver on bugzilla. If you are interested this, please take a look at
http://bugzilla.kernel.org/show_bug.cgi?id=5749#c18

signed-off-by [email protected]

[patch 1/3] vidoe sysfs support: Add dev argument for baclight sys dev [patch 2/3] Add display output class support
[patch 3/3] backlight and output sysfs support for acpi video driver

Thanks,
Luming

#14 lore raw

Hi!

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

a generic ACPI driver that exports the _BCL and _BCM method implementations via that same interface, so that systems providing that will "just work". drivers/acpi/video.c currently exports this via /proc/acpi/video/$DEVICE/brightness, which isn't the same as /sys/class/backlight. :-(

Yes, I'm working on acpi video driver transition , and have posted a patch to user backlight for acpi video driver.
http://marc.theaimsgroup.com/?l=linux-acpi&m=115574087203605&w=2

Quoted 5 lines

Just updated the backlight and output sysfs support for ACPI Video driver on bugzilla. If you are interested this, please take a look at
http://bugzilla.kernel.org/show_bug.cgi?id=5749#c18

[patch 1/3] vidoe sysfs support: Add dev argument for baclight sys dev

Two typos in one line :-).

Quoted 1 line

[patch 2/3] Add display output class support

I guess this needs Documentation/ so we can tell if user<->kernel interface is sane..

Quoted 1 line

[patch 3/3] backlight and output sysfs support for acpi video driver

Some whitespace is not okay there...
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#15 lore raw
Quoted 22 lines · Pavel Machek

Hi!

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

a generic ACPI driver that exports the _BCL and _BCM method implementations via that same interface, so that systems providing that will "just work". drivers/acpi/video.c currently exports this via /proc/acpi/video/$DEVICE/brightness, which isn't the same as /sys/class/backlight. :-(

Yes, I'm working on acpi video driver transition , and have posted a patch to user backlight for acpi video driver.
http://marc.theaimsgroup.com/?l=linux-acpi&m=115574087203605&w=2

Quoted 5 lines

Just updated the backlight and output sysfs support for ACPI Video driver on bugzilla. If you are interested this, please take a look at
http://bugzilla.kernel.org/show_bug.cgi?id=5749#c18

[patch 1/3] vidoe sysfs support: Add dev argument for baclight sys dev

Two typos in one line :-).

Quoted 1 line

[patch 2/3] Add display output class support

Quoted 7 lines

I guess this needs Documentation/ so we can tell if user<->kernel interface is sane..

Quoted 1 line

[patch 3/3] backlight and output sysfs support for acpi video driver

Some whitespace is not okay there...
Pavel

updated version.
[patch 1/4] video sysfs support: Add dev argument for backlight sys dev

 drivers/video/backlight/backlight.c |    3 ++-
 include/linux/backlight.h           |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

[patch 2/4] Add display output class support

 drivers/video/output.c |  110 
+++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/output.h |   23 ++++++++++
 2 files changed, 133 insertions(+)

[patch 3/4] backlight and output sysfs support for acpi video driver

 acpi/Kconfig   |    2
 acpi/video.c   |  257 
+++++++++++++++++++++++++++++++++++++++++++++++++++++----
 video/Kconfig  |    8 +
 video/Makefile |    1
 4 files changed, 252 insertions(+), 16 deletions(-)

[patch 4/4] Add output class document

 video-output.txt |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Thanks,
Luming

drivers/video/backlight/backlight.c +2 -1
index 27597c5..1a18cdb 100644
@@ -190,7 +190,7 @@ static int fb_notifier_callback(struct n
  * Creates and registers new backlight class_device. Returns either an
  * ERR_PTR() or a pointer to the newly allocated device.
  */
-struct backlight_device *backlight_device_register(const char *name, void *devdata,
+struct backlight_device *backlight_device_register(const char *name,struct device *dev,  void *devdata,
 						   struct backlight_properties *bp)
 {
 	int i, rc;
@@ -206,6 +206,7 @@ struct backlight_device *backlight_devic
 	new_bd->props = bp;
 	memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
 	new_bd->class_dev.class = &backlight_class;
+	new_bd->class_dev.dev = dev;
 	strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN);
 	class_set_devdata(&new_bd->class_dev, devdata);
 
include/linux/backlight.h +1 -1
index 75e91f5..de8e056 100644
@@ -54,7 +54,7 @@ struct backlight_device {
 };
 
 extern struct backlight_device *backlight_device_register(const char *name,
-	void *devdata, struct backlight_properties *bp);
+	struct device *dev, void *devdata, struct backlight_properties *bp);
 extern void backlight_device_unregister(struct backlight_device *bd);
 
 #define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)
drivers/video/output.c new file +110 -0

110 lines not on this page · raw message

include/linux/output.h new file +23 -0
new file mode 100644
index 0000000..f4eb12c
@@ -0,0 +1,23 @@
+#ifndef _LINUX_OUTPUT_H
+#define _LINUX_OUTPUT_H
+
+#include <linux/device.h>
+
+struct output_device;
+
+struct output_properties {
+	int (*set_state)(struct output_device *);
+	int (*get_status)(struct output_device *);
+};
+
+struct output_device {
+	int request_state;
+	struct output_properties *props;
+	struct class_device class_dev;
+};
+
+#define to_output_device(obj) container_of(obj, struct output_device, class_dev)
+
+struct output_device *video_output_register(const char *, struct device *dev, void *, struct output_properties *);
+void video_output_unregister(struct output_device *);
+#endif
Documentation/video-output.txt new file +27 -0
new file mode 100644
index 0000000..43cc0e2
@@ -0,0 +1,27 @@
+The output sysfs class driver is to provide video output abstract layer that can be used to hook platform specific methods to enable/disable video output device through common sysfs interface.
+
+For example, on my IBM Thinkpad T42 laptop, acpi video driver registered its output devices and read/write method for state with output sysfs class. The user interface under sysfs is :
+
+linux:/sys/class/video_output # tree .
+.
+|-- CRT0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+|-- DVI0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+|-- LCD0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+`-- TV0
+   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+   |-- state
+   |-- subsystem -> ../../../class/video_output
+   `-- uevent
+
drivers/acpi/Kconfig +1 -1
index 0f9d4be..a7671f7 100644
@@ -106,7 +106,7 @@ config ACPI_BUTTON
 
 config ACPI_VIDEO
 	tristate "Video"
-	depends on X86
+	depends on X86 && (BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL)
 	help
 	  This driver implement the ACPI Extensions For Display Adapters
 	  for integrated graphics devices on motherboard, as specified in
drivers/acpi/video.c +242 -15

406 lines not on this page · raw message

drivers/video/Kconfig +8 -0
index 7a43020..3b51742 100644
@@ -1644,5 +1644,13 @@ if SYSFS
 	source "drivers/video/backlight/Kconfig"
 endif
 
+
+config VIDEO_OUTPUT_CONTROL
+	tristate "video output device switch control"
+	depends on SYSFS
+	---help---
+	  sysfs support for video output device switching.
+
+
 endmenu
 
drivers/video/Makefile +1 -0
index a6980e9..0f82eed 100644
@@ -108,3 +108,4 @@ obj-$(CONFIG_FB_OF)               += off
 
 # the test framebuffer is last
 obj-$(CONFIG_FB_VIRTUAL)          += vfb.o
+obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o
#16 lore raw

Hi!

Quoted 9 lines
Quoted 2 lines

Some whitespace is not okay there...
Pavel

updated version.

index 27597c5..1a18cdb 100644

drivers/video/backlight/backlight.c static int fb_notifier_callback(struct n · line 194

Quoted 6 lines
drivers/video/backlight/backlight.c +1 -1
@@ -190,7 +190,7 @@ static int fb_notifier_callback(struct n
  * Creates and registers new backlight class_device. Returns either an
  * ERR_PTR() or a pointer to the newly allocated device.
  */
-struct backlight_device *backlight_device_register(const char *name, void *devdata,
+struct backlight_device *backlight_device_register(const char *name,struct device *dev,  void *devdata,
 						   struct

80-columns, and fix the whitespace, please.

drivers/video/output.c line 3

Quoted 6 lines
drivers/video/output.c new file +3 -0
@@ -0,0 +1,110 @@
+/*
+ * Video output switch support
+ */

I guess this one needs copyright/GPL.

drivers/video/output.c line 67

Quoted 2 lines
drivers/video/output.c new file +2 -0
+	struct output_device *new_dev;
+	int	ret_code = 0;

Indentation is wrong where...

drivers/video/output.c line 6

Quoted 1 line
drivers/video/output.c new file +1 -0
+	new_dev = (struct output_device *) kzalloc( sizeof(struct

output_device), GFP_KERNEL);

Cast should not be needed.

drivers/video/output.c line 80

Quoted 4 lines
drivers/video/output.c new file +4 -0
+	strlcpy(new_dev->class_dev.class_id, name, KOBJ_NAME_LEN);
+	class_set_devdata(&new_dev->class_dev, devdata);
+	ret_code = class_device_register(&new_dev->class_dev);
+	if (ret_code){

") {", please.

drivers/video/output.c line 81

Quoted 1 line
drivers/video/output.c new file +1 -0
+		kfree (new_dev);

..and no space between kfree and its arguments.

drivers/video/output.c line 2

Quoted 3 lines
drivers/video/output.c new file +2 -0
@@ -0,0 +1,27 @@
+The output sysfs class driver is to provide video output abstract layer that can be used to hook platform specific methods to enable/disable video output device through common sysfs interface.
+

80-columns, please. And some title would be nice.

drivers/video/output.c struct acpi_video_device_cap { · line 151

Quoted 9 lines
drivers/video/output.c new file +1 -0
@@ -141,11 +144,11 @@ struct acpi_video_device_cap {
 	u8 _ADR:1;		/*Return the unique ID */
 	u8 _BCL:1;		/*Query list of brightness control levels supported */
 	u8 _BCM:1;		/*Set the brightness level */
+	u8 _BQC:1;		/*Get current brightness level */
 	u8 _DDC:1;		/*Return the EDID for this device */
 	u8 _DCS:1;		/*Return status of output device */
 	u8 _DGS:1;		/*Query graphics state */
 	u8 _DSS:1;		/*Device state set */

It is nicer to have space between /* and comment.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#17 lore raw

updated version attached.

signed-off-by [email protected]

[patch 1/6] video sysfs support: Add dev argument for backlight sys dev

drivers/video/backlight/backlight.c |    7 +++++--
include/linux/backlight.h           |    2 +-
2 files changed, 6 insertions(+), 3 deletions(-)

patch 2/6] Add display output class support
drivers/video/output.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/output.h | 42 +++++++++++++++

2 files changed, 171 insertions(+)

[patch 3/6] backlight and output sysfs support for acpi video driver

acpi/Kconfig   |    2
acpi/video.c   |  257 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
video/Kconfig  |    9 +
video/Makefile |    1
4 files changed, 253 insertions(+), 16 deletions(-)

[patch 4/6] Add output class document
video-output.txt | 34 ++++++++++++++++++++++++++++++++++

1 file changed, 34 insertions(+)

[patch 5/6] fix comments style
video.c | 44 ++++++++++++++++++++++----------------------

1 file changed, 22 insertions(+), 22 deletions(-)

[patch 6/6] fix compile time warning
video.c | 4 +---

1 file changed, 1 insertion(+), 3 deletions(-)
Quoted 57 lines · Pavel Machek

Hi!

Quoted 9 lines
Quoted 2 lines

Some whitespace is not okay there...
Pavel

updated version.

index 27597c5..1a18cdb 100644

drivers/video/backlight/backlight.c static int fb_notifier_callback(struct n · line 194

Quoted 6 lines
drivers/video/backlight/backlight.c +1 -1
@@ -190,7 +190,7 @@ static int fb_notifier_callback(struct n
  * Creates and registers new backlight class_device. Returns either an
  * ERR_PTR() or a pointer to the newly allocated device.
  */
-struct backlight_device *backlight_device_register(const char *name, void *devdata,
+struct backlight_device *backlight_device_register(const char *name,struct device *dev,  void *devdata,
                                                 struct

80-columns, and fix the whitespace, please.

drivers/video/output.c line 3

Quoted 6 lines
drivers/video/output.c new file +3 -0
@@ -0,0 +1,110 @@
+/*
+ * Video output switch support
+ */

I guess this one needs copyright/GPL.

drivers/video/output.c line 5

Quoted 2 lines
drivers/video/output.c new file +2 -0
+     struct output_device *new_dev;
+     int     ret_code = 0;

Indentation is wrong where...

drivers/video/output.c line 6

Quoted 1 line
drivers/video/output.c new file +1 -0
+     new_dev = (struct output_device *) kzalloc( sizeof(struct

output_device), GFP_KERNEL);

Cast should not be needed.

drivers/video/output.c line 10

Quoted 4 lines
drivers/video/output.c new file +4 -0
+     strlcpy(new_dev->class_dev.class_id, name, KOBJ_NAME_LEN);
+     class_set_devdata(&new_dev->class_dev, devdata);
+     ret_code = class_device_register(&new_dev->class_dev);
+     if (ret_code){

") {", please.

drivers/video/output.c line 11

Quoted 1 line
drivers/video/output.c new file +1 -0
+             kfree (new_dev);

..and no space between kfree and its arguments.

drivers/video/output.c line 2

Quoted 3 lines
drivers/video/output.c new file +2 -0
@@ -0,0 +1,27 @@
+The output sysfs class driver is to provide video output abstract layer that can be used to hook platform specific methods to enable/disable video output device through common sysfs interface.
+

80-columns, please. And some title would be nice.

Quoted 16 lines

drivers/video/output.c struct acpi_video_device_cap { · line 151

Quoted 9 lines
drivers/video/output.c new file +1 -0
@@ -141,11 +144,11 @@ struct acpi_video_device_cap {
      u8 _ADR:1;              /*Return the unique ID */
      u8 _BCL:1;              /*Query list of brightness control levels supported */
      u8 _BCM:1;              /*Set the brightness level */
+     u8 _BQC:1;              /*Get current brightness level */
      u8 _DDC:1;              /*Return the EDID for this device */
      u8 _DCS:1;              /*Return status of output device */
      u8 _DGS:1;              /*Query graphics state */
      u8 _DSS:1;              /*Device state set */

It is nicer to have space between /* and comment.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

drivers/video/backlight/backlight.c +5 -2
index 27597c5..1d97cdf 100644
@@ -190,8 +190,10 @@ static int fb_notifier_callback(struct n
  * Creates and registers new backlight class_device. Returns either an
  * ERR_PTR() or a pointer to the newly allocated device.
  */
-struct backlight_device *backlight_device_register(const char *name, void *devdata,
-						   struct backlight_properties *bp)
+struct backlight_device *backlight_device_register(const char *name,
+	struct device *dev,
+	void *devdata,
+	struct backlight_properties *bp)
 {
 	int i, rc;
 	struct backlight_device *new_bd;
@@ -206,6 +208,7 @@ struct backlight_device *backlight_devic
 	new_bd->props = bp;
 	memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
 	new_bd->class_dev.class = &backlight_class;
+	new_bd->class_dev.dev = dev;
 	strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN);
 	class_set_devdata(&new_bd->class_dev, devdata);
 
include/linux/backlight.h +1 -1
index 75e91f5..a5cf1be 100644
@@ -54,7 +54,7 @@ struct backlight_device {
 };
 
 extern struct backlight_device *backlight_device_register(const char *name,
-	void *devdata, struct backlight_properties *bp);
+	struct device *dev,void *devdata,struct backlight_properties *bp);
 extern void backlight_device_unregister(struct backlight_device *bd);
 
 #define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)
drivers/video/output.c new file +129 -0

129 lines not on this page · raw message

include/linux/output.h new file +42 -0

42 lines not on this page · raw message

drivers/acpi/Kconfig +1 -1
index 0f9d4be..a7671f7 100644
@@ -106,7 +106,7 @@ config ACPI_BUTTON
 
 config ACPI_VIDEO
 	tristate "Video"
-	depends on X86
+	depends on X86 && (BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL)
 	help
 	  This driver implement the ACPI Extensions For Display Adapters
 	  for integrated graphics devices on motherboard, as specified in
drivers/acpi/video.c +242 -15

406 lines not on this page · raw message

drivers/video/Kconfig +9 -0
index 7a43020..effcb23 100644
@@ -1644,5 +1644,14 @@ if SYSFS
 	source "drivers/video/backlight/Kconfig"
 endif
 
+
+config VIDEO_OUTPUT_CONTROL
+	tristate "Video Output Switcher control"
+	depends on SYSFS
+	---help---
+	  The output sysfs class driver is to provide video output abstract
+	  layer that can be used to hook platform specific driver methods
+	  to enable/disable display output device through common sysfs
+	  interface.	  
 endmenu
 
drivers/video/Makefile +1 -0
index a6980e9..0f82eed 100644
@@ -108,3 +108,4 @@ obj-$(CONFIG_FB_OF)               += off
 
 # the test framebuffer is last
 obj-$(CONFIG_FB_VIRTUAL)          += vfb.o
+obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o
Documentation/video-output.txt new file +34 -0
new file mode 100644
index 0000000..71b1dba
@@ -0,0 +1,34 @@
+
+		Video Output Switcher Control
+		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+		2006 [email protected]
+
+The output sysfs class driver is to provide video output abstract layer that 
+can be used to hook platform specific methods to enable/disable video output
+device through common sysfs interface. For example, on my IBM Thinkpad T42 
+aptop, acpi video driver registered its output devices and read/write method
+for state with output sysfs class. The user interface under sysfs is :
+
+linux:/sys/class/video_output # tree .
+.
+|-- CRT0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+|-- DVI0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+|-- LCD0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+`-- TV0
+   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+   |-- state
+   |-- subsystem -> ../../../class/video_output
+   `-- uevent
+
drivers/acpi/video.c +22 -22

62 lines not on this page · raw message

drivers/acpi/video.c +1 -3
index 4ad109f..4a2520b 100644
@@ -560,13 +560,11 @@ static void acpi_pci_data_handler(acpi_h
 
 static struct acpi_pci_data * acpi_pci_get (struct acpi_device *device)
 {
-	int result = 0;
 	acpi_status status = AE_OK;
 	struct acpi_pci_data *data = NULL;
 	struct acpi_pci_data *pdata = NULL;
 	char *pathname = NULL;
 	struct acpi_buffer buffer = { 0, NULL };
-	acpi_handle handle = NULL;
 	struct pci_dev *dev;
 	struct pci_bus *bus;
 
@@ -576,7 +574,7 @@ static struct acpi_pci_data * acpi_pci_g
 
 	pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
 	if (!pathname)
-		return -ENOMEM;
+		return NULL;
 	memset(pathname, 0, ACPI_PATHNAME_MAX);
 	buffer.length = ACPI_PATHNAME_MAX;
 	buffer.pointer = pathname;
#18 lore raw
In reply to Pavel Machek
Quoted 22 lines · Pavel Machek

Hi!

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

a generic ACPI driver that exports the _BCL and _BCM method implementations via that same interface, so that systems providing that will "just work". drivers/acpi/video.c currently exports this via /proc/acpi/video/$DEVICE/brightness, which isn't the same as /sys/class/backlight. :-(

Yes, I'm working on acpi video driver transition , and have posted a patch to user backlight for acpi video driver.
http://marc.theaimsgroup.com/?l=linux-acpi&m=115574087203605&w=2

Quoted 5 lines

Just updated the backlight and output sysfs support for ACPI Video driver on bugzilla. If you are interested this, please take a look at
http://bugzilla.kernel.org/show_bug.cgi?id=5749#c18

[patch 1/3] vidoe sysfs support: Add dev argument for baclight sys dev

Two typos in one line :-).

Quoted 1 line

[patch 2/3] Add display output class support

Quoted 7 lines

I guess this needs Documentation/ so we can tell if user<->kernel interface is sane..

Quoted 1 line

[patch 3/3] backlight and output sysfs support for acpi video driver

Some whitespace is not okay there...
Pavel

updated version.
[patch 1/4] video sysfs support: Add dev argument for backlight sys dev

 drivers/video/backlight/backlight.c |    3 ++-
 include/linux/backlight.h           |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

[patch 2/4] Add display output class support

 drivers/video/output.c |  110 
+++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/output.h |   23 ++++++++++
 2 files changed, 133 insertions(+)

[patch 3/4] backlight and output sysfs support for acpi video driver

 acpi/Kconfig   |    2
 acpi/video.c   |  257 
+++++++++++++++++++++++++++++++++++++++++++++++++++++----
 video/Kconfig  |    8 +
 video/Makefile |    1
 4 files changed, 252 insertions(+), 16 deletions(-)

[patch 4/4] Add output class document

 video-output.txt |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Thanks,
Luming

drivers/video/backlight/backlight.c +2 -1
index 27597c5..1a18cdb 100644
@@ -190,7 +190,7 @@ static int fb_notifier_callback(struct n
  * Creates and registers new backlight class_device. Returns either an
  * ERR_PTR() or a pointer to the newly allocated device.
  */
-struct backlight_device *backlight_device_register(const char *name, void *devdata,
+struct backlight_device *backlight_device_register(const char *name,struct device *dev,  void *devdata,
 						   struct backlight_properties *bp)
 {
 	int i, rc;
@@ -206,6 +206,7 @@ struct backlight_device *backlight_devic
 	new_bd->props = bp;
 	memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
 	new_bd->class_dev.class = &backlight_class;
+	new_bd->class_dev.dev = dev;
 	strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN);
 	class_set_devdata(&new_bd->class_dev, devdata);
 
include/linux/backlight.h +1 -1
index 75e91f5..de8e056 100644
@@ -54,7 +54,7 @@ struct backlight_device {
 };
 
 extern struct backlight_device *backlight_device_register(const char *name,
-	void *devdata, struct backlight_properties *bp);
+	struct device *dev, void *devdata, struct backlight_properties *bp);
 extern void backlight_device_unregister(struct backlight_device *bd);
 
 #define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)
drivers/video/output.c new file +110 -0

110 lines not on this page · raw message

include/linux/output.h new file +23 -0
new file mode 100644
index 0000000..f4eb12c
@@ -0,0 +1,23 @@
+#ifndef _LINUX_OUTPUT_H
+#define _LINUX_OUTPUT_H
+
+#include <linux/device.h>
+
+struct output_device;
+
+struct output_properties {
+	int (*set_state)(struct output_device *);
+	int (*get_status)(struct output_device *);
+};
+
+struct output_device {
+	int request_state;
+	struct output_properties *props;
+	struct class_device class_dev;
+};
+
+#define to_output_device(obj) container_of(obj, struct output_device, class_dev)
+
+struct output_device *video_output_register(const char *, struct device *dev, void *, struct output_properties *);
+void video_output_unregister(struct output_device *);
+#endif
Documentation/video-output.txt new file +27 -0
new file mode 100644
index 0000000..43cc0e2
@@ -0,0 +1,27 @@
+The output sysfs class driver is to provide video output abstract layer that can be used to hook platform specific methods to enable/disable video output device through common sysfs interface.
+
+For example, on my IBM Thinkpad T42 laptop, acpi video driver registered its output devices and read/write method for state with output sysfs class. The user interface under sysfs is :
+
+linux:/sys/class/video_output # tree .
+.
+|-- CRT0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+|-- DVI0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+|-- LCD0
+|   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+|   |-- state
+|   |-- subsystem -> ../../../class/video_output
+|   `-- uevent
+`-- TV0
+   |-- device -> ../../../devices/pci0000:00/0000:00:01.0
+   |-- state
+   |-- subsystem -> ../../../class/video_output
+   `-- uevent
+
drivers/acpi/Kconfig +1 -1
index 0f9d4be..a7671f7 100644
@@ -106,7 +106,7 @@ config ACPI_BUTTON
 
 config ACPI_VIDEO
 	tristate "Video"
-	depends on X86
+	depends on X86 && (BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL)
 	help
 	  This driver implement the ACPI Extensions For Display Adapters
 	  for integrated graphics devices on motherboard, as specified in
drivers/acpi/video.c +242 -15

406 lines not on this page · raw message

drivers/video/Kconfig +8 -0
index 7a43020..3b51742 100644
@@ -1644,5 +1644,13 @@ if SYSFS
 	source "drivers/video/backlight/Kconfig"
 endif
 
+
+config VIDEO_OUTPUT_CONTROL
+	tristate "video output device switch control"
+	depends on SYSFS
+	---help---
+	  sysfs support for video output device switching.
+
+
 endmenu
 
drivers/video/Makefile +1 -0
index a6980e9..0f82eed 100644
@@ -108,3 +108,4 @@ obj-$(CONFIG_FB_OF)               += off
 
 # the test framebuffer is last
 obj-$(CONFIG_FB_VIRTUAL)          += vfb.o
+obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o
#19 lore raw
In reply to Yu Luming
Quoted 2 lines · Yu Luming
Quoted 1 line

From my understanding, a cute userspace App shouldn't have this kind

of logic:

(snip switching on hardware type)

Quoted 2 lines

It should be:
just write/read file in /sys/class/backlight ,....

Yup, but to do that on Dell hardware is basically impossible. It'd be nice if they implemented the ACPI video extension properly for future hardware.

Signature · 1 line
Matthew Garrett | [email protected]
#20 lore raw
Quoted 5 lines · Matthew Garrett
Quoted 2 lines · Yu Luming
Quoted 1 line

From my understanding, a cute userspace App shouldn't have this kind

of logic:

Quoted 8 lines

(snip switching on hardware type)

Quoted 2 lines

It should be:
just write/read file in /sys/class/backlight ,....

Yup, but to do that on Dell hardware is basically impossible. It'd be nice if they implemented the ACPI video extension properly for future hardware.

Yes, our BIOS teams are looking to do exactly that. I wouldn't expect such a change to be propogated back to earlier released systems though.

Signature · 4 lines
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
#21 lore raw
Quoted 2 lines · Matt Domsch

Yes, our BIOS teams are looking to do exactly that. I wouldn't expect such a change to be propogated back to earlier released systems though.

That's great news. I accept that it's impractical to port back to earlier hardware, but it means it'll stop being a problem eventually.

(Entirely unrelatedly, have you got any idea why several D-series Latitudes with Intel graphics switch off the backlight on lid close and never switch it back on again? It happens under Windows if you boot in safe mode, so it's not Linux specific...)

Signature · 1 line
Matthew Garrett | [email protected]
#22 lore raw
In reply to Matt Domsch
Quoted 2 lines

Yes, our BIOS teams are looking to do exactly that. I wouldn't expect such a change to be propogated back to earlier released systems though.

Wow! This is a really good news! Please just notify me when it ready. Because, I'd like to have one. :-)

Thanks,
Luming

#23 lore raw
In reply to Matthew Garrett
Quoted 5 lines · Matthew Garrett
Quoted 2 lines · Yu Luming
Quoted 1 line

From my understanding, a cute userspace App shouldn't have this kind

of logic:

Quoted 8 lines

(snip switching on hardware type)

Quoted 2 lines

It should be:
just write/read file in /sys/class/backlight ,....

Yup, but to do that on Dell hardware is basically impossible. It'd be nice if they implemented the ACPI video extension properly for future hardware.

it'd also be nice if the linux-ready firmware developer kit had a test for this, so that we can offer 1) a way to test this to the bios guys and 2) encourage adding/note the lack easily

Quoted 1 line
Signature · 1 line
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
#24 lore raw
Quoted 3 lines · Arjan van de Ven

it'd also be nice if the linux-ready firmware developer kit had a test for this, so that we can offer 1) a way to test this to the bios guys and 2) encourage adding/note the lack easily

Sure. Reading /proc/acpi/video/*/*/info should tell you whether a device is an LCD or not. The brightness file should then contain a list of available brightnesses, and writing one into there should change the screen value. There's a patch somewhere that ports this to the /sys/class/backlight infrastructure, but I don't think it's applied yet.

I'd write a test up for you, but I don't actually seem to have any hardware that implements this properly. Tch.

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

11 Eki 2006 Çar 10:04 tarihinde, Matthew Garrett şunları yazmıştı:

Quoted 7 lines · Arjan van de Ven
Quoted 3 lines

it'd also be nice if the linux-ready firmware developer kit had a test for this, so that we can offer 1) a way to test this to the bios guys and 2) encourage adding/note the lack easily

Sure. Reading /proc/acpi/video/*/*/info should tell you whether a device is an LCD or not.

On my Sony Vaio with latest linux-2.6 git kernel it says its a CRT :

[~]> cat /proc/acpi/video/*/*/info

device_id:    0x0100
type:         CRT
known by bios: no
device_id:    0x0320
type:         UNKNOWN
known by bios: no
device_id:    0x0410
type:         UNKNOWN
known by bios: no
device_id:    0x0240
type:         UNKNOWN
known by bios: no
device_id:    0x0100
type:         CRT
known by bios: no
device_id:    0x0111
type:         UNKNOWN
known by bios: no
device_id:    0x0118
type:         UNKNOWN
known by bios: no
device_id:    0x0200
type:         TVOUT
known by bios: no

So I don't think its reliable.

Regards,
ismail
-
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

#26 lore raw
Quoted 3 lines · Ismail Donmez
device_id:    0x0410
type:         UNKNOWN
known by bios: no

This one's an LCD, according to the spec. The id spec was changed slightly in 3.0 of the acpi spec (in a backwards compatible way) - I'd guess that the acpi video driver just hasn't been updated.

Signature · 1 line
Matthew Garrett | [email protected]
#27 lore raw
In reply to Ismail Donmez
Quoted 37 lines · Ismail Donmez

11 Eki 2006 Çar 10:04 tarihinde, Matthew Garrett şunları yazmıştı:

Quoted 7 lines · Arjan van de Ven
Quoted 3 lines

it'd also be nice if the linux-ready firmware developer kit had a test for this, so that we can offer 1) a way to test this to the bios guys and 2) encourage adding/note the lack easily

Sure. Reading /proc/acpi/video/*/*/info should tell you whether a device is an LCD or not.

On my Sony Vaio with latest linux-2.6 git kernel it says its a CRT :

[~]> cat /proc/acpi/video/*/*/info

device_id:    0x0100
type:         CRT
known by bios: no
device_id:    0x0320
type:         UNKNOWN
known by bios: no
device_id:    0x0410
type:         UNKNOWN
known by bios: no
device_id:    0x0240
type:         UNKNOWN
known by bios: no
device_id:    0x0100
type:         CRT
known by bios: no
device_id:    0x0111
type:         UNKNOWN
known by bios: no
device_id:    0x0118
type:         UNKNOWN
known by bios: no
device_id:    0x0200
type:         TVOUT
known by bios: no
Quoted 1 line

So I don't think its reliable.

Please open a bug on bugzilla.kernel.org,
and post acpidump output.

Thanks,
Luming

#29 lore raw
In reply to Andrew Morton
Quoted 7 lines · Andrew Morton
Quoted 3 lines · On Sat, 30 Sep 2006 19:08:10 +0200 Alessandro Guido…

Make the sony_acpi use the backlight subsystem to adjust brightness value instead of using the /proc/sony/brightness file.
(Other settings will still have a /proc/sony/... entry)

Quoted 5 lines

umm, OK, but now how do I adjust my screen brightness? ;)

I assume that cute userspace applications for controlling backlight brightness via the generic backlight driver either exist or are in progress? What is the status of that?

Most applications use HAL as a backend for display brightness these days. HAL still supports the old interface in /proc for the different brightness drivers, though, but the conversion to the new interface is on my TODO and I will do it this week. So userspace should have fixed this soon, so go ahead ;-)

Btw, there's a patchset from Matthew Garrett [1] sent some time ago which also converts the asus_acpi, ibm_acpi and the toshiba_acpi drivers.

Regards,
Holger

[1] http://lkml.org/lkml/2006/4/18/28

#30 lore raw
In reply to Andrew Morton
Quoted 7 lines · On Sun, 1 Oct 2006 17:19:12 -0700 Andrew Morton <[email protected]> wrote:

umm, OK, but now how do I adjust my screen brightness? ;)

I assume that cute userspace applications for controlling backlight brightness via the generic backlight driver either exist or are in progress? What is the status of that?

I use this tool: http://www.xs4all.nl/~bsamwel/laptop_mode/tools/
that automagically fires up whenever needed

$ cat /etc/laptop-mode/batt-start/brightness 
#!/bin/sh
echo -n CHOOSE_A_LOW_VALUE > /sys/class/backlight/sony/brightness

and

$ cat /etc/laptop-mode/batt-stop/brightness 
#!/bin/sh
let val="`</proc/acpi/sony/brightness_default` - 1"
echo -n "$val" > /sys/class/backlight/sony/brightness

But I seldom use my laptop in battery mode.

Quoted 4 lines

I assume that cute userspace applications for controlling backlight brightness via the generic backlight driver either exist or are in progress? What is the status of that?

I think the new gnome-power-manager does it, but I'm not sure since I use Xfce.

Quoted 1 line

Thanks.

Thank you.

#31 lore raw
Quoted 6 lines

I use this tool: http://www.xs4all.nl/~bsamwel/laptop_mode/tools/
that automagically fires up whenever needed

$ cat /etc/laptop-mode/batt-start/brightness
#!/bin/sh
echo -n CHOOSE_A_LOW_VALUE > /sys/class/backlight/sony/brightness

Also, we need to make hot-key events have similar handling code . For example, Fn+F5 and Fn+F6 are brightness down and up key on my sony laptop. There is a driver called sonypi.c can map Fn+F5/F6 to KEY_FN_F5/F6. But I think It should be mapped to KEY_BRIGHTNESSDOWN/UP (linux/input.h) Although, sonypi.c is NOT so clean, but , if it can report right event to input layer for all sony laptop(it works for me), and all related functions can be controlled through generic sysfs interface, then I would say sony has the best hot-key solution I have even seen so far for linux.

Thanks,
Luming.

#32 lore raw
Quoted 1 line · Yu Luming

It should be mapped to KEY_BRIGHTNESSDOWN/UP (linux/input.h)

Completely agree. Then userspace (like gnome-power-manager or powersaved) can change the brightness based on policy and user-lockdown.

Richard.

#33 lore raw
In reply to Yu Luming
Quoted 8 lines · Yu Luming

Also, we need to make hot-key events have similar handling code . For example, Fn+F5 and Fn+F6 are brightness down and up key on my sony laptop. There is a driver called sonypi.c can map Fn+F5/F6 to KEY_FN_F5/F6. But I think It should be mapped to KEY_BRIGHTNESSDOWN/UP (linux/input.h) Although, sonypi.c is NOT so clean, but , if it can report right event to input layer for all sony laptop(it works for me), and all related functions can be controlled through generic sysfs interface, then I would say sony has the best hot-key solution I have even seen so far for linux.

It would have to be DMI-based to some extent - not all Sonys use the same keys for the same purpose. Misery ensues.

Signature · 1 line
Matthew Garrett | [email protected]
#34 lore raw
Quoted 11 lines · Matthew Garrett
Quoted 8 lines · Yu Luming

Also, we need to make hot-key events have similar handling code . For example, Fn+F5 and Fn+F6 are brightness down and up key on my sony laptop. There is a driver called sonypi.c can map Fn+F5/F6 to KEY_FN_F5/F6. But I think It should be mapped to KEY_BRIGHTNESSDOWN/UP (linux/input.h) Although, sonypi.c is NOT so clean, but , if it can report right event to input layer for all sony laptop(it works for me), and all related functions can be controlled through generic sysfs interface, then I would say sony has the best hot-key solution I have even seen so far for linux.

Quoted 3 lines

It would have to be DMI-based to some extent - not all Sonys use the same keys for the same purpose. Misery ensues.

Then we need to add keymap table to the sonypi's input device so that keymap can be changed from userspace.

Signature · 1 line
Dmitry
#35 lore raw
Quoted 5 lines
Quoted 2 lines

It would have to be DMI-based to some extent - not all Sonys use the same keys for the same purpose. Misery ensues.

Then we need to add keymap table to the sonypi's input device so that keymap can be changed from userspace.

If some key is physically broken, I agree configurable keymap is the only solution. But, I don't see any other benefit of doing so, if we expect platform specific driver report meaningful key code to input layer.

Thanks,
Luming

#36 lore raw
Quoted 9 lines · Yu Luming
Quoted 5 lines
Quoted 2 lines

It would have to be DMI-based to some extent - not all Sonys use the same keys for the same purpose. Misery ensues.

Then we need to add keymap table to the sonypi's input device so that keymap can be changed from userspace.

If some key is physically broken, I agree configurable keymap is the only solution. But, I don't see any other benefit of doing so, if we expect platform specific driver report meaningful key code to input layer.

As Matthew said different Sony models use different mapping. DMI-based keymap solution requires kernel upgrade every time new model is out whereas configurable keymap can be loaded easily form userspace. Also user might want to remap keys to do different stuff. For example I never change brigtness on my laptop now that I found settings that I like. So I could map one key to start kmail and another one to build kernel for example ;)

Signature · 1 line
Dmitry