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