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