From: "Theo de Raadt" Subject: Re: sys/qcdpc: blank eDP panels during suspend To: tech@openbsd.org Date: Sun, 04 Oct 2026 19:26:18 -0600 Theo de Raadt wrote: > > +int > > +qcdpc_activate(struct device *self, int act) > > +{ > > + struct qcdpc_softc *sc = (struct qcdpc_softc *)self; > > + int ret; > > + > > + if (sc != qcdpc_bl || !sc->sc_bl.aux_enable) > > + return config_activate_children(self, act); > > + > > + switch (act) { > > + case DVACT_QUIESCE: > > + ret = config_activate_children(self, act); > > + if (ret) > > + return ret; > > + > > + if (!sc->sc_bl_suspended) { > > + ret = drm_dp_dpcd_read_byte(&sc->sc_aux, > > + DP_EDP_DISPLAY_CONTROL_REGISTER, &sc->sc_bl_control); > > + if (ret < 0) > > + return ret; > > + sc->sc_bl_suspended = 1; > > + } > > + > > + return drm_dp_dpcd_write_byte(&sc->sc_aux, > > + DP_EDP_DISPLAY_CONTROL_REGISTER, > > + (sc->sc_bl_control & ~DP_EDP_BACKLIGHT_ENABLE) | > > + DP_EDP_BLACK_VIDEO_ENABLE); From a style perspective, will this work? Regarding this, why are you inspecting "sc != qcdpc_bl"? if (sc != qcdpc_bl || !sc->sc_bl.aux_enable) You are running code in this activate function because that is already true. Index: qcdpc.c =================================================================== RCS file: /cvs/src/sys/dev/fdt/qcdpc.c,v diff -u -p -u -r1.2 qcdpc.c --- qcdpc.c 9 Mar 2026 23:57:53 -0000 1.2 +++ qcdpc.c 5 Oct 2026 01:12:04 -0000 +int +qcdpc_activate(struct device *self, int act) +{ + struct qcdpc_softc *sc = (struct qcdpc_softc *)self; + int ret; + + switch (act) { + case DVACT_QUIESCE: + ret = config_activate_children(self, act); + if (ret) + return ret; + if (sc != qcdpc_bl || !sc->sc_bl.aux_enable) + break; + + if (!sc->sc_bl_suspended) { + if (drm_dp_dpcd_read_byte(&sc->sc_aux, + DP_EDP_DISPLAY_CONTROL_REGISTER, + &sc->sc_bl_control) < 0) + break; + sc->sc_bl_suspended = 1; + } + (void) drm_dp_dpcd_write_byte(&sc->sc_aux, + DP_EDP_DISPLAY_CONTROL_REGISTER, + (sc->sc_bl_control & ~DP_EDP_BACKLIGHT_ENABLE) | + DP_EDP_BLACK_VIDEO_ENABLE); + break; + case DVACT_WAKEUP: + if (sc->sc_bl_suspended) { + if (drm_dp_dpcd_write_byte(&sc->sc_aux, + DP_EDP_DISPLAY_CONTROL_REGISTER, + sc->sc_bl_control) == 0) + sc->sc_bl_suspended = 0; + } + return config_activate_children(self, act); + default: + return config_activate_children(self, act); } }