Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c Broadcast PMF display on/off events when our con...



details:   https://anonhg.NetBSD.org/src/rev/b41cec02e3ed
branches:  trunk
changeset: 448466:b41cec02e3ed
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Feb 03 13:56:38 2019 +0000

description:
Broadcast PMF display on/off events when our connector is handling dpms so we can turn off the backlight

diffstat:

 sys/dev/i2c/anxedp.c |  22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r f3198b9d3a65 -r b41cec02e3ed sys/dev/i2c/anxedp.c
--- a/sys/dev/i2c/anxedp.c      Sun Feb 03 13:19:20 2019 +0000
+++ b/sys/dev/i2c/anxedp.c      Sun Feb 03 13:56:38 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: anxedp.c,v 1.1 2019/02/03 13:17:12 jmcneill Exp $ */
+/* $NetBSD: anxedp.c,v 1.2 2019/02/03 13:56:38 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: anxedp.c,v 1.1 2019/02/03 13:17:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: anxedp.c,v 1.2 2019/02/03 13:56:38 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -111,6 +111,22 @@
        (void)iic_smbus_write_byte(sc->sc_i2c, sc->sc_addr + off, reg, val, I2C_F_POLL);
 }
 
+static int
+anxedp_connector_dpms(struct drm_connector *connector, int mode)
+{
+       int error;
+
+       if (mode != DRM_MODE_DPMS_ON)
+               pmf_event_inject(NULL, PMFE_DISPLAY_OFF);
+
+       error = drm_helper_connector_dpms(connector, mode);
+
+       if (mode == DRM_MODE_DPMS_ON)
+               pmf_event_inject(NULL, PMFE_DISPLAY_ON);
+               
+       return error;
+}
+
 static enum drm_connector_status
 anxedp_connector_detect(struct drm_connector *connector, bool force)
 {
@@ -125,7 +141,7 @@
 }
 
 static const struct drm_connector_funcs anxedp_connector_funcs = {
-       .dpms = drm_helper_connector_dpms,
+       .dpms = anxedp_connector_dpms,
        .detect = anxedp_connector_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .destroy = anxedp_connector_destroy,



Home | Main Index | Thread Index | Old Index