Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
pc87360.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/platform_device.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon-vid.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/acpi.h>
#include <linux/io.h>

Go to the source code of this file.

Data Structures

struct  pc87360_data
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DEV   0x07 /* Register: Logical device select */
 
#define DEVID   0x20 /* Register: Device ID */
 
#define ACT   0x30 /* Register: Device activation */
 
#define BASE   0x60 /* Register: Base address */
 
#define FSCM   0x09 /* Logical device: fans */
 
#define VLM   0x0d /* Logical device: voltages */
 
#define TMS   0x0e /* Logical device: temperatures */
 
#define LDNI_MAX   3
 
#define LD_FAN   0
 
#define LD_IN   1
 
#define LD_TEMP   2
 
#define PC87360_EXTENT   0x10
 
#define PC87365_REG_BANK   0x09
 
#define NO_BANK   0xff
 
#define PC87360_REG_PRESCALE(nr)   (0x00 + 2 * (nr))
 
#define PC87360_REG_PWM(nr)   (0x01 + 2 * (nr))
 
#define PC87360_REG_FAN_MIN(nr)   (0x06 + 3 * (nr))
 
#define PC87360_REG_FAN(nr)   (0x07 + 3 * (nr))
 
#define PC87360_REG_FAN_STATUS(nr)   (0x08 + 3 * (nr))
 
#define FAN_FROM_REG(val, div)
 
#define FAN_TO_REG(val, div)
 
#define FAN_DIV_FROM_REG(val)   (1 << (((val) >> 5) & 0x03))
 
#define FAN_STATUS_FROM_REG(val)   ((val) & 0x07)
 
#define FAN_CONFIG_MONITOR(val, nr)   (((val) >> (2 + (nr) * 3)) & 1)
 
#define FAN_CONFIG_CONTROL(val, nr)   (((val) >> (3 + (nr) * 3)) & 1)
 
#define FAN_CONFIG_INVERT(val, nr)   (((val) >> (4 + (nr) * 3)) & 1)
 
#define PWM_FROM_REG(val, inv)   ((inv) ? 255 - (val) : (val))
 
#define PC87365_REG_IN_CONVRATE   0x07
 
#define PC87365_REG_IN_CONFIG   0x08
 
#define PC87365_REG_IN   0x0B
 
#define PC87365_REG_IN_MIN   0x0D
 
#define PC87365_REG_IN_MAX   0x0C
 
#define PC87365_REG_IN_STATUS   0x0A
 
#define PC87365_REG_IN_ALARMS1   0x00
 
#define PC87365_REG_IN_ALARMS2   0x01
 
#define PC87365_REG_VID   0x06
 
#define IN_FROM_REG(val, ref)   (((val) * (ref) + 128) / 256)
 
#define IN_TO_REG(val, ref)
 
#define PC87365_REG_TEMP_CONFIG   0x08
 
#define PC87365_REG_TEMP   0x0B
 
#define PC87365_REG_TEMP_MIN   0x0D
 
#define PC87365_REG_TEMP_MAX   0x0C
 
#define PC87365_REG_TEMP_CRIT   0x0E
 
#define PC87365_REG_TEMP_STATUS   0x0A
 
#define PC87365_REG_TEMP_ALARMS   0x00
 
#define TEMP_FROM_REG(val)   ((val) * 1000)
 
#define TEMP_TO_REG(val)
 
#define FAN_UNIT_ATTRS(X)
 
#define CHAN_ALM_MIN   0x02 /* min limit crossed */
 
#define CHAN_ALM_MAX   0x04 /* max limit exceeded */
 
#define TEMP_ALM_CRIT   0x08 /* temp crit exceeded (temp only) */
 
#define VIN_UNIT_ATTRS(X)
 
#define THERM_UNIT_ATTRS(X)
 
#define TEMP_FAULT   0x40 /* open diode */
 
#define TEMP_UNIT_ATTRS(X)
 
#define CHAN_CNVRTD   0x80 /* new data ready */
 
#define CHAN_ENA   0x01 /* enabled channel (temp or vin) */
 
#define CHAN_ALM_ENA   0x10 /* propagate to alarms-reg ?? (chk val!) */
 
#define CHAN_READY   (CHAN_ENA|CHAN_CNVRTD) /* sample ready mask */
 
#define TEMP_OTS_OE   0x20 /* OTS Output Enable */
 
#define VIN_RW1C_MASK   (CHAN_READY|CHAN_ALM_MAX|CHAN_ALM_MIN) /* 0x87 */
 
#define TEMP_RW1C_MASK   (VIN_RW1C_MASK|TEMP_ALM_CRIT|TEMP_FAULT) /* 0xCF */
 

Functions

 module_param (init, int, 0)
 
 MODULE_PARM_DESC (init,"Chip initialization level:\n"" 0: None\n""*1: Forcibly enable internal voltage and temperature channels, except in9\n"" 2: Forcibly enable all voltage and temperature channels, except in9\n"" 3: Forcibly enable all voltage and temperature channels, including in9")
 
 module_param (force_id, ushort, 0)
 
 MODULE_PARM_DESC (force_id,"Override the detected device ID")
 
 MODULE_AUTHOR ("Jean Delvare <[email protected]>")
 
 MODULE_DESCRIPTION ("PC8736x hardware monitor")
 
 MODULE_LICENSE ("GPL")
 
 module_init (pc87360_init)
 
 module_exit (pc87360_exit)
 

