On Tue, May 05, 2009 at 07:09:01PM +0100, Mark Brown wrote:
I planned to use that macro a second time for the register write-back at resume time. But unfortunately, the i2c stack is so badly broken that it does not allow the write of a whole data block without having the length itself as part of the message (which is wrong for the codec).
Could you clarify what you mean when you say that the I2C block requires the length be part of the message? The I2C stack needs to know the amount of data to write but I'm not aware of any restrictions it places on the content of the data.
All high-level i2c functions to write block data, namely i2c_smbus_write_block_data() and i2c_smbus_write_i2c_block_data(), put the length of the data being sent inside the block sent on the wire. I couldn't believe it myself, but even my hardware I2C analyzer clearly shows that. The API seems to assume that communication to I2C devices always wants data to be sent with a leading command, followed by the number of data bytes attached and then the data itself. Correct me if I'm wrong on that.
Daniel