Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
pmbus_core.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/jiffies.h>
#include <linux/i2c/pmbus.h>
#include "pmbus.h"

Go to the source code of this file.

Data Structures

struct  pmbus_sensor
 
struct  pmbus_boolean
 
struct  pmbus_label
 
struct  pmbus_data
 
struct  pmbus_limit_attr
 
struct  pmbus_sensor_attr
 

Macros

#define PMBUS_MAX_INPUT_SENSORS   22 /* 10*volt, 7*curr, 5*power */
 
#define PMBUS_VOUT_SENSORS_PER_PAGE
 
#define PMBUS_IOUT_SENSORS_PER_PAGE
 
#define PMBUS_POUT_SENSORS_PER_PAGE
 
#define PMBUS_MAX_SENSORS_PER_FAN   1 /* input */
 
#define PMBUS_MAX_SENSORS_PER_TEMP
 
#define PMBUS_MAX_INPUT_BOOLEANS
 
#define PMBUS_VOUT_BOOLEANS_PER_PAGE
 
#define PMBUS_IOUT_BOOLEANS_PER_PAGE
 
#define PMBUS_POUT_BOOLEANS_PER_PAGE
 
#define PMBUS_MAX_BOOLEANS_PER_FAN   2 /* alarm, fault */
 
#define PMBUS_MAX_BOOLEANS_PER_TEMP
 
#define PMBUS_MAX_INPUT_LABELS   4 /* vin, vcap, iin, pin */
 
#define PB_NUM_STATUS_REG   (PMBUS_PAGES * 6 + 1)
 
#define PB_STATUS_BASE   0
 
#define PB_STATUS_VOUT_BASE   (PB_STATUS_BASE + PMBUS_PAGES)
 
#define PB_STATUS_IOUT_BASE   (PB_STATUS_VOUT_BASE + PMBUS_PAGES)
 
#define PB_STATUS_FAN_BASE   (PB_STATUS_IOUT_BASE + PMBUS_PAGES)
 
#define PB_STATUS_FAN34_BASE   (PB_STATUS_FAN_BASE + PMBUS_PAGES)
 
#define PB_STATUS_INPUT_BASE   (PB_STATUS_FAN34_BASE + PMBUS_PAGES)
 
#define PB_STATUS_TEMP_BASE   (PB_STATUS_INPUT_BASE + 1)
 
#define PMBUS_NAME_SIZE   24
 
#define MAX_MANTISSA   (1023 * 1000)
 
#define MIN_MANTISSA   (511 * 1000)
 
#define PMBUS_ADD_ATTR(data, _name, _idx, _mode, _type, _show, _set)
 
#define PMBUS_ADD_GET_ATTR(data, _name, _type, _idx)
 
#define PMBUS_ADD_SET_ATTR(data, _name, _type, _idx)
 

Functions

int pmbus_set_page (struct i2c_client *client, u8 page)
 
 EXPORT_SYMBOL_GPL (pmbus_set_page)
 
int pmbus_write_byte (struct i2c_client *client, int page, u8 value)
 
 EXPORT_SYMBOL_GPL (pmbus_write_byte)
 
int pmbus_write_word_data (struct i2c_client *client, u8 page, u8 reg, u16 word)
 
 EXPORT_SYMBOL_GPL (pmbus_write_word_data)
 
int pmbus_read_word_data (struct i2c_client *client, u8 page, u8 reg)
 
 EXPORT_SYMBOL_GPL (pmbus_read_word_data)
 
int pmbus_read_byte_data (struct i2c_client *client, int page, u8 reg)
 
 EXPORT_SYMBOL_GPL (pmbus_read_byte_data)
 
void pmbus_clear_faults (struct i2c_client *client)
 
 EXPORT_SYMBOL_GPL (pmbus_clear_faults)
 
bool pmbus_check_byte_register (struct i2c_client *client, int page, int reg)
 
 EXPORT_SYMBOL_GPL (pmbus_check_byte_register)
 
bool pmbus_check_word_register (struct i2c_client *client, int page, int reg)
 
 EXPORT_SYMBOL_GPL (pmbus_check_word_register)
 
struct pmbus_driver_infopmbus_get_driver_info (struct i2c_client *client)
 
 EXPORT_SYMBOL_GPL (pmbus_get_driver_info)
 
int pmbus_do_probe (struct i2c_client *client, const struct i2c_device_id *id, struct pmbus_driver_info *info)
 
 EXPORT_SYMBOL_GPL (pmbus_do_probe)
 
int pmbus_do_remove (struct i2c_client *client)
 
 EXPORT_SYMBOL_GPL (pmbus_do_remove)
 
 MODULE_AUTHOR ("Guenter Roeck")
 
 MODULE_DESCRIPTION ("PMBus core driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define MAX_MANTISSA   (1023 * 1000)

Definition at line 535 of file pmbus_core.c.

#define MIN_MANTISSA   (511 * 1000)

Definition at line 536 of file pmbus_core.c.

#define PB_NUM_STATUS_REG   (PMBUS_PAGES * 6 + 1)

Definition at line 56 of file pmbus_core.c.

#define PB_STATUS_BASE   0

Definition at line 61 of file pmbus_core.c.

#define PB_STATUS_FAN34_BASE   (PB_STATUS_FAN_BASE + PMBUS_PAGES)

Definition at line 65 of file pmbus_core.c.

#define PB_STATUS_FAN_BASE   (PB_STATUS_IOUT_BASE + PMBUS_PAGES)

Definition at line 64 of file pmbus_core.c.

#define PB_STATUS_INPUT_BASE   (PB_STATUS_FAN34_BASE + PMBUS_PAGES)

Definition at line 66 of file pmbus_core.c.

#define PB_STATUS_IOUT_BASE   (PB_STATUS_VOUT_BASE + PMBUS_PAGES)

Definition at line 63 of file pmbus_core.c.

#define PB_STATUS_TEMP_BASE   (PB_STATUS_INPUT_BASE + 1)

Definition at line 67 of file pmbus_core.c.

#define PB_STATUS_VOUT_BASE   (PB_STATUS_BASE + PMBUS_PAGES)

Definition at line 62 of file pmbus_core.c.

#define PMBUS_ADD_ATTR (   data,
  _name,
  _idx,
  _mode,
  _type,
  _show,
  _set 
)
Value:
do { \
= &data->_type##s[data->num_##_type##s].attribute; \
BUG_ON(data->num_attributes >= data->max_attributes); \
sysfs_attr_init(&a->dev_attr.attr); \
a->dev_attr.attr.name = _name; \
a->dev_attr.attr.mode = _mode; \
a->dev_attr.show = _show; \
a->dev_attr.store = _set; \
a->index = _idx; \
data->attributes[data->num_attributes] = &a->dev_attr.attr; \
data->num_attributes++; \
} while (0)

Definition at line 796 of file pmbus_core.c.

#define PMBUS_ADD_GET_ATTR (   data,
  _name,
  _type,
  _idx 
)
Value:
PMBUS_ADD_ATTR(data, _name, _idx, S_IRUGO, _type, \
pmbus_show_##_type, NULL)

Definition at line 811 of file pmbus_core.c.

#define PMBUS_ADD_SET_ATTR (   data,
  _name,
  _type,
  _idx 
)
Value:
PMBUS_ADD_ATTR(data, _name, _idx, S_IWUSR | S_IRUGO, _type, \
pmbus_show_##_type, pmbus_set_##_type)

Definition at line 815 of file pmbus_core.c.

#define PMBUS_IOUT_BOOLEANS_PER_PAGE
Value:
3 /* alarm, lcrit_alarm,
crit_alarm */

Definition at line 45 of file pmbus_core.c.

#define PMBUS_IOUT_SENSORS_PER_PAGE
Value:
8 /* input, min, max, crit,
lowest, highest, avg,
reset */

Definition at line 38 of file pmbus_core.c.

#define PMBUS_MAX_BOOLEANS_PER_FAN   2 /* alarm, fault */

Definition at line 47 of file pmbus_core.c.

#define PMBUS_MAX_BOOLEANS_PER_TEMP
Value:
4 /* min_alarm, max_alarm,
lcrit_alarm, crit_alarm */

Definition at line 48 of file pmbus_core.c.

#define PMBUS_MAX_INPUT_BOOLEANS
Value:
7 /* v: min_alarm, max_alarm,
lcrit_alarm, crit_alarm;
c: alarm, crit_alarm;
p: crit_alarm */

Definition at line 43 of file pmbus_core.c.

#define PMBUS_MAX_INPUT_LABELS   4 /* vin, vcap, iin, pin */

Definition at line 50 of file pmbus_core.c.

#define PMBUS_MAX_INPUT_SENSORS   22 /* 10*volt, 7*curr, 5*power */

Definition at line 36 of file pmbus_core.c.

#define PMBUS_MAX_SENSORS_PER_FAN   1 /* input */

Definition at line 40 of file pmbus_core.c.

#define PMBUS_MAX_SENSORS_PER_TEMP
Value:
9 /* input, min, max, lcrit,
* crit, lowest, highest, avg,
* reset
*/

Definition at line 41 of file pmbus_core.c.

#define PMBUS_NAME_SIZE   24

Definition at line 69 of file pmbus_core.c.

#define PMBUS_POUT_BOOLEANS_PER_PAGE
Value:
3 /* cap_alarm, alarm, crit_alarm
*/

Definition at line 46 of file pmbus_core.c.

#define PMBUS_POUT_SENSORS_PER_PAGE
Value:
7 /* input, cap, max, crit,
* highest, avg, reset
*/

Definition at line 39 of file pmbus_core.c.

#define PMBUS_VOUT_BOOLEANS_PER_PAGE
Value:
4 /* min_alarm, max_alarm,
lcrit_alarm, crit_alarm */

Definition at line 44 of file pmbus_core.c.

#define PMBUS_VOUT_SENSORS_PER_PAGE
Value:
9 /* input, min, max, lcrit,
crit, lowest, highest, avg,
reset */

Definition at line 37 of file pmbus_core.c.

Function Documentation

EXPORT_SYMBOL_GPL ( pmbus_set_page  )
EXPORT_SYMBOL_GPL ( pmbus_write_byte  )
EXPORT_SYMBOL_GPL ( pmbus_write_word_data  )
EXPORT_SYMBOL_GPL ( pmbus_read_word_data  )
EXPORT_SYMBOL_GPL ( pmbus_read_byte_data  )
EXPORT_SYMBOL_GPL ( pmbus_clear_faults  )
EXPORT_SYMBOL_GPL ( pmbus_check_byte_register  )
EXPORT_SYMBOL_GPL ( pmbus_check_word_register  )
EXPORT_SYMBOL_GPL ( pmbus_get_driver_info  )
EXPORT_SYMBOL_GPL ( pmbus_do_probe  )
EXPORT_SYMBOL_GPL ( pmbus_do_remove  )
MODULE_AUTHOR ( "Guenter Roeck"  )
MODULE_DESCRIPTION ( "PMBus core driver )
MODULE_LICENSE ( "GPL"  )
bool pmbus_check_byte_register ( struct i2c_client client,
int  page,
int  reg 
)

Definition at line 316 of file pmbus_core.c.

bool pmbus_check_word_register ( struct i2c_client client,
int  page,
int  reg 
)

Definition at line 329 of file pmbus_core.c.

void pmbus_clear_faults ( struct i2c_client client)

Definition at line 293 of file pmbus_core.c.

int pmbus_do_probe ( struct i2c_client client,
const struct i2c_device_id id,
struct pmbus_driver_info info 
)

Definition at line 1665 of file pmbus_core.c.

int pmbus_do_remove ( struct i2c_client client)

Definition at line 1784 of file pmbus_core.c.

struct pmbus_driver_info* pmbus_get_driver_info ( struct i2c_client client)
read

Definition at line 342 of file pmbus_core.c.

int pmbus_read_byte_data ( struct i2c_client client,
int  page,
u8  reg 
)

Definition at line 256 of file pmbus_core.c.

int pmbus_read_word_data ( struct i2c_client client,
u8  page,
u8  reg 
)

Definition at line 224 of file pmbus_core.c.

int pmbus_set_page ( struct i2c_client client,
u8  page 
)

Definition at line 141 of file pmbus_core.c.

int pmbus_write_byte ( struct i2c_client client,
int  page,
u8  value 
)

Definition at line 159 of file pmbus_core.c.

int pmbus_write_word_data ( struct i2c_client client,
u8  page,
u8  reg,
u16  word 
)

Definition at line 191 of file pmbus_core.c.