Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
compal-laptop.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/backlight.h>
#include <linux/platform_device.h>
#include <linux/rfkill.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/power_supply.h>
#include <linux/fb.h>

Go to the source code of this file.

Data Structures

struct  compal_data
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DRIVER_NAME   "compal-laptop"
 
#define DRIVER_VERSION   "0.2.7"
 
#define BACKLIGHT_LEVEL_ADDR   0xB9
 
#define BACKLIGHT_LEVEL_MAX   7
 
#define BACKLIGHT_STATE_ADDR   0x59
 
#define BACKLIGHT_STATE_ON_DATA   0xE1
 
#define BACKLIGHT_STATE_OFF_DATA   0xE2
 
#define WAKE_UP_ADDR   0xA4
 
#define WAKE_UP_PME   (1 << 0)
 
#define WAKE_UP_MODEM   (1 << 1)
 
#define WAKE_UP_LAN   (1 << 2)
 
#define WAKE_UP_WLAN   (1 << 4)
 
#define WAKE_UP_KEY   (1 << 6)
 
#define WAKE_UP_MOUSE   (1 << 7)
 
#define WIRELESS_ADDR   0xBB
 
#define WIRELESS_WLAN   (1 << 0)
 
#define WIRELESS_BT   (1 << 1)
 
#define WIRELESS_WLAN_EXISTS   (1 << 2)
 
#define WIRELESS_BT_EXISTS   (1 << 3)
 
#define WIRELESS_KILLSWITCH   (1 << 4)
 
#define PWM_ADDRESS   0x46
 
#define PWM_DISABLE_ADDR   0x59
 
#define PWM_DISABLE_DATA   0xA5
 
#define PWM_ENABLE_ADDR   0x59
 
#define PWM_ENABLE_DATA   0xA8
 
#define FAN_ADDRESS   0x46
 
#define FAN_DATA   0x81
 
#define FAN_FULL_ON_CMD   0x59 /* Doesn't seem to work. Just */
 
#define FAN_FULL_ON_ENABLE   0x76 /* force the pwm signal to its */
 
#define FAN_FULL_ON_DISABLE   0x77 /* maximum value instead */
 
#define TEMP_CPU   0xB0
 
#define TEMP_CPU_LOCAL   0xB1
 
#define TEMP_CPU_DTS   0xB5
 
#define TEMP_NORTHBRIDGE   0xB6
 
#define TEMP_VGA   0xB4
 
#define TEMP_SKIN   0xB2
 
#define BAT_MANUFACTURER_NAME_ADDR   0x10
 
#define BAT_MANUFACTURER_NAME_LEN   9
 
#define BAT_MODEL_NAME_ADDR   0x19
 
#define BAT_MODEL_NAME_LEN   6
 
#define BAT_SERIAL_NUMBER_ADDR   0xC4
 
#define BAT_SERIAL_NUMBER_LEN   5
 
#define BAT_CHARGE_NOW   0xC2
 
#define BAT_CHARGE_DESIGN   0xCA
 
#define BAT_VOLTAGE_NOW   0xC6
 
#define BAT_VOLTAGE_DESIGN   0xC8
 
#define BAT_CURRENT_NOW   0xD0
 
#define BAT_CURRENT_AVG   0xD2
 
#define BAT_POWER   0xD4
 
#define BAT_CAPACITY   0xCE
 
#define BAT_TEMP   0xD6
 
#define BAT_TEMP_AVG   0xD7
 
#define BAT_STATUS0   0xC1
 
#define BAT_STATUS1   0xF0
 
#define BAT_STATUS2   0xF1
 
#define BAT_STOP_CHARGE1   0xF2
 
#define BAT_STOP_CHARGE2   0xF3
 
#define BAT_S0_DISCHARGE   (1 << 0)
 
#define BAT_S0_DISCHRG_CRITICAL   (1 << 2)
 
#define BAT_S0_LOW   (1 << 3)
 
#define BAT_S0_CHARGING   (1 << 1)
 
#define BAT_S0_AC   (1 << 7)
 
#define BAT_S1_EXISTS   (1 << 0)
 
#define BAT_S1_FULL   (1 << 1)
 
#define BAT_S1_EMPTY   (1 << 2)
 
