Loading ...
Sorry, an error occurred while loading the content.

I2C and kernel mutexes

Expand Messages
  • clerew5
    Is the I2C implementation in Slugos5.3 based upon the i2c-dev.c and i2c-core.c and i2c-algo-bit.c Linux drivers? I use the I2C_RDWR ioctl call to send a bunch
    Message 1 of 1 , May 17, 2012
    • 0 Attachment
      Is the I2C implementation in Slugos5.3 based upon the i2c-dev.c and i2c-core.c and i2c-algo-bit.c Linux drivers?

      I use the I2C_RDWR ioctl call to send a bunch of messages to the i2c bus. According to the source code of i2c_transfer in i2c-dev.c ( am looking at linux-2.6.21.7, but I don't suppose more recent linuces are much different), a kernel mutex is set whilst the whole bunch is sent, and thus the bunch can be regarded as an atomic action.

      But what I am seeing does not support this view. I have a variety of devices on my i2c bus, including an ADC and an EEPROM. If I run two programs, one of which is polling the ADC vigorously, and one is reading lots of stuff from the EEPROM, then from time to time the ADC gets confused and returns results from the wrong channel (or which it has four). So it would seem that a bunch of messages for the EEPROM is getting co-mingled with a bunch of messages for the ADC, and according to my understanding of the kernel code, that should not happen.

      Comments anyone?
    Your message has been successfully submitted and would be delivered to recipients shortly.