2009-01-12 06:38:29     I2C Driver - does not call "attach_adapter" callback.

Document created by Aaronwu Employee on Aug 9, 2013
Version 1Show Document
  • View in full screen mode

2009-01-12 06:38:29     I2C Driver - does not call "attach_adapter" callback.

ian davidson (UNITED KINGDOM)

Message: 67790   

 

I2C Driver - does not call "attach_adapter" callback.

The attached driver does not work. The code, is attached,

I have compiled using 2008 1.5-14 of the build tools and kernel.

The processor is BF527

root:/proc> cat version

Linux version 2.6.22.19-ADI-2008R1.5-svn (iand@vgc-ds1.vitecnet.local) (gcc version 4.1.2 (ADI svn)) #10 Mon Jan 12 09:27:00 GMT 2009

root:/proc>

 

When I do insmod on the driver this is all I get.

    root:/tmp/sbin/drivers> insmod max7313register.ko

    Jan  8 2009 16:54:34

    i2c driver registration OK

    root:/tmp/sbin/drivers>

The driver's _init function is called OK, but i2c_add_driver() does not call the callback "attach_adapter".

 

I know the hardware is OK as I can access the I2C devices OK using the "/dev/i2c-0" interface using ioctl() and read() and write(), but this shoulld not matter as it has not even got as far as calling i2c_probe()

 

I seem to be lacking some kernel configuration.

 

What do I need to configure in the kernel to get this driver to install OK, and where do I find it?

 

Also, is it possible to have the "/dev/i2c-0" interface and user supplied i2c drivers running at the same time?

 

Thanks,

Ian Davidson.

 

 

max7313register.c

QuoteReplyEditDelete

 

 

2009-01-12 07:27:30     Re: I2C Driver - does not call "attach_adapter" callback.

Mike Frysinger (UNITED STATES)

Message: 67796   

 

the probe function is only called if the slave address is actually detected.  check you declared the right address properly.  you can review the documentation here:

http://docs.blackfin.uclinux.org/doku.php?id=i2c

QuoteReplyEditDelete

 

 

2009-01-12 08:27:10     Re: I2C Driver - does not call "attach_adapter" callback.

ian davidson (UNITED KINGDOM)

Message: 67808   

 

Thanks Mike,

 

I re-read the documentation (for the nth time), and changed

 

     I2C_CLIENT_INSMOD_1(max7313)

 

to

 

   I2C_CLIENT_INSMOD;

 

I now get:

 

Jan 12 2009 13:17:30

attaching adapter

client detected at address 22

client detected at address 23

client detected at address 24

client detected at address 25

attaching adapter 0

i2c driver registration OK

root:/tmp/sbin/drivers>

 

 

 

So that seems to have fixed it.

 

What I don't undersand is how this exact same source code ran OK when built with an run on a different platform.

 

So the INSMOD_1 macro was OK on one platform, but not OK on another.

 

Thanks,

 

Ian

 

 

QuoteReplyEditDelete

 

 

2009-01-12 08:41:20     Re: I2C Driver - does not call "attach_adapter" callback.

Mike Frysinger (UNITED STATES)

Message: 67810   

 

APIs change over time.  you cant compare different platforms if they arent the same exact linux version.

QuoteReplyEditDelete

 

 

2009-01-12 09:27:01     Re: I2C Driver - does not call "attach_adapter" callback.

ian davidson (UNITED KINGDOM)

Message: 67811   

 

But it was the same kernel and toolchan, the difference was the kernel configuration and the platform.

 

Anyway, I'm over that little hurdle now, thanks.

 

ian

Attachments

Outcomes