How to use one I2C device from two modules?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On our custom board we have an I2C GPIO port expander. This is used for different things like power supply control and button control. Hence I wrote two modules; pscontrol and button. 

In the modules I use i2c_new_device to create the device and to get the i2c_client struct that I later use in the smbus calls. This works fine, one module at the time. Together the last insmod fails, because the device at that address is already created.

But how do I access the same I2C device from several modules? Ideally I want to specify the adapter and slave address. If a client is found, I get the i2c_client otherwise I have to create it by i2c_new_device (or probe it). Is it possible?

Since I know the I2C bus and slave addresses in advance, would it be better to predeclare them by i2c_register_board_info? And in that case, how do I get the i2c_client struct in the module?

Kernel version 2.6.29
Target is m68k (Coldfire)

Thanks and regards,
- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux