The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: "Poddar, Sourav" <sourav.poddar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>,
	"DebBarma, Tarun Kanti" <tarun.kanti@ti.com>,
	lo <linux-omap@vger.kernel.org>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Benoit Cousson <b-cousson@ti.com>,
	linux-kernel@vger.kernel.org, Felipe Balbi <balbi@ti.com>
Subject: Re: [GPIO] Crashed when not using
Date: Tue, 31 Jul 2012 09:52:26 +0300	[thread overview]
Message-ID: <20120731065224.GE6004@arwen.pp.htv.fi> (raw)
In-Reply-To: <CAKdam57xtXnKAgvneqATSTr0ng978T5HbkTB0T3sYp96N=Qfww@mail.gmail.com>

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

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 ?

-- 
balbi

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

  reply	other threads:[~2012-07-31  6:55 UTC|newest]

Thread overview: 12+ 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 22:37       ` Shilimkar, Santosh
2012-07-31  4:53       ` Poddar, Sourav
2012-07-31  6:52         ` Felipe Balbi [this message]
2012-07-31 12:32           ` Shilimkar, Santosh
2012-07-31 12:32             ` Felipe Balbi
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=20120731065224.GE6004@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox