FreeBSD kernel IICBUS device code
ds1307.c File Reference
#include <sys/cdefs.h>
#include "opt_platform.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/sysctl.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/ds1307reg.h>
#include "clock_if.h"
#include "iicbus_if.h"
Include dependency graph for ds1307.c:

Go to the source code of this file.

Data Structures

struct  ds1307_softc
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void ds1307_start (void *)
 
static int ds1307_read1 (device_t dev, uint8_t reg, uint8_t *data)
 
static int ds1307_write1 (device_t dev, uint8_t reg, uint8_t data)
 
static int ds1307_ctrl_read (struct ds1307_softc *sc)
 
static int ds1307_ctrl_write (struct ds1307_softc *sc)
 
static int ds1307_sqwe_sysctl (SYSCTL_HANDLER_ARGS)
 
static int ds1307_sqw_freq_sysctl (SYSCTL_HANDLER_ARGS)
 
static int ds1307_sqw_out_sysctl (SYSCTL_HANDLER_ARGS)
 
static int ds1307_probe (device_t dev)
 
static int ds1307_attach (device_t dev)
 
static int ds1307_detach (device_t dev)
 
static int ds1307_gettime (device_t dev, struct timespec *ts)
 
static int ds1307_settime (device_t dev, struct timespec *ts)
 
 DRIVER_MODULE (ds1307, iicbus, ds1307_driver, ds1307_devclass, NULL, NULL)
 
 MODULE_VERSION (ds1307, 1)
 
 MODULE_DEPEND (ds1307, iicbus, 1, 1, 1)
 
 IICBUS_FDT_PNP_INFO (ds1307_compat_data)
 

Variables

static device_method_t ds1307_methods []
 
static driver_t ds1307_driver
 
static devclass_t ds1307_devclass
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( ds1307  ,
iicbus  ,
ds1307_driver  ,
ds1307_devclass  ,
NULL  ,
NULL   
)

◆ ds1307_attach()

static int ds1307_attach ( device_t  dev)
static

Definition at line 229 of file ds1307.c.

References dev, ds1307_start(), ds1307_softc::enum_hook, ds1307_softc::sc_dev, and ds1307_softc::sc_mcp7941x.

Here is the call graph for this function:

◆ ds1307_ctrl_read()

static int ds1307_ctrl_read ( struct ds1307_softc sc)
static

Definition at line 92 of file ds1307.c.

References DS1307_CONTROL, ds1307_read1(), ds1307_softc::sc_ctrl, and ds1307_softc::sc_dev.

Referenced by ds1307_sqw_freq_sysctl(), ds1307_sqw_out_sysctl(), and ds1307_sqwe_sysctl().

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

◆ ds1307_ctrl_write()

static int ds1307_ctrl_write ( struct ds1307_softc sc)
static

Definition at line 107 of file ds1307.c.

References DS1307_CONTROL, DS1307_CTRL_MASK, ds1307_write1(), ds1307_softc::sc_ctrl, and ds1307_softc::sc_dev.

Referenced by ds1307_sqw_freq_sysctl(), ds1307_sqw_out_sysctl(), and ds1307_sqwe_sysctl().

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

◆ ds1307_detach()

static int ds1307_detach ( device_t  dev)
static

Definition at line 254 of file ds1307.c.

References dev.

◆ ds1307_gettime()

◆ ds1307_probe()

static int ds1307_probe ( device_t  dev)
static

Definition at line 210 of file ds1307.c.

References dev.

◆ ds1307_read1()

static int ds1307_read1 ( device_t  dev,
uint8_t  reg,
uint8_t *  data 
)
static

Definition at line 78 of file ds1307.c.

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

Referenced by ds1307_ctrl_read(), and ds1307_start().

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

◆ ds1307_settime()

static int ds1307_settime ( device_t  dev,
struct timespec *  ts 
)
static

◆ ds1307_sqw_freq_sysctl()

static int ds1307_sqw_freq_sysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 151 of file ds1307.c.

References ds1307_ctrl_read(), DS1307_CTRL_RS_MASK, ds1307_ctrl_write(), and ds1307_softc::sc_ctrl.

Referenced by ds1307_start().

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

◆ ds1307_sqw_out_sysctl()

static int ds1307_sqw_out_sysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 184 of file ds1307.c.

References DS1307_CTRL_OUT, ds1307_ctrl_read(), ds1307_ctrl_write(), and ds1307_softc::sc_ctrl.

Referenced by ds1307_start().

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

◆ ds1307_sqwe_sysctl()

static int ds1307_sqwe_sysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 121 of file ds1307.c.

References ds1307_ctrl_read(), DS1307_CTRL_SQWE, ds1307_ctrl_write(), MCP7941X_CTRL_SQWE, ds1307_softc::sc_ctrl, and ds1307_softc::sc_mcp7941x.

Referenced by ds1307_start().

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

◆ ds1307_start()

static void ds1307_start ( void *  xdev)
static

Definition at line 262 of file ds1307.c.

References dev, ds1307_read1(), DS1307_SECS, DS1307_SECS_CH, ds1307_sqw_freq_sysctl(), ds1307_sqw_out_sysctl(), ds1307_sqwe_sysctl(), ds1307_softc::enum_hook, ds1307_softc::sc_dev, and ds1307_softc::sc_mcp7941x.

Referenced by ds1307_attach().

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

◆ ds1307_write1()

static int ds1307_write1 ( device_t  dev,
uint8_t  reg,
uint8_t  data 
)
static

Definition at line 85 of file ds1307.c.

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

Referenced by ds1307_ctrl_write().

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

◆ IICBUS_FDT_PNP_INFO()

IICBUS_FDT_PNP_INFO ( ds1307_compat_data  )

◆ MODULE_DEPEND()

MODULE_DEPEND ( ds1307  ,
iicbus  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( ds1307  ,
 
)

Variable Documentation

◆ ds1307_devclass

devclass_t ds1307_devclass
static

Definition at line 428 of file ds1307.c.

◆ ds1307_driver

driver_t ds1307_driver
static
Initial value:
= {
"ds1307",
sizeof(struct ds1307_softc),
}
static device_method_t ds1307_methods[]
Definition: ds1307.c:411

Definition at line 422 of file ds1307.c.

◆ ds1307_methods

device_method_t ds1307_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, ds1307_probe),
DEVMETHOD(device_attach, ds1307_attach),
DEVMETHOD(device_detach, ds1307_detach),
DEVMETHOD(clock_gettime, ds1307_gettime),
DEVMETHOD(clock_settime, ds1307_settime),
DEVMETHOD_END
}
static int ds1307_gettime(device_t dev, struct timespec *ts)
Definition: ds1307.c:317
static int ds1307_detach(device_t dev)
Definition: ds1307.c:254
static int ds1307_probe(device_t dev)
Definition: ds1307.c:210
static int ds1307_attach(device_t dev)
Definition: ds1307.c:229
static int ds1307_settime(device_t dev, struct timespec *ts)
Definition: ds1307.c:362

Definition at line 411 of file ds1307.c.