diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-07-10 20:44:20 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-02 23:12:47 -0400 |
commit | cb75d97e9c77743ecfcc43375be135a55a4d9b25 (patch) | |
tree | e7903f00db28b25a88d295dcc863f14b3d3bd707 /drivers/gpu/drm/nouveau/nvd0_display.c | |
parent | 70790f4f819875e8f390871fd15bbbf823f28e1b (diff) |
drm/nouveau: implement devinit subdev, and new init table parser
v2:
- make sure not to execute display scripts unless resuming
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvd0_display.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvd0_display.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c index 8a2fc89b7763..d26dd02f3d13 100644 --- a/drivers/gpu/drm/nouveau/nvd0_display.c +++ b/drivers/gpu/drm/nouveau/nvd0_display.c | |||
@@ -1063,7 +1063,7 @@ static const struct drm_encoder_funcs nvd0_dac_func = { | |||
1063 | }; | 1063 | }; |
1064 | 1064 | ||
1065 | static int | 1065 | static int |
1066 | nvd0_dac_create(struct drm_connector *connector, struct dcb_entry *dcbe) | 1066 | nvd0_dac_create(struct drm_connector *connector, struct dcb_output *dcbe) |
1067 | { | 1067 | { |
1068 | struct drm_device *dev = connector->dev; | 1068 | struct drm_device *dev = connector->dev; |
1069 | struct nouveau_encoder *nv_encoder; | 1069 | struct nouveau_encoder *nv_encoder; |
@@ -1191,14 +1191,14 @@ nvd0_hdmi_disconnect(struct drm_encoder *encoder) | |||
1191 | * SOR | 1191 | * SOR |
1192 | *****************************************************************************/ | 1192 | *****************************************************************************/ |
1193 | static inline u32 | 1193 | static inline u32 |
1194 | nvd0_sor_dp_lane_map(struct drm_device *dev, struct dcb_entry *dcb, u8 lane) | 1194 | nvd0_sor_dp_lane_map(struct drm_device *dev, struct dcb_output *dcb, u8 lane) |
1195 | { | 1195 | { |
1196 | static const u8 nvd0[] = { 16, 8, 0, 24 }; | 1196 | static const u8 nvd0[] = { 16, 8, 0, 24 }; |
1197 | return nvd0[lane]; | 1197 | return nvd0[lane]; |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | static void | 1200 | static void |
1201 | nvd0_sor_dp_train_set(struct drm_device *dev, struct dcb_entry *dcb, u8 pattern) | 1201 | nvd0_sor_dp_train_set(struct drm_device *dev, struct dcb_output *dcb, u8 pattern) |
1202 | { | 1202 | { |
1203 | const u32 or = ffs(dcb->or) - 1, link = !(dcb->sorconf.link & 1); | 1203 | const u32 or = ffs(dcb->or) - 1, link = !(dcb->sorconf.link & 1); |
1204 | const u32 loff = (or * 0x800) + (link * 0x80); | 1204 | const u32 loff = (or * 0x800) + (link * 0x80); |
@@ -1206,7 +1206,7 @@ nvd0_sor_dp_train_set(struct drm_device *dev, struct dcb_entry *dcb, u8 pattern) | |||
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | static void | 1208 | static void |
1209 | nvd0_sor_dp_train_adj(struct drm_device *dev, struct dcb_entry *dcb, | 1209 | nvd0_sor_dp_train_adj(struct drm_device *dev, struct dcb_output *dcb, |
1210 | u8 lane, u8 swing, u8 preem) | 1210 | u8 lane, u8 swing, u8 preem) |
1211 | { | 1211 | { |
1212 | const u32 or = ffs(dcb->or) - 1, link = !(dcb->sorconf.link & 1); | 1212 | const u32 or = ffs(dcb->or) - 1, link = !(dcb->sorconf.link & 1); |
@@ -1247,7 +1247,7 @@ nvd0_sor_dp_train_adj(struct drm_device *dev, struct dcb_entry *dcb, | |||
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | static void | 1249 | static void |
1250 | nvd0_sor_dp_link_set(struct drm_device *dev, struct dcb_entry *dcb, int crtc, | 1250 | nvd0_sor_dp_link_set(struct drm_device *dev, struct dcb_output *dcb, int crtc, |
1251 | int link_nr, u32 link_bw, bool enhframe) | 1251 | int link_nr, u32 link_bw, bool enhframe) |
1252 | { | 1252 | { |
1253 | const u32 or = ffs(dcb->or) - 1, link = !(dcb->sorconf.link & 1); | 1253 | const u32 or = ffs(dcb->or) - 1, link = !(dcb->sorconf.link & 1); |
@@ -1290,7 +1290,7 @@ nvd0_sor_dp_link_set(struct drm_device *dev, struct dcb_entry *dcb, int crtc, | |||
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | static void | 1292 | static void |
1293 | nvd0_sor_dp_link_get(struct drm_device *dev, struct dcb_entry *dcb, | 1293 | nvd0_sor_dp_link_get(struct drm_device *dev, struct dcb_output *dcb, |
1294 | u32 *link_nr, u32 *link_bw) | 1294 | u32 *link_nr, u32 *link_bw) |
1295 | { | 1295 | { |
1296 | const u32 or = ffs(dcb->or) - 1, link = !(dcb->sorconf.link & 1); | 1296 | const u32 or = ffs(dcb->or) - 1, link = !(dcb->sorconf.link & 1); |
@@ -1308,7 +1308,7 @@ nvd0_sor_dp_link_get(struct drm_device *dev, struct dcb_entry *dcb, | |||
1308 | } | 1308 | } |
1309 | 1309 | ||
1310 | static void | 1310 | static void |
1311 | nvd0_sor_dp_calc_tu(struct drm_device *dev, struct dcb_entry *dcb, | 1311 | nvd0_sor_dp_calc_tu(struct drm_device *dev, struct dcb_output *dcb, |
1312 | u32 crtc, u32 datarate) | 1312 | u32 crtc, u32 datarate) |
1313 | { | 1313 | { |
1314 | const u32 symbol = 100000; | 1314 | const u32 symbol = 100000; |
@@ -1366,7 +1366,7 @@ nvd0_sor_dpms(struct drm_encoder *encoder, int mode) | |||
1366 | nv_wait(dev, 0x61c004 + (or * 0x0800), 0x80000000, 0x00000000); | 1366 | nv_wait(dev, 0x61c004 + (or * 0x0800), 0x80000000, 0x00000000); |
1367 | nv_wait(dev, 0x61c030 + (or * 0x0800), 0x10000000, 0x00000000); | 1367 | nv_wait(dev, 0x61c030 + (or * 0x0800), 0x10000000, 0x00000000); |
1368 | 1368 | ||
1369 | if (nv_encoder->dcb->type == OUTPUT_DP) { | 1369 | if (nv_encoder->dcb->type == DCB_OUTPUT_DP) { |
1370 | struct dp_train_func func = { | 1370 | struct dp_train_func func = { |
1371 | .link_set = nvd0_sor_dp_link_set, | 1371 | .link_set = nvd0_sor_dp_link_set, |
1372 | .train_set = nvd0_sor_dp_train_set, | 1372 | .train_set = nvd0_sor_dp_train_set, |
@@ -1427,7 +1427,7 @@ static void | |||
1427 | nvd0_sor_prepare(struct drm_encoder *encoder) | 1427 | nvd0_sor_prepare(struct drm_encoder *encoder) |
1428 | { | 1428 | { |
1429 | nvd0_sor_disconnect(encoder); | 1429 | nvd0_sor_disconnect(encoder); |
1430 | if (nouveau_encoder(encoder)->dcb->type == OUTPUT_DP) | 1430 | if (nouveau_encoder(encoder)->dcb->type == DCB_OUTPUT_DP) |
1431 | evo_sync(encoder->dev, EVO_MASTER); | 1431 | evo_sync(encoder->dev, EVO_MASTER); |
1432 | } | 1432 | } |
1433 | 1433 | ||
@@ -1462,7 +1462,7 @@ nvd0_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, | |||
1462 | 1462 | ||
1463 | nv_connector = nouveau_encoder_connector_get(nv_encoder); | 1463 | nv_connector = nouveau_encoder_connector_get(nv_encoder); |
1464 | switch (nv_encoder->dcb->type) { | 1464 | switch (nv_encoder->dcb->type) { |
1465 | case OUTPUT_TMDS: | 1465 | case DCB_OUTPUT_TMDS: |
1466 | if (nv_encoder->dcb->sorconf.link & 1) { | 1466 | if (nv_encoder->dcb->sorconf.link & 1) { |
1467 | if (mode->clock < 165000) | 1467 | if (mode->clock < 165000) |
1468 | mode_ctrl |= 0x00000100; | 1468 | mode_ctrl |= 0x00000100; |
@@ -1478,7 +1478,7 @@ nvd0_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, | |||
1478 | 1478 | ||
1479 | nvd0_hdmi_mode_set(encoder, mode); | 1479 | nvd0_hdmi_mode_set(encoder, mode); |
1480 | break; | 1480 | break; |
1481 | case OUTPUT_LVDS: | 1481 | case DCB_OUTPUT_LVDS: |
1482 | or_config = (mode_ctrl & 0x00000f00) >> 8; | 1482 | or_config = (mode_ctrl & 0x00000f00) >> 8; |
1483 | if (bios->fp_no_ddc) { | 1483 | if (bios->fp_no_ddc) { |
1484 | if (bios->fp.dual_link) | 1484 | if (bios->fp.dual_link) |
@@ -1507,7 +1507,7 @@ nvd0_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, | |||
1507 | 1507 | ||
1508 | } | 1508 | } |
1509 | break; | 1509 | break; |
1510 | case OUTPUT_DP: | 1510 | case DCB_OUTPUT_DP: |
1511 | if (nv_connector->base.display_info.bpc == 6) { | 1511 | if (nv_connector->base.display_info.bpc == 6) { |
1512 | nv_encoder->dp.datarate = mode->clock * 18 / 8; | 1512 | nv_encoder->dp.datarate = mode->clock * 18 / 8; |
1513 | syncs |= 0x00000002 << 6; | 1513 | syncs |= 0x00000002 << 6; |
@@ -1530,7 +1530,7 @@ nvd0_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, | |||
1530 | 1530 | ||
1531 | nvd0_sor_dpms(encoder, DRM_MODE_DPMS_ON); | 1531 | nvd0_sor_dpms(encoder, DRM_MODE_DPMS_ON); |
1532 | 1532 | ||
1533 | if (nv_encoder->dcb->type == OUTPUT_DP) { | 1533 | if (nv_encoder->dcb->type == DCB_OUTPUT_DP) { |
1534 | nvd0_sor_dp_calc_tu(dev, nv_encoder->dcb, nv_crtc->index, | 1534 | nvd0_sor_dp_calc_tu(dev, nv_encoder->dcb, nv_crtc->index, |
1535 | nv_encoder->dp.datarate); | 1535 | nv_encoder->dp.datarate); |
1536 | } | 1536 | } |
@@ -1571,7 +1571,7 @@ static const struct drm_encoder_funcs nvd0_sor_func = { | |||
1571 | }; | 1571 | }; |
1572 | 1572 | ||
1573 | static int | 1573 | static int |
1574 | nvd0_sor_create(struct drm_connector *connector, struct dcb_entry *dcbe) | 1574 | nvd0_sor_create(struct drm_connector *connector, struct dcb_output *dcbe) |
1575 | { | 1575 | { |
1576 | struct drm_device *dev = connector->dev; | 1576 | struct drm_device *dev = connector->dev; |
1577 | struct nouveau_encoder *nv_encoder; | 1577 | struct nouveau_encoder *nv_encoder; |
@@ -1597,23 +1597,23 @@ nvd0_sor_create(struct drm_connector *connector, struct dcb_entry *dcbe) | |||
1597 | /****************************************************************************** | 1597 | /****************************************************************************** |
1598 | * IRQ | 1598 | * IRQ |
1599 | *****************************************************************************/ | 1599 | *****************************************************************************/ |
1600 | static struct dcb_entry * | 1600 | static struct dcb_output * |
1601 | lookup_dcb(struct drm_device *dev, int id, u32 mc) | 1601 | lookup_dcb(struct drm_device *dev, int id, u32 mc) |
1602 | { | 1602 | { |
1603 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 1603 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
1604 | int type, or, i, link = -1; | 1604 | int type, or, i, link = -1; |
1605 | 1605 | ||
1606 | if (id < 4) { | 1606 | if (id < 4) { |
1607 | type = OUTPUT_ANALOG; | 1607 | type = DCB_OUTPUT_ANALOG; |
1608 | or = id; | 1608 | or = id; |
1609 | } else { | 1609 | } else { |
1610 | switch (mc & 0x00000f00) { | 1610 | switch (mc & 0x00000f00) { |
1611 | case 0x00000000: link = 0; type = OUTPUT_LVDS; break; | 1611 | case 0x00000000: link = 0; type = DCB_OUTPUT_LVDS; break; |
1612 | case 0x00000100: link = 0; type = OUTPUT_TMDS; break; | 1612 | case 0x00000100: link = 0; type = DCB_OUTPUT_TMDS; break; |
1613 | case 0x00000200: link = 1; type = OUTPUT_TMDS; break; | 1613 | case 0x00000200: link = 1; type = DCB_OUTPUT_TMDS; break; |
1614 | case 0x00000500: link = 0; type = OUTPUT_TMDS; break; | 1614 | case 0x00000500: link = 0; type = DCB_OUTPUT_TMDS; break; |
1615 | case 0x00000800: link = 0; type = OUTPUT_DP; break; | 1615 | case 0x00000800: link = 0; type = DCB_OUTPUT_DP; break; |
1616 | case 0x00000900: link = 1; type = OUTPUT_DP; break; | 1616 | case 0x00000900: link = 1; type = DCB_OUTPUT_DP; break; |
1617 | default: | 1617 | default: |
1618 | NV_ERROR(dev, "PDISP: unknown SOR mc 0x%08x\n", mc); | 1618 | NV_ERROR(dev, "PDISP: unknown SOR mc 0x%08x\n", mc); |
1619 | return NULL; | 1619 | return NULL; |
@@ -1623,7 +1623,7 @@ lookup_dcb(struct drm_device *dev, int id, u32 mc) | |||
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | for (i = 0; i < dev_priv->vbios.dcb.entries; i++) { | 1625 | for (i = 0; i < dev_priv->vbios.dcb.entries; i++) { |
1626 | struct dcb_entry *dcb = &dev_priv->vbios.dcb.entry[i]; | 1626 | struct dcb_output *dcb = &dev_priv->vbios.dcb.entry[i]; |
1627 | if (dcb->type == type && (dcb->or & (1 << or)) && | 1627 | if (dcb->type == type && (dcb->or & (1 << or)) && |
1628 | (link < 0 || link == !(dcb->sorconf.link & 1))) | 1628 | (link < 0 || link == !(dcb->sorconf.link & 1))) |
1629 | return dcb; | 1629 | return dcb; |
@@ -1636,7 +1636,7 @@ lookup_dcb(struct drm_device *dev, int id, u32 mc) | |||
1636 | static void | 1636 | static void |
1637 | nvd0_display_unk1_handler(struct drm_device *dev, u32 crtc, u32 mask) | 1637 | nvd0_display_unk1_handler(struct drm_device *dev, u32 crtc, u32 mask) |
1638 | { | 1638 | { |
1639 | struct dcb_entry *dcb; | 1639 | struct dcb_output *dcb; |
1640 | int i; | 1640 | int i; |
1641 | 1641 | ||
1642 | for (i = 0; mask && i < 8; i++) { | 1642 | for (i = 0; mask && i < 8; i++) { |
@@ -1659,7 +1659,7 @@ nvd0_display_unk1_handler(struct drm_device *dev, u32 crtc, u32 mask) | |||
1659 | static void | 1659 | static void |
1660 | nvd0_display_unk2_handler(struct drm_device *dev, u32 crtc, u32 mask) | 1660 | nvd0_display_unk2_handler(struct drm_device *dev, u32 crtc, u32 mask) |
1661 | { | 1661 | { |
1662 | struct dcb_entry *dcb; | 1662 | struct dcb_output *dcb; |
1663 | u32 or, tmp, pclk; | 1663 | u32 or, tmp, pclk; |
1664 | int i; | 1664 | int i; |
1665 | 1665 | ||
@@ -1697,12 +1697,12 @@ nvd0_display_unk2_handler(struct drm_device *dev, u32 crtc, u32 mask) | |||
1697 | 1697 | ||
1698 | nv_wr32(dev, 0x612200 + (crtc * 0x800), 0x00000000); | 1698 | nv_wr32(dev, 0x612200 + (crtc * 0x800), 0x00000000); |
1699 | switch (dcb->type) { | 1699 | switch (dcb->type) { |
1700 | case OUTPUT_ANALOG: | 1700 | case DCB_OUTPUT_ANALOG: |
1701 | nv_wr32(dev, 0x612280 + (or * 0x800), 0x00000000); | 1701 | nv_wr32(dev, 0x612280 + (or * 0x800), 0x00000000); |
1702 | break; | 1702 | break; |
1703 | case OUTPUT_TMDS: | 1703 | case DCB_OUTPUT_TMDS: |
1704 | case OUTPUT_LVDS: | 1704 | case DCB_OUTPUT_LVDS: |
1705 | case OUTPUT_DP: | 1705 | case DCB_OUTPUT_DP: |
1706 | if (cfg & 0x00000100) | 1706 | if (cfg & 0x00000100) |
1707 | tmp = 0x00000101; | 1707 | tmp = 0x00000101; |
1708 | else | 1708 | else |
@@ -1725,7 +1725,7 @@ nvd0_display_unk2_handler(struct drm_device *dev, u32 crtc, u32 mask) | |||
1725 | static void | 1725 | static void |
1726 | nvd0_display_unk4_handler(struct drm_device *dev, u32 crtc, u32 mask) | 1726 | nvd0_display_unk4_handler(struct drm_device *dev, u32 crtc, u32 mask) |
1727 | { | 1727 | { |
1728 | struct dcb_entry *dcb; | 1728 | struct dcb_output *dcb; |
1729 | int pclk, i; | 1729 | int pclk, i; |
1730 | 1730 | ||
1731 | pclk = nv_rd32(dev, 0x660450 + (crtc * 0x300)) / 1000; | 1731 | pclk = nv_rd32(dev, 0x660450 + (crtc * 0x300)) / 1000; |
@@ -1972,7 +1972,7 @@ nvd0_display_create(struct drm_device *dev) | |||
1972 | struct drm_connector *connector, *tmp; | 1972 | struct drm_connector *connector, *tmp; |
1973 | struct pci_dev *pdev = dev->pdev; | 1973 | struct pci_dev *pdev = dev->pdev; |
1974 | struct nvd0_display *disp; | 1974 | struct nvd0_display *disp; |
1975 | struct dcb_entry *dcbe; | 1975 | struct dcb_output *dcbe; |
1976 | int crtcs, ret, i; | 1976 | int crtcs, ret, i; |
1977 | 1977 | ||
1978 | disp = kzalloc(sizeof(*disp), GFP_KERNEL); | 1978 | disp = kzalloc(sizeof(*disp), GFP_KERNEL); |
@@ -2001,12 +2001,12 @@ nvd0_display_create(struct drm_device *dev) | |||
2001 | } | 2001 | } |
2002 | 2002 | ||
2003 | switch (dcbe->type) { | 2003 | switch (dcbe->type) { |
2004 | case OUTPUT_TMDS: | 2004 | case DCB_OUTPUT_TMDS: |
2005 | case OUTPUT_LVDS: | 2005 | case DCB_OUTPUT_LVDS: |
2006 | case OUTPUT_DP: | 2006 | case DCB_OUTPUT_DP: |
2007 | nvd0_sor_create(connector, dcbe); | 2007 | nvd0_sor_create(connector, dcbe); |
2008 | break; | 2008 | break; |
2009 | case OUTPUT_ANALOG: | 2009 | case DCB_OUTPUT_ANALOG: |
2010 | nvd0_dac_create(connector, dcbe); | 2010 | nvd0_dac_create(connector, dcbe); |
2011 | break; | 2011 | break; |
2012 | default: | 2012 | default: |