All of lore.kernel.org
 help / color / mirror / Atom feed
From: ulf.samuelsson@atmel.com (Ulf Samuelsson)
To: linux-arm-kernel@lists.infradead.org
Subject: request_irq in I2C driver causes kernel to freeze during probe, but if done later - no problem!
Date: Sat, 27 Mar 2010 00:16:58 +0100	[thread overview]
Message-ID: <4BAD406A.7070208@atmel.com> (raw)

I am currently working on an I2C driver which requires an irq.

The driver was developed on a Beagleboard running linux-2.6.29-rc3
(Android 1.6) where everything works OK.
I then try the driver on a customer board, where they use 2.6.27.16
(also Android 1.6) on a Qualcomm Snapdragon.

In the "probe" for the driver, I request an irq.
If the code below is active, then the driver completes the "probe"
and can communicate with other I2C peripherals.
(This is verified by listening to the I2C bus communications)
After ~20 I2C messages to 3 different peripherals, the kernel freezes.
The customer board does not have a console port!,
so you can only read the bootlog if the boot succeeds.

If the code below is ifdef'ed away. the boot succeeds.
I have implemented a workaround, using sysfs, which allows me to request
the irq manually after the system has completed the boot.

If I do that, then the interrupts are accepted and the correct interrupt
routine is called.


#ifdef	MAXINT
if (mxt->irq) {
	error = request_irq(
			mxt->irq,
			mxt_irq_handler,
			IRQF_TRIGGER_FALLING,
			client->dev.driver->name,
			mxt
		);
	if (error < 0) {
		dev_err(&client->dev,
			"failed to allocate irq %d\n", mxt->irq);
		goto err_free_device;
	}
}
#endif

Some notes:
"request_irq" completes with (error >= 0) so the error handling
is not processed. This is verified by listening to the I2C bus.

Since we take the appropriate interrupt, "mxt->irq" must be correct.
Since we call the correct irq handler,"mxt_irq_handler" must be correct.
"mxt" is a pointer to the driver local data.
We use the same pointer when we request the irq in sysfs.
Not sure about the contents of "client->dev.driver->name".

If the interrupt is executing, then we would see some I2C communication
as a result, but we do not see this, before the kernel freezes.

The interrupt is (and should be) called on the falling edge of the
interrupt.

I am currently scratching my head, and need help with ideas...


Best Regards
Ulf Samuelsson

             reply	other threads:[~2010-03-26 23:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26 23:16 Ulf Samuelsson [this message]
2010-03-26 23:24 ` request_irq in I2C driver causes kernel to freeze during probe, but if done later - no problem! Russell King - ARM Linux
2010-03-27  0:22   ` Ulf Samuelsson
2010-03-27  0:41     ` Ulf Samuelsson
2010-03-27  1:12       ` Ben Dooks
2010-03-27  7:01         ` Ulf Samuelsson
2010-03-27 10:11           ` Russell King - ARM Linux
2010-03-27 11:06             ` request_irq in I2C driver causes kernel to freeze duringprobe, " Ulf Samuelsson
2010-03-29 10:01         ` request_irq in I2C driver causes kernel to freeze during probe, " Mark Brown
2010-03-27  9:16     ` Russell King - ARM Linux
2010-03-27  9:17     ` Russell King - ARM Linux

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=4BAD406A.7070208@atmel.com \
    --to=ulf.samuelsson@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.