<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Chapter 10. I2C and SMBus Subsystem</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Linux Device Drivers" /><link rel="up" href="index.html" title="Linux Device Drivers" /><link rel="prev" href="re753.html" title="spi_write_then_read" /><link rel="next" href="re754.html" title="struct i2c_driver" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 10. I<sup>2</sup>C and SMBus Subsystem</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re753.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="re754.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 10. I2C and SMBus Subsystem"><div class="titlepage"><div><div><h2 class="title"><a id="i2c"></a>Chapter 10. I<sup>2</sup>C and SMBus Subsystem</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="refentrytitle"><a href="re754.html"><span>struct i2c_driver</span></a></span><span class="refpurpose"> — represent an I2C device driver </span></dt><dt><span class="refentrytitle"><a href="re755.html"><span>struct i2c_client</span></a></span><span class="refpurpose"> — represent an I2C slave device </span></dt><dt><span class="refentrytitle"><a href="re756.html"><span>struct i2c_board_info</span></a></span><span class="refpurpose"> — template for device creation </span></dt><dt><span class="refentrytitle"><a href="re757.html"><span>I2C_BOARD_INFO</span></a></span><span class="refpurpose"> — macro used to list an i2c device and its address </span></dt><dt><span class="refentrytitle"><a href="re758.html"><span>i2c_lock_adapter</span></a></span><span class="refpurpose"> — Prevent access to an I2C bus segment </span></dt><dt><span class="refentrytitle"><a href="re759.html"><span>i2c_unlock_adapter</span></a></span><span class="refpurpose"> — Reauthorize access to an I2C bus segment </span></dt><dt><span class="refentrytitle"><a href="re760.html"><span>struct i2c_msg</span></a></span><span class="refpurpose"> — an I2C transaction segment beginning with START </span></dt><dt><span class="refentrytitle"><a href="re761.html"><span>i2c_register_board_info</span></a></span><span class="refpurpose"> — statically declare I2C devices </span></dt><dt><span class="refentrytitle"><a href="re762.html"><span>i2c_verify_client</span></a></span><span class="refpurpose"> — return parameter as i2c_client, or NULL </span></dt><dt><span class="refentrytitle"><a href="re763.html"><span>i2c_new_device</span></a></span><span class="refpurpose"> — instantiate an i2c device </span></dt><dt><span class="refentrytitle"><a href="re764.html"><span>i2c_unregister_device</span></a></span><span class="refpurpose"> — reverse effect of <code class="function">i2c_new_device</code> </span></dt><dt><span class="refentrytitle"><a href="re765.html"><span>i2c_new_dummy</span></a></span><span class="refpurpose"> — return a new i2c device bound to a dummy driver </span></dt><dt><span class="refentrytitle"><a href="re766.html"><span>i2c_add_adapter</span></a></span><span class="refpurpose"> — declare i2c adapter, use dynamic bus number </span></dt><dt><span class="refentrytitle"><a href="re767.html"><span>i2c_add_numbered_adapter</span></a></span><span class="refpurpose"> — declare i2c adapter, use static bus number </span></dt><dt><span class="refentrytitle"><a href="re768.html"><span>i2c_del_adapter</span></a></span><span class="refpurpose"> — unregister I2C adapter </span></dt><dt><span class="refentrytitle"><a href="re769.html"><span>i2c_del_driver</span></a></span><span class="refpurpose"> — unregister I2C driver </span></dt><dt><span class="refentrytitle"><a href="re770.html"><span>i2c_use_client</span></a></span><span class="refpurpose"> — increments the reference count of the i2c client structure </span></dt><dt><span class="refentrytitle"><a href="re771.html"><span>i2c_release_client</span></a></span><span class="refpurpose"> — release a use of the i2c client structure </span></dt><dt><span class="refentrytitle"><a href="re772.html"><span>i2c_transfer</span></a></span><span class="refpurpose"> — execute a single or combined I2C message </span></dt><dt><span class="refentrytitle"><a href="re773.html"><span>i2c_master_send</span></a></span><span class="refpurpose"> — issue a single I2C message in master transmit mode </span></dt><dt><span class="refentrytitle"><a href="re774.html"><span>i2c_master_recv</span></a></span><span class="refpurpose"> — issue a single I2C message in master receive mode </span></dt><dt><span class="refentrytitle"><a href="re775.html"><span>i2c_smbus_read_byte</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">receive byte</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re776.html"><span>i2c_smbus_write_byte</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">send byte</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re777.html"><span>i2c_smbus_read_byte_data</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">read byte</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re778.html"><span>i2c_smbus_write_byte_data</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">write byte</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re779.html"><span>i2c_smbus_read_word_data</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">read word</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re780.html"><span>i2c_smbus_write_word_data</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">write word</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re781.html"><span>i2c_smbus_process_call</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">process call</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re782.html"><span>i2c_smbus_read_block_data</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">block read</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re783.html"><span>i2c_smbus_write_block_data</span></a></span><span class="refpurpose"> — SMBus <span class="quote">“<span class="quote">block write</span>”</span> protocol </span></dt><dt><span class="refentrytitle"><a href="re784.html"><span>i2c_smbus_xfer</span></a></span><span class="refpurpose"> — execute SMBus protocol operations </span></dt></dl></div><p> I<sup>2</sup>C (or without fancy typography, "I2C") is an acronym for the "Inter-IC" bus, a simple bus protocol which is widely used where low data rate communications suffice. Since it's also a licensed trademark, some vendors use another name (such as "Two-Wire Interface", TWI) for the same bus. I2C only needs two signals (SCL for clock, SDA for data), conserving board real estate and minimizing signal quality issues. Most I2C devices use seven bit addresses, and bus speeds of up to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet found wide use. I2C is a multi-master bus; open drain signaling is used to arbitrate between masters, as well as to handshake and to synchronize clocks from slower clients. </p><p> The Linux I2C programming interfaces support only the master side of bus interactions, not the slave side. The programming interface is structured around two kinds of driver, and two kinds of device. An I2C "Adapter Driver" abstracts the controller hardware; it binds to a physical device (perhaps a PCI device or platform_device) and exposes a <span class="structname">struct i2c_adapter</span> representing each I2C bus segment it manages. On each I2C bus segment will be I2C devices represented by a <span class="structname">struct i2c_client</span>. Those devices will be bound to a <span class="structname">struct i2c_driver</span>, which should follow the standard Linux driver model. (At this writing, a legacy model is more widely used.) There are functions to perform various I2C protocol operations; at this writing all such functions are usable only from task context. </p><p> The System Management Bus (SMBus) is a sibling protocol. Most SMBus systems are also I2C conformant. The electrical constraints are tighter for SMBus, and it standardizes particular protocol messages and idioms. Controllers that support I2C can also support most SMBus operations, but SMBus controllers don't support all the protocol options that an I2C controller will. There are functions to perform various SMBus protocol operations, either using I2C primitives or by issuing SMBus commands to i2c_adapter devices which don't support those I2C operations. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re753.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="re754.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>spi_write_then_read</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span>struct i2c_driver</span></td></tr></table></div></body></html>