All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: "Shilimkar, Santosh" <santosh.shilimkar@ti.com>
Cc: balbi@ti.com, "Poddar, Sourav" <sourav.poddar@ti.com>,
	Kevin Hilman <khilman@ti.com>,
	"DebBarma, Tarun Kanti" <tarun.kanti@ti.com>,
	lo <linux-omap@vger.kernel.org>,
	Benoit Cousson <b-cousson@ti.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [GPIO] Crashed when not using
Date: Tue, 31 Jul 2012 15:32:11 +0300	[thread overview]
Message-ID: <20120731123209.GA8024@arwen.pp.htv.fi> (raw)
In-Reply-To: <CAMQu2gxXX+4gtKVnAMMK4qr9ihJuP-OwjOYgr=6VrGZ2DWSf2A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4442 bytes --]

Hi,

On Tue, Jul 31, 2012 at 02:32:43PM +0200, Shilimkar, Santosh wrote:
> On Tue, Jul 31, 2012 at 8:52 AM, Felipe Balbi <balbi@ti.com> wrote:
> >
> > Hi,
> >
> > On Tue, Jul 31, 2012 at 10:23:16AM +0530, Poddar, Sourav wrote:
> > > >>>> The device tree data for acquiring the above GPIO interrupt line
> > > >>>> looks
> > > >>>> like this.
> > > >>>>
> > > >>>> +++ linux-omap-storage/arch/arm/boot/dts/omap5-evm.dts  2012-07-30
> > > >>>> 14:11:08.931694001 +0530
> > > >>>> @@ -42,7 +42,8 @@
> > > >>>>         tsl2771@39 {
> > > >>>>                 compatible = "taos,tsl2771";
> > > >>>>                 reg = <0x39>;
> > > >>>> +                interrupt-parent = <&gpio5>;
> > > >>>> +                interrupts = <21>; /* gpio line 149 */
> > > >>>>         };
> > > >>>>  };
> > > >>>>
> > > >>>> Note: using "gpio_request_one" in the driver solves the issue.
> > > >>>> Is using this api in the driver required?
> > > >>>> Any pointer on the above crash?
> > > >>>
> > > >> Hi Tarun,
> > > >>> Any user/client driver of GPIO is supposed to go through
> > > >>> gpio_request() API so that module clock
> > > >>> is enabled correctly. Overriding of APIs would put the power
> > > >>> management state machine in jeopardy.
> > > >>> --
> > > >> I tried putting "pm_runtime_get_sync" in gpio_irq_type api where the
> > > >> kernel
> > > >> is crashing and the crash is no longer observed. So indeed, its about
> > > >> enabling clocks.
> > > >>
> > > >> One doubt: Can't we put runtime apis in "gpio_irq_type" and eliminate
> > > >> the use of
> > > >> "gpio_request_one"??
> > > >
> > > > No.
> > > >
> > > > You must use the GPIO requiest/free APIs to tell the GPIO core that
> > > > the GPIO line is in use.
> > > >
> > > Thanks for this confirmation.
> > > > Why do you want to avoid using gpio_request/gpio_free?
> > > >
> > > I was assuming that DT based gpio IRQ registration will automatically
> > > take care of
> > > the above APIs. But since that is not the case(as mentioned by
> > > santosh),  we need to use the
> > > gpio_request/free apis.
> >
> > Hang on for a while, let's try to get to the bottom of this debate first
> > ;-)
> >
> > We have a canonical way of passing IRQ numbers to drivers through DT and
> > that is the "interrupts" attribute. It shouldn't matter if that IRQ pin
> > is connected to a real IRQ line or through a GPIO controller. In both
> > cases we should use the "interrupts" attribute.
> >
> > If DT core doesn't allocate the GPIO for us then how does this work:
> >
> > (omap4-sdp.dts)
> >
> > 127 &mcspi1 {
> > 128         eth@0 {
> > 129                 compatible = "ks8851";
> > 130                 spi-max-frequency = <24000000>;
> > 131                 reg = <0>;
> > 132                 interrupt-parent = <&gpio2>;
> > 133                 interrupts = <2>; /* gpio line 34 */
> > 134                 vdd-supply = <&vdd_eth>;
> > 135         };
> > 136 };
> >
> >
> > There's no gpio request on the driver:
> >
> > $ git grep -e gpio_request drivers/net/ethernet/micrel/ks8851.c
> > $
> >
> > Since Benoit was the one who added that to the dts file (commit
> > e7c64db9), I assume he tested his patch before posting, so again I ask -
> > How does that work and why doesn't this work for Sourav's tsl2771
> > controller ?
> >
> > This is either a regression on drivers/of, or commit e7c64db9 is also
> > broken...
> >
> > Benoit, do you know how should this work ?
> >
> I had a discussion with Benoit on this. In fact there is a way to actually
> trigger the GPIO request.
> 
> > 132                 interrupt-parent = <&gpio2>;
> > 133                 interrupts = <2>; /* gpio line 34 */
> 
> As above you can see, GPIO2 bank and 2nd line.
> And then it will make use of gpio_irq chip properties
> to probe the GPIO line.
> 
> Saurabh can try this out for his use case.

Isn't this exactly what Sourav has ?

> > > >>>> +++ linux-omap-storage/arch/arm/boot/dts/omap5-evm.dts  2012-07-30
> > > >>>> 14:11:08.931694001 +0530
> > > >>>> @@ -42,7 +42,8 @@
> > > >>>>         tsl2771@39 {
> > > >>>>                 compatible = "taos,tsl2771";
> > > >>>>                 reg = <0x39>;
> > > >>>> +                interrupt-parent = <&gpio5>;
> > > >>>> +                interrupts = <21>; /* gpio line 149 */
> > > >>>>         };
> > > >>>>  };

???

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-07-31 12:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30  8:43 [GPIO] Crashed when not using Poddar, Sourav
2012-07-30  9:34 ` DebBarma, Tarun Kanti
2012-07-30 11:15   ` Poddar, Sourav
2012-07-30 20:36     ` Kevin Hilman
2012-07-30 20:36       ` Kevin Hilman
2012-07-30 22:37       ` Shilimkar, Santosh
2012-07-31  4:53       ` Poddar, Sourav
2012-07-31  6:52         ` Felipe Balbi
2012-07-31 12:32           ` Shilimkar, Santosh
2012-07-31 12:32             ` Felipe Balbi [this message]
2012-07-31 12:56             ` Poddar, Sourav
2012-08-06  5:46               ` Shilimkar, Santosh
2012-07-31  6:43       ` Felipe Balbi

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=20120731123209.GA8024@arwen.pp.htv.fi \
    --to=balbi@ti.com \
    --cc=b-cousson@ti.com \
    --cc=khilman@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=santosh.shilimkar@ti.com \
    --cc=sourav.poddar@ti.com \
    --cc=tarun.kanti@ti.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.