Commit 4def8a36 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'acpi-video'

* acpi-video: (38 commits)
  ACPI / video: Make acpi_video_unregister_backlight() private
  acpi-video-detect: Remove old API
  toshiba-acpi: Port to new backlight interface selection API
  thinkpad-acpi: Port to new backlight interface selection API
  sony-laptop: Port to new backlight interface selection API
  samsung-laptop: Port to new backlight interface selection API
  msi-wmi: Port to new backlight interface selection API
  msi-laptop: Port to new backlight interface selection API
  intel-oaktrail: Port to new backlight interface selection API
  ideapad-laptop: Port to new backlight interface selection API
  fujitsu-laptop: Port to new backlight interface selection API
  eeepc-laptop: Port to new backlight interface selection API
  dell-wmi: Port to new backlight interface selection API
  dell-laptop: Port to new backlight interface selection API
  compal-laptop: Port to new backlight interface selection API
  asus-wmi: Port to new backlight interface selection API
  asus-laptop: Port to new backlight interface selection API
  apple-gmux: Port to new backlight interface selection API
  acer-wmi: Port to new backlight interface selection API
  ACPI / video: Fix acpi_video _register vs _unregister_backlight race
  ...
parents 763d9495 e7d024c0
...@@ -52,9 +52,6 @@ acpi-$(CONFIG_X86) += acpi_cmos_rtc.o ...@@ -52,9 +52,6 @@ acpi-$(CONFIG_X86) += acpi_cmos_rtc.o
acpi-$(CONFIG_DEBUG_FS) += debugfs.o acpi-$(CONFIG_DEBUG_FS) += debugfs.o
acpi-$(CONFIG_ACPI_NUMA) += numa.o acpi-$(CONFIG_ACPI_NUMA) += numa.o
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
ifdef CONFIG_ACPI_VIDEO
acpi-y += video_detect.o
endif
acpi-y += acpi_lpat.o acpi-y += acpi_lpat.o
acpi-$(CONFIG_ACPI_GENERIC_GSI) += gsi.o acpi-$(CONFIG_ACPI_GENERIC_GSI) += gsi.o
...@@ -95,3 +92,5 @@ obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o ...@@ -95,3 +92,5 @@ obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o
obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o
obj-$(CONFIG_CRC_PMIC_OPREGION) += pmic/intel_pmic_crc.o obj-$(CONFIG_CRC_PMIC_OPREGION) += pmic/intel_pmic_crc.o
obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o
video-objs += acpi_video.o video_detect.o
...@@ -183,13 +183,6 @@ static inline int suspend_nvs_save(void) { return 0; } ...@@ -183,13 +183,6 @@ static inline int suspend_nvs_save(void) { return 0; }
static inline void suspend_nvs_restore(void) {} static inline void suspend_nvs_restore(void) {}
#endif #endif
/*--------------------------------------------------------------------------
Video
-------------------------------------------------------------------------- */
#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
bool acpi_osi_is_win8(void);
#endif
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
Device properties Device properties
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
......
...@@ -1680,6 +1680,12 @@ int acpi_resources_are_enforced(void) ...@@ -1680,6 +1680,12 @@ int acpi_resources_are_enforced(void)
} }
EXPORT_SYMBOL(acpi_resources_are_enforced); EXPORT_SYMBOL(acpi_resources_are_enforced);
bool acpi_osi_is_win8(void)
{
return acpi_gbl_osi_data >= ACPI_OSI_WIN_8;
}
EXPORT_SYMBOL(acpi_osi_is_win8);
/* /*
* Deallocate the memory for a spinlock. * Deallocate the memory for a spinlock.
*/ */
......
...@@ -1935,6 +1935,62 @@ bool acpi_dock_match(acpi_handle handle) ...@@ -1935,6 +1935,62 @@ bool acpi_dock_match(acpi_handle handle)
return acpi_has_method(handle, "_DCK"); return acpi_has_method(handle, "_DCK");
} }
static acpi_status
acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
void **return_value)
{
long *cap = context;
if (acpi_has_method(handle, "_BCM") &&
acpi_has_method(handle, "_BCL")) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
"support\n"));
*cap |= ACPI_VIDEO_BACKLIGHT;
if (!acpi_has_method(handle, "_BQC"))
printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
"cannot determine initial brightness\n");
/* We have backlight support, no need to scan further */
return AE_CTRL_TERMINATE;
}
return 0;
}
/* Returns true if the ACPI object is a video device which can be
* handled by video.ko.
* The device will get a Linux specific CID added in scan.c to
* identify the device as an ACPI graphics device
* Be aware that the graphics device may not be physically present
* Use acpi_video_get_capabilities() to detect general ACPI video
* capabilities of present cards
*/
long acpi_is_video_device(acpi_handle handle)
{
long video_caps = 0;
/* Is this device able to support video switching ? */
if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS"))
video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
/* Is this device able to retrieve a video ROM ? */
if (acpi_has_method(handle, "_ROM"))
video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
/* Is this device able to configure which video head to be POSTed ? */
if (acpi_has_method(handle, "_VPO") &&
acpi_has_method(handle, "_GPD") &&
acpi_has_method(handle, "_SPD"))
video_caps |= ACPI_VIDEO_DEVICE_POSTING;
/* Only check for backlight functionality if one of the above hit. */
if (video_caps)
acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL,
&video_caps, NULL);
return video_caps;
}
EXPORT_SYMBOL(acpi_is_video_device);
const char *acpi_device_hid(struct acpi_device *device) const char *acpi_device_hid(struct acpi_device *device)
{ {
struct acpi_hardware_id *hid; struct acpi_hardware_id *hid;
......
...@@ -712,3 +712,18 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs) ...@@ -712,3 +712,18 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs)
return false; return false;
} }
EXPORT_SYMBOL(acpi_check_dsm); EXPORT_SYMBOL(acpi_check_dsm);
/*
* acpi_backlight= handling, this is done here rather then in video_detect.c
* because __setup cannot be used in modules.
*/
char acpi_video_backlight_string[16];
EXPORT_SYMBOL(acpi_video_backlight_string);
static int __init acpi_backlight(char *str)
{
strlcpy(acpi_video_backlight_string, str,
sizeof(acpi_video_backlight_string));
return 1;
}
__setup("acpi_backlight=", acpi_backlight);
This diff is collapsed.
...@@ -396,16 +396,6 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state) ...@@ -396,16 +396,6 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
return -EINVAL; return -EINVAL;
} }
/*
* If the vendor backlight interface is not in use and ACPI backlight interface
* is broken, do not bother processing backlight change requests from firmware.
*/
static bool should_ignore_backlight_request(void)
{
return acpi_video_backlight_support() &&
!acpi_video_verify_backlight_support();
}
static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
...@@ -414,7 +404,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) ...@@ -414,7 +404,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
if (should_ignore_backlight_request()) { if (acpi_video_get_backlight_type() == acpi_backlight_native) {
DRM_DEBUG_KMS("opregion backlight request ignored\n"); DRM_DEBUG_KMS("opregion backlight request ignored\n");
return 0; return 0;
} }
......
...@@ -71,9 +71,10 @@ config ASUS_LAPTOP ...@@ -71,9 +71,10 @@ config ASUS_LAPTOP
depends on ACPI depends on ACPI
select LEDS_CLASS select LEDS_CLASS
select NEW_LEDS select NEW_LEDS
select BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on INPUT depends on INPUT
depends on RFKILL || RFKILL = n depends on RFKILL || RFKILL = n
depends on ACPI_VIDEO || ACPI_VIDEO = n
select INPUT_SPARSEKMAP select INPUT_SPARSEKMAP
select INPUT_POLLDEV select INPUT_POLLDEV
---help--- ---help---
...@@ -95,6 +96,7 @@ config DELL_LAPTOP ...@@ -95,6 +96,7 @@ config DELL_LAPTOP
depends on X86 depends on X86
depends on DCDBAS depends on DCDBAS
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on ACPI_VIDEO || ACPI_VIDEO = n
depends on RFKILL || RFKILL = n depends on RFKILL || RFKILL = n
depends on SERIO_I8042 depends on SERIO_I8042
select POWER_SUPPLY select POWER_SUPPLY
...@@ -109,6 +111,7 @@ config DELL_WMI ...@@ -109,6 +111,7 @@ config DELL_WMI
tristate "Dell WMI extras" tristate "Dell WMI extras"
depends on ACPI_WMI depends on ACPI_WMI
depends on INPUT depends on INPUT
depends on ACPI_VIDEO || ACPI_VIDEO = n
select INPUT_SPARSEKMAP select INPUT_SPARSEKMAP
---help--- ---help---
Say Y here if you want to support WMI-based hotkeys on Dell laptops. Say Y here if you want to support WMI-based hotkeys on Dell laptops.
...@@ -144,6 +147,7 @@ config FUJITSU_LAPTOP ...@@ -144,6 +147,7 @@ config FUJITSU_LAPTOP
depends on ACPI depends on ACPI
depends on INPUT depends on INPUT
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on ACPI_VIDEO || ACPI_VIDEO = n
depends on LEDS_CLASS || LEDS_CLASS=n depends on LEDS_CLASS || LEDS_CLASS=n
---help--- ---help---
This is a driver for laptops built by Fujitsu: This is a driver for laptops built by Fujitsu:
...@@ -247,6 +251,7 @@ config MSI_LAPTOP ...@@ -247,6 +251,7 @@ config MSI_LAPTOP
tristate "MSI Laptop Extras" tristate "MSI Laptop Extras"
depends on ACPI depends on ACPI
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on ACPI_VIDEO || ACPI_VIDEO = n
depends on RFKILL depends on RFKILL
depends on INPUT && SERIO_I8042 depends on INPUT && SERIO_I8042
select INPUT_SPARSEKMAP select INPUT_SPARSEKMAP
...@@ -280,6 +285,7 @@ config COMPAL_LAPTOP ...@@ -280,6 +285,7 @@ config COMPAL_LAPTOP
tristate "Compal (and others) Laptop Extras" tristate "Compal (and others) Laptop Extras"
depends on ACPI depends on ACPI
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on ACPI_VIDEO || ACPI_VIDEO = n
depends on RFKILL depends on RFKILL
depends on HWMON depends on HWMON
depends on POWER_SUPPLY depends on POWER_SUPPLY
...@@ -296,7 +302,8 @@ config COMPAL_LAPTOP ...@@ -296,7 +302,8 @@ config COMPAL_LAPTOP
config SONY_LAPTOP config SONY_LAPTOP
tristate "Sony Laptop Extras" tristate "Sony Laptop Extras"
depends on ACPI depends on ACPI
select BACKLIGHT_CLASS_DEVICE depends on ACPI_VIDEO || ACPI_VIDEO = n
depends on BACKLIGHT_CLASS_DEVICE
depends on INPUT depends on INPUT
depends on RFKILL depends on RFKILL
---help--- ---help---
...@@ -321,6 +328,7 @@ config IDEAPAD_LAPTOP ...@@ -321,6 +328,7 @@ config IDEAPAD_LAPTOP
depends on RFKILL && INPUT depends on RFKILL && INPUT
depends on SERIO_I8042 depends on SERIO_I8042
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on ACPI_VIDEO || ACPI_VIDEO = n
select INPUT_SPARSEKMAP select INPUT_SPARSEKMAP
help help
This is a driver for Lenovo IdeaPad netbooks contains drivers for This is a driver for Lenovo IdeaPad netbooks contains drivers for
...@@ -331,8 +339,8 @@ config THINKPAD_ACPI ...@@ -331,8 +339,8 @@ config THINKPAD_ACPI
depends on ACPI depends on ACPI
depends on INPUT depends on INPUT
depends on RFKILL || RFKILL = n depends on RFKILL || RFKILL = n
select BACKLIGHT_LCD_SUPPORT depends on ACPI_VIDEO || ACPI_VIDEO = n
select BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
select HWMON select HWMON
select NVRAM select NVRAM
select NEW_LEDS select NEW_LEDS
...@@ -500,8 +508,9 @@ config EEEPC_LAPTOP ...@@ -500,8 +508,9 @@ config EEEPC_LAPTOP
depends on ACPI depends on ACPI
depends on INPUT depends on INPUT
depends on RFKILL || RFKILL = n depends on RFKILL || RFKILL = n
depends on ACPI_VIDEO || ACPI_VIDEO = n
depends on HOTPLUG_PCI depends on HOTPLUG_PCI
select BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
select HWMON select HWMON
select LEDS_CLASS select LEDS_CLASS
select NEW_LEDS select NEW_LEDS
...@@ -587,6 +596,7 @@ config MSI_WMI ...@@ -587,6 +596,7 @@ config MSI_WMI
depends on ACPI_WMI depends on ACPI_WMI
depends on INPUT depends on INPUT
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on ACPI_VIDEO || ACPI_VIDEO = n
select INPUT_SPARSEKMAP select INPUT_SPARSEKMAP
help help
Say Y here if you want to support WMI-based hotkeys on MSI laptops. Say Y here if you want to support WMI-based hotkeys on MSI laptops.
...@@ -824,6 +834,7 @@ config MXM_WMI ...@@ -824,6 +834,7 @@ config MXM_WMI
config INTEL_OAKTRAIL config INTEL_OAKTRAIL
tristate "Intel Oaktrail Platform Extras" tristate "Intel Oaktrail Platform Extras"
depends on ACPI depends on ACPI
depends on ACPI_VIDEO || ACPI_VIDEO = n
depends on RFKILL && BACKLIGHT_CLASS_DEVICE && ACPI depends on RFKILL && BACKLIGHT_CLASS_DEVICE && ACPI
---help--- ---help---
Intel Oaktrail platform need this driver to provide interfaces to Intel Oaktrail platform need this driver to provide interfaces to
......
...@@ -2246,14 +2246,10 @@ static int __init acer_wmi_init(void) ...@@ -2246,14 +2246,10 @@ static int __init acer_wmi_init(void)
set_quirks(); set_quirks();
if (dmi_check_system(video_vendor_dmi_table)) if (dmi_check_system(video_vendor_dmi_table))
acpi_video_dmi_promote_vendor(); acpi_video_set_dmi_backlight_type(acpi_backlight_vendor);
if (acpi_video_backlight_support()) {
if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
interface->capability &= ~ACER_CAP_BRIGHTNESS; interface->capability &= ~ACER_CAP_BRIGHTNESS;
pr_info("Brightness must be controlled by acpi video driver\n");
} else {
pr_info("Disabling ACPI video driver\n");
acpi_video_unregister_backlight();
}
if (wmi_has_guid(WMID_GUID3)) { if (wmi_has_guid(WMID_GUID3)) {
if (ec_raw_mode) { if (ec_raw_mode) {
......
...@@ -550,8 +550,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) ...@@ -550,8 +550,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
* backlight control and supports more levels than other options. * backlight control and supports more levels than other options.
* Disable the other backlight choices. * Disable the other backlight choices.
*/ */
acpi_video_dmi_promote_vendor(); acpi_video_set_dmi_backlight_type(acpi_backlight_vendor);
acpi_video_unregister();
apple_bl_unregister(); apple_bl_unregister();
gmux_data->power_state = VGA_SWITCHEROO_ON; gmux_data->power_state = VGA_SWITCHEROO_ON;
...@@ -645,7 +644,6 @@ static void gmux_remove(struct pnp_dev *pnp) ...@@ -645,7 +644,6 @@ static void gmux_remove(struct pnp_dev *pnp)
apple_gmux_data = NULL; apple_gmux_data = NULL;
kfree(gmux_data); kfree(gmux_data);
acpi_video_dmi_demote_vendor();
acpi_video_register(); acpi_video_register();
apple_bl_register(); apple_bl_register();
} }
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <acpi/video.h>
#define ASUS_LAPTOP_VERSION "0.42" #define ASUS_LAPTOP_VERSION "0.42"
...@@ -1884,12 +1885,11 @@ static int asus_acpi_add(struct acpi_device *device) ...@@ -1884,12 +1885,11 @@ static int asus_acpi_add(struct acpi_device *device)
if (result) if (result)
goto fail_platform; goto fail_platform;
if (!acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
result = asus_backlight_init(asus); result = asus_backlight_init(asus);
if (result) if (result)
goto fail_backlight; goto fail_backlight;
} else }
pr_info("Backlight controlled by ACPI video driver\n");
result = asus_input_init(asus); result = asus_input_init(asus);
if (result) if (result)
......
...@@ -1364,7 +1364,7 @@ static void asus_wmi_notify(u32 value, void *context) ...@@ -1364,7 +1364,7 @@ static void asus_wmi_notify(u32 value, void *context)
code = ASUS_WMI_BRN_DOWN; code = ASUS_WMI_BRN_DOWN;
if (code == ASUS_WMI_BRN_DOWN || code == ASUS_WMI_BRN_UP) { if (code == ASUS_WMI_BRN_DOWN || code == ASUS_WMI_BRN_UP) {
if (!acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
asus_wmi_backlight_notify(asus, orig_code); asus_wmi_backlight_notify(asus, orig_code);
goto exit; goto exit;
} }
...@@ -1772,17 +1772,16 @@ static int asus_wmi_add(struct platform_device *pdev) ...@@ -1772,17 +1772,16 @@ static int asus_wmi_add(struct platform_device *pdev)
stop this from showing up */ stop this from showing up */
chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE); chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE);
if (chassis_type && !strcmp(chassis_type, "3")) if (chassis_type && !strcmp(chassis_type, "3"))
acpi_video_dmi_promote_vendor(); acpi_video_set_dmi_backlight_type(acpi_backlight_vendor);
if (asus->driver->quirks->wmi_backlight_power) if (asus->driver->quirks->wmi_backlight_power)
acpi_video_dmi_promote_vendor(); acpi_video_set_dmi_backlight_type(acpi_backlight_vendor);
if (!acpi_video_backlight_support()) {
pr_info("Disabling ACPI video driver\n"); if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
acpi_video_unregister();
err = asus_wmi_backlight_init(asus); err = asus_wmi_backlight_init(asus);
if (err && err != -ENODEV) if (err && err != -ENODEV)
goto fail_backlight; goto fail_backlight;
} else }
pr_info("Backlight controlled by ACPI video driver\n");
status = wmi_install_notify_handler(asus->driver->event_guid, status = wmi_install_notify_handler(asus->driver->event_guid,
asus_wmi_notify, asus); asus_wmi_notify, asus);
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
#include <linux/hwmon-sysfs.h> #include <linux/hwmon-sysfs.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <acpi/video.h>
/* ======= */ /* ======= */
/* Defines */ /* Defines */
...@@ -959,7 +959,7 @@ static int __init compal_init(void) ...@@ -959,7 +959,7 @@ static int __init compal_init(void)
return -ENODEV; return -ENODEV;
} }
if (!acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
struct backlight_properties props; struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties)); memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_PLATFORM; props.type = BACKLIGHT_PLATFORM;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <acpi/video.h>
#include "../../firmware/dcdbas.h" #include "../../firmware/dcdbas.h"
#define BRIGHTNESS_TOKEN 0x7d #define BRIGHTNESS_TOKEN 0x7d
...@@ -1920,13 +1921,8 @@ static int __init dell_init(void) ...@@ -1920,13 +1921,8 @@ static int __init dell_init(void)
debugfs_create_file("rfkill", 0444, dell_laptop_dir, NULL, debugfs_create_file("rfkill", 0444, dell_laptop_dir, NULL,
&dell_debugfs_fops); &dell_debugfs_fops);
#ifdef CONFIG_ACPI if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
/* In the event of an ACPI backlight being available, don't
* register the platform controller.
*/
if (acpi_video_backlight_support())
return 0; return 0;
#endif
get_buffer(); get_buffer();
buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <acpi/video.h>
MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
MODULE_DESCRIPTION("Dell laptop WMI hotkeys driver"); MODULE_DESCRIPTION("Dell laptop WMI hotkeys driver");
...@@ -397,7 +398,7 @@ static int __init dell_wmi_init(void) ...@@ -397,7 +398,7 @@ static int __init dell_wmi_init(void)
} }
dmi_walk(find_hk_type, NULL); dmi_walk(find_hk_type, NULL);
acpi_video = acpi_video_backlight_support(); acpi_video = acpi_video_get_backlight_type() != acpi_backlight_vendor;
err = dell_wmi_input_setup(); err = dell_wmi_input_setup();
if (err) if (err)
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/pci_hotplug.h> #include <linux/pci_hotplug.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <acpi/video.h>
#define EEEPC_LAPTOP_VERSION "0.1" #define EEEPC_LAPTOP_VERSION "0.1"
#define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver" #define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver"
...@@ -1433,12 +1434,10 @@ static int eeepc_acpi_add(struct acpi_device *device) ...@@ -1433,12 +1434,10 @@ static int eeepc_acpi_add(struct acpi_device *device)
if (result) if (result)
goto fail_platform; goto fail_platform;
if (!acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
result = eeepc_backlight_init(eeepc); result = eeepc_backlight_init(eeepc);
if (result) if (result)
goto fail_backlight; goto fail_backlight;
} else {
pr_info("Backlight controlled by ACPI video driver\n");
} }
result = eeepc_input_init(eeepc); result = eeepc_input_init(eeepc);
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
#include <linux/leds.h> #include <linux/leds.h>
#endif #endif
#include <acpi/video.h>
#define FUJITSU_DRIVER_VERSION "0.6.0" #define FUJITSU_DRIVER_VERSION "0.6.0"
...@@ -1099,7 +1100,7 @@ static int __init fujitsu_init(void) ...@@ -1099,7 +1100,7 @@ static int __init fujitsu_init(void)
/* Register backlight stuff */ /* Register backlight stuff */
if (!acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
struct backlight_properties props; struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties)); memset(&props, 0, sizeof(struct backlight_properties));
...@@ -1137,8 +1138,7 @@ static int __init fujitsu_init(void) ...@@ -1137,8 +1138,7 @@ static int __init fujitsu_init(void)
} }
/* Sync backlight power status (needs FUJ02E3 device, hence deferred) */ /* Sync backlight power status (needs FUJ02E3 device, hence deferred) */
if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
if (!acpi_video_backlight_support()) {
if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3) if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3)
fujitsu->bl_device->props.power = FB_BLANK_POWERDOWN; fujitsu->bl_device->props.power = FB_BLANK_POWERDOWN;
else else
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/i8042.h> #include <linux/i8042.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/device.h> #include <linux/device.h>
#include <acpi/video.h>
#define IDEAPAD_RFKILL_DEV_NUM (3) #define IDEAPAD_RFKILL_DEV_NUM (3)
...@@ -903,7 +904,7 @@ static int ideapad_acpi_add(struct platform_device *pdev) ...@@ -903,7 +904,7 @@ static int ideapad_acpi_add(struct platform_device *pdev)
ideapad_sync_rfk_state(priv); ideapad_sync_rfk_state(priv);
ideapad_sync_touchpad_state(priv); ideapad_sync_touchpad_state(priv);
if (!acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
ret = ideapad_backlight_init(priv); ret = ideapad_backlight_init(priv);
if (ret && ret != -ENODEV) if (ret && ret != -ENODEV)
goto backlight_failed; goto backlight_failed;
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/rfkill.h> #include <linux/rfkill.h>
#include <acpi/video.h>
#define DRIVER_NAME "intel_oaktrail" #define DRIVER_NAME "intel_oaktrail"
#define DRIVER_VERSION "0.4ac1" #define DRIVER_VERSION "0.4ac1"
...@@ -343,13 +344,11 @@ static int __init oaktrail_init(void) ...@@ -343,13 +344,11 @@ static int __init oaktrail_init(void)
goto err_device_add; goto err_device_add;
} }
if (!acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
ret = oaktrail_backlight_init(); ret = oaktrail_backlight_init();
if (ret) if (ret)
goto err_backlight; goto err_backlight;
}
} else
pr_info("Backlight controlled by ACPI video driver\n");
ret = oaktrail_rfkill_init(); ret = oaktrail_rfkill_init();
if (ret) { if (ret) {
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <linux/i8042.h> #include <linux/i8042.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/input/sparse-keymap.h> #include <linux/input/sparse-keymap.h>
#include <acpi/video.h>
#define MSI_DRIVER_VERSION "0.5" #define MSI_DRIVER_VERSION "0.5"
...@@ -1069,9 +1070,8 @@ static int __init msi_init(void) ...@@ -1069,9 +1070,8 @@ static int __init msi_init(void)
/* Register backlight stuff */ /* Register backlight stuff */
if (!quirks->old_ec_model || acpi_video_backlight_support()) { if (quirks->old_ec_model ||
pr_info("Brightness ignored, must be controlled by ACPI video driver\n"); acpi_video_get_backlight_type() == acpi_backlight_vendor) {
} else {
struct backlight_properties props; struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties)); memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_PLATFORM; props.type = BACKLIGHT_PLATFORM;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/backlight.h> #include <linux/backlight.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <acpi/video.h>
MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>"); MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>");
MODULE_DESCRIPTION("MSI laptop WMI hotkeys driver"); MODULE_DESCRIPTION("MSI laptop WMI hotkeys driver");
...@@ -320,7 +321,8 @@ static int __init msi_wmi_init(void) ...@@ -320,7 +321,8 @@ static int __init msi_wmi_init(void)
break; break;
} }
if (wmi_has_guid(MSIWMI_BIOS_GUID) && !acpi_video_backlight_support()) { if (wmi_has_guid(MSIWMI_BIOS_GUID) &&
acpi_video_get_backlight_type() == acpi_backlight_vendor) {
err = msi_wmi_backlight_setup(); err = msi_wmi_backlight_setup();
if (err) { if (err) {
pr_err("Unable to setup backlight device\n"); pr_err("Unable to setup backlight device\n");
......
...@@ -1720,27 +1720,14 @@ static int __init samsung_init(void) ...@@ -1720,27 +1720,14 @@ static int __init samsung_init(void)
samsung->handle_backlight = true; samsung->handle_backlight = true;
samsung->quirks = quirks; samsung->quirks = quirks;
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
if (samsung->quirks->broken_acpi_video) if (samsung->quirks->broken_acpi_video)
acpi_video_dmi_promote_vendor(); acpi_video_set_dmi_backlight_type(acpi_backlight_vendor);
if (samsung->quirks->use_native_backlight)
/* Don't handle backlight here if the acpi video already handle it */ acpi_video_set_dmi_backlight_type(acpi_backlight_native);
if (acpi_video_backlight_support()) {
samsung->handle_backlight = false;
} else if (samsung->quirks->broken_acpi_video) {
pr_info("Disabling ACPI video driver\n");
acpi_video_unregister();
}
if (samsung->quirks->use_native_backlight) { if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
pr_info("Using native backlight driver\n");
/* Tell acpi-video to not handle the backlight */
acpi_video_dmi_promote_vendor();
acpi_video_unregister();
/* And also do not handle it ourselves */
samsung->handle_backlight = false; samsung->handle_backlight = false;
}
#endif #endif
ret = samsung_platform_init(samsung); ret = samsung_platform_init(samsung);
...@@ -1751,12 +1738,6 @@ static int __init samsung_init(void) ...@@ -1751,12 +1738,6 @@ static int __init samsung_init(void)
if (ret) if (ret)
goto error_sabi; goto error_sabi;
#ifdef CONFIG_ACPI
/* Only log that if we are really on a sabi platform */
if (acpi_video_backlight_support())
pr_info("Backlight controlled by ACPI video driver\n");
#endif
ret = samsung_sysfs_init(samsung); ret = samsung_sysfs_init(samsung);
if (ret) if (ret)
goto error_sysfs; goto error_sysfs;
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#endif #endif
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <acpi/video.h>
#define dprintk(fmt, ...) \ #define dprintk(fmt, ...) \
do { \ do { \
...@@ -3198,12 +3199,8 @@ static int sony_nc_add(struct acpi_device *device) ...@@ -3198,12 +3199,8 @@ static int sony_nc_add(struct acpi_device *device)
sony_nc_function_setup(device, sony_pf_device); sony_nc_function_setup(device, sony_pf_device);
} }
/* setup input devices and helper fifo */ if (acpi_video_get_backlight_type() == acpi_backlight_vendor)
if (acpi_video_backlight_support()) {
pr_info("brightness ignored, must be controlled by ACPI video driver\n");
} else {
sony_nc_backlight_setup(); sony_nc_backlight_setup();
}
/* create sony_pf sysfs attributes related to the SNC device */ /* create sony_pf sysfs attributes related to the SNC device */
for (item = sony_nc_values; item->name; ++item) { for (item = sony_nc_values; item->name; ++item) {
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
#include <sound/control.h> #include <sound/control.h>
#include <sound/initval.h> #include <sound/initval.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <acpi/video.h>
/* ThinkPad CMOS commands */ /* ThinkPad CMOS commands */
#define TP_CMOS_VOLUME_DOWN 0 #define TP_CMOS_VOLUME_DOWN 0
...@@ -3487,7 +3488,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) ...@@ -3487,7 +3488,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
/* Do not issue duplicate brightness change events to /* Do not issue duplicate brightness change events to
* userspace. tpacpi_detect_brightness_capabilities() must have * userspace. tpacpi_detect_brightness_capabilities() must have
* been called before this point */ * been called before this point */
if (acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() != acpi_backlight_vendor) {
pr_info("This ThinkPad has standard ACPI backlight " pr_info("This ThinkPad has standard ACPI backlight "
"brightness control, supported by the ACPI " "brightness control, supported by the ACPI "
"video driver\n"); "video driver\n");
...@@ -6491,7 +6492,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm) ...@@ -6491,7 +6492,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
return 1; return 1;
} }
if (acpi_video_backlight_support()) { if (acpi_video_get_backlight_type() != acpi_backlight_vendor) {
if (brightness_enable > 1) { if (brightness_enable > 1) {
pr_info("Standard ACPI backlight interface " pr_info("Standard ACPI backlight interface "
"available, not loading native one\n"); "available, not loading native one\n");
......
...@@ -2640,14 +2640,11 @@ static int toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev) ...@@ -2640,14 +2640,11 @@ static int toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev)
*/ */
if (dev->tr_backlight_supported || if (dev->tr_backlight_supported ||
dmi_check_system(toshiba_vendor_backlight_dmi)) dmi_check_system(toshiba_vendor_backlight_dmi))
acpi_video_dmi_promote_vendor(); acpi_video_set_dmi_backlight_type(acpi_backlight_vendor);
if (acpi_video_backlight_support()) if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
return 0; return 0;
/* acpi-video may have loaded before we called dmi_promote_vendor() */
acpi_video_unregister_backlight();
memset(&props, 0, sizeof(props)); memset(&props, 0, sizeof(props));
props.type = BACKLIGHT_PLATFORM; props.type = BACKLIGHT_PLATFORM;
props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;
......
...@@ -16,23 +16,36 @@ struct acpi_device; ...@@ -16,23 +16,36 @@ struct acpi_device;
#define ACPI_VIDEO_DISPLAY_LEGACY_PANEL 0x0110 #define ACPI_VIDEO_DISPLAY_LEGACY_PANEL 0x0110
#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200 #define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200
enum acpi_backlight_type {
acpi_backlight_undef = -1,
acpi_backlight_none = 0,
acpi_backlight_video,
acpi_backlight_vendor,
acpi_backlight_native,
};
#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
extern int acpi_video_register(void); extern int acpi_video_register(void);
extern void acpi_video_unregister(void); extern void acpi_video_unregister(void);
extern void acpi_video_unregister_backlight(void);
extern int acpi_video_get_edid(struct acpi_device *device, int type, extern int acpi_video_get_edid(struct acpi_device *device, int type,
int device_id, void **edid); int device_id, void **edid);
extern bool acpi_video_verify_backlight_support(void); extern enum acpi_backlight_type acpi_video_get_backlight_type(void);
extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
#else #else
static inline int acpi_video_register(void) { return 0; } static inline int acpi_video_register(void) { return 0; }
static inline void acpi_video_unregister(void) { return; } static inline void acpi_video_unregister(void) { return; }
static inline void acpi_video_unregister_backlight(void) { return; }
static inline int acpi_video_get_edid(struct acpi_device *device, int type, static inline int acpi_video_get_edid(struct acpi_device *device, int type,
int device_id, void **edid) int device_id, void **edid)
{ {
return -ENODEV; return -ENODEV;
} }
static inline bool acpi_video_verify_backlight_support(void) { return false; } static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
{
return acpi_backlight_vendor;
}
static void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type)
{
}
#endif #endif
#endif #endif
...@@ -253,50 +253,12 @@ extern bool wmi_has_guid(const char *guid); ...@@ -253,50 +253,12 @@ extern bool wmi_has_guid(const char *guid);
#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400
#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800
#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) extern char acpi_video_backlight_string[];
extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle);
extern long acpi_is_video_device(acpi_handle handle); extern long acpi_is_video_device(acpi_handle handle);
extern void acpi_video_dmi_promote_vendor(void);
extern void acpi_video_dmi_demote_vendor(void);
extern int acpi_video_backlight_support(void);
extern int acpi_video_display_switch_support(void);
#else
static inline long acpi_video_get_capabilities(acpi_handle graphics_dev_handle)
{
return 0;
}
static inline long acpi_is_video_device(acpi_handle handle)
{
return 0;
}
static inline void acpi_video_dmi_promote_vendor(void)
{
}
static inline void acpi_video_dmi_demote_vendor(void)
{
}
static inline int acpi_video_backlight_support(void)
{
return 0;
}
static inline int acpi_video_display_switch_support(void)
{
return 0;
}
#endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */
extern int acpi_blacklisted(void); extern int acpi_blacklisted(void);
extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
extern void acpi_osi_setup(char *str); extern void acpi_osi_setup(char *str);
extern bool acpi_osi_is_win8(void);
#ifdef CONFIG_ACPI_NUMA #ifdef CONFIG_ACPI_NUMA
int acpi_get_node(acpi_handle handle); int acpi_get_node(acpi_handle handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment