Emit PMFE_DISPLAY_{ON,OFF} events in response to DPMS requests.

This commit is contained in:
jmcneill 2020-01-04 12:08:32 +00:00
parent 869320cd52
commit d63ecae318
3 changed files with 31 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rk_anxdp.c,v 1.1 2019/12/19 00:25:59 jakllsch Exp $ */
/* $NetBSD: rk_anxdp.c,v 1.2 2020/01/04 12:08:32 jmcneill Exp $ */
/*-
* Copyright (c) 2019 Jonathan A. Kollasch <jakllsch@kollasch.net>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rk_anxdp.c,v 1.1 2019/12/19 00:25:59 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: rk_anxdp.c,v 1.2 2020/01/04 12:08:32 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -122,6 +122,14 @@ rk_anxdp_encoder_commit(struct drm_encoder *encoder)
{
}
static void
rk_anxdp_encoder_dpms(struct drm_encoder *encoder, int mode)
{
struct rk_anxdp_softc * const sc = to_rk_anxdp_encoder(encoder);
anxdp_dpms(&sc->sc_base, mode);
}
static const struct drm_encoder_funcs rk_anxdp_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
@ -133,6 +141,7 @@ static const struct drm_encoder_helper_funcs rk_anxdp_encoder_helper_funcs = {
.enable = rk_anxdp_encoder_enable,
.disable = rk_anxdp_encoder_disable,
.commit = rk_anxdp_encoder_commit,
.dpms = rk_anxdp_encoder_dpms,
};
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: anx_dp.c,v 1.1 2019/12/19 00:23:57 jakllsch Exp $ */
/* $NetBSD: anx_dp.c,v 1.2 2020/01/04 12:08:32 jmcneill Exp $ */
/*-
* Copyright (c) 2019 Jonathan A. Kollasch <jakllsch@kollasch.net>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.1 2019/12/19 00:23:57 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.2 2020/01/04 12:08:32 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -991,6 +991,21 @@ out:
return ret;
}
void
anxdp_dpms(struct anxdp_softc *sc, int mode)
{
switch (mode) {
case DRM_MODE_DPMS_ON:
pmf_event_inject(NULL, PMFE_DISPLAY_ON);
break;
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
pmf_event_inject(NULL, PMFE_DISPLAY_OFF);
break;
}
}
int
anxdp_attach(struct anxdp_softc *sc)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: anx_dp.h,v 1.1 2019/12/19 00:23:57 jakllsch Exp $ */
/* $NetBSD: anx_dp.h,v 1.2 2020/01/04 12:08:32 jmcneill Exp $ */
/*-
* Copyright (c) 2019 Jonathan A. Kollasch <jakllsch@kollasch.net>
@ -74,4 +74,6 @@ struct anxdp_softc {
int anxdp_attach(struct anxdp_softc *);
int anxdp_bind(struct anxdp_softc *, struct drm_encoder *);
void anxdp_dpms(struct anxdp_softc *, int);
#endif /* !_DEV_IC_ANXDP_H */