AnsweredAssumed Answered

MX6 i2C linux driver

Question asked by karstenklein on Nov 15, 2013
Latest reply on Feb 26, 2014 by Yixing Kong

Hi all,

I currently work with the MCIMMX6Q-SDB board from Freescale. The kernel is taken from Yocto/Dylan core-image-base as it is, without change in config.

 

I tried to write a small userspace-application which uses the accelerator MMA8451 via I2C.

I figured out how the MMA is connected to the CPU and tried to do the following:

 

dev = open ("/dev/i2c-0", O_RDWR);   

   

    if (dev < 0) {

   err = errno;
   perror("==> ERROR  open:");  
   printf("errno = %d\n", err);
   close(dev);
   exit (1);

    }

   

    if (ioctl(dev, I2C_SLAVE, I2C_DEV_ADR_MMA8451) < 0) {

   err = errno;
   perror("==> Error ioctl:");  
   printf("errno = %d\n", err);
   close(dev);  
   exit (1);

    }

 

The syscall ioclt comes up with the following error;

 

==> Error ioctl:: Device or resource busy

errno = 16

 

If I use

if (ioctl(dev, I2C_SLAVE_FORCE, I2C_DEV_ADR_MMA8451) < 0) {

instead, the I2C basicly works.

 

After some search, I found the following:

root@imx6qsabresd:/sys/devices/virtual/input/input3# cat name

mma845x

 

So this makes me thinking, that there is a virtual device driver in the system which uses the i2c-driver as well.

But I cant find any informations about this.

 

Does anyone have experience on that ?

 

Best regards

Karsten

Outcomes