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