Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
applesmc.c File Reference
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/input-polldev.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/timer.h>
#include <linux/dmi.h>
#include <linux/mutex.h>
#include <linux/hwmon-sysfs.h>
#include <linux/io.h>
#include <linux/leds.h>
#include <linux/hwmon.h>
#include <linux/workqueue.h>
#include <linux/err.h>

Go to the source code of this file.

Data Structures

struct  applesmc_dev_attr
 
struct  applesmc_node_group
 
struct  applesmc_entry
 
struct  applesmc_registers
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define APPLESMC_DATA_PORT   0x300
 
#define APPLESMC_CMD_PORT   0x304
 
#define APPLESMC_NR_PORTS   32 /* 0x300-0x31f */
 
#define APPLESMC_MAX_DATA_LENGTH   32
 
#define APPLESMC_MIN_WAIT   0x0010
 
#define APPLESMC_RETRY_WAIT   0x0100
 
#define APPLESMC_MAX_WAIT   0x20000
 
#define APPLESMC_READ_CMD   0x10
 
#define APPLESMC_WRITE_CMD   0x11
 
#define APPLESMC_GET_KEY_BY_INDEX_CMD   0x12
 
#define APPLESMC_GET_KEY_TYPE_CMD   0x13
 
#define KEY_COUNT_KEY   "#KEY" /* r-o ui32 */
 
#define LIGHT_SENSOR_LEFT_KEY   "ALV0" /* r-o {alv (6-10 bytes) */
 
#define LIGHT_SENSOR_RIGHT_KEY   "ALV1" /* r-o {alv (6-10 bytes) */
 
#define BACKLIGHT_KEY   "LKSB" /* w-o {lkb (2 bytes) */
 
#define CLAMSHELL_KEY   "MSLD" /* r-o ui8 (unused) */
 
#define MOTION_SENSOR_X_KEY   "MO_X" /* r-o sp78 (2 bytes) */
 
#define MOTION_SENSOR_Y_KEY   "MO_Y" /* r-o sp78 (2 bytes) */
 
#define MOTION_SENSOR_Z_KEY   "MO_Z" /* r-o sp78 (2 bytes) */
 
#define MOTION_SENSOR_KEY   "MOCN" /* r/w ui16 */
 
#define FANS_COUNT   "FNum" /* r-o ui8 */
 
#define FANS_MANUAL   "FS! " /* r-w ui16 */
 
#define FAN_ID_FMT   "F%dID" /* r-o char[16] */
 
#define TEMP_SENSOR_TYPE   "sp78"
 
#define INIT_TIMEOUT_MSECS   5000 /* wait up to 5s for device init ... */
 
#define INIT_WAIT_MSECS   50 /* ... in 50ms increments */
 
#define APPLESMC_POLL_INTERVAL   50 /* msecs */
 
#define APPLESMC_INPUT_FUZZ   4 /* input event threshold */
 
#define APPLESMC_INPUT_FLAT   4
 
#define to_index(attr)   (to_sensor_dev_attr(attr)->index & 0xffff)
 
#define to_option(attr)   (to_sensor_dev_attr(attr)->index >> 16)
 

Functions

 module_init (applesmc_init)
 
 module_exit (applesmc_exit)
 
 MODULE_AUTHOR ("Nicolas Boichat")
 
 MODULE_DESCRIPTION ("Apple SMC")
 
 MODULE_LICENSE ("GPL v2")
 
 MODULE_DEVICE_TABLE (dmi, applesmc_whitelist)
 

Macro Definition Documentation

#define APPLESMC_CMD_PORT   0x304

Definition at line 51 of file applesmc.c.

#define APPLESMC_DATA_PORT   0x300

Definition at line 49 of file applesmc.c.

#define APPLESMC_GET_KEY_BY_INDEX_CMD   0x12

Definition at line 64 of file applesmc.c.

#define APPLESMC_GET_KEY_TYPE_CMD   0x13

