Subversion Repositories Kolibri OS

Rev

Rev 4560 | Rev 5354 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4560 Rev 5060
Line 25... Line 25...
25
 *
25
 *
26
 */
26
 */
Line 27... Line 27...
27
 
27
 
Line 28... Line 28...
28
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
 
-
 
30
//#include 
29
 
31
//#include 
-
 
32
//#include 
-
 
Line 33... Line 30...
33
#include 
30
#include 
34
 
31
#include 
35
 
32
 
36
#include 
33
#include 
Line 227... Line 224...
227
#define ACPI_VGA_OUTPUT (1<<8)
224
#define ACPI_VGA_OUTPUT (1<<8)
228
#define ACPI_TV_OUTPUT (2<<8)
225
#define ACPI_TV_OUTPUT (2<<8)
229
#define ACPI_DIGITAL_OUTPUT (3<<8)
226
#define ACPI_DIGITAL_OUTPUT (3<<8)
230
#define ACPI_LVDS_OUTPUT (4<<8)
227
#define ACPI_LVDS_OUTPUT (4<<8)
Line -... Line 228...
-
 
228
 
-
 
229
#define MAX_DSLP	1500
231
 
230
 
232
#ifdef CONFIG_ACPI
231
#ifdef CONFIG_ACPI
233
static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
232
static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
234
{
233
{
235
	struct drm_i915_private *dev_priv = dev->dev_private;
234
	struct drm_i915_private *dev_priv = dev->dev_private;
Line 261... Line 260...
261
	dslp = ioread32(&swsci->dslp);
260
	dslp = ioread32(&swsci->dslp);
262
	if (!dslp) {
261
	if (!dslp) {
263
		/* The spec says 2ms should be the default, but it's too small
262
		/* The spec says 2ms should be the default, but it's too small
264
		 * for some machines. */
263
		 * for some machines. */
265
		dslp = 50;
264
		dslp = 50;
266
	} else if (dslp > 500) {
265
	} else if (dslp > MAX_DSLP) {
267
		/* Hey bios, trust must be earned. */
266
		/* Hey bios, trust must be earned. */
268
		WARN_ONCE(1, "excessive driver sleep timeout (DSPL) %u\n", dslp);
267
		DRM_INFO_ONCE("ACPI BIOS requests an excessive sleep of %u ms, "
-
 
268
			      "using %u ms instead\n", dslp, MAX_DSLP);
269
		dslp = 500;
269
		dslp = MAX_DSLP;
270
	}
270
	}
Line 271... Line 271...
271
 
271
 
272
	/* The spec tells us to do this, but we are the only user... */
272
	/* The spec tells us to do this, but we are the only user... */
273
	scic = ioread32(&swsci->scic);
273
	scic = ioread32(&swsci->scic);
Line 350... Line 350...
350
		type = DISPLAY_TYPE_CRT;
350
		type = DISPLAY_TYPE_CRT;
351
		break;
351
		break;
352
	case INTEL_OUTPUT_UNKNOWN:
352
	case INTEL_OUTPUT_UNKNOWN:
353
	case INTEL_OUTPUT_DISPLAYPORT:
353
	case INTEL_OUTPUT_DISPLAYPORT:
354
	case INTEL_OUTPUT_HDMI:
354
	case INTEL_OUTPUT_HDMI:
-
 
355
	case INTEL_OUTPUT_DP_MST:
355
		type = DISPLAY_TYPE_EXTERNAL_FLAT_PANEL;
356
		type = DISPLAY_TYPE_EXTERNAL_FLAT_PANEL;
356
		break;
357
		break;
357
	case INTEL_OUTPUT_EDP:
358
	case INTEL_OUTPUT_EDP:
358
		type = DISPLAY_TYPE_INTERNAL_FLAT_PANEL;
359
		type = DISPLAY_TYPE_INTERNAL_FLAT_PANEL;
359
		break;
360
		break;
Line 401... Line 402...
401
	struct intel_connector *intel_connector;
402
	struct intel_connector *intel_connector;
402
	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
403
	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
Line 403... Line 404...
403
 
404
 
Line -... Line 405...
-
 
405
	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
-
 
406
 
-
 
407
	/*
-
 
408
	 * If the acpi_video interface is not supposed to be used, don't
-
 
409
	 * bother processing backlight level change requests from firmware.
-
 
410
	 */
-
 
411
	if (!acpi_video_verify_backlight_support()) {
-
 
412
		DRM_DEBUG_KMS("opregion backlight request ignored\n");
-
 
413
		return 0;
404
	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
414
	}
405
 
415
 
Line 406... Line 416...
406
	if (!(bclp & ASLE_BCLP_VALID))
416
	if (!(bclp & ASLE_BCLP_VALID))
407
		return ASLC_BACKLIGHT_FAILED;
417
		return ASLC_BACKLIGHT_FAILED;
408
 
418
 
Line 409... Line 419...
409
	bclp &= ASLE_BCLP_MSK;
419
	bclp &= ASLE_BCLP_MSK;
Line 410... Line 420...
410
	if (bclp > 255)
420
	if (bclp > 255)
411
		return ASLC_BACKLIGHT_FAILED;
421
		return ASLC_BACKLIGHT_FAILED;
412
 
422
 
413
	mutex_lock(&dev->mode_config.mutex);
423
	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
414
 
424
 
415
	/*
425
	/*
416
	 * Update backlight on all connectors that support backlight (usually
426
	 * Update backlight on all connectors that support backlight (usually
417
	 * only one).
427
	 * only one).
Line 418... Line 428...
418
	 */
428
	 */
Line 419... Line 429...
419
	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
429
	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
420
	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
430
	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
Line 853... Line 863...
853
	if (asls == 0) {
863
	if (asls == 0) {
854
		DRM_DEBUG_DRIVER("ACPI OpRegion not supported!\n");
864
		DRM_DEBUG_DRIVER("ACPI OpRegion not supported!\n");
855
		return -ENOTSUPP;
865
		return -ENOTSUPP;
856
	}
866
	}
Line -... Line 867...
-
 
867
 
-
 
868
#ifdef CONFIG_ACPI
-
 
869
	INIT_WORK(&opregion->asle_work, asle_work);
-
 
870
#endif
857
 
871
 
858
    base = ioremap(asls, OPREGION_SIZE);
872
	base = acpi_os_ioremap(asls, OPREGION_SIZE);
859
	if (!base)
873
	if (!base)
Line 860... Line 874...
860
		return -ENOMEM;
874
		return -ENOMEM;
Line 861... Line 875...
861
 
875
 
862
	memcpy(buf, base, sizeof(buf));
876
	memcpy_fromio(buf, base, sizeof(buf));
863
 
877
 
864
	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
878
	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {