-/* $OpenBSD: gpiobl.c,v 1.1 2022/11/08 19:06:57 tobhe Exp $ */
+/* $OpenBSD: gpiobl.c,v 1.2 2022/11/09 22:56:44 tobhe Exp $ */
/*
* Copyright (c) 2022 Tobias Heider <tobhe@openbsd.org>
*
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
+extern void (*simplefb_burn_hook)(u_int);
+
struct gpiobl_softc {
struct device sc_dev;
int sc_on;
NULL, "gpiobl", DV_DULL
};
+void gpiobl_set(u_int);
void gpiobl_task(void *);
-int gpiobl_get_param(struct wsdisplay_param *);
-int gpiobl_set_param(struct wsdisplay_param *);
int
gpiobl_match(struct device *parent, void *match, void *aux)
sc_gpiobl = sc;
task_set(&sc->sc_task, gpiobl_task, sc);
- ws_get_param = gpiobl_get_param;
- ws_set_param = gpiobl_set_param;
+
+ simplefb_burn_hook = gpiobl_set;
+
printf("\n");
}
void
-gpiobl_task(void *args)
-{
- struct gpiobl_softc *sc = args;
- gpio_controller_set_pin(&sc->sc_gpio[0], sc->sc_on);
-}
-
-int
-gpiobl_get_param(struct wsdisplay_param *dp)
+gpiobl_set(u_int on)
{
struct gpiobl_softc *sc = (struct gpiobl_softc *)sc_gpiobl;
-
- switch (dp->param) {
- case WSDISPLAYIO_PARAM_BRIGHTNESS:
- dp->min = 0;
- dp->max = 1;
- dp->curval = sc->sc_on;
- return 0;
- default:
- return -1;
- }
+ sc->sc_on = on;
+ task_add(systq, &sc->sc_task);
}
-int
-gpiobl_set_param(struct wsdisplay_param *dp)
+void
+gpiobl_task(void *args)
{
- struct gpiobl_softc *sc = (struct gpiobl_softc *)sc_gpiobl;
-
- switch (dp->param) {
- case WSDISPLAYIO_PARAM_BRIGHTNESS:
- if (dp->curval == sc->sc_on)
- return 0;
- sc->sc_on = !sc->sc_on;
- task_add(systq, &sc->sc_task);
- return 0;
- default:
- return -1;
- }
+ struct gpiobl_softc *sc = args;
+ gpio_controller_set_pin(&sc->sc_gpio[0], sc->sc_on);
}
-/* $OpenBSD: simplefb.c,v 1.18 2022/11/09 22:12:40 kn Exp $ */
+/* $OpenBSD: simplefb.c,v 1.19 2022/11/09 22:56:44 tobhe Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
*
psize_t sc_psize;
};
+void (*simplefb_burn_hook)(u_int) = NULL;
+
struct rasops_info simplefb_ri;
struct wsscreen_descr simplefb_wsd = { "std" };
struct wsdisplay_charcell simplefb_bs[SIMPLEFB_WIDTH * SIMPLEFB_HEIGHT];
paddr_t simplefb_wsmmap(void *, off_t, int);
int simplefb_alloc_screen(void *, const struct wsscreen_descr *,
void **, int *, int *, uint32_t *);
+void simplefb_burn_screen(void *, u_int, u_int);
struct wsdisplay_accessops simplefb_accessops = {
.ioctl = simplefb_wsioctl,
.getchar = rasops_getchar,
.load_font = rasops_load_font,
.list_font = rasops_list_font,
- .scrollback = rasops_scrollback
+ .scrollback = rasops_scrollback,
+ .burn_screen = simplefb_burn_screen,
};
int
void **cookiep, int *curxp, int *curyp, uint32_t *attrp)
{
return rasops_alloc_screen(v, cookiep, curxp, curyp, attrp);
+}
+
+void
+simplefb_burn_screen(void *v, u_int on, u_int flags)
+{
+ if (simplefb_burn_hook != NULL)
+ simplefb_burn_hook(on);
}
#include "ukbd.h"