Skip to contentSkip to conversation

drm/exynos: few patches to enhance bridge chip support

PATCH Superseded Ajay Kumar 5 participants 43 messages Jul 17, 2014 – Jul 24, 2014

Subsystems (9)

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Ajay Kumar

author
#0 lore raw

v5 cover drm/exynos: few patches to enhance bridge chip support

This series is based on exynos-drm-next branch of Inki Dae's tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git

This patchset also consolidates various inputs from the drm community regarding the bridge chaining concept:
(1) [RFC V2 0/3] drm/bridge: panel and chaining

	http://www.spinics.net/lists/linux-samsung-soc/msg30160.html
(2) [RFC V3 0/3] drm/bridge: panel and chaining
	http://www.spinics.net/lists/linux-samsung-soc/msg30507.html

I have tested this after adding few DT changes for exynos5250-snow, exynos5420-peach-pit and exynos5800-peach-pi boards.

The V4 series of this particular patchset was also tested by:
Rahul Sharma <[email protected]>
Javier Martinez Canillas <[email protected]>

Changes since V2:
-- Address comments from Jingoo Han for ps8622 driver -- Address comments from Daniel, Rob and Thierry regarding
bridge chaining
-- Address comments from Thierry regarding the names for
new drm_panel functions

Changes since V3:
-- Remove hotplug based initialization of exynos_dp -- Make exynos_dp work directly with drm_panel, remove
dependency on panel_binder
-- Minor cleanups in panel_binder and panel_lvds driver

Changes since V4:
-- Use gpiod interface for panel-lvds and ps8622 drivers. -- Address comments from Javier.
-- Fix compilation issues when PANEL_BINDER is selected as module. -- Split Documentation patches from driver patches.
-- Rebase on top of the tree.

