All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support
@ 2014-04-16 14:32 Ajay Kumar
  2014-04-16 14:33 ` [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO Ajay Kumar
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Ajay Kumar @ 2014-04-16 14:32 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: inki.dae, a.hajda, treding, kyungmin.park, seanpaul, abrestic,
	rahul.sharma, ajaynumb, joshi, prashanth.g, Ajay Kumar

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

This set of drm patches are needed to support bridge chips and
eDP/LVDS panels with exynos_dp.
For testing, I have used exynos5250-snow board along with a few local
arch side patches.

This patchset tries to create a simple exynos_dp panel framework
to control power up/down sequence of the eDP/eDP-LVDS panel, and
the same is used to control the panel power sequence for the
LVDS panel on snow.

Andrew Bresticker (1):
  [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO

Ajay Kumar (5):
  [PATCH 2/7] drm/panel: add pre_enable routine to drm panel
  [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels
  [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver
  [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel
  [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls

Rahul Sharma (1):
  [PATCH 6/7] drm/bridge: ptn3460: enable polling based detection

 .../devicetree/bindings/panel/exynos-dp-panel.txt  |  32 ++++
 .../devicetree/bindings/video/exynos_dp.txt        |   4 +
 drivers/gpu/drm/bridge/Kconfig                     |   1 +
 drivers/gpu/drm/bridge/ptn3460.c                   |  18 +-
 drivers/gpu/drm/exynos/Kconfig                     |   1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c            |  66 ++++++-
 drivers/gpu/drm/exynos/exynos_dp_core.h            |   2 +
 drivers/gpu/drm/exynos/exynos_dp_reg.c             |  26 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.c            |  11 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.h            |   1 +
 drivers/gpu/drm/panel/Kconfig                      |   9 +
 drivers/gpu/drm/panel/Makefile                     |   1 +
 drivers/gpu/drm/panel/panel-exynos-dp.c            | 213 +++++++++++++++++++++
 include/drm/bridge/ptn3460.h                       |   6 +-
 include/drm/drm_panel.h                            |   9 +
 15 files changed, 387 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
 create mode 100644 drivers/gpu/drm/panel/panel-exynos-dp.c

-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO
  2014-04-16 14:32 [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support Ajay Kumar
@ 2014-04-16 14:33 ` Ajay Kumar
  2014-04-18  8:23   ` Jingoo Han
  2014-04-16 14:33 ` [PATCH 2/7] drm/panel: add pre_enable routine to drm panel Ajay Kumar
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Ajay Kumar @ 2014-04-16 14:33 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: inki.dae, a.hajda, treding, kyungmin.park, seanpaul, abrestic,
	rahul.sharma, ajaynumb, joshi, prashanth.g, Ajay Kumar

From: Andrew Bresticker <abrestic@chromium.org>

Certain bridge chips use a GPIO to indicate the cable status instead
of the I_DP_HPD pin.  This adds an optional device-tree property,
"samsung,hpd-gpio", to the exynos-dp controller which indicates that
the specified GPIO should be used for hotplug detection.
The GPIO is then set up as an edge-triggered interrupt where the
rising edge indicates hotplug-in and the falling edge indicates hotplug-out.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 .../devicetree/bindings/video/exynos_dp.txt        |  4 +++
 drivers/gpu/drm/exynos/exynos_dp_core.c            | 32 ++++++++++++++++++++--
 drivers/gpu/drm/exynos/exynos_dp_core.h            |  1 +
 drivers/gpu/drm/exynos/exynos_dp_reg.c             | 26 ++++++++++++++++--
 4 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt b/Documentation/devicetree/bindings/video/exynos_dp.txt
index 57ccdde..53dbccf 100644
--- a/Documentation/devicetree/bindings/video/exynos_dp.txt
+++ b/Documentation/devicetree/bindings/video/exynos_dp.txt
@@ -62,6 +62,10 @@ Optional properties for dp-controller:
 	-hsync-active-high:
 		HSYNC polarity configuration.
 			High if defined, Low if not defined
+	-samsung,hpd-gpio:
+		Hotplug detect GPIO.
+			Indicates which GPIO should be used for hotplug
+			detection
 
 Example:
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 1cc3981..18fd9c5 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -18,6 +18,8 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/gpio.h>
 #include <linux/component.h>
 #include <linux/phy/phy.h>
 #include <video/of_display_timing.h>
@@ -1226,6 +1228,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 	struct drm_device *drm_dev = data;
 	struct resource *res;
 	struct exynos_dp_device *dp;
+	unsigned int irq_flags;
 
 	int ret = 0;
 
@@ -1265,7 +1268,30 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 	if (IS_ERR(dp->reg_base))
 		return PTR_ERR(dp->reg_base);
 
