Take the 2-minute tour ×

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
This is typical on systems where i2c is a key part. If it's not needed for the system to boot, it probably could be a module, but the module likely still needs board specific configuration information. –  Chris Stratton May 2 '12 at 16:19
Ummm... @jeff what's a board support file? I'm not compiling the kernel (I hope) so is it something I just edit? Should I upgrade my kernel? apt-get tells me is available for my install. I guess I could go to Ubuntu 11.11 or whatever is newer, but I HATE gnome 3. –  Wes Miller May 2 '12 at 16:37
@Wes - the board support file is in the kernel. Somebody must have built it, perhaps your board vendor? It can be a bit painful to get one setup to build, but I think it's the only way to get the userspace support you need. Otherwise you could write an application that accesses the CPU registers directly, but that's as much work as figuring out how to build the kernel. –  Jeff May 3 '12 at 5:48
@Jeff Thanks. I was being so lucky. My board runs out of the box Linux - Ubuntu 10.03 to be exact. Besides my "embedded" function, the board also has to be a general purpose Linux PC. Heavy sigh. Tghe last time I built a kernel with any understanding was back in 2001. –  Wes Miller May 4 '12 at 11:49
@Wes - Jump in! :) Whoever gave you the board can probably give you sources and the toolchain to build the kernel. Once you get past the first build, it's easy. –  Jeff May 5 '12 at 15:16

Your Answer


