#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.
|
#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) |
|
#define DIV_FROM_REG |
( |
|
reg | ) |
(1 << (reg)) |
#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 |
#define RPM_FROM_REG |
( |
|
reg, |
|
|
|
div |
|
) |
| |
Value:(((
reg) == 0) || ((
reg) == 255) ? 0 : \
Definition at line 183 of file vt1211.c.
#define RPM_TO_REG |
( |
|
val, |
|
|
|
div |
|
) |
| |
Value:
SENSORS_LIMIT((1310720 / (
val) / \
Definition at line 185 of file vt1211.c.
#define SENSOR_ATTR_FAN |
( |
|
ix | ) |
|
#define SENSOR_ATTR_IN |
( |
|
ix | ) |
|
#define SENSOR_ATTR_PWM |
( |
|
ix | ) |
|
#define SENSOR_ATTR_PWM_AUTO_POINT_PWM |
( |
|
ix, |
|
|
|
ap |
|
) |
| |
Value:
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:
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:
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:
show_pwm_auto_point_temp,
NULL, \
ap-1, ix-1)
Definition at line 1038 of file vt1211.c.
#define SENSOR_ATTR_PWM_FREQ |
( |
|
ix | ) |
|
#define SENSOR_ATTR_PWM_FREQ_RO |
( |
|
ix | ) |
|
#define SENSOR_ATTR_TEMP |
( |
|
ix | ) |
|
#define SHOW_SET_FAN_DIV 2 |
#define SHOW_SET_FAN_MIN 1 |
#define SHOW_SET_IN_MAX 2 |
#define SHOW_SET_IN_MIN 1 |
#define SHOW_SET_PWM_AUTO_CHANNELS_TEMP 3 |
#define SHOW_SET_PWM_ENABLE 1 |
#define SHOW_SET_PWM_FREQ 2 |
#define SHOW_SET_TEMP_MAX 1 |
#define SHOW_SET_TEMP_MAX_HYST 2 |
#define SHOW_TEMP_ALARM 3 |
#define SHOW_TEMP_INPUT 0 |
#define SIO_REG_CIP1 0x2e |
#define SIO_REG_CIP2 0x4e |
#define SIO_VT1211_ACTIVE 0x30 /* HW monitor active */ |
#define SIO_VT1211_BADDR 0x60 /* base I/O address */ |
#define SIO_VT1211_DEVID 0x20 /* device ID */ |
#define SIO_VT1211_DEVREV 0x21 /* device revision */ |
#define SIO_VT1211_ID 0x3c /* VT1211 device ID */ |
#define SIO_VT1211_LDN 0x07 /* logical device number */ |
#define SIO_VT1211_LDN_HWMON 0x0b /* HW monitor */ |
#define TEMP_FROM_REG |
( |
|
ix, |
|
|
|
reg |
|
) |
| |
Value:((ix) == 0 ? (
reg) * 1000 : \
(ix) == 1 ? (
reg) < 51 ? 0 : \
((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 |
#define VT1211_REG_ALARM2 0x42 |
#define VT1211_REG_CONFIG 0x40 |
#define VT1211_REG_FAN |
( |
|
ix | ) |
(0x29 + (ix)) |
#define VT1211_REG_FAN_DIV 0x47 |
#define VT1211_REG_FAN_MIN |
( |
|
ix | ) |
(0x3b + (ix)) |
#define VT1211_REG_IN |
( |
|
ix | ) |
(0x21 + (ix)) |
#define VT1211_REG_IN_MAX |
( |
|
ix | ) |
((ix) == 0 ? 0x3d : 0x29 + 2 * (ix)) |
#define VT1211_REG_IN_MIN |
( |
|
ix | ) |
((ix) == 0 ? 0x3e : 0x2a + 2 * (ix)) |
#define VT1211_REG_PWM |
( |
|
ix | ) |
(0x60 + (ix)) |
#define VT1211_REG_PWM_AUTO_PWM |
( |
|
ix, |
|
|
|
ap |
|
) |
| (0x58 + 2 * (ix) - (ap)) |
#define VT1211_REG_PWM_AUTO_TEMP |
( |
|
ap | ) |
(0x55 - (ap)) |
#define VT1211_REG_PWM_CLK 0x50 |
#define VT1211_REG_PWM_CTL 0x51 |
#define VT1211_REG_TEMP1_CONFIG 0x4b |
#define VT1211_REG_TEMP2_CONFIG 0x4c |
#define VT1211_REG_UCH_CONFIG 0x4a |
#define VT1211_REG_VID 0x45 |
MODULE_DESCRIPTION |
( |
"VT1211 sensors" |
| ) |
|
module_exit |
( |
vt1211_exit |
| ) |
|
module_init |
( |
vt1211_init |
| ) |
|
module_param |
( |
uch_config |
, |
|
|
int |
, |
|
|
0 |
|
|
) |
| |
module_param |
( |
force_id |
, |
|
|
ushort |
, |
|
|
0 |
|
|
) |
| |
MODULE_PARM_DESC |
( |
uch_config |
, |
|
|
"Initialize the universal channel configuration" |
|
|
) |
| |
MODULE_PARM_DESC |
( |
force_id |
, |
|
|
"Override the detected device ID" |
|
|
) |
| |