aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/thinkpad-acpi.txt8
-rw-r--r--drivers/misc/thinkpad_acpi.c39
2 files changed, 45 insertions, 2 deletions
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index f877c13c5ef8..bb1c7a60b9bb 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -942,11 +942,15 @@ and CMOS. The driver tries to autodetect which interface to use.
942 942
943When display backlight brightness controls are available through the 943When display backlight brightness controls are available through the
944standard ACPI interface, it is best to use it instead of this direct 944standard ACPI interface, it is best to use it instead of this direct
945ThinkPad-specific interface. 945ThinkPad-specific interface. The driver will disable its native
946backlight brightness control interface if it detects that the standard
947ACPI interface is available in the ThinkPad.
946 948
947The brightness_enable module parameter can be used to control whether 949The brightness_enable module parameter can be used to control whether
948the LCD brightness control feature will be enabled when available. 950the LCD brightness control feature will be enabled when available.
949brightness_enable=0 forces it to be disabled. 951brightness_enable=0 forces it to be disabled. brightness_enable=1
952forces it to be enabled when available, even if the standard ACPI
953interface is also available.
950 954
951Procfs notes: 955Procfs notes:
952 956
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 56a21e6b80a9..109bd2750439 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -3174,6 +3174,39 @@ static int __init brightness_check_levels(void)
3174 return (ACPI_SUCCESS(status) && found_node != NULL); 3174 return (ACPI_SUCCESS(status) && found_node != NULL);
3175} 3175}
3176 3176
3177static acpi_status __init brightness_find_bcl(acpi_handle handle, u32 lvl,
3178 void *context, void **rv)
3179{
3180 char name[ACPI_PATH_SEGMENT_LENGTH];
3181 struct acpi_buffer buffer = { sizeof(name), &name };
3182
3183 if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) &&
3184 !strncmp("_BCL", name, sizeof(name) - 1)) {
3185 *rv = handle;
3186 return AE_CTRL_TERMINATE;
3187 } else {
3188 return AE_OK;
3189 }
3190}
3191
3192static int __init brightness_check_std_acpi_support(void)
3193{
3194 int status;
3195 void *found_node = NULL;
3196
3197 if (!vid_handle) {
3198 IBM_ACPIHANDLE_INIT(vid);
3199 }
3200 if (!vid_handle)
3201 return 0;
3202
3203 /* Search for a _BCL method, but don't execute it */
3204 status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3,
3205 brightness_find_bcl, NULL, &found_node);
3206
3207 return (ACPI_SUCCESS(status) && found_node != NULL);
3208}
3209
3177static int __init brightness_init(struct ibm_init_struct *iibm) 3210static int __init brightness_init(struct ibm_init_struct *iibm)
3178{ 3211{
3179 int b; 3212 int b;
@@ -3186,6 +3219,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
3186 dbg_printk(TPACPI_DBG_INIT, 3219 dbg_printk(TPACPI_DBG_INIT,
3187 "brightness support disabled by module parameter\n"); 3220 "brightness support disabled by module parameter\n");
3188 return 1; 3221 return 1;
3222 } else if (brightness_enable > 1) {
3223 if (brightness_check_std_acpi_support()) {
3224 printk(IBM_NOTICE
3225 "standard ACPI backlight interface available, not loading native one...\n");
3226 return 1;
3227 }
3189 } 3228 }
3190 3229
3191 if (!brightness_mode) { 3230 if (!brightness_mode) {