aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJonas Bonn <jonas@southpole.se>2009-05-15 03:10:41 -0400
committerEric Anholt <eric@anholt.net>2009-05-22 15:59:29 -0400
commitad5b2a6db3eddc41358d8a73f5cfe1c38e7e3a19 (patch)
tree27dfd0914e2d1704a53de795d53c27bba79e79f7 /drivers/gpu
parent7086c87fb1446ceb37918ffa0941359a7c2ec6cf (diff)
drm/i915: Determine type before initialising connector
drm_connector_init sets both the connector type and the connector type_id on the newly initialised connector. As the connector type_id is coupled to the connector type, the connector type cannot simply be modified on an initialised connector. This patch changes the order of operations on intel_sdvo_init so that the type is determined before the connector is intialised. This fixes a bug whereby the name card0-VGA-1 would be allocted to both a CRT and an SDVO connector since the SDVO connector would be initialised with type 'unknown' and hence have its type_id assigned from the wrong pool. Signed-off-by: Jonas Bonn <jonas@southpole.se> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index f79ebf4de63c..ded122c1ae2d 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1713,17 +1713,9 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1713 return false; 1713 return false;
1714 } 1714 }
1715 1715
1716 connector = &intel_output->base;
1717
1718 drm_connector_init(dev, connector, &intel_sdvo_connector_funcs,
1719 DRM_MODE_CONNECTOR_Unknown);
1720 drm_connector_helper_add(connector, &intel_sdvo_connector_helper_funcs);
1721 sdvo_priv = (struct intel_sdvo_priv *)(intel_output + 1); 1716 sdvo_priv = (struct intel_sdvo_priv *)(intel_output + 1);
1722 intel_output->type = INTEL_OUTPUT_SDVO; 1717 intel_output->type = INTEL_OUTPUT_SDVO;
1723 1718
1724 connector->interlace_allowed = 0;
1725 connector->doublescan_allowed = 0;
1726
1727 /* setup the DDC bus. */ 1719 /* setup the DDC bus. */
1728 if (output_device == SDVOB) 1720 if (output_device == SDVOB)
1729 i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB"); 1721 i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB");
@@ -1731,7 +1723,7 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1731 i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC"); 1723 i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC");
1732 1724
1733 if (!i2cbus) 1725 if (!i2cbus)
1734 goto err_connector; 1726 goto err_inteloutput;
1735 1727
1736 sdvo_priv->i2c_bus = i2cbus; 1728 sdvo_priv->i2c_bus = i2cbus;
1737 1729
@@ -1747,7 +1739,6 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1747 intel_output->i2c_bus = i2cbus; 1739 intel_output->i2c_bus = i2cbus;
1748 intel_output->dev_priv = sdvo_priv; 1740 intel_output->dev_priv = sdvo_priv;
1749 1741
1750
1751 /* Read the regs to test if we can talk to the device */ 1742 /* Read the regs to test if we can talk to the device */
1752 for (i = 0; i < 0x40; i++) { 1743 for (i = 0; i < 0x40; i++) {
1753 if (!intel_sdvo_read_byte(intel_output, i, &ch[i])) { 1744 if (!intel_sdvo_read_byte(intel_output, i, &ch[i])) {
@@ -1768,7 +1759,6 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1768 else 1759 else
1769 sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS1; 1760 sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS1;
1770 1761
1771 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
1772 encoder_type = DRM_MODE_ENCODER_TMDS; 1762 encoder_type = DRM_MODE_ENCODER_TMDS;
1773 connector_type = DRM_MODE_CONNECTOR_DVID; 1763 connector_type = DRM_MODE_CONNECTOR_DVID;
1774 1764
@@ -1786,7 +1776,6 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1786 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_SVID0) 1776 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_SVID0)
1787 { 1777 {
1788 sdvo_priv->controlled_output = SDVO_OUTPUT_SVID0; 1778 sdvo_priv->controlled_output = SDVO_OUTPUT_SVID0;
1789 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
1790 encoder_type = DRM_MODE_ENCODER_TVDAC; 1779 encoder_type = DRM_MODE_ENCODER_TVDAC;
1791 connector_type = DRM_MODE_CONNECTOR_SVIDEO; 1780 connector_type = DRM_MODE_CONNECTOR_SVIDEO;
1792 sdvo_priv->is_tv = true; 1781 sdvo_priv->is_tv = true;
@@ -1795,21 +1784,18 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1795 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB0) 1784 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB0)
1796 { 1785 {
1797 sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; 1786 sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0;
1798 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
1799 encoder_type = DRM_MODE_ENCODER_DAC; 1787 encoder_type = DRM_MODE_ENCODER_DAC;
1800 connector_type = DRM_MODE_CONNECTOR_VGA; 1788 connector_type = DRM_MODE_CONNECTOR_VGA;
1801 } 1789 }
1802 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB1) 1790 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB1)
1803 { 1791 {
1804 sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; 1792 sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1;
1805 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
1806 encoder_type = DRM_MODE_ENCODER_DAC; 1793 encoder_type = DRM_MODE_ENCODER_DAC;
1807 connector_type = DRM_MODE_CONNECTOR_VGA; 1794 connector_type = DRM_MODE_CONNECTOR_VGA;
1808 } 1795 }
1809 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS0) 1796 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS0)
1810 { 1797 {
1811 sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0; 1798 sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0;
1812 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
1813 encoder_type = DRM_MODE_ENCODER_LVDS; 1799 encoder_type = DRM_MODE_ENCODER_LVDS;
1814 connector_type = DRM_MODE_CONNECTOR_LVDS; 1800 connector_type = DRM_MODE_CONNECTOR_LVDS;
1815 sdvo_priv->is_lvds = true; 1801 sdvo_priv->is_lvds = true;
@@ -1817,7 +1803,6 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1817 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS1) 1803 else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS1)
1818 { 1804 {
1819 sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1; 1805 sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1;
1820 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
1821 encoder_type = DRM_MODE_ENCODER_LVDS; 1806 encoder_type = DRM_MODE_ENCODER_LVDS;
1822 connector_type = DRM_MODE_CONNECTOR_LVDS; 1807 connector_type = DRM_MODE_CONNECTOR_LVDS;
1823 sdvo_priv->is_lvds = true; 1808 sdvo_priv->is_lvds = true;
@@ -1836,9 +1821,16 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1836 goto err_i2c; 1821 goto err_i2c;
1837 } 1822 }
1838 1823
1824 connector = &intel_output->base;
1825 drm_connector_init(dev, connector, &intel_sdvo_connector_funcs,
1826 connector_type);
1827 drm_connector_helper_add(connector, &intel_sdvo_connector_helper_funcs);
1828 connector->interlace_allowed = 0;
1829 connector->doublescan_allowed = 0;
1830 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
1831
1839 drm_encoder_init(dev, &intel_output->enc, &intel_sdvo_enc_funcs, encoder_type); 1832 drm_encoder_init(dev, &intel_output->enc, &intel_sdvo_enc_funcs, encoder_type);
1840 drm_encoder_helper_add(&intel_output->enc, &intel_sdvo_helper_funcs); 1833 drm_encoder_helper_add(&intel_output->enc, &intel_sdvo_helper_funcs);
1841 connector->connector_type = connector_type;
1842 1834
1843 drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); 1835 drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc);
1844 drm_sysfs_connector_add(connector); 1836 drm_sysfs_connector_add(connector);
@@ -1876,8 +1868,7 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1876 1868
1877err_i2c: 1869err_i2c:
1878 intel_i2c_destroy(intel_output->i2c_bus); 1870 intel_i2c_destroy(intel_output->i2c_bus);
1879err_connector: 1871err_inteloutput:
1880 drm_connector_cleanup(connector);
1881 kfree(intel_output); 1872 kfree(intel_output);
1882 1873
1883 return false; 1874 return false;