19e1cbedeSMauro Carvalho Chehab=========================================
29e1cbedeSMauro Carvalho ChehabSony Notebook Control Driver (SNC) Readme
39e1cbedeSMauro Carvalho Chehab=========================================
49e1cbedeSMauro Carvalho Chehab
59e1cbedeSMauro Carvalho Chehab	- Copyright (C) 2004- 2005 Stelian Pop <stelian@popies.net>
69e1cbedeSMauro Carvalho Chehab	- Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
79e1cbedeSMauro Carvalho Chehab
89e1cbedeSMauro Carvalho ChehabThis mini-driver drives the SNC and SPIC device present in the ACPI BIOS of the
99e1cbedeSMauro Carvalho ChehabSony Vaio laptops. This driver mixes both devices functions under the same
109e1cbedeSMauro Carvalho Chehab(hopefully consistent) interface. This also means that the sonypi driver is
119e1cbedeSMauro Carvalho Chehabobsoleted by sony-laptop now.
129e1cbedeSMauro Carvalho Chehab
139e1cbedeSMauro Carvalho ChehabFn keys (hotkeys):
149e1cbedeSMauro Carvalho Chehab------------------
159e1cbedeSMauro Carvalho Chehab
169e1cbedeSMauro Carvalho ChehabSome models report hotkeys through the SNC or SPIC devices, such events are
179e1cbedeSMauro Carvalho Chehabreported both through the ACPI subsystem as acpi events and through the INPUT
189e1cbedeSMauro Carvalho Chehabsubsystem. See the logs of /proc/bus/input/devices to find out what those
199e1cbedeSMauro Carvalho Chehabevents are and which input devices are created by the driver.
209e1cbedeSMauro Carvalho ChehabAdditionally, loading the driver with the debug option will report all events
219e1cbedeSMauro Carvalho Chehabin the kernel log.
229e1cbedeSMauro Carvalho Chehab
239e1cbedeSMauro Carvalho ChehabThe "scancodes" passed to the input system (that can be remapped with udev)
249e1cbedeSMauro Carvalho Chehabare indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c
259e1cbedeSMauro Carvalho Chehabmodule.  For example the "FN/E" key combination (EJECTCD on some models)
269e1cbedeSMauro Carvalho Chehabgenerates the scancode 20 (0x14).
279e1cbedeSMauro Carvalho Chehab
289e1cbedeSMauro Carvalho ChehabBacklight control:
299e1cbedeSMauro Carvalho Chehab------------------
309e1cbedeSMauro Carvalho ChehabIf your laptop model supports it, you will find sysfs files in the
319e1cbedeSMauro Carvalho Chehab/sys/class/backlight/sony/
329e1cbedeSMauro Carvalho Chehabdirectory. You will be able to query and set the current screen
339e1cbedeSMauro Carvalho Chehabbrightness:
349e1cbedeSMauro Carvalho Chehab
359e1cbedeSMauro Carvalho Chehab	======================	=========================================
369e1cbedeSMauro Carvalho Chehab	brightness		get/set screen brightness (an integer
379e1cbedeSMauro Carvalho Chehab				between 0 and 7)
389e1cbedeSMauro Carvalho Chehab	actual_brightness	reading from this file will query the HW
399e1cbedeSMauro Carvalho Chehab				to get real brightness value
409e1cbedeSMauro Carvalho Chehab	max_brightness		the maximum brightness value
419e1cbedeSMauro Carvalho Chehab	======================	=========================================
429e1cbedeSMauro Carvalho Chehab
439e1cbedeSMauro Carvalho Chehab
449e1cbedeSMauro Carvalho ChehabPlatform specific:
459e1cbedeSMauro Carvalho Chehab------------------
469e1cbedeSMauro Carvalho ChehabLoading the sony-laptop module will create a
479e1cbedeSMauro Carvalho Chehab/sys/devices/platform/sony-laptop/
489e1cbedeSMauro Carvalho Chehabdirectory populated with some files.
499e1cbedeSMauro Carvalho Chehab
509e1cbedeSMauro Carvalho ChehabYou then read/write integer values from/to those files by using
519e1cbedeSMauro Carvalho Chehabstandard UNIX tools.
529e1cbedeSMauro Carvalho Chehab
539e1cbedeSMauro Carvalho ChehabThe files are:
549e1cbedeSMauro Carvalho Chehab
559e1cbedeSMauro Carvalho Chehab	======================	==========================================
569e1cbedeSMauro Carvalho Chehab	brightness_default	screen brightness which will be set
579e1cbedeSMauro Carvalho Chehab				when the laptop will be rebooted
589e1cbedeSMauro Carvalho Chehab	cdpower			power on/off the internal CD drive
599e1cbedeSMauro Carvalho Chehab	audiopower		power on/off the internal sound card
609e1cbedeSMauro Carvalho Chehab	lanpower		power on/off the internal ethernet card
619e1cbedeSMauro Carvalho Chehab				(only in debug mode)
629e1cbedeSMauro Carvalho Chehab	bluetoothpower		power on/off the internal bluetooth device
639e1cbedeSMauro Carvalho Chehab	fanspeed		get/set the fan speed
649e1cbedeSMauro Carvalho Chehab	======================	==========================================
659e1cbedeSMauro Carvalho Chehab
669e1cbedeSMauro Carvalho ChehabNote that some files may be missing if they are not supported
679e1cbedeSMauro Carvalho Chehabby your particular laptop model.
689e1cbedeSMauro Carvalho Chehab
699e1cbedeSMauro Carvalho ChehabExample usage::
709e1cbedeSMauro Carvalho Chehab
719e1cbedeSMauro Carvalho Chehab	# echo "1" > /sys/devices/platform/sony-laptop/brightness_default
729e1cbedeSMauro Carvalho Chehab
739e1cbedeSMauro Carvalho Chehabsets the lowest screen brightness for the next and later reboots
749e1cbedeSMauro Carvalho Chehab
759e1cbedeSMauro Carvalho Chehab::
769e1cbedeSMauro Carvalho Chehab
779e1cbedeSMauro Carvalho Chehab	# echo "8" > /sys/devices/platform/sony-laptop/brightness_default
789e1cbedeSMauro Carvalho Chehab
799e1cbedeSMauro Carvalho Chehabsets the highest screen brightness for the next and later reboots
809e1cbedeSMauro Carvalho Chehab
819e1cbedeSMauro Carvalho Chehab::
829e1cbedeSMauro Carvalho Chehab
839e1cbedeSMauro Carvalho Chehab	# cat /sys/devices/platform/sony-laptop/brightness_default
849e1cbedeSMauro Carvalho Chehab
859e1cbedeSMauro Carvalho Chehabretrieves the value
869e1cbedeSMauro Carvalho Chehab
879e1cbedeSMauro Carvalho Chehab::
889e1cbedeSMauro Carvalho Chehab
899e1cbedeSMauro Carvalho Chehab	# echo "0" > /sys/devices/platform/sony-laptop/audiopower
909e1cbedeSMauro Carvalho Chehab
919e1cbedeSMauro Carvalho Chehabpowers off the sound card
929e1cbedeSMauro Carvalho Chehab
939e1cbedeSMauro Carvalho Chehab::
949e1cbedeSMauro Carvalho Chehab
959e1cbedeSMauro Carvalho Chehab	# echo "1" > /sys/devices/platform/sony-laptop/audiopower
969e1cbedeSMauro Carvalho Chehab
979e1cbedeSMauro Carvalho Chehabpowers on the sound card.
989e1cbedeSMauro Carvalho Chehab
999e1cbedeSMauro Carvalho Chehab
1009e1cbedeSMauro Carvalho ChehabRFkill control:
1019e1cbedeSMauro Carvalho Chehab---------------
1029e1cbedeSMauro Carvalho ChehabMore recent Vaio models expose a consistent set of ACPI methods to
1039e1cbedeSMauro Carvalho Chehabcontrol radio frequency emitting devices. If you are a lucky owner of
1049e1cbedeSMauro Carvalho Chehabsuch a laptop you will find the necessary rfkill devices under
1059e1cbedeSMauro Carvalho Chehab/sys/class/rfkill. Check those starting with sony-* in::
1069e1cbedeSMauro Carvalho Chehab
1079e1cbedeSMauro Carvalho Chehab	# grep . /sys/class/rfkill/*/{state,name}
1089e1cbedeSMauro Carvalho Chehab
1099e1cbedeSMauro Carvalho Chehab
1109e1cbedeSMauro Carvalho ChehabDevelopment:
1119e1cbedeSMauro Carvalho Chehab------------
1129e1cbedeSMauro Carvalho Chehab
1139e1cbedeSMauro Carvalho ChehabIf you want to help with the development of this driver (and
1149e1cbedeSMauro Carvalho Chehabyou are not afraid of any side effects doing strange things with
1159e1cbedeSMauro Carvalho Chehabyour ACPI BIOS could have on your laptop), load the driver and
1169e1cbedeSMauro Carvalho Chehabpass the option 'debug=1'.
1179e1cbedeSMauro Carvalho Chehab
1189e1cbedeSMauro Carvalho ChehabREPEAT:
1199e1cbedeSMauro Carvalho Chehab	**DON'T DO THIS IF YOU DON'T LIKE RISKY BUSINESS.**
1209e1cbedeSMauro Carvalho Chehab
1219e1cbedeSMauro Carvalho ChehabIn your kernel logs you will find the list of all ACPI methods
1229e1cbedeSMauro Carvalho Chehabthe SNC device has on your laptop.
1239e1cbedeSMauro Carvalho Chehab
1249e1cbedeSMauro Carvalho Chehab* For new models you will see a long list of meaningless method names,
1259e1cbedeSMauro Carvalho Chehab  reading the DSDT table source should reveal that:
1269e1cbedeSMauro Carvalho Chehab
1279e1cbedeSMauro Carvalho Chehab(1) the SNC device uses an internal capability lookup table
1289e1cbedeSMauro Carvalho Chehab(2) SN00 is used to find values in the lookup table
1299e1cbedeSMauro Carvalho Chehab(3) SN06 and SN07 are used to call into the real methods based on
1309e1cbedeSMauro Carvalho Chehab    offsets you can obtain iterating the table using SN00
1319e1cbedeSMauro Carvalho Chehab(4) SN02 used to enable events.
1329e1cbedeSMauro Carvalho Chehab
1339e1cbedeSMauro Carvalho ChehabSome values in the capability lookup table are more or less known, see
1349e1cbedeSMauro Carvalho Chehabthe code for all sony_call_snc_handle calls, others are more obscure.
1359e1cbedeSMauro Carvalho Chehab
1369e1cbedeSMauro Carvalho Chehab* For old models you can see the GCDP/GCDP methods used to pwer on/off
1379e1cbedeSMauro Carvalho Chehab  the CD drive, but there are others and they are usually different from
1389e1cbedeSMauro Carvalho Chehab  model to model.
1399e1cbedeSMauro Carvalho Chehab
1409e1cbedeSMauro Carvalho Chehab**I HAVE NO IDEA WHAT THOSE METHODS DO.**
1419e1cbedeSMauro Carvalho Chehab
1429e1cbedeSMauro Carvalho ChehabThe sony-laptop driver creates, for some of those methods (the most
1439e1cbedeSMauro Carvalho Chehabcurrent ones found on several Vaio models), an entry under
1449e1cbedeSMauro Carvalho Chehab/sys/devices/platform/sony-laptop, just like the 'cdpower' one.
1459e1cbedeSMauro Carvalho ChehabYou can create other entries corresponding to your own laptop methods by
1469e1cbedeSMauro Carvalho Chehabfurther editing the source (see the 'sony_nc_values' table, and add a new
1479e1cbedeSMauro Carvalho Chehabentry to this table with your get/set method names using the
1489e1cbedeSMauro Carvalho ChehabSNC_HANDLE_NAMES macro).
1499e1cbedeSMauro Carvalho Chehab
1509e1cbedeSMauro Carvalho ChehabYour mission, should you accept it, is to try finding out what
1519e1cbedeSMauro Carvalho Chehabthose entries are for, by reading/writing random values from/to those
1529e1cbedeSMauro Carvalho Chehabfiles and find out what is the impact on your laptop.
1539e1cbedeSMauro Carvalho Chehab
1549e1cbedeSMauro Carvalho ChehabShould you find anything interesting, please report it back to me,
1559e1cbedeSMauro Carvalho ChehabI will not disavow all knowledge of your actions :)
1569e1cbedeSMauro Carvalho Chehab
1579e1cbedeSMauro Carvalho ChehabSee also http://www.linux.it/~malattia/wiki/index.php/Sony_drivers for other
1589e1cbedeSMauro Carvalho Chehabuseful info.
1599e1cbedeSMauro Carvalho Chehab
1609e1cbedeSMauro Carvalho ChehabBugs/Limitations:
1619e1cbedeSMauro Carvalho Chehab-----------------
1629e1cbedeSMauro Carvalho Chehab
1639e1cbedeSMauro Carvalho Chehab* This driver is not based on official documentation from Sony
1649e1cbedeSMauro Carvalho Chehab  (because there is none), so there is no guarantee this driver
1659e1cbedeSMauro Carvalho Chehab  will work at all, or do the right thing. Although this hasn't
1669e1cbedeSMauro Carvalho Chehab  happened to me, this driver could do very bad things to your
1679e1cbedeSMauro Carvalho Chehab  laptop, including permanent damage.
1689e1cbedeSMauro Carvalho Chehab
1699e1cbedeSMauro Carvalho Chehab* The sony-laptop and sonypi drivers do not interact at all. In the
1709e1cbedeSMauro Carvalho Chehab  future, sonypi will be removed and replaced by sony-laptop.
1719e1cbedeSMauro Carvalho Chehab
1729e1cbedeSMauro Carvalho Chehab* spicctrl, which is the userspace tool used to communicate with the
1739e1cbedeSMauro Carvalho Chehab  sonypi driver (through /dev/sonypi) is deprecated as well since all
1749e1cbedeSMauro Carvalho Chehab  its features are now available under the sysfs tree via sony-laptop.
175