Reputation: 2231
Sorry for the long description of my problem :-)
I have been handed a task to perform simple reads and writes to/from an I2C device on our new PC based board design. The board will be built using Portwell's Qseven mini PC which uses an Intel Tunnel Creek (ATOM) processor (essentially an x86 processor) and an EG20T IOH chip.
The I2C slave device is a TI AIC3254 audio codec. OS is Ubuntu 10.04 LTS 32 bit.
uname -a
Linux Torchwood 2.6.32-41-generic #88-Ubuntu SMP Thu Mar 29 13:08:43 UTC 2012 i686 GNU/Linux
The PC portion of this device will be essentially a general purpose PC.
The PC/OS needs to load the codec (registers) via I2C at system init. After that the codec will be controlled by an Atmel processor which will be a second master on the I2C bus (remaining silent until init is complete). The ATOM will have no additional direct interaction with the AIC3254.
All that I need to do, as far as I know, is to copy the codec's "program" to it over the I2C bus then read it back (poor man's load check).
It seems the logical approach is to use a userspace program to talk to the AIC3254 rather than try to create a device driver. However, after I modprobe i2c-dev; depmod -a no I2C bus appears in /dev and i2cdetect from i2c_tools finds no buses (devices?).
What I need is some understanding of Linux I2C access coding. Complete noob here.
Do I need a device driver after all? I don't need any fancy interface for general programs too use, just one simple read/write to bus/page/register. Perhaps a simple char mode driver? I've read something that suggests such things exist.
Do I need to put a *new_device* and *delete_device* file in /sys/bus/i2c/devices/i2c-0/?
Even with i2c-dev.ko installed no i2c-x "file" appears in /sys/bus/i2c/devices/ What am I missing here?
Can I assume or find out if this kernel knows about EG20T IOH chips? Or are these chips generic enough that i2c-dev can deal with them?
Will I need i2c-core.ko? It isn't found on the Ubuntu image. What do I need to apt-get to have it if I need it?
Do I have any use for the i2c-algo_???.ko's?
Sorry to be such a noob. Thanks for any help.
Upvotes: 0
Views: 4692
Reputation: 2009
I think you need to add i2c support in your board support file when you build the kernel for the target. We use an Atmel based board to do i2c, and during kernel init, it calls i2c_register_board_info() to register the i2c devices. Then you can access them using i2c-tools, and userspace apps. Note we are using 3.2.6 kernel, but similar calls are likely needed for 2.6 kernels
Upvotes: 1