Re: [PATCH v4] i2c: add driver for Rockchip RK3xxx SoC I2C adapter

From: Wolfram Sang
Date: Tue Jun 10 2014 - 04:20:04 EST



> > > + /* Synchronization & notification */
> > > + spinlock_t lock;
> >
> > Why the lock? The core has per-adapter locks anyhow.
>
> I'm using it to lock the rk3x_i2c struct during interrupts. It's needed there
> because an operation can timeout, which means the interrupt can occur at any
> time and possibly conflict with the cleanup I do after a timeout.
>
> I looked around in i2c-exynos5.c, i2c-pxa.c and others, and they do it the
> same way. Could you explain in more detail why it's not needed?

I saw that you disable IRQs on timeout, so that shouldn't happen? You
don't disable IRQs after a successful transfer, though, AFAICS.

> > It looks to me that you STOP after every message? You should use
> > REPEATED_START inbetween messages and only stop after the last message
> > of a transfer.
>
> I had a fight with the hw today and finally got it to issue a REPEATED_START
> for multiple "boring" messages. Will be included in the next version.

Great.

> Actually, I wasn't aware that (len == 0) is a valid case. The hw supports it
> in both modes, I just tested that. So the check is going away.

Also good!

Attachment: signature.asc
Description: Digital signature