Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
gl520sm.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.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/sysfs.h>

Go to the source code of this file.

Data Structures

struct  gl520_data
 

Macros

#define GL520_REG_CHIP_ID   0x00
 
#define GL520_REG_REVISION   0x01
 
#define GL520_REG_CONF   0x03
 
#define GL520_REG_MASK   0x11
 
#define GL520_REG_VID_INPUT   0x02
 
#define GL520_REG_FAN_INPUT   0x07
 
#define GL520_REG_FAN_MIN   0x08
 
#define GL520_REG_FAN_DIV   0x0f
 
#define GL520_REG_FAN_OFF   GL520_REG_FAN_DIV
 
#define GL520_REG_ALARMS   0x12
 
#define GL520_REG_BEEP_MASK   0x10
 
#define GL520_REG_BEEP_ENABLE   GL520_REG_CONF
 
#define VDD_FROM_REG(val)   (((val) * 95 + 2) / 4)
 
#define VDD_TO_REG(val)   SENSORS_LIMIT((((val) * 4 + 47) / 95), 0, 255)
 
#define IN_FROM_REG(val)   ((val) * 19)
 
#define IN_TO_REG(val)   SENSORS_LIMIT((((val) + 9) / 19), 0, 255)
 
#define DIV_FROM_REG(val)   (1 << (val))
 
#define FAN_FROM_REG(val, div)   ((val) == 0 ? 0 : (480000 / ((val) << (div))))
 
#define FAN_TO_REG(val, div)
 
#define TEMP_FROM_REG(val)   (((val) - 130) * 1000)
 
#define TEMP_TO_REG(val)
 

Functions

 module_param (extra_sensor_type, ushort, 0)
 
 MODULE_PARM_DESC (extra_sensor_type,"Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)")
 
 MODULE_DEVICE_TABLE (i2c, gl520_id)
 
 module_i2c_driver (gl520_driver)
 
 MODULE_AUTHOR ("Frodo Looijaard <[email protected]>, ""Kyösti Mälkki <[email protected]>, ""Maarten Deprez <[email protected]>")
 
 MODULE_DESCRIPTION ("GL520SM driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define DIV_FROM_REG (   val)    (1 << (val))

Definition at line 285 of file gl520sm.c.

#define FAN_FROM_REG (   val,
  div 
)    ((val) == 0 ? 0 : (480000 / ((val) << (div))))

Definition at line 286 of file gl520sm.c.

#define FAN_TO_REG (   val,
  div 
)
Value:
((val) <= 0 ? 0 : \
SENSORS_LIMIT((480000 + ((val) << ((div)-1))) / ((val) << (div)), 1, \
255))

Definition at line 287 of file gl520sm.c.

#define GL520_REG_ALARMS   0x12

Definition at line 72 of file gl520sm.c.

#define GL520_REG_BEEP_ENABLE   GL520_REG_CONF

Definition at line 74 of file gl520sm.c.

#define GL520_REG_BEEP_MASK   0x10

Definition at line 73 of file gl520sm.c.

#define GL520_REG_CHIP_ID   0x00

Definition at line 51 of file gl520sm.c.

#define GL520_REG_CONF   0x03

Definition at line 53 of file gl520sm.c.

#define GL520_REG_FAN_DIV   0x0f

Definition at line 69 of file gl520sm.c.

#define GL520_REG_FAN_INPUT   0x07

Definition at line 67 of file gl520sm.c.

#define GL520_REG_FAN_MIN   0x08

Definition at line 68 of file gl520sm.c.

#define GL520_REG_FAN_OFF   GL520_REG_FAN_DIV

Definition at line 70 of file gl520sm.c.

#define GL520_REG_MASK   0x11

Definition at line 54 of file gl520sm.c.

#define GL520_REG_REVISION   0x01

Definition at line 52 of file gl520sm.c.

#define GL520_REG_VID_INPUT   0x02

Definition at line 56 of file gl520sm.c.

#define IN_FROM_REG (   val)    ((val) * 19)

Definition at line 149 of file gl520sm.c.

#define IN_TO_REG (   val)    SENSORS_LIMIT((((val) + 9) / 19), 0, 255)

Definition at line 150 of file gl520sm.c.

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

Definition at line 452 of file gl520sm.c.

#define TEMP_TO_REG (   val)
Value:
SENSORS_LIMIT(((((val) < 0 ? \
(val) - 500 : (val) + 500) / 1000) + 130), 0, 255)

Definition at line 453 of file gl520sm.c.

#define VDD_FROM_REG (   val)    (((val) * 95 + 2) / 4)

Definition at line 146 of file gl520sm.c.

#define VDD_TO_REG (   val)    SENSORS_LIMIT((((val) * 4 + 47) / 95), 0, 255)

Definition at line 147 of file gl520sm.c.

Function Documentation

MODULE_AUTHOR ( "Frodo Looijaard <[email protected] ,
""Kyösti Mälkki< kmalkki @cc.hut.fi >  ,
""Maarten Deprez< maartendeprez @users.sourceforge.net >"   
)
MODULE_DESCRIPTION ( "GL520SM driver )
MODULE_DEVICE_TABLE ( i2c  ,
gl520_id   
)
module_i2c_driver ( gl520_driver  )
MODULE_LICENSE ( "GPL"  )
module_param ( extra_sensor_type  ,
ushort  ,
 
)
MODULE_PARM_DESC ( extra_sensor_type  ,
"Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)"   
)