linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <architt@codeaurora.org>
To: Rob Clark <robdclark@gmail.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/msm/hdmi: Prevent gpio_free related kernel warnings
Date: Wed, 20 Apr 2016 11:33:20 +0530	[thread overview]
Message-ID: <57171BA8.10302@codeaurora.org> (raw)
In-Reply-To: <CAF6AEGsNdUP67S7HjiKES-5LZZ_0ntejWMgKgBYDcypTuEhxiw@mail.gmail.com>

Hi Bjorn, Rob,

On 04/19/2016 11:14 PM, Rob Clark wrote:
>
> On Apr 19, 2016 11:50, "Bjorn Andersson" <bjorn.andersson@linaro.org
> <mailto:bjorn.andersson@linaro.org>> wrote:
>  >
>  > On Tue 19 Apr 03:56 PDT 2016, Archit Taneja wrote:
>  >
>  > > Calling the legacy gpio_free on an invalid GPIO (a GPIO numbered -1)
>  > > results in kernel warnings. This causes a lot of backtraces when
>  > > we try to unload the drm/msm module.
>  > >
>  > > Call gpio_free only on valid GPIOs.
>  > >
>  > > Signed-off-by: Archit Taneja <architt@codeaurora.org
> <mailto:architt@codeaurora.org>>
>  > > ---
>  > >  drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 19 ++++++++++++-------
>  > >  1 file changed, 12 insertions(+), 7 deletions(-)
>  > >
>  > > diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
> b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
>  > > index 26129bf..ce86117 100644
>  > > --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
>  > > +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
>  > > @@ -112,13 +112,16 @@ static int gpio_config(struct hdmi *hdmi,
> bool on)
>  > >               for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) {
>  > >                       struct hdmi_gpio_data gpio = config->gpios[i];
>  > >
>  > > -                     if (gpio.output) {
>  > > -                             int value = gpio.value ? 0 : 1;
>  > > +                     if (gpio.num != -1) {
>  > > +                             if (gpio.output) {
>  > > +                                     int value = gpio.value ? 0 : 1;
>  > >
>  > > -                             gpio_set_value_cansleep(gpio.num, value);
>  > > -                     }
>  > > +                                     gpio_set_value_cansleep(gpio.num,
>  > > +                                                             value);
>  > > +                             }
>  > >
>  > > -                     gpio_free(gpio.num);
>  > > +                             gpio_free(gpio.num);
>  > > +                     }
>  > >               };
>  > >
>  > >               DBG("gpio off");
>  > > @@ -126,8 +129,10 @@ static int gpio_config(struct hdmi *hdmi, bool on)
>  > >
>  > >       return 0;
>  > >  err:
>  > > -     while (i--)
>  > > -             gpio_free(config->gpios[i].num);
>  > > +     while (i--) {
>  > > +             if (config->gpios[i].num != -1)
>  > > +                     gpio_free(config->gpios[i].num);
>  > > +     }
>  > >
>  > >       return ret;
>  > >  }
>  >
>  > The patch in itself looks good, but the bigger picture does not.
>  >
>  > The ddc and hdp should be muxed to the hdmi block, so they should not
>  > operated as gpios.

I agree on the DDC part. I am not sure why they are passed as GPIOs to
the driver. For boards that do this (i.e, 1fc6410), the pinctrl tlmm
node sets the GPIOs function as "hdmi". Does that mean the the
gpio_set_value() in the driver are simply ignored?

I'll test and drop these if things work fine without them.

>  >
>  > The mux seems more of a gpio so it should be made more explicit - i.e.
>  > actually support muxing (if that's needed) rather than just setting hard
>  > coded values.

I have to study the schematics a bit on what the MUX actually does.

>
> Note that at least on some devices, hpd was unreliable without using a
> combination of gpio and denounced hpd signal from HDMI block...

Hmm, one thing I don't get is that the pinctrl DT node for the HPD pin
explicitly assigns its function as "hdmi". If that's the case, how does
it even work as a gpio?

>
> Not sure what sort of MUX it is but it seemed possible (and necessary)
> to use both at same time..
>
> Please be sure to test lots of devices and monitors if you are going to
> change this ;-)

