diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-05-13 01:54:17 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-06-11 02:09:15 -0400 |
commit | 20a8007485e9272ab0e964fdecc3cbceeef9d2f4 (patch) | |
tree | a96ee3776101b2667e103118b647447418358e82 | |
parent | bc3b0c41b1caa6b12f510f300587c52275218b45 (diff) |
drm/nouveau/gpio: send separate event types for high/low transitions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/core/include/subdev/gpio.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/gpio/base.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_connector.c | 2 |
4 files changed, 17 insertions, 14 deletions
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h index 2e2effa66442..612d82ab683d 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h | |||
@@ -8,6 +8,12 @@ | |||
8 | #include <subdev/bios.h> | 8 | #include <subdev/bios.h> |
9 | #include <subdev/bios/gpio.h> | 9 | #include <subdev/bios/gpio.h> |
10 | 10 | ||
11 | enum nvkm_gpio_event { | ||
12 | NVKM_GPIO_HI = 1, | ||
13 | NVKM_GPIO_LO = 2, | ||
14 | NVKM_GPIO_TOGGLED = (NVKM_GPIO_HI | NVKM_GPIO_LO), | ||
15 | }; | ||
16 | |||
11 | struct nouveau_gpio { | 17 | struct nouveau_gpio { |
12 | struct nouveau_subdev base; | 18 | struct nouveau_subdev base; |
13 | 19 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c index e43bc9f0cf00..45e0202f3151 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c | |||
@@ -110,7 +110,7 @@ nouveau_gpio_intr_disable(struct nouveau_event *event, int type, int index) | |||
110 | { | 110 | { |
111 | struct nouveau_gpio *gpio = nouveau_gpio(event->priv); | 111 | struct nouveau_gpio *gpio = nouveau_gpio(event->priv); |
112 | const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass; | 112 | const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass; |
113 | impl->intr_mask(gpio, NVKM_GPIO_TOGGLED, 1 << index, 0); | 113 | impl->intr_mask(gpio, type, 1 << index, 0); |
114 | } | 114 | } |
115 | 115 | ||
116 | static void | 116 | static void |
@@ -118,7 +118,7 @@ nouveau_gpio_intr_enable(struct nouveau_event *event, int type, int index) | |||
118 | { | 118 | { |
119 | struct nouveau_gpio *gpio = nouveau_gpio(event->priv); | 119 | struct nouveau_gpio *gpio = nouveau_gpio(event->priv); |
120 | const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass; | 120 | const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass; |
121 | impl->intr_mask(gpio, NVKM_GPIO_TOGGLED, 1 << index, 1 << index); | 121 | impl->intr_mask(gpio, type, 1 << index, 1 << index); |
122 | } | 122 | } |
123 | 123 | ||
124 | static void | 124 | static void |
@@ -126,13 +126,16 @@ nouveau_gpio_intr(struct nouveau_subdev *subdev) | |||
126 | { | 126 | { |
127 | struct nouveau_gpio *gpio = nouveau_gpio(subdev); | 127 | struct nouveau_gpio *gpio = nouveau_gpio(subdev); |
128 | const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass; | 128 | const struct nouveau_gpio_impl *impl = (void *)nv_object(gpio)->oclass; |
129 | u32 hi, lo, i; | 129 | u32 hi, lo, e, i; |
130 | 130 | ||
131 | impl->intr_stat(gpio, &hi, &lo); | 131 | impl->intr_stat(gpio, &hi, &lo); |
132 | 132 | ||
133 | for (i = 0; (hi | lo) && i < impl->lines; i++) { | 133 | for (i = 0; e = 0, (hi | lo) && i < impl->lines; i++) { |
134 | if ((hi | lo) & (1 << i)) | 134 | if (hi & (1 << i)) |
135 | nouveau_event_trigger(gpio->events, 1, i); | 135 | e |= NVKM_GPIO_HI; |
136 | if (lo & (1 << i)) | ||
137 | e |= NVKM_GPIO_LO; | ||
138 | nouveau_event_trigger(gpio->events, e, i); | ||
136 | } | 139 | } |
137 | } | 140 | } |
138 | 141 | ||
@@ -205,7 +208,7 @@ nouveau_gpio_create_(struct nouveau_object *parent, | |||
205 | gpio->get = nouveau_gpio_get; | 208 | gpio->get = nouveau_gpio_get; |
206 | gpio->reset = impl->reset; | 209 | gpio->reset = impl->reset; |
207 | 210 | ||
208 | ret = nouveau_event_create(1, impl->lines, &gpio->events); | 211 | ret = nouveau_event_create(2, impl->lines, &gpio->events); |
209 | if (ret) | 212 | if (ret) |
210 | return ret; | 213 | return ret; |
211 | 214 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h b/drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h index 5c023983b05b..e1724dfc86ae 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h | |||
@@ -27,12 +27,6 @@ void _nouveau_gpio_dtor(struct nouveau_object *); | |||
27 | int _nouveau_gpio_init(struct nouveau_object *); | 27 | int _nouveau_gpio_init(struct nouveau_object *); |
28 | int _nouveau_gpio_fini(struct nouveau_object *, bool); | 28 | int _nouveau_gpio_fini(struct nouveau_object *, bool); |
29 | 29 | ||
30 | enum nvkm_gpio_event { | ||
31 | NVKM_GPIO_HI = 1, | ||
32 | NVKM_GPIO_LO = 2, | ||
33 | NVKM_GPIO_TOGGLED = (NVKM_GPIO_HI | NVKM_GPIO_LO), | ||
34 | }; | ||
35 | |||
36 | struct nouveau_gpio_impl { | 30 | struct nouveau_gpio_impl { |
37 | struct nouveau_oclass base; | 31 | struct nouveau_oclass base; |
38 | int lines; | 32 | int lines; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 0f3fdc66c823..4a162a426437 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -1013,7 +1013,7 @@ nouveau_connector_create(struct drm_device *dev, int index) | |||
1013 | nv_connector->hpd.func = DCB_GPIO_UNUSED; | 1013 | nv_connector->hpd.func = DCB_GPIO_UNUSED; |
1014 | 1014 | ||
1015 | if (nv_connector->hpd.func != DCB_GPIO_UNUSED) { | 1015 | if (nv_connector->hpd.func != DCB_GPIO_UNUSED) { |
1016 | nouveau_event_new(gpio->events, 1, | 1016 | nouveau_event_new(gpio->events, NVKM_GPIO_TOGGLED, |
1017 | nv_connector->hpd.line, | 1017 | nv_connector->hpd.line, |
1018 | nouveau_connector_hotplug, | 1018 | nouveau_connector_hotplug, |
1019 | nv_connector, | 1019 | nv_connector, |