Ajay Kumar (9):
[RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue [RESEND PATCH V5 02/12] drm/panel: add prepare and unprepare routines [RESEND PATCH V5 03/12] drm/exynos: dp: modify driver to support drm_panel [PATCH V5 04/12] drm/panel: Add driver for lvds/edp based panels
[PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver [RESEND PATCH V5 06/12] drm/bridge: add helper functions to support bridge chain [PATCH V5 07/12] drm/bridge: Add a driver which binds drm_bridge with drm_panel [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining [RESEND PATCH V5 09/12] drm/exynos: dp: create bridge chain using ptn3460 and panel_binder

Vincent Palatin (2):
[PATCH V5 10/12] Documentation: Add DT bindings for ps8622/ps8625 bridge driver [PATCH V5 11/12] drm/bridge: Add ps8622/ps8625 bridge driver

Rahul Sharma (1):
[RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

 .../devicetree/bindings/drm/bridge/ps8622.txt      |   21 +
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++
 .../devicetree/bindings/video/exynos_dp.txt        |    2 +
 drivers/gpu/drm/bridge/Kconfig                     |   15 +
 drivers/gpu/drm/bridge/Makefile                    |    2 +
 drivers/gpu/drm/bridge/panel_binder.c              |  193 ++++++++
 drivers/gpu/drm/bridge/ps8622.c                    |  476 ++++++++++++++++++++
 drivers/gpu/drm/bridge/ptn3460.c                   |  137 +-----
 drivers/gpu/drm/exynos/Kconfig                     |    1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c            |   87 +++-
 drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 +
 drivers/gpu/drm/panel/Kconfig                      |   10 +
 drivers/gpu/drm/panel/Makefile                     |    1 +
 drivers/gpu/drm/panel/panel-lvds.c                 |  268 +++++++++++
 include/drm/bridge/panel_binder.h                  |   44 ++
 include/drm/bridge/ps8622.h                        |   41 ++
 include/drm/bridge/ptn3460.h                       |   15 +-
 include/drm/drm_crtc.h                             |   72 +++
 include/drm/drm_panel.h                            |   18 +
 19 files changed, 1316 insertions(+), 139 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
 create mode 100644 drivers/gpu/drm/bridge/panel_binder.c
 create mode 100644 drivers/gpu/drm/bridge/ps8622.c
 create mode 100644 drivers/gpu/drm/panel/panel-lvds.c
 create mode 100644 include/drm/bridge/panel_binder.h
 create mode 100644 include/drm/bridge/ps8622.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH RESEND v5 1/12 drm/exynos: Move DP setup out of hotplug workqueue

Move the DP training and video enable from the hotplug handler into a seperate function and call the same during dpms ON.

With existing code, DP HPD should be generated just few ms before calling enable_irq in dp_poweron.

This patch removes that stringent time constraint.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +10 -1
index 845d766..a94b114 100644
@@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg)
 static void exynos_dp_hotplug(struct work_struct *work)
 {
 	struct exynos_dp_device *dp;
-	int ret;
 
 	dp = container_of(work, struct exynos_dp_device, hotplug_work);
 
+	if (dp->drm_dev)
+		drm_helper_hpd_irq_event(dp->drm_dev);
+}
+
+static void exynos_dp_setup(void *in_ctx)
+{
+	struct exynos_dp_device *dp = in_ctx;
+	int ret;
+
 	ret = exynos_dp_detect_hpd(dp);
 	if (ret) {
 		/* Cable has been disconnected, we're done */
@@ -1059,6 +1067,7 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
 	exynos_dp_phy_init(dp);
 	exynos_dp_init_dp(dp);
 	enable_irq(dp->irq);
+	exynos_dp_setup(dp);
 }
 
 static void exynos_dp_poweroff(struct exynos_dp_device *dp)
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue

Quoted 9 lines · Ajay Kumar

Move the DP training and video enable from the hotplug handler into a seperate function and call the same during dpms ON.

With existing code, DP HPD should be generated just few ms before calling enable_irq in dp_poweron.

This patch removes that stringent time constraint.

This looks eerily familiar to:
https://chromium-review.googlesource.com/#/c/65782/

In fact, I think it's probably better to do this in commit, rather than poweron.

Sean

Quoted 39 lines
---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +10 -2
index 845d766..a94b114 100644
@@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg)
 static void exynos_dp_hotplug(struct work_struct *work)
 {
        struct exynos_dp_device *dp;
-       int ret;
 
        dp = container_of(work, struct exynos_dp_device, hotplug_work);
 
+       if (dp->drm_dev)
+               drm_helper_hpd_irq_event(dp->drm_dev);
+}
+
+static void exynos_dp_setup(void *in_ctx)
+{
+       struct exynos_dp_device *dp = in_ctx;
+       int ret;
+
        ret = exynos_dp_detect_hpd(dp);
        if (ret) {
                /* Cable has been disconnected, we're done */
@@ -1059,6 +1067,7 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
        exynos_dp_phy_init(dp);
        exynos_dp_init_dp(dp);
        enable_irq(dp->irq);
+       exynos_dp_setup(dp);
 }
 
 static void exynos_dp_poweroff(struct exynos_dp_device *dp)
--

1.7.9.5

#3 lore raw

Re: [RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue

Sean,

Quoted 12 lines · Sean Paul
Quoted 9 lines · Ajay Kumar

Move the DP training and video enable from the hotplug handler into a seperate function and call the same during dpms ON.

With existing code, DP HPD should be generated just few ms before calling enable_irq in dp_poweron.

This patch removes that stringent time constraint.

Quoted 6 lines

This looks eerily familiar to:
https://chromium-review.googlesource.com/#/c/65782/

In fact, I think it's probably better to do this in commit, rather than poweron.

Sean

Your are right. This patch contains a subset of changes from the patch you have mentioned.
But, If I provide commit calback to dp, then it would cause dp to reinitialize twice
in quick successions - during dpms_on and during commit. For the user, it would look like a glitch. So, I chose not to provide a commit callback.

Ajay

Quoted 40 lines
Quoted 40 lines
---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +10 -2
index 845d766..a94b114 100644
@@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg)
 static void exynos_dp_hotplug(struct work_struct *work)
 {
        struct exynos_dp_device *dp;
-       int ret;
 
        dp = container_of(work, struct exynos_dp_device, hotplug_work);
 
+       if (dp->drm_dev)
+               drm_helper_hpd_irq_event(dp->drm_dev);
+}
+
+static void exynos_dp_setup(void *in_ctx)
+{
+       struct exynos_dp_device *dp = in_ctx;
+       int ret;
+
        ret = exynos_dp_detect_hpd(dp);
        if (ret) {
                /* Cable has been disconnected, we're done */
@@ -1059,6 +1067,7 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
        exynos_dp_phy_init(dp);
        exynos_dp_init_dp(dp);
        enable_irq(dp->irq);
+       exynos_dp_setup(dp);
 }
 
 static void exynos_dp_poweroff(struct exynos_dp_device *dp)
--

1.7.9.5

#4 lore raw

Re: [RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue

Quoted 20 lines · Ajay kumar

Sean,

Quoted 17 lines · Sean Paul
Quoted 9 lines · Ajay Kumar

Move the DP training and video enable from the hotplug handler into a seperate function and call the same during dpms ON.

With existing code, DP HPD should be generated just few ms before calling enable_irq in dp_poweron.

This patch removes that stringent time constraint.

This looks eerily familiar to:
https://chromium-review.googlesource.com/#/c/65782/

In fact, I think it's probably better to do this in commit, rather than poweron.

Quoted 9 lines
Quoted 1 line

Sean

Your are right. This patch contains a subset of changes from the patch you have mentioned.
But, If I provide commit calback to dp, then it would cause dp to reinitialize twice
in quick successions - during dpms_on and during commit. For the user, it would look like a glitch. So, I chose not to provide a commit callback.

Interesting. At least in my testing, the absence of the commit callback causes my simple test app (which just does drmModeSetCrtc) to fail. In this case, by fail, I mean that the screen just shows black.

Sean

Quoted 41 lines

Ajay

Quoted 40 lines
Quoted 40 lines
---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +10 -2
index 845d766..a94b114 100644
@@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg)
 static void exynos_dp_hotplug(struct work_struct *work)
 {
        struct exynos_dp_device *dp;
-       int ret;
 
        dp = container_of(work, struct exynos_dp_device, hotplug_work);
 
+       if (dp->drm_dev)
+               drm_helper_hpd_irq_event(dp->drm_dev);
+}
+
+static void exynos_dp_setup(void *in_ctx)
+{
+       struct exynos_dp_device *dp = in_ctx;
+       int ret;
+
        ret = exynos_dp_detect_hpd(dp);
        if (ret) {
                /* Cable has been disconnected, we're done */
@@ -1059,6 +1067,7 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
        exynos_dp_phy_init(dp);
        exynos_dp_init_dp(dp);
        enable_irq(dp->irq);
+       exynos_dp_setup(dp);
 }
 
 static void exynos_dp_poweroff(struct exynos_dp_device *dp)
--

1.7.9.5

#5 lore raw

Re: [RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue

Quoted 31 lines · Sean Paul
Quoted 20 lines · Ajay kumar

Sean,

Quoted 17 lines · Sean Paul
Quoted 9 lines · Ajay Kumar

Move the DP training and video enable from the hotplug handler into a seperate function and call the same during dpms ON.

With existing code, DP HPD should be generated just few ms before calling enable_irq in dp_poweron.

This patch removes that stringent time constraint.

This looks eerily familiar to:
https://chromium-review.googlesource.com/#/c/65782/

In fact, I think it's probably better to do this in commit, rather than poweron.

Quoted 9 lines
Quoted 1 line

Sean

Your are right. This patch contains a subset of changes from the patch you have mentioned.
But, If I provide commit calback to dp, then it would cause dp to reinitialize twice
in quick successions - during dpms_on and during commit. For the user, it would look like a glitch. So, I chose not to provide a commit callback.

Quoted 5 lines

Interesting. At least in my testing, the absence of the commit callback causes my simple test app (which just does drmModeSetCrtc) to fail. In this case, by fail, I mean that the screen just shows black.

Sean

I tried running modetest. It is running fine.
Also, exynos_drm_encoder_commit calls both dpms_on and commit for the encoder. So, there should be no problem I guess!

Your testapp stops working only after adding this patch?

Ajay

Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +10 -2
index 845d766..a94b114 100644
@@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg)
 static void exynos_dp_hotplug(struct work_struct *work)
 {
        struct exynos_dp_device *dp;
-       int ret;
 
        dp = container_of(work, struct exynos_dp_device, hotplug_work);
 
+       if (dp->drm_dev)
+               drm_helper_hpd_irq_event(dp->drm_dev);
+}
+
+static void exynos_dp_setup(void *in_ctx)
+{
+       struct exynos_dp_device *dp = in_ctx;
+       int ret;
+
        ret = exynos_dp_detect_hpd(dp);
        if (ret) {
                /* Cable has been disconnected, we're done */
@@ -1059,6 +1067,7 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
        exynos_dp_phy_init(dp);
        exynos_dp_init_dp(dp);
        enable_irq(dp->irq);
+       exynos_dp_setup(dp);
 }
 
 static void exynos_dp_poweroff(struct exynos_dp_device *dp)
--

1.7.9.5

#6 lore raw

Re: [RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue

Quoted 36 lines · Ajay kumar
Quoted 35 lines · Sean Paul
Quoted 20 lines · Ajay kumar

Sean,

Quoted 17 lines · Sean Paul
Quoted 9 lines · Ajay Kumar

Move the DP training and video enable from the hotplug handler into a seperate function and call the same during dpms ON.

With existing code, DP HPD should be generated just few ms before calling enable_irq in dp_poweron.

This patch removes that stringent time constraint.

This looks eerily familiar to:
https://chromium-review.googlesource.com/#/c/65782/

In fact, I think it's probably better to do this in commit, rather than poweron.

Quoted 9 lines
Quoted 1 line

Sean

Your are right. This patch contains a subset of changes from the patch you have mentioned.
But, If I provide commit calback to dp, then it would cause dp to reinitialize twice
in quick successions - during dpms_on and during commit. For the user, it would look like a glitch. So, I chose not to provide a commit callback.

Interesting. At least in my testing, the absence of the commit callback causes my simple test app (which just does drmModeSetCrtc) to fail. In this case, by fail, I mean that the screen just shows black.

Quoted 6 lines
Quoted 1 line

Sean

I tried running modetest. It is running fine.
Also, exynos_drm_encoder_commit calls both dpms_on and commit for the encoder. So, there should be no problem I guess!

Your testapp stops working only after adding this patch?

Sorry for taking a while to get back to you, I didn't get the chance to test this until now.

Yes, my testapp stops working after adding this patch (but works with the patch which does it in commit).

Sean

Quoted 43 lines

Ajay

Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +10 -2
index 845d766..a94b114 100644
@@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg)
 static void exynos_dp_hotplug(struct work_struct *work)
 {
        struct exynos_dp_device *dp;
-       int ret;
 
        dp = container_of(work, struct exynos_dp_device, hotplug_work);
 
+       if (dp->drm_dev)
+               drm_helper_hpd_irq_event(dp->drm_dev);
+}
+
+static void exynos_dp_setup(void *in_ctx)
+{
+       struct exynos_dp_device *dp = in_ctx;
+       int ret;
+
        ret = exynos_dp_detect_hpd(dp);
        if (ret) {
                /* Cable has been disconnected, we're done */
@@ -1059,6 +1067,7 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
        exynos_dp_phy_init(dp);
        exynos_dp_init_dp(dp);
        enable_irq(dp->irq);
+       exynos_dp_setup(dp);
 }
 
 static void exynos_dp_poweroff(struct exynos_dp_device *dp)
--

1.7.9.5

author
#7 lore raw

PATCH RESEND v5 2/12 drm/panel: add prepare and unprepare routines

In reply to Ajay Kumar

Most of the panels need an init sequence as mentioned below:
-- poweron LCD unit/LCD_EN
-- start video data
-- poweron LED unit/BACKLIGHT_EN
And, a de-init sequence as mentioned below:
-- poweroff LED unit/BACKLIGHT_EN
-- stop video data
-- poweroff LCD unit/LCD_EN
With existing callbacks for drm panel, we cannot accomodate such panels, since only two callbacks, i.e "panel_enable" and panel_disable are supported.

This patch adds:
-- "prepare" callback which can be called before the actual video data is on, and then call the "enable" callback after the video data is available.

-- "unprepare" callback which can be called after the video data is off, and use "disable" callback to do something before switching off the video data.

Now, we can easily map the above scenario as shown below:
poweron LCD unit/LCD_EN = "prepare" callback poweron LED unit/BACKLIGHT_EN = "enable" callback poweroff LED unit/BACKLIGHT_EN = "disable" callback poweroff LCD unit/LCD_EN = "unprepare" callback

---
 include/drm/drm_panel.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
include/drm/drm_panel.h +18 -0
index c2ab77a..9addc69 100644
@@ -31,7 +31,9 @@ struct drm_device;
 struct drm_panel;
 
 struct drm_panel_funcs {
+	int (*unprepare)(struct drm_panel *panel);
 	int (*disable)(struct drm_panel *panel);
+	int (*prepare)(struct drm_panel *panel);
 	int (*enable)(struct drm_panel *panel);
 	int (*get_modes)(struct drm_panel *panel);
 };
@@ -46,6 +48,14 @@ struct drm_panel {
 	struct list_head list;
 };
 
+static inline int drm_panel_unprepare(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->unprepare)
+		return panel->funcs->unprepare(panel);
+
+	return panel ? -ENOSYS : -EINVAL;
+}
+
 static inline int drm_panel_disable(struct drm_panel *panel)
 {
 	if (panel && panel->funcs && panel->funcs->disable)
@@ -54,6 +64,14 @@ static inline int drm_panel_disable(struct drm_panel *panel)
 	return panel ? -ENOSYS : -EINVAL;
 }
 
+static inline int drm_panel_prepare(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->prepare)
+		return panel->funcs->prepare(panel);
+
+	return panel ? -ENOSYS : -EINVAL;
+}
+
 static inline int drm_panel_enable(struct drm_panel *panel)
 {
 	if (panel && panel->funcs && panel->funcs->enable)
Signature · 1 line
1.7.9.5
author
#8 lore raw

PATCH RESEND v5 3/12 drm/exynos: dp: modify driver to support drm_panel

In reply to Ajay Kumar

Add drm_panel controls to support powerup/down of the eDP panel, if one is present at the sink side.

---
 .../devicetree/bindings/video/exynos_dp.txt        |    2 +
 drivers/gpu/drm/exynos/Kconfig                     |    1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c            |   45 ++++++++++++++++----
 drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 +
 4 files changed, 41 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/video/exynos_dp.txt +2 -0
index 53dbccf..c029a09 100644
@@ -51,6 +51,8 @@ Required properties for dp-controller:
 			LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4
 	- display-timings: timings for the connected panel as described by
 		Documentation/devicetree/bindings/video/display-timing.txt
+	-edp-panel:
+		phandle for the edp/lvds drm_panel node.
 
 Optional properties for dp-controller:
 	-interlaced:
drivers/gpu/drm/exynos/Kconfig +1 -0
index 178d2a9..fd1c070 100644
@@ -52,6 +52,7 @@ config DRM_EXYNOS_DP
 	bool "EXYNOS DRM DP driver support"
 	depends on DRM_EXYNOS_FIMD && ARCH_EXYNOS && (DRM_PTN3460=n || DRM_PTN3460=y || DRM_PTN3460=DRM_EXYNOS)
 	default DRM_EXYNOS
+	select DRM_PANEL
 	help
 	  This enables support for DP device.
 
drivers/gpu/drm/exynos/exynos_dp_core.c +36 -9

112 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_dp_core.h +2 -0
index 02cc4f9..3c29e4e 100644
@@ -146,9 +146,11 @@ struct link_train {
 
 struct exynos_dp_device {
 	struct device		*dev;
+	struct device_node	*panel_node;
 	struct drm_device	*drm_dev;
 	struct drm_connector	connector;
 	struct drm_encoder	*encoder;
+	struct drm_panel	*edp_panel;
 	struct clk		*clock;
 	unsigned int		irq;
 	void __iomem		*reg_base;
Signature · 1 line
1.7.9.5
#9 lore raw

Re: [RESEND PATCH V5 03/12] drm/exynos: dp: modify driver to support drm_panel

On Fri, Jul 18, 2014 at 02:13:49AM +0530, Ajay Kumar wrote:
[...]

Quoted 1 line
drivers/gpu/drm/exynos/Kconfig +0 -0

[...]

Quoted 1 line

depends on DRM_EXYNOS_FIMD && ARCH_EXYNOS && (DRM_PTN3460=n || DRM_PTN3460=y || DRM_PTN3460=DRM_EXYNOS)

One of the reasons the current way of implementing bridges is that it doesn't scale, as shown by this ridiculous dependency. In patch

[RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

you add support for another type of bridge but it doesn't update this dependency. I suspect that in order for this to work properly you'll need to extend the dependency like so (rewritten to make it somewhat cleaner):

	depends on DRM_EXYNOS_FIMD && ARCH_EXYNOS
	depends on DRM_PTN3460=n || DRM_PTN3460=y || DRM_PTN3460=DRM_EXYNOS
	depends on DRM_PS8622=n || DRM_PS8622=y || DRM_PS8622=DRM_EXYNOS

And you'll need one more of these lines for each new bridge chip that you want to support.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw

Re: [RESEND PATCH V5 03/12] drm/exynos: dp: modify driver to support drm_panel

In reply to Ajay Kumar
Quoted 16 lines · Ajay Kumar

Add drm_panel controls to support powerup/down of the eDP panel, if one is present at the sink side.

---
 .../devicetree/bindings/video/exynos_dp.txt        |    2 +
 drivers/gpu/drm/exynos/Kconfig                     |    1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c            |   45 ++++++++++++++++----
 drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 +
 4 files changed, 41 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/video/exynos_dp.txt +0 -0
index 53dbccf..c029a09 100644

Documentation/devicetree/bindings/video/exynos_dp.txt Required properties for dp-controller: · line 55

Quoted 5 lines
Documentation/devicetree/bindings/video/exynos_dp.txt +2 -0
@@ -51,6 +51,8 @@ Required properties for dp-controller:
 			LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4
 	- display-timings: timings for the connected panel as described by
 		Documentation/devicetree/bindings/video/display-timing.txt
+	-edp-panel:
+		phandle for the edp/lvds drm_panel node.

There's really no need for the edp- prefix here. Also please don't use drm_panel in the binding description since it makes no sense outside of DRM (and bindings need to be OS agnostic).

Also: "eDP" and "LVDS"

Quoted 13 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index a94b114..b3d0d9b 100644
@@ -28,6 +28,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 
 #include "exynos_drm_drv.h"

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_create_connector(struct exynos_drm_display *display, · line 1034

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
@@ -1029,6 +1030,9 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
 	drm_connector_register(connector);
 	drm_mode_connector_attach_encoder(connector, encoder);
 
+	if (dp->edp_panel)
+		drm_panel_attach(dp->edp_panel, &dp->connector);

This function can fail, so you really need to do some error-checking here.

drivers/gpu/drm/exynos/exynos_dp_core.c static void exynos_dp_poweron(struct exynos_dp_device *dp) · line 1076

Quoted 11 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
@@ -1063,11 +1067,13 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
 	if (dp->dpms_mode == DRM_MODE_DPMS_ON)
 		return;
 
+	drm_panel_prepare(dp->edp_panel);
 	clk_prepare_enable(dp->clock);
 	exynos_dp_phy_init(dp);
 	exynos_dp_init_dp(dp);
 	enable_irq(dp->irq);
 	exynos_dp_setup(dp);
+	drm_panel_enable(dp->edp_panel);

These two as well. clk_prepare_enable() can also fail by the way.

exynos_dp_init_dp() can also fail theoretically (it returns int) but never returns anything other than 0, so it could just as well return void.

drivers/gpu/drm/exynos/exynos_dp_core.c static void exynos_dp_poweroff(struct exynos_dp_device *dp) · line 1090

Quoted 11 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
@@ -1075,10 +1081,12 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp)
 	if (dp->dpms_mode != DRM_MODE_DPMS_ON)
 		return;
 
+	drm_panel_disable(dp->edp_panel);
 	disable_irq(dp->irq);
 	flush_work(&dp->hotplug_work);
 	exynos_dp_phy_exit(dp);
 	clk_disable_unprepare(dp->clock);
+	drm_panel_unprepare(dp->edp_panel);
 }

And these two also.

Quoted 7 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
 static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
@@ -1209,8 +1217,17 @@ err:
 static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
 {
 	int ret;
+	struct device_node *videomode_parent;
+

drivers/gpu/drm/exynos/exynos_dp_core.c err: · line 1230

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +8 -1
+	/* Receive video timing info from panel node
+	 * if there is a panel node
+	 */
+	if (dp->panel_node)
+		videomode_parent = dp->panel_node;
+	else
+		videomode_parent = dp->dev->of_node;
 
-	ret = of_get_videomode(dp->dev->of_node, &dp->panel.vm,
+	ret = of_get_videomode(videomode_parent, &dp->panel.vm,

You shouldn't be grabbing the video timings from some random node like this. Instead you should use the DRM panel's .get_modes() function to query the supported modes. The panel may not (in fact, should not, at least under most circumstances) define video timings in the device tree.

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_probe(struct platform_device *pdev) · line 1361

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +6 -0
@@ -1341,6 +1353,21 @@ static int exynos_dp_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
+	dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device),
+				GFP_KERNEL);
+	if (!dp)
+		return -ENOMEM;
+
+	dp->panel_node = of_parse_phandle(dev->of_node, "edp-panel", 0);

There should be no need to store the struct device_node * obtained here in the context like this.

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_probe(struct platform_device *pdev) · line 1364

Quoted 3 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +3 -0
+	if (dp->panel_node) {
+		dp->edp_panel = of_drm_find_panel(dp->panel_node);
+		of_node_put(dp->panel_node);

Especially since after this that pointer may become invalid.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

Re: [RESEND PATCH V5 03/12] drm/exynos: dp: modify driver to support drm_panel

Hi Thierry,

Quoted 27 lines · Thierry Reding
Quoted 16 lines · Ajay Kumar

Add drm_panel controls to support powerup/down of the eDP panel, if one is present at the sink side.

---
 .../devicetree/bindings/video/exynos_dp.txt        |    2 +
 drivers/gpu/drm/exynos/Kconfig                     |    1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c            |   45 ++++++++++++++++----
 drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 +
 4 files changed, 41 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/video/exynos_dp.txt +0 -0
index 53dbccf..c029a09 100644

Documentation/devicetree/bindings/video/exynos_dp.txt Required properties for dp-controller: · line 55

Quoted 5 lines
Documentation/devicetree/bindings/video/exynos_dp.txt +2 -0
@@ -51,6 +51,8 @@ Required properties for dp-controller:
                      LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4
      - display-timings: timings for the connected panel as described by
              Documentation/devicetree/bindings/video/display-timing.txt
+     -edp-panel:
+             phandle for the edp/lvds drm_panel node.

There's really no need for the edp- prefix here. Also please don't use drm_panel in the binding description since it makes no sense outside of DRM (and bindings need to be OS agnostic).

Quoted 1 line

Also: "eDP" and "LVDS"

Ok. Will fix this.

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index a94b114..b3d0d9b 100644
@@ -28,6 +28,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 
 #include "exynos_drm_drv.h"
@@ -1029,6 +1030,9 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
      drm_connector_register(connector);
      drm_mode_connector_attach_encoder(connector, encoder);
 
Quoted 5 lines

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_create_connector(struct exynos_drm_display *display, · line 1034

Quoted 2 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
+     if (dp->edp_panel)
+             drm_panel_attach(dp->edp_panel, &dp->connector);

This function can fail, so you really need to do some error-checking here.

Ok.

Quoted 14 lines

drivers/gpu/drm/exynos/exynos_dp_core.c static void exynos_dp_poweron(struct exynos_dp_device *dp) · line 1076

Quoted 11 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
@@ -1063,11 +1067,13 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
      if (dp->dpms_mode == DRM_MODE_DPMS_ON)
              return;
 
+     drm_panel_prepare(dp->edp_panel);
      clk_prepare_enable(dp->clock);
      exynos_dp_phy_init(dp);
      exynos_dp_init_dp(dp);
      enable_irq(dp->irq);
      exynos_dp_setup(dp);
+     drm_panel_enable(dp->edp_panel);

These two as well. clk_prepare_enable() can also fail by the way.

Quoted 3 lines

exynos_dp_init_dp() can also fail theoretically (it returns int) but never returns anything other than 0, so it could just as well return void.

Ok. Will fix this.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +0 -0
@@ -1075,10 +1081,12 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp)
      if (dp->dpms_mode != DRM_MODE_DPMS_ON)
              return;
 
Quoted 9 lines

drivers/gpu/drm/exynos/exynos_dp_core.c static void exynos_dp_poweroff(struct exynos_dp_device *dp) · line 1090

Quoted 7 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2 -0
+     drm_panel_disable(dp->edp_panel);
      disable_irq(dp->irq);
      flush_work(&dp->hotplug_work);
      exynos_dp_phy_exit(dp);
      clk_disable_unprepare(dp->clock);
+     drm_panel_unprepare(dp->edp_panel);
 }

And these two also.

Ok.

Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +9 -0
 static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
@@ -1209,8 +1217,17 @@ err:
 static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
 {
      int ret;
+     struct device_node *videomode_parent;
+
+     /* Receive video timing info from panel node
+      * if there is a panel node
+      */
+     if (dp->panel_node)
+             videomode_parent = dp->panel_node;
+     else
+             videomode_parent = dp->dev->of_node;
 
Quoted 7 lines

drivers/gpu/drm/exynos/exynos_dp_core.c err: · line 1230

Quoted 2 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -1
-     ret = of_get_videomode(dp->dev->of_node, &dp->panel.vm,
+     ret = of_get_videomode(videomode_parent, &dp->panel.vm,

You shouldn't be grabbing the video timings from some random node like this. Instead you should use the DRM panel's .get_modes() function to query the supported modes. The panel may not (in fact, should not, at least under most circumstances) define video timings in the device tree.

Right, I am planning to use panel-simple driver by adding drm_display_mode structure for the lvds panels. So, I would not need this change.

Quoted 14 lines

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_probe(struct platform_device *pdev) · line 1361

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +6 -0
@@ -1341,6 +1353,21 @@ static int exynos_dp_probe(struct platform_device *pdev)
      if (ret)
              return ret;
 
+     dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device),
+                             GFP_KERNEL);
+     if (!dp)
+             return -ENOMEM;
+
+     dp->panel_node = of_parse_phandle(dev->of_node, "edp-panel", 0);

There should be no need to store the struct device_node * obtained here in the context like this.

Quoted 5 lines

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_probe(struct platform_device *pdev) · line 1364

Quoted 3 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +3 -0
+     if (dp->panel_node) {
+             dp->edp_panel = of_drm_find_panel(dp->panel_node);
+             of_node_put(dp->panel_node);

Especially since after this that pointer may become invalid.

Same explanation as above. Need not store panel_node inside private context.

Ajay

author
#12 lore raw

PATCH v5 4/12 drm/panel: Add driver for lvds/edp based panels

In reply to Ajay Kumar

This patch adds a simple driver to handle all the LCD and LED powerup/down routines needed to support eDP/LVDS panels.

The LCD and LED units are usually powered up via regulators, and almost on all boards, we will have a BACKLIGHT_EN pin to enable/ disable the backlight.
Sometimes, we can have LCD_EN switches as well.

The routines in this driver can be used to control panel power sequence on such boards.

---
 drivers/gpu/drm/panel/Kconfig      |   10 ++
 drivers/gpu/drm/panel/Makefile     |    1 +
 drivers/gpu/drm/panel/panel-lvds.c |  268 ++++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-lvds.c
drivers/gpu/drm/panel/Kconfig +10 -0
index 4ec874d..8fe7ee5 100644
@@ -30,4 +30,14 @@ config DRM_PANEL_S6E8AA0
 	select DRM_MIPI_DSI
 	select VIDEOMODE_HELPERS
 
+config DRM_PANEL_EDP_LVDS
+	tristate "support for eDP/LVDS panels"
+	depends on OF && DRM_PANEL
+	select VIDEOMODE_HELPERS
+	help
+	  DRM panel driver for direct eDP panels or LVDS connected
+	  via DP bridges, that need at most a regulator for LCD unit,
+	  a regulator for LED unit and/or enable GPIOs for LCD or LED units.
+	  Delay values can also be specified to support powerup and
+	  powerdown process.
 endmenu
drivers/gpu/drm/panel/Makefile +1 -0
index 8b92921..eaafa01 100644
@@ -1,3 +1,4 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o
 obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o
+obj-$(CONFIG_DRM_PANEL_EDP_LVDS) += panel-lvds.o
drivers/gpu/drm/panel/panel-lvds.c new file +268 -0

268 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#13 lore raw

PATCH v5 5/12 Documentation: Add DT bindings for panel-lvds driver

In reply to Ajay Kumar

Add DT binding documentation for panel-lvds driver.

---
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +50 -0
new file mode 100644
index 0000000..fdf91da2
@@ -0,0 +1,50 @@
+panel interface for eDP/lvds panels
+
+Required properties:
+  - compatible: "panel-lvds"
+
+Optional properties:
+	-lcd-enable-gpios:
+		panel LCD poweron GPIO.
+			Indicates which GPIO needs to be powered up as output
+			to powerup/enable the switch to the LCD panel.
+	-backlight-enable-gpios:
+		panel LED enable GPIO.
+			Indicates which GPIO needs to be powered up as output
+			to enable the backlight.
+	-panel-prepare-delay:
+		delay value in ms required for panel_prepare process
+			Delay in ms needed for the panel LCD unit to
+			powerup completely.
+			ex: delay needed till eDP panel throws HPD.
+			    delay needed so that we cans tart reading edid.
+	-panel-enable-delay:
+		delay value in ms required for panel_enable process
+			Delay in ms needed for the panel backlight/LED unit
+			to powerup, and delay needed between video_enable and
+			backlight_enable.
+	-panel-disable-delay:
+		delay value in ms required for panel_disable process
+			Delay in ms needed for the panel backlight/LED unit
+			powerdown, and delay needed between backlight_disable
+			and video_disable.
+	-panel-unprepare-delay:
+		delay value in ms required for panel_post_disable process
+			Delay in ms needed for the panel LCD unit to
+			to powerdown completely, and the minimum delay needed
+			before powering it on again.
+	-panel-width-mm: physical panel width [mm]
+	-panel-height-mm: physical panel height [mm]
+
+Example:
+
+	panel-lvds {
+		compatible = "panel-lvds";
+		backlight-enable-gpios = <&gpx3 0 0>;
+		panel-prepare-delay = <40>;
+		panel-enable-delay = <20>;
+		panel-disable-delay = <20>;
+		panel-unprepare-delay = <30>;
+		panel-width-mm = <256>;
+		panel-height-mm = <144>;
+	};
Signature · 1 line
1.7.9.5
#14 lore raw

Re: [PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver

[email protected]

Quoted 67 lines · Ajay Kumar

Add DT binding documentation for panel-lvds driver.

---
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +50 -1
new file mode 100644
index 0000000..fdf91da2
@@ -0,0 +1,50 @@
+panel interface for eDP/lvds panels
+
+Required properties:
+  - compatible: "panel-lvds"
+
+Optional properties:
+       -lcd-enable-gpios:
+               panel LCD poweron GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to powerup/enable the switch to the LCD panel.
+       -backlight-enable-gpios:
+               panel LED enable GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to enable the backlight.
+       -panel-prepare-delay:
+               delay value in ms required for panel_prepare process
+                       Delay in ms needed for the panel LCD unit to
+                       powerup completely.
+                       ex: delay needed till eDP panel throws HPD.
+                           delay needed so that we cans tart reading edid.
+       -panel-enable-delay:
+               delay value in ms required for panel_enable process
+                       Delay in ms needed for the panel backlight/LED unit
+                       to powerup, and delay needed between video_enable and
+                       backlight_enable.
+       -panel-disable-delay:
+               delay value in ms required for panel_disable process
+                       Delay in ms needed for the panel backlight/LED unit
+                       powerdown, and delay needed between backlight_disable
+                       and video_disable.
+       -panel-unprepare-delay:
+               delay value in ms required for panel_post_disable process
+                       Delay in ms needed for the panel LCD unit to
+                       to powerdown completely, and the minimum delay needed
+                       before powering it on again.
+       -panel-width-mm: physical panel width [mm]
+       -panel-height-mm: physical panel height [mm]
+
+Example:
+
+       panel-lvds {
+               compatible = "panel-lvds";
+               backlight-enable-gpios = <&gpx3 0 0>;
+               panel-prepare-delay = <40>;
+               panel-enable-delay = <20>;
+               panel-disable-delay = <20>;
+               panel-unprepare-delay = <30>;
+               panel-width-mm = <256>;
+               panel-height-mm = <144>;
+       };
--

1.7.9.5

#15 lore raw

Re: [PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver

Quoted 11 lines · Ajay kumar

[email protected]

Quoted 8 lines · Ajay Kumar

Add DT binding documentation for panel-lvds driver.

---
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
Quoted 10 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +4 -0
new file mode 100644
index 0000000..fdf91da2
@@ -0,0 +1,50 @@
+panel interface for eDP/lvds panels
+
+Required properties:
+  - compatible: "panel-lvds"

I think I've said this before. I oppose the addition of this binding. We need to list a device-specific compatible value here, wildcards like this aren't a good choice. And then if we have that compatible value we can move most of the optional properties below into a driver.

Quoted 1 line

Documentation/devicetree/bindings/panel/panel-lvds.txt line 6

Quoted 1 line
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +1 -0
+Optional properties:

If all these properties are optional, then what happens if a device tree node doesn't contain any of them? Doesn't that turn the driver into one big no-op?

Quoted 8 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 14

Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +8 -0
+       -lcd-enable-gpios:
+               panel LCD poweron GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to powerup/enable the switch to the LCD panel.
+       -backlight-enable-gpios:
+               panel LED enable GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to enable the backlight.

I've also said before that this really belongs in a backlight driver. Chances are that you'll want to have a way to set the brightness of the backlight as well, so simply an enable GPIO won't be good enough.

Quoted 6 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 20

Quoted 6 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +6 -0
+       -panel-prepare-delay:
+               delay value in ms required for panel_prepare process
+                       Delay in ms needed for the panel LCD unit to
+                       powerup completely.
+                       ex: delay needed till eDP panel throws HPD.
+                           delay needed so that we cans tart reading edid.

If the panel signals HPD then we don't need this delay at all and we should just wait for HPD instead.

Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +7 -0
+       -panel-enable-delay:
+               delay value in ms required for panel_enable process
+                       Delay in ms needed for the panel backlight/LED unit
+                       to powerup, and delay needed between video_enable and
+                       backlight_enable.
+       -panel-disable-delay:
+               delay value in ms required for panel_disable process
Quoted 8 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 35

Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +8 -0
+                       Delay in ms needed for the panel backlight/LED unit
+                       powerdown, and delay needed between backlight_disable
+                       and video_disable.
+       -panel-unprepare-delay:
+               delay value in ms required for panel_post_disable process
+                       Delay in ms needed for the panel LCD unit to
+                       to powerdown completely, and the minimum delay needed
+                       before powering it on again.

These delays are all panel specific and they don't vary per board, so they shouldn't go into the device tree at all.

Quoted 2 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 37

Quoted 2 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +2 -0
+       -panel-width-mm: physical panel width [mm]
+       -panel-height-mm: physical panel height [mm]

Same here.

Thierry

#16 lore raw

Re: [PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver

Hi Thierry,

Thanks for your comments.

Quoted 12 lines · Thierry Reding
Quoted 11 lines · Ajay kumar

[email protected]

Quoted 8 lines · Ajay Kumar

Add DT binding documentation for panel-lvds driver.

---
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
Quoted 15 lines
Quoted 10 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +4 -0
new file mode 100644
index 0000000..fdf91da2
@@ -0,0 +1,50 @@
+panel interface for eDP/lvds panels
+
+Required properties:
+  - compatible: "panel-lvds"

I think I've said this before. I oppose the addition of this binding. We need to list a device-specific compatible value here, wildcards like this aren't a good choice. And then if we have that compatible value we can move most of the optional properties below into a driver.

Yes, "panel-lvds" is a wildcard for all lvds panels.
And since lvds panels from different vendors have different values for power_up_delay, delay from video_to_backlight etc, I thought its better to pick them up from device tree.

Quoted 5 lines
Quoted 1 line

Documentation/devicetree/bindings/panel/panel-lvds.txt line 6

Quoted 1 line
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +1 -0
+Optional properties:

If all these properties are optional, then what happens if a device tree node doesn't contain any of them? Doesn't that turn the driver into one big no-op?

No! We need to provide lcd-supply and backlight-supply.

Quoted 9 lines
Quoted 8 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 14

Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +8 -0
+       -lcd-enable-gpios:
+               panel LCD poweron GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to powerup/enable the switch to the LCD panel.
+       -backlight-enable-gpios:
+               panel LED enable GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to enable the backlight.
Quoted 3 lines

I've also said before that this really belongs in a backlight driver. Chances are that you'll want to have a way to set the brightness of the backlight as well, so simply an enable GPIO won't be good enough.

Ok. I can handle this in backlight driver itself (with some minor glitches). But, how do I map bridge functions to panel functions now?
The bridge supports (pre_enable, enable, disable and post_disable) which I map with (prepare, enable, disable and unprepare) of the panel, using a sample layer called bridge to panel_binder.
Moving out the backlight control from panel means I really don't need those extra
panel calls(prepare and unprepare)!
Then how to distribute 2 panel calls(enable and disable) across 4 bridge calls?

Quoted 9 lines
Quoted 6 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 20

Quoted 6 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +6 -0
+       -panel-prepare-delay:
+               delay value in ms required for panel_prepare process
+                       Delay in ms needed for the panel LCD unit to
+                       powerup completely.
+                       ex: delay needed till eDP panel throws HPD.
+                           delay needed so that we cans tart reading edid.

If the panel signals HPD then we don't need this delay at all and we should just wait for HPD instead.

Not always for HPD, we need to wait for EDID module as well.

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +7 -0
+       -panel-enable-delay:
+               delay value in ms required for panel_enable process
+                       Delay in ms needed for the panel backlight/LED unit
+                       to powerup, and delay needed between video_enable and
+                       backlight_enable.
+       -panel-disable-delay:
+               delay value in ms required for panel_disable process
Quoted 8 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 35

Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +8 -0
+                       Delay in ms needed for the panel backlight/LED unit
+                       powerdown, and delay needed between backlight_disable
+                       and video_disable.
+       -panel-unprepare-delay:
+               delay value in ms required for panel_post_disable process
+                       Delay in ms needed for the panel LCD unit to
+                       to powerdown completely, and the minimum delay needed
+                       before powering it on again.
Quoted 2 lines

These delays are all panel specific and they don't vary per board, so they shouldn't go into the device tree at all.

But, fetching them from device tree would allow us to support all lvds panels in this single driver.

Thanks and Regards,
Ajay Kumar

#17 lore raw

Re: [PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver

Quoted 33 lines · Ajay kumar

Hi Thierry,

Thanks for your comments.

Quoted 12 lines · Thierry Reding
Quoted 11 lines · Ajay kumar

[email protected]

Quoted 8 lines · Ajay Kumar

Add DT binding documentation for panel-lvds driver.

---
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
Quoted 15 lines
Quoted 10 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +4 -0
new file mode 100644
index 0000000..fdf91da2
@@ -0,0 +1,50 @@
+panel interface for eDP/lvds panels
+
+Required properties:
+  - compatible: "panel-lvds"

I think I've said this before. I oppose the addition of this binding. We need to list a device-specific compatible value here, wildcards like this aren't a good choice. And then if we have that compatible value we can move most of the optional properties below into a driver.

Quoted 4 lines

Yes, "panel-lvds" is a wildcard for all lvds panels.
And since lvds panels from different vendors have different values for power_up_delay, delay from video_to_backlight etc, I thought its better to pick them up from device tree.

What I'm saying is that we shouldn't be adding this type of wildcard. Instead the compatible property needs to list the specific type of panel and since the driver will match on that specific compatible, the values for the delays etc. are all implicit and don't have to be listed in device tree.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Documentation/devicetree/bindings/panel/panel-lvds.txt line 6

Quoted 1 line
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +1 -0
+Optional properties:

If all these properties are optional, then what happens if a device tree node doesn't contain any of them? Doesn't that turn the driver into one big no-op?

No! We need to provide lcd-supply and backlight-supply.

What are those? I don't see them described anywhere.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +8 -0
+       -lcd-enable-gpios:
+               panel LCD poweron GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to powerup/enable the switch to the LCD panel.
+       -backlight-enable-gpios:
+               panel LED enable GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to enable the backlight.
Quoted 4 lines
Quoted 3 lines

I've also said before that this really belongs in a backlight driver. Chances are that you'll want to have a way to set the brightness of the backlight as well, so simply an enable GPIO won't be good enough.

Ok. I can handle this in backlight driver itself (with some minor glitches).

You can make it work without glitches as well and we've discussed this before.

Quoted 8 lines

But, how do I map bridge functions to panel functions now?
The bridge supports (pre_enable, enable, disable and post_disable) which I map with (prepare, enable, disable and unprepare) of the panel, using a sample layer called bridge to panel_binder.
Moving out the backlight control from panel means I really don't need those extra
panel calls(prepare and unprepare)!
Then how to distribute 2 panel calls(enable and disable) across 4 bridge calls?

The .prepare() and .unprepare() functions are useful irrespective of backlight control. What you want to separate is powering up the panel from enabling the backlight. So .prepare() could be what's doing the power up of the panel (and possibly other initialization required to make it work) and .enable() could be as simple as turning on the backlight.

What I'm saying is rather than use a backlight-enable-gpios property in the panel, that property should be part of the backlight device and the GPIO can then be toggled by the backlight driver when the backlight is enabled.

Quoted 10 lines
Quoted 9 lines
Quoted 6 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 20

Quoted 6 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +6 -0
+       -panel-prepare-delay:
+               delay value in ms required for panel_prepare process
+                       Delay in ms needed for the panel LCD unit to
+                       powerup completely.
+                       ex: delay needed till eDP panel throws HPD.
+                           delay needed so that we cans tart reading edid.

If the panel signals HPD then we don't need this delay at all and we should just wait for HPD instead.

Not always for HPD, we need to wait for EDID module as well.

I always thought that HPD signalled readiness from the panel to provide EDID, too. Are there really panels that need additional delays after HPD has been signalled until the EDID can be read? Are there maybe other ways to detect that EDID can't be read?

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +15 -0
+       -panel-enable-delay:
+               delay value in ms required for panel_enable process
+                       Delay in ms needed for the panel backlight/LED unit
+                       to powerup, and delay needed between video_enable and
+                       backlight_enable.
+       -panel-disable-delay:
+               delay value in ms required for panel_disable process
+                       Delay in ms needed for the panel backlight/LED unit
+                       powerdown, and delay needed between backlight_disable
+                       and video_disable.
+       -panel-unprepare-delay:
+               delay value in ms required for panel_post_disable process
+                       Delay in ms needed for the panel LCD unit to
+                       to powerdown completely, and the minimum delay needed
+                       before powering it on again.
Quoted 4 lines
Quoted 2 lines

These delays are all panel specific and they don't vary per board, so they shouldn't go into the device tree at all.

But, fetching them from device tree would allow us to support all lvds panels in this single driver.

You can do that even without having this data in device tree. My point is that this is redundant information once you know the panel's specific compatible value. Therefore there shouldn't be a need to list this in device tree again.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#18 lore raw

Re: [PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver

Hi Thierry,

Quoted 129 lines · Thierry Reding
Quoted 33 lines · Ajay kumar

Hi Thierry,

Thanks for your comments.

Quoted 12 lines · Thierry Reding
Quoted 11 lines · Ajay kumar

[email protected]

Quoted 8 lines · Ajay Kumar

Add DT binding documentation for panel-lvds driver.

---
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
Quoted 15 lines
Quoted 10 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +4 -0
new file mode 100644
index 0000000..fdf91da2
@@ -0,0 +1,50 @@
+panel interface for eDP/lvds panels
+
+Required properties:
+  - compatible: "panel-lvds"

I think I've said this before. I oppose the addition of this binding. We need to list a device-specific compatible value here, wildcards like this aren't a good choice. And then if we have that compatible value we can move most of the optional properties below into a driver.

Quoted 4 lines

Yes, "panel-lvds" is a wildcard for all lvds panels.
And since lvds panels from different vendors have different values for power_up_delay, delay from video_to_backlight etc, I thought its better to pick them up from device tree.

What I'm saying is that we shouldn't be adding this type of wildcard. Instead the compatible property needs to list the specific type of panel and since the driver will match on that specific compatible, the values for the delays etc. are all implicit and don't have to be listed in device tree.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Documentation/devicetree/bindings/panel/panel-lvds.txt line 6

Quoted 1 line
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +1 -0
+Optional properties:

If all these properties are optional, then what happens if a device tree node doesn't contain any of them? Doesn't that turn the driver into one big no-op?

No! We need to provide lcd-supply and backlight-supply.

What are those? I don't see them described anywhere.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +8 -0
+       -lcd-enable-gpios:
+               panel LCD poweron GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to powerup/enable the switch to the LCD panel.
+       -backlight-enable-gpios:
+               panel LED enable GPIO.
+                       Indicates which GPIO needs to be powered up as output
+                       to enable the backlight.
Quoted 4 lines
Quoted 3 lines

I've also said before that this really belongs in a backlight driver. Chances are that you'll want to have a way to set the brightness of the backlight as well, so simply an enable GPIO won't be good enough.

Ok. I can handle this in backlight driver itself (with some minor glitches).

You can make it work without glitches as well and we've discussed this before.

Quoted 8 lines

But, how do I map bridge functions to panel functions now?
The bridge supports (pre_enable, enable, disable and post_disable) which I map with (prepare, enable, disable and unprepare) of the panel, using a sample layer called bridge to panel_binder.
Moving out the backlight control from panel means I really don't need those extra
panel calls(prepare and unprepare)!
Then how to distribute 2 panel calls(enable and disable) across 4 bridge calls?

The .prepare() and .unprepare() functions are useful irrespective of backlight control. What you want to separate is powering up the panel from enabling the backlight. So .prepare() could be what's doing the power up of the panel (and possibly other initialization required to make it work) and .enable() could be as simple as turning on the backlight.

What I'm saying is rather than use a backlight-enable-gpios property in the panel, that property should be part of the backlight device and the GPIO can then be toggled by the backlight driver when the backlight is enabled.

Quoted 10 lines
Quoted 9 lines
Quoted 6 lines

Documentation/devicetree/bindings/panel/panel-lvds.txt line 20

Quoted 6 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +6 -0
+       -panel-prepare-delay:
+               delay value in ms required for panel_prepare process
+                       Delay in ms needed for the panel LCD unit to
+                       powerup completely.
+                       ex: delay needed till eDP panel throws HPD.
+                           delay needed so that we cans tart reading edid.

If the panel signals HPD then we don't need this delay at all and we should just wait for HPD instead.

Not always for HPD, we need to wait for EDID module as well.

I always thought that HPD signalled readiness from the panel to provide EDID, too. Are there really panels that need additional delays after HPD has been signalled until the EDID can be read? Are there maybe other ways to detect that EDID can't be read?

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/panel/panel-lvds.txt new file +15 -0
+       -panel-enable-delay:
+               delay value in ms required for panel_enable process
+                       Delay in ms needed for the panel backlight/LED unit
+                       to powerup, and delay needed between video_enable and
+                       backlight_enable.
+       -panel-disable-delay:
+               delay value in ms required for panel_disable process
+                       Delay in ms needed for the panel backlight/LED unit
+                       powerdown, and delay needed between backlight_disable
+                       and video_disable.
+       -panel-unprepare-delay:
+               delay value in ms required for panel_post_disable process
+                       Delay in ms needed for the panel LCD unit to
+                       to powerdown completely, and the minimum delay needed
+                       before powering it on again.
Quoted 4 lines
Quoted 2 lines

These delays are all panel specific and they don't vary per board, so they shouldn't go into the device tree at all.

But, fetching them from device tree would allow us to support all lvds panels in this single driver.

Quoted 6 lines

You can do that even without having this data in device tree. My point is that this is redundant information once you know the panel's specific compatible value. Therefore there shouldn't be a need to list this in device tree again.

Thierry

I am planning to use panel-simple driver for the lvds panels. Let me test using that and if things workout well, then will drop this entire driver.

Ajay

author
#19 lore raw

PATCH RESEND v5 6/12 drm/bridge: add helper functions to support bridge chain

In reply to Ajay Kumar

Add helper functions to create bridge chain and to call the corresponding next_bridge functions.

---
 include/drm/drm_crtc.h |   72 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
include/drm/drm_crtc.h +72 -0
index e529b68..0a6950a 100644
@@ -652,6 +652,7 @@ struct drm_bridge_funcs {
 struct drm_bridge {
 	struct drm_device *dev;
 	struct list_head head;
+	struct drm_bridge *next_bridge;
 
 	struct drm_mode_object base;
 
@@ -1166,6 +1167,77 @@ drm_property_blob_find(struct drm_device *dev, uint32_t id)
 	return mo ? obj_to_blob(mo) : NULL;
 }
 
+static inline int drm_bridge_add_to_chain(struct drm_bridge *head,
+					  struct drm_bridge *last)
+{
+	struct drm_bridge *temp = head;
+
+	if (head && last) {
+		while (temp->next_bridge)
+			temp = temp->next_bridge;
+
+		temp->next_bridge = last;
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
+static inline void drm_next_bridge_mode_fixup(struct drm_bridge *bridge,
+					const struct drm_display_mode *mode,
+					struct drm_display_mode *adjusted_mode)
+{
+	if (bridge && bridge->next_bridge && bridge->next_bridge->funcs &&
+	    bridge->next_bridge->funcs->mode_fixup)
+		bridge->next_bridge->funcs->mode_fixup(bridge->next_bridge,
+							mode, adjusted_mode);
+}
+
+static inline void drm_next_bridge_disable(struct drm_bridge *bridge)
+{
+	if (bridge && bridge->next_bridge && bridge->next_bridge->funcs &&
+	    bridge->next_bridge->funcs->disable)
+		bridge->next_bridge->funcs->disable(bridge->next_bridge);
+}
+
+static inline void drm_next_bridge_post_disable(struct drm_bridge *bridge)
+{
+	if (bridge && bridge->next_bridge && bridge->next_bridge->funcs &&
+	    bridge->next_bridge->funcs->post_disable)
+		bridge->next_bridge->funcs->post_disable(bridge->next_bridge);
+}
+
+static inline void drm_next_bridge_mode_set(struct drm_bridge *bridge,
+					struct drm_display_mode *mode,
+					struct drm_display_mode *adjusted_mode)
+{
+	if (bridge && bridge->next_bridge && bridge->next_bridge->funcs &&
+	    bridge->next_bridge->funcs->mode_set)
+		bridge->next_bridge->funcs->mode_set(bridge->next_bridge,
+							mode, adjusted_mode);
+}
+
+static inline void drm_next_bridge_pre_enable(struct drm_bridge *bridge)
+{
+	if (bridge && bridge->next_bridge && bridge->next_bridge->funcs &&
+	    bridge->next_bridge->funcs->pre_enable)
+		bridge->next_bridge->funcs->pre_enable(bridge->next_bridge);
+}
+
+static inline void drm_next_bridge_enable(struct drm_bridge *bridge)
+{
+	if (bridge && bridge->next_bridge && bridge->next_bridge->funcs &&
+	    bridge->next_bridge->funcs->enable)
+		bridge->next_bridge->funcs->enable(bridge->next_bridge);
+}
+
+static inline void drm_next_bridge_destroy(struct drm_bridge *bridge)
+{
+	if (bridge && bridge->next_bridge && bridge->next_bridge->funcs &&
+	    bridge->next_bridge->funcs->destroy)
+		bridge->next_bridge->funcs->destroy(bridge->next_bridge);
+}
+
 /* Plane list iterator for legacy (overlay only) planes. */
 #define drm_for_each_legacy_plane(plane, planelist) \
 	list_for_each_entry(plane, planelist, head) \
Signature · 1 line
1.7.9.5
author
#20 lore raw

PATCH v5 7/12 drm/bridge: Add a driver which binds drm_bridge with drm_panel

In reply to Ajay Kumar

Add a dummy bridge which binds all of the drm_bridge callbacks to corresponding drm_panel callbacks.

In theory, this is just a glue layer for the last bridge and the panel attached to it.

This driver also implements the required drm_connector ops for the encoder(on which the entire bridge chain is hanging off).

---
 drivers/gpu/drm/bridge/Kconfig        |    7 ++
 drivers/gpu/drm/bridge/Makefile       |    1 +
 drivers/gpu/drm/bridge/panel_binder.c |  193 +++++++++++++++++++++++++++++++++
 include/drm/bridge/panel_binder.h     |   44 ++++++++
 4 files changed, 245 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/panel_binder.c
 create mode 100644 include/drm/bridge/panel_binder.h
drivers/gpu/drm/bridge/Kconfig +7 -0
index 884923f..e3fb487 100644
@@ -3,3 +3,10 @@ config DRM_PTN3460
 	depends on DRM
 	select DRM_KMS_HELPER
 	---help---
+
+config DRM_PANEL_BINDER
+	tristate "bridge panel binder"
+	depends on DRM
+	select DRM_KMS_HELPER
+	select DRM_PANEL
+	---help---
drivers/gpu/drm/bridge/Makefile +1 -0
index b4733e1..ba8b5b8 100644
@@ -1,3 +1,4 @@
 ccflags-y := -Iinclude/drm
 
 obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
+obj-$(CONFIG_DRM_PANEL_BINDER) += panel_binder.o
drivers/gpu/drm/bridge/panel_binder.c new file +193 -0

193 lines not on this page · raw message

include/drm/bridge/panel_binder.h new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#21 lore raw

PATCH RESEND v5 8/12 drm/bridge: ptn3460: Support bridge chaining

In reply to Ajay Kumar

Modify the driver to invoke callbacks for the next bridge in the bridge chain.
Also, remove the drm_connector implementation from ptn3460, since the same is implemented using panel_binder.

---
 drivers/gpu/drm/bridge/ptn3460.c        |  137 +++++--------------------------
 drivers/gpu/drm/exynos/exynos_dp_core.c |   16 ++--
 include/drm/bridge/ptn3460.h            |   15 ++--
 3 files changed, 39 insertions(+), 129 deletions(-)
drivers/gpu/drm/bridge/ptn3460.c +22 -115
index d466696..5fe16c6 100644
@@ -34,37 +34,15 @@
 #define PTN3460_EDID_SRAM_LOAD_ADDR		0x85
 
 struct ptn3460_bridge {
-	struct drm_connector connector;
 	struct i2c_client *client;
 	struct drm_encoder *encoder;
 	struct drm_bridge *bridge;
-	struct edid *edid;
 	int gpio_pd_n;
 	int gpio_rst_n;
 	u32 edid_emulation;
 	bool enabled;
 };
 
-static int ptn3460_read_bytes(struct ptn3460_bridge *ptn_bridge, char addr,
-		u8 *buf, int len)
-{
-	int ret;
-
-	ret = i2c_master_send(ptn_bridge->client, &addr, 1);
-	if (ret <= 0) {
-		DRM_ERROR("Failed to send i2c command, ret=%d\n", ret);
-		return ret;
-	}
-
-	ret = i2c_master_recv(ptn_bridge->client, buf, len);
-	if (ret <= 0) {
-		DRM_ERROR("Failed to recv i2c data, ret=%d\n", ret);
-		return ret;
-	}
-
-	return 0;
-}
-
 static int ptn3460_write_byte(struct ptn3460_bridge *ptn_bridge, char addr,
 		char val)
 {
@@ -126,6 +104,8 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
 		gpio_set_value(ptn_bridge->gpio_rst_n, 1);
 	}
 
+	drm_next_bridge_pre_enable(bridge);
+
 	/*
 	 * There's a bug in the PTN chip where it falsely asserts hotplug before
 	 * it is fully functional. We're forced to wait for the maximum start up
@@ -142,6 +122,7 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
 
 static void ptn3460_enable(struct drm_bridge *bridge)
 {
+	drm_next_bridge_enable(bridge);
 }
 
 static void ptn3460_disable(struct drm_bridge *bridge)
@@ -153,6 +134,8 @@ static void ptn3460_disable(struct drm_bridge *bridge)
 
 	ptn_bridge->enabled = false;
 
+	drm_next_bridge_disable(bridge);
+
 	if (gpio_is_valid(ptn_bridge->gpio_rst_n))
 		gpio_set_value(ptn_bridge->gpio_rst_n, 1);
 
@@ -162,6 +145,7 @@ static void ptn3460_disable(struct drm_bridge *bridge)
 
 static void ptn3460_post_disable(struct drm_bridge *bridge)
 {
+	drm_next_bridge_post_disable(bridge);
 }
 
 void ptn3460_bridge_destroy(struct drm_bridge *bridge)
@@ -173,6 +157,9 @@ void ptn3460_bridge_destroy(struct drm_bridge *bridge)
 		gpio_free(ptn_bridge->gpio_pd_n);
 	if (gpio_is_valid(ptn_bridge->gpio_rst_n))
 		gpio_free(ptn_bridge->gpio_rst_n);
+
+	drm_next_bridge_destroy(bridge);
+
 	/* Nothing else to free, we've got devm allocated memory */
 }
 
@@ -184,81 +171,10 @@ struct drm_bridge_funcs ptn3460_bridge_funcs = {
 	.destroy = ptn3460_bridge_destroy,
 };
 
-int ptn3460_get_modes(struct drm_connector *connector)
-{
-	struct ptn3460_bridge *ptn_bridge;
-	u8 *edid;
-	int ret, num_modes;
-	bool power_off;
-
-	ptn_bridge = container_of(connector, struct ptn3460_bridge, connector);
-
-	if (ptn_bridge->edid)
-		return drm_add_edid_modes(connector, ptn_bridge->edid);
-
-	power_off = !ptn_bridge->enabled;
-	ptn3460_pre_enable(ptn_bridge->bridge);
-
-	edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
-	if (!edid) {
-		DRM_ERROR("Failed to allocate edid\n");
-		return 0;
-	}
-
-	ret = ptn3460_read_bytes(ptn_bridge, PTN3460_EDID_ADDR, edid,
-			EDID_LENGTH);
-	if (ret) {
-		kfree(edid);
-		num_modes = 0;
-		goto out;
-	}
-
-	ptn_bridge->edid = (struct edid *)edid;
-	drm_mode_connector_update_edid_property(connector, ptn_bridge->edid);
-
-	num_modes = drm_add_edid_modes(connector, ptn_bridge->edid);
-
-out:
-	if (power_off)
-		ptn3460_disable(ptn_bridge->bridge);
-
-	return num_modes;
-}
-
-struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector)
-{
-	struct ptn3460_bridge *ptn_bridge;
-
-	ptn_bridge = container_of(connector, struct ptn3460_bridge, connector);
-
-	return ptn_bridge->encoder;
-}
-
-struct drm_connector_helper_funcs ptn3460_connector_helper_funcs = {
-	.get_modes = ptn3460_get_modes,
-	.best_encoder = ptn3460_best_encoder,
-};
-
-enum drm_connector_status ptn3460_detect(struct drm_connector *connector,
-		bool force)
-{
-	return connector_status_connected;
-}
-
-void ptn3460_connector_destroy(struct drm_connector *connector)
-{
-	drm_connector_cleanup(connector);
-}
-
-struct drm_connector_funcs ptn3460_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
-	.fill_modes = drm_helper_probe_single_connector_modes,
-	.detect = ptn3460_detect,
-	.destroy = ptn3460_connector_destroy,
-};
-
-int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
-		struct i2c_client *client, struct device_node *node)
+struct drm_bridge *ptn3460_init(struct drm_device *dev,
+				struct drm_encoder *encoder,
+				struct i2c_client *client,
+				struct device_node *node)
 {
 	int ret;
 	struct drm_bridge *bridge;
@@ -267,13 +183,13 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 	bridge = devm_kzalloc(dev->dev, sizeof(*bridge), GFP_KERNEL);
 	if (!bridge) {
 		DRM_ERROR("Failed to allocate drm bridge\n");
-		return -ENOMEM;
+		return NULL;
 	}
 
 	ptn_bridge = devm_kzalloc(dev->dev, sizeof(*ptn_bridge), GFP_KERNEL);
 	if (!ptn_bridge) {
 		DRM_ERROR("Failed to allocate ptn bridge\n");
-		return -ENOMEM;
+		return NULL;
 	}
 
 	ptn_bridge->client = client;
@@ -285,7 +201,7 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 				GPIOF_OUT_INIT_HIGH, "PTN3460_PD_N");
 		if (ret) {
 			DRM_ERROR("Request powerdown-gpio failed (%d)\n", ret);
-			return ret;
+			return NULL;
 		}
 	}
 
@@ -300,7 +216,7 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 		if (ret) {
 			DRM_ERROR("Request reset-gpio failed (%d)\n", ret);
 			gpio_free(ptn_bridge->gpio_pd_n);
-			return ret;
+			return NULL;
 		}
 	}
 
@@ -318,26 +234,17 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 	}
 
 	bridge->driver_private = ptn_bridge;
-	encoder->bridge = bridge;
+	if (!encoder->bridge)
+		/* First entry in the bridge chain */
+		encoder->bridge = bridge;
 
-	ret = drm_connector_init(dev, &ptn_bridge->connector,
-			&ptn3460_connector_funcs, DRM_MODE_CONNECTOR_LVDS);
-	if (ret) {
-		DRM_ERROR("Failed to initialize connector with drm\n");
-		goto err;
-	}
-	drm_connector_helper_add(&ptn_bridge->connector,
-			&ptn3460_connector_helper_funcs);
-	drm_connector_register(&ptn_bridge->connector);
-	drm_mode_connector_attach_encoder(&ptn_bridge->connector, encoder);
-
-	return 0;
+	return bridge;
 
 err:
 	if (gpio_is_valid(ptn_bridge->gpio_pd_n))
 		gpio_free(ptn_bridge->gpio_pd_n);
 	if (gpio_is_valid(ptn_bridge->gpio_rst_n))
 		gpio_free(ptn_bridge->gpio_rst_n);
-	return ret;
+	return NULL;
 }
 EXPORT_SYMBOL(ptn3460_init);
drivers/gpu/drm/exynos/exynos_dp_core.c +8 -8
index b3d0d9b..9d31296 100644
@@ -988,19 +988,19 @@ static bool find_bridge(const char *compat, struct bridge_init *bridge)
 	return true;
 }
 
-/* returns the number of bridges attached */
-static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
+static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
 		struct drm_encoder *encoder)
 {
 	struct bridge_init bridge;
-	int ret;
+	struct drm_bridge *bridge_chain = NULL;
+	bool connector_created = false;
 
 	if (find_bridge("nxp,ptn3460", &bridge)) {
-		ret = ptn3460_init(dev, encoder, bridge.client, bridge.node);
-		if (!ret)
-			return 1;
+		bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
+								bridge.node);
 	}
-	return 0;
+
+	return connector_created;
 }
 
 static int exynos_dp_create_connector(struct exynos_drm_display *display,
@@ -1013,7 +1013,7 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
 	dp->encoder = encoder;
 
 	/* Pre-empt DP connector creation if there's a bridge */
-	ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder);
+	ret = exynos_drm_attach_lcd_bridge(dp, encoder);
 	if (ret)
 		return 0;
 
include/drm/bridge/ptn3460.h +9 -6
index ff62344..f612b9b 100644
@@ -21,15 +21,18 @@ struct device_node;
 
 #if defined(CONFIG_DRM_PTN3460) || defined(CONFIG_DRM_PTN3460_MODULE)
 
-int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
-		struct i2c_client *client, struct device_node *node);
+struct drm_bridge *ptn3460_init(struct drm_device *dev,
+				struct drm_encoder *encoder,
+				struct i2c_client *client,
+				struct device_node *node);
 #else
 
-static inline int ptn3460_init(struct drm_device *dev,
-		struct drm_encoder *encoder, struct i2c_client *client,
-		struct device_node *node)
+static inline struct drm_bridge *ptn3460_init(struct drm_device *dev,
+						struct drm_encoder *encoder,
+						struct i2c_client *client,
+						struct device_node *node)
 {
-	return 0;
+	return NULL;
 }
 
 #endif
Signature · 1 line
1.7.9.5
maintainer
#22 lore raw

Re: [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining

Quoted 185 lines · Ajay Kumar

Modify the driver to invoke callbacks for the next bridge in the bridge chain.
Also, remove the drm_connector implementation from ptn3460, since the same is implemented using panel_binder.

---
 drivers/gpu/drm/bridge/ptn3460.c        |  137 +++++--------------------------
 drivers/gpu/drm/exynos/exynos_dp_core.c |   16 ++--
 include/drm/bridge/ptn3460.h            |   15 ++--
 3 files changed, 39 insertions(+), 129 deletions(-)
drivers/gpu/drm/bridge/ptn3460.c +13 -97
index d466696..5fe16c6 100644
@@ -34,37 +34,15 @@
 #define PTN3460_EDID_SRAM_LOAD_ADDR		0x85
 
 struct ptn3460_bridge {
-	struct drm_connector connector;
 	struct i2c_client *client;
 	struct drm_encoder *encoder;
 	struct drm_bridge *bridge;
-	struct edid *edid;
 	int gpio_pd_n;
 	int gpio_rst_n;
 	u32 edid_emulation;
 	bool enabled;
 };
 
-static int ptn3460_read_bytes(struct ptn3460_bridge *ptn_bridge, char addr,
-		u8 *buf, int len)
-{
-	int ret;
-
-	ret = i2c_master_send(ptn_bridge->client, &addr, 1);
-	if (ret <= 0) {
-		DRM_ERROR("Failed to send i2c command, ret=%d\n", ret);
-		return ret;
-	}
-
-	ret = i2c_master_recv(ptn_bridge->client, buf, len);
-	if (ret <= 0) {
-		DRM_ERROR("Failed to recv i2c data, ret=%d\n", ret);
-		return ret;
-	}
-
-	return 0;
-}
-
 static int ptn3460_write_byte(struct ptn3460_bridge *ptn_bridge, char addr,
 		char val)
 {
@@ -126,6 +104,8 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
 		gpio_set_value(ptn_bridge->gpio_rst_n, 1);
 	}
 
+	drm_next_bridge_pre_enable(bridge);
+
 	/*
 	 * There's a bug in the PTN chip where it falsely asserts hotplug before
 	 * it is fully functional. We're forced to wait for the maximum start up
@@ -142,6 +122,7 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
 
 static void ptn3460_enable(struct drm_bridge *bridge)
 {
+	drm_next_bridge_enable(bridge);
 }
 
 static void ptn3460_disable(struct drm_bridge *bridge)
@@ -153,6 +134,8 @@ static void ptn3460_disable(struct drm_bridge *bridge)
 
 	ptn_bridge->enabled = false;
 
+	drm_next_bridge_disable(bridge);
+
 	if (gpio_is_valid(ptn_bridge->gpio_rst_n))
 		gpio_set_value(ptn_bridge->gpio_rst_n, 1);
 
@@ -162,6 +145,7 @@ static void ptn3460_disable(struct drm_bridge *bridge)
 
 static void ptn3460_post_disable(struct drm_bridge *bridge)
 {
+	drm_next_bridge_post_disable(bridge);
 }
 
 void ptn3460_bridge_destroy(struct drm_bridge *bridge)
@@ -173,6 +157,9 @@ void ptn3460_bridge_destroy(struct drm_bridge *bridge)
 		gpio_free(ptn_bridge->gpio_pd_n);
 	if (gpio_is_valid(ptn_bridge->gpio_rst_n))
 		gpio_free(ptn_bridge->gpio_rst_n);
+
+	drm_next_bridge_destroy(bridge);
+
 	/* Nothing else to free, we've got devm allocated memory */
 }
 
@@ -184,81 +171,10 @@ struct drm_bridge_funcs ptn3460_bridge_funcs = {
 	.destroy = ptn3460_bridge_destroy,
 };
 
-int ptn3460_get_modes(struct drm_connector *connector)
-{
-	struct ptn3460_bridge *ptn_bridge;
-	u8 *edid;
-	int ret, num_modes;
-	bool power_off;
-
-	ptn_bridge = container_of(connector, struct ptn3460_bridge, connector);
-
-	if (ptn_bridge->edid)
-		return drm_add_edid_modes(connector, ptn_bridge->edid);
-
-	power_off = !ptn_bridge->enabled;
-	ptn3460_pre_enable(ptn_bridge->bridge);
-
-	edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
-	if (!edid) {
-		DRM_ERROR("Failed to allocate edid\n");
-		return 0;
-	}
-
-	ret = ptn3460_read_bytes(ptn_bridge, PTN3460_EDID_ADDR, edid,
-			EDID_LENGTH);
-	if (ret) {
-		kfree(edid);
-		num_modes = 0;
-		goto out;
-	}
-
-	ptn_bridge->edid = (struct edid *)edid;
-	drm_mode_connector_update_edid_property(connector, ptn_bridge->edid);
-
-	num_modes = drm_add_edid_modes(connector, ptn_bridge->edid);
-
-out:
-	if (power_off)
-		ptn3460_disable(ptn_bridge->bridge);
-
-	return num_modes;
-}
-
-struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector)
-{
-	struct ptn3460_bridge *ptn_bridge;
-
-	ptn_bridge = container_of(connector, struct ptn3460_bridge, connector);
-
-	return ptn_bridge->encoder;
-}
-
-struct drm_connector_helper_funcs ptn3460_connector_helper_funcs = {
-	.get_modes = ptn3460_get_modes,
-	.best_encoder = ptn3460_best_encoder,
-};
-
-enum drm_connector_status ptn3460_detect(struct drm_connector *connector,
-		bool force)
-{
-	return connector_status_connected;
-}
-
-void ptn3460_connector_destroy(struct drm_connector *connector)
-{
-	drm_connector_cleanup(connector);
-}
-
-struct drm_connector_funcs ptn3460_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
-	.fill_modes = drm_helper_probe_single_connector_modes,
-	.detect = ptn3460_detect,
-	.destroy = ptn3460_connector_destroy,
-};
-
-int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
-		struct i2c_client *client, struct device_node *node)
+struct drm_bridge *ptn3460_init(struct drm_device *dev,
+				struct drm_encoder *encoder,
+				struct i2c_client *client,
+				struct device_node *node)
 {
 	int ret;
 	struct drm_bridge *bridge;

drivers/gpu/drm/bridge/ptn3460.c int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, · line 186

Quoted 5 lines
drivers/gpu/drm/bridge/ptn3460.c +1 -1
@@ -267,13 +183,13 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 	bridge = devm_kzalloc(dev->dev, sizeof(*bridge), GFP_KERNEL);
 	if (!bridge) {
 		DRM_ERROR("Failed to allocate drm bridge\n");
-		return -ENOMEM;
+		return NULL;

I think you could handle error case correctly. Please return ERR_PTR(-ENOMEM) instead of NULL, and below codes also.

Thanks,
Inki Dae

Quoted 28 lines
drivers/gpu/drm/bridge/ptn3460.c +3 -3
 	}
 
 	ptn_bridge = devm_kzalloc(dev->dev, sizeof(*ptn_bridge), GFP_KERNEL);
 	if (!ptn_bridge) {
 		DRM_ERROR("Failed to allocate ptn bridge\n");
-		return -ENOMEM;
+		return NULL;
 	}
 
 	ptn_bridge->client = client;
@@ -285,7 +201,7 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 				GPIOF_OUT_INIT_HIGH, "PTN3460_PD_N");
 		if (ret) {
 			DRM_ERROR("Request powerdown-gpio failed (%d)\n", ret);
-			return ret;
+			return NULL;
 		}
 	}
 
@@ -300,7 +216,7 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 		if (ret) {
 			DRM_ERROR("Request reset-gpio failed (%d)\n", ret);
 			gpio_free(ptn_bridge->gpio_pd_n);
-			return ret;
+			return NULL;
 		}
 	}
 
#23 lore raw

Re: [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining

In reply to Ajay Kumar

On Fri, Jul 18, 2014 at 02:13:54AM +0530, Ajay Kumar wrote:
[...]

Quoted 2 lines

Also, remove the drm_connector implementation from ptn3460, since the same is implemented using panel_binder.

I think that's a step backwards. In fact I think the panel-bridge binder driver shouldn't be needed at all. At least not for now. We have a very limited number of bridge drivers, so it shouldn't hurt at this stage to implement the connector instantiation within each driver. Once we have more bridge drivers, and therefore a better understanding of what they need, we can always add something like the panel-binder (though I think it should be library code, similar to the drm_encoder_helper_add() API, rather than this kind of self-contained object).

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#24 lore raw

Re: [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining

Hi Thierry,

Quoted 5 lines · Thierry Reding

On Fri, Jul 18, 2014 at 02:13:54AM +0530, Ajay Kumar wrote:
[...]

Quoted 2 lines

Also, remove the drm_connector implementation from ptn3460, since the same is implemented using panel_binder.

Quoted 8 lines

I think that's a step backwards. In fact I think the panel-bridge binder driver shouldn't be needed at all. At least not for now. We have a very limited number of bridge drivers, so it shouldn't hurt at this stage to implement the connector instantiation within each driver. Once we have more bridge drivers, and therefore a better understanding of what they need, we can always add something like the panel-binder (though I think it should be library code, similar to the drm_encoder_helper_add() API, rather than this kind of self-contained object).

panel_binder was needed to wrap around panel as a bridge, and this was in turn needed because people wanted to represent a bridge+panel combo as a chain of bridges.
So, if we choose to drop panel_binder, we choose to drop the idea of chaining the bridges, and end up calling drm_panel functions directly from individual bridges.
And, the bridge will implement the connector functions as you suggested. I am okay with this, if Daniel/Rob don't have an issue with this.

Ajay

#25 lore raw

Re: [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining

Quoted 17 lines · Ajay kumar

Hi Thierry,

Quoted 5 lines · Thierry Reding

On Fri, Jul 18, 2014 at 02:13:54AM +0530, Ajay Kumar wrote:
[...]

Quoted 2 lines

Also, remove the drm_connector implementation from ptn3460, since the same is implemented using panel_binder.

Quoted 8 lines

I think that's a step backwards. In fact I think the panel-bridge binder driver shouldn't be needed at all. At least not for now. We have a very limited number of bridge drivers, so it shouldn't hurt at this stage to implement the connector instantiation within each driver. Once we have more bridge drivers, and therefore a better understanding of what they need, we can always add something like the panel-binder (though I think it should be library code, similar to the drm_encoder_helper_add() API, rather than this kind of self-contained object).

Quoted 8 lines

panel_binder was needed to wrap around panel as a bridge, and this was in turn needed because people wanted to represent a bridge+panel combo as a chain of bridges.
So, if we choose to drop panel_binder, we choose to drop the idea of chaining the bridges, and end up calling drm_panel functions directly from individual bridges.
And, the bridge will implement the connector functions as you suggested. I am okay with this, if Daniel/Rob don't have an issue with this.

I think bridge chaining and panel handling are separate issues. That's why I think we shouldn't mix them like this. From earlier discussion[0] the conclusion was that the final element in the chain should implement a connector (with the appropriate type). Often that last element would be an encoder (when there are no bridges). Sometimes the last element would be a bridge. It's logical for that same element to also implement the panel integration since it's closely tied to the connector.

Thierry

[0]: http://lists.freedesktop.org/archives/dri-devel/2014-May/059685.html

#26 lore raw

Re: [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining

Quoted 35 lines · Thierry Reding
Quoted 17 lines · Ajay kumar

Hi Thierry,

Quoted 5 lines · Thierry Reding

On Fri, Jul 18, 2014 at 02:13:54AM +0530, Ajay Kumar wrote:
[...]

Quoted 2 lines

Also, remove the drm_connector implementation from ptn3460, since the same is implemented using panel_binder.

Quoted 8 lines

I think that's a step backwards. In fact I think the panel-bridge binder driver shouldn't be needed at all. At least not for now. We have a very limited number of bridge drivers, so it shouldn't hurt at this stage to implement the connector instantiation within each driver. Once we have more bridge drivers, and therefore a better understanding of what they need, we can always add something like the panel-binder (though I think it should be library code, similar to the drm_encoder_helper_add() API, rather than this kind of self-contained object).

Quoted 8 lines

panel_binder was needed to wrap around panel as a bridge, and this was in turn needed because people wanted to represent a bridge+panel combo as a chain of bridges.
So, if we choose to drop panel_binder, we choose to drop the idea of chaining the bridges, and end up calling drm_panel functions directly from individual bridges.
And, the bridge will implement the connector functions as you suggested. I am okay with this, if Daniel/Rob don't have an issue with this.

I think bridge chaining and panel handling are separate issues. That's why I think we shouldn't mix them like this. From earlier discussion[0] the conclusion was that the final element in the chain should implement a connector (with the appropriate type). Often that last element would be an encoder (when there are no bridges). Sometimes the last element would be a bridge. It's logical for that same element to also implement the panel integration since it's closely tied to the connector.

Quoted 3 lines

Thierry

[0]: http://lists.freedesktop.org/archives/dri-devel/2014-May/059685.html

Going with Thierry's opinion, if the bridge is allowed to do panel integration, there is no need for a bridge_chain. I mean a bridge_chain doesn't exist in my case at all. I have just one bridge which integrates a panel. Is it really necessary to keep next_bridge pointer and other helpers?

Ajay

author
#27 lore raw

PATCH RESEND v5 9/12 drm/exynos: dp: create bridge chain using ptn3460 and panel_binder

In reply to Ajay Kumar

exynos_dp supports a simple bridge chain with ptn3460 bridge and an LVDS panel attached to it.
This patch creates the bridge chain with ptn3460 as the head of the list and panel_binder being the tail.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +11 -1
index 9d31296..0ca6256 100644
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
+#include <drm/bridge/panel_binder.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"
@@ -992,7 +993,7 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
 		struct drm_encoder *encoder)
 {
 	struct bridge_init bridge;
-	struct drm_bridge *bridge_chain = NULL;
+	struct drm_bridge *bridge_chain = NULL, *next = NULL;
 	bool connector_created = false;
 
 	if (find_bridge("nxp,ptn3460", &bridge)) {
@@ -1000,6 +1001,15 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
 								bridge.node);
 	}
 
+	if (bridge_chain && dp->edp_panel) {
+		next = panel_binder_init(dp->drm_dev, encoder, bridge.client,
+			bridge.node, dp->edp_panel, DRM_MODE_CONNECTOR_LVDS,
+			DRM_CONNECTOR_POLL_HPD);
+		if (next)
+			connector_created = true;
+		drm_bridge_add_to_chain(bridge_chain, next);
+	}
+
 	return connector_created;
 }
 
Signature · 1 line
1.7.9.5
author
#28 lore raw

PATCH v5 10/12 drm/bridge: Add ps8622/ps8625 bridge driver

In reply to Ajay Kumar

From: Vincent Palatin <[email protected]>

This patch adds drm_bridge driver for parade DisplayPort to LVDS bridge chip.

---
 drivers/gpu/drm/bridge/Kconfig  |    8 +
 drivers/gpu/drm/bridge/Makefile |    1 +
 drivers/gpu/drm/bridge/ps8622.c |  476 +++++++++++++++++++++++++++++++++++++++
 include/drm/bridge/ps8622.h     |   41 ++++
 4 files changed, 526 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ps8622.c
 create mode 100644 include/drm/bridge/ps8622.h
drivers/gpu/drm/bridge/Kconfig +8 -0
index e3fb487..7b843c8 100644
@@ -10,3 +10,11 @@ config DRM_PANEL_BINDER
 	select DRM_KMS_HELPER
 	select DRM_PANEL
 	---help---
+
+config DRM_PS8622
+	tristate "Parade eDP/LVDS bridge"
+	depends on DRM
+	select DRM_KMS_HELPER
+	select BACKLIGHT_LCD_SUPPORT
+	select BACKLIGHT_CLASS_DEVICE
+	---help---
drivers/gpu/drm/bridge/Makefile +1 -0
index ba8b5b8..b494d4b 100644
@@ -2,3 +2,4 @@ ccflags-y := -Iinclude/drm
 
 obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
 obj-$(CONFIG_DRM_PANEL_BINDER) += panel_binder.o
+obj-$(CONFIG_DRM_PS8622) += ps8622.o
drivers/gpu/drm/bridge/ps8622.c new file +476 -0

476 lines not on this page · raw message

include/drm/bridge/ps8622.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#29 lore raw

PATCH v5 11/12 Documentation: Add DT bindings for ps8622/ps8625 bridge driver

In reply to Ajay Kumar

From: Vincent Palatin <[email protected]>

Add DT binding documentation for ps8622/ps8625 bridge driver.

---
 .../devicetree/bindings/drm/bridge/ps8622.txt      |   21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +21 -0
new file mode 100644
index 0000000..1d154ac
@@ -0,0 +1,21 @@
+ps8622-bridge bindings
+
+Required properties:
+	- compatible: "parade,ps8622" or "parade,ps8625"
+	- reg: first i2c address of the bridge
+	- sleep-gpios: OF device-tree gpio specification
+	- reset-gpios: OF device-tree gpio specification
+
+Optional properties:
+	- lane-count: number of DP lanes to use
+	- use-external-pwm: backlight will be controlled by an external PWM
+
+Example:
+	ps8622-bridge@48 {
+		compatible = "parade,ps8622";
+		reg = <0x48>;
+		sleep-gpios = <&gpc3 6 1 0 0>;
+		reset-gpios = <&gpc3 1 1 0 0>;
+		display-timings = <&lcd_display_timings>;
+		lane-count = <1>
+	};
Signature · 1 line
1.7.9.5
#30 lore raw

Re: [PATCH V5 11/12] Documentation: Add DT bindings for ps8622/ps8625 bridge driver

[email protected]

Quoted 41 lines · Ajay Kumar

From: Vincent Palatin <[email protected]>

Add DT binding documentation for ps8622/ps8625 bridge driver.

---
 .../devicetree/bindings/drm/bridge/ps8622.txt      |   21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +21 -1
new file mode 100644
index 0000000..1d154ac
@@ -0,0 +1,21 @@
+ps8622-bridge bindings
+
+Required properties:
+       - compatible: "parade,ps8622" or "parade,ps8625"
+       - reg: first i2c address of the bridge
+       - sleep-gpios: OF device-tree gpio specification
+       - reset-gpios: OF device-tree gpio specification
+
+Optional properties:
+       - lane-count: number of DP lanes to use
+       - use-external-pwm: backlight will be controlled by an external PWM
+
+Example:
+       ps8622-bridge@48 {
+               compatible = "parade,ps8622";
+               reg = <0x48>;
+               sleep-gpios = <&gpc3 6 1 0 0>;
+               reset-gpios = <&gpc3 1 1 0 0>;
+               display-timings = <&lcd_display_timings>;
+               lane-count = <1>
+       };
--

1.7.9.5

#31 lore raw

Re: [PATCH V5 11/12] Documentation: Add DT bindings for ps8622/ps8625 bridge driver

In reply to Ajay Kumar
Quoted 8 lines · Ajay Kumar

From: Vincent Palatin <[email protected]>

Add DT binding documentation for ps8622/ps8625 bridge driver.

---
 .../devicetree/bindings/drm/bridge/ps8622.txt      |   21 ++++++++++++++++++++

This is the wrong directory. Bindings are supposed to be OS agnostic, but DRM is (mostly) Linux-specific. video/bridge would be a better subdirectory for this. Somebody really ought to be moving out the existing bindings in the drm subdirectory to a more proper location.

Documentation/devicetree/bindings/drm/bridge/ps8622.txt line 4

Quoted 13 lines
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +4 -0
new file mode 100644
index 0000000..1d154ac
@@ -0,0 +1,21 @@
+ps8622-bridge bindings
+
+Required properties:
+	- compatible: "parade,ps8622" or "parade,ps8625"

Documentation/devicetree/bindings/vendor-prefixes.txt doesn't contain an entry for parade yet.

Documentation/devicetree/bindings/drm/bridge/ps8622.txt line 11

Quoted 7 lines
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +7 -0
+	- reg: first i2c address of the bridge
+	- sleep-gpios: OF device-tree gpio specification
+	- reset-gpios: OF device-tree gpio specification
+
+Optional properties:
+	- lane-count: number of DP lanes to use
+	- use-external-pwm: backlight will be controlled by an external PWM

In case of an external backlight, don't you still need a way to control it? Perhaps instead of using this boolean property you should make this take a phandle to the real backlight? Like so:

	backlight {
		compatible = "pwm-backlight";
		...
	}

	bridge@48 {
		compatible = "parade,ps8622";
		...
		backlight = <&/backlight>;
	}

Then you can simply look up the backlight device when that property exists and instantiate the built-in backlight otherwise.

Documentation/devicetree/bindings/drm/bridge/ps8622.txt line 19

Quoted 8 lines
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +8 -0
+
+Example:
+	ps8622-bridge@48 {
+		compatible = "parade,ps8622";
+		reg = <0x48>;
+		sleep-gpios = <&gpc3 6 1 0 0>;
+		reset-gpios = <&gpc3 1 1 0 0>;
+		display-timings = <&lcd_display_timings>;

Why is this specifying display-timings? It's not mentioned in the binding above and I don't see why the bridge would need to provide one since it's really a property of the panel.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#32 lore raw

Re: [PATCH V5 11/12] Documentation: Add DT bindings for ps8622/ps8625 bridge driver

Hi Thierry,

Quoted 10 lines · Thierry Reding
Quoted 8 lines · Ajay Kumar

From: Vincent Palatin <[email protected]>

Add DT binding documentation for ps8622/ps8625 bridge driver.

---
 .../devicetree/bindings/drm/bridge/ps8622.txt      |   21 ++++++++++++++++++++
Quoted 4 lines

This is the wrong directory. Bindings are supposed to be OS agnostic, but DRM is (mostly) Linux-specific. video/bridge would be a better subdirectory for this. Somebody really ought to be moving out the existing bindings in the drm subdirectory to a more proper location.

Ok. I will move them out into video/bridge.

Quoted 16 lines

Documentation/devicetree/bindings/drm/bridge/ps8622.txt line 4

Quoted 13 lines
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +4 -0
new file mode 100644
index 0000000..1d154ac
@@ -0,0 +1,21 @@
+ps8622-bridge bindings
+
+Required properties:
+     - compatible: "parade,ps8622" or "parade,ps8625"

Documentation/devicetree/bindings/vendor-prefixes.txt doesn't contain an entry for parade yet.

I will fix this.

Quoted 23 lines

Documentation/devicetree/bindings/drm/bridge/ps8622.txt line 11

Quoted 7 lines
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +7 -0
+     - reg: first i2c address of the bridge
+     - sleep-gpios: OF device-tree gpio specification
+     - reset-gpios: OF device-tree gpio specification
+
+Optional properties:
+     - lane-count: number of DP lanes to use
+     - use-external-pwm: backlight will be controlled by an external PWM

In case of an external backlight, don't you still need a way to control it? Perhaps instead of using this boolean property you should make this take a phandle to the real backlight? Like so:

        backlight {
                compatible = "pwm-backlight";
                ...
        }

        bridge@48 {
                compatible = "parade,ps8622";
                ...
                backlight = <&/backlight>;
        }
Quoted 2 lines

Then you can simply look up the backlight device when that property exists and instantiate the built-in backlight otherwise.

Thanks for the pointer, this approach seems perfect!

Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +4 -0
+
+Example:
+     ps8622-bridge@48 {
+             compatible = "parade,ps8622";
Quoted 8 lines

Documentation/devicetree/bindings/drm/bridge/ps8622.txt line 19

Quoted 4 lines
Documentation/devicetree/bindings/drm/bridge/ps8622.txt new file +4 -0
+             reg = <0x48>;
+             sleep-gpios = <&gpc3 6 1 0 0>;
+             reset-gpios = <&gpc3 1 1 0 0>;
+             display-timings = <&lcd_display_timings>;

Why is this specifying display-timings? It's not mentioned in the binding above and I don't see why the bridge would need to provide one since it's really a property of the panel.

Ahh. I was trying to copy bindings from previous patchset and I messed it up. Will fix it.

Ajay

author
#33 lore raw

PATCH RESEND v5 12/12 drm/exynos: Add ps8622 lvds bridge discovery to DP driver

In reply to Ajay Kumar

From: Rahul Sharma <[email protected]>

This patch adds ps8622 lvds bridge discovery code to the dp driver.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +5 -0
index 0ca6256..82e2942 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 #include <drm/bridge/panel_binder.h>
+#include <drm/bridge/ps8622.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"
@@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
 	if (find_bridge("nxp,ptn3460", &bridge)) {
 		bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
 								bridge.node);
+	} else if (find_bridge("parade,ps8622", &bridge) ||
+				find_bridge("parade,ps8625", &bridge)) {
+		bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
+								bridge.node);
 	}
 
 	if (bridge_chain && dp->edp_panel) {
Signature · 1 line
1.7.9.5
#34 lore raw

Re: [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

Quoted 23 lines · Ajay Kumar

From: Rahul Sharma <[email protected]>

This patch adds ps8622 lvds bridge discovery code to the dp driver.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index 0ca6256..82e2942 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 #include <drm/bridge/panel_binder.h>
+#include <drm/bridge/ps8622.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, · line 1007

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
 	if (find_bridge("nxp,ptn3460", &bridge)) {
 		bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
 								bridge.node);
+	} else if (find_bridge("parade,ps8622", &bridge) ||
+				find_bridge("parade,ps8625", &bridge)) {
+		bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
+								bridge.node);
 	}

We really ought to be adding some sort of registry at some point. Otherwise every driver that wants to use bridges needs to come up with a similar set of helpers to instantiate them.

Also you're making this driver depend on (now) two bridges, whereas it really shouldn't matter which exact types it supports. Bridges should be exposed via a generic interface.

Thierry

#35 lore raw

Re: [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

Quoted 37 lines · Thierry Reding
Quoted 23 lines · Ajay Kumar

From: Rahul Sharma <[email protected]>

This patch adds ps8622 lvds bridge discovery code to the dp driver.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index 0ca6256..82e2942 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 #include <drm/bridge/panel_binder.h>
+#include <drm/bridge/ps8622.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, · line 1007

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
      if (find_bridge("nxp,ptn3460", &bridge)) {
              bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
                                                              bridge.node);
+     } else if (find_bridge("parade,ps8622", &bridge) ||
+                             find_bridge("parade,ps8625", &bridge)) {
+             bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
+                                                             bridge.node);
      }

We really ought to be adding some sort of registry at some point. Otherwise every driver that wants to use bridges needs to come up with a similar set of helpers to instantiate them.

Quoted 3 lines

Also you're making this driver depend on (now) two bridges, whereas it really shouldn't matter which exact types it supports. Bridges should be exposed via a generic interface.

How about moving out the find_bridge() function into a common header file, and also supporting the list of bridge_init declarations in the same file?

We get bridge chip node from phandle, and then pass the same node to find_bridge() which searches the list using of_device_is_compatible() to call the appropriate bridge_init function?

Ajay

#36 lore raw

Re: [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

Quoted 43 lines · Ajay kumar
Quoted 37 lines · Thierry Reding
Quoted 23 lines · Ajay Kumar

From: Rahul Sharma <[email protected]>

This patch adds ps8622 lvds bridge discovery code to the dp driver.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index 0ca6256..82e2942 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 #include <drm/bridge/panel_binder.h>
+#include <drm/bridge/ps8622.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, · line 1007

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
      if (find_bridge("nxp,ptn3460", &bridge)) {
              bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
                                                              bridge.node);
+     } else if (find_bridge("parade,ps8622", &bridge) ||
+                             find_bridge("parade,ps8625", &bridge)) {
+             bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
+                                                             bridge.node);
      }

We really ought to be adding some sort of registry at some point. Otherwise every driver that wants to use bridges needs to come up with a similar set of helpers to instantiate them.

Quoted 3 lines

Also you're making this driver depend on (now) two bridges, whereas it really shouldn't matter which exact types it supports. Bridges should be exposed via a generic interface.

Quoted 6 lines

How about moving out the find_bridge() function into a common header file, and also supporting the list of bridge_init declarations in the same file?

We get bridge chip node from phandle, and then pass the same node to find_bridge() which searches the list using of_device_is_compatible() to call the appropriate bridge_init function?

That could work, but it's still somewhat unusual and shouldn't be required. I think we'd be better of with some sort of registry like we have for panels. That would mean that a driver that wants to use a bridge would do something like this:

	struct drm_bridge *bridge;
	struct device_node *np;

	np = of_parse_phandle(dev->of_node, "bridge", 0);
	if (np) {
		bridge = of_drm_find_bridge(np);
		of_node_put(np);

		if (!bridge)
			return -EPROBE_DEFER;
	}

An alternative way would be to add a non-OF wrapper around this, like this for example:

	bridge = drm_bridge_get(dev, NULL);

Which would be conceptually the same as clk_get() or regulator_get() and could be easily extended to support non-DT setups as well.

As for bridge drivers I think we may have to rework things a little, so that a driver can call some sequence like this:

	struct foo_bridge {
		struct drm_bridge base;
		...
	};

	static const struct drm_bridge_funcs foo_bridge_funcs = {
		...
	};

	static int foo_probe(...)
	{
		struct foo_bridge *bridge;
		int err;

		bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
		if (!bridge)
			return -ENOMEM;

		/* setup bridge (return -EPROBE_DEFER if necessary, ...) */

		/* register bridge with DRM */
		drm_bridge_init(&bridge->base);
		bridge->base.dev = dev;
		bridge->base.funcs = &foo_bridge_funcs;

		err = drm_bridge_add(&bridge->base);
		if (err < 0)
			return err;

		dev_set_drvdata(dev, bridge);
		...
	}

drm_bridge_add() would add the bridge to a global list of bridge devices which drm_bridge_get()/of_drm_find_bridge() can use to find the one that it needs. The above has the big advantage that it's completely independent of the underlying bus that the bridge is on. It could be I2C or SPI, platform device or PCI device.

Thierry

#37 lore raw

Re: [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

Hi Thierry,

Quoted 68 lines · Thierry Reding
Quoted 43 lines · Ajay kumar
Quoted 37 lines · Thierry Reding
Quoted 23 lines · Ajay Kumar

From: Rahul Sharma <[email protected]>

This patch adds ps8622 lvds bridge discovery code to the dp driver.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index 0ca6256..82e2942 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 #include <drm/bridge/panel_binder.h>
+#include <drm/bridge/ps8622.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, · line 1007

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
      if (find_bridge("nxp,ptn3460", &bridge)) {
              bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
                                                              bridge.node);
+     } else if (find_bridge("parade,ps8622", &bridge) ||
+                             find_bridge("parade,ps8625", &bridge)) {
+             bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
+                                                             bridge.node);
      }

We really ought to be adding some sort of registry at some point. Otherwise every driver that wants to use bridges needs to come up with a similar set of helpers to instantiate them.

Quoted 3 lines

Also you're making this driver depend on (now) two bridges, whereas it really shouldn't matter which exact types it supports. Bridges should be exposed via a generic interface.

Quoted 6 lines

How about moving out the find_bridge() function into a common header file, and also supporting the list of bridge_init declarations in the same file?

We get bridge chip node from phandle, and then pass the same node to find_bridge() which searches the list using of_device_is_compatible() to call the appropriate bridge_init function?

That could work, but it's still somewhat unusual and shouldn't be required. I think we'd be better of with some sort of registry like we have for panels. That would mean that a driver that wants to use a bridge would do something like this:

        struct drm_bridge *bridge;
        struct device_node *np;

        np = of_parse_phandle(dev->of_node, "bridge", 0);
        if (np) {
                bridge = of_drm_find_bridge(np);
                of_node_put(np);

                if (!bridge)
                        return -EPROBE_DEFER;
        }
Quoted 2 lines

An alternative way would be to add a non-OF wrapper around this, like this for example:

Let me try the DT version first :)

Quoted 41 lines
        bridge = drm_bridge_get(dev, NULL);

Which would be conceptually the same as clk_get() or regulator_get() and could be easily extended to support non-DT setups as well.

As for bridge drivers I think we may have to rework things a little, so that a driver can call some sequence like this:

        struct foo_bridge {
                struct drm_bridge base;
                ...
        };

        static const struct drm_bridge_funcs foo_bridge_funcs = {
                ...
        };

        static int foo_probe(...)
        {
                struct foo_bridge *bridge;
                int err;

                bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
                if (!bridge)
                        return -ENOMEM;

                /* setup bridge (return -EPROBE_DEFER if necessary, ...) */

                /* register bridge with DRM */
                drm_bridge_init(&bridge->base);
                bridge->base.dev = dev;
                bridge->base.funcs = &foo_bridge_funcs;

                err = drm_bridge_add(&bridge->base);
                if (err < 0)
                        return err;

                dev_set_drvdata(dev, bridge);
                ...
        }
Quoted 7 lines

drm_bridge_add() would add the bridge to a global list of bridge devices which drm_bridge_get()/of_drm_find_bridge() can use to find the one that
it needs. The above has the big advantage that it'sdev->mode_config.bridge_list completely independent of the underlying bus that the bridge is on. It could be I2C
or SPI, platform device or PCI device.

Thierry

Ok. This is all about making the bridge driver confine to the driver model. But, I would need a drm_device pointer to register the bridge to DRM core. How do I get it?

Ajay

#38 lore raw

Re: [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

Quoted 123 lines · Ajay kumar

Hi Thierry,

Quoted 68 lines · Thierry Reding
Quoted 43 lines · Ajay kumar
Quoted 37 lines · Thierry Reding
Quoted 23 lines · Ajay Kumar

From: Rahul Sharma <[email protected]>

This patch adds ps8622 lvds bridge discovery code to the dp driver.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index 0ca6256..82e2942 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 #include <drm/bridge/panel_binder.h>
+#include <drm/bridge/ps8622.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, · line 1007

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
      if (find_bridge("nxp,ptn3460", &bridge)) {
              bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
                                                              bridge.node);
+     } else if (find_bridge("parade,ps8622", &bridge) ||
+                             find_bridge("parade,ps8625", &bridge)) {
+             bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
+                                                             bridge.node);
      }

