Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
w83627ehf.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>
#include "lm75.h"

Go to the source code of this file.

Data Structures

struct  w83627ehf_data
 
struct  w83627ehf_sio_data
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DRVNAME   "w83627ehf"
 
#define W83627EHF_LD_HWM   0x0b
 
#define W83667HG_LD_VID   0x0d
 
#define SIO_REG_LDSEL   0x07 /* Logical device select */
 
#define SIO_REG_DEVID   0x20 /* Device ID (2 bytes) */
 
#define SIO_REG_EN_VRM10   0x2C /* GPIO3, GPIO4 selection */
 
#define SIO_REG_ENABLE   0x30 /* Logical device enable */
 
#define SIO_REG_ADDR   0x60 /* Logical device address (2 bytes) */
 
#define SIO_REG_VID_CTRL   0xF0 /* VID control */
 
#define SIO_REG_VID_DATA   0xF1 /* VID data */
 
#define SIO_W83627EHF_ID   0x8850
 
#define SIO_W83627EHG_ID   0x8860
 
#define SIO_W83627DHG_ID   0xa020
 
#define SIO_W83627DHG_P_ID   0xb070
 
#define SIO_W83627UHG_ID   0xa230
 
#define SIO_W83667HG_ID   0xa510
 
#define SIO_W83667HG_B_ID   0xb350
 
#define SIO_NCT6775_ID   0xb470
 
#define SIO_NCT6776_ID   0xc330
 
#define SIO_ID_MASK   0xFFF0
 
#define IOREGION_ALIGNMENT   (~7)
 
#define IOREGION_OFFSET   5
 
#define IOREGION_LENGTH   2
 
#define ADDR_REG_OFFSET   0
 
#define DATA_REG_OFFSET   1
 
#define W83627EHF_REG_BANK   0x4E
 
#define W83627EHF_REG_CONFIG   0x40
 
#define W83627EHF_REG_IN_MAX(nr)
 
#define W83627EHF_REG_IN_MIN(nr)
 
#define W83627EHF_REG_IN(nr)
 
#define W83627EHF_REG_FANDIV1   0x47
 
#define W83627EHF_REG_FANDIV2   0x4B
 
#define W83627EHF_REG_VBAT   0x5D
 
#define W83627EHF_REG_DIODE   0x59
 
#define W83627EHF_REG_SMI_OVT   0x4C
 
#define NCT6775_REG_FANDIV1   0x506
 
#define NCT6775_REG_FANDIV2   0x507
 
#define NCT6775_REG_FAN_DEBOUNCE   0xf0
 
#define W83627EHF_REG_ALARM1   0x459
 
#define W83627EHF_REG_ALARM2   0x45A
 
#define W83627EHF_REG_ALARM3   0x45B
 
#define W83627EHF_REG_CASEOPEN_DET   0x42 /* SMI STATUS #2 */
 
#define W83627EHF_REG_CASEOPEN_CLR   0x46 /* SMI MASK #3 */
 
#define W83627EHF_REG_FAN_STEPUP_TIME   0x0f
 
#define W83627EHF_REG_FAN_STEPDOWN_TIME   0x0e
 
#define NUM_REG_TEMP   ARRAY_SIZE(NCT6775_REG_TEMP)
 
#define show_in_reg(reg)
 
#define store_in_reg(REG, reg)
 
#define show_temp_reg(addr, reg)
 
#define store_temp_reg(addr, reg)
 
#define show_pwm_reg(reg)
 
#define show_tol_temp(reg)
 
#define fan_functions(reg, REG)
 
#define fan_time_functions(reg, REG)
 

Enumerations

enum  kinds {
  f71805f, f71872f, w83627ehf, w83627dhg,
  w83627dhg_p, w83627uhg, w83667hg, w83667hg_b,
  nct6775, nct6776
}
 

Functions

 module_param (force_id, ushort, 0)
 
 MODULE_PARM_DESC (force_id,"Override the detected device ID")
 
 module_param (fan_debounce, ushort, 0)
 
 MODULE_PARM_DESC (fan_debounce,"Enable debouncing for fan RPM signal")
 
 show_in_reg (in)
 
 show_temp_reg (reg_temp, temp)
 
 show_temp_reg (reg_temp_over, temp_max)
 
 show_temp_reg (reg_temp_hyst, temp_max_hyst)
 
 store_temp_reg (reg_temp_over, temp_max)
 
 store_temp_reg (reg_temp_hyst, temp_max_hyst)
 
 show_pwm_reg (pwm_mode)
 
 show_tol_temp (tolerance)
 
 fan_functions (fan_start_output, FAN_START_OUTPUT)
 
 MODULE_AUTHOR ("Jean Delvare <[email protected]>")
 
 MODULE_DESCRIPTION ("W83627EHF driver")
 
 MODULE_LICENSE ("GPL")
 
 module_init (sensors_w83627ehf_init)
 
 module_exit (sensors_w83627ehf_exit)
 

Macro Definition Documentation

#define ADDR_REG_OFFSET   0

Definition at line 160 of file w83627ehf.c.

#define DATA_REG_OFFSET   1

