Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[pandora-kernel.git] / Documentation / laptops / sony-laptop.txt
1 Sony Notebook Control Driver (SNC) Readme
2 -----------------------------------------
3         Copyright (C) 2004- 2005 Stelian Pop <stelian@popies.net>
4         Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
5
6 This mini-driver drives the SNC and SPIC device present in the ACPI BIOS of the
7 Sony Vaio laptops. This driver mixes both devices functions under the same
8 (hopefully consistent) interface. This also means that the sonypi driver is
9 obsoleted by sony-laptop now.
10
11 Fn keys (hotkeys):
12 ------------------
13 Some models report hotkeys through the SNC or SPIC devices, such events are
14 reported both through the ACPI subsystem as acpi events and through the INPUT
15 subsystem. See the logs of acpid or /proc/acpi/event and
16 /proc/bus/input/devices to find out what those events are and which input
17 devices are created by the driver. Additionally, loading the driver with the
18 debug option will report all events in the kernel log.
19
20 Backlight control:
21 ------------------
22 If your laptop model supports it, you will find sysfs files in the
23 /sys/class/backlight/sony/
24 directory. You will be able to query and set the current screen
25 brightness:
26         brightness              get/set screen brightness (an integer
27                                 between 0 and 7)
28         actual_brightness       reading from this file will query the HW
29                                 to get real brightness value
30         max_brightness          the maximum brightness value
31
32
33 Platform specific:
34 ------------------
35 Loading the sony-laptop module will create a
36 /sys/devices/platform/sony-laptop/
37 directory populated with some files.
38
39 You then read/write integer values from/to those files by using
40 standard UNIX tools.
41
42 The files are:
43         brightness_default      screen brightness which will be set
44                                 when the laptop will be rebooted
45         cdpower                 power on/off the internal CD drive
46         audiopower              power on/off the internal sound card
47         lanpower                power on/off the internal ethernet card
48                                 (only in debug mode)
49         bluetoothpower          power on/off the internal bluetooth device
50         fanspeed                get/set the fan speed
51
52 Note that some files may be missing if they are not supported
53 by your particular laptop model.
54
55 Example usage:
56         # echo "1" > /sys/devices/platform/sony-laptop/brightness_default
57 sets the lowest screen brightness for the next and later reboots,
58         # echo "8" > /sys/devices/platform/sony-laptop/brightness_default
59 sets the highest screen brightness for the next and later reboots,
60         # cat /sys/devices/platform/sony-laptop/brightness_default
61 retrieves the value.
62
63         # echo "0" > /sys/devices/platform/sony-laptop/audiopower
64 powers off the sound card,
65         # echo "1" > /sys/devices/platform/sony-laptop/audiopower
66 powers on the sound card.
67
68
69 RFkill control:
70 ---------------
71 More recent Vaio models expose a consistent set of ACPI methods to
72 control radio frequency emitting devices. If you are a lucky owner of
73 such a laptop you will find the necessary rfkill devices under
74 /sys/class/rfkill. Check those starting with sony-* in
75         # grep . /sys/class/rfkill/*/{state,name}
76
77
78 Development:
79 ------------
80
81 If you want to help with the development of this driver (and
82 you are not afraid of any side effects doing strange things with
83 your ACPI BIOS could have on your laptop), load the driver and
84 pass the option 'debug=1'.
85
86 REPEAT: DON'T DO THIS IF YOU DON'T LIKE RISKY BUSINESS.
87
88 In your kernel logs you will find the list of all ACPI methods
89 the SNC device has on your laptop.
90
91 * For new models you will see a long list of meaningless method names,
92 reading the DSDT table source should reveal that:
93 (1) the SNC device uses an internal capability lookup table
94 (2) SN00 is used to find values in the lookup table
95 (3) SN06 and SN07 are used to call into the real methods based on
96     offsets you can obtain iterating the table using SN00
97 (4) SN02 used to enable events.
98 Some values in the capability lookup table are more or less known, see
99 the code for all sony_call_snc_handle calls, others are more obscure.
100
101 * For old models you can see the GCDP/GCDP methods used to pwer on/off
102 the CD drive, but there are others and they are usually different from
103 model to model.
104
105 I HAVE NO IDEA WHAT THOSE METHODS DO.
106
107 The sony-laptop driver creates, for some of those methods (the most
108 current ones found on several Vaio models), an entry under
109 /sys/devices/platform/sony-laptop, just like the 'cdpower' one.
110 You can create other entries corresponding to your own laptop methods by
111 further editing the source (see the 'sony_nc_values' table, and add a new
112 entry to this table with your get/set method names using the
113 SNC_HANDLE_NAMES macro).
114
115 Your mission, should you accept it, is to try finding out what
116 those entries are for, by reading/writing random values from/to those
117 files and find out what is the impact on your laptop.
118
119 Should you find anything interesting, please report it back to me,
120 I will not disavow all knowledge of your actions :)
121
122 See also http://www.linux.it/~malattia/wiki/index.php/Sony_drivers for other
123 useful info.
124
125 Bugs/Limitations:
126 -----------------
127
128 * This driver is not based on official documentation from Sony
129   (because there is none), so there is no guarantee this driver
130   will work at all, or do the right thing. Although this hasn't
131   happened to me, this driver could do very bad things to your
132   laptop, including permanent damage.
133
134 * The sony-laptop and sonypi drivers do not interact at all. In the
135   future, sonypi will be removed and replaced by sony-laptop.
136
137 * spicctrl, which is the userspace tool used to communicate with the
138   sonypi driver (through /dev/sonypi) is deprecated as well since all
139   its features are now available under the sysfs tree via sony-laptop.