diff options
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_gpio.c | 31 |
4 files changed, 48 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index b311faba34f8..30e723c81069 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -5884,9 +5884,15 @@ parse_dcb_gpio_table(struct nvbios *bios) | |||
5884 | } | 5884 | } |
5885 | 5885 | ||
5886 | e->line = (e->entry & 0x0000001f) >> 0; | 5886 | e->line = (e->entry & 0x0000001f) >> 0; |
5887 | e->state_default = (e->entry & 0x01000000) >> 24; | 5887 | if (gpio[0] == 0x40) { |
5888 | e->state[0] = (e->entry & 0x18000000) >> 27; | 5888 | e->state_default = (e->entry & 0x01000000) >> 24; |
5889 | e->state[1] = (e->entry & 0x60000000) >> 29; | 5889 | e->state[0] = (e->entry & 0x18000000) >> 27; |
5890 | e->state[1] = (e->entry & 0x60000000) >> 29; | ||
5891 | } else { | ||
5892 | e->state_default = (e->entry & 0x00000080) >> 7; | ||
5893 | e->state[0] = (entry[4] >> 4) & 3; | ||
5894 | e->state[1] = (entry[4] >> 6) & 3; | ||
5895 | } | ||
5890 | } | 5896 | } |
5891 | } | 5897 | } |
5892 | 5898 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 7fdfad03f96c..721845add9b2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -1391,6 +1391,8 @@ int nv50_gpio_init(struct drm_device *dev); | |||
1391 | void nv50_gpio_fini(struct drm_device *dev); | 1391 | void nv50_gpio_fini(struct drm_device *dev); |
1392 | int nv50_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); | 1392 | int nv50_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); |
1393 | int nv50_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state); | 1393 | int nv50_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state); |
1394 | int nvd0_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); | ||
1395 | int nvd0_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state); | ||
1394 | int nv50_gpio_irq_register(struct drm_device *, enum dcb_gpio_tag, | 1396 | int nv50_gpio_irq_register(struct drm_device *, enum dcb_gpio_tag, |
1395 | void (*)(void *, int), void *); | 1397 | void (*)(void *, int), void *); |
1396 | void nv50_gpio_irq_unregister(struct drm_device *, enum dcb_gpio_tag, | 1398 | void nv50_gpio_irq_unregister(struct drm_device *, enum dcb_gpio_tag, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 10b201102231..8cf42e223fc3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -459,8 +459,13 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
459 | engine->display.create = nouveau_stub_init; | 459 | engine->display.create = nouveau_stub_init; |
460 | engine->display.init = nouveau_stub_init; | 460 | engine->display.init = nouveau_stub_init; |
461 | engine->display.destroy = nouveau_stub_takedown; | 461 | engine->display.destroy = nouveau_stub_takedown; |
462 | engine->gpio.init = nouveau_stub_init; | 462 | engine->gpio.init = nv50_gpio_init; |
463 | engine->gpio.takedown = nouveau_stub_takedown; | 463 | engine->gpio.takedown = nouveau_stub_takedown; |
464 | engine->gpio.get = nvd0_gpio_get; | ||
465 | engine->gpio.set = nvd0_gpio_set; | ||
466 | engine->gpio.irq_register = nv50_gpio_irq_register; | ||
467 | engine->gpio.irq_unregister = nv50_gpio_irq_unregister; | ||
468 | engine->gpio.irq_enable = nv50_gpio_irq_enable; | ||
464 | engine->vram.init = nvc0_vram_init; | 469 | engine->vram.init = nvc0_vram_init; |
465 | engine->vram.takedown = nv50_vram_fini; | 470 | engine->vram.takedown = nv50_vram_fini; |
466 | engine->vram.get = nvc0_vram_new; | 471 | engine->vram.get = nvc0_vram_new; |
diff --git a/drivers/gpu/drm/nouveau/nv50_gpio.c b/drivers/gpu/drm/nouveau/nv50_gpio.c index d4f4206dad7e..793a5ccca121 100644 --- a/drivers/gpu/drm/nouveau/nv50_gpio.c +++ b/drivers/gpu/drm/nouveau/nv50_gpio.c | |||
@@ -98,6 +98,37 @@ nv50_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | int | 100 | int |
101 | nvd0_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag) | ||
102 | { | ||
103 | struct dcb_gpio_entry *gpio; | ||
104 | u32 v; | ||
105 | |||
106 | gpio = nouveau_bios_gpio_entry(dev, tag); | ||
107 | if (!gpio) | ||
108 | return -ENOENT; | ||
109 | |||
110 | v = nv_rd32(dev, 0x00d610 + (gpio->line * 4)); | ||
111 | v &= 0x00004000; | ||
112 | return (!!v == (gpio->state[1] & 1)); | ||
113 | } | ||
114 | |||
115 | int | ||
116 | nvd0_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state) | ||
117 | { | ||
118 | struct dcb_gpio_entry *gpio; | ||
119 | u32 v; | ||
120 | |||
121 | gpio = nouveau_bios_gpio_entry(dev, tag); | ||
122 | if (!gpio) | ||
123 | return -ENOENT; | ||
124 | |||
125 | v = gpio->state[state] ^ 2; | ||
126 | |||
127 | nv_mask(dev, 0x00d610 + (gpio->line * 4), 0x00003000, v << 12); | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | int | ||
101 | nv50_gpio_irq_register(struct drm_device *dev, enum dcb_gpio_tag tag, | 132 | nv50_gpio_irq_register(struct drm_device *dev, enum dcb_gpio_tag tag, |
102 | void (*handler)(void *, int), void *data) | 133 | void (*handler)(void *, int), void *data) |
103 | { | 134 | { |