For sure!

>
> BR,
> -R
>
>  > And you should not gpio_request/free the gpio upon every usage, request
>  > it during "probe time" and release it during "remove".

The hpd_enable/disable functions actually get called only during probe
and remove. We don't enable/disable HPD sensing at other points in the
driver. So, I guess it should be okay for now.

Thanks,
Archit

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum, hosted by The Linux Foundation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-04-20  6:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 10:56 [PATCH 0/3] drm/msm: Remove drm_driver load/unload ops Archit Taneja
2016-04-19 10:56 ` [PATCH 1/3] drm/msm/hdmi: Prevent gpio_free related kernel warnings Archit Taneja
2016-04-19 15:49   ` Bjorn Andersson
     [not found]     ` <CAF6AEGv0uJhvkhsOWeZvZ9iXZO3eMdCnr6PCq5bpx0bNTJHj9g@mail.gmail.com>
     [not found]       ` <CAF6AEGuHq96komyBscvB6jfVSRUn0djp_W6Ui_0xi7VEE2mGsw@mail.gmail.com>
     [not found]         ` <CAF6AEGuMTZ0dr26oC4v2whFKoFY3Wc4SY=Ryst7QCoD-Ko2_AQ@mail.gmail.com>
     [not found]           ` <CAF6AEGsTPw8GPqfUuzVPjKoGM0FTq=XTtS0mEk5BxwvRUdbVfw@mail.gmail.com>
     [not found]             ` <CAF6AEGvTp2xEo6H2P-VOoFrg5aSd3T7eEbd6vDm_kMm8-FkfpQ@mail.gmail.com>
     [not found]               ` <CAF6AEGsX7F4Q=8__Y-SP_gs6e6CfX6JuocK5jVKJO0CkE10_Hw@mail.gmail.com>
2016-04-19 17:44                 ` Rob Clark
2016-04-19 18:25                   ` Bjorn Andersson
2016-04-20  6:03                   ` Archit Taneja [this message]
2016-04-19 10:56 ` [PATCH 2/3] drm/msm: Centralize connector registration/unregistration Archit Taneja
2016-04-19 12:10   ` Daniel Vetter
2016-04-20  4:40     ` Archit Taneja
2016-04-19 10:56 ` [PATCH 3/3] drm/msm: Drop load/unload drm_driver ops Archit Taneja
2016-04-25 10:16 ` [PATCH v2 0/3] drm/msm: Remove drm_driver load/unload ops Archit Taneja
2016-04-25 10:16   ` [PATCH v2 1/3] drm/msm/hdmi: Prevent gpio_free related kernel warnings Archit Taneja
2016-04-25 17:48     ` twp
2016-04-27  4:55       ` Archit Taneja
2016-04-25 10:16   ` [PATCH v2 2/3] drm/msm: Centralize connector registration/unregistration Archit Taneja
2016-04-25 10:16   ` [PATCH v2 3/3] drm/msm: Drop load/unload drm_driver ops Archit Taneja
2016-05-02  5:35   ` [PATCH v3 0/3] drm/msm: Remove drm_driver load/unload ops Archit Taneja
2016-05-02  5:35     ` [PATCH v3 1/3] drm/msm/hdmi: Prevent gpio_free related kernel warnings Archit Taneja
2016-05-02  5:35     ` [PATCH v3 2/3] drm/msm: Centralize connector registration/unregistration Archit Taneja
2016-05-02  5:35     ` [PATCH v3 3/3] drm/msm: Drop load/unload drm_driver ops Archit Taneja

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=57171BA8.10302@codeaurora.org \
    --to=architt@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=robdclark@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).