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

Go to the source code of this file.

Data Structures

struct  lm92_data
 

Macros

#define LM92_REG_CONFIG   0x01 /* 8-bit, RW */
 
#define LM92_REG_TEMP   0x00 /* 16-bit, RO */
 
#define LM92_REG_TEMP_HYST   0x02 /* 16-bit, RW */
 
#define LM92_REG_TEMP_CRIT   0x03 /* 16-bit, RW */
 
#define LM92_REG_TEMP_LOW   0x04 /* 16-bit, RW */
 
#define LM92_REG_TEMP_HIGH   0x05 /* 16-bit, RW */
 
#define LM92_REG_MAN_ID   0x07 /* 16-bit, RO, LM92 only */
 
#define show_temp(value)
 
#define set_temp(value, reg)
 

Functions

 show_temp (temp1_input)
 
 show_temp (temp1_crit)
 
 show_temp (temp1_min)
 
 show_temp (temp1_max)
 
 set_temp (temp1_crit, LM92_REG_TEMP_CRIT)
 
 set_temp (temp1_min, LM92_REG_TEMP_LOW)
 
 set_temp (temp1_max, LM92_REG_TEMP_HIGH)
 
 MODULE_DEVICE_TABLE (i2c, lm92_id)
 
 module_i2c_driver (lm92_driver)
 
 MODULE_AUTHOR ("Jean Delvare <[email protected]>")
 
 MODULE_DESCRIPTION ("LM92/MAX6635 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define LM92_REG_CONFIG   0x01 /* 8-bit, RW */

Definition at line 61 of file lm92.c.

#define LM92_REG_MAN_ID   0x07 /* 16-bit, RO, LM92 only */

Definition at line 67 of file lm92.c.

#define LM92_REG_TEMP   0x00 /* 16-bit, RO */

Definition at line 62 of file lm92.c.

#define LM92_REG_TEMP_CRIT   0x03 /* 16-bit, RW */

Definition at line 64 of file lm92.c.

#define LM92_REG_TEMP_HIGH   0x05 /* 16-bit, RW */

Definition at line 66 of file lm92.c.

#define LM92_REG_TEMP_HYST   0x02 /* 16-bit, RW */

Definition at line 63 of file lm92.c.

#define LM92_REG_TEMP_LOW   0x04 /* 16-bit, RW */

Definition at line 65 of file lm92.c.

#define set_temp (   value,
  reg 
)
Value:
static ssize_t set_##value(struct device *dev, struct device_attribute *attr, \
const char *buf, \
size_t count) \
{ \
struct lm92_data *data = i2c_get_clientdata(client); \
long val; \
int err = kstrtol(buf, 10, &val); \
if (err) \
return err; \
mutex_lock(&data->update_lock); \
data->value = TEMP_TO_REG(val); \
i2c_smbus_write_word_swapped(client, reg, data->value); \
mutex_unlock(&data->update_lock); \
return count; \
}

Definition at line 157 of file lm92.c.

#define show_temp (   value)
Value:
static ssize_t show_##value(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct lm92_data *data = lm92_update_device(dev); \
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \
}

Definition at line 145 of file lm92.c.

Function Documentation

MODULE_AUTHOR ( "Jean Delvare <[email protected]>"  )
MODULE_DESCRIPTION ( "LM92/MAX6635 driver )
MODULE_DEVICE_TABLE ( i2c  ,
lm92_id   
)
module_i2c_driver ( lm92_driver  )
MODULE_LICENSE ( "GPL"  )
set_temp ( temp1_crit  ,
LM92_REG_TEMP_CRIT   
)
set_temp ( temp1_min  ,
LM92_REG_TEMP_LOW   
)
set_temp ( temp1_max  ,
LM92_REG_TEMP_HIGH   
)
show_temp ( temp1_input  )
show_temp ( temp1_crit  )
show_temp ( temp1_min  )
show_temp ( temp1_max  )