diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2007-04-24 10:48:20 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-04-25 02:00:27 -0400 |
commit | 7d5a015eece8be9186d3613d595643a520555e33 (patch) | |
tree | 7ce09f4b768e2d471daa6a26ef7336965972004f | |
parent | b616004c70dd7f60a1477c3e9d6fddd00ee1fa37 (diff) |
ACPI: thinkpad-acpi: update brightness sysfs interface support
Update the brightness sysfs interface (done through the backlight class) to
be in line with the rest of the thinkpad-acpi driver.
This renames the incorrect, un-obvious, and clash-prone name of "ibm" for
the backlight device to a much more fitting and descriptive
"thinkpad_screen". This is something I wanted to do for quite a while...
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | Documentation/thinkpad-acpi.txt | 52 | ||||
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 5 | ||||
-rw-r--r-- | drivers/misc/thinkpad_acpi.h | 2 |
3 files changed, 51 insertions, 8 deletions
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt index 352e8aee63fe..eab4997efc0f 100644 --- a/Documentation/thinkpad-acpi.txt +++ b/Documentation/thinkpad-acpi.txt | |||
@@ -611,19 +611,59 @@ registers contain the current battery capacity, etc. If you experiment | |||
611 | with this, do send me your results (including some complete dumps with | 611 | with this, do send me your results (including some complete dumps with |
612 | a description of the conditions when they were taken.) | 612 | a description of the conditions when they were taken.) |
613 | 613 | ||
614 | LCD brightness control -- /proc/acpi/ibm/brightness | 614 | LCD brightness control |
615 | --------------------------------------------------- | 615 | ---------------------- |
616 | |||
617 | procfs: /proc/acpi/ibm/brightness | ||
618 | sysfs backlight device "thinkpad_screen" | ||
616 | 619 | ||
617 | This feature allows software control of the LCD brightness on ThinkPad | 620 | This feature allows software control of the LCD brightness on ThinkPad |
618 | models which don't have a hardware brightness slider. The available | 621 | models which don't have a hardware brightness slider. |
619 | commands are: | 622 | |
623 | It has some limitations: the LCD backlight cannot be actually turned on or off | ||
624 | by this interface, and in many ThinkPad models, the "dim while on battery" | ||
625 | functionality will be enabled by the BIOS when this interface is used, and | ||
626 | cannot be controlled. | ||
627 | |||
628 | The backlight control has eight levels, ranging from 0 to 7. Some of the | ||
629 | levels may not be distinct. | ||
630 | |||
631 | Procfs notes: | ||
632 | |||
633 | The available commands are: | ||
620 | 634 | ||
621 | echo up >/proc/acpi/ibm/brightness | 635 | echo up >/proc/acpi/ibm/brightness |
622 | echo down >/proc/acpi/ibm/brightness | 636 | echo down >/proc/acpi/ibm/brightness |
623 | echo 'level <level>' >/proc/acpi/ibm/brightness | 637 | echo 'level <level>' >/proc/acpi/ibm/brightness |
624 | 638 | ||
625 | The <level> number range is 0 to 7, although not all of them may be | 639 | Sysfs notes: |
626 | distinct. The current brightness level is shown in the file. | 640 | |
641 | The interface is implemented through the backlight sysfs class, which is poorly | ||
642 | documented at this time. | ||
643 | |||
644 | Locate the thinkpad_screen device under /sys/class/backlight, and inside it | ||
645 | there will be the following attributes: | ||
646 | |||
647 | max_brightness: | ||
648 | Reads the maximum brightness the hardware can be set to. | ||
649 | The minimum is always zero. | ||
650 | |||
651 | actual_brightness: | ||
652 | Reads what brightness the screen is set to at this instant. | ||
653 | |||
654 | brightness: | ||
655 | Writes request the driver to change brightness to the given | ||
656 | value. Reads will tell you what brightness the driver is trying | ||
657 | to set the display to when "power" is set to zero and the display | ||
658 | has not been dimmed by a kernel power management event. | ||
659 | |||
660 | power: | ||
661 | power management mode, where 0 is "display on", and 1 to 3 will | ||
662 | dim the display backlight to brightness level 0 because | ||
663 | thinkpad-acpi cannot really turn the backlight off. Kernel | ||
664 | power management events can temporarily increase the current | ||
665 | power management level, i.e. they can dim the display. | ||
666 | |||
627 | 667 | ||
628 | Volume control -- /proc/acpi/ibm/volume | 668 | Volume control -- /proc/acpi/ibm/volume |
629 | --------------------------------------- | 669 | --------------------------------------- |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index ba749df189ab..c0a023cc5ded 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -2414,8 +2414,9 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
2414 | if (b < 0) | 2414 | if (b < 0) |
2415 | return b; | 2415 | return b; |
2416 | 2416 | ||
2417 | ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, | 2417 | ibm_backlight_device = backlight_device_register( |
2418 | &ibm_backlight_data); | 2418 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, |
2419 | &ibm_backlight_data); | ||
2419 | if (IS_ERR(ibm_backlight_device)) { | 2420 | if (IS_ERR(ibm_backlight_device)) { |
2420 | printk(IBM_ERR "Could not register backlight device\n"); | 2421 | printk(IBM_ERR "Could not register backlight device\n"); |
2421 | return PTR_ERR(ibm_backlight_device); | 2422 | return PTR_ERR(ibm_backlight_device); |
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index 2fe4d61cc27f..8348fc653009 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
@@ -296,6 +296,8 @@ static int bluetooth_write(char *buf); | |||
296 | * Brightness (backlight) subdriver | 296 | * Brightness (backlight) subdriver |
297 | */ | 297 | */ |
298 | 298 | ||
299 | #define TPACPI_BACKLIGHT_DEV_NAME "thinkpad_screen" | ||
300 | |||
299 | static struct backlight_device *ibm_backlight_device; | 301 | static struct backlight_device *ibm_backlight_device; |
300 | static int brightness_offset = 0x31; | 302 | static int brightness_offset = 0x31; |
301 | 303 | ||