IIC troubles w/ ppc4xx (STB04)

Eugene Surovegin ebs at ebshome.net
Sun Apr 16 15:57:02 EST 2006


On Sun, Apr 16, 2006 at 07:33:45AM +0200, Andre Draszik wrote:
> I see :) So if that doesn't work, what is the preferred way of testing
> for existence of a device in a kernel module? Should I just
> unconditionally i2c_client_register() a static struct and then
> i2c_master_send() to see if it works?

There is no generic reliable way to detect that some i2c device exists 
on the bus. Even if smbus_quick worked it cannot guarantee that 
device you found is actually device you are expected - same i2c 
address can be used by different devices.

Frankly, I never saw this as a problem in embedded world, because 
most of the time you have a custom built kernel for your particular 
board or family of the boards, and you already know what devices might 
be there, so just trying to access those devices from whatever 
drivers and/or user-space applications you wrote is sufficient. In 
fact, I never needed i2c "probing" in any of almost dozen different 
embedded projects I wrote firmware/Linux board support for.

So, I think unconditional i2c_master_send() should be fine, just be 
prepared to handle errors in case device isn't there or broken.

-- 
Eugene




More information about the Linuxppc-embedded mailing list