summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2013-03-21 08:27:33 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2013-03-21 08:27:33 +0000
commite36b22694495b220dc602af1f9495de11e94c9b9 (patch)
tree7ae916c2dcd608dcdc7b3445290db3a0c26e3762 /sys
parent86bfb4dfbbb0e2ecb058c59b752c1870a90dfc14 (diff)
Enable the opregion code but keep the parts that try to talk to acpi
disabled for now. Makes the brightness keys on my x230 work.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.h20
-rw-r--r--sys/dev/pci/drm/i915/i915_irq.c24
-rw-r--r--sys/dev/pci/drm/i915/intel_opregion.c49
3 files changed, 38 insertions, 55 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.h b/sys/dev/pci/drm/i915/i915_drv.h
index 66fbd20a693..85a193d2997 100644
--- a/sys/dev/pci/drm/i915/i915_drv.h
+++ b/sys/dev/pci/drm/i915/i915_drv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_drv.h,v 1.2 2013/03/20 12:37:41 jsg Exp $ */
+/* $OpenBSD: i915_drv.h,v 1.3 2013/03/21 08:27:32 jsg Exp $ */
/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
*/
/*
@@ -41,6 +41,8 @@
#include <dev/wscons/wsdisplayvar.h>
#include <dev/rasops/rasops.h>
+#include "acpi.h"
+
/* General customization:
*/
@@ -1012,6 +1014,7 @@ void i915_enable_pipestat(struct inteldrm_softc *, int, u_int32_t);
void i915_disable_pipestat(struct inteldrm_softc *, int, u_int32_t);
void intel_irq_init(struct drm_device *dev);
void i915_hangcheck_elapsed(void *);
+void intel_enable_asle(struct drm_device *);
extern void intel_gt_init(struct drm_device *dev);
extern void intel_gt_reset(struct drm_device *dev);
@@ -1221,10 +1224,19 @@ int i915_mutex_lock_interruptible(struct drm_device *dev);
/* intel_opregion.c */
int intel_opregion_setup(struct drm_device *dev);
-extern int intel_opregion_init(struct drm_device *dev);
+#if NACPI > 0
+extern void intel_opregion_init(struct drm_device *dev);
extern void intel_opregion_fini(struct drm_device *dev);
-extern void opregion_asle_intr(struct drm_device *dev);
-extern void opregion_enable_asle(struct drm_device *dev);
+extern void intel_opregion_asle_intr(struct drm_device *dev);
+extern void intel_opregion_gse_intr(struct drm_device *dev);
+extern void intel_opregion_enable_asle(struct drm_device *dev);
+#else
+static inline void intel_opregion_init(struct drm_device *dev) { return; }
+static inline void intel_opregion_fini(struct drm_device *dev) { return; }
+static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
+static inline void intel_opregion_gse_intr(struct drm_device *dev) { return; }
+static inline void intel_opregion_enable_asle(struct drm_device *dev) { return; }
+#endif
/* i915_gem_gtt.c */
void i915_gem_cleanup_aliasing_ppgtt(struct drm_device *dev);
diff --git a/sys/dev/pci/drm/i915/i915_irq.c b/sys/dev/pci/drm/i915/i915_irq.c
index b78578035d4..2ade5520e0d 100644
--- a/sys/dev/pci/drm/i915/i915_irq.c
+++ b/sys/dev/pci/drm/i915/i915_irq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_irq.c,v 1.2 2013/03/20 12:37:41 jsg Exp $ */
+/* $OpenBSD: i915_irq.c,v 1.3 2013/03/21 08:27:32 jsg Exp $ */
/* i915_irq.c -- IRQ support for the I915 -*- linux-c -*-
*/
/*
@@ -785,10 +785,8 @@ ivybridge_intr(void *arg)
de_iir = I915_READ(DEIIR);
if (de_iir) {
-#ifdef notyet
if (de_iir & DE_GSE_IVB)
intel_opregion_gse_intr(dev);
-#endif
for (i = 0; i < 3; i++) {
if (de_iir & (DE_PIPEA_VBLANK_IVB << (5 * i)))
@@ -869,10 +867,8 @@ ironlake_intr(void *arg)
else
snb_gt_irq_handler(dev, dev_priv, gt_iir);
-#ifdef notyet
if (de_iir & DE_GSE)
intel_opregion_gse_intr(dev);
-#endif
if (de_iir & DE_PIPEA_VBLANK)
drm_handle_vblank(dev, 0);
@@ -2398,11 +2394,7 @@ i915_irq_postinstall(struct drm_device *dev)
/* Unmask the interrupts that we always want on. */
dev_priv->irq_mask =
-#ifdef notyet
~(I915_ASLE_INTERRUPT |
-#else
- ~(
-#endif
I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
@@ -2410,9 +2402,7 @@ i915_irq_postinstall(struct drm_device *dev)
I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
enable_mask =
-#ifdef notyet
I915_ASLE_INTERRUPT |
-#endif
I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT |
@@ -2452,7 +2442,7 @@ i915_irq_postinstall(struct drm_device *dev)
I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
}
-// intel_opregion_enable_asle(dev);
+ intel_opregion_enable_asle(dev);
return 0;
}
@@ -2544,10 +2534,8 @@ i915_intr(void *arg)
blc_event = true;
}
-#ifdef notyet
if (blc_event || (iir & I915_ASLE_INTERRUPT))
intel_opregion_asle_intr(dev);
-#endif
/* With MSI, interrupts are only generated when iir
* transitions from zero to nonzero. If another bit got
@@ -2624,11 +2612,7 @@ i965_irq_postinstall(struct drm_device *dev)
u32 error_mask;
/* Unmask the interrupts that we always want on. */
-#ifdef notyet
dev_priv->irq_mask = ~(I915_ASLE_INTERRUPT |
-#else
- dev_priv->irq_mask = ~(
-#endif
I915_DISPLAY_PORT_INTERRUPT |
I915_DISPLAY_PIPE_A_EVENT_INTERRUPT |
I915_DISPLAY_PIPE_B_EVENT_INTERRUPT |
@@ -2699,9 +2683,7 @@ i965_irq_postinstall(struct drm_device *dev)
I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
-#ifdef notyet
intel_opregion_enable_asle(dev);
-#endif
return 0;
}
@@ -2796,10 +2778,8 @@ i965_intr(void *arg)
}
-#ifdef notyet
if (blc_event || (iir & I915_ASLE_INTERRUPT))
intel_opregion_asle_intr(dev);
-#endif
/* With MSI, interrupts are only generated when iir
* transitions from zero to nonzero. If another bit got
diff --git a/sys/dev/pci/drm/i915/intel_opregion.c b/sys/dev/pci/drm/i915/intel_opregion.c
index 9255bdfe1e7..075a5cd1b08 100644
--- a/sys/dev/pci/drm/i915/intel_opregion.c
+++ b/sys/dev/pci/drm/i915/intel_opregion.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_opregion.c,v 1.1 2013/03/18 12:36:52 jsg Exp $ */
+/* $OpenBSD: intel_opregion.c,v 1.2 2013/03/21 08:27:32 jsg Exp $ */
/*
* Copyright 2008 Intel Corporation <hong.liu@intel.com>
* Copyright 2008 Red Hat <mjg@redhat.com>
@@ -33,6 +33,8 @@
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
+
+#include "acpi.h"
#include <dev/acpi/acpivar.h>
#define PCI_ASLE 0xe4
@@ -146,7 +148,15 @@ struct opregion_asle {
#define ACPI_DIGITAL_OUTPUT (3<<8)
#define ACPI_LVDS_OUTPUT (4<<8)
-#ifdef CONFIG_ACPI
+u32 asle_set_backlight(struct drm_device *, u32);
+u32 asle_set_als_illum(struct drm_device *, u32);
+u32 asle_set_pwm_freq(struct drm_device *, u32);
+u32 asle_set_pfit(struct drm_device *, u32);
+void intel_opregion_asle_intr(struct drm_device *);
+void intel_opregion_gse_intr(struct drm_device *);
+void intel_didl_outputs(struct drm_device *);
+
+#if NACPI > 0
u32
asle_set_backlight(struct drm_device *dev, u32 bclp)
{
@@ -299,6 +309,7 @@ intel_opregion_enable_asle(struct drm_device *dev)
static struct intel_opregion *system_opregion;
+#ifdef notyet
int
intel_opregion_video_event(struct notifier_block *nb, unsigned long val,
void *data)
@@ -330,6 +341,7 @@ intel_opregion_video_event(struct notifier_block *nb, unsigned long val,
static struct notifier_block intel_opregion_notifier = {
.notifier_call = intel_opregion_video_event,
};
+#endif
/*
* Initialise the DIDL field in opregion. This passes a list of devices to
@@ -340,6 +352,7 @@ static struct notifier_block intel_opregion_notifier = {
void
intel_didl_outputs(struct drm_device *dev)
{
+#ifdef notyet
struct inteldrm_softc *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion;
struct drm_connector *connector;
@@ -427,6 +440,7 @@ blind_set:
i++;
}
goto end;
+#endif
}
void
@@ -449,7 +463,9 @@ intel_opregion_init(struct drm_device *dev)
opregion->acpi->drdy = 1;
system_opregion = opregion;
+#ifdef notyet
register_acpi_notifier(&intel_opregion_notifier);
+#endif
}
if (opregion->asle)
@@ -469,37 +485,12 @@ intel_opregion_fini(struct drm_device *dev)
opregion->acpi->drdy = 0;
system_opregion = NULL;
+#ifdef notyet
unregister_acpi_notifier(&intel_opregion_notifier);
+#endif
}
/* just clear all opregion memory pointers now */
- iounmap(opregion->header);
- opregion->header = NULL;
- opregion->acpi = NULL;
- opregion->swsci = NULL;
- opregion->asle = NULL;
- opregion->vbt = NULL;
-}
-#else
-int
-intel_opregion_init(struct drm_device *dev)
-{
-
- return (0);
-}
-
-void
-intel_opregion_fini(struct drm_device *dev)
-{
- struct inteldrm_softc *dev_priv;
- struct intel_opregion *opregion;
-
- dev_priv = dev->dev_private;
- opregion = &dev_priv->opregion;
-
- if (opregion->header == NULL)
- return;
-
bus_space_unmap(dev_priv->bst, dev_priv->opregion_ioh, OPREGION_SIZE);
opregion->header = NULL;
opregion->acpi = NULL;