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

Go to the source code of this file.

Data Structures

struct  max1619_data
 

Macros

#define MAX1619_REG_R_MAN_ID   0xFE
 
#define MAX1619_REG_R_CHIP_ID   0xFF
 
#define MAX1619_REG_R_CONFIG   0x03
 
#define MAX1619_REG_W_CONFIG   0x09
 
#define MAX1619_REG_R_CONVRATE   0x04
 
#define MAX1619_REG_W_CONVRATE   0x0A
 
#define MAX1619_REG_R_STATUS   0x02
 
#define MAX1619_REG_R_LOCAL_TEMP   0x00
 
#define MAX1619_REG_R_REMOTE_TEMP   0x01
 
#define MAX1619_REG_R_REMOTE_HIGH   0x07
 
#define MAX1619_REG_W_REMOTE_HIGH   0x0D
 
#define MAX1619_REG_R_REMOTE_LOW   0x08
 
#define MAX1619_REG_W_REMOTE_LOW   0x0E
 
#define MAX1619_REG_R_REMOTE_CRIT   0x10
 
#define MAX1619_REG_W_REMOTE_CRIT   0x12
 
#define MAX1619_REG_R_TCRIT_HYST   0x11
 
#define MAX1619_REG_W_TCRIT_HYST   0x13
 
#define show_temp(value)
 
#define set_temp2(value, reg)
 

Functions

 MODULE_DEVICE_TABLE (i2c, max1619_id)
 
 show_temp (temp_input1)
 
 show_temp (temp_input2)
 
 show_temp (temp_low2)
 
 show_temp (temp_high2)
 
 show_temp (temp_crit2)
 
 show_temp (temp_hyst2)
 
 set_temp2 (temp_low2, MAX1619_REG_W_REMOTE_LOW)
 
 set_temp2 (temp_high2, MAX1619_REG_W_REMOTE_HIGH)
 
 set_temp2 (temp_crit2, MAX1619_REG_W_REMOTE_CRIT)
 
 set_temp2 (temp_hyst2, MAX1619_REG_W_TCRIT_HYST)
 
 module_i2c_driver (max1619_driver)
 
 MODULE_AUTHOR ("Oleksij Rempel <bug-track@fisher-privat.net> and ""Jean Delvare <[email protected]>")
 
 MODULE_DESCRIPTION ("MAX1619 sensor driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define MAX1619_REG_R_CHIP_ID   0xFF

Definition at line 48 of file max1619.c.

#define MAX1619_REG_R_CONFIG   0x03

Definition at line 49 of file max1619.c.

#define MAX1619_REG_R_CONVRATE   0x04

Definition at line 51 of file max1619.c.

#define MAX1619_REG_R_LOCAL_TEMP   0x00

Definition at line 54 of file max1619.c.

#define MAX1619_REG_R_MAN_ID   0xFE

Definition at line 47 of file max1619.c.

#define MAX1619_REG_R_REMOTE_CRIT   0x10

Definition at line 60 of file max1619.c.

#define MAX1619_REG_R_REMOTE_HIGH   0x07

Definition at line 56 of file max1619.c.

#define MAX1619_REG_R_REMOTE_LOW   0x08

Definition at line 58 of file max1619.c.

#define MAX1619_REG_R_REMOTE_TEMP   0x01

Definition at line 55 of file max1619.c.

#define MAX1619_REG_R_STATUS   0x02

Definition at line 53 of file max1619.c.

#define MAX1619_REG_R_TCRIT_HYST   0x11

Definition at line 62 of file max1619.c.

#define MAX1619_REG_W_CONFIG   0x09

Definition at line 50 of file max1619.c.

#define MAX1619_REG_W_CONVRATE   0x0A

Definition at line 52 of file max1619.c.

#define MAX1619_REG_W_REMOTE_CRIT   0x12

Definition at line 61 of file max1619.c.

#define MAX1619_REG_W_REMOTE_HIGH   0x0D

Definition at line 57 of file max1619.c.

#define MAX1619_REG_W_REMOTE_LOW   0x0E

Definition at line 59 of file max1619.c.

#define MAX1619_REG_W_TCRIT_HYST   0x13

Definition at line 63 of file max1619.c.

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

Definition at line 149 of file max1619.c.

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

Definition at line 135 of file max1619.c.

Function Documentation

MODULE_AUTHOR ( "Oleksij Rempel <bug-track@fisher-privat.net> and ""Jean Delvare <[email protected]>"  )
MODULE_DESCRIPTION ( "MAX1619 sensor driver )
MODULE_DEVICE_TABLE ( i2c  ,
max1619_id   
)
module_i2c_driver ( max1619_driver  )
MODULE_LICENSE ( "GPL"  )
set_temp2 ( temp_low2  ,
MAX1619_REG_W_REMOTE_LOW   
)
set_temp2 ( temp_high2  ,
MAX1619_REG_W_REMOTE_HIGH   
)
set_temp2 ( temp_crit2  ,
MAX1619_REG_W_REMOTE_CRIT   
)
set_temp2 ( temp_hyst2  ,
MAX1619_REG_W_TCRIT_HYST   
)
show_temp ( temp_input1  )
show_temp ( temp_input2  )
show_temp ( temp_low2  )
show_temp ( temp_high2  )
show_temp ( temp_crit2  )
show_temp ( temp_hyst2  )