Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
sony-laptop.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/backlight.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/dmi.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/kfifo.h>
#include <linux/workqueue.h>
#include <linux/acpi.h>
#include <linux/slab.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acpi_bus.h>
#include <asm/uaccess.h>
#include <linux/sonypi.h>
#include <linux/sony-laptop.h>
#include <linux/rfkill.h>

Go to the source code of this file.

Data Structures

struct  sony_laptop_input_s
 
struct  sony_laptop_keypress
 
struct  sony_nc_value
 
struct  sony_nc_handles
 
struct  sony_backlight_props
 
struct  sony_nc_event
 
struct  kbd_backlight
 
struct  battery_care_control
 
struct  snc_thermal_ctrl
 
struct  snc_lid_resume_control
 
struct  touchpad_control
 
struct  sony_pic_ioport
 
struct  sony_pic_irq
 
struct  sonypi_eventtypes
 
struct  sony_pic_dev
 
struct  sonypi_event
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define dprintk(fmt,...)
 
#define SONY_LAPTOP_DRIVER_VERSION   "0.6"
 
#define SONY_NC_CLASS   "sony-nc"
 
#define SONY_NC_HID   "SNY5001"
 
#define SONY_NC_DRIVER_NAME   "Sony Notebook Control Driver"
 
#define SONY_PIC_CLASS   "sony-pic"
 
#define SONY_PIC_HID   "SNY6001"
 
#define SONY_PIC_DRIVER_NAME   "Sony Programmable IO Control Driver"
 
#define SONY_LAPTOP_BUF_SIZE   128
 
#define SONY_MAX_BRIGHTNESS   8
 
#define SNC_VALIDATE_IN   0
 
#define SNC_VALIDATE_OUT   1
 
#define SNC_HANDLE_NAMES(_name, _values...)   static char *snc_##_name[] = { _values, NULL }
 
#define SNC_HANDLE(_name, _getters, _setters, _validate, _debug)
 
#define SNC_HANDLE_NULL   { .name = NULL }
 
#define MIN(a, b)   (a > b ? b : a)
 
#define THM_PROFILE_MAX   3
 
#define SONYPI_DEVICE_TYPE1   0x00000001
 
#define SONYPI_DEVICE_TYPE2   0x00000002
 
#define SONYPI_DEVICE_TYPE3   0x00000004
 
#define SONYPI_TYPE1_OFFSET   0x04
 
#define SONYPI_TYPE2_OFFSET   0x12
 
#define SONYPI_TYPE3_OFFSET   0x12
 
#define SONYPI_JOGGER_MASK   0x00000001
 
#define SONYPI_CAPTURE_MASK   0x00000002
 
#define SONYPI_FNKEY_MASK   0x00000004
 
#define SONYPI_BLUETOOTH_MASK   0x00000008
 
#define SONYPI_PKEY_MASK   0x00000010
 
#define SONYPI_BACK_MASK   0x00000020
 
#define SONYPI_HELP_MASK   0x00000040
 
#define SONYPI_LID_MASK   0x00000080
 
#define SONYPI_ZOOM_MASK   0x00000100
 
#define SONYPI_THUMBPHRASE_MASK   0x00000200
 
#define SONYPI_MEYE_MASK   0x00000400
 
#define SONYPI_MEMORYSTICK_MASK   0x00000800
 
#define SONYPI_BATTERY_MASK   0x00001000
 
#define SONYPI_WIRELESS_MASK   0x00002000
 
#define ITERATIONS_LONG   10000
 
#define ITERATIONS_SHORT   10
 
#define wait_on_command(command, iterations)
 
#define SONYPI_CAMERA_PICTURE   5
 
#define SONYPI_CAMERA_CONTROL   0x10
 
#define SONYPI_CAMERA_BRIGHTNESS   0
 
#define SONYPI_CAMERA_CONTRAST   1
 
#define SONYPI_CAMERA_HUE   2
 
#define SONYPI_CAMERA_COLOR   3
 
#define SONYPI_CAMERA_SHARPNESS   4
 
#define SONYPI_CAMERA_EXPOSURE_MASK   0xC
 
#define SONYPI_CAMERA_WHITE_BALANCE_MASK   0x3
 
#define SONYPI_CAMERA_PICTURE_MODE_MASK   0x30
 
#define SONYPI_CAMERA_MUTE_MASK   0x40
 