Macro Definition Documentation

#define ACT   0x30 /* Register: Device activation */

Definition at line 75 of file pc87360.c.

#define BASE   0x60 /* Register: Base address */

Definition at line 76 of file pc87360.c.

#define CHAN_ALM_ENA   0x10 /* propagate to alarms-reg ?? (chk val!) */

Definition at line 1419 of file pc87360.c.

#define CHAN_ALM_MAX   0x04 /* max limit exceeded */

Definition at line 532 of file pc87360.c.

#define CHAN_ALM_MIN   0x02 /* min limit crossed */

Definition at line 531 of file pc87360.c.

#define CHAN_CNVRTD   0x80 /* new data ready */

Definition at line 1417 of file pc87360.c.

#define CHAN_ENA   0x01 /* enabled channel (temp or vin) */

Definition at line 1418 of file pc87360.c.

#define CHAN_READY   (CHAN_ENA|CHAN_CNVRTD) /* sample ready mask */

Definition at line 1420 of file pc87360.c.

#define DEV   0x07 /* Register: Logical device select */

Definition at line 73 of file pc87360.c.

#define DEVID   0x20 /* Register: Device ID */

Definition at line 74 of file pc87360.c.

#define FAN_CONFIG_CONTROL (   val,
  nr 
)    (((val) >> (3 + (nr) * 3)) & 1)

Definition at line 133 of file pc87360.c.

#define FAN_CONFIG_INVERT (   val,
  nr 
)    (((val) >> (4 + (nr) * 3)) & 1)

Definition at line 134 of file pc87360.c.

#define FAN_CONFIG_MONITOR (   val,
  nr 
)    (((val) >> (2 + (nr) * 3)) & 1)

Definition at line 132 of file pc87360.c.

#define FAN_DIV_FROM_REG (   val)    (1 << (((val) >> 5) & 0x03))

Definition at line 129 of file pc87360.c.

#define FAN_FROM_REG (   val,
  div 
)
Value:
((val) == 0 ? 0 : \
480000 / ((val) * (div)))

Definition at line 125 of file pc87360.c.

#define FAN_STATUS_FROM_REG (   val)    ((val) & 0x07)

Definition at line 130 of file pc87360.c.

#define FAN_TO_REG (   val,
  div 
)
Value:
((val) <= 100 ? 0 : \
480000 / ((val) * (div)))

Definition at line 127 of file pc87360.c.

#define FAN_UNIT_ATTRS (   X)
Value:
{ &fan_input[X].dev_attr.attr, \
&fan_status[X].dev_attr.attr, \
&fan_div[X].dev_attr.attr, \
&fan_min[X].dev_attr.attr, \
NULL \
}

Definition at line 349 of file pc87360.c.

#define FSCM   0x09 /* Logical device: fans */

Definition at line 78 of file pc87360.c.

#define IN_FROM_REG (   val,
  ref 
)    (((val) * (ref) + 128) / 256)

Definition at line 162 of file pc87360.c.

#define IN_TO_REG (   val,
  ref 
)
Value:
((val) < 0 ? 0 : \
(val) * 256 >= (ref) * 255 ? 255 : \
((val) * 256 + (ref) / 2) / (ref))

Definition at line 163 of file pc87360.c.

#define LD_FAN   0

Definition at line 84 of file pc87360.c.

#define LD_IN   1

Definition at line 85 of file pc87360.c.

#define LD_TEMP   2

Definition at line 86 of file pc87360.c.

#define LDNI_MAX   3

Definition at line 81 of file pc87360.c.

#define NO_BANK   0xff

Definition at line 112 of file pc87360.c.

#define PC87360_EXTENT   0x10

Definition at line 110 of file pc87360.c.

#define PC87360_REG_FAN (   nr)    (0x07 + 3 * (nr))

Definition at line 122 of file pc87360.c.

#define PC87360_REG_FAN_MIN (   nr)    (0x06 + 3 * (nr))

Definition at line 121 of file pc87360.c.

#define PC87360_REG_FAN_STATUS (   nr)    (0x08 + 3 * (nr))

Definition at line 123 of file pc87360.c.

#define PC87360_REG_PRESCALE (   nr)    (0x00 + 2 * (nr))

Definition at line 119 of file pc87360.c.

#define PC87360_REG_PWM (   nr)    (0x01 + 2 * (nr))

Definition at line 120 of file pc87360.c.

#define PC87365_REG_BANK   0x09

Definition at line 111 of file pc87360.c.

#define PC87365_REG_IN   0x0B

Definition at line 154 of file pc87360.c.

#define PC87365_REG_IN_ALARMS1   0x00

Definition at line 158 of file pc87360.c.

#define PC87365_REG_IN_ALARMS2   0x01

Definition at line 159 of file pc87360.c.

#define PC87365_REG_IN_CONFIG   0x08