Definition at line 161 of file w83627ehf.c.

#define DRVNAME   "w83627ehf"

Definition at line 89 of file w83627ehf.c.

#define fan_functions (   reg,
  REG 
)
Value:
static ssize_t show_##reg(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct w83627ehf_data *data = w83627ehf_update_device(dev); \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
return sprintf(buf, "%d\n", data->reg[nr]); \
} \
static ssize_t \
store_##reg(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
unsigned long val; \
int err; \
err = kstrtoul(buf, 10, &val); \
if (err < 0) \
return err; \
val = SENSORS_LIMIT(val, 1, 255); \
mutex_lock(&data->update_lock); \
data->reg[nr] = val; \
w83627ehf_write_value(data, data->REG_##REG[nr], val); \
mutex_unlock(&data->update_lock); \
return count; \
}

Definition at line 1610 of file w83627ehf.c.

#define fan_time_functions (   reg,
  REG 
)
#define IOREGION_ALIGNMENT   (~7)

Definition at line 157 of file w83627ehf.c.

#define IOREGION_LENGTH   2

Definition at line 159 of file w83627ehf.c.

#define IOREGION_OFFSET   5

Definition at line 158 of file w83627ehf.c.

#define NCT6775_REG_FAN_DEBOUNCE   0xf0

Definition at line 200 of file w83627ehf.c.

#define NCT6775_REG_FANDIV1   0x506

Definition at line 198 of file w83627ehf.c.

#define NCT6775_REG_FANDIV2   0x507

Definition at line 199 of file w83627ehf.c.

#define NUM_REG_TEMP   ARRAY_SIZE(NCT6775_REG_TEMP)

Definition at line 328 of file w83627ehf.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 48 of file w83627ehf.c.

#define show_in_reg (   reg)
Value:
static ssize_t \
show_##reg(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct w83627ehf_data *data = w83627ehf_update_device(dev); \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
return sprintf(buf, "%ld\n", in_from_reg(data->reg[nr], nr, \
data->scale_in)); \
}

Definition at line 928 of file w83627ehf.c.

#define show_pwm_reg (   reg)
Value:
static ssize_t show_##reg(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct w83627ehf_data *data = w83627ehf_update_device(dev); \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
return sprintf(buf, "%d\n", data->reg[nr]); \
}

Definition at line 1366 of file w83627ehf.c.

#define show_temp_reg (   addr,
  reg 
)
Value:
static ssize_t \
show_##reg(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct w83627ehf_data *data = w83627ehf_update_device(dev); \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
return sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(data->reg[nr])); \
}

Definition at line 1199 of file w83627ehf.c.

#define show_tol_temp (   reg)
Value:
static ssize_t show_##reg(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct w83627ehf_data *data = w83627ehf_update_device(dev); \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
return sprintf(buf, "%d\n", data->reg[nr] * 1000); \
}

Definition at line 1480 of file w83627ehf.c.

#define SIO_ID_MASK   0xFFF0

Definition at line 115 of file w83627ehf.c.

#define SIO_NCT6775_ID   0xb470

Definition at line 113 of file w83627ehf.c.

#define SIO_NCT6776_ID   0xc330

Definition at line 114 of file w83627ehf.c.

#define SIO_REG_ADDR   0x60 /* Logical device address (2 bytes) */

Definition at line 102 of file w83627ehf.c.

#define SIO_REG_DEVID   0x20 /* Device ID (2 bytes) */

Definition at line 99 of file w83627ehf.c.

#define SIO_REG_EN_VRM10   0x2C /* GPIO3, GPIO4 selection */

Definition at line 100 of file w83627ehf.c.

#define SIO_REG_ENABLE   0x30 /* Logical device enable */

Definition at line 101 of file w83627ehf.c.

#define SIO_REG_LDSEL   0x07 /* Logical device select */

Definition at line 98 of file w83627ehf.c.

#define SIO_REG_VID_CTRL   0xF0 /* VID control */

Definition at line 103 of file w83627ehf.c.

#define SIO_REG_VID_DATA   0xF1 /* VID data */

Definition at line 104 of file w83627ehf.c.

#define SIO_W83627DHG_ID   0xa020

Definition at line 108 of file w83627ehf.c.

#define SIO_W83627DHG_P_ID   0xb070

Definition at line 109 of file w83627ehf.c.

#define SIO_W83627EHF_ID   0x8850

Definition at line 106 of file w83627ehf.c.

#define SIO_W83627EHG_ID   0x8860

Definition at line 107 of file w83627ehf.c.

#define SIO_W83627UHG_ID   0xa230

Definition at line 110 of file w83627ehf.c.

#define SIO_W83667HG_B_ID   0xb350

Definition at line 112 of file w83627ehf.c.

#define SIO_W83667HG_ID   0xa510

Definition at line 111 of file w83627ehf.c.

