This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM 365 -> controlling additional i2c slave

I´m on the quest to control an additional i2c slave attached to the imager port .

48hrs later it seems that I completly underestimated the necessary effort and overestimated the available documentation.

Using montavista kernel and studying some already existent drivers for video stuff - I found the

i2c_driver_add  - routine which calls the i2c_client_attach routine via supplied function pointer (and i2c slave addr)

After that - using i2c_transfer or whatever should work out.

Finally I discovered that this works well with my code and already embedded slaves like 0x18 and so on.

So there should be the need to register my (new) slave address somewhere - because on using my slave address - the i2c controller addesses 0x7c (instead of proper address) , gets a NACK and I got segmentation faults and lots of other ugly things (I don´t get the point here that adresses are filtered and the stuff crashes anyway). (problem replicates in user and kernel space). So the error handling is curious at that point.

Browsing around - there are "i2c_board_info" structures and things like "i2c_new_device" things - but they come in a different init style like:

i2c_add_driver

i2c_get_adapter

i2c_new_device

i2c_put_adapter

which is somewhat different to the above mentioned method used in some of the video encoder supported drivers.

Well, it would be great if you could give me some advice how this mission is intended to work out on the actual montavista kernel thing with dm 365 bsp.

I tried this from user space using ioctl - as well as form an external self-built loadable kernel module.

And everything´s fine if I use slave address 0x18 for example.- so I think my code is fine.

rgds.

 

  • Found out so far:

    i2c_new_device to register an i2c slave device is the new method for > 2.6.30.

    The actual Montavista Kernel is 2.6.18......

     

     

  • Well, to sum it up - there are 3 possibilities to register I2C slave devices / addresses:

    1.) Static - in some architecture files with:

    i2c_register_board_info()

    2.) On loading kernel module using:

    I2C_CLIENT_INSMOD macro
    -> This is the way it´s done in Montavista 2.6.18
    (verified with grep)

    3.) with ic2_new_device for kernels >=2.6.31 (current git distri)

    Here I found my info - lets hook on the scope - have to try...

    http://www.mail-archive.com/linux-i2c@vger.kernel.org/msg01446.html

     

    rgds.