All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ajay kumar <ajaynumb@gmail.com>
To: Jingoo Han <jg1.han@samsung.com>
Cc: "linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	Sean Paul <seanpaul@google.com>,
	abrestic@chromium.org, sunil joshi <joshi@samsung.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	a.hajda@samsung.com, Kyungmin Park <kyungmin.park@samsung.com>,
	treding@nvidia.com, Prashanth G <prashanth.g@samsung.com>,
	Ajay Kumar <ajaykumar.rs@samsung.com>,
	Rahul Sharma <rahul.sharma@samsung.com>
Subject: Re: [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO
Date: Sat, 19 Apr 2014 01:03:07 +0530	[thread overview]
Message-ID: <CAEC9eQO8+-et=-OdwV-1fqO=RuCx-fEPa6XgRA5K_duJHvjGtw@mail.gmail.com> (raw)
In-Reply-To: <000001cf5adf$87cf7280$976e5780$%han@samsung.com>


[-- 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

  reply	other threads:[~2014-04-18 19:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEC9eQO8+-et=-OdwV-1fqO=RuCx-fEPa6XgRA5K_duJHvjGtw@mail.gmail.com' \
    --to=ajaynumb@gmail.com \
    --cc=a.hajda@samsung.com \
    --cc=abrestic@chromium.org \
    --cc=ajaykumar.rs@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jg1.han@samsung.com \
    --cc=joshi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=prashanth.g@samsung.com \
    --cc=rahul.sharma@samsung.com \
    --cc=seanpaul@google.com \
    --cc=treding@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.