#define SONYPI_CAMERA_AGC   6
 
#define SONYPI_CAMERA_AGC_MASK   0x30
 
#define SONYPI_CAMERA_SHUTTER_MASK   0x7
 
#define SONYPI_CAMERA_SHUTDOWN_REQUEST   7
 
#define SONYPI_CAMERA_CONTROL   0x10
 
#define SONYPI_CAMERA_STATUS   7
 
#define SONYPI_CAMERA_STATUS_READY   0x2
 
#define SONYPI_CAMERA_STATUS_POSITION   0x4
 
#define SONYPI_DIRECTION_BACKWARDS   0x4
 
#define SONYPI_CAMERA_REVISION   8
 
#define SONYPI_CAMERA_ROMVERSION   9
 
#define SONY_PIC_FAN0_STATUS   0x93
 
#define SPIC_ATTR(_name, _mode)
 

Enumerations

enum  sony_nc_rfkill {
  SONY_WIFI, SONY_BLUETOOTH, SONY_WWAN, SONY_WIMAX,
  N_SONY_RFKILL
}
 
enum  event_types { HOTKEY = 1, KILLSWITCH, GFX_SWITCH }
 

Functions

 MODULE_AUTHOR ("Stelian Pop, Mattia Dongili")
 
 MODULE_DESCRIPTION ("Sony laptop extras driver (SPIC and SNC ACPI device)")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (SONY_LAPTOP_DRIVER_VERSION)
 
 module_param (debug, int, 0)
 
 MODULE_PARM_DESC (debug,"set this to 1 (and RTFM) if you want to help ""the development of this driver")
 
 module_param (no_spic, int, 0444)
 
 MODULE_PARM_DESC (no_spic,"set this if you don't want to enable the SPIC device")
 
 module_param (compat, int, 0444)
 
 MODULE_PARM_DESC (compat,"set this if you want to enable backward compatibility mode")
 
 module_param (mask, ulong, 0644)
 
 MODULE_PARM_DESC (mask,"set this to the mask of event you want to enable (see doc)")
 
 module_param (camera, int, 0444)
 
 MODULE_PARM_DESC (camera,"set this to 1 to enable Motion Eye camera controls ""(only use it if you have a C1VE or C1VN model)")
 
 module_param (kbd_backlight, int, 0444)
 
 MODULE_PARM_DESC (kbd_backlight,"set this to 0 to disable keyboard backlight, ""1 to enable it (default: 0)")
 
 module_param (kbd_backlight_timeout, int, 0444)
 
 MODULE_PARM_DESC (kbd_backlight_timeout,"set this to 0 to set the default 10 seconds timeout, ""1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout ""(default: 0)")
 
 SNC_HANDLE_NAMES (fnkey_get,"GHKE")
 
 SNC_HANDLE_NAMES (brightness_def_get,"GPBR")
 
 SNC_HANDLE_NAMES (brightness_def_set,"SPBR")
 
 SNC_HANDLE_NAMES (cdpower_get,"GCDP")
 
 SNC_HANDLE_NAMES (cdpower_set,"SCDP","CDPW")
 
 SNC_HANDLE_NAMES (audiopower_get,"GAZP")
 
 SNC_HANDLE_NAMES (audiopower_set,"AZPW")
 
 SNC_HANDLE_NAMES (lanpower_get,"GLNP")
 
 SNC_HANDLE_NAMES (lanpower_set,"LNPW")
 
 SNC_HANDLE_NAMES (lidstate_get,"GLID")
 
 SNC_HANDLE_NAMES (indicatorlamp_get,"GILS")
 
 SNC_HANDLE_NAMES (indicatorlamp_set,"SILS")
 
 SNC_HANDLE_NAMES (gainbass_get,"GMGB")
 
 SNC_HANDLE_NAMES (gainbass_set,"CMGB")
 
 SNC_HANDLE_NAMES (PID_get,"GPID")
 
 SNC_HANDLE_NAMES (CTR_get,"GCTR")
 
 SNC_HANDLE_NAMES (CTR_set,"SCTR")
 
 SNC_HANDLE_NAMES (PCR_get,"GPCR")
 
 SNC_HANDLE_NAMES (PCR_set,"SPCR")
 
 SNC_HANDLE_NAMES (CMI_get,"GCMI")
 
 SNC_HANDLE_NAMES (CMI_set,"SCMI")
 
 MODULE_DEVICE_TABLE (acpi, sony_device_ids)
 
int sony_pic_camera_command (int command, u8 value)
 
 EXPORT_SYMBOL (sony_pic_camera_command)
 
 module_init (sony_laptop_init)
 
 module_exit (sony_laptop_exit)
 

Variables

struct sony_backlight_props sony_bl_props
 

Macro Definition Documentation

#define dprintk (   fmt,
  ... 
)
Value:
do { \
if (debug) \
pr_warn(fmt, ##__VA_ARGS__); \
} while (0)

Definition at line 75 of file sony-laptop.c.

#define ITERATIONS_LONG   10000

Definition at line 3058 of file sony-laptop.c.

#define ITERATIONS_SHORT   10

Definition at line 3059 of file sony-laptop.c.

#define MIN (   a,
  b 
)    (a > b ? b : a)

Definition at line 785 of file sony-laptop.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 45 of file sony-laptop.c.

#define SNC_HANDLE (   _name,
  _getters,
  _setters,
  _validate,
  _debug 
)
Value:
{ \
.name = __stringify(_name), \
.acpiget = _getters, \
.acpiset = _setters, \
.validate = _validate, \
.debug = _debug, \
.devattr = __ATTR(_name, 0, sony_nc_sysfs_show, sony_nc_sysfs_store), \
}

Definition at line 647 of file sony-laptop.c.

#define SNC_HANDLE_NAMES (   _name,
  _values... 
)    static char *snc_##_name[] = { _values, NULL }

Definition at line 644 of file sony-laptop.c.

#define SNC_HANDLE_NULL   { .name = NULL }

Definition at line 657 of file sony-laptop.c.

#define SNC_VALIDATE_IN   0

Definition at line 623 of file sony-laptop.c.

#define SNC_VALIDATE_OUT   1

Definition at line 624 of file sony-laptop.c.

#define SONY_LAPTOP_BUF_SIZE   128

Definition at line 186 of file sony-laptop.c.

#define SONY_LAPTOP_DRIVER_VERSION   "0.6"

Definition at line 81 of file sony-laptop.c.

#define SONY_MAX_BRIGHTNESS   8

Definition at line 621 of file sony-laptop.c.

#define SONY_NC_CLASS   "sony-nc"

Definition at line 83 of file sony-laptop.c.

#define SONY_NC_DRIVER_NAME   "Sony Notebook Control Driver"

Definition at line 85 of file sony-laptop.c.

#define SONY_NC_HID   "SNY5001"

Definition at line 84 of file sony-laptop.c.

#define SONY_PIC_CLASS   "sony-pic"

Definition at line 87 of file sony-laptop.c.

#define SONY_PIC_DRIVER_NAME   "Sony Programmable IO Control Driver"

Definition at line 89 of file sony-laptop.c.

#define SONY_PIC_FAN0_STATUS   0x93

Definition at line 3431 of file sony-laptop.c.

#define SONY_PIC_HID   "SNY6001"

Definition at line 88 of file sony-laptop.c.

#define SONYPI_BACK_MASK   0x00000020

Definition at line 2844 of file sony-laptop.c.

#define SONYPI_BATTERY_MASK   0x00001000

Definition at line 2851 of file sony-laptop.c.

#define SONYPI_BLUETOOTH_MASK   0x00000008

Definition at line 2842 of file sony-laptop.c.

#define SONYPI_CAMERA_AGC   6

Definition at line 3217 of file sony-laptop.c.

#define SONYPI_CAMERA_AGC_MASK   0x30

Definition at line 3218 of file sony-laptop.c.

#define SONYPI_CAMERA_BRIGHTNESS   0

Definition at line 3205 of file sony-laptop.c.

#define SONYPI_CAMERA_COLOR   3

Definition at line 3208 of file sony-laptop.c.

#define SONYPI_CAMERA_CONTRAST   1

Definition at line 3206 of file sony-laptop.c.

#define SONYPI_CAMERA_CONTROL   0x10

Definition at line 3222 of file sony-laptop.c.

#define SONYPI_CAMERA_CONTROL   0x10

Definition at line 3222 of file sony-laptop.c.

#define SONYPI_CAMERA_EXPOSURE_MASK   0xC

Definition at line 3211 of file sony-laptop.c.

#define SONYPI_CAMERA_HUE   2

