View | Details | Raw Unified | Return to bug 190186
Collapse All | Expand All

(-)drm2/i915/i915_drv.h (-3 / +4 lines)
Lines 1242-1251 Link Here
1242
1242
1243
/* intel_opregion.c */
1243
/* intel_opregion.c */
1244
int intel_opregion_setup(struct drm_device *dev);
1244
int intel_opregion_setup(struct drm_device *dev);
1245
extern int intel_opregion_init(struct drm_device *dev);
1245
extern void intel_opregion_init(struct drm_device *dev);
1246
extern void intel_opregion_fini(struct drm_device *dev);
1246
extern void intel_opregion_fini(struct drm_device *dev);
1247
extern void opregion_asle_intr(struct drm_device *dev);
1247
extern void intel_opregion_asle_intr(struct drm_device *dev);
1248
extern void opregion_enable_asle(struct drm_device *dev);
1248
extern void intel_opregion_gse_intr(struct drm_device *dev);
1249
extern void intel_opregion_enable_asle(struct drm_device *dev);
1249
1250
1250
/* i915_gem_gtt.c */
1251
/* i915_gem_gtt.c */
1251
int i915_gem_init_aliasing_ppgtt(struct drm_device *dev);
1252
int i915_gem_init_aliasing_ppgtt(struct drm_device *dev);
(-)drm2/i915/i915_irq.c (-16 lines)
Lines 537-547 Link Here
537
		notify_ring(dev, &dev_priv->rings[BCS]);
537
		notify_ring(dev, &dev_priv->rings[BCS]);
538
538
539
	if (de_iir & DE_GSE_IVB) {
539
	if (de_iir & DE_GSE_IVB) {
540
#if 1
541
		KIB_NOTYET();
542
#else
543
		intel_opregion_gse_intr(dev);
540
		intel_opregion_gse_intr(dev);
544
#endif
545
	}
541
	}