We really ought to be adding some sort of registry at some point. Otherwise every driver that wants to use bridges needs to come up with a similar set of helpers to instantiate them.

Quoted 3 lines

Also you're making this driver depend on (now) two bridges, whereas it really shouldn't matter which exact types it supports. Bridges should be exposed via a generic interface.

Quoted 6 lines

How about moving out the find_bridge() function into a common header file, and also supporting the list of bridge_init declarations in the same file?

We get bridge chip node from phandle, and then pass the same node to find_bridge() which searches the list using of_device_is_compatible() to call the appropriate bridge_init function?

That could work, but it's still somewhat unusual and shouldn't be required. I think we'd be better of with some sort of registry like we have for panels. That would mean that a driver that wants to use a bridge would do something like this:

        struct drm_bridge *bridge;
        struct device_node *np;

        np = of_parse_phandle(dev->of_node, "bridge", 0);
        if (np) {
                bridge = of_drm_find_bridge(np);
                of_node_put(np);

                if (!bridge)
                        return -EPROBE_DEFER;
        }
Quoted 2 lines

An alternative way would be to add a non-OF wrapper around this, like this for example:

Let me try the DT version first :)

Quoted 47 lines
        bridge = drm_bridge_get(dev, NULL);

Which would be conceptually the same as clk_get() or regulator_get() and could be easily extended to support non-DT setups as well.

