summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-05-13 15:54:17 +1000
committerBen Skeggs <bskeggs@redhat.com>2014-06-11 16:02:08 +1000
commit53c1481ae686a0295edf97ee3ba3683fd5b94994 (patch)
treee1229236e5ff4f717341a5af914e3ccb1ed6a85a
parent9dd7079a34c0a7b6ce7e9179241b3af1cb9e76ce (diff)
gpio: send separate event types for high/low transitions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drm/nouveau_connector.c2
-rw-r--r--nvkm/include/subdev/gpio.h6
-rw-r--r--nvkm/subdev/gpio/base.c17
-rw-r--r--nvkm/subdev/gpio/priv.h6
4 files changed, 17 insertions, 14 deletions
diff --git a/drm/nouveau_connector.c b/drm/nouveau_connector.c
index 0f3fdc66..4a162a42 100644
--- a/drm/nouveau_connector.c
+++ b/drm/nouveau_connector.c
@@ -1013,7 +1013,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
nv_connector->hpd.func = DCB_GPIO_UNUSED;
if (nv_connector->hpd.func != DCB_GPIO_UNUSED) {
- nouveau_event_new(gpio->events, 1,
+ nouveau_event_new(gpio->events, NVKM_GPIO_TOGGLED,
nv_connector->hpd.line,
nouveau_connector_hotplug,
nv_connector,
diff --git a/nvkm/include/subdev/gpio.h b/nvkm/include/subdev/gpio.h
index 2e2effa6..612d82ab 100644
--- a/nvkm/include/subdev/gpio.h
+++ b/nvkm/include/subdev/gpio.h
@@ -8,6 +8,12 @@
#include <subdev/bios.h>
#include <subdev/bios/gpio.h>
+enum nvkm_gpio_event {
+ NVKM_GPIO_HI = 1,
+ NVKM_GPIO_LO = 2,
+ NVKM_GPIO_TOGGLED = (NVKM_GPIO_HI | NVKM_GPIO_LO),
+};
+
struct nouveau_gpio {
struct nouveau_subdev base;
diff --git a/nvkm/subdev/gpio/base.c b/nvkm/subdev/gpio/base.c
index e43bc9f0..45e0202f 100644
--- a/nvkm/subdev/gpio/base.c
+++ b/nvkm/subdev/gpio/base.c
@@ -110,7 +110,7 @@ nouveau_gpio_intr_disable(struct nouveau_event *event, int type, int index)
{
struct nouveau_gpio *gpio = nouveau_gpio(event->priv);
const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass;
- impl->intr_mask(gpio, NVKM_GPIO_TOGGLED, 1 << index, 0);
+ impl->intr_mask(gpio, type, 1 << index, 0);
}
static void
@@ -118,7 +118,7 @@ nouveau_gpio_intr_enable(struct nouveau_event *event, int type, int index)
{
struct nouveau_gpio *gpio = nouveau_gpio(event->priv);
const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass;
- impl->intr_mask(gpio, NVKM_GPIO_TOGGLED, 1 << index, 1 << index);
+ impl->intr_mask(gpio, type, 1 << index, 1 << index);
}
static void
@@ -126,13 +126,16 @@ nouveau_gpio_intr(struct nouveau_subdev *subdev)
{
struct nouveau_gpio *gpio = nouveau_gpio(subdev);
const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass;
- u32 hi, lo, i;
+ u32 hi, lo, e, i;
impl->intr_stat(gpio, &hi, &lo);
- for (i = 0; (hi | lo) && i < impl->lines; i++) {
- if ((hi | lo) & (1 << i))
- nouveau_event_trigger(gpio->events, 1, i);
+ for (i = 0; e = 0, (hi | lo) && i < impl->lines; i++) {
+ if (hi & (1 << i))
+ e |= NVKM_GPIO_HI;
+ if (lo & (1 << i))
+ e |= NVKM_GPIO_LO;
+ nouveau_event_trigger(gpio->events, e, i);
}
}
@@ -205,7 +208,7 @@ nouveau_gpio_create_(struct nouveau_object *parent,
gpio->get = nouveau_gpio_get;
gpio->reset = impl->reset;
- ret = nouveau_event_create(1, impl->lines, &gpio->events);
+ ret = nouveau_event_create(2, impl->lines, &gpio->events);
if (ret)
return ret;
diff --git a/nvkm/subdev/gpio/priv.h b/nvkm/subdev/gpio/priv.h
index 5c023983..e1724dfc 100644
--- a/nvkm/subdev/gpio/priv.h
+++ b/nvkm/subdev/gpio/priv.h
@@ -27,12 +27,6 @@ void _nouveau_gpio_dtor(struct nouveau_object *);
int _nouveau_gpio_init(struct nouveau_object *);
int _nouveau_gpio_fini(struct nouveau_object *, bool);
-enum nvkm_gpio_event {
- NVKM_GPIO_HI = 1,
- NVKM_GPIO_LO = 2,
- NVKM_GPIO_TOGGLED = (NVKM_GPIO_HI | NVKM_GPIO_LO),
-};
-
struct nouveau_gpio_impl {
struct nouveau_oclass base;
int lines;