Definition at line 3207 of file sony-laptop.c.

#define SONYPI_CAMERA_MUTE_MASK   0x40

Definition at line 3214 of file sony-laptop.c.

#define SONYPI_CAMERA_PICTURE   5

Definition at line 3202 of file sony-laptop.c.

#define SONYPI_CAMERA_PICTURE_MODE_MASK   0x30

Definition at line 3213 of file sony-laptop.c.

#define SONYPI_CAMERA_REVISION   8

Definition at line 3230 of file sony-laptop.c.

#define SONYPI_CAMERA_ROMVERSION   9

Definition at line 3231 of file sony-laptop.c.

#define SONYPI_CAMERA_SHARPNESS   4

Definition at line 3209 of file sony-laptop.c.

#define SONYPI_CAMERA_SHUTDOWN_REQUEST   7

Definition at line 3221 of file sony-laptop.c.

#define SONYPI_CAMERA_SHUTTER_MASK   0x7

Definition at line 3219 of file sony-laptop.c.

#define SONYPI_CAMERA_STATUS   7

Definition at line 3224 of file sony-laptop.c.

#define SONYPI_CAMERA_STATUS_POSITION   0x4

Definition at line 3226 of file sony-laptop.c.

#define SONYPI_CAMERA_STATUS_READY   0x2

Definition at line 3225 of file sony-laptop.c.

#define SONYPI_CAMERA_WHITE_BALANCE_MASK   0x3

Definition at line 3212 of file sony-laptop.c.

#define SONYPI_CAPTURE_MASK   0x00000002

Definition at line 2840 of file sony-laptop.c.

#define SONYPI_DEVICE_TYPE1   0x00000001

Definition at line 2790 of file sony-laptop.c.

#define SONYPI_DEVICE_TYPE2   0x00000002

Definition at line 2791 of file sony-laptop.c.

#define SONYPI_DEVICE_TYPE3   0x00000004

Definition at line 2792 of file sony-laptop.c.

#define SONYPI_DIRECTION_BACKWARDS   0x4

Definition at line 3228 of file sony-laptop.c.

#define SONYPI_FNKEY_MASK   0x00000004

Definition at line 2841 of file sony-laptop.c.

#define SONYPI_HELP_MASK   0x00000040

Definition at line 2845 of file sony-laptop.c.

#define SONYPI_JOGGER_MASK   0x00000001

Definition at line 2839 of file sony-laptop.c.

#define SONYPI_LID_MASK   0x00000080

Definition at line 2846 of file sony-laptop.c.

#define SONYPI_MEMORYSTICK_MASK   0x00000800

Definition at line 2850 of file sony-laptop.c.

#define SONYPI_MEYE_MASK   0x00000400

Definition at line 2849 of file sony-laptop.c.

#define SONYPI_PKEY_MASK   0x00000010

Definition at line 2843 of file sony-laptop.c.

#define SONYPI_THUMBPHRASE_MASK   0x00000200

Definition at line 2848 of file sony-laptop.c.

#define SONYPI_TYPE1_OFFSET   0x04

Definition at line 2794 of file sony-laptop.c.

#define SONYPI_TYPE2_OFFSET   0x12

Definition at line 2795 of file sony-laptop.c.

#define SONYPI_TYPE3_OFFSET   0x12

Definition at line 2796 of file sony-laptop.c.

#define SONYPI_WIRELESS_MASK   0x00002000

Definition at line 2852 of file sony-laptop.c.

#define SONYPI_ZOOM_MASK   0x00000100

Definition at line 2847 of file sony-laptop.c.

#define SPIC_ATTR (   _name,
  _mode 
)
Value:
struct device_attribute spic_attr_##_name = __ATTR(_name, \
_mode, sony_pic_## _name ##_show, \
sony_pic_## _name ##_store)

Definition at line 3469 of file sony-laptop.c.

#define THM_PROFILE_MAX   3

Definition at line 2068 of file sony-laptop.c.

#define wait_on_command (   command,
  iterations 
)
Value:
{ \
unsigned int n = iterations; \
while (--n && (command)) \
udelay(1); \
if (!n) \
dprintk("command failed at %s : %s (line %d)\n", \
__FILE__, __func__, __LINE__); \
}

Definition at line 3060 of file sony-laptop.c.

Enumeration Type Documentation

Enumerator:
HOTKEY 
KILLSWITCH 
GFX_SWITCH 