As for bridge drivers I think we may have to rework things a little, so that a driver can call some sequence like this:

        struct foo_bridge {
                struct drm_bridge base;
                ...
        };

        static const struct drm_bridge_funcs foo_bridge_funcs = {
                ...
        };

        static int foo_probe(...)
        {
                struct foo_bridge *bridge;
                int err;

                bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
                if (!bridge)
                        return -ENOMEM;

                /* setup bridge (return -EPROBE_DEFER if necessary, ...) */

                /* register bridge with DRM */
                drm_bridge_init(&bridge->base);
                bridge->base.dev = dev;
                bridge->base.funcs = &foo_bridge_funcs;

                err = drm_bridge_add(&bridge->base);
                if (err < 0)
                        return err;

                dev_set_drvdata(dev, bridge);
                ...
        }

drm_bridge_add() would add the bridge to a global list of bridge devices which drm_bridge_get()/of_drm_find_bridge() can use to find the one that
it needs. The above has the big advantage that it'sdev->mode_config.bridge_list completely independent of the underlying bus that the bridge is on. It could be I2C
or SPI, platform device or PCI device.

Quoted 4 lines
Quoted 1 line

Thierry

Ok. This is all about making the bridge driver confine to the driver model. But, I would need a drm_device pointer to register the bridge to DRM core. How do I get it?

