[v5,10/24] drm/imx: imx-ldb: Provide ddc symlink in connector's sysfs
diff mbox series

Message ID 8e79f715659cbf092e4a79631bdd940c9a036d14.1563960855.git.andrzej.p@collabora.com
State New
Headers show
Series
  • Associate ddc adapters with connectors
Related show

Commit Message

Andrzej Pietrasiewicz July 24, 2019, 1:59 p.m. UTC
Use the ddc pointer provided by the generic connector.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 drivers/gpu/drm/imx/imx-ldb.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index de62a4cd4827..94945dd937cc 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -57,7 +57,6 @@  struct imx_ldb_channel {
 	struct drm_bridge *bridge;
 
 	struct device_node *child;
-	struct i2c_adapter *ddc;
 	int chno;
 	void *edid;
 	int edid_len;
@@ -133,8 +132,8 @@  static int imx_ldb_connector_get_modes(struct drm_connector *connector)
 			return num_modes;
 	}
 
-	if (!imx_ldb_ch->edid && imx_ldb_ch->ddc)
-		imx_ldb_ch->edid = drm_get_edid(connector, imx_ldb_ch->ddc);
+	if (!imx_ldb_ch->edid && connector->ddc)
+		imx_ldb_ch->edid = drm_get_edid(connector, connector->ddc);
 
 	if (imx_ldb_ch->edid) {
 		drm_connector_update_edid_property(connector,
@@ -462,9 +461,10 @@  static int imx_ldb_register(struct drm_device *drm,
 		 */
 		drm_connector_helper_add(&imx_ldb_ch->connector,
 				&imx_ldb_connector_helper_funcs);
-		drm_connector_init(drm, &imx_ldb_ch->connector,
-				&imx_ldb_connector_funcs,
-				DRM_MODE_CONNECTOR_LVDS);
+		drm_connector_init_with_ddc(drm, &imx_ldb_ch->connector,
+					    &imx_ldb_connector_funcs,
+					    DRM_MODE_CONNECTOR_LVDS,
+					    imx_ldb_ch->connector.ddc);
 		drm_connector_attach_encoder(&imx_ldb_ch->connector, encoder);
 	}
 
@@ -552,15 +552,15 @@  static int imx_ldb_panel_ddc(struct device *dev,
 
 	ddc_node = of_parse_phandle(child, "ddc-i2c-bus", 0);
 	if (ddc_node) {
-		channel->ddc = of_find_i2c_adapter_by_node(ddc_node);
+		channel->connector.ddc = of_find_i2c_adapter_by_node(ddc_node);
 		of_node_put(ddc_node);
-		if (!channel->ddc) {
+		if (!channel->connector.ddc) {
 			dev_warn(dev, "failed to get ddc i2c adapter\n");
 			return -EPROBE_DEFER;
 		}
 	}
 
-	if (!channel->ddc) {
+	if (!channel->connector.ddc) {
 		/* if no DDC available, fallback to hardcoded EDID */
 		dev_dbg(dev, "no ddc available\n");
 
@@ -727,7 +727,7 @@  static void imx_ldb_unbind(struct device *dev, struct device *master,
 			drm_panel_detach(channel->panel);
 
 		kfree(channel->edid);
-		i2c_put_adapter(channel->ddc);
+		i2c_put_adapter(channel->connector.ddc);
 	}
 }