FreeBSD kernel IICBUS device code
iicbus.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
#include "iicbus_if.h"
Include dependency graph for iicbus.c:

Go to the source code of this file.

Macros

#define SCAN_IICBUS   0
 

Functions

 __FBSDID ("$FreeBSD$")
 
 SYSCTL_NODE (_hw, OID_AUTO, i2c, CTLFLAG_RW, 0, "i2c controls")
 
static int iicbus_probe (device_t dev)
 
int iicbus_attach_common (device_t dev, u_int bus_freq)
 
static int iicbus_attach (device_t dev)
 
int iicbus_detach (device_t dev)
 
static int iicbus_print_child (device_t dev, device_t child)
 
void iicbus_probe_nomatch (device_t bus, device_t child)
 
int iicbus_child_location (device_t bus, device_t child, struct sbuf *sb)
 
int iicbus_child_pnpinfo (device_t bus, device_t child, struct sbuf *sb)
 
int iicbus_read_ivar (device_t bus, device_t child, int which, uintptr_t *result)
 
int iicbus_write_ivar (device_t bus, device_t child, int which, uintptr_t value)
 
device_t iicbus_add_child_common (device_t dev, u_int order, const char *name, int unit, size_t ivars_size)
 
static device_t iicbus_add_child (device_t dev, u_int order, const char *name, int unit)
 
static void iicbus_hinted_child (device_t bus, const char *dname, int dunit)
 
static struct resource_list * iicbus_get_resource_list (device_t bus __unused, device_t child)
 
int iicbus_generic_intr (device_t dev, int event, char *buf)
 
int iicbus_null_callback (device_t dev, int index, caddr_t data)
 
int iicbus_null_repeated_start (device_t dev, u_char addr)
 
void iicbus_init_frequency (device_t dev, u_int bus_freq)
 
static u_int iicbus_get_frequency (device_t dev, u_char speed)
 
 MODULE_VERSION (iicbus, IICBUS_MODVER)
 
 DRIVER_MODULE (iicbus, iichb, iicbus_driver, iicbus_devclass, 0, 0)
 

Variables

static device_method_t iicbus_methods []
 
driver_t iicbus_driver
 
devclass_t iicbus_devclass
 

Macro Definition Documentation

◆ SCAN_IICBUS

#define SCAN_IICBUS   0

Definition at line 54 of file iicbus.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( iicbus  ,
iichb  ,
iicbus_driver  ,
iicbus_devclass  ,
,
 
)

◆ iicbus_add_child()

static device_t iicbus_add_child ( device_t  dev,
u_int  order,
const char *  name,
int  unit 
)
static

Definition at line 246 of file iicbus.c.

References dev, and iicbus_add_child_common().

Here is the call graph for this function:

◆ iicbus_add_child_common()

device_t iicbus_add_child_common ( device_t  dev,
u_int  order,
const char *  name,
int  unit,
size_t  ivars_size 
)

Definition at line 226 of file iicbus.c.

References dev, and iicbus_ivar::rl.

Referenced by acpi_iicbus_add_child(), and iicbus_add_child().

Here is the caller graph for this function:

◆ iicbus_attach()

static int iicbus_attach ( device_t  dev)
static

Definition at line 137 of file iicbus.c.

References dev, and iicbus_attach_common().

Here is the call graph for this function:

◆ iicbus_attach_common()

int iicbus_attach_common ( device_t  dev,
u_int  bus_freq 
)

Definition at line 96 of file iicbus.c.

References addr, iicbus_softc::bus_freq, iicbus_softc::dev, dev, IIC_FASTEST, iicbus_init_frequency(), iicbus_reset, IICBUS_SOFTC, iicbus_softc::lock, and iicbus_softc::strict.

Referenced by acpi_iicbus_attach(), and iicbus_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iicbus_child_location()

int iicbus_child_location ( device_t  bus,
device_t  child,
struct sbuf *  sb 
)

Definition at line 180 of file iicbus.c.

References iicbus_ivar::addr, and IICBUS_IVAR.

Referenced by acpi_iicbus_child_location().

Here is the caller graph for this function:

◆ iicbus_child_pnpinfo()

int iicbus_child_pnpinfo ( device_t  bus,
device_t  child,
struct sbuf *  sb 
)

Definition at line 189 of file iicbus.c.

Referenced by acpi_iicbus_child_pnpinfo().

