diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-11-21 22:49:22 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-12-21 04:01:45 -0500 |
commit | 47e5d5cb83d4b41168f4afa1ca32843d4a126cc8 (patch) | |
tree | 4081ca722b80a39dffc0b64b4e23fc1abd6181a3 | |
parent | a0b25635515ef5049f93b032a1e37f18b16e0f6f (diff) |
drm/nv40/disp: implement support for hotplug irq
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_display.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv10_gpio.c | 41 |
3 files changed, 52 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index c4edba6a457d..57ccda47a70b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -273,8 +273,11 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
273 | engine->display.destroy = nv04_display_destroy; | 273 | engine->display.destroy = nv04_display_destroy; |
274 | engine->display.init = nv04_display_init; | 274 | engine->display.init = nv04_display_init; |
275 | engine->display.fini = nv04_display_fini; | 275 | engine->display.fini = nv04_display_fini; |
276 | engine->gpio.init = nv10_gpio_init; | ||
277 | engine->gpio.fini = nv10_gpio_fini; | ||
276 | engine->gpio.drive = nv10_gpio_drive; | 278 | engine->gpio.drive = nv10_gpio_drive; |
277 | engine->gpio.sense = nv10_gpio_sense; | 279 | engine->gpio.sense = nv10_gpio_sense; |
280 | engine->gpio.irq_enable = nv10_gpio_irq_enable; | ||
278 | engine->pm.clocks_get = nv40_pm_clocks_get; | 281 | engine->pm.clocks_get = nv40_pm_clocks_get; |
279 | engine->pm.clocks_pre = nv40_pm_clocks_pre; | 282 | engine->pm.clocks_pre = nv40_pm_clocks_pre; |
280 | engine->pm.clocks_set = nv40_pm_clocks_set; | 283 | engine->pm.clocks_set = nv40_pm_clocks_set; |
diff --git a/drivers/gpu/drm/nouveau/nv04_display.c b/drivers/gpu/drm/nouveau/nv04_display.c index 7047d37e8dab..15b748f0ea4b 100644 --- a/drivers/gpu/drm/nouveau/nv04_display.c +++ b/drivers/gpu/drm/nouveau/nv04_display.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "nouveau_hw.h" | 31 | #include "nouveau_hw.h" |
32 | #include "nouveau_encoder.h" | 32 | #include "nouveau_encoder.h" |
33 | #include "nouveau_connector.h" | 33 | #include "nouveau_connector.h" |
34 | #include "nouveau_gpio.h" | ||
34 | 35 | ||
35 | static void nv04_vblank_crtc0_isr(struct drm_device *); | 36 | static void nv04_vblank_crtc0_isr(struct drm_device *); |
36 | static void nv04_vblank_crtc1_isr(struct drm_device *); | 37 | static void nv04_vblank_crtc1_isr(struct drm_device *); |
@@ -220,6 +221,7 @@ nv04_display_destroy(struct drm_device *dev) | |||
220 | int | 221 | int |
221 | nv04_display_init(struct drm_device *dev) | 222 | nv04_display_init(struct drm_device *dev) |
222 | { | 223 | { |
224 | struct drm_connector *connector; | ||
223 | struct drm_encoder *encoder; | 225 | struct drm_encoder *encoder; |
224 | struct drm_crtc *crtc; | 226 | struct drm_crtc *crtc; |
225 | 227 | ||
@@ -240,6 +242,12 @@ nv04_display_init(struct drm_device *dev) | |||
240 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | 242 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
241 | crtc->funcs->restore(crtc); | 243 | crtc->funcs->restore(crtc); |
242 | 244 | ||
245 | /* enable hotplug interrupts */ | ||
246 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
247 | struct nouveau_connector *conn = nouveau_connector(connector); | ||
248 | nouveau_gpio_irq(dev, 0, conn->hpd, 0xff, true); | ||
249 | } | ||
250 | |||
243 | return 0; | 251 | return 0; |
244 | } | 252 | } |
245 | 253 | ||
diff --git a/drivers/gpu/drm/nouveau/nv10_gpio.c b/drivers/gpu/drm/nouveau/nv10_gpio.c index 419d6495649b..550ad3fcf0af 100644 --- a/drivers/gpu/drm/nouveau/nv10_gpio.c +++ b/drivers/gpu/drm/nouveau/nv10_gpio.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "drmP.h" | 27 | #include "drmP.h" |
28 | #include "nouveau_drv.h" | 28 | #include "nouveau_drv.h" |
29 | #include "nouveau_hw.h" | 29 | #include "nouveau_hw.h" |
30 | #include "nouveau_gpio.h" | ||
30 | 31 | ||
31 | int | 32 | int |
32 | nv10_gpio_sense(struct drm_device *dev, int line) | 33 | nv10_gpio_sense(struct drm_device *dev, int line) |
@@ -80,3 +81,43 @@ nv10_gpio_drive(struct drm_device *dev, int line, int dir, int out) | |||
80 | NVWriteCRTC(dev, 0, reg, mask | (data << line)); | 81 | NVWriteCRTC(dev, 0, reg, mask | (data << line)); |
81 | return 0; | 82 | return 0; |
82 | } | 83 | } |
84 | |||
85 | void | ||
86 | nv10_gpio_irq_enable(struct drm_device *dev, int line, bool on) | ||
87 | { | ||
88 | u32 mask = 0x00010001 << line; | ||
89 | |||
90 | nv_wr32(dev, 0x001104, mask); | ||
91 | nv_mask(dev, 0x001144, mask, on ? mask : 0); | ||
92 | } | ||
93 | |||
94 | static void | ||
95 | nv10_gpio_isr(struct drm_device *dev) | ||
96 | { | ||
97 | u32 intr = nv_rd32(dev, 0x1104); | ||
98 | u32 hi = (intr & 0x0000ffff) >> 0; | ||
99 | u32 lo = (intr & 0xffff0000) >> 16; | ||
100 | |||
101 | nouveau_gpio_isr(dev, 0, hi | lo); | ||
102 | |||
103 | nv_wr32(dev, 0x001104, intr); | ||
104 | } | ||
105 | |||
106 | int | ||
107 | nv10_gpio_init(struct drm_device *dev) | ||
108 | { | ||
109 | nv_wr32(dev, 0x001140, 0x00000000); | ||
110 | nv_wr32(dev, 0x001100, 0xffffffff); | ||
111 | nv_wr32(dev, 0x001144, 0x00000000); | ||
112 | nv_wr32(dev, 0x001104, 0xffffffff); | ||
113 | nouveau_irq_register(dev, 28, nv10_gpio_isr); /* PBUS */ | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | void | ||
118 | nv10_gpio_fini(struct drm_device *dev) | ||
119 | { | ||
120 | nv_wr32(dev, 0x001140, 0x00000000); | ||
121 | nv_wr32(dev, 0x001144, 0x00000000); | ||
122 | nouveau_irq_unregister(dev, 28); | ||
123 | } | ||