All of lore.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <len.brown@intel.com>
To: linux-acpi@vger.kernel.org
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
	Len Brown <len.brown@intel.com>
Subject: [PATCH 076/105] ACPI: thinkpad-acpi: update brightness sysfs interface support
Date: Sun, 29 Apr 2007 00:51:16 -0400	[thread overview]
Message-ID: <11778223741-git-send-email-len.brown@intel.com> (raw)
Message-ID: <7d5a015eece8be9186d3613d595643a520555e33.1177822058.git.len.brown@intel.com> (raw)
In-Reply-To: <11778223733679-git-send-email-len.brown@intel.com>
In-Reply-To: <ac122bb64b0d51f0512185d3522a75f3f3a80bc9.1177822058.git.len.brown@intel.com>

From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>

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>
---
 Documentation/thinkpad-acpi.txt |   52 ++++++++++++++++++++++++++++++++++----
 drivers/misc/thinkpad_acpi.c    |    5 ++-
 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 352e8ae..eab4997 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
 with this, do send me your results (including some complete dumps with
 a description of the conditions when they were taken.)
 
-LCD brightness control -- /proc/acpi/ibm/brightness
----------------------------------------------------
+LCD brightness control
+----------------------
+
+procfs: /proc/acpi/ibm/brightness
+sysfs backlight device "thinkpad_screen"
 
 This feature allows software control of the LCD brightness on ThinkPad
-models which don't have a hardware brightness slider. The available
-commands are:
+models which don't have a hardware brightness slider.
+
+It has some limitations: the LCD backlight cannot be actually turned on or off
+by this interface, and in many ThinkPad models, the "dim while on battery"
+functionality will be enabled by the BIOS when this interface is used, and
+cannot be controlled.
+
+The backlight control has eight levels, ranging from 0 to 7.  Some of the
+levels may not be distinct.
+
+Procfs notes:
+
+	The available commands are:
 
 	echo up   >/proc/acpi/ibm/brightness
 	echo down >/proc/acpi/ibm/brightness
 	echo 'level <level>' >/proc/acpi/ibm/brightness
 
-The <level> number range is 0 to 7, although not all of them may be
-distinct. The current brightness level is shown in the file.
+Sysfs notes:
+
+The interface is implemented through the backlight sysfs class, which is poorly
+documented at this time.
+
+Locate the thinkpad_screen device under /sys/class/backlight, and inside it
+there will be the following attributes:
+
+	max_brightness:
+		Reads the maximum brightness the hardware can be set to.
+		The minimum is always zero.
+
+	actual_brightness:
+		Reads what brightness the screen is set to at this instant.
+
+	brightness:
+		Writes request the driver to change brightness to the given
+		value.  Reads will tell you what brightness the driver is trying
+		to set the display to when "power" is set to zero and the display
+		has not been dimmed by a kernel power management event.
+
+	power:
+		power management mode, where 0 is "display on", and 1 to 3 will
+		dim the display backlight to brightness level 0 because
+		thinkpad-acpi cannot really turn the backlight off.  Kernel
+		power management events can temporarily increase the current
+		power management level, i.e. they can dim the display.
+
 
 Volume control -- /proc/acpi/ibm/volume
 ---------------------------------------
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index ba749df..c0a023c 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)
 	if (b < 0)
 		return b;
 