Once you've obtained a reference to the DRM bridge from your driver you should carry it around until you've set up the DRM device. Then you can hook it up, which possibly requires a new function (since it's what the drm_bridge_init() used to do).

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#39 lore raw

Re: [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

Quoted 125 lines · Thierry Reding
Quoted 124 lines · Ajay kumar

Hi Thierry,

Quoted 68 lines · Thierry Reding
Quoted 43 lines · Ajay kumar
Quoted 37 lines · Thierry Reding
Quoted 23 lines · Ajay Kumar

From: Rahul Sharma <[email protected]>

This patch adds ps8622 lvds bridge discovery code to the dp driver.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index 0ca6256..82e2942 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 #include <drm/bridge/panel_binder.h>
+#include <drm/bridge/ps8622.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, · line 1007

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
      if (find_bridge("nxp,ptn3460", &bridge)) {
              bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
                                                              bridge.node);
+     } else if (find_bridge("parade,ps8622", &bridge) ||
+                             find_bridge("parade,ps8625", &bridge)) {
+             bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
+                                                             bridge.node);
      }

We really ought to be adding some sort of registry at some point. Otherwise every driver that wants to use bridges needs to come up with a similar set of helpers to instantiate them.

Quoted 3 lines

Also you're making this driver depend on (now) two bridges, whereas it really shouldn't matter which exact types it supports. Bridges should be exposed via a generic interface.

