title: Implementing i2c from Linux Userspace
body: <p>Sorry for the long description of my problem :-)</p>
  
  <p>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.  </p>
  
  <p>The I2C slave device is a TI AIC3254 audio codec.  OS is Ubuntu 10.04 LTS 32 bit.  </p>
  
  <pre><code>uname -a
  Linux Torchwood 2.6.32-41-generic #88-Ubuntu SMP Thu Mar 29 13:08:43 UTC 2012 i686 GNU/Linux
  </code></pre>
  
  <p>The PC portion of this device will be essentially a general purpose PC.  </p>
  
  <p>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.</p>
  
  <p>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).</p>
  
  <p>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 <strong>modprobe i2c-dev; depmod -a</strong> no I2C bus appears in /dev and <strong>i2cdetect</strong> from i2c_tools finds no buses (devices?).</p>
  
  <p>What I need is some understanding of Linux I2C access coding. Complete noob here.</p>
  
  <p>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.</p>
  
  <p>Do I need to put a *new_device* and *delete_device*  file in <strong>/sys/bus/i2c/devices/i2c-0/</strong>?  </p>
  
  <p>Even with i2c-dev.ko installed no i2c-x "file" appears in <strong>/sys/bus/i2c/devices/</strong>  What am I missing here?</p>
  
  <p>Can I assume or find out if this kernel knows about EG20T IOH chips?  Or are these chips generic enough that <strong>i2c-dev</strong> can deal with them?</p>
  
  <p>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?</p>
  
  <p>Do I have any use for the <strong>i2c-algo_???.ko</strong>'s?</p>
  
  <p>Sorry to be such a noob.  Thanks for any help.</p>