coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
lm96000.c File Reference
#include <delay.h>
#include <timer.h>
#include <console/console.h>
#include <device/device.h>
#include <device/i2c_bus.h>
#include "lm96000.h"
#include "chip.h"
Include dependency graph for lm96000.c:

Go to the source code of this file.

Functions

static int lm96000_read (struct device *const dev, const u8 reg)
 
static int lm96000_write (struct device *const dev, const u8 reg, const u8 value)
 
static int lm96000_update (struct device *const dev, const u8 reg, const u8 clear_mask, const u8 set_mask)
 
static u8 lm96000_to_low_limit (const enum lm96000_vin ref, const u16 limit)
 
static u8 lm96000_to_high_limit (const enum lm96000_vin ref, const u16 limit)
 
static void lm96000_set_vin_limits (struct device *const dev, const struct drivers_i2c_lm96000_config *const config)
 
static void lm96000_set_temp_limits (struct device *const dev, const struct drivers_i2c_lm96000_config *const config)
 
static u16 lm96000_rpm_to_tach (const u16 rpm)
 
static void lm96000_set_fan_limits (struct device *const dev, const struct drivers_i2c_lm96000_config *const config)
 
static u8 lm96000_to_duty (const u8 duty_cycle)
 
static void lm96000_configure_pwm (struct device *const dev, const unsigned int fan, const struct lm96000_fan_config *const config)
 
static void lm96000_configure_temp_zone (struct device *const dev, const unsigned int zone, const struct lm96000_temp_zone *const config)
 
static void lm96000_init (struct device *const dev)
 
static void lm96000_enable (struct device *const dev)
 

Variables

static const unsigned int ref_mv [] = { 2500, 2250, 3300, 5000, 12000 }
 
static struct device_operations lm96000_ops
 
struct chip_operations drivers_i2c_lm96000_ops
 

Function Documentation

◆ lm96000_configure_pwm()

◆ lm96000_configure_temp_zone()

static void lm96000_configure_temp_zone ( struct device *const  dev,
const unsigned int  zone,
const struct lm96000_temp_zone *const  config 
)
static

◆ lm96000_enable()

static void lm96000_enable ( struct device *const  dev)
static

Definition at line 212 of file lm96000.c.

◆ lm96000_init()

◆ lm96000_read()

static int lm96000_read ( struct device *const  dev,
const u8  reg 
)
inlinestatic

Definition at line 12 of file lm96000.c.

References i2c_dev_readb_at().

Referenced by lm96000_init().

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

◆ lm96000_rpm_to_tach()

static u16 lm96000_rpm_to_tach ( const u16  rpm)
static

Definition at line 80 of file lm96000.c.

Referenced by lm96000_set_fan_limits().

Here is the caller graph for this function:

◆ lm96000_set_fan_limits()

static void lm96000_set_fan_limits ( struct device *const  dev,
const struct drivers_i2c_lm96000_config *const  config 
)
static

Definition at line 85 of file lm96000.c.

References config, LM96000_FAN_IN_CNT, LM96000_FAN_LOW_LIMIT, lm96000_rpm_to_tach(), and lm96000_write().

Referenced by lm96000_init().

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

◆ lm96000_set_temp_limits()

static void lm96000_set_temp_limits ( struct device *const  dev,
const struct drivers_i2c_lm96000_config *const  config 
)
static

Definition at line 64 of file lm96000.c.

References config, LM96000_TEMP_HIGH_LIMIT, LM96000_TEMP_IN_CNT, LM96000_TEMP_LOW_LIMIT, and lm96000_write().

Referenced by lm96000_init().

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

◆ lm96000_set_vin_limits()

static void lm96000_set_vin_limits ( struct device *const  dev,
const struct drivers_i2c_lm96000_config *const  config 
)
static

Definition at line 48 of file lm96000.c.

References config, lm96000_to_high_limit(), lm96000_to_low_limit(), LM96000_VIN_CNT, LM96000_VIN_HIGH_LIMIT, LM96000_VIN_LOW_LIMIT, and lm96000_write().

Referenced by lm96000_init().

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

◆ lm96000_to_duty()

static u8 lm96000_to_duty ( const u8  duty_cycle)
static

Definition at line 97 of file lm96000.c.

Referenced by lm96000_configure_pwm().

Here is the caller graph for this function:

◆ lm96000_to_high_limit()

static u8 lm96000_to_high_limit ( const enum lm96000_vin  ref,
const u16  limit 
)
static

Definition at line 41 of file lm96000.c.

References DIV_ROUND_UP, and ref_mv.

Referenced by lm96000_set_vin_limits().

Here is the caller graph for this function:

◆ lm96000_to_low_limit()

static u8 lm96000_to_low_limit ( const enum lm96000_vin  ref,
const u16  limit 
)
static

Definition at line 34 of file lm96000.c.

References ref_mv.

Referenced by lm96000_set_vin_limits().

Here is the caller graph for this function:

◆ lm96000_update()

static int lm96000_update ( struct device *const  dev,
const u8  reg,
const u8  clear_mask,
const u8  set_mask 
)
inlinestatic

Definition at line 23 of file lm96000.c.

References i2c_dev_readb_at(), i2c_dev_writeb_at(), and val.

Referenced by lm96000_configure_pwm(), lm96000_configure_temp_zone(), and lm96000_init().

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

◆ lm96000_write()

static int lm96000_write ( struct device *const  dev,
const u8  reg,
const u8  value 
)
inlinestatic

Definition at line 17 of file lm96000.c.

References i2c_dev_writeb_at(), and value.

Referenced by lm96000_configure_pwm(), lm96000_configure_temp_zone(), lm96000_set_fan_limits(), lm96000_set_temp_limits(), and lm96000_set_vin_limits().

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

Variable Documentation

◆ drivers_i2c_lm96000_ops

struct chip_operations drivers_i2c_lm96000_ops
Initial value:
= {
.enable_dev = lm96000_enable
}
static void lm96000_enable(struct device *const dev)
Definition: lm96000.c:212

Definition at line 212 of file lm96000.c.

◆ lm96000_ops

struct device_operations lm96000_ops
static
Initial value:
= {
.read_resources = noop_read_resources,
.set_resources = noop_set_resources,
.init = lm96000_init,
}
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
Definition: device.h:73
static void noop_set_resources(struct device *dev)
Definition: device.h:74
static void lm96000_init(struct device *const dev)
Definition: lm96000.c:172

Definition at line 172 of file lm96000.c.

◆ ref_mv

const unsigned int ref_mv[] = { 2500, 2250, 3300, 5000, 12000 }
static

Definition at line 32 of file lm96000.c.

Referenced by lm96000_to_high_limit(), and lm96000_to_low_limit().