Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
vt1211.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/ioport.h>
#include <linux/acpi.h>
#include <linux/io.h>

Go to the source code of this file.

Data Structures

struct  vt1211_data
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DRVNAME   "vt1211"
 
#define VT1211_REG_IN(ix)   (0x21 + (ix))
 
#define VT1211_REG_IN_MIN(ix)   ((ix) == 0 ? 0x3e : 0x2a + 2 * (ix))
 
#define VT1211_REG_IN_MAX(ix)   ((ix) == 0 ? 0x3d : 0x29 + 2 * (ix))
 
#define VT1211_REG_FAN(ix)   (0x29 + (ix))
 
#define VT1211_REG_FAN_MIN(ix)   (0x3b + (ix))
 
#define VT1211_REG_FAN_DIV   0x47
 
#define VT1211_REG_PWM(ix)   (0x60 + (ix))
 
#define VT1211_REG_PWM_CLK   0x50
 
#define VT1211_REG_PWM_CTL   0x51
 
#define VT1211_REG_PWM_AUTO_TEMP(ap)   (0x55 - (ap))
 
#define VT1211_REG_PWM_AUTO_PWM(ix, ap)   (0x58 + 2 * (ix) - (ap))
 
#define VT1211_REG_CONFIG   0x40
 
#define VT1211_REG_ALARM1   0x41
 
#define VT1211_REG_ALARM2   0x42
 
#define VT1211_REG_VID   0x45
 
#define VT1211_REG_UCH_CONFIG   0x4a
 
#define VT1211_REG_TEMP1_CONFIG   0x4b
 
#define VT1211_REG_TEMP2_CONFIG   0x4c
 
#define ISVOLT(ix, uch_config)
 
#define ISTEMP(ix, uch_config)
 
#define IN_FROM_REG(ix, reg)
 
#define IN_TO_REG(ix, val)
 
#define TEMP_FROM_REG(ix, reg)
 
#define TEMP_TO_REG(ix, val)
 
#define DIV_FROM_REG(reg)   (1 << (reg))
 
#define RPM_FROM_REG(reg, div)
 
#define RPM_TO_REG(val, div)
 
#define SIO_REG_CIP1   0x2e
 
#define SIO_REG_CIP2   0x4e
 
#define SIO_VT1211_LDN   0x07 /* logical device number */
 
#define SIO_VT1211_DEVID   0x20 /* device ID */
 
#define SIO_VT1211_DEVREV   0x21 /* device revision */
 
#define SIO_VT1211_ACTIVE   0x30 /* HW monitor active */
 
#define SIO_VT1211_BADDR   0x60 /* base I/O address */
 
#define SIO_VT1211_ID   0x3c /* VT1211 device ID */
 
#define SIO_VT1211_LDN_HWMON   0x0b /* HW monitor */
 
#define SHOW_IN_INPUT   0
 
#define SHOW_SET_IN_MIN   1
 
#define SHOW_SET_IN_MAX   2
 
#define SHOW_IN_ALARM   3
 
#define SHOW_TEMP_INPUT   0
 
#define SHOW_SET_TEMP_MAX   1
 
#define SHOW_SET_TEMP_MAX_HYST   2
 
#define SHOW_TEMP_ALARM   3
 
#define SHOW_FAN_INPUT   0
 
#define SHOW_SET_FAN_MIN   1
 
#define SHOW_SET_FAN_DIV   2
 
#define SHOW_FAN_ALARM   3
 
#define SHOW_PWM   0
 
#define SHOW_SET_PWM_ENABLE   1
 
#define SHOW_SET_PWM_FREQ   2
 
#define SHOW_SET_PWM_AUTO_CHANNELS_TEMP   3
 
#define SENSOR_ATTR_IN(ix)
 
#define IN_UNIT_ATTRS(X)
 
#define SENSOR_ATTR_TEMP(ix)
 
#define TEMP_UNIT_ATTRS(X)
 
#define SENSOR_ATTR_FAN(ix)
 
#define SENSOR_ATTR_PWM(ix)
 
#define SENSOR_ATTR_PWM_FREQ(ix)
 
#define SENSOR_ATTR_PWM_FREQ_RO(ix)
 
#define SENSOR_ATTR_PWM_AUTO_POINT_TEMP(ix, ap)
 
#define SENSOR_ATTR_PWM_AUTO_POINT_TEMP_RO(ix, ap)
 
#define SENSOR_ATTR_PWM_AUTO_POINT_PWM(ix, ap)
 
