[PATCH v3 31/32] drm/exynos: Move lvds bridge discovery into DP driver
Sean Paul
seanpaul at chromium.org
Tue Oct 29 17:13:17 CET 2013
This patch moves the lvds bridge discovery and connector pre-emption
code from exynos common code into the dp driver (since the bridge is
only applicable for dp).
Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
Changes in v3:
- Added to the patchset
drivers/gpu/drm/exynos/exynos_dp_core.c | 41 ++++++++++++++++++++++++++++++++
drivers/gpu/drm/exynos/exynos_drm_core.c | 41 --------------------------------
2 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 139ea15..32ba791 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -24,6 +24,7 @@
#include <drm/drmP.h>
#include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h>
+#include <drm/bridge/ptn3460.h>
#include "exynos_drm_drv.h"
#include "exynos_dp_core.h"
@@ -31,6 +32,11 @@
#define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \
connector)
+struct bridge_init {
+ struct i2c_client *client;
+ struct device_node *node;
+};
+
static int exynos_dp_init_dp(struct exynos_dp_device *dp)
{
exynos_dp_reset(dp);
@@ -972,6 +978,35 @@ static int exynos_dp_initialize(struct exynos_drm_display *display,
return 0;
}
+static bool find_bridge(const char *compat, struct bridge_init *bridge)
+{
+ bridge->client = NULL;
+ bridge->node = of_find_compatible_node(NULL, NULL, compat);
+ if (!bridge->node)
+ return false;
+
+ bridge->client = of_find_i2c_device_by_node(bridge->node);
+ if (!bridge->client)
+ return false;
+
+ return true;
+}
+
+/* returns the number of bridges attached */
+static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
+ struct drm_encoder *encoder)
+{
+ struct bridge_init bridge;
+ int ret;
+
+ if (find_bridge("nxp,ptn3460", &bridge)) {
+ ret = ptn3460_init(dev, encoder, bridge.client, bridge.node);
+ if (!ret)
+ return 1;
+ }
+ return 0;
+}
+
static int exynos_dp_create_connector(struct exynos_drm_display *display,
struct drm_encoder *encoder)
{
@@ -980,6 +1015,12 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
int ret;
dp->encoder = encoder;
+
+ /* Pre-empt DP connector creation if there's a bridge */
+ ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder);
+ if (ret)
+ return 0;
+
connector->polled = DRM_CONNECTOR_POLL_HPD;
ret = drm_connector_init(dp->drm_dev, connector,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c
index 1a60f5a..2446352 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_core.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_core.c
@@ -14,7 +14,6 @@
#include <linux/i2c.h>
#include <drm/drmP.h>
-#include <drm/bridge/ptn3460.h>
#include "exynos_drm_drv.h"
#include "exynos_drm_crtc.h"
#include "exynos_drm_encoder.h"
@@ -25,40 +24,6 @@ static LIST_HEAD(exynos_drm_subdrv_list);
static LIST_HEAD(exynos_drm_manager_list);
static LIST_HEAD(exynos_drm_display_list);
-struct bridge_init {
- struct i2c_client *client;
- struct device_node *node;
-};
-
-static bool find_bridge(const char *compat, struct bridge_init *bridge)
-{
- bridge->client = NULL;
- bridge->node = of_find_compatible_node(NULL, NULL, compat);
- if (!bridge->node)
- return false;
-
- bridge->client = of_find_i2c_device_by_node(bridge->node);
- if (!bridge->client)
- return false;
-
- return true;
-}
-
-/* returns the number of bridges attached */
-static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
- struct drm_encoder *encoder)
-{
- struct bridge_init bridge;
- int ret;
-
- if (find_bridge("nxp,ptn3460", &bridge)) {
- ret = ptn3460_init(dev, encoder, bridge.client, bridge.node);
- if (!ret)
- return 1;
- }
- return 0;
-}
-
static int exynos_drm_create_enc_conn(struct drm_device *dev,
struct exynos_drm_display *display)
{
@@ -81,12 +46,6 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev,
}
display->encoder = encoder;
- if (display->type == EXYNOS_DISPLAY_TYPE_LCD) {
- ret = exynos_drm_attach_lcd_bridge(dev, encoder);
- if (ret)
- return 0;
- }
-
if (display->ops->create_connector)
return display->ops->create_connector(display, encoder);
--
1.8.4
More information about the dri-devel
mailing list