linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] i2c: omap: correct usage of the interrupt enable register
@ 2013-05-30 15:56 Oleksandr Dmytryshyn
       [not found] ` <1369929379-19165-1-git-send-email-oleksandr.dmytryshyn-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Oleksandr Dmytryshyn @ 2013-05-30 15:56 UTC (permalink / raw)
  To: Tony Lindgren, Wolfram Sang
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

I've just added a detailed description of the problem that is being solved
to the cover letter and commit message in the patch.

If the i2c controller during suspend will generate an interrupt, it
can lead to unpredictable behaviour in the kernel.

Based on the logic of the kernel code interrupts from i2c should be
prohibited during suspend. Kernel writes 0 to the I2C_IE register in
the omap_i2c_runtime_suspend() function. In the other side kernel
writes saved interrupt flags to the I2C_IE register in
omap_i2c_runtime_resume() function. I.e. interrupts should be disabled
during suspend.

This works for chips with version1 registers scheme. Interrupts are
disabled during suspend. For chips with version2 scheme registers
writting 0 to the I2C_IE register does nothing (because now the
I2C_IRQENABLE_SET register is located at this address). This register
is used to enable interrupts. For disabling interrupts
I2C_IRQENABLE_CLR register should be used.

Because the registers I2C_IRQENABLE_SET and I2C_IE have the same
addresses, the interrupt enabling procedure is unchanged.

I've checked that interrupts in the i2c controller are still enabled
after writting 0 to the I2C_IE register. But with my patch interrupts
are disabled in the omap_i2c_runtime_suspend() function. 

Next patch fixes it.

Patch is based on:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
tag: v3.10-rc2

Verified on OMAP4430.

Oleksandr Dmytryshyn (1):
  i2c: omap: correct usage of the interrupt enable register

 drivers/i2c/busses/i2c-omap.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

-- 
1.8.2.rc2

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-31 17:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 15:56 [PATCH v2 0/1] i2c: omap: correct usage of the interrupt enable register Oleksandr Dmytryshyn
     [not found] ` <1369929379-19165-1-git-send-email-oleksandr.dmytryshyn-l0cyMroinI0@public.gmane.org>
2013-05-30 15:56   ` [PATCH v2 1/1] " Oleksandr Dmytryshyn
     [not found]     ` <1369929379-19165-2-git-send-email-oleksandr.dmytryshyn-l0cyMroinI0@public.gmane.org>
2013-05-30 16:46       ` Kevin Hilman
     [not found]         ` <87vc604dr9.fsf-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-05-31  8:19           ` Oleksandr Dmytryshyn
     [not found]             ` <51A85CFC.2000904-l0cyMroinI0@public.gmane.org>
2013-05-31 17:24               ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).