27,12 → 27,9 |
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|
//#include <linux/acpi.h> |
//#include <linux/acpi_io.h> |
//#include <acpi/video.h> |
#include <linux/errno.h> |
#include <linux/acpi.h> |
#include <acpi/video.h> |
|
|
#include <drm/drmP.h> |
#include <drm/i915_drm.h> |
#include "i915_drv.h" |
229,6 → 226,8 |
#define ACPI_DIGITAL_OUTPUT (3<<8) |
#define ACPI_LVDS_OUTPUT (4<<8) |
|
#define MAX_DSLP 1500 |
|
#ifdef CONFIG_ACPI |
static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out) |
{ |
263,10 → 262,11 |
/* The spec says 2ms should be the default, but it's too small |
* for some machines. */ |
dslp = 50; |
} else if (dslp > 500) { |
} else if (dslp > MAX_DSLP) { |
/* Hey bios, trust must be earned. */ |
WARN_ONCE(1, "excessive driver sleep timeout (DSPL) %u\n", dslp); |
dslp = 500; |
DRM_INFO_ONCE("ACPI BIOS requests an excessive sleep of %u ms, " |
"using %u ms instead\n", dslp, MAX_DSLP); |
dslp = MAX_DSLP; |
} |
|
/* The spec tells us to do this, but we are the only user... */ |
352,6 → 352,7 |
case INTEL_OUTPUT_UNKNOWN: |
case INTEL_OUTPUT_DISPLAYPORT: |
case INTEL_OUTPUT_HDMI: |
case INTEL_OUTPUT_DP_MST: |
type = DISPLAY_TYPE_EXTERNAL_FLAT_PANEL; |
break; |
case INTEL_OUTPUT_EDP: |
403,6 → 404,15 |
|
DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); |
|
/* |
* If the acpi_video interface is not supposed to be used, don't |
* bother processing backlight level change requests from firmware. |
*/ |
if (!acpi_video_verify_backlight_support()) { |
DRM_DEBUG_KMS("opregion backlight request ignored\n"); |
return 0; |
} |
|
if (!(bclp & ASLE_BCLP_VALID)) |
return ASLC_BACKLIGHT_FAILED; |
|
410,7 → 420,7 |
if (bclp > 255) |
return ASLC_BACKLIGHT_FAILED; |
|
mutex_lock(&dev->mode_config.mutex); |
drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); |
|
/* |
* Update backlight on all connectors that support backlight (usually |
418,10 → 428,10 |
*/ |
DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp); |
list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head) |
intel_panel_set_backlight(intel_connector, bclp, 255); |
intel_panel_set_backlight_acpi(intel_connector, bclp, 255); |
iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv); |
|
mutex_unlock(&dev->mode_config.mutex); |
drm_modeset_unlock(&dev->mode_config.connection_mutex); |
|
|
return 0; |
855,11 → 865,15 |
return -ENOTSUPP; |
} |
|
base = ioremap(asls, OPREGION_SIZE); |
#ifdef CONFIG_ACPI |
INIT_WORK(&opregion->asle_work, asle_work); |
#endif |
|
base = acpi_os_ioremap(asls, OPREGION_SIZE); |
if (!base) |
return -ENOMEM; |
|
memcpy(buf, base, sizeof(buf)); |
memcpy_fromio(buf, base, sizeof(buf)); |
|
if (memcmp(buf, OPREGION_SIGNATURE, 16)) { |
DRM_DEBUG_DRIVER("opregion signature mismatch\n"); |