Quoted 6 lines

How about moving out the find_bridge() function into a common header file, and also supporting the list of bridge_init declarations in the same file?

We get bridge chip node from phandle, and then pass the same node to find_bridge() which searches the list using of_device_is_compatible() to call the appropriate bridge_init function?

That could work, but it's still somewhat unusual and shouldn't be required. I think we'd be better of with some sort of registry like we have for panels. That would mean that a driver that wants to use a bridge would do something like this:

        struct drm_bridge *bridge;
        struct device_node *np;

        np = of_parse_phandle(dev->of_node, "bridge", 0);
        if (np) {
                bridge = of_drm_find_bridge(np);
                of_node_put(np);

                if (!bridge)
                        return -EPROBE_DEFER;
        }
Quoted 2 lines

An alternative way would be to add a non-OF wrapper around this, like this for example:

Let me try the DT version first :)

Quoted 48 lines
        bridge = drm_bridge_get(dev, NULL);

Which would be conceptually the same as clk_get() or regulator_get() and could be easily extended to support non-DT setups as well.

As for bridge drivers I think we may have to rework things a little, so that a driver can call some sequence like this:

        struct foo_bridge {
                struct drm_bridge base;
                ...
        };

        static const struct drm_bridge_funcs foo_bridge_funcs = {
                ...
        };

        static int foo_probe(...)
        {
                struct foo_bridge *bridge;
                int err;

                bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
                if (!bridge)
                        return -ENOMEM;

                /* setup bridge (return -EPROBE_DEFER if necessary, ...) */

                /* register bridge with DRM */
                drm_bridge_init(&bridge->base);
                bridge->base.dev = dev;
                bridge->base.funcs = &foo_bridge_funcs;

                err = drm_bridge_add(&bridge->base);
                if (err < 0)
                        return err;

                dev_set_drvdata(dev, bridge);
                ...
        }