#define BAT_S1_LiION_OR_NiMH   (1 << 7)
 
#define BAT_S2_LOW_LOW   (1 << 0)
 
#define BAT_STOP_CHRG1_BAD_CELL   (1 << 1)
 
#define BAT_STOP_CHRG1_COMM_FAIL   (1 << 2)
 
#define BAT_STOP_CHRG1_OVERVOLTAGE   (1 << 6)
 
#define BAT_STOP_CHRG1_OVERTEMPERATURE   (1 << 7)
 
#define SIMPLE_MASKED_STORE_SHOW(NAME, ADDR, MASK)
 
#define TEMPERATURE_SHOW_TEMP_AND_LABEL(POSTFIX, ADDRESS, LABEL)
 

Functions

 module_param (force, bool, 0)
 
 MODULE_PARM_DESC (force,"Force driver load, ignore DMI data")
 
 TEMPERATURE_SHOW_TEMP_AND_LABEL (cpu, TEMP_CPU,"CPU_TEMP")
 
 TEMPERATURE_SHOW_TEMP_AND_LABEL (cpu_local, TEMP_CPU_LOCAL,"CPU_TEMP_LOCAL")
 
 TEMPERATURE_SHOW_TEMP_AND_LABEL (cpu_DTS, TEMP_CPU_DTS,"CPU_DTS")
 
 TEMPERATURE_SHOW_TEMP_AND_LABEL (northbridge, TEMP_NORTHBRIDGE,"NorthBridge")
 
 TEMPERATURE_SHOW_TEMP_AND_LABEL (vga, TEMP_VGA,"VGA_TEMP")
 
 TEMPERATURE_SHOW_TEMP_AND_LABEL (SKIN, TEMP_SKIN,"SKIN_TEMP90")
 
 MODULE_DEVICE_TABLE (dmi, compal_dmi_table)
 
 module_init (compal_init)
 
 module_exit (compal_cleanup)
 
 MODULE_AUTHOR ("Cezary Jackiewicz")
 
 MODULE_AUTHOR ("Roald Frederickx ([email protected])")
 
 MODULE_DESCRIPTION ("Compal Laptop Support")
 
 MODULE_VERSION (DRIVER_VERSION)
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define BACKLIGHT_LEVEL_ADDR   0xB9

Definition at line 93 of file compal-laptop.c.

#define BACKLIGHT_LEVEL_MAX   7

Definition at line 94 of file compal-laptop.c.

#define BACKLIGHT_STATE_ADDR   0x59

Definition at line 95 of file compal-laptop.c.

#define BACKLIGHT_STATE_OFF_DATA   0xE2

Definition at line 97 of file compal-laptop.c.

#define BACKLIGHT_STATE_ON_DATA   0xE1

Definition at line 96 of file compal-laptop.c.

#define BAT_CAPACITY   0xCE

Definition at line 146 of file compal-laptop.c.

#define BAT_CHARGE_DESIGN   0xCA

Definition at line 140 of file compal-laptop.c.

#define BAT_CHARGE_NOW   0xC2

Definition at line 139 of file compal-laptop.c.

#define BAT_CURRENT_AVG   0xD2

Definition at line 144 of file compal-laptop.c.

#define BAT_CURRENT_NOW   0xD0

Definition at line 143 of file compal-laptop.c.

#define BAT_MANUFACTURER_NAME_ADDR   0x10

Definition at line 133 of file compal-laptop.c.

#define BAT_MANUFACTURER_NAME_LEN   9

Definition at line 134 of file compal-laptop.c.

#define BAT_MODEL_NAME_ADDR   0x19

Definition at line 135 of file compal-laptop.c.

#define BAT_MODEL_NAME_LEN   6

Definition at line 136 of file compal-laptop.c.

#define BAT_POWER   0xD4

Definition at line 145 of file compal-laptop.c.

#define BAT_S0_AC   (1 << 7)

Definition at line 159 of file compal-laptop.c.

#define BAT_S0_CHARGING   (1 << 1)

Definition at line 158 of file compal-laptop.c.

#define BAT_S0_DISCHARGE   (1 << 0)

Definition at line 155 of file compal-laptop.c.

#define BAT_S0_DISCHRG_CRITICAL   (1 << 2)

