aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_connector.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_connector.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c129
1 files changed, 75 insertions, 54 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 5dbf2e45993d..702e2a74d2d1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -31,14 +31,29 @@
31#include "drm_crtc_helper.h" 31#include "drm_crtc_helper.h"
32 32
33#include "nouveau_reg.h" 33#include "nouveau_reg.h"
34#include "nouveau_drv.h" 34#include "nouveau_drm.h"
35#include "nouveau_encoder.h"
36#include "nouveau_crtc.h"
37#include "nouveau_connector.h"
38#include "nouveau_hw.h" 35#include "nouveau_hw.h"
39#include "nouveau_acpi.h" 36#include "nouveau_acpi.h"
40 37
41#include <subdev/bios/gpio.h> 38#include "nouveau_display.h"
39#include "nouveau_connector.h"
40#include "nouveau_encoder.h"
41#include "nouveau_crtc.h"
42
43#include <subdev/i2c.h>
44#include <subdev/gpio.h>
45
46MODULE_PARM_DESC(tv_disable, "Disable TV-out detection");
47static int nouveau_tv_disable = 0;
48module_param_named(tv_disable, nouveau_tv_disable, int, 0400);
49
50MODULE_PARM_DESC(ignorelid, "Ignore ACPI lid status");
51static int nouveau_ignorelid = 0;
52module_param_named(ignorelid, nouveau_ignorelid, int, 0400);
53
54MODULE_PARM_DESC(duallink, "Allow dual-link TMDS (default: enabled)");
55static int nouveau_duallink = 1;
56module_param_named(duallink, nouveau_duallink, int, 0400);
42 57
43static void nouveau_connector_hotplug(void *, int); 58static void nouveau_connector_hotplug(void *, int);
44 59
@@ -85,19 +100,21 @@ static void
85nouveau_connector_destroy(struct drm_connector *connector) 100nouveau_connector_destroy(struct drm_connector *connector)
86{ 101{
87 struct nouveau_connector *nv_connector = nouveau_connector(connector); 102 struct nouveau_connector *nv_connector = nouveau_connector(connector);
88 struct drm_nouveau_private *dev_priv; 103 struct nouveau_gpio *gpio;
104 struct nouveau_drm *drm;
89 struct drm_device *dev; 105 struct drm_device *dev;
90 106
91 if (!nv_connector) 107 if (!nv_connector)
92 return; 108 return;
93 109
94 dev = nv_connector->base.dev; 110 dev = nv_connector->base.dev;
95 dev_priv = dev->dev_private; 111 drm = nouveau_drm(dev);
96 NV_DEBUG_KMS(dev, "\n"); 112 gpio = nouveau_gpio(drm->device);
113 NV_DEBUG(drm, "\n");
97 114
98 if (nv_connector->hpd != DCB_GPIO_UNUSED) { 115 if (gpio && nv_connector->hpd != DCB_GPIO_UNUSED) {
99 nouveau_gpio_isr_del(dev, 0, nv_connector->hpd, 0xff, 116 gpio->isr_del(gpio, 0, nv_connector->hpd, 0xff,
100 nouveau_connector_hotplug, connector); 117 nouveau_connector_hotplug, connector);
101 } 118 }
102 119
103 kfree(nv_connector->edid); 120 kfree(nv_connector->edid);
@@ -111,10 +128,12 @@ nouveau_connector_ddc_detect(struct drm_connector *connector,
111 struct nouveau_encoder **pnv_encoder) 128 struct nouveau_encoder **pnv_encoder)
112{ 129{
113 struct drm_device *dev = connector->dev; 130 struct drm_device *dev = connector->dev;
131 struct nouveau_drm *drm = nouveau_drm(dev);
132 struct nouveau_i2c *i2c = nouveau_i2c(drm->device);
114 int i; 133 int i;
115 134
116 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { 135 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
117 struct nouveau_i2c_port *i2c = NULL; 136 struct nouveau_i2c_port *port = NULL;
118 struct nouveau_encoder *nv_encoder; 137 struct nouveau_encoder *nv_encoder;
119 struct drm_mode_object *obj; 138 struct drm_mode_object *obj;
120 int id; 139 int id;
@@ -129,11 +148,10 @@ nouveau_connector_ddc_detect(struct drm_connector *connector,
129 nv_encoder = nouveau_encoder(obj_to_encoder(obj)); 148 nv_encoder = nouveau_encoder(obj_to_encoder(obj));
130 149
131 if (nv_encoder->dcb->i2c_index < 0xf) 150 if (nv_encoder->dcb->i2c_index < 0xf)
132 i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index); 151 port = i2c->find(i2c, nv_encoder->dcb->i2c_index);
133 152 if (port && nv_probe_i2c(port, 0x50)) {
134 if (i2c && nouveau_probe_i2c_addr(i2c, 0x50)) {
135 *pnv_encoder = nv_encoder; 153 *pnv_encoder = nv_encoder;
136 return i2c; 154 return port;
137 } 155 }
138 } 156 }
139 157
@@ -175,14 +193,14 @@ nouveau_connector_set_encoder(struct drm_connector *connector,
175 struct nouveau_encoder *nv_encoder) 193 struct nouveau_encoder *nv_encoder)
176{ 194{
177 struct nouveau_connector *nv_connector = nouveau_connector(connector); 195 struct nouveau_connector *nv_connector = nouveau_connector(connector);
178 struct drm_nouveau_private *dev_priv = connector->dev->dev_private; 196 struct nouveau_drm *drm = nouveau_drm(connector->dev);
179 struct drm_device *dev = connector->dev; 197 struct drm_device *dev = connector->dev;
180 198
181 if (nv_connector->detected_encoder == nv_encoder) 199 if (nv_connector->detected_encoder == nv_encoder)
182 return; 200 return;
183 nv_connector->detected_encoder = nv_encoder; 201 nv_connector->detected_encoder = nv_encoder;
184 202
185 if (dev_priv->card_type >= NV_50) { 203 if (nv_device(drm->device)->card_type >= NV_50) {
186 connector->interlace_allowed = true; 204 connector->interlace_allowed = true;
187 connector->doublescan_allowed = true; 205 connector->doublescan_allowed = true;
188 } else 206 } else
@@ -192,8 +210,8 @@ nouveau_connector_set_encoder(struct drm_connector *connector,
192 connector->interlace_allowed = false; 210 connector->interlace_allowed = false;
193 } else { 211 } else {
194 connector->doublescan_allowed = true; 212 connector->doublescan_allowed = true;
195 if (dev_priv->card_type == NV_20 || 213 if (nv_device(drm->device)->card_type == NV_20 ||
196 (dev_priv->card_type == NV_10 && 214 (nv_device(drm->device)->card_type == NV_10 &&
197 (dev->pci_device & 0x0ff0) != 0x0100 && 215 (dev->pci_device & 0x0ff0) != 0x0100 &&
198 (dev->pci_device & 0x0ff0) != 0x0150)) 216 (dev->pci_device & 0x0ff0) != 0x0150))
199 /* HW is broken */ 217 /* HW is broken */
@@ -215,6 +233,7 @@ static enum drm_connector_status
215nouveau_connector_detect(struct drm_connector *connector, bool force) 233nouveau_connector_detect(struct drm_connector *connector, bool force)
216{ 234{
217 struct drm_device *dev = connector->dev; 235 struct drm_device *dev = connector->dev;
236 struct nouveau_drm *drm = nouveau_drm(dev);
218 struct nouveau_connector *nv_connector = nouveau_connector(connector); 237 struct nouveau_connector *nv_connector = nouveau_connector(connector);
219 struct nouveau_encoder *nv_encoder = NULL; 238 struct nouveau_encoder *nv_encoder = NULL;
220 struct nouveau_encoder *nv_partner; 239 struct nouveau_encoder *nv_partner;
@@ -230,18 +249,18 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
230 249
231 i2c = nouveau_connector_ddc_detect(connector, &nv_encoder); 250 i2c = nouveau_connector_ddc_detect(connector, &nv_encoder);
232 if (i2c) { 251 if (i2c) {
233 nv_connector->edid = drm_get_edid(connector, nouveau_i2c_adapter(i2c)); 252 nv_connector->edid = drm_get_edid(connector, &i2c->adapter);
234 drm_mode_connector_update_edid_property(connector, 253 drm_mode_connector_update_edid_property(connector,
235 nv_connector->edid); 254 nv_connector->edid);
236 if (!nv_connector->edid) { 255 if (!nv_connector->edid) {
237 NV_ERROR(dev, "DDC responded, but no EDID for %s\n", 256 NV_ERROR(drm, "DDC responded, but no EDID for %s\n",
238 drm_get_connector_name(connector)); 257 drm_get_connector_name(connector));
239 goto detect_analog; 258 goto detect_analog;
240 } 259 }
241 260
242 if (nv_encoder->dcb->type == DCB_OUTPUT_DP && 261 if (nv_encoder->dcb->type == DCB_OUTPUT_DP &&
243 !nouveau_dp_detect(to_drm_encoder(nv_encoder))) { 262 !nouveau_dp_detect(to_drm_encoder(nv_encoder))) {
244 NV_ERROR(dev, "Detected %s, but failed init\n", 263 NV_ERROR(drm, "Detected %s, but failed init\n",
245 drm_get_connector_name(connector)); 264 drm_get_connector_name(connector));
246 return connector_status_disconnected; 265 return connector_status_disconnected;
247 } 266 }
@@ -303,7 +322,7 @@ static enum drm_connector_status
303nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) 322nouveau_connector_detect_lvds(struct drm_connector *connector, bool force)
304{ 323{
305 struct drm_device *dev = connector->dev; 324 struct drm_device *dev = connector->dev;
306 struct drm_nouveau_private *dev_priv = dev->dev_private; 325 struct nouveau_drm *drm = nouveau_drm(dev);
307 struct nouveau_connector *nv_connector = nouveau_connector(connector); 326 struct nouveau_connector *nv_connector = nouveau_connector(connector);
308 struct nouveau_encoder *nv_encoder = NULL; 327 struct nouveau_encoder *nv_encoder = NULL;
309 enum drm_connector_status status = connector_status_disconnected; 328 enum drm_connector_status status = connector_status_disconnected;
@@ -320,7 +339,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force)
320 return connector_status_disconnected; 339 return connector_status_disconnected;
321 340
322 /* Try retrieving EDID via DDC */ 341 /* Try retrieving EDID via DDC */
323 if (!dev_priv->vbios.fp_no_ddc) { 342 if (!drm->vbios.fp_no_ddc) {
324 status = nouveau_connector_detect(connector, force); 343 status = nouveau_connector_detect(connector, force);
325 if (status == connector_status_connected) 344 if (status == connector_status_connected)
326 goto out; 345 goto out;
@@ -346,7 +365,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force)
346 * modeline is avalilable for the panel, set it as the panel's 365 * modeline is avalilable for the panel, set it as the panel's
347 * native mode and exit. 366 * native mode and exit.
348 */ 367 */
349 if (nouveau_bios_fp_mode(dev, NULL) && (dev_priv->vbios.fp_no_ddc || 368 if (nouveau_bios_fp_mode(dev, NULL) && (drm->vbios.fp_no_ddc ||
350 nv_encoder->dcb->lvdsconf.use_straps_for_mode)) { 369 nv_encoder->dcb->lvdsconf.use_straps_for_mode)) {
351 status = connector_status_connected; 370 status = connector_status_connected;
352 goto out; 371 goto out;
@@ -355,7 +374,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force)
355 /* Still nothing, some VBIOS images have a hardcoded EDID block 374 /* Still nothing, some VBIOS images have a hardcoded EDID block
356 * stored for the panel stored in them. 375 * stored for the panel stored in them.
357 */ 376 */
358 if (!dev_priv->vbios.fp_no_ddc) { 377 if (!drm->vbios.fp_no_ddc) {
359 struct edid *edid = 378 struct edid *edid =
360 (struct edid *)nouveau_bios_embedded_edid(dev); 379 (struct edid *)nouveau_bios_embedded_edid(dev);
361 if (edid) { 380 if (edid) {
@@ -381,6 +400,7 @@ out:
381static void 400static void
382nouveau_connector_force(struct drm_connector *connector) 401nouveau_connector_force(struct drm_connector *connector)
383{ 402{
403 struct nouveau_drm *drm = nouveau_drm(connector->dev);
384 struct nouveau_connector *nv_connector = nouveau_connector(connector); 404 struct nouveau_connector *nv_connector = nouveau_connector(connector);
385 struct nouveau_encoder *nv_encoder; 405 struct nouveau_encoder *nv_encoder;
386 int type; 406 int type;
@@ -395,7 +415,7 @@ nouveau_connector_force(struct drm_connector *connector)
395 415
396 nv_encoder = find_encoder(connector, type); 416 nv_encoder = find_encoder(connector, type);
397 if (!nv_encoder) { 417 if (!nv_encoder) {
398 NV_ERROR(connector->dev, "can't find encoder to force %s on!\n", 418 NV_ERROR(drm, "can't find encoder to force %s on!\n",
399 drm_get_connector_name(connector)); 419 drm_get_connector_name(connector));
400 connector->status = connector_status_disconnected; 420 connector->status = connector_status_disconnected;
401 return; 421 return;
@@ -408,8 +428,7 @@ static int
408nouveau_connector_set_property(struct drm_connector *connector, 428nouveau_connector_set_property(struct drm_connector *connector,
409 struct drm_property *property, uint64_t value) 429 struct drm_property *property, uint64_t value)
410{ 430{
411 struct drm_nouveau_private *dev_priv = connector->dev->dev_private; 431 struct nouveau_display *disp = nouveau_display(connector->dev);
412 struct nouveau_display_engine *disp = &dev_priv->engine.display;
413 struct nouveau_connector *nv_connector = nouveau_connector(connector); 432 struct nouveau_connector *nv_connector = nouveau_connector(connector);
414 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; 433 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
415 struct drm_encoder *encoder = to_drm_encoder(nv_encoder); 434 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
@@ -545,6 +564,7 @@ static struct drm_display_mode *
545nouveau_connector_native_mode(struct drm_connector *connector) 564nouveau_connector_native_mode(struct drm_connector *connector)
546{ 565{
547 struct drm_connector_helper_funcs *helper = connector->helper_private; 566 struct drm_connector_helper_funcs *helper = connector->helper_private;
567 struct nouveau_drm *drm = nouveau_drm(connector->dev);
548 struct nouveau_connector *nv_connector = nouveau_connector(connector); 568 struct nouveau_connector *nv_connector = nouveau_connector(connector);
549 struct drm_device *dev = connector->dev; 569 struct drm_device *dev = connector->dev;
550 struct drm_display_mode *mode, *largest = NULL; 570 struct drm_display_mode *mode, *largest = NULL;
@@ -558,7 +578,7 @@ nouveau_connector_native_mode(struct drm_connector *connector)
558 578
559 /* Use preferred mode if there is one.. */ 579 /* Use preferred mode if there is one.. */
560 if (mode->type & DRM_MODE_TYPE_PREFERRED) { 580 if (mode->type & DRM_MODE_TYPE_PREFERRED) {
561 NV_DEBUG_KMS(dev, "native mode from preferred\n"); 581 NV_DEBUG(drm, "native mode from preferred\n");
562 return drm_mode_duplicate(dev, mode); 582 return drm_mode_duplicate(dev, mode);
563 } 583 }
564 584
@@ -581,7 +601,7 @@ nouveau_connector_native_mode(struct drm_connector *connector)
581 largest = mode; 601 largest = mode;
582 } 602 }
583 603
584 NV_DEBUG_KMS(dev, "native mode from largest: %dx%d@%d\n", 604 NV_DEBUG(drm, "native mode from largest: %dx%d@%d\n",
585 high_w, high_h, high_v); 605 high_w, high_h, high_v);
586 return largest ? drm_mode_duplicate(dev, largest) : NULL; 606 return largest ? drm_mode_duplicate(dev, largest) : NULL;
587} 607}
@@ -645,10 +665,10 @@ nouveau_connector_scaler_modes_add(struct drm_connector *connector)
645static void 665static void
646nouveau_connector_detect_depth(struct drm_connector *connector) 666nouveau_connector_detect_depth(struct drm_connector *connector)
647{ 667{
648 struct drm_nouveau_private *dev_priv = connector->dev->dev_private; 668 struct nouveau_drm *drm = nouveau_drm(connector->dev);
649 struct nouveau_connector *nv_connector = nouveau_connector(connector); 669 struct nouveau_connector *nv_connector = nouveau_connector(connector);
650 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; 670 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
651 struct nvbios *bios = &dev_priv->vbios; 671 struct nvbios *bios = &drm->vbios;
652 struct drm_display_mode *mode = nv_connector->native_mode; 672 struct drm_display_mode *mode = nv_connector->native_mode;
653 bool duallink; 673 bool duallink;
654 674
@@ -695,7 +715,7 @@ static int
695nouveau_connector_get_modes(struct drm_connector *connector) 715nouveau_connector_get_modes(struct drm_connector *connector)
696{ 716{
697 struct drm_device *dev = connector->dev; 717 struct drm_device *dev = connector->dev;
698 struct drm_nouveau_private *dev_priv = dev->dev_private; 718 struct nouveau_drm *drm = nouveau_drm(dev);
699 struct nouveau_connector *nv_connector = nouveau_connector(connector); 719 struct nouveau_connector *nv_connector = nouveau_connector(connector);
700 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; 720 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
701 struct drm_encoder *encoder = to_drm_encoder(nv_encoder); 721 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
@@ -713,7 +733,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
713 else 733 else
714 if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS && 734 if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS &&
715 (nv_encoder->dcb->lvdsconf.use_straps_for_mode || 735 (nv_encoder->dcb->lvdsconf.use_straps_for_mode ||
716 dev_priv->vbios.fp_no_ddc) && nouveau_bios_fp_mode(dev, NULL)) { 736 drm->vbios.fp_no_ddc) && nouveau_bios_fp_mode(dev, NULL)) {
717 struct drm_display_mode mode; 737 struct drm_display_mode mode;
718 738
719 nouveau_bios_fp_mode(dev, &mode); 739 nouveau_bios_fp_mode(dev, &mode);
@@ -763,15 +783,15 @@ static unsigned
763get_tmds_link_bandwidth(struct drm_connector *connector) 783get_tmds_link_bandwidth(struct drm_connector *connector)
764{ 784{
765 struct nouveau_connector *nv_connector = nouveau_connector(connector); 785 struct nouveau_connector *nv_connector = nouveau_connector(connector);
766 struct drm_nouveau_private *dev_priv = connector->dev->dev_private; 786 struct nouveau_drm *drm = nouveau_drm(connector->dev);
767 struct dcb_output *dcb = nv_connector->detected_encoder->dcb; 787 struct dcb_output *dcb = nv_connector->detected_encoder->dcb;
768 788
769 if (dcb->location != DCB_LOC_ON_CHIP || 789 if (dcb->location != DCB_LOC_ON_CHIP ||
770 dev_priv->chipset >= 0x46) 790 nv_device(drm->device)->chipset >= 0x46)
771 return 165000; 791 return 165000;
772 else if (dev_priv->chipset >= 0x40) 792 else if (nv_device(drm->device)->chipset >= 0x40)
773 return 155000; 793 return 155000;
774 else if (dev_priv->chipset >= 0x18) 794 else if (nv_device(drm->device)->chipset >= 0x18)
775 return 135000; 795 return 135000;
776 else 796 else
777 return 112000; 797 return 112000;
@@ -901,14 +921,15 @@ struct drm_connector *
901nouveau_connector_create(struct drm_device *dev, int index) 921nouveau_connector_create(struct drm_device *dev, int index)
902{ 922{
903 const struct drm_connector_funcs *funcs = &nouveau_connector_funcs; 923 const struct drm_connector_funcs *funcs = &nouveau_connector_funcs;
904 struct drm_nouveau_private *dev_priv = dev->dev_private; 924 struct nouveau_drm *drm = nouveau_drm(dev);
905 struct nouveau_display_engine *disp = &dev_priv->engine.display; 925 struct nouveau_gpio *gpio = nouveau_gpio(drm->device);
926 struct nouveau_display *disp = nouveau_display(dev);
906 struct nouveau_connector *nv_connector = NULL; 927 struct nouveau_connector *nv_connector = NULL;
907 struct drm_connector *connector; 928 struct drm_connector *connector;
908 int type, ret = 0; 929 int type, ret = 0;
909 bool dummy; 930 bool dummy;
910 931
911 NV_DEBUG_KMS(dev, "\n"); 932 NV_DEBUG(drm, "\n");
912 933
913 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 934 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
914 nv_connector = nouveau_connector(connector); 935 nv_connector = nouveau_connector(connector);
@@ -941,7 +962,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
941 nv_connector->type = nv_connector->dcb[0]; 962 nv_connector->type = nv_connector->dcb[0];
942 if (drm_conntype_from_dcb(nv_connector->type) == 963 if (drm_conntype_from_dcb(nv_connector->type) ==
943 DRM_MODE_CONNECTOR_Unknown) { 964 DRM_MODE_CONNECTOR_Unknown) {
944 NV_WARN(dev, "unknown connector type %02x\n", 965 NV_WARN(drm, "unknown connector type %02x\n",
945 nv_connector->type); 966 nv_connector->type);
946 nv_connector->type = DCB_CONNECTOR_NONE; 967 nv_connector->type = DCB_CONNECTOR_NONE;
947 } 968 }
@@ -966,8 +987,8 @@ nouveau_connector_create(struct drm_device *dev, int index)
966 * figure out something suitable ourselves 987 * figure out something suitable ourselves
967 */ 988 */
968 if (nv_connector->type == DCB_CONNECTOR_NONE) { 989 if (nv_connector->type == DCB_CONNECTOR_NONE) {
969 struct drm_nouveau_private *dev_priv = dev->dev_private; 990 struct nouveau_drm *drm = nouveau_drm(dev);
970 struct dcb_table *dcbt = &dev_priv->vbios.dcb; 991 struct dcb_table *dcbt = &drm->vbios.dcb;
971 u32 encoders = 0; 992 u32 encoders = 0;
972 int i; 993 int i;
973 994
@@ -1003,7 +1024,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
1003 if (type == DRM_MODE_CONNECTOR_LVDS) { 1024 if (type == DRM_MODE_CONNECTOR_LVDS) {
1004 ret = nouveau_bios_parse_lvds_table(dev, 0, &dummy, &dummy); 1025 ret = nouveau_bios_parse_lvds_table(dev, 0, &dummy, &dummy);
1005 if (ret) { 1026 if (ret) {
1006 NV_ERROR(dev, "Error parsing LVDS table, disabling\n"); 1027 NV_ERROR(drm, "Error parsing LVDS table, disabling\n");
1007 kfree(nv_connector); 1028 kfree(nv_connector);
1008 return ERR_PTR(ret); 1029 return ERR_PTR(ret);
1009 } 1030 }
@@ -1053,7 +1074,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
1053 1074
1054 switch (nv_connector->type) { 1075 switch (nv_connector->type) {
1055 case DCB_CONNECTOR_VGA: 1076 case DCB_CONNECTOR_VGA:
1056 if (dev_priv->card_type >= NV_50) { 1077 if (nv_device(drm->device)->card_type >= NV_50) {
1057 drm_connector_attach_property(connector, 1078 drm_connector_attach_property(connector,
1058 dev->mode_config.scaling_mode_property, 1079 dev->mode_config.scaling_mode_property,
1059 nv_connector->scaling_mode); 1080 nv_connector->scaling_mode);
@@ -1086,10 +1107,9 @@ nouveau_connector_create(struct drm_device *dev, int index)
1086 } 1107 }
1087 1108
1088 connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1109 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1089 if (nv_connector->hpd != DCB_GPIO_UNUSED) { 1110 if (gpio && nv_connector->hpd != DCB_GPIO_UNUSED) {
1090 ret = nouveau_gpio_isr_add(dev, 0, nv_connector->hpd, 0xff, 1111 ret = gpio->isr_add(gpio, 0, nv_connector->hpd, 0xff,
1091 nouveau_connector_hotplug, 1112 nouveau_connector_hotplug, connector);
1092 connector);
1093 if (ret == 0) 1113 if (ret == 0)
1094 connector->polled = DRM_CONNECTOR_POLL_HPD; 1114 connector->polled = DRM_CONNECTOR_POLL_HPD;
1095 } 1115 }
@@ -1103,8 +1123,9 @@ nouveau_connector_hotplug(void *data, int plugged)
1103{ 1123{
1104 struct drm_connector *connector = data; 1124 struct drm_connector *connector = data;
1105 struct drm_device *dev = connector->dev; 1125 struct drm_device *dev = connector->dev;
1126 struct nouveau_drm *drm = nouveau_drm(dev);
1106 1127
1107 NV_DEBUG(dev, "%splugged %s\n", plugged ? "" : "un", 1128 NV_DEBUG(drm, "%splugged %s\n", plugged ? "" : "un",
1108 drm_get_connector_name(connector)); 1129 drm_get_connector_name(connector));
1109 1130
1110 if (plugged) 1131 if (plugged)