#define SENSOR_ATTR_PWM_AUTO_POINT_PWM_RO(ix, ap)
 

Functions

 module_param (uch_config, int, 0)
 
 MODULE_PARM_DESC (uch_config,"Initialize the universal channel configuration")
 
 module_param (int_mode, int, 0)
 
 MODULE_PARM_DESC (int_mode,"Force the temperature interrupt mode")
 
 module_param (force_id, ushort, 0)
 
 MODULE_PARM_DESC (force_id,"Override the detected device ID")
 
 MODULE_AUTHOR ("Juerg Haefliger <[email protected]>")
 
 MODULE_DESCRIPTION ("VT1211 sensors")
 
 MODULE_LICENSE ("GPL")
 
 module_init (vt1211_init)
 
 module_exit (vt1211_exit)
 

Macro Definition Documentation

#define DIV_FROM_REG (   reg)    (1 << (reg))

Definition at line 181 of file vt1211.c.

#define DRVNAME   "vt1211"

Definition at line 54 of file vt1211.c.

#define IN_FROM_REG (   ix,
  reg 
)
Value:
((reg) < 3 ? 0 : (ix) == 5 ? \
(((reg) - 3) * 15882 + 479) / 958 : \
(((reg) - 3) * 10000 + 479) / 958)

Definition at line 158 of file vt1211.c.

#define IN_TO_REG (   ix,
  val 
)
Value:
(SENSORS_LIMIT((ix) == 5 ? \
((val) * 958 + 7941) / 15882 + 3 : \
((val) * 958 + 5000) / 10000 + 3, 0, 255))

Definition at line 161 of file vt1211.c.

#define IN_UNIT_ATTRS (   X)
Value:
{ &vt1211_sysfs_in[X][0].dev_attr.attr, \
&vt1211_sysfs_in[X][1].dev_attr.attr, \
&vt1211_sysfs_in[X][2].dev_attr.attr, \
&vt1211_sysfs_in[X][3].dev_attr.attr, \
NULL \
}

Definition at line 932 of file vt1211.c.

#define ISTEMP (   ix,
  uch_config 
)
Value:
((ix) < 2 ? 1 : \
((uch_config) >> (ix)) & 1)

Definition at line 151 of file vt1211.c.

#define ISVOLT (   ix,
  uch_config 
)
Value:
((ix) > 4 ? 1 : \
!(((uch_config) >> ((ix) + 2)) & 1))

Definition at line 147 of file vt1211.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 24 of file vt1211.c.

#define RPM_FROM_REG (   reg,
  div 
)
Value:
(((reg) == 0) || ((reg) == 255) ? 0 : \
1310720 / (reg) / DIV_FROM_REG(div))

Definition at line 183 of file vt1211.c.

#define RPM_TO_REG (   val,
  div 
)
Value:
((val) == 0 ? 255 : \
SENSORS_LIMIT((1310720 / (val) / \
DIV_FROM_REG(div)), 1, 254))

Definition at line 185 of file vt1211.c.

#define SENSOR_ATTR_FAN (   ix)
Value:
SENSOR_ATTR_2(fan##ix##_input, S_IRUGO, \
SENSOR_ATTR_2(fan##ix##_min, S_IRUGO | S_IWUSR, \
SENSOR_ATTR_2(fan##ix##_div, S_IRUGO | S_IWUSR, \
SENSOR_ATTR_2(fan##ix##_alarm, S_IRUGO, \

Definition at line 1007 of file vt1211.c.

#define SENSOR_ATTR_IN (   ix)
Value:
{ SENSOR_ATTR_2(in##ix##_input, S_IRUGO, \
SENSOR_ATTR_2(in##ix##_min, S_IRUGO | S_IWUSR, \
SENSOR_ATTR_2(in##ix##_max, S_IRUGO | S_IWUSR, \
SENSOR_ATTR_2(in##ix##_alarm, S_IRUGO, \
}

Definition at line 912 of file vt1211.c.

#define SENSOR_ATTR_PWM (   ix)
Value:
show_pwm, NULL, SHOW_PWM, ix-1), \
SENSOR_ATTR_2(pwm##ix##_enable, S_IRUGO | S_IWUSR, \
show_pwm, set_pwm, SHOW_SET_PWM_ENABLE, ix-1), \
SENSOR_ATTR_2(pwm##ix##_auto_channels_temp, S_IRUGO | S_IWUSR, \
show_pwm, set_pwm, SHOW_SET_PWM_AUTO_CHANNELS_TEMP, ix-1)

Definition at line 1017 of file vt1211.c.

#define SENSOR_ATTR_PWM_AUTO_POINT_PWM (   ix,
  ap 
)
Value:
SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_pwm, S_IRUGO | S_IWUSR, \
show_pwm_auto_point_pwm, set_pwm_auto_point_pwm, \
ap-1, ix-1)

Definition at line 1043 of file vt1211.c.

#define SENSOR_ATTR_PWM_AUTO_POINT_PWM_RO (   ix,
  ap 
)
Value:
SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_pwm, S_IRUGO, \
show_pwm_auto_point_pwm, NULL, \
ap-1, ix-1)

Definition at line 1048 of file vt1211.c.

#define SENSOR_ATTR_PWM_AUTO_POINT_TEMP (   ix,
  ap 
)
Value:
SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_temp, S_IRUGO | S_IWUSR, \
show_pwm_auto_point_temp, set_pwm_auto_point_temp, \
ap-1, ix-1)

Definition at line 1033 of file vt1211.c.

#define SENSOR_ATTR_PWM_AUTO_POINT_TEMP_RO (   ix,
  ap 
)
Value:
SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_temp, S_IRUGO, \
show_pwm_auto_point_temp, NULL, \
ap-1, ix-1)

