Commit 217f09631a420295a9688e18aa4dbad1b385e56c

Authored by Henrique de Moraes Holschuh
Committed by Matthew Garrett
1 parent 122f26726b

thinkpad-acpi: untangle ACPI/vendor backlight selection

acpi_video_backlight_support() already tells us if ACPI is handling
backlight control through the generic ACPI handle.  It is better to just
trust it.

While at it, adjust down a printk priority, and test earlier for
brightness_enable=0.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>

Showing 2 changed files with 24 additions and 22 deletions Side-by-side Diff

Documentation/laptops/thinkpad-acpi.txt
... ... @@ -1024,6 +1024,10 @@
1024 1024 backlight brightness control interface if it detects that the standard
1025 1025 ACPI interface is available in the ThinkPad.
1026 1026  
  1027 +If you want to use the thinkpad-acpi backlight brightness control
  1028 +instead of the generic ACPI video backlight brightness control for some
  1029 +reason, you should use the acpi_backlight=vendor kernel parameter.
  1030 +
1027 1031 The brightness_enable module parameter can be used to control whether
1028 1032 the LCD brightness control feature will be enabled when available.
1029 1033 brightness_enable=0 forces it to be disabled. brightness_enable=1
drivers/platform/x86/thinkpad_acpi.c
... ... @@ -6216,33 +6216,31 @@
6216 6216 if (tp_features.bright_unkfw)
6217 6217 return 1;
6218 6218  
6219   - if (tp_features.bright_acpimode) {
6220   - if (acpi_video_backlight_support()) {
6221   - if (brightness_enable > 1) {
6222   - printk(TPACPI_NOTICE
6223   - "Standard ACPI backlight interface "
6224   - "available, not loading native one.\n");
6225   - return 1;
6226   - } else if (brightness_enable == 1) {
6227   - printk(TPACPI_NOTICE
6228   - "Backlight control force enabled, even if standard "
6229   - "ACPI backlight interface is available\n");
6230   - }
6231   - } else {
6232   - if (brightness_enable > 1) {
6233   - printk(TPACPI_NOTICE
6234   - "Standard ACPI backlight interface not "
6235   - "available, thinkpad_acpi native "
6236   - "brightness control enabled\n");
6237   - }
6238   - }
6239   - }
6240   -
6241 6219 if (!brightness_enable) {
6242 6220 dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT,
6243 6221 "brightness support disabled by "
6244 6222 "module parameter\n");
6245 6223 return 1;
  6224 + }
  6225 +
  6226 + if (acpi_video_backlight_support()) {
  6227 + if (brightness_enable > 1) {
  6228 + printk(TPACPI_INFO
  6229 + "Standard ACPI backlight interface "
  6230 + "available, not loading native one.\n");
  6231 + return 1;
  6232 + } else if (brightness_enable == 1) {
  6233 + printk(TPACPI_WARN
  6234 + "Cannot enable backlight brightness support, "
  6235 + "ACPI is already handling it. Refer to the "
  6236 + "acpi_backlight kernel parameter\n");
  6237 + return 1;
  6238 + }
  6239 + } else if (tp_features.bright_acpimode && brightness_enable > 1) {
  6240 + printk(TPACPI_NOTICE
  6241 + "Standard ACPI backlight interface not "
  6242 + "available, thinkpad_acpi native "
  6243 + "brightness control enabled\n");
6246 6244 }
6247 6245  
6248 6246 /*