Hi everybody,
I am looking for advice on how to best control an additional I2C device. I have successfully implemented a test program with the i2c-dev framework. Thus, I can read and write to my I2C device from userspace. However, I am somewhat confused how to continue and have, therefore, some questions:
Currently, I set the address of the device with ioctl(fd, I2C_SLAVE_FORCE, DEV_ADDRESS)
1) Does this function set the address for all devices on the I2C bus?
For example, I have the imager MT9T001 attached to I2C bus as well as my additional device. MT9T001 has the address 0x39 and the additional device 0x40. Once set the I2C device address to 0x40 of the additional device, can I still access the imager at 0x40 at the same using the MT9T001 driver provided by the VPFE framework?
A more general question is:
2) What is the advantage of implementing a kernel driver for my I2C device instead of accessing it from the userspace?
I read the following interesting thread...
http://e2e.ti.com/support/dsp/davinci_digital_media_processors/dm3x/f/100/p/7809/31191.aspx#31191
...but still a little bit confused.
I am currently working with kernel 2.6.10 and would like to know
3) which is the best way to implement a driver for my I2C device?
The driver for MT9T001 uses i2c_driver and i2c_add_driver, whereas the documentation /i2c/writing-clients recommends to use i2c_driver and i2c_probe. Probably, I still misunderstand something. Could somebody point me to a good I2C driver example compatible with kernel 2.6.10? Is for example the driver bt832.c a good starting point?
Thank you in advance for some advice on I2C.
Regards,
Stefan