summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2013-03-30 13:14:33 +0000
committerkettenis <kettenis@openbsd.org>2013-03-30 13:14:33 +0000
commit4c800b7dae66ae590c9fb64ad529244b43178f34 (patch)
tree029b86937bad34e69842dace1f6f72e30087ea35
parentsync (diff)
downloadwireguard-openbsd-4c800b7dae66ae590c9fb64ad529244b43178f34.tar.xz
wireguard-openbsd-4c800b7dae66ae590c9fb64ad529244b43178f34.zip
If the ws_{get|set}_param hooks are set, use those for brightness control
instead of poking the hardware directly. Prevents some funny interaction between using the brightness keys and wsconsctl(8) on the Dell XPS M1330. Changing the brightness behind ACPI's back is apparently not such a good idea.
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c
index 9b280119592..554c42c584d 100644
--- a/sys/dev/pci/drm/i915/i915_drv.c
+++ b/sys/dev/pci/drm/i915/i915_drv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_drv.c,v 1.13 2013/03/30 04:57:53 jsg Exp $ */
+/* $OpenBSD: i915_drv.c,v 1.14 2013/03/30 13:14:33 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -646,6 +646,9 @@ struct wsdisplay_accessops inteldrm_accessops = {
inteldrm_show_screen
};
+extern int (*ws_get_param)(struct wsdisplay_param *);
+extern int (*ws_set_param)(struct wsdisplay_param *);
+
int
inteldrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
{
@@ -656,6 +659,9 @@ inteldrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
switch (cmd) {
case WSDISPLAYIO_GETPARAM:
+ if (ws_get_param && ws_get_param(dp) == 0)
+ return 0;
+
switch (dp->param) {
case WSDISPLAYIO_PARAM_BRIGHTNESS:
dp->min = 0;
@@ -665,6 +671,9 @@ inteldrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
}
break;
case WSDISPLAYIO_SETPARAM:
+ if (ws_set_param && ws_set_param(dp) == 0)
+ return 0;
+
switch (dp->param) {
case WSDISPLAYIO_PARAM_BRIGHTNESS:
intel_panel_set_backlight(dev, dp->curval);