-	dp->irq = platform_get_irq(pdev, 0);
+	dp->hpd_gpio = of_get_named_gpio(dev->of_node, "samsung,hpd-gpio", 0);
+
+	if (gpio_is_valid(dp->hpd_gpio)) {
+		/*
+		 * Set up the hotplug GPIO from the device tree as an interrupt.
+		 * Simply specifying a different interrupt in the device tree
+		 * doesn't work since we handle hotplug rather differently when
+		 * using a GPIO.  We also need the actual GPIO specifier so
+		 * that we can get the current state of the GPIO.
+		 */
+		ret = devm_gpio_request_one(&pdev->dev, dp->hpd_gpio, GPIOF_IN,
+					    "hpd_gpio");
+		if (ret) {
+			dev_err(&pdev->dev, "failed to get hpd gpio\n");
+			return ret;
+		}
+		dp->irq = gpio_to_irq(dp->hpd_gpio);
+		irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
+	} else {
+		dp->hpd_gpio = -ENODEV;
+		dp->irq = platform_get_irq(pdev, 0);
+		irq_flags = 0;
+	}
+
 	if (dp->irq == -ENXIO) {
 		dev_err(&pdev->dev, "failed to get irq\n");
 		return -ENODEV;
@@ -1277,8 +1303,8 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 
 	exynos_dp_init_dp(dp);
 
-	ret = devm_request_irq(&pdev->dev, dp->irq, exynos_dp_irq_handler, 0,
-				"exynos-dp", dp);
+	ret = devm_request_irq(&pdev->dev, dp->irq, exynos_dp_irq_handler,
+			irq_flags, "exynos-dp", dp);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to request irq\n");
 		return ret;
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
index d6a900d..56fa43e 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.h
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
@@ -159,6 +159,7 @@ struct exynos_dp_device {
 	struct work_struct	hotplug_work;
 	struct phy		*phy;
 	int			dpms_mode;
+	int			hpd_gpio;
 
 	struct exynos_drm_panel_info panel;
 };
diff --git a/drivers/gpu/drm/exynos/exynos_dp_reg.c b/drivers/gpu/drm/exynos/exynos_dp_reg.c
index b70da50..82475de 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_reg.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_reg.c
@@ -13,6 +13,7 @@
 #include <linux/device.h>
 #include <linux/io.h>
 #include <linux/delay.h>
+#include <linux/gpio.h>
 
 #include "exynos_dp_core.h"
 #include "exynos_dp_reg.h"
@@ -326,6 +327,9 @@ void exynos_dp_clear_hotplug_interrupts(struct exynos_dp_device *dp)
 {
 	u32 reg;
 
+	if (gpio_is_valid(dp->hpd_gpio))
+		return;
+
 	reg = HOTPLUG_CHG | HPD_LOST | PLUG;
 	writel(reg, dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
 
@@ -337,6 +341,9 @@ void exynos_dp_init_hpd(struct exynos_dp_device *dp)
 {
 	u32 reg;
 
+	if (gpio_is_valid(dp->hpd_gpio))
+		return;
+
 	exynos_dp_clear_hotplug_interrupts(dp);
 
 	reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
@@ -348,6 +355,14 @@ enum dp_irq_type exynos_dp_get_irq_type(struct exynos_dp_device *dp)
 {
 	u32 reg;
 
+	if (gpio_is_valid(dp->hpd_gpio)) {
+		reg = gpio_get_value(dp->hpd_gpio);
+		if (reg)
+			return DP_IRQ_TYPE_HP_CABLE_IN;
+		else
+			return DP_IRQ_TYPE_HP_CABLE_OUT;
+	}
+
 	/* Parse hotplug interrupt status register */
 	reg = readl(dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
 
@@ -402,9 +417,14 @@ int exynos_dp_get_plug_in_status(struct exynos_dp_device *dp)
 {
 	u32 reg;
 
-	reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
-	if (reg & HPD_STATUS)
-		return 0;
+	if (gpio_is_valid(dp->hpd_gpio)) {
+		if (gpio_get_value(dp->hpd_gpio))
+			return 0;
+	} else {
+		reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
+		if (reg & HPD_STATUS)
+			return 0;
+	}
 
 	return -EINVAL;
 }
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/7] drm/panel: add pre_enable routine to drm panel
  2014-04-16 14:32 [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support Ajay Kumar
  2014-04-16 14:33 ` [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO Ajay Kumar
@ 2014-04-16 14:33 ` Ajay Kumar
  2014-04-16 14:33 ` [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels Ajay Kumar
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Ajay Kumar @ 2014-04-16 14:33 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: inki.dae, a.hajda, treding, kyungmin.park, seanpaul, abrestic,
	rahul.sharma, ajaynumb, joshi, prashanth.g, Ajay Kumar

Most of the panels need an init sequence as mentioned below:
	-- poweron LCD unit/LCD_EN
	-- start video data
	-- poweron LED unit/BL_EN
With existing callbacks for drm panel, we cannot accomodate such
panels, since only one callback, i.e "panel_enable" is supported.

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

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 include/drm/drm_panel.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index c2ab77a..89210bf 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -32,6 +32,7 @@ struct drm_panel;
 
 struct drm_panel_funcs {
 	int (*disable)(struct drm_panel *panel);
+	int (*pre_enable)(struct drm_panel *panel);
 	int (*enable)(struct drm_panel *panel);
 	int (*get_modes)(struct drm_panel *panel);
 };
@@ -54,6 +55,14 @@ static inline int drm_panel_disable(struct drm_panel *panel)
 	return panel ? -ENOSYS : -EINVAL;
 }
 
+static inline int drm_panel_pre_enable(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->pre_enable)
+		return panel->funcs->pre_enable(panel);
+
+	return panel ? -ENOSYS : -EINVAL;
+}
+
 static inline int drm_panel_enable(struct drm_panel *panel)
 {
 	if (panel && panel->funcs && panel->funcs->enable)
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels
  2014-04-16 14:32 [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support Ajay Kumar
  2014-04-16 14:33 ` [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO Ajay Kumar
  2014-04-16 14:33 ` [PATCH 2/7] drm/panel: add pre_enable routine to drm panel Ajay Kumar
@ 2014-04-16 14:33 ` Ajay Kumar
  2014-04-18  8:47   ` Jingoo Han
  2014-04-16 14:33 ` [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver Ajay Kumar
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Ajay Kumar @ 2014-04-16 14:33 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: inki.dae, a.hajda, treding, kyungmin.park, seanpaul, abrestic,
	rahul.sharma, ajaynumb, joshi, prashanth.g, Ajay Kumar

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

Most of the eDP/LVDS panels need this sequence for powerup:
	-- LCD unit powerup/LCD_EN
	-- video data on
	-- LED unit powerup/BL_EN

The LCD and LED units are usually powered up via regulators,
and almost on all boards, we will have a BL_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.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 .../devicetree/bindings/panel/exynos-dp-panel.txt  |  32 ++++
 drivers/gpu/drm/panel/Kconfig                      |   9 +
 drivers/gpu/drm/panel/Makefile                     |   1 +
 drivers/gpu/drm/panel/panel-exynos-dp.c            | 213 +++++++++++++++++++++
 4 files changed, 255 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
 create mode 100644 drivers/gpu/drm/panel/panel-exynos-dp.c

diff --git a/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt b/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
new file mode 100644
index 0000000..a1428d2
--- /dev/null
+++ b/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
@@ -0,0 +1,32 @@
+exynos_DP_panel/DP_to_LVDS_panel
+==================================
+
+Required properties:
+  - compatible: "samsung,exynos-dp-panel"
+
+Optional properties:
+	-samsung,lcd-en-gpio:
+		eDP panel LCD poweron GPIO.
+			Indicates which GPIO needs to be powered up as output
+			to powerup/enable the switch to the LCD panel.
+	-samsung,led-en-gpio:
+		eDP panel LED enable GPIO.
+			Indicates which GPIO needs to be powered up as output
+			to enable the backlight.
+	-samsung,power-up-delay:
+		eDP panel powerup delay value in ms.
+			Delay in ms needed for the eDP panel to properly
+			powerup after giving powerup signals to the panel.
+	-samsung,power-down-delay:
+		eDP panel powerdown delay value in ms.
+			Delay in ms needed for the eDP panel to properly
+			powerdown after giving powerdown signals to the panel.
+
+Example:
+
+	dp-panel {
+		compatible = "samsung,exynos-dp-panel";
+		samsung,led-en-gpio = <&gpx3 0 1>;
+		samsung,power-up-delay = <40>;
+		samsung,power-down-delay = <50>;
+	};
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 4ec874d..ea9d5ac 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -30,4 +30,13 @@ config DRM_PANEL_S6E8AA0
 	select DRM_MIPI_DSI
 	select VIDEOMODE_HELPERS
 
+config DRM_PANEL_EXYNOS_DP
+	tristate "support for DP panels"
+	depends on OF && DRM_PANEL && DRM_EXYNOS_DP
+	help
+	  DRM panel driver for DP panels and 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
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 8b92921..30311a4 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -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_EXYNOS_DP) += panel-exynos-dp.o
diff --git a/drivers/gpu/drm/panel/panel-exynos-dp.c b/drivers/gpu/drm/panel/panel-exynos-dp.c
new file mode 100644
index 0000000..e85a7b2
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-exynos-dp.c
@@ -0,0 +1,213 @@
+/*
+ * Exynos DP panel driver
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd
+ *
+ * Ajay Kumar <ajaykumar.rs@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/component.h>
+#include <linux/gpio.h>
+#include <linux/module.h>
+#include <linux/of_gpio.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
+
+#include <drm/drmP.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_panel.h>
+
+struct panel_exynos_dp {
+	struct drm_panel	base;
+	struct regulator	*bck_fet;
+	struct regulator	*lcd_fet;
+	int			led_en_gpio;
+	int			lcd_en_gpio;
+	int			power_up_delay;
+	int			power_down_delay;
+	bool			enabled;
+};
+
+static inline struct panel_exynos_dp *to_panel(struct drm_panel *panel)
+{
+	return container_of(panel, struct panel_exynos_dp, base);
+}
+
+static int panel_exynos_dp_disable(struct drm_panel *panel)
+{
+	struct panel_exynos_dp *dp_panel = to_panel(panel);
+	bool enable_delay = false;
+
+	if (!dp_panel->enabled)
+		return 0;
+
+	if (gpio_is_valid(dp_panel->led_en_gpio))
+		gpio_set_value(dp_panel->led_en_gpio, 0);
+
+	if (!IS_ERR_OR_NULL(dp_panel->bck_fet))
+		regulator_disable(dp_panel->bck_fet);
+
+	if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
+		gpio_set_value(dp_panel->lcd_en_gpio, 0);
+		enable_delay = true;
+	}
+
+	if (!IS_ERR_OR_NULL(dp_panel->lcd_fet)) {
+		regulator_disable(dp_panel->lcd_fet);
+		enable_delay = true;
+	}
+
+	if (enable_delay)
+		msleep(dp_panel->power_down_delay);
+
+	dp_panel->enabled = false;
+
+	return 0;
+}
+
+static int panel_exynos_dp_pre_enable(struct drm_panel *panel)
+{
+	struct panel_exynos_dp *dp_panel = to_panel(panel);
+	bool enable_delay = false;
+
+	if (dp_panel->enabled)
+		return 0;
+
+	if (!IS_ERR_OR_NULL(dp_panel->lcd_fet)) {
+		if (regulator_enable(dp_panel->lcd_fet))
+			DRM_ERROR("Failed to enable LCD fet\n");
+		enable_delay = true;
+	}
+
+	if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
+		gpio_set_value(dp_panel->lcd_en_gpio, 1);
+		enable_delay = true;
+	}
+
+	if (enable_delay)
+		msleep(dp_panel->power_up_delay);
+
+	return 0;
+}
+
+static int panel_exynos_dp_enable(struct drm_panel *panel)
+{
+	struct panel_exynos_dp *dp_panel = to_panel(panel);
+
+	if (dp_panel->enabled)
+		return 0;
+
+	if (!IS_ERR_OR_NULL(dp_panel->bck_fet))
+		if (regulator_enable(dp_panel->bck_fet))
+				DRM_ERROR("Failed to enable LED fet\n");
+
+	if (gpio_is_valid(dp_panel->led_en_gpio))
+		gpio_set_value(dp_panel->led_en_gpio, 1);
+
+	dp_panel->enabled = true;
+
+	return 0;
+}
+
+static const struct drm_panel_funcs panel_exynos_dp_funcs = {
+	.disable = panel_exynos_dp_disable,
+	.pre_enable = panel_exynos_dp_pre_enable,
+	.enable = panel_exynos_dp_enable,
+};
+
+static int panel_exynos_dp_probe(struct platform_device *pdev)
+{
+	struct panel_exynos_dp *dp_panel;
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	dp_panel = devm_kzalloc(dev, sizeof(*dp_panel), GFP_KERNEL);
+	if (!dp_panel)
+		return -ENOMEM;
+
+	dp_panel->enabled = false;
+
+	dp_panel->lcd_en_gpio = of_get_named_gpio(dev->of_node,
+						"samsung,lcd-en-gpio", 0);
+	dp_panel->led_en_gpio = of_get_named_gpio(dev->of_node,
+						"samsung,led-en-gpio", 0);
+
+	of_property_read_u32(dev->of_node, "samsung,power-up-delay",
+						&dp_panel->power_up_delay);
+	of_property_read_u32(dev->of_node, "samsung,power-down-delay",
+						&dp_panel->power_down_delay);
+
+	dp_panel->lcd_fet = devm_regulator_get(dev, "lcd_vdd");
+	if (IS_ERR(dp_panel->lcd_fet))
+		return PTR_ERR(dp_panel->lcd_fet);
+
+	dp_panel->bck_fet = devm_regulator_get(dev, "vcd_led");
+	if (IS_ERR(dp_panel->bck_fet))
+		return PTR_ERR(dp_panel->bck_fet);
+
+	if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
+		ret = devm_gpio_request_one(dev, dp_panel->lcd_en_gpio,
+					GPIOF_OUT_INIT_LOW, "lcd_en_gpio");
+		if (ret) {
+			DRM_ERROR("failed to get lcd-en gpio [%d]\n", ret);
+			return ret;
+		}
+	} else {
+		dp_panel->lcd_en_gpio = -ENODEV;
+	}
+
+	if (gpio_is_valid(dp_panel->led_en_gpio)) {
+		ret = devm_gpio_request_one(dev, dp_panel->led_en_gpio,
+					GPIOF_OUT_INIT_LOW, "led_en_gpio");
+		if (ret) {
+			DRM_ERROR("failed to get led-en gpio [%d]\n", ret);
+			return ret;
+		}
+	} else {
+		dp_panel->led_en_gpio = -ENODEV;
+	}
+
+	drm_panel_init(&dp_panel->base);
+	dp_panel->base.dev = dev;
+	dp_panel->base.funcs = &panel_exynos_dp_funcs;
+
+	ret = drm_panel_add(&dp_panel->base);
+	if (ret < 0)
+		return ret;
+
+	dev_set_drvdata(dev, dp_panel);
+
+	return 0;
+}
+
+static int panel_exynos_dp_remove(struct platform_device *pdev)
+{
+	struct panel_exynos_dp *dp_panel = dev_get_drvdata(&pdev->dev);
+
+	drm_panel_detach(&dp_panel->base);
+	drm_panel_remove(&dp_panel->base);
+
+	panel_exynos_dp_disable(&dp_panel->base);
+
+	return 0;
+}
+
+static const struct of_device_id exynos_dp_panel_dt_match[] = {
+	{ .compatible = "samsung,exynos-dp-panel" },
+	{},
+};
+
+struct platform_driver exynos_dp_panel_driver = {
+	.driver = {
+		.name = "exynos-dp-panel",
+		.owner = THIS_MODULE,
+		.of_match_table = exynos_dp_panel_dt_match,
+	},
+	.probe = panel_exynos_dp_probe,
+	.remove = panel_exynos_dp_remove,
+};
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver
  2014-04-16 14:32 [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support Ajay Kumar
                   ` (2 preceding siblings ...)
  2014-04-16 14:33 ` [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels Ajay Kumar
@ 2014-04-16 14:33 ` Ajay Kumar
  2014-04-18  8:57   ` Jingoo Han
  2014-04-16 14:33 ` [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel Ajay Kumar
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Ajay Kumar @ 2014-04-16 14:33 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: inki.dae, a.hajda, treding, kyungmin.park, seanpaul, abrestic,
	rahul.sharma, ajaynumb, joshi, prashanth.g, Ajay Kumar

Register exynos_dp_panel before the list of exynos crtcs and
connectors are probed.

This is needed because exynos_dp_panel should be registered to
the drm_panel list via panel-exynos-dp probe, i.e much before
exynos_dp_bind calls of_drm_find_panel().

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 1d1c604..47266e7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -560,12 +560,23 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
 		goto err_unregister_ipp;
 #endif
 
+#ifdef CONFIG_DRM_PANEL_EXYNOS_DP
+	ret = platform_driver_register(&exynos_dp_panel_driver);
+	if (ret < 0)
+		goto err_unregister_dp_panel;
+#endif
+
 	ret = component_master_add(&pdev->dev, &exynos_drm_ops);
 	if (ret < 0)
 		DRM_DEBUG_KMS("re-tried by last sub driver probed later.\n");
 
 	return 0;
 
+#ifdef CONFIG_DRM_PANEL_EXYNOS_DP
+	platform_driver_unregister(&exynos_dp_panel_driver);
+err_unregister_dp_panel:
+#endif
+
 #ifdef CONFIG_DRM_EXYNOS_IPP
 	exynos_platform_device_ipp_unregister();
 err_unregister_ipp:
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 257ce09..f606290 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -368,4 +368,5 @@ extern struct platform_driver fimc_driver;
 extern struct platform_driver rotator_driver;
 extern struct platform_driver gsc_driver;
 extern struct platform_driver ipp_driver;
+extern struct platform_driver exynos_dp_panel_driver;
 #endif
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel
  2014-04-16 14:32 [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support Ajay Kumar
                   ` (3 preceding siblings ...)
  2014-04-16 14:33 ` [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver Ajay Kumar
@ 2014-04-16 14:33 ` Ajay Kumar
  2014-04-18  9:08   ` Jingoo Han
  2014-04-16 14:33 ` [PATCH 6/7] drm/bridge: ptn3460: enable polling based detection Ajay Kumar
  2014-04-16 14:33 ` [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls Ajay Kumar
  6 siblings, 1 reply; 20+ messages in thread
From: Ajay Kumar @ 2014-04-16 14:33 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: inki.dae, a.hajda, treding, kyungmin.park, seanpaul, abrestic,
	rahul.sharma, ajaynumb, joshi, prashanth.g, Ajay Kumar

This patch attaches the dp connector to exynos_dp_panel, and adds
calls to drm_panel functions to control panel power sequence.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 drivers/gpu/drm/exynos/Kconfig          |  1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c | 19 +++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_dp_core.h |  1 +
 3 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 5bf5bca..56af433 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -52,6 +52,7 @@ config DRM_EXYNOS_DP
 	bool "EXYNOS DRM DP driver support"
 	depends on DRM_EXYNOS && ARCH_EXYNOS
 	default DRM_EXYNOS
+	select DRM_PANEL
 	help
 	  This enables support for DP device.
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 18fd9c5..6beeab6 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -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"
@@ -1028,6 +1029,9 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
 	drm_sysfs_connector_add(connector);
 	drm_mode_connector_attach_encoder(connector, encoder);
 
+	if (dp->drm_panel)
+		drm_panel_attach(dp->drm_panel, &dp->connector);
+
 	return 0;
 }
 
@@ -1062,10 +1066,12 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
 	if (dp->dpms_mode == DRM_MODE_DPMS_ON)
 		return;
 
+	drm_panel_pre_enable(dp->drm_panel);
 	clk_prepare_enable(dp->clock);
 	exynos_dp_phy_init(dp);
 	exynos_dp_init_dp(dp);
 	enable_irq(dp->irq);
+	drm_panel_enable(dp->drm_panel);
 }
 
 static void exynos_dp_poweroff(struct exynos_dp_device *dp)
@@ -1073,6 +1079,7 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp)
 	if (dp->dpms_mode != DRM_MODE_DPMS_ON)
 		return;
 
+	drm_panel_disable(dp->drm_panel);
 	disable_irq(dp->irq);
 	flush_work(&dp->hotplug_work);
 	exynos_dp_phy_exit(dp);
@@ -1225,6 +1232,7 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
 static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
+	struct device_node *panel_node;
 	struct drm_device *drm_dev = data;
 	struct resource *res;
 	struct exynos_dp_device *dp;
@@ -1299,6 +1307,17 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
 
 	INIT_WORK(&dp->hotplug_work, exynos_dp_hotplug);
 
+	panel_node = of_find_compatible_node(NULL, NULL,
+						"samsung,exynos-dp-panel");
+	if (panel_node) {
+		dp->drm_panel = of_drm_find_panel(panel_node);
+		if (!dp->drm_panel) {
+			of_node_put(panel_node);
+			return -ENODEV;
+		}
+		of_node_put(panel_node);
+	}
+
 	exynos_dp_phy_init(dp);
 
 	exynos_dp_init_dp(dp);
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
index 56fa43e..9dc7991 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.h
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
@@ -148,6 +148,7 @@ struct exynos_dp_device {
 	struct drm_device	*drm_dev;
 	struct drm_connector	connector;
 	struct drm_encoder	*encoder;
+	struct drm_panel	*drm_panel;
 	struct clk		*clock;
 	unsigned int		irq;
 	void __iomem		*reg_base;
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/7] drm/bridge: ptn3460: enable polling based detection
  2014-04-16 14:32 [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support Ajay Kumar
                   ` (4 preceding siblings ...)
  2014-04-16 14:33 ` [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel Ajay Kumar
@ 2014-04-16 14:33 ` Ajay Kumar
  2014-04-16 14:33 ` [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls Ajay Kumar
  6 siblings, 0 replies; 20+ messages in thread
From: Ajay Kumar @ 2014-04-16 14:33 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: inki.dae, a.hajda, treding, kyungmin.park, seanpaul, abrestic,
	rahul.sharma, ajaynumb, joshi, prashanth.g

From: Rahul Sharma <Rahul.Sharma@samsung.com>

Add DRM_CONNECTOR_POLL_HPD to the set of connector flags while
registering drm_connector for ptn3460.

Signed-off-by: Rahul Sharma <Rahul.Sharma@samsung.com>
Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 drivers/gpu/drm/bridge/ptn3460.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index b171901..f1d2afc 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -326,6 +326,7 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 
 	bridge->driver_private = ptn_bridge;
 	encoder->bridge = bridge;
+	ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD;
 
 	ret = drm_connector_init(dev, &ptn_bridge->connector,
 			&ptn3460_connector_funcs, DRM_MODE_CONNECTOR_LVDS);
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls
  2014-04-16 14:32 [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support Ajay Kumar
                   ` (5 preceding siblings ...)
  2014-04-16 14:33 ` [PATCH 6/7] drm/bridge: ptn3460: enable polling based detection Ajay Kumar
@ 2014-04-16 14:33 ` Ajay Kumar
  2014-04-18  9:25   ` Jingoo Han
  6 siblings, 1 reply; 20+ messages in thread
From: Ajay Kumar @ 2014-04-16 14:33 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: inki.dae, a.hajda, treding, kyungmin.park, seanpaul, abrestic,
	rahul.sharma, ajaynumb, joshi, prashanth.g, Ajay Kumar

attach ptn3460 connector to drm_panel and support drm_panel routines,
if a valid drm_panel object is passed to ptn3460_init.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
---
 drivers/gpu/drm/bridge/Kconfig          |  1 +
 drivers/gpu/drm/bridge/ptn3460.c        | 17 ++++++++++++++++-
 drivers/gpu/drm/exynos/exynos_dp_core.c | 15 +++++++++++----
 include/drm/bridge/ptn3460.h            |  6 ++++--
 4 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 884923f..3bc6845 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -2,4 +2,5 @@ config DRM_PTN3460
 	tristate "PTN3460 DP/LVDS bridge"
 	depends on DRM
 	select DRM_KMS_HELPER
+	select DRM_PANEL
 	---help---
diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index f1d2afc..736c7a8 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -24,6 +24,7 @@
 #include "drm_edid.h"
 #include "drm_crtc.h"
 #include "drm_crtc_helper.h"
+#include <drm/drm_panel.h>
 
 #include "bridge/ptn3460.h"
 
@@ -38,6 +39,7 @@ struct ptn3460_bridge {
 	struct i2c_client *client;
 	struct drm_encoder *encoder;
 	struct drm_bridge *bridge;
+	struct drm_panel *panel;
 	struct edid *edid;
 	int gpio_pd_n;
 	int gpio_rst_n;
@@ -126,6 +128,8 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
 		gpio_set_value(ptn_bridge->gpio_rst_n, 1);
 	}
 
+	drm_panel_pre_enable(ptn_bridge->panel);
+
 	/*
 	 * 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 +146,9 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
 
 static void ptn3460_enable(struct drm_bridge *bridge)
 {
+	struct ptn3460_bridge *ptn_bridge = bridge->driver_private;
+
+	drm_panel_enable(ptn_bridge->panel);
 }
 
 static void ptn3460_disable(struct drm_bridge *bridge)
@@ -153,6 +160,8 @@ static void ptn3460_disable(struct drm_bridge *bridge)
 
 	ptn_bridge->enabled = false;
 
+	drm_panel_disable(ptn_bridge->panel);
+
 	if (gpio_is_valid(ptn_bridge->gpio_rst_n))
 		gpio_set_value(ptn_bridge->gpio_rst_n, 1);
 
@@ -265,7 +274,8 @@ struct drm_connector_funcs ptn3460_connector_funcs = {
 };
 
 int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
-		struct i2c_client *client, struct device_node *node)
+		struct i2c_client *client, struct device_node *node,
+		struct drm_panel *panel)
 {
 	int ret;
 	struct drm_bridge *bridge;
@@ -324,6 +334,11 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
 		goto err;
 	}
 
+	if (panel) {
+		ptn_bridge->panel = panel;
+		drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector);
+	}
+
 	bridge->driver_private = ptn_bridge;
 	encoder->bridge = bridge;
 	ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD;
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 6beeab6..7f550b6 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -989,13 +989,14 @@ static bool find_bridge(const char *compat, struct bridge_init *bridge)
 
 /* returns the number of bridges attached */
 static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
-		struct drm_encoder *encoder)
+		struct drm_encoder *encoder, struct drm_panel *panel)
 {
 	struct bridge_init bridge;
 	int ret;
 
 	if (find_bridge("nxp,ptn3460", &bridge)) {
-		ret = ptn3460_init(dev, encoder, bridge.client, bridge.node);
+		ret = ptn3460_init(dev, encoder, bridge.client, bridge.node,
+									panel);
 		if (!ret)
 			return 1;
 	}
@@ -1012,9 +1013,15 @@ 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);
-	if (ret)
+	ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder, dp->drm_panel);
+	if (ret) {
+		/* Also set "dp->drm_panel = NULL" so that we don't end up
+		 * controlling panel power both in exynos_dp and bridge
+		 * DPMS routines.
+		 */
+		dp->drm_panel = NULL;
 		return 0;
+	}
 
 	connector->polled = DRM_CONNECTOR_POLL_HPD;
 
diff --git a/include/drm/bridge/ptn3460.h b/include/drm/bridge/ptn3460.h
index ff62344..570cebb 100644
--- a/include/drm/bridge/ptn3460.h
+++ b/include/drm/bridge/ptn3460.h
@@ -18,16 +18,18 @@ struct drm_device;
 struct drm_encoder;
 struct i2c_client;
 struct device_node;
+struct drm_panel;
 
 #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 i2c_client *client, struct device_node *node,
+		struct drm_panel *panel);
 #else
 
 static inline int ptn3460_init(struct drm_device *dev,
 		struct drm_encoder *encoder, struct i2c_client *client,
-		struct device_node *node)
+		struct device_node *node, struct drm_panel *panel)
 {
 	return 0;
 }
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO
  2014-04-16 14:33 ` [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO Ajay Kumar
@ 2014-04-18  8:23   ` Jingoo Han
  2014-04-18 19:33     ` Ajay kumar
  0 siblings, 1 reply; 20+ messages in thread
From: Jingoo Han @ 2014-04-18  8:23 UTC (permalink / raw)
  To: 'Ajay Kumar'
  Cc: linux-samsung-soc, seanpaul, abrestic, joshi, dri-devel, a.hajda,
	kyungmin.park, ajaynumb, treding, prashanth.g, rahul.sharma

On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> 
> From: Andrew Bresticker <abrestic@chromium.org>
> 
> Certain bridge chips use a GPIO to indicate the cable status instead
> of the I_DP_HPD pin.  This adds an optional device-tree property,
> "samsung,hpd-gpio", to the exynos-dp controller which indicates that
> the specified GPIO should be used for hotplug detection.
> The GPIO is then set up as an edge-triggered interrupt where the
> rising edge indicates hotplug-in and the falling edge indicates hotplug-out.
> 
> Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
> Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> ---
>  .../devicetree/bindings/video/exynos_dp.txt        |  4 +++
>  drivers/gpu/drm/exynos/exynos_dp_core.c            | 32 ++++++++++++++++++++--
>  drivers/gpu/drm/exynos/exynos_dp_core.h            |  1 +
>  drivers/gpu/drm/exynos/exynos_dp_reg.c             | 26 ++++++++++++++++--
>  4 files changed, 57 insertions(+), 6 deletions(-)
> 

[.....]

> --- a/drivers/gpu/drm/exynos/exynos_dp_reg.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_reg.c
> @@ -13,6 +13,7 @@
>  #include <linux/device.h>
>  #include <linux/io.h>
>  #include <linux/delay.h>
> +#include <linux/gpio.h>
> 
>  #include "exynos_dp_core.h"
>  #include "exynos_dp_reg.h"
> @@ -326,6 +327,9 @@ void exynos_dp_clear_hotplug_interrupts(struct exynos_dp_device *dp)
>  {
>  	u32 reg;
> 
> +	if (gpio_is_valid(dp->hpd_gpio))
> +		return;
> +
>  	reg = HOTPLUG_CHG | HPD_LOST | PLUG;
>  	writel(reg, dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
> 
> @@ -337,6 +341,9 @@ void exynos_dp_init_hpd(struct exynos_dp_device *dp)
>  {
>  	u32 reg;
> 
> +	if (gpio_is_valid(dp->hpd_gpio))
> +		return;
> +
>  	exynos_dp_clear_hotplug_interrupts(dp);
> 
>  	reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
> @@ -348,6 +355,14 @@ enum dp_irq_type exynos_dp_get_irq_type(struct exynos_dp_device *dp)
>  {
>  	u32 reg;
> 
> +	if (gpio_is_valid(dp->hpd_gpio)) {
> +		reg = gpio_get_value(dp->hpd_gpio);
> +		if (reg)
> +			return DP_IRQ_TYPE_HP_CABLE_IN;
> +		else
> +			return DP_IRQ_TYPE_HP_CABLE_OUT;
> +	}
> +

Please keep the style. It enhances the readability.

if (gpio_is_valid(dp->hpd_gpio)) {
	...
} else {
	...
}

Then, it can be as bellows.

+	if (gpio_is_valid(dp->hpd_gpio)) {
+		reg = gpio_get_value(dp->hpd_gpio);
+		if (reg)
+			return DP_IRQ_TYPE_HP_CABLE_IN;
+		else
+			return DP_IRQ_TYPE_HP_CABLE_OUT;
+	} else {
+		/* Parse hotplug interrupt status register */
+		reg = readl(dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
+
+		if (reg & PLUG)
+			return DP_IRQ_TYPE_HP_CABLE_IN;
+
+		if (reg & HPD_LOST)
+			return DP_IRQ_TYPE_HP_CABLE_OUT;
+
+		if (reg & HOTPLUG_CHG)
+			return DP_IRQ_TYPE_HP_CHANGE;
+	}

        return DP_IRQ_TYPE_UNKNOWN;
}

Best regards,
Jingoo Han

>  	/* Parse hotplug interrupt status register */
>  	reg = readl(dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
> 
> @@ -402,9 +417,14 @@ int exynos_dp_get_plug_in_status(struct exynos_dp_device *dp)
>  {
>  	u32 reg;
> 
> -	reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
> -	if (reg & HPD_STATUS)
> -		return 0;
> +	if (gpio_is_valid(dp->hpd_gpio)) {
> +		if (gpio_get_value(dp->hpd_gpio))
> +			return 0;
> +	} else {
> +		reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
> +		if (reg & HPD_STATUS)
> +			return 0;
> +	}
> 
>  	return -EINVAL;
>  }
> --
> 1.8.1.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels
  2014-04-16 14:33 ` [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels Ajay Kumar
@ 2014-04-18  8:47   ` Jingoo Han
  2014-04-18 19:42     ` Ajay kumar
  0 siblings, 1 reply; 20+ messages in thread
From: Jingoo Han @ 2014-04-18  8:47 UTC (permalink / raw)
  To: 'Ajay Kumar'
  Cc: linux-samsung-soc, seanpaul, abrestic, joshi, dri-devel, a.hajda,
	kyungmin.park, ajaynumb, treding, prashanth.g, rahul.sharma

On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> 
> This patch adds a simple driver to handle all the LCD and LED
> powerup/down routines needed to support eDP/eDP-LVDS panels
> supported on exynos boards.
> 
> Most of the eDP/LVDS panels need this sequence for powerup:
> 	-- LCD unit powerup/LCD_EN
> 	-- video data on
> 	-- LED unit powerup/BL_EN
> 
> The LCD and LED units are usually powered up via regulators,
> and almost on all boards, we will have a BL_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.
> 
> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> ---
>  .../devicetree/bindings/panel/exynos-dp-panel.txt  |  32 ++++
>  drivers/gpu/drm/panel/Kconfig                      |   9 +
>  drivers/gpu/drm/panel/Makefile                     |   1 +
>  drivers/gpu/drm/panel/panel-exynos-dp.c            | 213 +++++++++++++++++++++
>  4 files changed, 255 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
>  create mode 100644 drivers/gpu/drm/panel/panel-exynos-dp.c
> 
> diff --git a/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
> b/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
> new file mode 100644
> index 0000000..a1428d2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
> @@ -0,0 +1,32 @@
> +exynos_DP_panel/DP_to_LVDS_panel

Please remove unnecessary under lines as below.

Exynos DP panel/DP to LVDS panel

> +==================================
> +
> +Required properties:
> +  - compatible: "samsung,exynos-dp-panel"
> +
> +Optional properties:
> +	-samsung,lcd-en-gpio:
> +		eDP panel LCD poweron GPIO.
> +			Indicates which GPIO needs to be powered up as output
> +			to powerup/enable the switch to the LCD panel.
> +	-samsung,led-en-gpio:
> +		eDP panel LED enable GPIO.
> +			Indicates which GPIO needs to be powered up as output
> +			to enable the backlight.
> +	-samsung,power-up-delay:
> +		eDP panel powerup delay value in ms.
> +			Delay in ms needed for the eDP panel to properly
> +			powerup after giving powerup signals to the panel.
> +	-samsung,power-down-delay:
> +		eDP panel powerdown delay value in ms.
> +			Delay in ms needed for the eDP panel to properly
> +			powerdown after giving powerdown signals to the panel.
> +
> +Example:
> +
> +	dp-panel {
> +		compatible = "samsung,exynos-dp-panel";
> +		samsung,led-en-gpio = <&gpx3 0 1>;
> +		samsung,power-up-delay = <40>;
> +		samsung,power-down-delay = <50>;
> +	};
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 4ec874d..ea9d5ac 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -30,4 +30,13 @@ config DRM_PANEL_S6E8AA0
>  	select DRM_MIPI_DSI
>  	select VIDEOMODE_HELPERS
> 
> +config DRM_PANEL_EXYNOS_DP
> +	tristate "support for DP panels"
> +	depends on OF && DRM_PANEL && DRM_EXYNOS_DP
> +	help
> +	  DRM panel driver for DP panels and 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
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 8b92921..30311a4 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -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_EXYNOS_DP) += panel-exynos-dp.o
> diff --git a/drivers/gpu/drm/panel/panel-exynos-dp.c b/drivers/gpu/drm/panel/panel-exynos-dp.c
> new file mode 100644
> index 0000000..e85a7b2
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-exynos-dp.c
> @@ -0,0 +1,213 @@
> +/*
> + * Exynos DP panel driver
> + *
> + * Copyright (c) 2014 Samsung Electronics Co., Ltd
> + *
> + * Ajay Kumar <ajaykumar.rs@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/component.h>
> +#include <linux/gpio.h>
> +#include <linux/module.h>
> +#include <linux/of_gpio.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/regulator/consumer.h>
> +
> +#include <drm/drmP.h>
> +#include <drm/drm_crtc.h>
> +#include <drm/drm_panel.h>
> +
> +struct panel_exynos_dp {
> +	struct drm_panel	base;
> +	struct regulator	*bck_fet;
> +	struct regulator	*lcd_fet;

'bck' means 'backlight'? Then, just use 'backlight_fet'.
Also, I cannot understand the meaning of 'fet'.
What's the meaning of the 'fet'?

> +	int			led_en_gpio;
> +	int			lcd_en_gpio;
> +	int			power_up_delay;
> +	int			power_down_delay;
> +	bool			enabled;
> +};
> +
> +static inline struct panel_exynos_dp *to_panel(struct drm_panel *panel)
> +{
> +	return container_of(panel, struct panel_exynos_dp, base);
> +}
> +
> +static int panel_exynos_dp_disable(struct drm_panel *panel)
> +{
> +	struct panel_exynos_dp *dp_panel = to_panel(panel);
> +	bool enable_delay = false;
> +
> +	if (!dp_panel->enabled)
> +		return 0;
> +
> +	if (gpio_is_valid(dp_panel->led_en_gpio))
> +		gpio_set_value(dp_panel->led_en_gpio, 0);
> +
> +	if (!IS_ERR_OR_NULL(dp_panel->bck_fet))
> +		regulator_disable(dp_panel->bck_fet);
> +
> +	if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
> +		gpio_set_value(dp_panel->lcd_en_gpio, 0);
> +		enable_delay = true;
> +	}
> +
> +	if (!IS_ERR_OR_NULL(dp_panel->lcd_fet)) {
> +		regulator_disable(dp_panel->lcd_fet);
> +		enable_delay = true;
> +	}
> +
> +	if (enable_delay)
> +		msleep(dp_panel->power_down_delay);
> +
> +	dp_panel->enabled = false;
> +
> +	return 0;
> +}
> +
> +static int panel_exynos_dp_pre_enable(struct drm_panel *panel)

panel_exynos_dp_pre_enable() always returns '0'.
These are two ways. Either one will be better.
1. Make return values meaningful. In other words, add the case
   returning error values.

2. Change the return type to 'void'

Best regards,
Jingoo Han

> +{
> +	struct panel_exynos_dp *dp_panel = to_panel(panel);
> +	bool enable_delay = false;
> +
> +	if (dp_panel->enabled)
> +		return 0;
> +
> +	if (!IS_ERR_OR_NULL(dp_panel->lcd_fet)) {
> +		if (regulator_enable(dp_panel->lcd_fet))
> +			DRM_ERROR("Failed to enable LCD fet\n");
> +		enable_delay = true;
> +	}
> +
> +	if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
> +		gpio_set_value(dp_panel->lcd_en_gpio, 1);
> +		enable_delay = true;
> +	}
> +
> +	if (enable_delay)
> +		msleep(dp_panel->power_up_delay);
> +
> +	return 0;
> +}
> +
> +static int panel_exynos_dp_enable(struct drm_panel *panel)
> +{
> +	struct panel_exynos_dp *dp_panel = to_panel(panel);
> +
> +	if (dp_panel->enabled)
> +		return 0;
> +
> +	if (!IS_ERR_OR_NULL(dp_panel->bck_fet))
> +		if (regulator_enable(dp_panel->bck_fet))
> +				DRM_ERROR("Failed to enable LED fet\n");
> +
> +	if (gpio_is_valid(dp_panel->led_en_gpio))
> +		gpio_set_value(dp_panel->led_en_gpio, 1);
> +
> +	dp_panel->enabled = true;
> +
> +	return 0;
> +}
> +
> +static const struct drm_panel_funcs panel_exynos_dp_funcs = {
> +	.disable = panel_exynos_dp_disable,
> +	.pre_enable = panel_exynos_dp_pre_enable,
> +	.enable = panel_exynos_dp_enable,
> +};
> +
> +static int panel_exynos_dp_probe(struct platform_device *pdev)
> +{
> +	struct panel_exynos_dp *dp_panel;
> +	struct device *dev = &pdev->dev;
> +	int ret;
> +
> +	dp_panel = devm_kzalloc(dev, sizeof(*dp_panel), GFP_KERNEL);
> +	if (!dp_panel)
> +		return -ENOMEM;
> +
> +	dp_panel->enabled = false;
> +
> +	dp_panel->lcd_en_gpio = of_get_named_gpio(dev->of_node,
> +						"samsung,lcd-en-gpio", 0);
> +	dp_panel->led_en_gpio = of_get_named_gpio(dev->of_node,
> +						"samsung,led-en-gpio", 0);
> +
> +	of_property_read_u32(dev->of_node, "samsung,power-up-delay",
> +						&dp_panel->power_up_delay);
> +	of_property_read_u32(dev->of_node, "samsung,power-down-delay",
> +						&dp_panel->power_down_delay);
> +
> +	dp_panel->lcd_fet = devm_regulator_get(dev, "lcd_vdd");
> +	if (IS_ERR(dp_panel->lcd_fet))
> +		return PTR_ERR(dp_panel->lcd_fet);
> +
> +	dp_panel->bck_fet = devm_regulator_get(dev, "vcd_led");
> +	if (IS_ERR(dp_panel->bck_fet))
> +		return PTR_ERR(dp_panel->bck_fet);
> +
> +	if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
> +		ret = devm_gpio_request_one(dev, dp_panel->lcd_en_gpio,
> +					GPIOF_OUT_INIT_LOW, "lcd_en_gpio");
> +		if (ret) {
> +			DRM_ERROR("failed to get lcd-en gpio [%d]\n", ret);
> +			return ret;
> +		}
> +	} else {
> +		dp_panel->lcd_en_gpio = -ENODEV;
> +	}
> +
> +	if (gpio_is_valid(dp_panel->led_en_gpio)) {
> +		ret = devm_gpio_request_one(dev, dp_panel->led_en_gpio,
> +					GPIOF_OUT_INIT_LOW, "led_en_gpio");
> +		if (ret) {
> +			DRM_ERROR("failed to get led-en gpio [%d]\n", ret);
> +			return ret;
> +		}
> +	} else {
> +		dp_panel->led_en_gpio = -ENODEV;
> +	}
> +
> +	drm_panel_init(&dp_panel->base);
> +	dp_panel->base.dev = dev;
> +	dp_panel->base.funcs = &panel_exynos_dp_funcs;
> +
> +	ret = drm_panel_add(&dp_panel->base);
> +	if (ret < 0)
> +		return ret;
> +
> +	dev_set_drvdata(dev, dp_panel);
> +
> +	return 0;
> +}
> +
> +static int panel_exynos_dp_remove(struct platform_device *pdev)
> +{
> +	struct panel_exynos_dp *dp_panel = dev_get_drvdata(&pdev->dev);
> +
> +	drm_panel_detach(&dp_panel->base);
> +	drm_panel_remove(&dp_panel->base);
> +
> +	panel_exynos_dp_disable(&dp_panel->base);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id exynos_dp_panel_dt_match[] = {
> +	{ .compatible = "samsung,exynos-dp-panel" },
> +	{},
> +};
> +
> +struct platform_driver exynos_dp_panel_driver = {
> +	.driver = {
> +		.name = "exynos-dp-panel",
> +		.owner = THIS_MODULE,
> +		.of_match_table = exynos_dp_panel_dt_match,
> +	},
> +	.probe = panel_exynos_dp_probe,
> +	.remove = panel_exynos_dp_remove,
> +};
> --
> 1.8.1.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver
  2014-04-16 14:33 ` [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver Ajay Kumar
@ 2014-04-18  8:57   ` Jingoo Han
  2014-04-18 19:50     ` Ajay kumar
  0 siblings, 1 reply; 20+ messages in thread
From: Jingoo Han @ 2014-04-18  8:57 UTC (permalink / raw)
  To: 'Ajay Kumar'
  Cc: linux-samsung-soc, seanpaul, abrestic, joshi, dri-devel, a.hajda,
	kyungmin.park, ajaynumb, treding, prashanth.g, rahul.sharma

On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> 
> Register exynos_dp_panel before the list of exynos crtcs and
> connectors are probed.
> 
> This is needed because exynos_dp_panel should be registered to
> the drm_panel list via panel-exynos-dp probe, i.e much before
> exynos_dp_bind calls of_drm_find_panel().
> 
> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++
>  drivers/gpu/drm/exynos/exynos_drm_drv.h |  1 +
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 1d1c604..47266e7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -560,12 +560,23 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
>  		goto err_unregister_ipp;
>  #endif
> 
> +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP
> +	ret = platform_driver_register(&exynos_dp_panel_driver);
> +	if (ret < 0)
> +		goto err_unregister_dp_panel;
> +#endif
> +
>  	ret = component_master_add(&pdev->dev, &exynos_drm_ops);
>  	if (ret < 0)
>  		DRM_DEBUG_KMS("re-tried by last sub driver probed later.\n");
> 
>  	return 0;
> 
> +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP
> +	platform_driver_unregister(&exynos_dp_panel_driver);
> +err_unregister_dp_panel:
> +#endif

Please add platform_driver_unregister() to exynos_drm_platform_remove(),
as well as exynos_drm_platform_probe().

Best regards,
Jingoo Han

> +
>  #ifdef CONFIG_DRM_EXYNOS_IPP
>  	exynos_platform_device_ipp_unregister();
>  err_unregister_ipp:
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> index 257ce09..f606290 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> @@ -368,4 +368,5 @@ extern struct platform_driver fimc_driver;
>  extern struct platform_driver rotator_driver;
>  extern struct platform_driver gsc_driver;
>  extern struct platform_driver ipp_driver;
> +extern struct platform_driver exynos_dp_panel_driver;
>  #endif
> --
> 1.8.1.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel
  2014-04-16 14:33 ` [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel Ajay Kumar
@ 2014-04-18  9:08   ` Jingoo Han
  2014-04-18 19:52     ` Ajay kumar
  0 siblings, 1 reply; 20+ messages in thread
From: Jingoo Han @ 2014-04-18  9:08 UTC (permalink / raw)
  To: 'Ajay Kumar', dri-devel, linux-samsung-soc
  Cc: seanpaul, abrestic, joshi, a.hajda, kyungmin.park, ajaynumb,
	treding, prashanth.g, rahul.sharma

On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> 
> This patch attaches the dp connector to exynos_dp_panel, and adds
> calls to drm_panel functions to control panel power sequence.
> 
> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> ---
>  drivers/gpu/drm/exynos/Kconfig          |  1 +
>  drivers/gpu/drm/exynos/exynos_dp_core.c | 19 +++++++++++++++++++
>  drivers/gpu/drm/exynos/exynos_dp_core.h |  1 +
>  3 files changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
> index 5bf5bca..56af433 100644
> --- a/drivers/gpu/drm/exynos/Kconfig
> +++ b/drivers/gpu/drm/exynos/Kconfig
> @@ -52,6 +52,7 @@ config DRM_EXYNOS_DP
>  	bool "EXYNOS DRM DP driver support"
>  	depends on DRM_EXYNOS && ARCH_EXYNOS
>  	default DRM_EXYNOS
> +	select DRM_PANEL
>  	help
>  	  This enables support for DP device.
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 18fd9c5..6beeab6 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -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"
> @@ -1028,6 +1029,9 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
>  	drm_sysfs_connector_add(connector);
>  	drm_mode_connector_attach_encoder(connector, encoder);
> 
> +	if (dp->drm_panel)
> +		drm_panel_attach(dp->drm_panel, &dp->connector);
> +
>  	return 0;
>  }
> 
> @@ -1062,10 +1066,12 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
>  	if (dp->dpms_mode == DRM_MODE_DPMS_ON)
>  		return;
> 
> +	drm_panel_pre_enable(dp->drm_panel);
>  	clk_prepare_enable(dp->clock);
>  	exynos_dp_phy_init(dp);
>  	exynos_dp_init_dp(dp);
>  	enable_irq(dp->irq);
> +	drm_panel_enable(dp->drm_panel);
>  }
> 
>  static void exynos_dp_poweroff(struct exynos_dp_device *dp)
> @@ -1073,6 +1079,7 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp)
>  	if (dp->dpms_mode != DRM_MODE_DPMS_ON)
>  		return;
> 
> +	drm_panel_disable(dp->drm_panel);
>  	disable_irq(dp->irq);
>  	flush_work(&dp->hotplug_work);
>  	exynos_dp_phy_exit(dp);
> @@ -1225,6 +1232,7 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
>  static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
> +	struct device_node *panel_node;
>  	struct drm_device *drm_dev = data;
>  	struct resource *res;
>  	struct exynos_dp_device *dp;
> @@ -1299,6 +1307,17 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
> 
>  	INIT_WORK(&dp->hotplug_work, exynos_dp_hotplug);
> 
> +	panel_node = of_find_compatible_node(NULL, NULL,
> +						"samsung,exynos-dp-panel");
> +	if (panel_node) {
> +		dp->drm_panel = of_drm_find_panel(panel_node);
> +		if (!dp->drm_panel) {
> +			of_node_put(panel_node);
> +			return -ENODEV;
> +		}
> +		of_node_put(panel_node);
> +	}

The following is simpler.

+	if (panel_node) {
+		dp->drm_panel = of_drm_find_panel(panel_node);
+		of_node_put(panel_node);
+		if (!dp->drm_panel)
+			return -ENODEV;
+	}

Best regards,
Jingoo Han

> +
>  	exynos_dp_phy_init(dp);
> 
>  	exynos_dp_init_dp(dp);
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h
> index 56fa43e..9dc7991 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
> @@ -148,6 +148,7 @@ struct exynos_dp_device {
>  	struct drm_device	*drm_dev;
>  	struct drm_connector	connector;
>  	struct drm_encoder	*encoder;
> +	struct drm_panel	*drm_panel;
>  	struct clk		*clock;
>  	unsigned int		irq;
>  	void __iomem		*reg_base;
> --
> 1.8.1.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls
  2014-04-16 14:33 ` [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls Ajay Kumar
@ 2014-04-18  9:25   ` Jingoo Han
  2014-04-18 19:55     ` Ajay kumar
  0 siblings, 1 reply; 20+ messages in thread
From: Jingoo Han @ 2014-04-18  9:25 UTC (permalink / raw)
  To: 'Ajay Kumar'
  Cc: linux-samsung-soc, seanpaul, abrestic, joshi, dri-devel, a.hajda,
	kyungmin.park, ajaynumb, treding, prashanth.g, rahul.sharma

On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> 
> attach ptn3460 connector to drm_panel and support drm_panel routines,
> if a valid drm_panel object is passed to ptn3460_init.
> 
> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> ---
>  drivers/gpu/drm/bridge/Kconfig          |  1 +
>  drivers/gpu/drm/bridge/ptn3460.c        | 17 ++++++++++++++++-
>  drivers/gpu/drm/exynos/exynos_dp_core.c | 15 +++++++++++----
>  include/drm/bridge/ptn3460.h            |  6 ++++--
>  4 files changed, 32 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 884923f..3bc6845 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -2,4 +2,5 @@ config DRM_PTN3460
>  	tristate "PTN3460 DP/LVDS bridge"
>  	depends on DRM
>  	select DRM_KMS_HELPER
> +	select DRM_PANEL
>  	---help---
> diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
> index f1d2afc..736c7a8 100644
> --- a/drivers/gpu/drm/bridge/ptn3460.c
> +++ b/drivers/gpu/drm/bridge/ptn3460.c
> @@ -24,6 +24,7 @@
>  #include "drm_edid.h"
>  #include "drm_crtc.h"
>  #include "drm_crtc_helper.h"
> +#include <drm/drm_panel.h>

Move '<drm/drm_panel.h>' as below.

#include <linux/gpio.h>
#include <linux/delay.h>
+#include <drm/drm_panel.h>

#include "drmP.h"


> 
>  #include "bridge/ptn3460.h"
> 
> @@ -38,6 +39,7 @@ struct ptn3460_bridge {
>  	struct i2c_client *client;
>  	struct drm_encoder *encoder;
>  	struct drm_bridge *bridge;
> +	struct drm_panel *panel;
>  	struct edid *edid;
>  	int gpio_pd_n;
>  	int gpio_rst_n;
> @@ -126,6 +128,8 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
>  		gpio_set_value(ptn_bridge->gpio_rst_n, 1);
>  	}
> 
> +	drm_panel_pre_enable(ptn_bridge->panel);
> +
>  	/*
>  	 * 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 +146,9 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)
> 
>  static void ptn3460_enable(struct drm_bridge *bridge)
>  {
> +	struct ptn3460_bridge *ptn_bridge = bridge->driver_private;
> +
> +	drm_panel_enable(ptn_bridge->panel);
>  }
> 
>  static void ptn3460_disable(struct drm_bridge *bridge)
> @@ -153,6 +160,8 @@ static void ptn3460_disable(struct drm_bridge *bridge)
> 
>  	ptn_bridge->enabled = false;
> 
> +	drm_panel_disable(ptn_bridge->panel);
> +
>  	if (gpio_is_valid(ptn_bridge->gpio_rst_n))
>  		gpio_set_value(ptn_bridge->gpio_rst_n, 1);
> 
> @@ -265,7 +274,8 @@ struct drm_connector_funcs ptn3460_connector_funcs = {
>  };
> 
>  int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
> -		struct i2c_client *client, struct device_node *node)
> +		struct i2c_client *client, struct device_node *node,
> +		struct drm_panel *panel)
>  {
>  	int ret;
>  	struct drm_bridge *bridge;
> @@ -324,6 +334,11 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
>  		goto err;
>  	}
> 
> +	if (panel) {
> +		ptn_bridge->panel = panel;
> +		drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector);
> +	}
> +
>  	bridge->driver_private = ptn_bridge;
>  	encoder->bridge = bridge;
>  	ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD;
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 6beeab6..7f550b6 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -989,13 +989,14 @@ static bool find_bridge(const char *compat, struct bridge_init *bridge)
> 
>  /* returns the number of bridges attached */
>  static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
> -		struct drm_encoder *encoder)
> +		struct drm_encoder *encoder, struct drm_panel *panel)
>  {
>  	struct bridge_init bridge;
>  	int ret;
> 
>  	if (find_bridge("nxp,ptn3460", &bridge)) {
> -		ret = ptn3460_init(dev, encoder, bridge.client, bridge.node);
> +		ret = ptn3460_init(dev, encoder, bridge.client, bridge.node,
> +									panel);

'panel' is too far. Please fix it as below.

	if (find_bridge("nxp,ptn3460", &bridge)) {
		ret = ptn3460_init(dev, encoder, bridge.client, bridge.node,
				   panel);


>  		if (!ret)
>  			return 1;
>  	}
> @@ -1012,9 +1013,15 @@ 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);
> -	if (ret)
> +	ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder, dp->drm_panel);
> +	if (ret) {
> +		/* Also set "dp->drm_panel = NULL" so that we don't end up
> +		 * controlling panel power both in exynos_dp and bridge
> +		 * DPMS routines.
> +		 */

Please fix it as below.

 +		/*
 +		 * Also set "dp->drm_panel = NULL" so that we don't end up
 +		 * controlling panel power both in exynos_dp and bridge
 +		 * DPMS routines.
 +		 */

Best regards,
Jingoo Han

> +		dp->drm_panel = NULL;
>  		return 0;
> +	}
> 
>  	connector->polled = DRM_CONNECTOR_POLL_HPD;
> 
> diff --git a/include/drm/bridge/ptn3460.h b/include/drm/bridge/ptn3460.h
> index ff62344..570cebb 100644
> --- a/include/drm/bridge/ptn3460.h
> +++ b/include/drm/bridge/ptn3460.h
> @@ -18,16 +18,18 @@ struct drm_device;
>  struct drm_encoder;
>  struct i2c_client;
>  struct device_node;
> +struct drm_panel;
> 
>  #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 i2c_client *client, struct device_node *node,
> +		struct drm_panel *panel);
>  #else
> 
>  static inline int ptn3460_init(struct drm_device *dev,
>  		struct drm_encoder *encoder, struct i2c_client *client,
> -		struct device_node *node)
> +		struct device_node *node, struct drm_panel *panel)
>  {
>  	return 0;
>  }
> --
> 1.8.1.2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO
  2014-04-18  8:23   ` Jingoo Han
@ 2014-04-18 19:33     ` Ajay kumar
  0 siblings, 0 replies; 20+ messages in thread