Definition at line 156 of file compal-laptop.c.

#define BAT_S0_LOW   (1 << 3)

Definition at line 157 of file compal-laptop.c.

#define BAT_S1_EMPTY   (1 << 2)

Definition at line 162 of file compal-laptop.c.

#define BAT_S1_EXISTS   (1 << 0)

Definition at line 160 of file compal-laptop.c.

#define BAT_S1_FULL   (1 << 1)

Definition at line 161 of file compal-laptop.c.

#define BAT_S1_LiION_OR_NiMH   (1 << 7)

Definition at line 163 of file compal-laptop.c.

#define BAT_S2_LOW_LOW   (1 << 0)

Definition at line 164 of file compal-laptop.c.

#define BAT_SERIAL_NUMBER_ADDR   0xC4

Definition at line 137 of file compal-laptop.c.

#define BAT_SERIAL_NUMBER_LEN   5

Definition at line 138 of file compal-laptop.c.

#define BAT_STATUS0   0xC1

Definition at line 149 of file compal-laptop.c.

#define BAT_STATUS1   0xF0

Definition at line 150 of file compal-laptop.c.

#define BAT_STATUS2   0xF1

Definition at line 151 of file compal-laptop.c.

#define BAT_STOP_CHARGE1   0xF2

Definition at line 152 of file compal-laptop.c.

#define BAT_STOP_CHARGE2   0xF3

Definition at line 153 of file compal-laptop.c.

#define BAT_STOP_CHRG1_BAD_CELL   (1 << 1)

Definition at line 165 of file compal-laptop.c.

#define BAT_STOP_CHRG1_COMM_FAIL   (1 << 2)

Definition at line 166 of file compal-laptop.c.

#define BAT_STOP_CHRG1_OVERTEMPERATURE   (1 << 7)

Definition at line 168 of file compal-laptop.c.

#define BAT_STOP_CHRG1_OVERVOLTAGE   (1 << 6)

Definition at line 167 of file compal-laptop.c.

#define BAT_TEMP   0xD6

Definition at line 147 of file compal-laptop.c.

#define BAT_TEMP_AVG   0xD7

Definition at line 148 of file compal-laptop.c.

#define BAT_VOLTAGE_DESIGN   0xC8

Definition at line 142 of file compal-laptop.c.

#define BAT_VOLTAGE_NOW   0xC6

Definition at line 141 of file compal-laptop.c.

#define DRIVER_NAME   "compal-laptop"

Definition at line 90 of file compal-laptop.c.

#define DRIVER_VERSION   "0.2.7"

Definition at line 91 of file compal-laptop.c.

#define FAN_ADDRESS   0x46

Definition at line 120 of file compal-laptop.c.

#define FAN_DATA   0x81

Definition at line 121 of file compal-laptop.c.

#define FAN_FULL_ON_CMD   0x59 /* Doesn't seem to work. Just */

Definition at line 122 of file compal-laptop.c.

#define FAN_FULL_ON_DISABLE   0x77 /* maximum value instead */

Definition at line 124 of file compal-laptop.c.

#define FAN_FULL_ON_ENABLE   0x76 /* force the pwm signal to its */

Definition at line 123 of file compal-laptop.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 71 of file compal-laptop.c.

#define PWM_ADDRESS   0x46

Definition at line 114 of file compal-laptop.c.

#define PWM_DISABLE_ADDR   0x59

Definition at line 115 of file compal-laptop.c.

#define PWM_DISABLE_DATA   0xA5

Definition at line 116 of file compal-laptop.c.

#define PWM_ENABLE_ADDR   0x59

Definition at line 117 of file compal-laptop.c.

#define PWM_ENABLE_DATA   0xA8

Definition at line 118 of file compal-laptop.c.

#define SIMPLE_MASKED_STORE_SHOW (   NAME,
  ADDR,
  MASK 
)
Value:
static ssize_t NAME##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, "%d\n", ((ec_read_u8(ADDR) & MASK) != 0)); \
} \
static ssize_t NAME##_store(struct device *dev, \
struct device_attribute *attr, const char *buf, size_t count) \
{ \
int state; \
u8 old_val = ec_read_u8(ADDR); \
if (sscanf(buf, "%d", &state) != 1 || (state < 0 || state > 1)) \
return -EINVAL; \
ec_write(ADDR, state ? (old_val | MASK) : (old_val & ~MASK)); \
return count; \
}

