aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authoryakui_zhao <yakui.zhao@intel.com>2009-05-31 05:18:07 -0400
committerEric Anholt <eric@anholt.net>2009-06-05 10:22:19 -0400
commit714605e4a05787c51a5ac36c926d2169cfdfbfba (patch)
tree5e8979209866a8f46af3994dfe3384f3142de8d0 /drivers/gpu
parent9b9d172d06b0f2d51cc9431e2c6c3055f0cf10ef (diff)
drm/i915: Initialize the SDVO device based on the sdvo info parsed from VBT
http://bugs.freedesktop.org/show_bug.cgi?id=20429 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> [anholt: Massive cleanup of the slave addr function] Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index f3ef6bfd8ffc..d8fb88d335cd 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1741,6 +1741,43 @@ static struct i2c_algorithm intel_sdvo_i2c_bit_algo = {
1741 .master_xfer = intel_sdvo_master_xfer, 1741 .master_xfer = intel_sdvo_master_xfer,
1742}; 1742};
1743 1743
1744static u8
1745intel_sdvo_get_slave_addr(struct drm_device *dev, int output_device)
1746{
1747 struct drm_i915_private *dev_priv = dev->dev_private;
1748 struct sdvo_device_mapping *my_mapping, *other_mapping;
1749
1750 if (output_device == SDVOB) {
1751 my_mapping = &dev_priv->sdvo_mappings[0];
1752 other_mapping = &dev_priv->sdvo_mappings[1];
1753 } else {
1754 my_mapping = &dev_priv->sdvo_mappings[1];
1755 other_mapping = &dev_priv->sdvo_mappings[0];
1756 }
1757
1758 /* If the BIOS described our SDVO device, take advantage of it. */
1759 if (my_mapping->slave_addr)
1760 return my_mapping->slave_addr;
1761
1762 /* If the BIOS only described a different SDVO device, use the
1763 * address that it isn't using.
1764 */
1765 if (other_mapping->slave_addr) {
1766 if (other_mapping->slave_addr == 0x70)
1767 return 0x72;
1768 else
1769 return 0x70;
1770 }
1771
1772 /* No SDVO device info is found for another DVO port,
1773 * so use mapping assumption we had before BIOS parsing.
1774 */
1775 if (output_device == SDVOB)
1776 return 0x70;
1777 else
1778 return 0x72;
1779}
1780
1744bool intel_sdvo_init(struct drm_device *dev, int output_device) 1781bool intel_sdvo_init(struct drm_device *dev, int output_device)
1745{ 1782{
1746 struct drm_connector *connector; 1783 struct drm_connector *connector;
@@ -1752,6 +1789,7 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1752 u8 ch[0x40]; 1789 u8 ch[0x40];
1753 int i; 1790 int i;
1754 int encoder_type, output_id; 1791 int encoder_type, output_id;
1792 u8 slave_addr;
1755 1793
1756 intel_output = kcalloc(sizeof(struct intel_output)+sizeof(struct intel_sdvo_priv), 1, GFP_KERNEL); 1794 intel_output = kcalloc(sizeof(struct intel_output)+sizeof(struct intel_sdvo_priv), 1, GFP_KERNEL);
1757 if (!intel_output) { 1795 if (!intel_output) {
@@ -1770,16 +1808,15 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
1770 if (!i2cbus) 1808 if (!i2cbus)
1771 goto err_inteloutput; 1809 goto err_inteloutput;
1772 1810
1811 slave_addr = intel_sdvo_get_slave_addr(dev, output_device);
1773 sdvo_priv->i2c_bus = i2cbus; 1812 sdvo_priv->i2c_bus = i2cbus;
1774 1813
1775 if (output_device == SDVOB) { 1814 if (output_device == SDVOB) {
1776 output_id = 1; 1815 output_id = 1;
1777 sdvo_priv->i2c_bus->slave_addr = 0x38;
1778 } else { 1816 } else {
1779 output_id = 2; 1817 output_id = 2;
1780 sdvo_priv->i2c_bus->slave_addr = 0x39;
1781 } 1818 }
1782 1819 sdvo_priv->i2c_bus->slave_addr = slave_addr >> 1;
1783 sdvo_priv->output_device = output_device; 1820 sdvo_priv->output_device = output_device;
1784 intel_output->i2c_bus = i2cbus; 1821 intel_output->i2c_bus = i2cbus;
1785 intel_output->dev_priv = sdvo_priv; 1822 intel_output->dev_priv = sdvo_priv;