drm_bridge_add() would add the bridge to a global list of bridge devices which drm_bridge_get()/of_drm_find_bridge() can use to find the one that
it needs. The above has the big advantage that it'sdev->mode_config.bridge_list completely independent of the underlying bus that the bridge is on. It could be I2C
or SPI, platform device or PCI device.

Thierry

Quoted 8 lines
Quoted 3 lines

Ok. This is all about making the bridge driver confine to the driver model. But, I would need a drm_device pointer to register the bridge to DRM core. How do I get it?

Once you've obtained a reference to the DRM bridge from your driver you should carry it around until you've set up the DRM device. Then you can hook it up, which possibly requires a new function (since it's what the drm_bridge_init() used to do).

Ok. We can have 2 parts:

Non-DRM part:
In order to get a reference for drm_bridge in my encoder driver, I should be using
of_drm_find_bridge(). In order to do that, I should have already added the bridge
into a static list of bridges(using something like drm_bridge_add). Also, bridge_funcs pointer is assigned to the bridge object in the bridge driver itself.

DRM part:
Assuming that the bridge driver probe will take care of calling drm_bridge_add(),
I can then call drm_bridge_init from encoder driver, with a drm_bridge pointer and a drm_device pointer, which will actually register the bridge into DRM core.

Ajay

#40 lore raw

Re: [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

Quoted 147 lines · Ajay kumar
Quoted 125 lines · Thierry Reding
Quoted 124 lines · Ajay kumar

Hi Thierry,

Quoted 68 lines · Thierry Reding
Quoted 43 lines · Ajay kumar
Quoted 37 lines · Thierry Reding
Quoted 23 lines · Ajay Kumar

From: Rahul Sharma <[email protected]>

This patch adds ps8622 lvds bridge discovery code to the dp driver.

---
 drivers/gpu/drm/exynos/exynos_dp_core.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -0
index 0ca6256..82e2942 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 #include <drm/bridge/panel_binder.h>
+#include <drm/bridge/ps8622.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"

drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, · line 1007

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
      if (find_bridge("nxp,ptn3460", &bridge)) {
              bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
                                                              bridge.node);
+     } else if (find_bridge("parade,ps8622", &bridge) ||
+                             find_bridge("parade,ps8625", &bridge)) {
+             bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
+                                                             bridge.node);
      }