From: Ajay kumar @ 2014-04-18 19:33 UTC (permalink / raw)
  To: Jingoo Han
  Cc: linux-samsung-soc, Sean Paul, abrestic, sunil joshi, dri-devel,
	a.hajda, Kyungmin Park, treding, Prashanth G, Ajay Kumar,
	Rahul Sharma


[-- Attachment #1.1: Type: text/plain, Size: 4293 bytes --]

Hi Jingoo,


On Fri, Apr 18, 2014 at 1:53 PM, Jingoo Han <jg1.han@samsung.com> wrote:

> On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> >
> > From: Andrew Bresticker <abrestic@chromium.org>
> >
> > Certain bridge chips use a GPIO to indicate the cable status instead
> > of the I_DP_HPD pin.  This adds an optional device-tree property,
> > "samsung,hpd-gpio", to the exynos-dp controller which indicates that
> > the specified GPIO should be used for hotplug detection.
> > The GPIO is then set up as an edge-triggered interrupt where the
> > rising edge indicates hotplug-in and the falling edge indicates
> hotplug-out.
> >
> > Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
> > Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> > Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> > ---
> >  .../devicetree/bindings/video/exynos_dp.txt        |  4 +++
> >  drivers/gpu/drm/exynos/exynos_dp_core.c            | 32
> ++++++++++++++++++++--
> >  drivers/gpu/drm/exynos/exynos_dp_core.h            |  1 +
> >  drivers/gpu/drm/exynos/exynos_dp_reg.c             | 26
> ++++++++++++++++--
> >  4 files changed, 57 insertions(+), 6 deletions(-)
> >
>
> [.....]
>
> > --- a/drivers/gpu/drm/exynos/exynos_dp_reg.c
> > +++ b/drivers/gpu/drm/exynos/exynos_dp_reg.c
> > @@ -13,6 +13,7 @@
> >  #include <linux/device.h>
> >  #include <linux/io.h>
> >  #include <linux/delay.h>
> > +#include <linux/gpio.h>
> >
> >  #include "exynos_dp_core.h"
> >  #include "exynos_dp_reg.h"
> > @@ -326,6 +327,9 @@ void exynos_dp_clear_hotplug_interrupts(struct
> exynos_dp_device *dp)
> >  {
> >       u32 reg;
> >
> > +     if (gpio_is_valid(dp->hpd_gpio))
> > +             return;
> > +
> >       reg = HOTPLUG_CHG | HPD_LOST | PLUG;
> >       writel(reg, dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
> >
> > @@ -337,6 +341,9 @@ void exynos_dp_init_hpd(struct exynos_dp_device *dp)
> >  {
> >       u32 reg;
> >
> > +     if (gpio_is_valid(dp->hpd_gpio))
> > +             return;
> > +
> >       exynos_dp_clear_hotplug_interrupts(dp);
> >
> >       reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
> > @@ -348,6 +355,14 @@ enum dp_irq_type exynos_dp_get_irq_type(struct
> exynos_dp_device *dp)
> >  {
> >       u32 reg;
> >
> > +     if (gpio_is_valid(dp->hpd_gpio)) {
> > +             reg = gpio_get_value(dp->hpd_gpio);
> > +             if (reg)
> > +                     return DP_IRQ_TYPE_HP_CABLE_IN;
> > +             else
> > +                     return DP_IRQ_TYPE_HP_CABLE_OUT;
> > +     }
> > +
>
> Please keep the style. It enhances the readability.
>
> if (gpio_is_valid(dp->hpd_gpio)) {
>         ...
> } else {
>         ...
> }
>
> Ok.

> Then, it can be as bellows.
>
> +       if (gpio_is_valid(dp->hpd_gpio)) {
> +               reg = gpio_get_value(dp->hpd_gpio);
> +               if (reg)
> +                       return DP_IRQ_TYPE_HP_CABLE_IN;
> +               else
> +                       return DP_IRQ_TYPE_HP_CABLE_OUT;
> +       } else {
> +               /* Parse hotplug interrupt status register */
> +               reg = readl(dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
> +
> +               if (reg & PLUG)
> +                       return DP_IRQ_TYPE_HP_CABLE_IN;
> +
> +               if (reg & HPD_LOST)
> +                       return DP_IRQ_TYPE_HP_CABLE_OUT;
> +
> +               if (reg & HOTPLUG_CHG)
> +                       return DP_IRQ_TYPE_HP_CHANGE;
> +       }
>
> Will change this.

>         return DP_IRQ_TYPE_UNKNOWN;
> }
>
> Best regards,
> Jingoo Han
>
> >       /* Parse hotplug interrupt status register */
> >       reg = readl(dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
> >
> > @@ -402,9 +417,14 @@ int exynos_dp_get_plug_in_status(struct
> exynos_dp_device *dp)
> >  {
> >       u32 reg;
> >
> > -     reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
> > -     if (reg & HPD_STATUS)
> > -             return 0;
> > +     if (gpio_is_valid(dp->hpd_gpio)) {
> > +             if (gpio_get_value(dp->hpd_gpio))
> > +                     return 0;
> > +     } else {
> > +             reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3);
> > +             if (reg & HPD_STATUS)
> > +                     return 0;
> > +     }
> >
> >       return -EINVAL;
> >  }
> > --
> > 1.8.1.2
>
>
Thanks and Regrads,
Ajay Kumar

[-- Attachment #1.2: Type: text/html, Size: 6340 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels
  2014-04-18  8:47   ` Jingoo Han
@ 2014-04-18 19:42     ` Ajay kumar
  2014-04-21  0:34       ` Jingoo Han
  0 siblings, 1 reply; 20+ messages in thread
From: Ajay kumar @ 2014-04-18 19:42 UTC (permalink / raw)
  To: Jingoo Han
  Cc: linux-samsung-soc, Sean Paul, abrestic, sunil joshi, dri-devel,
	a.hajda, Kyungmin Park, treding, Prashanth G, Ajay Kumar,
	Rahul Sharma


[-- Attachment #1.1: Type: text/plain, Size: 12486 bytes --]

Hi Jingoo,


On Fri, Apr 18, 2014 at 2:17 PM, Jingoo Han <jg1.han@samsung.com> wrote:

> On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> >
> > This patch adds a simple driver to handle all the LCD and LED
> > powerup/down routines needed to support eDP/eDP-LVDS panels
> > supported on exynos boards.
> >
> > Most of the eDP/LVDS panels need this sequence for powerup:
> >       -- LCD unit powerup/LCD_EN
> >       -- video data on
> >       -- LED unit powerup/BL_EN
> >
> > The LCD and LED units are usually powered up via regulators,
> > and almost on all boards, we will have a BL_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.
> >
> > Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> > ---
> >  .../devicetree/bindings/panel/exynos-dp-panel.txt  |  32 ++++
> >  drivers/gpu/drm/panel/Kconfig                      |   9 +
> >  drivers/gpu/drm/panel/Makefile                     |   1 +
> >  drivers/gpu/drm/panel/panel-exynos-dp.c            | 213
> +++++++++++++++++++++
> >  4 files changed, 255 insertions(+)
> >  create mode 100644
> Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
> >  create mode 100644 drivers/gpu/drm/panel/panel-exynos-dp.c
> >
> > diff --git a/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
> > b/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
> > new file mode 100644
> > index 0000000..a1428d2
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
> > @@ -0,0 +1,32 @@
> > +exynos_DP_panel/DP_to_LVDS_panel
>
> Please remove unnecessary under lines as below.
>
> Ok.

> Exynos DP panel/DP to LVDS panel
>
> > +==================================
> > +
> > +Required properties:
> > +  - compatible: "samsung,exynos-dp-panel"
> > +
> > +Optional properties:
> > +     -samsung,lcd-en-gpio:
> > +             eDP panel LCD poweron GPIO.
> > +                     Indicates which GPIO needs to be powered up as
> output
> > +                     to powerup/enable the switch to the LCD panel.
> > +     -samsung,led-en-gpio:
> > +             eDP panel LED enable GPIO.
> > +                     Indicates which GPIO needs to be powered up as
> output
> > +                     to enable the backlight.
> > +     -samsung,power-up-delay:
> > +             eDP panel powerup delay value in ms.
> > +                     Delay in ms needed for the eDP panel to properly
> > +                     powerup after giving powerup signals to the panel.
> > +     -samsung,power-down-delay:
> > +             eDP panel powerdown delay value in ms.
> > +                     Delay in ms needed for the eDP panel to properly
> > +                     powerdown after giving powerdown signals to the
> panel.
> > +
> > +Example:
> > +
> > +     dp-panel {
> > +             compatible = "samsung,exynos-dp-panel";
> > +             samsung,led-en-gpio = <&gpx3 0 1>;
> > +             samsung,power-up-delay = <40>;
> > +             samsung,power-down-delay = <50>;
> > +     };
> > diff --git a/drivers/gpu/drm/panel/Kconfig
> b/drivers/gpu/drm/panel/Kconfig
> > index 4ec874d..ea9d5ac 100644
> > --- a/drivers/gpu/drm/panel/Kconfig
> > +++ b/drivers/gpu/drm/panel/Kconfig
> > @@ -30,4 +30,13 @@ config DRM_PANEL_S6E8AA0
> >       select DRM_MIPI_DSI
> >       select VIDEOMODE_HELPERS
> >
> > +config DRM_PANEL_EXYNOS_DP
> > +     tristate "support for DP panels"
> > +     depends on OF && DRM_PANEL && DRM_EXYNOS_DP
> > +     help
> > +       DRM panel driver for DP panels and 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
> > diff --git a/drivers/gpu/drm/panel/Makefile
> b/drivers/gpu/drm/panel/Makefile
> > index 8b92921..30311a4 100644
> > --- a/drivers/gpu/drm/panel/Makefile
> > +++ b/drivers/gpu/drm/panel/Makefile
> > @@ -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_EXYNOS_DP) += panel-exynos-dp.o
> > diff --git a/drivers/gpu/drm/panel/panel-exynos-dp.c
> b/drivers/gpu/drm/panel/panel-exynos-dp.c
> > new file mode 100644
> > index 0000000..e85a7b2
> > --- /dev/null
> > +++ b/drivers/gpu/drm/panel/panel-exynos-dp.c
> > @@ -0,0 +1,213 @@
> > +/*
> > + * Exynos DP panel driver
> > + *
> > + * Copyright (c) 2014 Samsung Electronics Co., Ltd
> > + *
> > + * Ajay Kumar <ajaykumar.rs@samsung.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#include <linux/component.h>
> > +#include <linux/gpio.h>
> > +#include <linux/module.h>
> > +#include <linux/of_gpio.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/regulator/consumer.h>
> > +
> > +#include <drm/drmP.h>
> > +#include <drm/drm_crtc.h>
> > +#include <drm/drm_panel.h>
> > +
> > +struct panel_exynos_dp {
> > +     struct drm_panel        base;
> > +     struct regulator        *bck_fet;
> > +     struct regulator        *lcd_fet;
>
> 'bck' means 'backlight'? Then, just use 'backlight_fet'.
>
backlight_fet is more meaningful. Will change it.

Also, I cannot understand the meaning of 'fet'.
> What's the meaning of the 'fet'?
>
> FET is an output from the regulator. On exynos5250-snow board,
FET1 controls power to the backlight unit.
See more here: https://lkml.org/lkml/2014/4/15/618

> +     int                     led_en_gpio;
> > +     int                     lcd_en_gpio;
> > +     int                     power_up_delay;
> > +     int                     power_down_delay;
> > +     bool                    enabled;
> > +};
> > +
> > +static inline struct panel_exynos_dp *to_panel(struct drm_panel *panel)
> > +{
> > +     return container_of(panel, struct panel_exynos_dp, base);
> > +}
> > +
> > +static int panel_exynos_dp_disable(struct drm_panel *panel)
> > +{
> > +     struct panel_exynos_dp *dp_panel = to_panel(panel);
> > +     bool enable_delay = false;
> > +
> > +     if (!dp_panel->enabled)
> > +             return 0;
> > +
> > +     if (gpio_is_valid(dp_panel->led_en_gpio))
> > +             gpio_set_value(dp_panel->led_en_gpio, 0);
> > +
> > +     if (!IS_ERR_OR_NULL(dp_panel->bck_fet))
> > +             regulator_disable(dp_panel->bck_fet);
> > +
> > +     if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
> > +             gpio_set_value(dp_panel->lcd_en_gpio, 0);
> > +             enable_delay = true;
> > +     }
> > +
> > +     if (!IS_ERR_OR_NULL(dp_panel->lcd_fet)) {
> > +             regulator_disable(dp_panel->lcd_fet);
> > +             enable_delay = true;
> > +     }
> > +
> > +     if (enable_delay)
> > +             msleep(dp_panel->power_down_delay);
> > +
> > +     dp_panel->enabled = false;
> > +
> > +     return 0;
> > +}
> > +
> > +static int panel_exynos_dp_pre_enable(struct drm_panel *panel)
>
> panel_exynos_dp_pre_enable() always returns '0'.
> These are two ways. Either one will be better.
> 1. Make return values meaningful. In other words, add the case
>    returning error values.
>
> 2. Change the return type to 'void'
>
> Ok. Will add a check for all failure cases.


> > +{
> > +     struct panel_exynos_dp *dp_panel = to_panel(panel);
> > +     bool enable_delay = false;
> > +
> > +     if (dp_panel->enabled)
> > +             return 0;
> > +
> > +     if (!IS_ERR_OR_NULL(dp_panel->lcd_fet)) {
> > +             if (regulator_enable(dp_panel->lcd_fet))
> > +                     DRM_ERROR("Failed to enable LCD fet\n");
> > +             enable_delay = true;
> > +     }
> > +
> > +     if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
> > +             gpio_set_value(dp_panel->lcd_en_gpio, 1);
> > +             enable_delay = true;
> > +     }
> > +
> > +     if (enable_delay)
> > +             msleep(dp_panel->power_up_delay);
> > +
> > +     return 0;
> > +}
> > +
> > +static int panel_exynos_dp_enable(struct drm_panel *panel)
> > +{
> > +     struct panel_exynos_dp *dp_panel = to_panel(panel);
> > +
> > +     if (dp_panel->enabled)
> > +             return 0;
> > +
> > +     if (!IS_ERR_OR_NULL(dp_panel->bck_fet))
> > +             if (regulator_enable(dp_panel->bck_fet))
> > +                             DRM_ERROR("Failed to enable LED fet\n");
> > +
> > +     if (gpio_is_valid(dp_panel->led_en_gpio))
> > +             gpio_set_value(dp_panel->led_en_gpio, 1);
> > +
> > +     dp_panel->enabled = true;
> > +
> > +     return 0;
> > +}
> > +
> > +static const struct drm_panel_funcs panel_exynos_dp_funcs = {
> > +     .disable = panel_exynos_dp_disable,
> > +     .pre_enable = panel_exynos_dp_pre_enable,
> > +     .enable = panel_exynos_dp_enable,
> > +};
> > +
> > +static int panel_exynos_dp_probe(struct platform_device *pdev)
> > +{
> > +     struct panel_exynos_dp *dp_panel;
> > +     struct device *dev = &pdev->dev;
> > +     int ret;
> > +
> > +     dp_panel = devm_kzalloc(dev, sizeof(*dp_panel), GFP_KERNEL);
> > +     if (!dp_panel)
> > +             return -ENOMEM;
> > +
> > +     dp_panel->enabled = false;
> > +
> > +     dp_panel->lcd_en_gpio = of_get_named_gpio(dev->of_node,
> > +                                             "samsung,lcd-en-gpio", 0);
> > +     dp_panel->led_en_gpio = of_get_named_gpio(dev->of_node,
> > +                                             "samsung,led-en-gpio", 0);
> > +
> > +     of_property_read_u32(dev->of_node, "samsung,power-up-delay",
> > +                                             &dp_panel->power_up_delay);
> > +     of_property_read_u32(dev->of_node, "samsung,power-down-delay",
> > +
> &dp_panel->power_down_delay);
> > +
> > +     dp_panel->lcd_fet = devm_regulator_get(dev, "lcd_vdd");
> > +     if (IS_ERR(dp_panel->lcd_fet))
> > +             return PTR_ERR(dp_panel->lcd_fet);
> > +
> > +     dp_panel->bck_fet = devm_regulator_get(dev, "vcd_led");
> > +     if (IS_ERR(dp_panel->bck_fet))
> > +             return PTR_ERR(dp_panel->bck_fet);
> > +
> > +     if (gpio_is_valid(dp_panel->lcd_en_gpio)) {
> > +             ret = devm_gpio_request_one(dev, dp_panel->lcd_en_gpio,
> > +                                     GPIOF_OUT_INIT_LOW, "lcd_en_gpio");
> > +             if (ret) {
> > +                     DRM_ERROR("failed to get lcd-en gpio [%d]\n", ret);
> > +                     return ret;
> > +             }
> > +     } else {
> > +             dp_panel->lcd_en_gpio = -ENODEV;
> > +     }
> > +
> > +     if (gpio_is_valid(dp_panel->led_en_gpio)) {
> > +             ret = devm_gpio_request_one(dev, dp_panel->led_en_gpio,
> > +                                     GPIOF_OUT_INIT_LOW, "led_en_gpio");
> > +             if (ret) {
> > +                     DRM_ERROR("failed to get led-en gpio [%d]\n", ret);
> > +                     return ret;
> > +             }
> > +     } else {
> > +             dp_panel->led_en_gpio = -ENODEV;
> > +     }
> > +
> > +     drm_panel_init(&dp_panel->base);
> > +     dp_panel->base.dev = dev;
> > +     dp_panel->base.funcs = &panel_exynos_dp_funcs;
> > +
> > +     ret = drm_panel_add(&dp_panel->base);
> > +     if (ret < 0)
> > +             return ret;
> > +
> > +     dev_set_drvdata(dev, dp_panel);
> > +
> > +     return 0;
> > +}
> > +
> > +static int panel_exynos_dp_remove(struct platform_device *pdev)
> > +{
> > +     struct panel_exynos_dp *dp_panel = dev_get_drvdata(&pdev->dev);
> > +
> > +     drm_panel_detach(&dp_panel->base);
> > +     drm_panel_remove(&dp_panel->base);
> > +
> > +     panel_exynos_dp_disable(&dp_panel->base);
> > +
> > +     return 0;
> > +}
> > +
> > +static const struct of_device_id exynos_dp_panel_dt_match[] = {
> > +     { .compatible = "samsung,exynos-dp-panel" },
> > +     {},
> > +};
> > +
> > +struct platform_driver exynos_dp_panel_driver = {
> > +     .driver = {
> > +             .name = "exynos-dp-panel",
> > +             .owner = THIS_MODULE,
> > +             .of_match_table = exynos_dp_panel_dt_match,
> > +     },
> > +     .probe = panel_exynos_dp_probe,
> > +     .remove = panel_exynos_dp_remove,
> > +};
> > --
> > 1.8.1.2
>
>
Thanks and regards,
Ajay Kumar

[-- Attachment #1.2: Type: text/html, Size: 17139 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver
  2014-04-18  8:57   ` Jingoo Han
@ 2014-04-18 19:50     ` Ajay kumar
  2014-04-21  0:29       ` Jingoo Han
  0 siblings, 1 reply; 20+ messages in thread
From: Ajay kumar @ 2014-04-18 19:50 UTC (permalink / raw)
  To: Jingoo Han
  Cc: linux-samsung-soc, Sean Paul, abrestic, sunil joshi, dri-devel,
	a.hajda, Kyungmin Park, treding, Prashanth G, Ajay Kumar,
	Rahul Sharma


[-- Attachment #1.1: Type: text/plain, Size: 2524 bytes --]

Hi Jingoo,


On Fri, Apr 18, 2014 at 2:27 PM, Jingoo Han <jg1.han@samsung.com> wrote:

> On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> >
> > Register exynos_dp_panel before the list of exynos crtcs and
> > connectors are probed.
> >
> > This is needed because exynos_dp_panel should be registered to
> > the drm_panel list via panel-exynos-dp probe, i.e much before
> > exynos_dp_bind calls of_drm_find_panel().
> >
> > Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> > ---
> >  drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++
> >  drivers/gpu/drm/exynos/exynos_drm_drv.h |  1 +
> >  2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > index 1d1c604..47266e7 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > @@ -560,12 +560,23 @@ static int exynos_drm_platform_probe(struct
> platform_device *pdev)
> >               goto err_unregister_ipp;
> >  #endif
> >
> > +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP
> > +     ret = platform_driver_register(&exynos_dp_panel_driver);
> > +     if (ret < 0)
> > +             goto err_unregister_dp_panel;
> > +#endif
> > +
> >       ret = component_master_add(&pdev->dev, &exynos_drm_ops);
> >       if (ret < 0)
> >               DRM_DEBUG_KMS("re-tried by last sub driver probed
> later.\n");
> >
> >       return 0;
> >
> > +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP
> > +     platform_driver_unregister(&exynos_dp_panel_driver);
> > +err_unregister_dp_panel:
> > +#endif
>
> Please add platform_driver_unregister() to exynos_drm_platform_remove(),
>
Right, I have missed adding it in exynos_drm_platform_remove().

as well as exynos_drm_platform_probe().
>
> I have already added for this case!


> Best regards,
> Jingoo Han
>
> > +
> >  #ifdef CONFIG_DRM_EXYNOS_IPP
> >       exynos_platform_device_ipp_unregister();
> >  err_unregister_ipp:
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> > index 257ce09..f606290 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> > @@ -368,4 +368,5 @@ extern struct platform_driver fimc_driver;
> >  extern struct platform_driver rotator_driver;
> >  extern struct platform_driver gsc_driver;
> >  extern struct platform_driver ipp_driver;
> > +extern struct platform_driver exynos_dp_panel_driver;
> >  #endif
> > --
> > 1.8.1.2
>
>
Thanks and Regards,
Ajay Kumar

[-- Attachment #1.2: Type: text/html, Size: 3762 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel
  2014-04-18  9:08   ` Jingoo Han
@ 2014-04-18 19:52     ` Ajay kumar
  0 siblings, 0 replies; 20+ messages in thread
From: Ajay kumar @ 2014-04-18 19:52 UTC (permalink / raw)
  To: Jingoo Han
  Cc: linux-samsung-soc, Sean Paul, abrestic, sunil joshi, dri-devel,
	a.hajda, Kyungmin Park, treding, Prashanth G, Ajay Kumar,
	Rahul Sharma


[-- Attachment #1.1: Type: text/plain, Size: 4696 bytes --]

Hi Jingoo,


On Fri, Apr 18, 2014 at 2:38 PM, Jingoo Han <jg1.han@samsung.com> wrote:

> On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> >
> > This patch attaches the dp connector to exynos_dp_panel, and adds
> > calls to drm_panel functions to control panel power sequence.
> >
> > Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> > ---
> >  drivers/gpu/drm/exynos/Kconfig          |  1 +
> >  drivers/gpu/drm/exynos/exynos_dp_core.c | 19 +++++++++++++++++++
> >  drivers/gpu/drm/exynos/exynos_dp_core.h |  1 +
> >  3 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/exynos/Kconfig
> b/drivers/gpu/drm/exynos/Kconfig
> > index 5bf5bca..56af433 100644
> > --- a/drivers/gpu/drm/exynos/Kconfig
> > +++ b/drivers/gpu/drm/exynos/Kconfig
> > @@ -52,6 +52,7 @@ config DRM_EXYNOS_DP
> >       bool "EXYNOS DRM DP driver support"
> >       depends on DRM_EXYNOS && ARCH_EXYNOS
> >       default DRM_EXYNOS
> > +     select DRM_PANEL
> >       help
> >         This enables support for DP device.
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c
> b/drivers/gpu/drm/exynos/exynos_dp_core.c
> > index 18fd9c5..6beeab6 100644
> > --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> > +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> > @@ -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"
> > @@ -1028,6 +1029,9 @@ static int exynos_dp_create_connector(struct
> exynos_drm_display *display,
> >       drm_sysfs_connector_add(connector);
> >       drm_mode_connector_attach_encoder(connector, encoder);
> >
> > +     if (dp->drm_panel)
> > +             drm_panel_attach(dp->drm_panel, &dp->connector);
> > +
> >       return 0;
> >  }
> >
> > @@ -1062,10 +1066,12 @@ static void exynos_dp_poweron(struct
> exynos_dp_device *dp)
> >       if (dp->dpms_mode == DRM_MODE_DPMS_ON)
> >               return;
> >
> > +     drm_panel_pre_enable(dp->drm_panel);
> >       clk_prepare_enable(dp->clock);
> >       exynos_dp_phy_init(dp);
> >       exynos_dp_init_dp(dp);
> >       enable_irq(dp->irq);
> > +     drm_panel_enable(dp->drm_panel);
> >  }
> >
> >  static void exynos_dp_poweroff(struct exynos_dp_device *dp)
> > @@ -1073,6 +1079,7 @@ static void exynos_dp_poweroff(struct
> exynos_dp_device *dp)
> >       if (dp->dpms_mode != DRM_MODE_DPMS_ON)
> >               return;
> >
> > +     drm_panel_disable(dp->drm_panel);
> >       disable_irq(dp->irq);
> >       flush_work(&dp->hotplug_work);
> >       exynos_dp_phy_exit(dp);
> > @@ -1225,6 +1232,7 @@ static int exynos_dp_dt_parse_panel(struct
> exynos_dp_device *dp)
> >  static int exynos_dp_bind(struct device *dev, struct device *master,
> void *data)
> >  {
> >       struct platform_device *pdev = to_platform_device(dev);
> > +     struct device_node *panel_node;
> >       struct drm_device *drm_dev = data;
> >       struct resource *res;
> >       struct exynos_dp_device *dp;
> > @@ -1299,6 +1307,17 @@ static int exynos_dp_bind(struct device *dev,
> struct device *master, void *data)
> >
> >       INIT_WORK(&dp->hotplug_work, exynos_dp_hotplug);
> >
> > +     panel_node = of_find_compatible_node(NULL, NULL,
> > +                                             "samsung,exynos-dp-panel");
> > +     if (panel_node) {
> > +             dp->drm_panel = of_drm_find_panel(panel_node);
> > +             if (!dp->drm_panel) {
> > +                     of_node_put(panel_node);
> > +                     return -ENODEV;
> > +             }
> > +             of_node_put(panel_node);
> > +     }
>
> The following is simpler.
>
> +       if (panel_node) {
> +               dp->drm_panel = of_drm_find_panel(panel_node);
> +               of_node_put(panel_node);
> +               if (!dp->drm_panel)
> +                       return -ENODEV;
> +       }
>
Right, will change it.


> Best regards,
> Jingoo Han
>
> > +
> >       exynos_dp_phy_init(dp);
> >
> >       exynos_dp_init_dp(dp);
> > diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h
> b/drivers/gpu/drm/exynos/exynos_dp_core.h
> > index 56fa43e..9dc7991 100644
> > --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
> > +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
> > @@ -148,6 +148,7 @@ struct exynos_dp_device {
> >       struct drm_device       *drm_dev;
> >       struct drm_connector    connector;
> >       struct drm_encoder      *encoder;
> > +     struct drm_panel        *drm_panel;
> >       struct clk              *clock;
> >       unsigned int            irq;
> >       void __iomem            *reg_base;
> > --
> > 1.8.1.2
>
>
Thanks and regards,
Ajay Kumar

[-- Attachment #1.2: Type: text/html, Size: 6446 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls
  2014-04-18  9:25   ` Jingoo Han
@ 2014-04-18 19:55     ` Ajay kumar
  0 siblings, 0 replies; 20+ messages in thread
From: Ajay kumar @ 2014-04-18 19:55 UTC (permalink / raw)
  To: Jingoo Han
  Cc: linux-samsung-soc, Sean Paul, abrestic, sunil joshi, dri-devel,
	a.hajda, Kyungmin Park, treding, Prashanth G, Ajay Kumar,
	Rahul Sharma


[-- Attachment #1.1: Type: text/plain, Size: 7081 bytes --]

Hi Jingoo,

On Fri, Apr 18, 2014 at 2:55 PM, Jingoo Han <jg1.han@samsung.com> wrote:

> On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
> >
> > attach ptn3460 connector to drm_panel and support drm_panel routines,
> > if a valid drm_panel object is passed to ptn3460_init.
> >
> > Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> > ---
> >  drivers/gpu/drm/bridge/Kconfig          |  1 +
> >  drivers/gpu/drm/bridge/ptn3460.c        | 17 ++++++++++++++++-
> >  drivers/gpu/drm/exynos/exynos_dp_core.c | 15 +++++++++++----
> >  include/drm/bridge/ptn3460.h            |  6 ++++--
> >  4 files changed, 32 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/Kconfig
> b/drivers/gpu/drm/bridge/Kconfig
> > index 884923f..3bc6845 100644
> > --- a/drivers/gpu/drm/bridge/Kconfig
> > +++ b/drivers/gpu/drm/bridge/Kconfig
> > @@ -2,4 +2,5 @@ config DRM_PTN3460
> >       tristate "PTN3460 DP/LVDS bridge"
> >       depends on DRM
> >       select DRM_KMS_HELPER
> > +     select DRM_PANEL
> >       ---help---
> > diff --git a/drivers/gpu/drm/bridge/ptn3460.c
> b/drivers/gpu/drm/bridge/ptn3460.c
> > index f1d2afc..736c7a8 100644
> > --- a/drivers/gpu/drm/bridge/ptn3460.c
> > +++ b/drivers/gpu/drm/bridge/ptn3460.c
> > @@ -24,6 +24,7 @@
> >  #include "drm_edid.h"
> >  #include "drm_crtc.h"
> >  #include "drm_crtc_helper.h"
> > +#include <drm/drm_panel.h>
>
> Move '<drm/drm_panel.h>' as below.
>
> #include <linux/gpio.h>
> #include <linux/delay.h>
> +#include <drm/drm_panel.h>
>
> #include "drmP.h"
>
>
> >
> >  #include "bridge/ptn3460.h"
> >
> > @@ -38,6 +39,7 @@ struct ptn3460_bridge {
> >       struct i2c_client *client;
> >       struct drm_encoder *encoder;
> >       struct drm_bridge *bridge;
> > +     struct drm_panel *panel;
> >       struct edid *edid;
> >       int gpio_pd_n;
> >       int gpio_rst_n;
> > @@ -126,6 +128,8 @@ static void ptn3460_pre_enable(struct drm_bridge
> *bridge)
> >               gpio_set_value(ptn_bridge->gpio_rst_n, 1);
> >       }
> >
> > +     drm_panel_pre_enable(ptn_bridge->panel);
> > +
> >       /*
> >        * 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 +146,9 @@ static void ptn3460_pre_enable(struct drm_bridge
> *bridge)
> >
> >  static void ptn3460_enable(struct drm_bridge *bridge)
> >  {
> > +     struct ptn3460_bridge *ptn_bridge = bridge->driver_private;
> > +
> > +     drm_panel_enable(ptn_bridge->panel);
> >  }
> >
> >  static void ptn3460_disable(struct drm_bridge *bridge)
> > @@ -153,6 +160,8 @@ static void ptn3460_disable(struct drm_bridge
> *bridge)
> >
> >       ptn_bridge->enabled = false;
> >
> > +     drm_panel_disable(ptn_bridge->panel);
> > +
> >       if (gpio_is_valid(ptn_bridge->gpio_rst_n))
> >               gpio_set_value(ptn_bridge->gpio_rst_n, 1);
> >
> > @@ -265,7 +274,8 @@ struct drm_connector_funcs ptn3460_connector_funcs =
> {
> >  };
> >
> >  int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
> > -             struct i2c_client *client, struct device_node *node)
> > +             struct i2c_client *client, struct device_node *node,
> > +             struct drm_panel *panel)
> >  {
> >       int ret;
> >       struct drm_bridge *bridge;
> > @@ -324,6 +334,11 @@ int ptn3460_init(struct drm_device *dev, struct
> drm_encoder *encoder,
> >               goto err;
> >       }
> >
> > +     if (panel) {
> > +             ptn_bridge->panel = panel;
> > +             drm_panel_attach(ptn_bridge->panel,
> &ptn_bridge->connector);
> > +     }
> > +
> >       bridge->driver_private = ptn_bridge;
> >       encoder->bridge = bridge;
> >       ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD;
> > diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c
> b/drivers/gpu/drm/exynos/exynos_dp_core.c
> > index 6beeab6..7f550b6 100644
> > --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> > +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> > @@ -989,13 +989,14 @@ static bool find_bridge(const char *compat, struct
> bridge_init *bridge)
> >
> >  /* returns the number of bridges attached */
> >  static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
> > -             struct drm_encoder *encoder)
> > +             struct drm_encoder *encoder, struct drm_panel *panel)
> >  {
> >       struct bridge_init bridge;
> >       int ret;
> >
> >       if (find_bridge("nxp,ptn3460", &bridge)) {
> > -             ret = ptn3460_init(dev, encoder, bridge.client,
> bridge.node);
> > +             ret = ptn3460_init(dev, encoder, bridge.client,
> bridge.node,
> > +
> panel);
>
> 'panel' is too far. Please fix it as below.
>
>         if (find_bridge("nxp,ptn3460", &bridge)) {
>                 ret = ptn3460_init(dev, encoder, bridge.client,
> bridge.node,
>                                    panel);
>
> Ok.

>
> >               if (!ret)
> >                       return 1;
> >       }
> > @@ -1012,9 +1013,15 @@ 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);
> > -     if (ret)
> > +     ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder,
> dp->drm_panel);
> > +     if (ret) {
> > +             /* Also set "dp->drm_panel = NULL" so that we don't end up
> > +              * controlling panel power both in exynos_dp and bridge
> > +              * DPMS routines.
> > +              */
>
> Please fix it as below.
>
>  +              /*
>  +               * Also set "dp->drm_panel = NULL" so that we don't end up
>  +               * controlling panel power both in exynos_dp and bridge
>  +               * DPMS routines.
>  +               */
>
> Right. I used wrong style for commenting!


> Best regards,
> Jingoo Han
>
> > +             dp->drm_panel = NULL;
> >               return 0;
> > +     }
> >
> >       connector->polled = DRM_CONNECTOR_POLL_HPD;
> >
> > diff --git a/include/drm/bridge/ptn3460.h b/include/drm/bridge/ptn3460.h
> > index ff62344..570cebb 100644
> > --- a/include/drm/bridge/ptn3460.h
> > +++ b/include/drm/bridge/ptn3460.h
> > @@ -18,16 +18,18 @@ struct drm_device;
> >  struct drm_encoder;
> >  struct i2c_client;
> >  struct device_node;
> > +struct drm_panel;
> >
> >  #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 i2c_client *client, struct device_node *node,
> > +             struct drm_panel *panel);
> >  #else
> >
> >  static inline int ptn3460_init(struct drm_device *dev,
> >               struct drm_encoder *encoder, struct i2c_client *client,
> > -             struct device_node *node)
> > +             struct device_node *node, struct drm_panel *panel)
> >  {
> >       return 0;
> >  }
> > --
> > 1.8.1.2
>
>
Thanks and regards,
Ajay Kumar

[-- Attachment #1.2: Type: text/html, Size: 9746 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver
  2014-04-18 19:50     ` Ajay kumar
@ 2014-04-21  0:29       ` Jingoo Han
  0 siblings, 0 replies; 20+ messages in thread
From: Jingoo Han @ 2014-04-21  0:29 UTC (permalink / raw)
  To: 'Ajay kumar'
  Cc: linux-samsung-soc, 'Sean Paul',
	abrestic, 'sunil joshi',
	dri-devel, a.hajda, 'Kyungmin Park',
	treding, 'Prashanth G', 'Ajay Kumar',
	'Rahul Sharma'

On Saturday, April 19, 2014 4:51 AM, Ajay Kumar wrote:
> On Fri, Apr 18, 2014 at 2:27 PM, Jingoo Han <jg1.han@samsung.com> wrote:
> > On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:

[.....]

> > > +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP
> > > +     platform_driver_unregister(&exynos_dp_panel_driver);
> > > +err_unregister_dp_panel:
> > > +#endif
> > Please add platform_driver_unregister() to exynos_drm_platform_remove(),
> Right, I have missed adding it in exynos_drm_platform_remove().
> > as well as exynos_drm_platform_probe().
> I have already added for this case!

What I wanted to say is that
"Please add platform_driver_unregister() to exynos_drm_platform_remove(),
as you added it to exynos_drm_platform_probe()."

Best regards,
Jingoo Han

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels
  2014-04-18 19:42     ` Ajay kumar
@ 2014-04-21  0:34       ` Jingoo Han
  0 siblings, 0 replies; 20+ messages in thread
From: Jingoo Han @ 2014-04-21  0:34 UTC (permalink / raw)
  To: 'Ajay kumar'
  Cc: linux-samsung-soc, 'Sean Paul',
	abrestic, 'sunil joshi',
	dri-devel, a.hajda, 'Kyungmin Park',
	treding, 'Prashanth G', 'Ajay Kumar',
	'Rahul Sharma'

On Saturday, April 19, 2014 4:43 AM, Ajay kumar wrote:
> On Fri, Apr 18, 2014 at 2:17 PM, Jingoo Han <jg1.han@samsung.com> wrote:
> > On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:

[.....]

> > > +struct panel_exynos_dp {
> > > +     struct drm_panel        base;
> > > +     struct regulator        *bck_fet;
> > > +     struct regulator        *lcd_fet;
> > 'bck' means 'backlight'? Then, just use 'backlight_fet'.
> backlight_fet is more meaningful. Will change it.
> > Also, I cannot understand the meaning of 'fet'.
> > What's the meaning of the 'fet'?
>
> FET is an output from the regulator. On exynos5250-snow board,
> FET1 controls power to the backlight unit.
> See more here: https://lkml.org/lkml/2014/4/15/618 

OK, I see.

PS: Please change your mail from 'html' mode to 'text' mode.

Best regards,
Jingoo Han

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-04-21  0:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-16 14:32 [PATCH 0/7] drm: exynos: few patches to enhance bridge chip support Ajay Kumar
2014-04-16 14:33 ` [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO Ajay Kumar
2014-04-18  8:23   ` Jingoo Han
2014-04-18 19:33     ` Ajay kumar
2014-04-16 14:33 ` [PATCH 2/7] drm/panel: add pre_enable routine to drm panel Ajay Kumar
2014-04-16 14:33 ` [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels Ajay Kumar
2014-04-18  8:47   ` Jingoo Han
2014-04-18 19:42     ` Ajay kumar
2014-04-21  0:34       ` Jingoo Han
2014-04-16 14:33 ` [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver Ajay Kumar
2014-04-18  8:57   ` Jingoo Han
2014-04-18 19:50     ` Ajay kumar
2014-04-21  0:29       ` Jingoo Han
2014-04-16 14:33 ` [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel Ajay Kumar
2014-04-18  9:08   ` Jingoo Han
2014-04-18 19:52     ` Ajay kumar
2014-04-16 14:33 ` [PATCH 6/7] drm/bridge: ptn3460: enable polling based detection Ajay Kumar
2014-04-16 14:33 ` [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls Ajay Kumar
2014-04-18  9:25   ` Jingoo Han
2014-04-18 19:55     ` Ajay kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.