From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hansverk@cisco.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
Valentine <valentine.barshak@cogentembedded.com>,
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>,
Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH V2] media: i2c: Add ADV761X support
Date: Wed, 27 Nov 2013 17:32:36 +0100 [thread overview]
Message-ID: <3492580.V1k5XZPn5x@avalon> (raw)
In-Reply-To: <5295E231.9030200@cisco.com>
Hi Hans,
On Wednesday 27 November 2013 13:14:41 Hans Verkuil wrote:
> On 11/27/13 12:39, Laurent Pinchart wrote:
> > On Wednesday 27 November 2013 09:21:22 Hans Verkuil wrote:
> >> On 11/26/2013 10:28 PM, Valentine wrote:
> >>> On 11/20/2013 07:53 PM, Valentine wrote:
> >>>> On 11/20/2013 07:42 PM, Hans Verkuil wrote:
> >>>>> Hi Valentine,
> >>>
> >>> Hi Hans,
> >>>
> >>>>> Did you ever look at this adv7611 driver:
> >>>>>
> >>>>> https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e
> >>>>> 4afa42af2daa12
> >>>>
> >>>> No, I missed that one somehow, although I did search for the
> >>>> adv7611/7612 before implementing this one. I'm going to look closer at
> >>>> the patch and test it.
> >>>
> >>> I've tried the patch and I doubt that it was ever tested on adv7611.
> >>> I haven't been able to make it work so far. Here's the description of
> >>> some of the issues I've encountered.
> >>>
> >>> The patch does not apply cleanly so I had to make small adjustments just
> >>> to make it apply without changing the functionality.
> >>>
> >>> First of all the driver (adv7604_dummy_client function) does not set
> >>> default I2C slave addresses in the I/O map in case they are not set in
> >>> the platform data.
> >>> This is not needed for 7604, since the default addresses are already set
> >>> in the I/O map after chip reset. However, the map is zeroed on 7611/7612
> >>> after power up, and we always have to set it manually.
> >>
> >> So, the platform data for the 7611/2 should always give i2c addresses.
> >> That seems reasonable.
> >>
> >>> I had to implement the IRQ handler since the soc_camera model does not
> >>> use interrupt_service_routine subdevice callback and R-Car VIN knows
> >>> nothing about adv7612 interrupt routed to a GPIO pin. So I had to
> >>> schedule a workqueue and call adv7604_isr from there in case an
> >>> interrupt happens.
> >>
> >> For our systems the adv7604 interrupts is not always hooked up to a gpio
> >> irq, instead a register has to be read to figure out which device
> >> actually produced the irq.
> >
> > Where is that register located ? Shouldn't it be modeled as an interrupt
> > controller ?
>
> It's a PCIe interrupt whose handler needs to read several FPGA registers
> in order to figure out which interrupt was actually triggered. I don't
> know enough about interrupt controller to understand whether it can be
> modeled as a 'standard' interrupt.
I've replied to this separately.
> >> So I want to keep the interrupt_service_routine(). However, adding a gpio
> >> field to the platform_data that, if set, will tell the driver to request
> >> an irq and setup a workqueue that calls interrupt_service_routine() would
> >> be fine with me. That will benefit a lot of people since using gpios is
> >> much more common.
> >
> > We should use the i2c_board_info.irq field for that, not a field in the
> > platform data structure. The IRQ line could be hooked up to a non-GPIO
> > IRQ.
>
> 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.
I believe we should then extend the I2C interrupt support. The reason for
doing so is that we want to use the interrupt DT bindings for DT platforms,
and those are handled by the I2C core.
> >>> The driver enables multiple interrupts on the chip, however, the
> >>> adv7604_isr callback doesn't seem to handle them correctly.
> >>> According to the docs:
> >>> "If an interrupt event occurs, and then a second interrupt event occurs
> >>> before the system controller has cleared or masked the first interrupt
> >>> event, the ADV7611 does not generate a second interrupt signal."
> >>>
> >>> However, the interrupt_service_routine doesn't account for that.
> >>> For example, in case fmt_change interrupt happens while
> >>> fmt_change_digital interrupt is being processed by the adv7604_isr
> >>> routine. If fmt_change status is set just before we clear
> >>> fmt_change_digital, we never clear fmt_change. Thus, we end up with
> >>> fmt_change interrupt missed and therefore further interrupts disabled.
> >>> I've tried to call the adv7604_isr routine in a loop and return from the
> >>> worlqueue only when all interrupt status bits are cleared. This did help
> >>> a bit, but sometimes I started getting lots of I2C read/write errors for
> >>> some reason.
> >>
> >> I'm not sure if there is much that can be done about this. The code reads
> >> the interrupt status, then clears the interrupts right after. There is
> >> always a race condition there since this isn't atomic ('read and clear').
> >> Unless Lars-Peter has a better idea?
> >>
> >> What can be improved, though, is to clear not just the interrupts that
> >> were read, but all the interrupts that are unmasked. You are right, you
> >> couldloose an interrupt that way.
> >
> > Wouldn't level-trigerred interrupts fix the issue ?
>
> See my earlier reply.
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2013-11-27 16:32 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
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 [this message]
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=3492580.V1k5XZPn5x@avalon \
--to=laurent.pinchart@ideasonboard.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=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=valentine.barshak@cogentembedded.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