We really ought to be adding some sort of registry at some point. Otherwise every driver that wants to use bridges needs to come up with a similar set of helpers to instantiate them.

Quoted 3 lines

Also you're making this driver depend on (now) two bridges, whereas it really shouldn't matter which exact types it supports. Bridges should be exposed via a generic interface.

Quoted 6 lines

How about moving out the find_bridge() function into a common header file, and also supporting the list of bridge_init declarations in the same file?

We get bridge chip node from phandle, and then pass the same node to find_bridge() which searches the list using of_device_is_compatible() to call the appropriate bridge_init function?

That could work, but it's still somewhat unusual and shouldn't be required. I think we'd be better of with some sort of registry like we have for panels. That would mean that a driver that wants to use a bridge would do something like this:

        struct drm_bridge *bridge;
        struct device_node *np;

        np = of_parse_phandle(dev->of_node, "bridge", 0);
        if (np) {
                bridge = of_drm_find_bridge(np);
                of_node_put(np);

                if (!bridge)
                        return -EPROBE_DEFER;
        }
Quoted 2 lines

An alternative way would be to add a non-OF wrapper around this, like this for example:

Let me try the DT version first :)

Quoted 48 lines
        bridge = drm_bridge_get(dev, NULL);

Which would be conceptually the same as clk_get() or regulator_get() and could be easily extended to support non-DT setups as well.

As for bridge drivers I think we may have to rework things a little, so that a driver can call some sequence like this:

        struct foo_bridge {
                struct drm_bridge base;
                ...
        };

        static const struct drm_bridge_funcs foo_bridge_funcs = {
                ...
        };

        static int foo_probe(...)
        {
                struct foo_bridge *bridge;
                int err;

                bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
                if (!bridge)
                        return -ENOMEM;

                /* setup bridge (return -EPROBE_DEFER if necessary, ...) */

                /* register bridge with DRM */
                drm_bridge_init(&bridge->base);
                bridge->base.dev = dev;
                bridge->base.funcs = &foo_bridge_funcs;

                err = drm_bridge_add(&bridge->base);
                if (err < 0)
                        return err;

                dev_set_drvdata(dev, bridge);
                ...
        }

drm_bridge_add() would add the bridge to a global list of bridge devices which drm_bridge_get()/of_drm_find_bridge() can use to find the one that
it needs. The above has the big advantage that it'sdev->mode_config.bridge_list completely independent of the underlying bus that the bridge is on. It could be I2C
or SPI, platform device or PCI device.

Thierry

Quoted 8 lines
Quoted 3 lines

Ok. This is all about making the bridge driver confine to the driver model. But, I would need a drm_device pointer to register the bridge to DRM core. How do I get it?

Once you've obtained a reference to the DRM bridge from your driver you should carry it around until you've set up the DRM device. Then you can hook it up, which possibly requires a new function (since it's what the drm_bridge_init() used to do).

Ok. We can have 2 parts:

Non-DRM part:
In order to get a reference for drm_bridge in my encoder driver, I should be using
of_drm_find_bridge(). In order to do that, I should have already added the bridge
into a static list of bridges(using something like drm_bridge_add). Also, bridge_funcs pointer is assigned to the bridge object in the bridge driver itself.

Quoted 5 lines

DRM part:
Assuming that the bridge driver probe will take care of calling drm_bridge_add(),
I can then call drm_bridge_init from encoder driver, with a drm_bridge pointer and a drm_device pointer, which will actually register the bridge into DRM core.

Yes, exactly.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#41 lore raw
In reply to Ajay Kumar
Quoted 30 lines · Ajay Kumar

This series is based on exynos-drm-next branch of Inki Dae's tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git

This patchset also consolidates various inputs from the drm community regarding the bridge chaining concept:
(1) [RFC V2 0/3] drm/bridge: panel and chaining

	http://www.spinics.net/lists/linux-samsung-soc/msg30160.html
(2) [RFC V3 0/3] drm/bridge: panel and chaining
	http://www.spinics.net/lists/linux-samsung-soc/msg30507.html

I have tested this after adding few DT changes for exynos5250-snow, exynos5420-peach-pit and exynos5800-peach-pi boards.

The V4 series of this particular patchset was also tested by:
Rahul Sharma <[email protected]>
Javier Martinez Canillas <[email protected]>

Changes since V2:
-- Address comments from Jingoo Han for ps8622 driver -- Address comments from Daniel, Rob and Thierry regarding
bridge chaining
-- Address comments from Thierry regarding the names for
new drm_panel functions

Changes since V3:
-- Remove hotplug based initialization of exynos_dp -- Make exynos_dp work directly with drm_panel, remove
dependency on panel_binder
-- Minor cleanups in panel_binder and panel_lvds driver

Quoted 6 lines

Changes since V4:
-- Use gpiod interface for panel-lvds and ps8622 drivers. -- Address comments from Javier.
-- Fix compilation issues when PANEL_BINDER is selected as module. -- Split Documentation patches from driver patches.
-- Rebase on top of the tree.

Hi Ajay,

Thanks for your contribution.

I am reviewing your patch series. Sorry for late. Below is my comment.

How about using graph concept to bind eDP, LVDS bridge, and Panel? Your patch tries to bind bridge driver using find_bridge function, and this function tries to find bridge device node directly using of_find_compatible_node() again, which in turn make eDP driver to add all codes related to all bridge devices including all relevant bridge
headers: i.e., if there are five bridge devices then eDP driver should try to find all of them. That is really not good.

So my opinion is to define the relationship between eDP, LVDS, and Panel using graph concept: eDP context would have panel and bridge object according to graph definition of device tree.

As a result, eDP context has already bridge_chain object for lvds bridge device and panel_binder->bridge object in exynos_drm_attach_lcd_bridge function context so it can add bridge_chain object to panel_binder->bridge as is there. I think lvds bridge device drivers could follow Linux driver model with this approach.

Rob, it seems to need at least your ACK so that I can merge this patch series to exynos-drm-next.

Thanks,
Inki Dae

Quoted 47 lines

Ajay Kumar (9):
[RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue [RESEND PATCH V5 02/12] drm/panel: add prepare and unprepare routines [RESEND PATCH V5 03/12] drm/exynos: dp: modify driver to support drm_panel [PATCH V5 04/12] drm/panel: Add driver for lvds/edp based panels
[PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver [RESEND PATCH V5 06/12] drm/bridge: add helper functions to support bridge chain [PATCH V5 07/12] drm/bridge: Add a driver which binds drm_bridge with drm_panel [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining [RESEND PATCH V5 09/12] drm/exynos: dp: create bridge chain using ptn3460 and panel_binder

Vincent Palatin (2):
[PATCH V5 10/12] Documentation: Add DT bindings for ps8622/ps8625 bridge driver [PATCH V5 11/12] drm/bridge: Add ps8622/ps8625 bridge driver

Rahul Sharma (1):
[RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

 .../devicetree/bindings/drm/bridge/ps8622.txt      |   21 +
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++
 .../devicetree/bindings/video/exynos_dp.txt        |    2 +
 drivers/gpu/drm/bridge/Kconfig                     |   15 +
 drivers/gpu/drm/bridge/Makefile                    |    2 +
 drivers/gpu/drm/bridge/panel_binder.c              |  193 ++++++++
 drivers/gpu/drm/bridge/ps8622.c                    |  476 ++++++++++++++++++++
 drivers/gpu/drm/bridge/ptn3460.c                   |  137 +-----
 drivers/gpu/drm/exynos/Kconfig                     |    1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c            |   87 +++-
 drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 +
 drivers/gpu/drm/panel/Kconfig                      |   10 +
 drivers/gpu/drm/panel/Makefile                     |    1 +
 drivers/gpu/drm/panel/panel-lvds.c                 |  268 +++++++++++
 include/drm/bridge/panel_binder.h                  |   44 ++
 include/drm/bridge/ps8622.h                        |   41 ++
 include/drm/bridge/ptn3460.h                       |   15 +-
 include/drm/drm_crtc.h                             |   72 +++
 include/drm/drm_panel.h                            |   18 +
 19 files changed, 1316 insertions(+), 139 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
 create mode 100644 drivers/gpu/drm/bridge/panel_binder.c
 create mode 100644 drivers/gpu/drm/bridge/ps8622.c
 create mode 100644 drivers/gpu/drm/panel/panel-lvds.c
 create mode 100644 include/drm/bridge/panel_binder.h
 create mode 100644 include/drm/bridge/ps8622.h
#42 lore raw

Hi Inki,

Quoted 44 lines · Inki Dae
Quoted 30 lines · Ajay Kumar

This series is based on exynos-drm-next branch of Inki Dae's tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git

This patchset also consolidates various inputs from the drm community regarding the bridge chaining concept:
(1) [RFC V2 0/3] drm/bridge: panel and chaining

      http://www.spinics.net/lists/linux-samsung-soc/msg30160.html
(2) [RFC V3 0/3] drm/bridge: panel and chaining
      http://www.spinics.net/lists/linux-samsung-soc/msg30507.html

I have tested this after adding few DT changes for exynos5250-snow, exynos5420-peach-pit and exynos5800-peach-pi boards.

The V4 series of this particular patchset was also tested by:
Rahul Sharma <[email protected]>
Javier Martinez Canillas <[email protected]>

Changes since V2:
-- Address comments from Jingoo Han for ps8622 driver -- Address comments from Daniel, Rob and Thierry regarding
bridge chaining
-- Address comments from Thierry regarding the names for
new drm_panel functions

Changes since V3:
-- Remove hotplug based initialization of exynos_dp -- Make exynos_dp work directly with drm_panel, remove
dependency on panel_binder
-- Minor cleanups in panel_binder and panel_lvds driver

Quoted 6 lines

Changes since V4:
-- Use gpiod interface for panel-lvds and ps8622 drivers. -- Address comments from Javier.
-- Fix compilation issues when PANEL_BINDER is selected as module. -- Split Documentation patches from driver patches.
-- Rebase on top of the tree.

Hi Ajay,

Thanks for your contribution.

I am reviewing your patch series. Sorry for late. Below is my comment.

Quoted 7 lines

How about using graph concept to bind eDP, LVDS bridge, and Panel? Your patch tries to bind bridge driver using find_bridge function, and this function tries to find bridge device node directly using of_find_compatible_node() again, which in turn make eDP driver to add all codes related to all bridge devices including all relevant bridge
headers: i.e., if there are five bridge devices then eDP driver should try to find all of them. That is really not good.

I agree.

Quoted 9 lines

So my opinion is to define the relationship between eDP, LVDS, and Panel using graph concept: eDP context would have panel and bridge object according to graph definition of device tree.

As a result, eDP context has already bridge_chain object for lvds bridge device and panel_binder->bridge object in exynos_drm_attach_lcd_bridge function context so it can add bridge_chain object to panel_binder->bridge as is there. I think lvds bridge device drivers could follow Linux driver model with this approach.

Sorry, I didn't quite understand the graph concept. Already Thierry suggested of having a common repository for list of supported bridges. That way, we can move out bridge detection stuff from exynos_dp to a common file.

Ajay

Quoted 54 lines

Rob, it seems to need at least your ACK so that I can merge this patch series to exynos-drm-next.

Thanks,
Inki Dae

Quoted 47 lines

Ajay Kumar (9):
[RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue [RESEND PATCH V5 02/12] drm/panel: add prepare and unprepare routines [RESEND PATCH V5 03/12] drm/exynos: dp: modify driver to support drm_panel [PATCH V5 04/12] drm/panel: Add driver for lvds/edp based panels
[PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver [RESEND PATCH V5 06/12] drm/bridge: add helper functions to support bridge chain [PATCH V5 07/12] drm/bridge: Add a driver which binds drm_bridge with drm_panel [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining [RESEND PATCH V5 09/12] drm/exynos: dp: create bridge chain using ptn3460 and panel_binder

Vincent Palatin (2):
[PATCH V5 10/12] Documentation: Add DT bindings for ps8622/ps8625 bridge driver [PATCH V5 11/12] drm/bridge: Add ps8622/ps8625 bridge driver

Rahul Sharma (1):
[RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver

 .../devicetree/bindings/drm/bridge/ps8622.txt      |   21 +
 .../devicetree/bindings/panel/panel-lvds.txt       |   50 ++
 .../devicetree/bindings/video/exynos_dp.txt        |    2 +
 drivers/gpu/drm/bridge/Kconfig                     |   15 +
 drivers/gpu/drm/bridge/Makefile                    |    2 +
 drivers/gpu/drm/bridge/panel_binder.c              |  193 ++++++++
 drivers/gpu/drm/bridge/ps8622.c                    |  476 ++++++++++++++++++++
 drivers/gpu/drm/bridge/ptn3460.c                   |  137 +-----
 drivers/gpu/drm/exynos/Kconfig                     |    1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c            |   87 +++-
 drivers/gpu/drm/exynos/exynos_dp_core.h            |    2 +
 drivers/gpu/drm/panel/Kconfig                      |   10 +
 drivers/gpu/drm/panel/Makefile                     |    1 +
 drivers/gpu/drm/panel/panel-lvds.c                 |  268 +++++++++++
 include/drm/bridge/panel_binder.h                  |   44 ++
 include/drm/bridge/ps8622.h                        |   41 ++
 include/drm/bridge/ptn3460.h                       |   15 +-
 include/drm/drm_crtc.h                             |   72 +++
 include/drm/drm_panel.h                            |   18 +
 19 files changed, 1316 insertions(+), 139 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/ps8622.txt
 create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt
 create mode 100644 drivers/gpu/drm/bridge/panel_binder.c
 create mode 100644 drivers/gpu/drm/bridge/ps8622.c
 create mode 100644 drivers/gpu/drm/panel/panel-lvds.c
 create mode 100644 include/drm/bridge/panel_binder.h
 create mode 100644 include/drm/bridge/ps8622.h