Definition at line 1038 of file vt1211.c.

#define SENSOR_ATTR_PWM_FREQ (   ix)
Value:
SENSOR_ATTR_2(pwm##ix##_freq, S_IRUGO | S_IWUSR, \
show_pwm, set_pwm, SHOW_SET_PWM_FREQ, ix-1)

Definition at line 1025 of file vt1211.c.

#define SENSOR_ATTR_PWM_FREQ_RO (   ix)
Value:
SENSOR_ATTR_2(pwm##ix##_freq, S_IRUGO, \
show_pwm, NULL, SHOW_SET_PWM_FREQ, ix-1)

Definition at line 1029 of file vt1211.c.

#define SENSOR_ATTR_TEMP (   ix)
Value:
{ SENSOR_ATTR_2(temp##ix##_input, S_IRUGO, \
SENSOR_ATTR_2(temp##ix##_max, S_IRUGO | S_IWUSR, \
SENSOR_ATTR_2(temp##ix##_max_hyst, S_IRUGO | S_IWUSR, \
SENSOR_ATTR_2(temp##ix##_alarm, S_IRUGO, \
}

Definition at line 958 of file vt1211.c.

#define SHOW_FAN_ALARM   3

Definition at line 495 of file vt1211.c.

#define SHOW_FAN_INPUT   0

Definition at line 492 of file vt1211.c.

#define SHOW_IN_ALARM   3

Definition at line 345 of file vt1211.c.

#define SHOW_IN_INPUT   0

Definition at line 342 of file vt1211.c.

#define SHOW_PWM   0

Definition at line 597 of file vt1211.c.

#define SHOW_SET_FAN_DIV   2

Definition at line 494 of file vt1211.c.

#define SHOW_SET_FAN_MIN   1

Definition at line 493 of file vt1211.c.

#define SHOW_SET_IN_MAX   2

Definition at line 344 of file vt1211.c.

#define SHOW_SET_IN_MIN   1

Definition at line 343 of file vt1211.c.

#define SHOW_SET_PWM_AUTO_CHANNELS_TEMP   3

Definition at line 600 of file vt1211.c.

#define SHOW_SET_PWM_ENABLE   1

Definition at line 598 of file vt1211.c.

#define SHOW_SET_PWM_FREQ   2

Definition at line 599 of file vt1211.c.

#define SHOW_SET_TEMP_MAX   1

Definition at line 417 of file vt1211.c.

#define SHOW_SET_TEMP_MAX_HYST   2

Definition at line 418 of file vt1211.c.

#define SHOW_TEMP_ALARM   3

Definition at line 419 of file vt1211.c.

#define SHOW_TEMP_INPUT   0

Definition at line 416 of file vt1211.c.

#define SIO_REG_CIP1   0x2e

Definition at line 197 of file vt1211.c.

#define SIO_REG_CIP2   0x4e

Definition at line 198 of file vt1211.c.

#define SIO_VT1211_ACTIVE   0x30 /* HW monitor active */

Definition at line 204 of file vt1211.c.

#define SIO_VT1211_BADDR   0x60 /* base I/O address */

Definition at line 205 of file vt1211.c.

#define SIO_VT1211_DEVID   0x20 /* device ID */

Definition at line 202 of file vt1211.c.

#define SIO_VT1211_DEVREV   0x21 /* device revision */

Definition at line 203 of file vt1211.c.

#define SIO_VT1211_ID   0x3c /* VT1211 device ID */

Definition at line 206 of file vt1211.c.

#define SIO_VT1211_LDN   0x07 /* logical device number */

Definition at line 201 of file vt1211.c.

#define SIO_VT1211_LDN_HWMON   0x0b /* HW monitor */

Definition at line 209 of file vt1211.c.

#define TEMP_FROM_REG (   ix,
  reg 
)
Value:
((ix) == 0 ? (reg) * 1000 : \
(ix) == 1 ? (reg) < 51 ? 0 : \
((reg) - 51) * 1000 : \
((253 - (reg)) * 2200 + 105) / 210)

Definition at line 172 of file vt1211.c.

#define TEMP_TO_REG (   ix,
  val 
)
Value:
SENSORS_LIMIT( \
((ix) == 0 ? ((val) + 500) / 1000 : \
(ix) == 1 ? ((val) + 500) / 1000 + 51 : \
253 - ((val) * 210 + 1100) / 2200), 0, 255)

Definition at line 176 of file vt1211.c.

#define TEMP_UNIT_ATTRS (   X)
Value:
{ &vt1211_sysfs_temp[X][0].dev_attr.attr, \
&vt1211_sysfs_temp[X][1].dev_attr.attr, \
&vt1211_sysfs_temp[X][2].dev_attr.attr, \
&vt1211_sysfs_temp[X][3].dev_attr.attr, \
NULL \
}

Definition at line 979 of file vt1211.c.

#define VT1211_REG_ALARM1   0x41

Definition at line 99 of file vt1211.c.

#define VT1211_REG_ALARM2   0x42

Definition at line 100 of file vt1211.c.

#define VT1211_REG_CONFIG   0x40

Definition at line 98 of file vt1211.c.

#define VT1211_REG_FAN (   ix)    (0x29 + (ix))

Definition at line 85 of file vt1211.c.

#define VT1211_REG_FAN_DIV   0x47

Definition at line 87 of file vt1211.c.

#define VT1211_REG_FAN_MIN (   ix)    (0x3b + (ix))

Definition at line 86 of file vt1211.c.

#define VT1211_REG_IN (   ix)    (0x21 + (ix))

Definition at line 75 of file vt1211.c.

#define VT1211_REG_IN_MAX (   ix)    ((ix) == 0 ? 0x3d : 0x29 + 2 * (ix))

Definition at line 77 of file vt1211.c.

#define VT1211_REG_IN_MIN (   ix)    ((ix) == 0 ? 0x3e : 0x2a + 2 * (ix))

Definition at line 76 of file vt1211.c.

#define VT1211_REG_PWM (   ix)    (0x60 + (ix))

Definition at line 91 of file vt1211.c.

#define VT1211_REG_PWM_AUTO_PWM (   ix,
  ap 
)    (0x58 + 2 * (ix) - (ap))

Definition at line 95 of file vt1211.c.

#define VT1211_REG_PWM_AUTO_TEMP (   ap)    (0x55 - (ap))

Definition at line 94 of file vt1211.c.

#define VT1211_REG_PWM_CLK   0x50

Definition at line 92 of file vt1211.c.

#define VT1211_REG_PWM_CTL   0x51

Definition at line 93 of file vt1211.c.

#define VT1211_REG_TEMP1_CONFIG   0x4b

Definition at line 103 of file vt1211.c.

#define VT1211_REG_TEMP2_CONFIG   0x4c

Definition at line 104 of file vt1211.c.

#define VT1211_REG_UCH_CONFIG   0x4a

Definition at line 102 of file vt1211.c.

#define VT1211_REG_VID   0x45

Definition at line 101 of file vt1211.c.

Function Documentation

MODULE_AUTHOR ( "Juerg Haefliger <[email protected]>"  )
MODULE_DESCRIPTION ( "VT1211 sensors )
module_exit ( vt1211_exit  )
module_init ( vt1211_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( uch_config  ,
int  ,
 
)
module_param ( int_mode  ,
int  ,
 
)
module_param ( force_id  ,
ushort  ,
 
)
MODULE_PARM_DESC ( uch_config  ,
"Initialize the universal channel configuration"   
)
MODULE_PARM_DESC ( int_mode  ,
"Force the temperature interrupt mode  
)
MODULE_PARM_DESC ( force_id  ,
"Override the detected device ID  
)