Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
therm_adt746x.c File Reference
#include <linux/types.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/suspend.h>
#include <linux/kthread.h>
#include <linux/moduleparam.h>
#include <linux/freezer.h>
#include <linux/of_platform.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/io.h>
#include <asm/sections.h>

Go to the source code of this file.

Data Structures

struct  thermostat
 

Macros

#define CONFIG_REG   0x40
 
#define MANUAL_MASK   0xe0
 
#define AUTO_MASK   0x20
 
#define INVERT_MASK   0x10
 
#define BUILD_SHOW_FUNC_INT(name, data)
 
#define BUILD_SHOW_FUNC_INT_LITE(name, data)
 
#define BUILD_SHOW_FUNC_STR(name, data)
 
#define BUILD_SHOW_FUNC_FAN(name, data)
 
#define BUILD_STORE_FUNC_DEG(name, data)
 
#define BUILD_STORE_FUNC_INT(name, data)
 

Functions

 MODULE_AUTHOR ("Colin Leroy <[email protected]>")
 
 MODULE_DESCRIPTION ("Driver for ADT746x thermostat in iBook G4 and ""Powerbook G4 Alu")
 
 MODULE_LICENSE ("GPL")
 
 module_param (limit_adjust, int, 0644)
 
 MODULE_PARM_DESC (limit_adjust,"Adjust maximum temperatures (50 sensor1, 70 sensor2) ""by N degrees.")
 
 module_param (fan_speed, int, 0644)
 
 MODULE_PARM_DESC (fan_speed,"Specify starting fan speed (0-255) ""(default 64)")
 
 module_param (verbose, bool, 0)
 
 MODULE_PARM_DESC (verbose,"Verbose log operations ""(default 0)")
 
 BUILD_SHOW_FUNC_INT (sensor1_temperature,(read_reg(th, TEMP_REG[1])))
 
 MODULE_DEVICE_TABLE (i2c, therm_adt746x_id)
 
 module_init (thermostat_init)
 
 module_exit (thermostat_exit)
 

Macro Definition Documentation

#define AUTO_MASK   0x20

Definition at line 38 of file therm_adt746x.c.

#define BUILD_SHOW_FUNC_FAN (   name,
  data 
)
Value:
static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, "%d (%d rpm)\n", \
th->last_speed[data], \
read_fan_speed(th, FAN_SPEED[data]) \
); \
}

Definition at line 338 of file therm_adt746x.c.

#define BUILD_SHOW_FUNC_INT (   name,
  data 
)
Value:
static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, "%d\n", data); \
}

Definition at line 319 of file therm_adt746x.c.

#define BUILD_SHOW_FUNC_INT_LITE (   name,
  data 
)
Value:
static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, "%d\n", data); \
}

Definition at line 326 of file therm_adt746x.c.

#define BUILD_SHOW_FUNC_STR (   name,
  data 
)
Value:
static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, "%s\n", data); \
}

Definition at line 332 of file therm_adt746x.c.

#define BUILD_STORE_FUNC_DEG (   name,
  data 
)
Value:
static ssize_t store_##name(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) \
{ \
int val; \
int i; \
val = simple_strtol(buf, NULL, 10); \
printk(KERN_INFO "Adjusting limits by %d degrees\n", val); \
limit_adjust = val; \
for (i=0; i < 3; i++) \
set_limit(th, i); \
return n; \
}

Definition at line 348 of file therm_adt746x.c.

#define BUILD_STORE_FUNC_INT (   name,
  data 
)
Value:
static ssize_t store_##name(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) \
{ \
int val; \
val = simple_strtol(buf, NULL, 10); \
if (val < 0 || val > 255) \
return -EINVAL; \
printk(KERN_INFO "Setting specified fan speed to %d\n", val); \
data = val; \
return n; \
}

Definition at line 362 of file therm_adt746x.c.

#define CONFIG_REG   0x40

Definition at line 36 of file therm_adt746x.c.

#define INVERT_MASK   0x10

Definition at line 39 of file therm_adt746x.c.

#define MANUAL_MASK   0xe0

Definition at line 37 of file therm_adt746x.c.

Function Documentation

BUILD_SHOW_FUNC_INT ( sensor1_temperature  ,
(read_reg(th, TEMP_REG[1]))   
)

Definition at line 374 of file therm_adt746x.c.

MODULE_AUTHOR ( "Colin Leroy <[email protected]>"  )
MODULE_DESCRIPTION ( "Driver for ADT746x thermostat in iBook G4 and ""Powerbook G4 Alu"  )
MODULE_DEVICE_TABLE ( i2c  ,
therm_adt746x_id   
)
module_exit ( thermostat_exit  )
module_init ( thermostat_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( limit_adjust  ,
int  ,
0644   
)
module_param ( fan_speed  ,
int  ,
0644   
)
module_param ( verbose  ,
bool  ,
 
)
MODULE_PARM_DESC ( limit_adjust  ,
"Adjust maximum temperatures (50 sensor1, 70 sensor2) ""by N degrees."   
)
MODULE_PARM_DESC ( fan_speed  ,
"Specify starting fan speed (0-255) ""(default 64)"   
)
MODULE_PARM_DESC ( verbose  ,
"Verbose log operations ""(default 0)"   
)