Definition at line 1179 of file sony-laptop.c.

Enumerator:
SONY_WIFI 
SONY_BLUETOOTH 
SONY_WWAN 
SONY_WIMAX 
N_SONY_RFKILL 

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

Function Documentation

EXPORT_SYMBOL ( sony_pic_camera_command  )
MODULE_AUTHOR ( "Stelian  Pop,
Mattia Dongili"   
)
MODULE_DESCRIPTION ( "Sony laptop extras driver (SPIC and SNC ACPI device)"  )
MODULE_DEVICE_TABLE ( acpi  ,
sony_device_ids   
)
module_exit ( sony_laptop_exit  )
module_init ( sony_laptop_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( debug  ,
int  ,
 
)
module_param ( no_spic  ,
int  ,
0444   
)
module_param ( compat  ,
int  ,
0444   
)
module_param ( mask  ,
ulong  ,
0644   
)
module_param ( camera  ,
int  ,
0444   
)
module_param ( kbd_backlight  ,
int  ,
0444   
)
module_param ( kbd_backlight_timeout  ,
int  ,
0444   
)
MODULE_PARM_DESC ( debug  ,
"set this to 1 (and RTFM) if you want to help ""the development of this driver  
)
MODULE_PARM_DESC ( no_spic  ,
"set this if you don't want to enable the SPIC device  
)
MODULE_PARM_DESC ( compat  ,
"set this if you want to enable backward compatibility mode  
)
MODULE_PARM_DESC ( mask  ,
"set this to the mask of event you want to enable (see doc)"   
)
MODULE_PARM_DESC ( camera  ,
"set this to 1 to enable Motion Eye camera controls ""(only use it if you have a C1VE or C1VN model)"   
)
MODULE_PARM_DESC ( kbd_backlight  ,
"set this to 0 to disable keyboard  backlight,
""1 to enable it(default:0)"   
)
MODULE_PARM_DESC ( kbd_backlight_timeout  ,
"set this to 0 to set the default 10 seconds  timeout,
""1 for 30  seconds,
2 for 60 seconds and 3 to disable timeout""(default:0)"   
)
MODULE_VERSION ( SONY_LAPTOP_DRIVER_VERSION  )
SNC_HANDLE_NAMES ( fnkey_get  ,
"GHKE"   
)
SNC_HANDLE_NAMES ( brightness_def_get  ,
"GPBR"   
)
SNC_HANDLE_NAMES ( brightness_def_set  ,
"SPBR"   
)
SNC_HANDLE_NAMES ( cdpower_get  ,
"GCDP"   
)
SNC_HANDLE_NAMES ( cdpower_set  ,
"SCDP"  ,
"CDPW"   
)
SNC_HANDLE_NAMES ( audiopower_get  ,
"GAZP"   
)
SNC_HANDLE_NAMES ( audiopower_set  ,
"AZPW"   
)
SNC_HANDLE_NAMES ( lanpower_get  ,
"GLNP"   
)
SNC_HANDLE_NAMES ( lanpower_set  ,
"LNPW"   
)
SNC_HANDLE_NAMES ( lidstate_get  ,
"GLID"   
)
SNC_HANDLE_NAMES ( indicatorlamp_get  ,
"GILS"   
)
SNC_HANDLE_NAMES ( indicatorlamp_set  ,
"SILS"   
)
SNC_HANDLE_NAMES ( gainbass_get  ,
"GMGB"   
)
SNC_HANDLE_NAMES ( gainbass_set  ,
"CMGB"   
)
SNC_HANDLE_NAMES ( PID_get  ,
"GPID"   
)
SNC_HANDLE_NAMES ( CTR_get  ,
"GCTR"   
)
SNC_HANDLE_NAMES ( CTR_set  ,
"SCTR"   
)
SNC_HANDLE_NAMES ( PCR_get  ,
"GPCR"   
)
SNC_HANDLE_NAMES ( PCR_set  ,
"SPCR"   
)
SNC_HANDLE_NAMES ( CMI_get  ,
"GCMI"   
)
SNC_HANDLE_NAMES ( CMI_set  ,
"SCMI"   
)
int sony_pic_camera_command ( int  command,
u8  value 
)

Definition at line 3300 of file sony-laptop.c.

Variable Documentation

Definition at line 1019 of file sony-laptop.c.