[Openchrome-devel] drm-openchrome: Branch 'drm-next-3.19' - 2 commits - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Wed Nov 22 11:11:57 UTC 2017


 drivers/gpu/drm/openchrome/via_drv.h |    4 +--
 drivers/gpu/drm/openchrome/via_fp.c  |   36 +++++++++++++++++++++++++++++++----
 2 files changed, 34 insertions(+), 6 deletions(-)

New commits:
commit 9d18df4289d1fb585b39f32ddbf6bed6f13a870e
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Nov 22 03:10:52 2017 -0800

    drm/openchrome: Version bumped to 3.0.58
    
    An improvement in FP detection.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/via_drv.h b/drivers/gpu/drm/openchrome/via_drv.h
index 36630636efe9..ef1e3dcf63c3 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -30,11 +30,11 @@
 #define DRIVER_AUTHOR       "OpenChrome Project"
 #define DRIVER_NAME         "openchrome"
 #define DRIVER_DESC         "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE         "20171106"
+#define DRIVER_DATE         "20171122"
 
 #define DRIVER_MAJOR		3
 #define DRIVER_MINOR		0
-#define DRIVER_PATCHLEVEL	57
+#define DRIVER_PATCHLEVEL	58
 
 #include <linux/module.h>
 
commit 1e6c54a62f1c7d71dd554a2ae532d8dbd2a20e0b
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Nov 22 02:48:31 2017 -0800

    drm/openchrome: Probing for FP's I2C bus support
    
    This improves the FP detection compared to the previous code.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/via_fp.c b/drivers/gpu/drm/openchrome/via_fp.c
index 56719a3dc7ed..87ee9ac0b570 100644
--- a/drivers/gpu/drm/openchrome/via_fp.c
+++ b/drivers/gpu/drm/openchrome/via_fp.c
@@ -980,6 +980,9 @@ struct drm_connector_helper_funcs via_fp_connector_helper_funcs = {
 void via_fp_probe(struct drm_device *dev)
 {
 	struct via_device *dev_priv = dev->dev_private;
+	struct drm_connector connector;
+	struct i2c_adapter *i2c_bus;
+	struct edid *edid;
 	u16 chipset = dev->pdev->device;
 	u8 sr12, sr13, sr5a;
 	u8 cr3b;
@@ -1157,18 +1160,43 @@ void via_fp_probe(struct drm_device *dev)
 	dev_priv->int_fp1_i2c_bus = VIA_I2C_NONE;
 	dev_priv->int_fp2_i2c_bus = VIA_I2C_NONE;
 
+	/* Zero clear connector struct.
+	 * Not doing so leads to a crash. */
+	memset(&connector, 0, sizeof(connector));
+
+	/* Register a connector only for I2C bus probing. */
+	drm_connector_init(dev, &connector, &via_fp_connector_funcs,
+				DRM_MODE_CONNECTOR_LVDS);
+	drm_connector_helper_add(&connector,
+					&via_fp_connector_helper_funcs);
+	drm_connector_register(&connector);
+
 	if ((dev_priv->int_fp1_presence)
 		&& (!(dev_priv->mapped_i2c_bus & VIA_I2C_BUS2))) {
-		dev_priv->int_fp1_i2c_bus = VIA_I2C_BUS2;
-		dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+		i2c_bus = via_find_ddc_bus(0x31);
+		edid = drm_get_edid(&connector, i2c_bus);
+		if (edid) {
+			dev_priv->int_fp1_i2c_bus = VIA_I2C_BUS2;
+			dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+			kfree(edid);
+		}
 	}
 
 	if ((dev_priv->int_fp2_presence)
 		&& (!(dev_priv->mapped_i2c_bus & VIA_I2C_BUS2))) {
-		dev_priv->int_fp2_i2c_bus = VIA_I2C_BUS2;
-		dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+		i2c_bus = via_find_ddc_bus(0x31);
+		edid = drm_get_edid(&connector, i2c_bus);
+		if (edid) {
+			dev_priv->int_fp2_i2c_bus = VIA_I2C_BUS2;
+			dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+			kfree(edid);
+		}
 	}
 
+	/* Release the connector resource. */
+	drm_connector_unregister(&connector);
+	drm_connector_cleanup(&connector);
+
 	DRM_DEBUG_KMS("int_fp1_presence: %x\n",
 			dev_priv->int_fp1_presence);
 	DRM_DEBUG_KMS("int_fp1_di_port: 0x%08x\n",


More information about the Openchrome-devel mailing list