Definition at line 381 of file compal-laptop.c.

#define TEMP_CPU   0xB0

Definition at line 126 of file compal-laptop.c.

#define TEMP_CPU_DTS   0xB5

Definition at line 128 of file compal-laptop.c.

#define TEMP_CPU_LOCAL   0xB1

Definition at line 127 of file compal-laptop.c.

#define TEMP_NORTHBRIDGE   0xB6

Definition at line 129 of file compal-laptop.c.

#define TEMP_SKIN   0xB2

Definition at line 131 of file compal-laptop.c.

#define TEMP_VGA   0xB4

Definition at line 130 of file compal-laptop.c.

#define TEMPERATURE_SHOW_TEMP_AND_LABEL (   POSTFIX,
  ADDRESS,
  LABEL 
)
Value:
static ssize_t temp_##POSTFIX(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, "%d\n", 1000 * (int)ec_read_s8(ADDRESS)); \
} \
static ssize_t label_##POSTFIX(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, "%s\n", LABEL); \
}

Definition at line 489 of file compal-laptop.c.

#define WAKE_UP_ADDR   0xA4

Definition at line 99 of file compal-laptop.c.

#define WAKE_UP_KEY   (1 << 6)

Definition at line 104 of file compal-laptop.c.

#define WAKE_UP_LAN   (1 << 2)

Definition at line 102 of file compal-laptop.c.

#define WAKE_UP_MODEM   (1 << 1)

Definition at line 101 of file compal-laptop.c.

#define WAKE_UP_MOUSE   (1 << 7)

Definition at line 105 of file compal-laptop.c.

#define WAKE_UP_PME   (1 << 0)

Definition at line 100 of file compal-laptop.c.

#define WAKE_UP_WLAN   (1 << 4)

Definition at line 103 of file compal-laptop.c.

#define WIRELESS_ADDR   0xBB

Definition at line 107 of file compal-laptop.c.

#define WIRELESS_BT   (1 << 1)

Definition at line 109 of file compal-laptop.c.

#define WIRELESS_BT_EXISTS   (1 << 3)

Definition at line 111 of file compal-laptop.c.

#define WIRELESS_KILLSWITCH   (1 << 4)

Definition at line 112 of file compal-laptop.c.

#define WIRELESS_WLAN   (1 << 0)

Definition at line 108 of file compal-laptop.c.

#define WIRELESS_WLAN_EXISTS   (1 << 2)

Definition at line 110 of file compal-laptop.c.

Function Documentation

MODULE_AUTHOR ( "Cezary Jackiewicz"  )
MODULE_AUTHOR ( "Roald Frederickx ([email protected])"  )
MODULE_DESCRIPTION ( "Compal Laptop Support"  )
MODULE_DEVICE_TABLE ( dmi  ,
compal_dmi_table   
)
module_exit ( compal_cleanup  )
module_init ( compal_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( force  ,
bool  ,
 
)
MODULE_PARM_DESC ( force  ,
"Force driver  load,
ignore DMI data  
)
MODULE_VERSION ( DRIVER_VERSION  )
TEMPERATURE_SHOW_TEMP_AND_LABEL ( cpu  ,
TEMP_CPU  ,
"CPU_TEMP"   
)
TEMPERATURE_SHOW_TEMP_AND_LABEL ( cpu_local  ,
TEMP_CPU_LOCAL  ,
"CPU_TEMP_LOCAL"   
)
TEMPERATURE_SHOW_TEMP_AND_LABEL ( cpu_DTS  ,
TEMP_CPU_DTS  ,
"CPU_DTS"   
)
TEMPERATURE_SHOW_TEMP_AND_LABEL ( northbridge  ,
TEMP_NORTHBRIDGE  ,
"NorthBridge"   
)
TEMPERATURE_SHOW_TEMP_AND_LABEL ( vga  ,
TEMP_VGA  ,
"VGA_TEMP"   
)
TEMPERATURE_SHOW_TEMP_AND_LABEL ( SKIN  ,
TEMP_SKIN  ,
"SKIN_TEMP90"   
)