[Intel-gfx] [PATCH 3/3] [DRM/I915] Initialize the SDVO device based on the sdvo info parsed from VBT
yakui_zhao
yakui.zhao at intel.com
Sun May 31 11:18:07 CEST 2009
When the slave address is found for the SDVO port, the SDVO device will
be initialzied.
When the slave address is not found for the SDVO port, it will return
the slave address by using the following flowchart:
a. If the SDVO device info is found for another SDVO port, it will return
the slave address that is not used. For example: if 0x70 is used, then 0x72
is returned.
b. If no SDVO device info is found for another SDVO port, it will return
0x70 for SDVOB and 0x72 for SDVOC.
http://bugs.freedesktop.org/show_bug.cgi?id=20429
Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
drivers/gpu/drm/i915/intel_sdvo.c | 70 ++++++++++++++++++++++++++++++++++++--
1 file changed, 67 insertions(+), 3 deletions(-)
Index: linux-2.6/drivers/gpu/drm/i915/intel_sdvo.c
===================================================================
--- linux-2.6.orig/drivers/gpu/drm/i915/intel_sdvo.c 2009-05-31 17:07:24.000000000 +0800
+++ linux-2.6/drivers/gpu/drm/i915/intel_sdvo.c 2009-05-31 17:07:29.000000000 +0800
@@ -1741,6 +1741,67 @@
.master_xfer = intel_sdvo_master_xfer,
};
+/*
+ * find the slave address for the given SDVO port based on the info
+ * parsed in general definition blocks.
+ * If the slave address is found in the SDVO device info parsed from
+ * VBT,it will be returned.
+ * Otherwise it will return the slave address by the following steps.
+ * a. If one SDVO device info is found in another DVO port, it will return
+ * the slave address that is not used. For example: if 0x70 is used,
+ * then 0x72 is returned.
+ * b. If no SDVO device info is found in another DVO port, it will return
+ * 0x70 for SDVOB and 0x72 for SDVOC port.
+ */
+static void drm_find_sdvo_slave(struct drm_device *dev, int output_device,
+ u8 *slave_addr)
+{
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ u8 temp_slave_addr;
+ u8 dvo_port, dvo2_port;
+ struct sdvo_device_mapping *p_mapping;
+
+ if (output_device == SDVOB) {
+ /* device port DVOB */
+ dvo_port = 0;
+ dvo2_port = 1;
+ } else {
+ /* device port DVOC */
+ dvo_port = 1;
+ dvo2_port = 0;
+ }
+ p_mapping = &(dev_priv->sdvo_mappings[dvo_port]);
+ temp_slave_addr = p_mapping->slave_addr;
+ if (temp_slave_addr) {
+ /* slave address is found. Return it */
+ *slave_addr = temp_slave_addr;
+ return;
+ }
+ /* check whether the SDVO device info is found for another DVO port */
+ p_mapping = &(dev_priv->sdvo_mappings[dvo2_port]);
+ temp_slave_addr = p_mapping->slave_addr;
+ if (!temp_slave_addr) {
+ /* No SDVO device info is found for another DVO port */
+ if (output_device == SDVOB)
+ temp_slave_addr = 0x70;
+ else
+ temp_slave_addr = 0x72;
+ *slave_addr = temp_slave_addr;
+ return;
+ }
+ /* The SDVO device info is found for another DVO port.
+ * return the slave address that is not used.
+ * For example: When 0x70 is used, 0x72 is returned.
+ * When 0x72 is used, 0x70 is returned.
+ */
+ if (temp_slave_addr == 0x70)
+ temp_slave_addr = 0x72;
+ else
+ temp_slave_addr = 0x70;
+ *slave_addr = temp_slave_addr;
+
+ return;
+}
bool intel_sdvo_init(struct drm_device *dev, int output_device)
{
struct drm_connector *connector;
@@ -1752,6 +1813,7 @@
u8 ch[0x40];
int i;
int encoder_type, output_id;
+ u8 slave_addr;
intel_output = kcalloc(sizeof(struct intel_output)+sizeof(struct intel_sdvo_priv), 1, GFP_KERNEL);
if (!intel_output) {
@@ -1770,16 +1832,18 @@
if (!i2cbus)
goto err_inteloutput;
+ slave_addr = 0;
+ drm_find_sdvo_slave(dev, output_device, &slave_addr);
+ /* slave address is 0x70/0x72. It should be divided by 2. */
+ slave_addr = slave_addr >> 1;
sdvo_priv->i2c_bus = i2cbus;
if (output_device == SDVOB) {
output_id = 1;
- sdvo_priv->i2c_bus->slave_addr = 0x38;
} else {
output_id = 2;
- sdvo_priv->i2c_bus->slave_addr = 0x39;
}
-
+ sdvo_priv->i2c_bus->slave_addr = slave_addr;
sdvo_priv->output_device = output_device;
intel_output->i2c_bus = i2cbus;
intel_output->dev_priv = sdvo_priv;
More information about the Intel-gfx
mailing list