Here is the caller graph for this function:

◆ iicbus_detach()

int iicbus_detach ( device_t  dev)

Definition at line 144 of file iicbus.c.

References dev, IIC_FASTEST, iicbus_reset, IICBUS_SOFTC, and iicbus_softc::lock.

Referenced by acpi_iicbus_detach().

Here is the caller graph for this function:

◆ iicbus_generic_intr()

int iicbus_generic_intr ( device_t  dev,
int  event,
char *  buf 
)

Definition at line 280 of file iicbus.c.

◆ iicbus_get_frequency()

static u_int iicbus_get_frequency ( device_t  dev,
u_char  speed 
)
static

Definition at line 331 of file iicbus.c.

References iicbus_softc::bus_freq, dev, IIC_SLOW, IICBUS_SOFTC, and speed.

◆ iicbus_get_resource_list()

static struct resource_list * iicbus_get_resource_list ( device_t bus  __unused,
device_t  child 
)
static

Definition at line 271 of file iicbus.c.

References IICBUS_IVAR, and iicbus_ivar::rl.

◆ iicbus_hinted_child()

static void iicbus_hinted_child ( device_t  bus,
const char *  dname,
int  dunit 
)
static

Definition at line 254 of file iicbus.c.

References iicbus_ivar::addr, and IICBUS_IVAR.

◆ iicbus_init_frequency()

void iicbus_init_frequency ( device_t  dev,
u_int  bus_freq 
)

Definition at line 301 of file iicbus.c.

References iicbus_softc::bus_freq, dev, and IICBUS_SOFTC.

Referenced by iicbus_attach_common(), and ofw_iicbus_attach().

Here is the caller graph for this function:

◆ iicbus_null_callback()

int iicbus_null_callback ( device_t  dev,
int  index,
caddr_t  data 
)

Definition at line 287 of file iicbus.c.

◆ iicbus_null_repeated_start()

int iicbus_null_repeated_start ( device_t  dev,
u_char  addr 
)

Definition at line 294 of file iicbus.c.

References IIC_ENOTSUPP.

◆ iicbus_print_child()

static int iicbus_print_child ( device_t  dev,
device_t  child 
)
static

Definition at line 157 of file iicbus.c.

References iicbus_ivar::addr, dev, IICBUS_IVAR, and iicbus_ivar::rl.

◆ iicbus_probe()

static int iicbus_probe ( device_t  dev)
static

Definition at line 59 of file iicbus.c.

References dev.

◆ iicbus_probe_nomatch()

void iicbus_probe_nomatch ( device_t  bus,
device_t  child 
)

Definition at line 172 of file iicbus.c.

References iicbus_ivar::addr, and IICBUS_IVAR.

Referenced by acpi_iicbus_probe_nomatch().

Here is the caller graph for this function:

◆ iicbus_read_ivar()

int iicbus_read_ivar ( device_t  bus,
device_t  child,
int  which,
uintptr_t *  result 
)

Definition at line 195 of file iicbus.c.

References iicbus_ivar::addr, IICBUS_IVAR, and IICBUS_IVAR_ADDR.

Referenced by acpi_iicbus_read_ivar().

Here is the caller graph for this function:

◆ iicbus_write_ivar()

int iicbus_write_ivar ( device_t  bus,
device_t  child,
int  which,
uintptr_t  value 
)

Definition at line 210 of file iicbus.c.

References iicbus_ivar::addr, IICBUS_IVAR, and IICBUS_IVAR_ADDR.

Referenced by acpi_iicbus_write_ivar().

Here is the caller graph for this function:

◆ MODULE_VERSION()

MODULE_VERSION ( iicbus  ,
IICBUS_MODVER   
)

◆ SYSCTL_NODE()

SYSCTL_NODE ( _hw  ,
OID_AUTO  ,
i2c  ,
CTLFLAG_RW  ,
,
"i2c controls"   
)

Variable Documentation

◆ iicbus_devclass

devclass_t iicbus_devclass

Definition at line 386 of file iicbus.c.

◆ iicbus_driver

driver_t iicbus_driver
Initial value:
= {
"iicbus",
sizeof(struct iicbus_softc),
}
static device_method_t iicbus_methods[]
Definition: iicbus.c:345

Definition at line 380 of file iicbus.c.

◆ iicbus_methods

device_method_t iicbus_methods[]
static

Definition at line 345 of file iicbus.c.