Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Variables
i2c.h File Reference
#include <linux/mod_devicetable.h>
#include <linux/device.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/swab.h>
#include <uapi/linux/i2c.h>

Go to the source code of this file.

Data Structures

struct  i2c_driver
 
struct  i2c_client
 
struct  i2c_board_info
 
struct  i2c_algorithm
 
struct  i2c_adapter
 

Macros

#define to_i2c_driver(d)   container_of(d, struct i2c_driver, driver)
 

Variables

struct bus_type i2c_bus_type
 
struct device_type i2c_adapter_type
 

: Indicates the type of the device, usually a chip name that's

struct i2c_client - represent an I2C slave device : I2C_CLIENT_TEN indicates the device uses a ten bit chip address; I2C_CLIENT_PEC indicates it uses SMBus Packet Error Checking : Address used on the I2C bus connected to the parent adapter.

generic enough to hide second-sourcing and compatible revisions. : manages the bus segment hosting this I2C device : device's driver, hence pointer to access routines : Driver model device node for the slave. : indicates the IRQ generated by this device (if any) : member of an i2c_driver.clients list or i2c-core's userspace_devices list

An i2c_client identifies a single device (i.e. chip) connected to an i2c bus. The behaviour exposed to Linux is defined by the driver managing the device.

#define to_i2c_client(d)   container_of(d, struct i2c_client, dev)
 
#define I2C_BOARD_INFO(dev_type, dev_addr)   .type = dev_type, .addr = (dev_addr)
 
#define to_i2c_adapter(d)   container_of(d, struct i2c_adapter, dev)
 
#define I2C_CLIENT_PEC   0x04 /* Use Packet Error Checking */
 
#define I2C_CLIENT_TEN   0x10 /* we have a ten bit chip address */
 
#define I2C_CLIENT_WAKE   0x80 /* for board_info; true iff can wake */
 
#define I2C_CLIENT_SCCB   0x9000 /* Use Omnivision SCCB protocol */
 
#define I2C_CLASS_HWMON   (1<<0) /* lm_sensors, ... */
 
#define I2C_CLASS_DDC   (1<<3) /* DDC bus on graphics adapters */
 
#define I2C_CLASS_SPD   (1<<7) /* Memory modules */
 
#define I2C_CLIENT_END   0xfffeU
 
#define I2C_ADDRS(addr, addrs...)   ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
 
struct i2c_clienti2c_verify_client (struct device *dev)
 
struct i2c_adapteri2c_verify_adapter (struct device *dev)
 
int i2c_for_each_dev (void *data, int(*fn)(struct device *, void *))
 
void i2c_lock_adapter (struct i2c_adapter *)
 
void i2c_unlock_adapter (struct i2c_adapter *)
 

Macro Definition Documentation

#define I2C_ADDRS (   addr,
  addrs... 
)    ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })

Definition at line 441 of file i2c.h.

#define I2C_BOARD_INFO (   dev_type,
  dev_addr 
)    .type = dev_type, .addr = (dev_addr)

I2C_BOARD_INFO - macro used to list an i2c device and its address : identifies the device type : the device's address on the bus.

This macro initializes essential fields of a struct i2c_board_info, declaring what has been provided on a particular board. Optional fields (such as associated irq, or device-specific platform_data) are provided using conventional syntax.

Definition at line 295 of file i2c.h.

#define I2C_CLASS_DDC   (1<<3) /* DDC bus on graphics adapters */

Definition at line 434 of file i2c.h.

#define I2C_CLASS_HWMON   (1<<0) /* lm_sensors, ... */

Definition at line 433 of file i2c.h.

#define I2C_CLASS_SPD   (1<<7) /* Memory modules */

Definition at line 435 of file i2c.h.

#define I2C_CLIENT_END   0xfffeU

Definition at line 438 of file i2c.h.

#define I2C_CLIENT_PEC   0x04 /* Use Packet Error Checking */

Definition at line 425 of file i2c.h.

#define I2C_CLIENT_SCCB   0x9000 /* Use Omnivision SCCB protocol */

Definition at line 429 of file i2c.h.

#define I2C_CLIENT_TEN   0x10 /* we have a ten bit chip address */

Definition at line 426 of file i2c.h.

#define I2C_CLIENT_WAKE   0x80 /* for board_info; true iff can wake */

Definition at line 428 of file i2c.h.

#define to_i2c_adapter (   d)    container_of(d, struct i2c_adapter, dev)

Definition at line 395 of file i2c.h.

#define to_i2c_client (   d)    container_of(d, struct i2c_client, dev)

Definition at line 233 of file i2c.h.

#define to_i2c_driver (   d)    container_of(d, struct i2c_driver, driver)

Definition at line 201 of file i2c.h.

Function Documentation

int i2c_for_each_dev ( void data,
int(*)(struct device *, void *)  fn 
)

Definition at line 1143 of file i2c-core.c.

void i2c_lock_adapter ( struct i2c_adapter adapter)

i2c_lock_adapter - Get exclusive access to an I2C bus segment : Target I2C bus segment

Definition at line 446 of file i2c-core.c.

void i2c_unlock_adapter ( struct i2c_adapter adapter)

i2c_unlock_adapter - Release exclusive access to an I2C bus segment : Target I2C bus segment

Definition at line 475 of file i2c-core.c.

struct i2c_adapter* i2c_verify_adapter ( struct device dev)
read

i2c_verify_adapter - return parameter as i2c_adapter or NULL : device, probably from some driver model iterator

When traversing the driver model tree, perhaps using driver model iterators like (), you can't assume very much about the nodes you find. Use this function to avoid oopses caused by wrongly treating some non-I2C device as an i2c_adapter.

Definition at line 801 of file i2c-core.c.

struct i2c_client* i2c_verify_client ( struct device dev)
read

i2c_verify_client - return parameter as i2c_client, or NULL : device, probably from some driver model iterator

When traversing the driver model tree, perhaps using driver model iterators like (), you can't assume very much about the nodes you find. Use this function to avoid oopses caused by wrongly treating some non-I2C device as an i2c_client.

Definition at line 342 of file i2c-core.c.

Variable Documentation

struct device_type i2c_adapter_type

Definition at line 786 of file i2c-core.c.

struct bus_type i2c_bus_type

Definition at line 316 of file i2c-core.c.