Definition at line 65 of file applesmc.c.

#define APPLESMC_INPUT_FLAT   4

Definition at line 100 of file applesmc.c.

#define APPLESMC_INPUT_FUZZ   4 /* input event threshold */

Definition at line 99 of file applesmc.c.

#define APPLESMC_MAX_DATA_LENGTH   32

Definition at line 55 of file applesmc.c.

#define APPLESMC_MAX_WAIT   0x20000

Definition at line 60 of file applesmc.c.

#define APPLESMC_MIN_WAIT   0x0010

Definition at line 58 of file applesmc.c.

#define APPLESMC_NR_PORTS   32 /* 0x300-0x31f */

Definition at line 53 of file applesmc.c.

#define APPLESMC_POLL_INTERVAL   50 /* msecs */

Definition at line 98 of file applesmc.c.

#define APPLESMC_READ_CMD   0x10

Definition at line 62 of file applesmc.c.

#define APPLESMC_RETRY_WAIT   0x0100

Definition at line 59 of file applesmc.c.

#define APPLESMC_WRITE_CMD   0x11

Definition at line 63 of file applesmc.c.

#define BACKLIGHT_KEY   "LKSB" /* w-o {lkb (2 bytes) */

Definition at line 71 of file applesmc.c.

#define CLAMSHELL_KEY   "MSLD" /* r-o ui8 (unused) */

Definition at line 73 of file applesmc.c.

#define FAN_ID_FMT   "F%dID" /* r-o char[16] */

Definition at line 82 of file applesmc.c.

#define FANS_COUNT   "FNum" /* r-o ui8 */

Definition at line 80 of file applesmc.c.

#define FANS_MANUAL   "FS! " /* r-w ui16 */

Definition at line 81 of file applesmc.c.

#define INIT_TIMEOUT_MSECS   5000 /* wait up to 5s for device init ... */

Definition at line 95 of file applesmc.c.

#define INIT_WAIT_MSECS   50 /* ... in 50ms increments */

Definition at line 96 of file applesmc.c.

#define KEY_COUNT_KEY   "#KEY" /* r-o ui32 */

Definition at line 67 of file applesmc.c.

#define LIGHT_SENSOR_LEFT_KEY   "ALV0" /* r-o {alv (6-10 bytes) */

Definition at line 69 of file applesmc.c.

#define LIGHT_SENSOR_RIGHT_KEY   "ALV1" /* r-o {alv (6-10 bytes) */

Definition at line 70 of file applesmc.c.

#define MOTION_SENSOR_KEY   "MOCN" /* r/w ui16 */

Definition at line 78 of file applesmc.c.

#define MOTION_SENSOR_X_KEY   "MO_X" /* r-o sp78 (2 bytes) */

Definition at line 75 of file applesmc.c.

#define MOTION_SENSOR_Y_KEY   "MO_Y" /* r-o sp78 (2 bytes) */

Definition at line 76 of file applesmc.c.

#define MOTION_SENSOR_Z_KEY   "MO_Z" /* r-o sp78 (2 bytes) */

Definition at line 77 of file applesmc.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 30 of file applesmc.c.

#define TEMP_SENSOR_TYPE   "sp78"

Definition at line 84 of file applesmc.c.

#define to_index (   attr)    (to_sensor_dev_attr(attr)->index & 0xffff)

Definition at line 102 of file applesmc.c.

#define to_option (   attr)    (to_sensor_dev_attr(attr)->index >> 16)

Definition at line 103 of file applesmc.c.

Function Documentation

MODULE_AUTHOR ( "Nicolas Boichat"  )
MODULE_DESCRIPTION ( "Apple SMC )
MODULE_DEVICE_TABLE ( dmi  ,
applesmc_whitelist   
)
module_exit ( applesmc_exit  )
module_init ( applesmc_init  )
MODULE_LICENSE ( "GPL v2 )