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

Go to the source code of this file.

Data Structures

struct  lm77_data
 

Macros

#define LM77_REG_TEMP   0x00
 
#define LM77_REG_CONF   0x01
 
#define LM77_REG_TEMP_HYST   0x02
 
#define LM77_REG_TEMP_CRIT   0x03
 
#define LM77_REG_TEMP_MIN   0x04
 
#define LM77_REG_TEMP_MAX   0x05
 
#define LM77_TEMP_MIN   (-55000)
 
#define LM77_TEMP_MAX   125000
 
#define show(value)
 
#define set(value, reg)
 

Functions

 MODULE_DEVICE_TABLE (i2c, lm77_id)
 
 show (temp_input)
 
 show (temp_crit)
 
 show (temp_min)
 
 show (temp_max)
 
 set (temp_min, LM77_REG_TEMP_MIN)
 
 set (temp_max, LM77_REG_TEMP_MAX)
 
 module_i2c_driver (lm77_driver)
 
 MODULE_AUTHOR ("Andras BALI <[email protected]>")
 
 MODULE_DESCRIPTION ("LM77 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define LM77_REG_CONF   0x01

Definition at line 44 of file lm77.c.

#define LM77_REG_TEMP   0x00

Definition at line 43 of file lm77.c.

#define LM77_REG_TEMP_CRIT   0x03

Definition at line 46 of file lm77.c.

#define LM77_REG_TEMP_HYST   0x02

Definition at line 45 of file lm77.c.

#define LM77_REG_TEMP_MAX   0x05

Definition at line 48 of file lm77.c.

#define LM77_REG_TEMP_MIN   0x04

Definition at line 47 of file lm77.c.

#define LM77_TEMP_MAX   125000

Definition at line 96 of file lm77.c.

#define LM77_TEMP_MIN   (-55000)

Definition at line 95 of file lm77.c.

#define set (   value,
  reg 
)
Value:
static ssize_t set_##value(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
struct lm77_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 = val; \
lm77_write_value(client, reg, LM77_TEMP_TO_REG(data->value)); \
mutex_unlock(&data->update_lock); \
return count; \
}

Definition at line 151 of file lm77.c.

#define show (   value)
Value:
static ssize_t show_##value(struct device *dev, \
char *buf) \
{ \
struct lm77_data *data = lm77_update_device(dev); \
return sprintf(buf, "%d\n", data->value); \
}

Definition at line 116 of file lm77.c.

Function Documentation

MODULE_AUTHOR ( "Andras BALI <[email protected]>"  )
MODULE_DESCRIPTION ( "LM77 driver )
MODULE_DEVICE_TABLE ( i2c  ,
lm77_id   
)
module_i2c_driver ( lm77_driver  )
MODULE_LICENSE ( "GPL"  )
set ( temp_min  ,
LM77_REG_TEMP_MIN   
)
set ( temp_max  ,
LM77_REG_TEMP_MAX   
)
show ( temp_input  )
show ( temp_crit  )
show ( temp_min  )
show ( temp_max  )