FreeBSD kernel IICBUS device code
sy8106a.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/kernel.h>
#include <sys/reboot.h>
#include <sys/module.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iiconf.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/extres/regulator/regulator.h>
#include "iicbus_if.h"
#include "regdev_if.h"
Include dependency graph for sy8106a.c:

Go to the source code of this file.

Data Structures

struct  sy8106a_reg_sc
 
struct  sy8106a_softc
 

Macros

#define VOUT1_SEL   0x01
 
#define SEL_GO   (1 << 7)
 
#define SEL_VOLTAGE_MASK   0x7f
 
#define SEL_VOLTAGE_BASE   680000 /* uV */
 
#define SEL_VOLTAGE_STEP   10000 /* uV */
 
#define VOUT_COM   0x02
 
#define COM_DISABLE   (1 << 0)
 
#define SYS_STATUS   0x06
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int sy8106a_read (device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
 
static int sy8106a_write (device_t dev, uint8_t reg, uint8_t val)
 
static int sy8106a_regnode_init (struct regnode *regnode)
 
static int sy8106a_regnode_enable (struct regnode *regnode, bool enable, int *udelay)
 
static int sy8106a_regnode_set_voltage (struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay)
 
static int sy8106a_regnode_get_voltage (struct regnode *regnode, int *uvolt)
 
 DEFINE_CLASS_1 (sy8106a_regnode, sy8106a_regnode_class, sy8106a_regnode_methods, sizeof(struct sy8106a_reg_sc), regnode_class)
 
static struct sy8106a_reg_scsy8106a_reg_attach (device_t dev, phandle_t node)
 
static int sy8106a_regdev_map (device_t dev, phandle_t xref, int ncells, pcell_t *cells, intptr_t *num)
 
static int sy8106a_probe (device_t dev)
 
static int sy8106a_attach (device_t dev)
 
 EARLY_DRIVER_MODULE (sy8106a, iicbus, sy8106a_driver, sy8106a_devclass, 0, 0, BUS_PASS_RESOURCE)
 
 MODULE_VERSION (sy8106a, 1)
 
 MODULE_DEPEND (sy8106a, iicbus, 1, 1, 1)
 
 IICBUS_FDT_PNP_INFO (compat_data)
 

Variables

static struct ofw_compat_data compat_data []
 
static regnode_method_t sy8106a_regnode_methods []
 
static device_method_t sy8106a_methods []
 
static driver_t sy8106a_driver
 
static devclass_t sy8106a_devclass
 

Macro Definition Documentation

◆ COM_DISABLE

#define COM_DISABLE   (1 << 0)

Definition at line 60 of file sy8106a.c.

◆ SEL_GO

#define SEL_GO   (1 << 7)

Definition at line 55 of file sy8106a.c.

◆ SEL_VOLTAGE_BASE

#define SEL_VOLTAGE_BASE   680000 /* uV */

Definition at line 57 of file sy8106a.c.

◆ SEL_VOLTAGE_MASK

#define SEL_VOLTAGE_MASK   0x7f

Definition at line 56 of file sy8106a.c.

◆ SEL_VOLTAGE_STEP

#define SEL_VOLTAGE_STEP   10000 /* uV */

Definition at line 58 of file sy8106a.c.

◆ SYS_STATUS

#define SYS_STATUS   0x06

Definition at line 61 of file sy8106a.c.

◆ VOUT1_SEL

#define VOUT1_SEL   0x01

Definition at line 54 of file sy8106a.c.

◆ VOUT_COM

#define VOUT_COM   0x02

Definition at line 59 of file sy8106a.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DEFINE_CLASS_1()

DEFINE_CLASS_1 ( sy8106a_regnode  ,
sy8106a_regnode_class  ,
sy8106a_regnode_methods  ,
sizeof(struct sy8106a_reg_sc ,
regnode_class   
)

◆ EARLY_DRIVER_MODULE()

EARLY_DRIVER_MODULE ( sy8106a  ,
iicbus  ,
sy8106a_driver  ,
sy8106a_devclass  ,
,
,
BUS_PASS_RESOURCE   
)

◆ IICBUS_FDT_PNP_INFO()

IICBUS_FDT_PNP_INFO ( compat_data  )

◆ MODULE_DEPEND()

MODULE_DEPEND ( sy8106a  ,
iicbus  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( sy8106a  ,
 
)

◆ sy8106a_attach()

static int sy8106a_attach ( device_t  dev)
static

Definition at line 260 of file sy8106a.c.

References sy8106a_softc::addr, dev, sy8106a_softc::reg, and sy8106a_reg_attach().

Here is the call graph for this function:

◆ sy8106a_probe()

static int sy8106a_probe ( device_t  dev)
static

Definition at line 246 of file sy8106a.c.

References compat_data, and dev.

◆ sy8106a_read()

static int sy8106a_read ( device_t  dev,
uint8_t  reg,
uint8_t *  data,
uint8_t  size 
)
static

Definition at line 83 of file sy8106a.c.

References sy8106a_softc::addr, iic_msg::buf, data, dev, iic_msg::flags, IIC_M_RD, IIC_M_WR, iicbus_transfer(), iic_msg::len, and iic_msg::slave.

Referenced by sy8106a_regnode_enable(), sy8106a_regnode_get_voltage(), and sy8106a_regnode_set_voltage().

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

◆ sy8106a_reg_attach()

static struct sy8106a_reg_sc * sy8106a_reg_attach ( device_t  dev,
phandle_t  node 
)
static

Definition at line 202 of file sy8106a.c.

References sy8106a_reg_sc::base_dev, dev, sy8106a_reg_sc::param, sy8106a_reg_sc::regnode, and sy8106a_reg_sc::xref.

Referenced by sy8106a_attach().

Here is the caller graph for this function:

◆ sy8106a_regdev_map()

static int sy8106a_regdev_map ( device_t  dev,
phandle_t  xref,
int  ncells,
pcell_t *  cells,
intptr_t *  num 
)
static

Definition at line 230 of file sy8106a.c.

References dev, sy8106a_softc::reg, and sy8106a_reg_sc::xref.

◆ sy8106a_regnode_enable()

static int sy8106a_regnode_enable ( struct regnode *  regnode,
bool  enable,
int *  udelay 
)
static

Definition at line 130 of file sy8106a.c.

References sy8106a_reg_sc::base_dev, COM_DISABLE, sy8106a_reg_sc::param, sy8106a_reg_sc::regnode, sy8106a_read(), sy8106a_write(), val, and VOUT_COM.

Here is the call graph for this function:

◆ sy8106a_regnode_get_voltage()

static int sy8106a_regnode_get_voltage ( struct regnode *  regnode,
int *  uvolt 
)
static

Definition at line 176 of file sy8106a.c.

References sy8106a_reg_sc::base_dev, sy8106a_reg_sc::regnode, SEL_VOLTAGE_BASE, SEL_VOLTAGE_MASK, SEL_VOLTAGE_STEP, sy8106a_read(), val, and VOUT1_SEL.

Here is the call graph for this function:

◆ sy8106a_regnode_init()

static int sy8106a_regnode_init ( struct regnode *  regnode)
static

Definition at line 124 of file sy8106a.c.

◆ sy8106a_regnode_set_voltage()

static int sy8106a_regnode_set_voltage ( struct regnode *  regnode,
int  min_uvolt,
int  max_uvolt,
int *  udelay 
)
static

◆ sy8106a_write()

static int sy8106a_write ( device_t  dev,
uint8_t  reg,
uint8_t  val 
)
static

Definition at line 104 of file sy8106a.c.

References sy8106a_softc::addr, iic_msg::buf, dev, iic_msg::flags, IIC_M_WR, iicbus_transfer(), iic_msg::len, iic_msg::slave, and val.

Referenced by sy8106a_regnode_enable(), and sy8106a_regnode_set_voltage().

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

Variable Documentation

◆ compat_data

struct ofw_compat_data compat_data[]
static
Initial value:
= {
{ "silergy,sy8106a", 1 },
{ NULL, 0 }
}

Definition at line 63 of file sy8106a.c.

Referenced by sy8106a_probe().

◆ sy8106a_devclass

devclass_t sy8106a_devclass
static

Definition at line 296 of file sy8106a.c.

◆ sy8106a_driver

driver_t sy8106a_driver
static
Initial value:
= {
"sy8106a",
sizeof(struct sy8106a_softc),
}
static device_method_t sy8106a_methods[]
Definition: sy8106a.c:279

Definition at line 290 of file sy8106a.c.

◆ sy8106a_methods

device_method_t sy8106a_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, sy8106a_probe),
DEVMETHOD(device_attach, sy8106a_attach),
DEVMETHOD(regdev_map, sy8106a_regdev_map),
DEVMETHOD_END
}
static int sy8106a_probe(device_t dev)
Definition: sy8106a.c:246
static int sy8106a_regdev_map(device_t dev, phandle_t xref, int ncells, pcell_t *cells, intptr_t *num)
Definition: sy8106a.c:230
static int sy8106a_attach(device_t dev)
Definition: sy8106a.c:260

Definition at line 279 of file sy8106a.c.

◆ sy8106a_regnode_methods

regnode_method_t sy8106a_regnode_methods[]
static
Initial value:
= {
REGNODEMETHOD(regnode_init, sy8106a_regnode_init),
REGNODEMETHOD(regnode_enable, sy8106a_regnode_enable),
REGNODEMETHOD(regnode_set_voltage, sy8106a_regnode_set_voltage),
REGNODEMETHOD(regnode_get_voltage, sy8106a_regnode_get_voltage),
REGNODEMETHOD_END
}
static int sy8106a_regnode_init(struct regnode *regnode)
Definition: sy8106a.c:124
static int sy8106a_regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay)
Definition: sy8106a.c:150
static int sy8106a_regnode_enable(struct regnode *regnode, bool enable, int *udelay)
Definition: sy8106a.c:130
static int sy8106a_regnode_get_voltage(struct regnode *regnode, int *uvolt)
Definition: sy8106a.c:176

Definition at line 190 of file sy8106a.c.