-	ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
-							 &ibm_backlight_data);
+	ibm_backlight_device = backlight_device_register(
+					TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
+					&ibm_backlight_data);
 	if (IS_ERR(ibm_backlight_device)) {
 		printk(IBM_ERR "Could not register backlight device\n");
 		return PTR_ERR(ibm_backlight_device);
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 2fe4d61..8348fc6 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -296,6 +296,8 @@ static int bluetooth_write(char *buf);
  * Brightness (backlight) subdriver
  */
 
+#define TPACPI_BACKLIGHT_DEV_NAME "thinkpad_screen"
+
 static struct backlight_device *ibm_backlight_device;
 static int brightness_offset = 0x31;
 
-- 
1.5.2.rc0.34.gda94

  parent reply	other threads:[~2007-04-29  4:52 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-29  4:50 ACPI patches for 2.6.22 merge window Len Brown
     [not found] ` <11778223068-git-send-email-len.brown@intel.com>
     [not found]   ` <ac122bb64b0d51f0512185d3522a75f3f3a80bc9.1177822058.git.len.brown@intel.com>
2007-04-29  4:50     ` [PATCH 002/105] ACPI: EC: Don't use Global Lock if not asked to do so Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 003/105] ACPI: EC: Make EC to initialize first in ACPI Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 004/105] ACPI: EC: "Fake ECDT" workaround is not needed any longer Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 005/105] ACPI: EC: enable burst functionality in EC Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 006/105] ACPI: EC: Remove casts to/from void* from ec.c Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 007/105] ACPI: EC: Put install handlers into separate function Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 008/105] ACPI: EC: Clean ECDT and namespace parsing Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 009/105] ACPI: EC: Rename ec_ecdt to more informative boot_ec Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 010/105] ACPI: EC: first_ec is better to be acpi_ec than acpi_device Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 011/105] ACPI: EC: Cleanup of EC initialization Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 012/105] ACPI: EC: Block queries until EC is fully initialized Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 013/105] asus-laptop: use acpi_evaluate_integer instead of read_acpi_int Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 014/105] asus-laptop: clean write_status Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 015/105] asus-laptop: add GLED Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 016/105] asus-laptop: add wapf param Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 017/105] asus-laptop: version bump Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 018/105] ACPI: sbs: use EC rather than I2C Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 019/105] ACPI: sbs: remove I2C Kconfig dependency Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 020/105] ACPI: sbs: remove I2C Makefile hooks Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 021/105] ACPI: sbs: Debug messages correction/improvement Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 022/105] ACPI: sbs: Common interface with CM battery Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 023/105] ACPI: sbs: remove i2c_ec.[ch] Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 024/105] ACPI: ibm-acpi: kill trailing whitespace Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 025/105] ACPI: ibm-acpi: rename some identifiers Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 026/105] ACPI: ibm-acpi: add header file Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 027/105] ACPI: ibm-acpi: organize code Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 028/105] ACPI: ibm-acpi: update copyright notice Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 029/105] ACPI: ibm-acpi: update documentation Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 031/105] ACPI: dock: use NULL for pointer Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 033/105] ACPI: thinkpad-acpi: cleanup Kconfig for thinkpad-acpi Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 034/105] ACPI: thinkpad-acpi: add compatibility MODULE_ALIAS entry Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 035/105] ACPI: thinkpad-acpi: cleanup after rename Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 036/105] ACPI: thinkpad-acpi: update MAINTAINERS Len Brown
2007-04-29  4:50       ` Len Brown
     [not found]         ` <11778223411658-git-send-email-len.brown@intel.com>
     [not found]           ` <11778223412672-git-send-email-len.brown@intel.com>
     [not found]             ` <11778223423-git-send-email-len.brown@intel.com>
     [not found]               ` <1177822343712-git-send-email-len.brown@intel.com>
     [not found]                 ` <11778223442065-git-send-email-len.brown@intel.com>
     [not found]                   ` <11778223452843-git-send-email-len.brown@intel.com>
     [not found]                     ` <11778223461282-git-send-email-len.brown@intel.com>
     [not found]                       ` <11778223472316-git-send-email-len.brown@intel.com>
2007-04-29  4:50     ` [PATCH 046/105] ACPI: thinkpad-acpi: rename register_ibmacpi_subdriver Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 047/105] ACPI: thinkpad-acpi: rename one stray use of ibm-acpi in a comment Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 048/105] ACPI: thinkpad-acpi: rename module glue Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 049/105] ACPI: thinkpad-acpi: rename thinkpad constants Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 050/105] ACPI: thinkpad-acpi: update fan firmware documentation Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 051/105] ACPI: thinkpad-acpi: add debug mode Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 052/105] ACPI: thinkpad-acpi: clean up probing and move init to subdrivers Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 053/105] ACPI: thinkpad-acpi: add subdriver debug statements Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 054/105] ACPI: thinkpad-acpi: uncouple subdriver init from ibms struct Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 055/105] ACPI: thinkpad-acpi: improve thinkpad detection Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 056/105] ACPI: thinkpad-acpi: use bitfields to hold subdriver flags Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 057/105] ACPI: thinkpad-acpi: use bitfields for module flags Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 058/105] ACPI: thinkpad-acpi: prepare for device model conversion Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:50     ` [PATCH 059/105] ACPI: thinkpad-acpi: mark acpi helper functions __must_check Len Brown
2007-04-29  4:50       ` Len Brown
2007-04-29  4:51     ` [PATCH 060/105] ACPI: thinkpad-acpi: clean up hotkey subdriver Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 061/105] ACPI: thinkpad-acpi: cleanup bluetooth and wan for sysfs conversion Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 062/105] ACPI: thinkpad-acpi: cleanup video subdriver Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 063/105] ACPI: thinkpad-acpi: clean up CMOS commands subdriver Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 064/105] ACPI: thinkpad-acpi: cleanup thermal subdriver for sysfs conversion Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 065/105] ACPI: thinkpad-acpi: improve fan watchdog messages Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 066/105] ACPI: Disable MSI on request of FADT Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 067/105] ACPI: Improve acpi debug documentation Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 068/105] ACPI: thinkpad-acpi: register with the device model Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 069/105] ACPI: thinkpad-acpi: driver sysfs conversion Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 070/105] ACPI: thinkpad-acpi: add infrastructure for the sysfs device attributes Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 071/105] ACPI: thinkpad-acpi: protect fan and hotkey data structures Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 072/105] ACPI: thinkpad-acpi: add sysfs support to the thermal subdriver Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 073/105] ACPI: thinkpad-acpi: add sysfs support to fan subdriver Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 074/105] ACPI: thinkpad-acpi: add a safety net for TPEC fan control mode Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 075/105] ACPI: thinkpad-acpi: add sysfs support to the cmos command subdriver Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` Len Brown [this message]
2007-04-29  4:51       ` [PATCH 076/105] ACPI: thinkpad-acpi: update brightness sysfs interface support Len Brown
2007-04-29  4:51     ` [PATCH 077/105] ACPI: remove duplicate include Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 078/105] ACPI: Remove duplicate definitions for _STA bits Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 079/105] ACPI: use _STA bit names rather than 0x0F Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 080/105] ACPI: correct pathname in comment Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 081/105] ACPI: word-smith kconfig help Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 082/105] ACPI: make /proc/acpi/wakeup more useful Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 083/105] ACPI: prevent ACPI quirk warning mass spamming in logs Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  9:58         ` Andi Kleen
2007-04-29  4:51     ` [PATCH 084/105] ACPI: Remove a warning about unused variable in !CONFIG_ACPI compilation Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  9:59         ` Andi Kleen
2007-04-29  4:51     ` [PATCH 085/105] ACPICA: clear fields reserved before FADT r3 Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 086/105] ACPI: thinkpad-acpi: add a fan-control feature master toggle Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 087/105] ACPI: thinkpad-acpi: do not arm fan watchdog if it would not work Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 088/105] ACPI: thinkpad-acpi: fix a fan watchdog invocation Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 089/105] ACPI: thinkpad-acpi: map ENXIO to EINVAL for fan sysfs Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 090/105] ACPI: thinkpad-acpi: improve fan control documentation Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 091/105] ACPI: thinkpad-acpi: improve debugging for acpi helpers Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 092/105] ACPI: thinkpad-acpi: improve dock subdriver initialization Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 093/105] ACPI: thinkpad-acpi: add sysfs support to hotkey subdriver Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 094/105] ACPI: thinkpad-acpi: add sysfs support to wan and bluetooth subdrivers Len Brown
2007-04-29  4:51       ` Len Brown
2007-04-29  4:51     ` [PATCH 095/105] thinkpad-acpi: make drivers/misc/thinkpad_acpi:fan_mutex static Len Brown
2007-04-29  4:51       ` Len Brown
     [not found]         ` <11778223931192-git-send-email-len.brown@intel.com>
     [not found]           ` <11778223942367-git-send-email-len.brown@intel.com>
     [not found]             ` <11778223942377-git-send-email-len.brown@intel.com>
     [not found]               ` <1177822395384-git-send-email-len.brown@intel.com>
     [not found]                 ` <11778223963095-git-send-email-len.brown@intel.com>
     [not found]                   ` <11778223972558-git-send-email-len.brown@intel.com>
     [not found]                     ` <11778223981263-git-send-email-len.brown@intel.com>
     [not found]                       ` <117782239917-git-send-email-len.brown@intel.com>
2007-04-29  4:51     ` [PATCH 105/105] sonypi: use mutex instead of semaphore Len Brown
2007-04-29  4:51       ` Len Brown
2007-05-01  2:19 ` ACPI patches for 2.6.22 merge window Mattia Dongili
2007-05-10  6:44   ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11778223741-git-send-email-len.brown@intel.com \
    --to=len.brown@intel.com \
    --cc=hmh@hmh.eng.br \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.