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