FreeBSD kernel IICBUS device code
tmp461.c File Reference
#include <sys/cdefs.h>
#include "opt_platform.h"
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/ctype.h>
#include <sys/kernel.h>
#include <sys/libkern.h>
#include <sys/sysctl.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iiconf.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/ofw/ofw_bus.h>
Include dependency graph for tmp461.c:

Go to the source code of this file.

Macros

#define BIT(x)   (1UL << (x))
 
#define TMP461_LOCAL_TEMP_REG_MSB   0x0
 
#define TMP461_LOCAL_TEMP_REG_LSB   0x15
 
#define TMP461_GLOBAL_TEMP_REG_MSB   0x1
 
#define TMP461_GLOBAL_TEMP_REG_LSB   0x10
 
#define TMP461_CONFIG_REG   0x3
 
#define TMP461_CONFIG_REG_TEMP_RANGE_BIT   BIT(2)
 
#define TMP461_EXTENDED_TEMP_MODIFIER   64
 
#define TMP461_C_TO_K_FIX   4370
 
#define TMP461_TEMP_LSB   0
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int tmp461_probe (device_t dev)
 
static int tmp461_attach (device_t dev)
 
static int tmp461_read_1 (device_t dev, uint8_t reg, uint8_t *data)
 
static int tmp461_read_temp (device_t dev, int32_t *temp)
 
static int tmp461_detach (device_t dev)
 
static int tmp461_sensor_sysctl (SYSCTL_HANDLER_ARGS)
 
static int32_t tmp461_signed_extend32 (uint32_t value, int sign_pos)
 
 DRIVER_MODULE (tmp461, iicbus, tmp461_driver, tmp461_devclass, 0, 0)
 
 IICBUS_FDT_PNP_INFO (tmp461_compat_data)
 

Variables

static device_method_t tmp461_methods []
 
static driver_t tmp461_driver
 
static devclass_t tmp461_devclass
 
static struct ofw_compat_data tmp461_compat_data []
 

Macro Definition Documentation

◆ BIT

#define BIT (   x)    (1UL << (x))

Definition at line 47 of file tmp461.c.

◆ TMP461_C_TO_K_FIX

#define TMP461_C_TO_K_FIX   4370

Definition at line 58 of file tmp461.c.

◆ TMP461_CONFIG_REG

#define TMP461_CONFIG_REG   0x3

Definition at line 53 of file tmp461.c.

◆ TMP461_CONFIG_REG_TEMP_RANGE_BIT

#define TMP461_CONFIG_REG_TEMP_RANGE_BIT   BIT(2)

Definition at line 54 of file tmp461.c.

◆ TMP461_EXTENDED_TEMP_MODIFIER

#define TMP461_EXTENDED_TEMP_MODIFIER   64

Definition at line 56 of file tmp461.c.

◆ TMP461_GLOBAL_TEMP_REG_LSB

#define TMP461_GLOBAL_TEMP_REG_LSB   0x10

Definition at line 52 of file tmp461.c.

◆ TMP461_GLOBAL_TEMP_REG_MSB

#define TMP461_GLOBAL_TEMP_REG_MSB   0x1

Definition at line 51 of file tmp461.c.

◆ TMP461_LOCAL_TEMP_REG_LSB

#define TMP461_LOCAL_TEMP_REG_LSB   0x15

Definition at line 50 of file tmp461.c.

◆ TMP461_LOCAL_TEMP_REG_MSB

#define TMP461_LOCAL_TEMP_REG_MSB   0x0

Definition at line 49 of file tmp461.c.

◆ TMP461_TEMP_LSB

#define TMP461_TEMP_LSB   0

Definition at line 59 of file tmp461.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( tmp461  ,
iicbus  ,
tmp461_driver  ,
tmp461_devclass  ,
,
 
)

◆ IICBUS_FDT_PNP_INFO()

IICBUS_FDT_PNP_INFO ( tmp461_compat_data  )

◆ tmp461_attach()

static int tmp461_attach ( device_t  dev)
static

Definition at line 94 of file tmp461.c.

References dev, and tmp461_sensor_sysctl().

Here is the call graph for this function:

◆ tmp461_detach()

static int tmp461_detach ( device_t  dev)
static

Definition at line 130 of file tmp461.c.

◆ tmp461_probe()

static int tmp461_probe ( device_t  dev)
static

Definition at line 115 of file tmp461.c.

References dev, and tmp461_compat_data.

◆ tmp461_read_1()

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

Definition at line 137 of file tmp461.c.

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

Referenced by tmp461_read_temp().

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

◆ tmp461_read_temp()

static int tmp461_read_temp ( device_t  dev,
int32_t *  temp 
)
static

Definition at line 149 of file tmp461.c.

References data, dev, TMP461_C_TO_K_FIX, TMP461_CONFIG_REG, TMP461_CONFIG_REG_TEMP_RANGE_BIT, TMP461_EXTENDED_TEMP_MODIFIER, TMP461_LOCAL_TEMP_REG_LSB, TMP461_LOCAL_TEMP_REG_MSB, tmp461_read_1(), and TMP461_TEMP_LSB.

Referenced by tmp461_sensor_sysctl().

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

◆ tmp461_sensor_sysctl()

static int tmp461_sensor_sysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 180 of file tmp461.c.

References dev, and tmp461_read_temp().

Referenced by tmp461_attach().

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

◆ tmp461_signed_extend32()

static int32_t tmp461_signed_extend32 ( uint32_t  value,
int  sign_pos 
)
static

Variable Documentation

◆ tmp461_compat_data

struct ofw_compat_data tmp461_compat_data[]
static
Initial value:
= {
{ "ti,tmp461", 1 },
{ NULL, 0 }
}

Definition at line 85 of file tmp461.c.

Referenced by tmp461_probe().

◆ tmp461_devclass

devclass_t tmp461_devclass
static

Definition at line 83 of file tmp461.c.

◆ tmp461_driver

driver_t tmp461_driver
static
Initial value:
= {
"tmp461_dev",
0
}
static device_method_t tmp461_methods[]
Definition: tmp461.c:69

Definition at line 77 of file tmp461.c.

◆ tmp461_methods

device_method_t tmp461_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, tmp461_probe),
DEVMETHOD(device_attach, tmp461_attach),
DEVMETHOD(device_detach, tmp461_detach),
DEVMETHOD_END
}
static int tmp461_probe(device_t dev)
Definition: tmp461.c:115
static int tmp461_detach(device_t dev)
Definition: tmp461.c:130
static int tmp461_attach(device_t dev)
Definition: tmp461.c:94

Definition at line 69 of file tmp461.c.