public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Valentine <valentine.barshak@cogentembedded.com>
To: Lars-Peter Clausen <lars@metafoo.de>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Hans Verkuil <hansverk@cisco.com>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Simon Horman <horms@verge.net.au>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [PATCH V2] media: i2c: Add ADV761X support
Date: Fri, 29 Nov 2013 16:14:39 +0400	[thread overview]
Message-ID: <5298852F.6030303@cogentembedded.com> (raw)
In-Reply-To: <52987058.80700@metafoo.de>

On 11/29/2013 02:45 PM, Lars-Peter Clausen wrote:
> On 11/29/2013 11:37 AM, Linus Walleij wrote:
>> On Wed, Nov 27, 2013 at 5:40 PM, Laurent Pinchart
>> <laurent.pinchart@ideasonboard.com> wrote:
>>> (CC'ing Linus Walleij, Wolfram Sang and LAKML)
>>> On Wednesday 27 November 2013 16:32:01 Valentine wrote:
>>>> On 11/27/2013 04:14 PM, Hans Verkuil wrote:
>>
>>>>> Yes, of course. Although the adv7604 has two interrupt lines, so if you
>>>>> would want to use the second, then that would still have to be specified
>>>>> through the platform data.
>>>>
>>>> In this case the GPIO should be configured as interrupt source in the
>>>> platform code. But this doesn't seem to work with R-Car GPIO since it is
>>>> initialized later, and the gpio_to_irq function returns an error.
>>>> The simplest way seemed to use a GPIO number in the platform data
>>>> to have the adv driver configure the pin and request the IRQ.
>>>> I'm not sure how to easily defer I2C board info IRQ setup (and
>>>> camera/subdevice probing) until GPIO driver is ready.
>>>
>>> Good question. This looks like a core problem to me, not specific to the
>>> adv761x driver. Linus, Wolfram, do you have a comment on that ?
>>
>> So we recently has a large-ish discussion involving me, Stephen
>> Warren and Jean-Christophe, leading to the conclusion that the
>> gpio_chip and irq_chip abstractions are orthogonal, and you should
>> be able to request a GPIO or IRQ without interacting with the other
>> subsystem.
>>
>> Specifically you should be able to request an IRQ from the irq_chip
>> portions of the driver without first requesting the GPIO line.
>>
>> Some drivers already support this.
>>
>> We added an internal API to the gpiolib so that the lib, *internally*
>> can be made aware that a certain GPIO line is used for IRQs,
>> see commit d468bf9ecaabd3bf3a6134e5a369ced82b1d1ca1
>> "gpio: add API to be strict about GPIO IRQ usage"
>>
>> So I guess the answer to the question is something like, fix
>> the GPIO driver to stop requiring the GPIO lines to be requested
>> and configured before being used as IRQs, delete that code,
>> and while you're at it add a call to gpiod_lock_as_irq()
>> to your GPIO driver in the right spot: examples are on the
>> mailing list and my mark-irqs branch in the GPIO tree.
>
> As far as I understand it this already works more or less with the driver.
> The problem is that the IRQ numbers are dynamically allocated, while the
> GPIO numbers apparently are not. So the board code knows the the GPIO number
> at compile time and can pass this to the diver which then does a gpio_to_irq
> to lookup the IRQ number.

This is correct.

> This of course isn't really a problem with
> devicetree, but only with platform board code.

I'm not sure what's the difference here and why it is not a problem with devicetree?

The other problem with R-Car GPIO driver is that it apparently does not support level IRQs.

>
> - Lars
>

Thanks,
Val.

  reply	other threads:[~2013-11-29 12:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-15 12:54 [PATCH V2] media: i2c: Add ADV761X support Valentine Barshak
2013-11-19  9:50 ` Hans Verkuil
2013-11-20 10:14   ` Valentine
2013-11-20 11:19     ` Hans Verkuil
2013-11-20 12:24       ` Valentine
2013-11-20 15:42         ` Hans Verkuil
2013-11-20 15:53           ` Valentine
2013-11-26 21:28             ` Valentine
2013-11-26 21:43               ` Lars-Peter Clausen
2013-11-26 21:57                 ` Valentine
2013-11-26 22:02                   ` Lars-Peter Clausen
2013-11-26 22:00                 ` Laurent Pinchart
2013-11-26 22:03                   ` Lars-Peter Clausen
2013-11-26 22:03                     ` Laurent Pinchart
2013-11-26 22:06                       ` Lars-Peter Clausen
2013-11-29 20:07                         ` Lars-Peter Clausen
2013-11-27  8:21               ` Hans Verkuil
2013-11-27  9:59                 ` Lars-Peter Clausen
2013-11-27 11:26                   ` Hans Verkuil
2013-11-27 10:29                 ` Valentine
2013-11-27 11:18                   ` Hans Verkuil
2013-11-27 11:39                 ` Laurent Pinchart
2013-11-27 12:14                   ` Hans Verkuil
2013-11-27 12:32                     ` Valentine
2013-11-27 13:07                       ` Lars-Peter Clausen
2013-11-27 13:46                         ` Valentine
2013-11-27 16:40                       ` Laurent Pinchart
2013-11-27 16:48                         ` Lars-Peter Clausen
2013-11-29 10:37                         ` Linus Walleij
2013-11-29 10:45                           ` Lars-Peter Clausen
2013-11-29 12:14                             ` Valentine [this message]
2013-11-29 13:46                               ` Linus Walleij
2013-11-29 13:42                             ` Linus Walleij
2013-11-29 13:48                               ` Lars-Peter Clausen
2013-11-29 19:52                                 ` Linus Walleij
2013-11-29 20:03                                   ` Laurent Pinchart
2013-11-29 20:05                                   ` Lars-Peter Clausen
2013-11-29 20:09                                     ` Linus Walleij
2013-11-27 14:50                     ` Lars-Peter Clausen
2013-11-27 16:29                       ` Laurent Pinchart
2013-11-27 16:32                     ` Laurent Pinchart

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=5298852F.6030303@cogentembedded.com \
    --to=valentine.barshak@cogentembedded.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=hans.verkuil@cisco.com \
    --cc=hansverk@cisco.com \
    --cc=horms@verge.net.au \
    --cc=hverkuil@xs4all.nl \
    --cc=lars@metafoo.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=swarren@wwwdotorg.org \
    --cc=wsa@the-dreams.de \
    /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