[PATCH V2 1/9] drm/exynos: dp: support hotplug detection via GPIO

2014-05-09 Thread Jingoo Han
On Tuesday, April 22, 2014 4:14 PM, Jingoo Han wrote:
> On Tuesday, April 22, 2014 7:39 AM, Ajay Kumar wrote:
> >
> > From: Andrew Bresticker 
> >
> > 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 
> > Signed-off-by: Rahul Sharma 
> > Signed-off-by: Ajay Kumar 
> 
> Acked-by: Jingoo Han 

Hi Inki Dae,

Actually, this patch is NOT related to other patches for
bridge chip support. So, would you apply this patch into
your exynos drm git with my Acked-by?

Best regards,
Jingoo Han


> 
> > ---
> > Changes since V1:
> > Address reiew comments from Jingoo Han
> >
> >  .../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 |   44 
> > ++--
> >  4 files changed, 66 insertions(+), 15 deletions(-)
> 
> [.]



[PATCH V2 1/9] drm/exynos: dp: support hotplug detection via GPIO

2014-04-22 Thread Jingoo Han
On Tuesday, April 22, 2014 7:39 AM, Ajay Kumar wrote:
> 
> From: Andrew Bresticker 
> 
> 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 
> Signed-off-by: Rahul Sharma 
> Signed-off-by: Ajay Kumar 

Acked-by: Jingoo Han 

Best regards,
Jingoo Han

> ---
> Changes since V1:
>   Address reiew comments from Jingoo Han
> 
>  .../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 |   44 
> ++--
>  4 files changed, 66 insertions(+), 15 deletions(-)

[.]



[PATCH V2 1/9] drm/exynos: dp: support hotplug detection via GPIO

2014-04-22 Thread Ajay Kumar
From: Andrew Bresticker 

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 
Signed-off-by: Rahul Sharma 
Signed-off-by: Ajay Kumar 
---
Changes since V1:
Address reiew comments from Jingoo Han

 .../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 |   44 ++--
 4 files changed, 66 insertions(+), 15 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 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -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..79291a2 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_reg.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_reg.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "exynos_dp_core.h"
 #include "exynos_dp_reg.h"
@@ -326,6 +327,9 @@ void exynos_dp_clear_hotplug_