Definition at line 153 of file pc87360.c.

#define PC87365_REG_IN_CONVRATE   0x07

Definition at line 152 of file pc87360.c.

#define PC87365_REG_IN_MAX   0x0C

Definition at line 156 of file pc87360.c.

#define PC87365_REG_IN_MIN   0x0D

Definition at line 155 of file pc87360.c.

#define PC87365_REG_IN_STATUS   0x0A

Definition at line 157 of file pc87360.c.

#define PC87365_REG_TEMP   0x0B

Definition at line 172 of file pc87360.c.

#define PC87365_REG_TEMP_ALARMS   0x00

Definition at line 177 of file pc87360.c.

#define PC87365_REG_TEMP_CONFIG   0x08

Definition at line 171 of file pc87360.c.

#define PC87365_REG_TEMP_CRIT   0x0E

Definition at line 175 of file pc87360.c.

#define PC87365_REG_TEMP_MAX   0x0C

Definition at line 174 of file pc87360.c.

#define PC87365_REG_TEMP_MIN   0x0D

Definition at line 173 of file pc87360.c.

#define PC87365_REG_TEMP_STATUS   0x0A

Definition at line 176 of file pc87360.c.

#define PC87365_REG_VID   0x06

Definition at line 160 of file pc87360.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 36 of file pc87360.c.

#define PWM_FROM_REG (   val,
  inv 
)    ((inv) ? 255 - (val) : (val))

Definition at line 136 of file pc87360.c.

#define TEMP_ALM_CRIT   0x08 /* temp crit exceeded (temp only) */

Definition at line 533 of file pc87360.c.

#define TEMP_FAULT   0x40 /* open diode */

Definition at line 1067 of file pc87360.c.

#define TEMP_FROM_REG (   val)    ((val) * 1000)

Definition at line 179 of file pc87360.c.

#define TEMP_OTS_OE   0x20 /* OTS Output Enable */

Definition at line 1422 of file pc87360.c.

#define TEMP_RW1C_MASK   (VIN_RW1C_MASK|TEMP_ALM_CRIT|TEMP_FAULT) /* 0xCF */

Definition at line 1424 of file pc87360.c.

#define TEMP_TO_REG (   val)
Value:
((val) < -55000 ? -55 : \
(val) > 127000 ? 127 : \
(val) < 0 ? ((val) - 500) / 1000 : \
((val) + 500) / 1000)

Definition at line 180 of file pc87360.c.

#define TEMP_UNIT_ATTRS (   X)
Value:
{ &temp_input[X].dev_attr.attr, \
&temp_status[X].dev_attr.attr, \
&temp_min[X].dev_attr.attr, \
&temp_max[X].dev_attr.attr, \
&temp_crit[X].dev_attr.attr, \
&temp_min_alarm[X].dev_attr.attr, \
&temp_max_alarm[X].dev_attr.attr, \
&temp_crit_alarm[X].dev_attr.attr, \
&temp_fault[X].dev_attr.attr, \
NULL \
}

Definition at line 1082 of file pc87360.c.

#define THERM_UNIT_ATTRS (   X)
Value:
&therm_input[X].dev_attr.attr, \
&therm_status[X].dev_attr.attr, \
&therm_min[X].dev_attr.attr, \
&therm_max[X].dev_attr.attr, \
&therm_crit[X].dev_attr.attr, \
&therm_min_alarm[X].dev_attr.attr, \
&therm_max_alarm[X].dev_attr.attr, \
&therm_crit_alarm[X].dev_attr.attr

Definition at line 848 of file pc87360.c.

#define TMS   0x0e /* Logical device: temperatures */

Definition at line 80 of file pc87360.c.

#define VIN_RW1C_MASK   (CHAN_READY|CHAN_ALM_MAX|CHAN_ALM_MIN) /* 0x87 */

Definition at line 1423 of file pc87360.c.

#define VIN_UNIT_ATTRS (   X)
Value:
&in_input[X].dev_attr.attr, \
&in_status[X].dev_attr.attr, \
&in_min[X].dev_attr.attr, \
&in_max[X].dev_attr.attr, \
&in_min_alarm[X].dev_attr.attr, \
&in_max_alarm[X].dev_attr.attr

Definition at line 585 of file pc87360.c.

#define VLM   0x0d /* Logical device: voltages */

Definition at line 79 of file pc87360.c.

Function Documentation

MODULE_AUTHOR ( "Jean Delvare <[email protected]>"  )
MODULE_DESCRIPTION ( "PC8736x hardware monitor"  )
module_exit ( pc87360_exit  )
module_init ( pc87360_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( init  ,
int  ,
 
)
module_param ( force_id  ,
ushort  ,
 
)
MODULE_PARM_DESC ( init  ,
"Chip initialization level:\n"" 0: None\n""*1: Forcibly enable internal voltage and temperature  channels,
except in9\n""2:Forcibly enable all voltage and temperature  channels,
except in9\n""3:Forcibly enable all voltage and temperature  channels,
including in9"   
)
MODULE_PARM_DESC ( force_id  ,
"Override the detected device ID  
)