546
542
547
	if (de_iir & DE_PLANEA_FLIP_DONE_IVB) {
543
	if (de_iir & DE_PLANEA_FLIP_DONE_IVB) {
Lines 649-659 Link Here
649
		notify_ring(dev, &dev_priv->rings[BCS]);
645
		notify_ring(dev, &dev_priv->rings[BCS]);
650
646
651
	if (de_iir & DE_GSE) {
647
	if (de_iir & DE_GSE) {
652
#if 1
653
		KIB_NOTYET();
654
#else
655
		intel_opregion_gse_intr(dev);
648
		intel_opregion_gse_intr(dev);
656
#endif
657
	}
649
	}
658
650
659
	if (de_iir & DE_PLANEA_FLIP_DONE) {
651
	if (de_iir & DE_PLANEA_FLIP_DONE) {
Lines 1055-1065 Link Here
1055
1047
1056
1048
1057
		if (blc_event || (iir & I915_ASLE_INTERRUPT)) {
1049
		if (blc_event || (iir & I915_ASLE_INTERRUPT)) {
1058
#if 1
1059
			KIB_NOTYET();
1060
#else
1061
			intel_opregion_asle_intr(dev);
1050
			intel_opregion_asle_intr(dev);
1062
#endif
1063
		}
1051
		}
1064
1052
1065
		/* With MSI, interrupts are only generated when iir
1053
		/* With MSI, interrupts are only generated when iir
Lines 1781-1791 Link Here
1781
		I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
1769
		I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
1782
	}
1770
	}
1783
1771
1784
#if 1
1785
	KIB_NOTYET();
1786
#else
1787
	intel_opregion_enable_asle(dev);
1772
	intel_opregion_enable_asle(dev);
1788
#endif
1789
1773
1790
	return 0;
1774
	return 0;
1791
}
1775
}
(-)drm2/i915/intel_opregion.c (-12 / +78 lines)
Lines 32-37 Link Here
32
#include <dev/drm2/i915/i915_drm.h>
32
#include <dev/drm2/i915/i915_drm.h>
33
#include <dev/drm2/i915/i915_drv.h>
33
#include <dev/drm2/i915/i915_drv.h>
34
#include <dev/drm2/i915/intel_drv.h>
34
#include <dev/drm2/i915/intel_drv.h>
35
#include <contrib/dev/acpica/include/acpi.h>
36
#include <contrib/dev/acpica/include/accommon.h>
37
#include <dev/acpica/acpivar.h>
35
38
36
#define PCI_ASLE 0xe4
39
#define PCI_ASLE 0xe4
37
#define PCI_ASLS 0xfc
40
#define PCI_ASLS 0xfc
Lines 144-150 Link Here
144
#define ACPI_DIGITAL_OUTPUT (3<<8)
147
#define ACPI_DIGITAL_OUTPUT (3<<8)
145
#define ACPI_LVDS_OUTPUT (4<<8)
148
#define ACPI_LVDS_OUTPUT (4<<8)
146
149
147
#ifdef CONFIG_ACPI
150
#if 1
148
static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
151
static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
149
{
152
{
150
	struct drm_i915_private *dev_priv = dev->dev_private;
153
	struct drm_i915_private *dev_priv = dev->dev_private;
Lines 289-294 Link Here
289
292
290
static struct intel_opregion *system_opregion;
293
static struct intel_opregion *system_opregion;
291
294
295
#if 0
292
static int intel_opregion_video_event(struct notifier_block *nb,
296
static int intel_opregion_video_event(struct notifier_block *nb,
293
				      unsigned long val, void *data)
297
				      unsigned long val, void *data)
294
{
298
{
Lines 319-324 Link Here
319
static struct notifier_block intel_opregion_notifier = {
323
static struct notifier_block intel_opregion_notifier = {
320
	.notifier_call = intel_opregion_video_event,
324
	.notifier_call = intel_opregion_video_event,
321
};
325
};
326
#endif
322
327
323
/*
328
/*
324
 * Initialise the DIDL field in opregion. This passes a list of devices to
329
 * Initialise the DIDL field in opregion. This passes a list of devices to
Lines 326-349 Link Here
326
 * (version 3)
331
 * (version 3)
327
 */
332
 */
328
333
334
static int acpi_is_video_device(ACPI_HANDLE devh) {
335
	ACPI_HANDLE h;
336
	if (ACPI_FAILURE(AcpiGetHandle(devh, "_DOD", &h)) ||
337
		ACPI_FAILURE(AcpiGetHandle(devh, "_DOS", &h))) {
338
		return 0;
339
	}
340
	return 1;
341
}
342
329
static void intel_didl_outputs(struct drm_device *dev)
343
static void intel_didl_outputs(struct drm_device *dev)
330
{
344
{
331
	struct drm_i915_private *dev_priv = dev->dev_private;
345
	struct drm_i915_private *dev_priv = dev->dev_private;
332
	struct intel_opregion *opregion = &dev_priv->opregion;
346
	struct intel_opregion *opregion = &dev_priv->opregion;
333
	struct drm_connector *connector;
347
	struct drm_connector *connector;
334
	acpi_handle handle;
348
	u32 device_id;
335
	struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL;
349
	ACPI_HANDLE handle, acpi_video_bus, acpi_cdev;
336
	unsigned long long device_id;
350
	ACPI_STATUS status;
337
	acpi_status status;
338
	int i = 0;
351
	int i = 0;
339
352
340
	handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev);
353
	handle = acpi_get_handle(dev->device);
341
	if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev)))
354
	if (!handle)
342
		return;
355
		return;
343
356
344
	if (acpi_is_video_device(acpi_dev))
357
	if (acpi_is_video_device(handle))
345
		acpi_video_bus = acpi_dev;
358
		acpi_video_bus = handle;
346
	else {
359
	else {
360
		acpi_cdev = NULL;
361
		acpi_video_bus = NULL;
362
		while (AcpiGetNextObject(ACPI_TYPE_DEVICE, handle, acpi_cdev,
363
					&acpi_cdev) != AE_NOT_FOUND) {
364
			if (acpi_is_video_device(acpi_cdev)) {
365
				acpi_video_bus = acpi_cdev;
366
				break;
367
			}
368
		}
369
#if 0
347
		list_for_each_entry(acpi_cdev, &acpi_dev->children, node) {
370
		list_for_each_entry(acpi_cdev, &acpi_dev->children, node) {
348
			if (acpi_is_video_device(acpi_cdev)) {
371
			if (acpi_is_video_device(acpi_cdev)) {
349
				acpi_video_bus = acpi_cdev;
372
				acpi_video_bus = acpi_cdev;
Lines 350-362 Link Here
350
				break;
373
				break;
351
			}
374
			}
352
		}
375
		}
376
#endif
353
	}
377
	}
354
378
355
	if (!acpi_video_bus) {
379
	if (!acpi_video_bus) {
356
		printk(KERN_WARNING "No ACPI video bus found\n");
380
		device_printf(dev->device, "No ACPI video bus found\n");
357
		return;
381
		return;
358
	}
382
	}
359
383
384
	acpi_cdev = NULL;
385
	while (AcpiGetNextObject(ACPI_TYPE_DEVICE, acpi_video_bus, acpi_cdev,
386
				&acpi_cdev) != AE_NOT_FOUND) {
387
		if (i >= 8) {
388
			device_printf(dev->device, "More than 8 outputs detected\n");
389
			return;
390
		}
391
		status = acpi_GetInteger(acpi_cdev, "_ADR", &device_id);
392
		if (ACPI_SUCCESS(status)) {
393
			if (!device_id)
394
				goto blind_set;
395
			opregion->acpi->didl[i] = (u32)(device_id & 0x0f0f);
396
			i++;
397
		}
398
	}
399
#if 0
360
	list_for_each_entry(acpi_cdev, &acpi_video_bus->children, node) {
400
	list_for_each_entry(acpi_cdev, &acpi_video_bus->children, node) {
361
		if (i >= 8) {
401
		if (i >= 8) {
362
			dev_printk(KERN_ERR, &dev->pdev->dev,
402
			dev_printk(KERN_ERR, &dev->pdev->dev,
Lines 373-378 Link Here
373
			i++;
413
			i++;
374
		}
414
		}
375
	}
415
	}
416
#endif
376
417
377
end:
418
end:
378
	/* If fewer than 8 outputs, the list must be null terminated */
419
	/* If fewer than 8 outputs, the list must be null terminated */
Lines 417-422 Link Here
417
	goto end;
458
	goto end;
418
}
459
}
419
460
461
static void intel_setup_cadls(struct drm_device *dev)
462
{
463
	struct drm_i915_private *dev_priv = dev->dev_private;
464
	struct intel_opregion *opregion = &dev_priv->opregion;
465
	int i = 0;
466
	u32 disp_id;
467
468
	/* Initialize the CADL field by duplicating the DIDL values.
469
	 * Technically, this is not always correct as display outputs may exist,
470
	 * but not active. This initialization is necessary for some Clevo
471
	 * laptops that check this field before processing the brightness and
472
	 * display switching hotkeys. Just like DIDL, CADL is NULL-terminated if
473
	 * there are less than eight devices. */
474
	do {
475
		disp_id = opregion->acpi->didl[i];
476
		opregion->acpi->cadl[i] = disp_id;
477
	} while (++i < 8 && disp_id != 0);
478
}
479
420
void intel_opregion_init(struct drm_device *dev)
480
void intel_opregion_init(struct drm_device *dev)
421
{
481
{
422
	struct drm_i915_private *dev_priv = dev->dev_private;
482
	struct drm_i915_private *dev_priv = dev->dev_private;
Lines 426-433 Link Here
426
		return;
486
		return;
427
487
428
	if (opregion->acpi) {
488
	if (opregion->acpi) {
429
		if (drm_core_check_feature(dev, DRIVER_MODESET))
489
		if (drm_core_check_feature(dev, DRIVER_MODESET)) {
430
			intel_didl_outputs(dev);
490
			intel_didl_outputs(dev);
491
			intel_setup_cadls(dev);
492
		}
431
493
432
		/* Notify BIOS we are ready to handle ACPI video ext notifs.
494
		/* Notify BIOS we are ready to handle ACPI video ext notifs.
433
		 * Right now, all the events are handled by the ACPI video module.
495
		 * Right now, all the events are handled by the ACPI video module.
Lines 436-442 Link Here
436
		opregion->acpi->drdy = 1;
498
		opregion->acpi->drdy = 1;
437
499
438
		system_opregion = opregion;
500
		system_opregion = opregion;
501
#if 0
439
		register_acpi_notifier(&intel_opregion_notifier);
502
		register_acpi_notifier(&intel_opregion_notifier);
503
#endif
440
	}
504
	}
441
505
442
	if (opregion->asle)
506
	if (opregion->asle)
Lines 455-465 Link Here
455
		opregion->acpi->drdy = 0;
519
		opregion->acpi->drdy = 0;
456
520
457
		system_opregion = NULL;
521
		system_opregion = NULL;
522
#if 0
458
		unregister_acpi_notifier(&intel_opregion_notifier);
523
		unregister_acpi_notifier(&intel_opregion_notifier);
524
#endif
459
	}
525
	}
460
526
461
	/* just clear all opregion memory pointers now */
527
	/* just clear all opregion memory pointers now */
462
	iounmap(opregion->header);
528
	pmap_unmapdev((vm_offset_t)opregion->header, OPREGION_SIZE);
463
	opregion->header = NULL;
529
	opregion->header = NULL;
464
	opregion->acpi = NULL;
530
	opregion->acpi = NULL;
465
	opregion->swsci = NULL;
531
	opregion->swsci = NULL;

Return to bug 190186