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

Kevin Brace kevinbrace at kemper.freedesktop.org
Fri Jan 26 20:57:58 UTC 2018


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

New commits:
commit f29b718cbd5805343ed6fad02678a7bba1a4a563
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Fri Jan 26 12:56:53 2018 -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 0a4561e895bc..194b93f3cddf 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -34,7 +34,7 @@
 
 #define DRIVER_MAJOR		3
 #define DRIVER_MINOR		0
-#define DRIVER_PATCHLEVEL	57
+#define DRIVER_PATCHLEVEL	58
 
 #include <linux/module.h>
 
commit 70a0ef9032a5bd95ea3c4bfbffac81cf29c26cc7
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Fri Jan 26 12:55:20 2018 -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 1000d278c887..f88fe3a4c53b 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