#define store_in_reg (   REG,
  reg 
)
Value:
static ssize_t \
store_in_##reg(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
unsigned long val; \
int err; \
err = kstrtoul(buf, 10, &val); \
if (err < 0) \
return err; \
mutex_lock(&data->update_lock); \
data->in_##reg[nr] = in_to_reg(val, nr, data->scale_in); \
w83627ehf_write_value(data, W83627EHF_REG_IN_##REG(nr), \
data->in_##reg[nr]); \
mutex_unlock(&data->update_lock); \
return count; \
}
#define store_temp_reg (   addr,
  reg 
)
Value:
static ssize_t \
store_##reg(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
to_sensor_dev_attr(attr); \
int nr = sensor_attr->index; \
int err; \
long val; \
err = kstrtol(buf, 10, &val); \
if (err < 0) \
return err; \
mutex_lock(&data->update_lock); \
data->reg[nr] = LM75_TEMP_TO_REG(val); \
w83627ehf_write_temp(data, data->addr[nr], data->reg[nr]); \
mutex_unlock(&data->update_lock); \
return count; \
}

Definition at line 1214 of file w83627ehf.c.

#define W83627EHF_LD_HWM   0x0b

Definition at line 95 of file w83627ehf.c.

#define W83627EHF_REG_ALARM1   0x459

Definition at line 202 of file w83627ehf.c.

#define W83627EHF_REG_ALARM2   0x45A

Definition at line 203 of file w83627ehf.c.

#define W83627EHF_REG_ALARM3   0x45B

Definition at line 204 of file w83627ehf.c.

#define W83627EHF_REG_BANK   0x4E

Definition at line 163 of file w83627ehf.c.

#define W83627EHF_REG_CASEOPEN_CLR   0x46 /* SMI MASK #3 */

Definition at line 207 of file w83627ehf.c.

#define W83627EHF_REG_CASEOPEN_DET   0x42 /* SMI STATUS #2 */

Definition at line 206 of file w83627ehf.c.

#define W83627EHF_REG_CONFIG   0x40

Definition at line 164 of file w83627ehf.c.

#define W83627EHF_REG_DIODE   0x59

Definition at line 194 of file w83627ehf.c.

#define W83627EHF_REG_FAN_STEPDOWN_TIME   0x0e

Definition at line 211 of file w83627ehf.c.

#define W83627EHF_REG_FAN_STEPUP_TIME   0x0f

Definition at line 210 of file w83627ehf.c.

#define W83627EHF_REG_FANDIV1   0x47

Definition at line 191 of file w83627ehf.c.

#define W83627EHF_REG_FANDIV2   0x4B

Definition at line 192 of file w83627ehf.c.

#define W83627EHF_REG_IN (   nr)
Value:
((nr < 7) ? (0x20 + (nr)) : \
(0x550 + (nr) - 7))

Definition at line 182 of file w83627ehf.c.

#define W83627EHF_REG_IN_MAX (   nr)
Value:
((nr < 7) ? (0x2b + (nr) * 2) : \
(0x554 + (((nr) - 7) * 2)))

Definition at line 178 of file w83627ehf.c.

#define W83627EHF_REG_IN_MIN (   nr)
Value:
((nr < 7) ? (0x2c + (nr) * 2) : \
(0x555 + (((nr) - 7) * 2)))

Definition at line 180 of file w83627ehf.c.

#define W83627EHF_REG_SMI_OVT   0x4C

Definition at line 195 of file w83627ehf.c.

#define W83627EHF_REG_VBAT   0x5D

Definition at line 193 of file w83627ehf.c.

#define W83667HG_LD_VID   0x0d

Definition at line 96 of file w83627ehf.c.

Enumeration Type Documentation

enum kinds
Enumerator:
f71805f 
f71872f 
w83627ehf 
w83627dhg 
w83627dhg_p 
w83627uhg 
w83667hg 
w83667hg_b 
nct6775 
nct6776 

Definition at line 64 of file w83627ehf.c.

Function Documentation

fan_functions ( fan_start_output  ,
FAN_START_OUTPUT   
)

Definition at line 1641 of file w83627ehf.c.

MODULE_AUTHOR ( "Jean Delvare <[email protected]>"  )
MODULE_DESCRIPTION ( "W83627EHF driver )
module_exit ( sensors_w83627ehf_exit  )
module_init ( sensors_w83627ehf_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( force_id  ,
ushort  ,
 
)
module_param ( fan_debounce  ,
ushort  ,
 
)
MODULE_PARM_DESC ( force_id  ,
"Override the detected device ID  
)
MODULE_PARM_DESC ( fan_debounce  ,
"Enable debouncing for fan RPM signal"   
)
show_in_reg ( in  )

Definition at line 940 of file w83627ehf.c.

show_pwm_reg ( pwm_mode  )

Definition at line 1377 of file w83627ehf.c.

show_temp_reg ( reg_temp  ,
temp   
)
show_temp_reg ( reg_temp_over  ,
temp_max   
)
show_temp_reg ( reg_temp_hyst  ,
temp_max_hyst   
)
show_tol_temp ( tolerance  )

Definition at line 1491 of file w83627ehf.c.

store_temp_reg ( reg_temp_over  ,
temp_max   
)
store_temp_reg ( reg_temp_hyst  ,
temp_max_hyst   
)