1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct i2c_algorithm</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="i2c.html" title="Chapter&#160;10.&#160;I2C and SMBus Subsystem"><link rel="prev" href="API-I2C-BOARD-INFO.html" title="I2C_BOARD_INFO"><link rel="next" href="API-struct-i2c-bus-recovery-info.html" title="struct i2c_bus_recovery_info"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct i2c_algorithm</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-I2C-BOARD-INFO.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;10.&#160;I<sup>2</sup>C and SMBus Subsystem</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-struct-i2c-bus-recovery-info.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-i2c-algorithm"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct i2c_algorithm &#8212; 
2     represent I2C transfer method
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct i2c_algorithm {
5  int (* master_xfer) (struct i2c_adapter *adap, struct i2c_msg *msgs,int num);
6  int (* smbus_xfer) (struct i2c_adapter *adap, u16 addr,unsigned short flags, char read_write,u8 command, int size, union i2c_smbus_data *data);
7  u32 (* functionality) (struct i2c_adapter *);
8#if IS_ENABLED(CONFIG_I2C_SLAVE)
9  int (* reg_slave) (struct i2c_client *client);
10  int (* unreg_slave) (struct i2c_client *client);
11#endif
12};  </pre></div><div class="refsect1"><a name="idp1115278380"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">master_xfer</span></dt><dd><p>
13   Issue a set of i2c transactions to the given I2C adapter
14   defined by the msgs array, with num messages available to transfer via
15   the adapter specified by adap.
16      </p></dd><dt><span class="term">smbus_xfer</span></dt><dd><p>
17   Issue smbus transactions to the given I2C adapter. If this
18   is not present, then the bus layer will try and convert the SMBus calls
19   into I2C transfers instead.
20      </p></dd><dt><span class="term">functionality</span></dt><dd><p>
21   Return the flags that this algorithm/adapter pair supports
22   from the I2C_FUNC_* flags.
23      </p></dd><dt><span class="term">reg_slave</span></dt><dd><p>
24   Register given client to I2C slave mode of this adapter
25      </p></dd><dt><span class="term">unreg_slave</span></dt><dd><p>
26   Unregister given client from I2C slave mode of this adapter
27      </p></dd></dl></div></div><div class="refsect1"><a name="idp1115282884"></a><h2>The following structs are for those who like to implement new bus drivers</h2><p>
28   i2c_algorithm is the interface to a class of hardware solutions which can
29   be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
30   to name two of the most common.
31   </p><p>
32
33   The return codes from the <em class="parameter"><code>master_xfer</code></em> field should indicate the type of
34   error code that occurred during the transfer, as documented in the kernel
35   Documentation file Documentation/i2c/fault-codes.
36</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-I2C-BOARD-INFO.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="i2c.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-struct-i2c-bus-recovery-info.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">I2C_BOARD_INFO</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">struct i2c_bus_recovery_info</span></td></tr></table></div></body></html>
37