drm/nouveau/core: rework event interface
This is a lot of prep-work for being able to send event notifications
back to userspace. Events now contain data, rather than a "something
just happened" signal.
Handler data is now embedded into a containing structure, rather than
being kmalloc()'d, and can optionally have the notify routine handled
in a workqueue.
Various races between suspend/unload with display HPD/DP IRQ handlers
automagically solved as a result.
Signed-off-by:
Ben Skeggs <bskeggs@redhat.com>
... | ... | @@ -22,39 +22,41 @@ |
* Authors: Ben Skeggs | ||
*/ | ||
#include <core/os.h> | ||
#include <nvif/event.h> | ||
#include <subdev/gpio.h> | ||
#include "conn.h" | ||
#include "outp.h" | ||
static void | ||
nvkm_connector_hpd_work(struct work_struct *w) | ||
static int | ||
nvkm_connector_hpd(struct nvkm_notify *notify) | ||
{ | ||
struct nvkm_connector *conn = container_of(w, typeof(*conn), hpd.work); | ||
struct nvkm_connector *conn = container_of(notify, typeof(*conn), hpd); | ||
struct nouveau_disp *disp = nouveau_disp(conn); | ||
struct nouveau_gpio *gpio = nouveau_gpio(conn); | ||
u32 send = NVKM_HPD_UNPLUG; | ||
if (gpio->get(gpio, 0, DCB_GPIO_UNUSED, conn->hpd.event->index)) | ||
send = NVKM_HPD_PLUG; | ||
nouveau_event_trigger(disp->hpd, send, conn->index); | ||
nouveau_event_get(conn->hpd.event); | ||
} | ||
const struct nvkm_gpio_ntfy_rep *line = notify->data; | ||
struct nvif_notify_conn_rep_v0 rep; | ||
< |