FreeBSD kernel IICBUS device code
syr827.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 syr827.c:

Go to the source code of this file.

Data Structures

struct  syr827_reg_sc
 
struct  syr827_softc
 

Macros

#define VSEL0   0x00
 
#define VSEL1   0x01
 
#define VSEL_BUCK_EN   (1 << 7)
 
#define VSEL_NSEL_MASK   0x3F
 
#define VSEL_VOLTAGE_BASE   712500 /* uV */
 
#define VSEL_VOLTAGE_STEP   12500 /* uV */
 
#define ID1   0x03
 
#define ID1_VENDOR_MASK   0xE0
 
#define ID1_VENDOR_SHIFT   5
 
#define ID1_DIE_MASK   0xF
 
#define ID2   0x4
 
#define ID2_DIE_REV_MASK   0xF
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int syr827_read (device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
 
static int syr827_write (device_t dev, uint8_t reg, uint8_t val)
 
static int syr827_regnode_init (struct regnode *regnode)
 
static int syr827_regnode_enable (struct regnode *regnode, bool enable, int *udelay)
 
static int syr827_regnode_set_voltage (struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay)
 
static int syr827_regnode_get_voltage (struct regnode *regnode, int *uvolt)
 
 DEFINE_CLASS_1 (syr827_regnode, syr827_regnode_class, syr827_regnode_methods, sizeof(struct syr827_reg_sc), regnode_class)
 
static struct syr827_reg_scsyr827_reg_attach (device_t dev, phandle_t node)
 
static int syr827_regdev_map (device_t dev, phandle_t xref, int ncells, pcell_t *cells, intptr_t *num)
 
static int syr827_probe (device_t dev)
 
static void syr827_start (void *pdev)
 
static int syr827_attach (device_t dev)
 
 EARLY_DRIVER_MODULE (syr827, iicbus, syr827_driver, syr827_devclass, 0, 0, BUS_PASS_RESOURCE)
 
 MODULE_VERSION (syr827, 1)
 
 MODULE_DEPEND (syr827, iicbus, 1, 1, 1)
 
 IICBUS_FDT_PNP_INFO (compat_data)
 

Variables

static struct ofw_compat_data compat_data []
 
static regnode_method_t syr827_regnode_methods []
 
static device_method_t syr827_methods []
 
static driver_t syr827_driver
 
static devclass_t syr827_devclass
 

Macro Definition Documentation

◆ ID1

#define ID1   0x03

Definition at line 59 of file syr827.c.

◆ ID1_DIE_MASK

#define ID1_DIE_MASK   0xF

Definition at line 62 of file syr827.c.

◆ ID1_VENDOR_MASK

#define ID1_VENDOR_MASK   0xE0

Definition at line 60 of file syr827.c.

◆ ID1_VENDOR_SHIFT

#define ID1_VENDOR_SHIFT   5

Definition at line 61 of file syr827.c.

◆ ID2

#define ID2   0x4

Definition at line 64 of file syr827.c.

◆ ID2_DIE_REV_MASK

#define ID2_DIE_REV_MASK   0xF

Definition at line 65 of file syr827.c.

◆ VSEL0

#define VSEL0   0x00

Definition at line 51 of file syr827.c.

◆ VSEL1

#define VSEL1   0x01

Definition at line 52 of file syr827.c.

◆ VSEL_BUCK_EN

#define VSEL_BUCK_EN   (1 << 7)

Definition at line 54 of file syr827.c.

◆ VSEL_NSEL_MASK

#define VSEL_NSEL_MASK   0x3F

Definition at line 55 of file syr827.c.

◆ VSEL_VOLTAGE_BASE

#define VSEL_VOLTAGE_BASE   712500 /* uV */

Definition at line 56 of file syr827.c.

◆ VSEL_VOLTAGE_STEP

#define VSEL_VOLTAGE_STEP   12500 /* uV */

Definition at line 57 of file syr827.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DEFINE_CLASS_1()

DEFINE_CLASS_1 ( syr827_regnode  ,
syr827_regnode_class  ,
syr827_regnode_methods  ,
sizeof(struct syr827_reg_sc ,
regnode_class   
)

◆ EARLY_DRIVER_MODULE()

EARLY_DRIVER_MODULE ( syr827  ,
iicbus  ,
syr827_driver  ,
syr827_devclass  ,
,
,
BUS_PASS_RESOURCE   
)

◆ IICBUS_FDT_PNP_INFO()

IICBUS_FDT_PNP_INFO ( compat_data  )

◆ MODULE_DEPEND()

MODULE_DEPEND ( syr827  ,
iicbus  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( syr827  ,
 
)

◆ syr827_attach()

static int syr827_attach ( device_t  dev)
static

Definition at line 278 of file syr827.c.

References syr827_softc::addr, dev, syr827_softc::intr_hook, syr827_softc::reg, syr827_reg_attach(), and syr827_start().

Here is the call graph for this function:

◆ syr827_probe()

static int syr827_probe ( device_t  dev)
static

Definition at line 242 of file syr827.c.

References compat_data, and dev.

◆ syr827_read()

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

Definition at line 91 of file syr827.c.

References data, dev, IIC_INTRWAIT, and iicdev_readfrom().

Referenced by syr827_regnode_enable(), syr827_regnode_get_voltage(), syr827_regnode_set_voltage(), and syr827_start().

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

◆ syr827_reg_attach()

static struct syr827_reg_sc * syr827_reg_attach ( device_t  dev,
phandle_t  node 
)
static

Definition at line 182 of file syr827.c.

References syr827_reg_sc::base_dev, dev, syr827_reg_sc::param, syr827_reg_sc::regnode, syr827_reg_sc::suspend_reg, syr827_reg_sc::volt_reg, VSEL0, VSEL1, and syr827_reg_sc::xref.

Referenced by syr827_attach().

Here is the caller graph for this function:

◆ syr827_regdev_map()

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

Definition at line 226 of file syr827.c.

References dev, syr827_softc::reg, and syr827_reg_sc::xref.

◆ syr827_regnode_enable()

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

Definition at line 109 of file syr827.c.

References syr827_reg_sc::base_dev, syr827_reg_sc::param, syr827_reg_sc::regnode, syr827_read(), syr827_write(), val, syr827_reg_sc::volt_reg, and VSEL_BUCK_EN.

Here is the call graph for this function:

◆ syr827_regnode_get_voltage()

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

Definition at line 156 of file syr827.c.

References syr827_reg_sc::base_dev, syr827_reg_sc::regnode, syr827_read(), val, syr827_reg_sc::volt_reg, VSEL_NSEL_MASK, VSEL_VOLTAGE_BASE, and VSEL_VOLTAGE_STEP.

Here is the call graph for this function:

◆ syr827_regnode_init()

static int syr827_regnode_init ( struct regnode *  regnode)
static

Definition at line 103 of file syr827.c.

◆ syr827_regnode_set_voltage()

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

◆ syr827_start()

static void syr827_start ( void *  pdev)
static

Definition at line 256 of file syr827.c.

References dev, ID1, ID1_DIE_MASK, ID1_VENDOR_MASK, ID1_VENDOR_SHIFT, ID2, ID2_DIE_REV_MASK, syr827_softc::intr_hook, syr827_read(), and val.

Referenced by syr827_attach().

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

◆ syr827_write()

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

Definition at line 97 of file syr827.c.

References dev, IIC_INTRWAIT, iicdev_writeto(), and val.

Referenced by syr827_regnode_enable(), and syr827_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,syr827", 1 },
{ NULL, 0 }
}

Definition at line 67 of file syr827.c.

Referenced by syr827_probe().

◆ syr827_devclass

devclass_t syr827_devclass
static

Definition at line 320 of file syr827.c.

◆ syr827_driver

driver_t syr827_driver
static
Initial value:
= {
"syr827",
sizeof(struct syr827_softc),
}
static device_method_t syr827_methods[]
Definition: syr827.c:303

Definition at line 314 of file syr827.c.

◆ syr827_methods

device_method_t syr827_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, syr827_probe),
DEVMETHOD(device_attach, syr827_attach),
DEVMETHOD(regdev_map, syr827_regdev_map),
DEVMETHOD_END
}
static int syr827_probe(device_t dev)
Definition: syr827.c:242
static int syr827_attach(device_t dev)
Definition: syr827.c:278
static int syr827_regdev_map(device_t dev, phandle_t xref, int ncells, pcell_t *cells, intptr_t *num)
Definition: syr827.c:226

Definition at line 303 of file syr827.c.

◆ syr827_regnode_methods

regnode_method_t syr827_regnode_methods[]
static
Initial value:
= {
REGNODEMETHOD(regnode_init, syr827_regnode_init),
REGNODEMETHOD(regnode_enable, syr827_regnode_enable),
REGNODEMETHOD(regnode_set_voltage, syr827_regnode_set_voltage),
REGNODEMETHOD(regnode_get_voltage, syr827_regnode_get_voltage),
REGNODEMETHOD_END
}
static int syr827_regnode_get_voltage(struct regnode *regnode, int *uvolt)
Definition: syr827.c:156
static int syr827_regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay)
Definition: syr827.c:129
static int syr827_regnode_init(struct regnode *regnode)
Definition: syr827.c:103
static int syr827_regnode_enable(struct regnode *regnode, bool enable, int *udelay)
Definition: syr827.c:109

Definition at line 170 of file syr827.c.