Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 1 | Sony 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.it | 3d2b8a9 | 2007-04-09 19:31:16 +0200 | [diff] [blame] | 6 | This mini-driver drives the SNC and SPIC device present in the ACPI BIOS of the |
| 7 | Sony Vaio laptops. This driver mixes both devices functions under the same |
| 8 | (hopefully consistent) interface. This also means that the sonypi driver is |
| 9 | obsoleted by sony-laptop now. |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 10 | |
malattia@linux.it | 3d2b8a9 | 2007-04-09 19:31:16 +0200 | [diff] [blame] | 11 | Fn keys (hotkeys): |
| 12 | ------------------ |
| 13 | Some models report hotkeys through the SNC or SPIC devices, such events are |
| 14 | reported both through the ACPI subsystem as acpi events and through the INPUT |
| 15 | subsystem. See the logs of acpid or /proc/acpi/event and |
| 16 | /proc/bus/input/devices to find out what those events are and which input |
Mattia Dongili | 54286fd | 2011-02-19 11:52:26 +0900 | [diff] [blame] | 17 | devices are created by the driver. Additionally, loading the driver with the |
| 18 | debug option will report all events in the kernel log. |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 19 | |
John Hughes | 747a562 | 2011-11-16 19:51:57 +0100 | [diff] [blame] | 20 | The "scancodes" passed to the input system (that can be remapped with udev) |
| 21 | are indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c |
| 22 | module. For example the "FN/E" key combination (EJECTCD on some models) |
| 23 | generates the scancode 20 (0x14). |
| 24 | |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 25 | Backlight control: |
| 26 | ------------------ |
| 27 | If your laptop model supports it, you will find sysfs files in the |
| 28 | /sys/class/backlight/sony/ |
| 29 | directory. You will be able to query and set the current screen |
| 30 | brightness: |
Matt LaPlante | 19f5946 | 2009-04-27 15:06:31 +0200 | [diff] [blame] | 31 | brightness get/set screen brightness (an integer |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 32 | 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 | |
| 38 | Platform specific: |
| 39 | ------------------ |
| 40 | Loading the sony-laptop module will create a |
| 41 | /sys/devices/platform/sony-laptop/ |
| 42 | directory populated with some files. |
| 43 | |
| 44 | You then read/write integer values from/to those files by using |
| 45 | standard UNIX tools. |
| 46 | |
| 47 | The 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.it | 3d2b8a9 | 2007-04-09 19:31:16 +0200 | [diff] [blame] | 54 | bluetoothpower power on/off the internal bluetooth device |
| 55 | fanspeed get/set the fan speed |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 56 | |
| 57 | Note that some files may be missing if they are not supported |
| 58 | by your particular laptop model. |
| 59 | |
| 60 | Example usage: |
| 61 | # echo "1" > /sys/devices/platform/sony-laptop/brightness_default |
| 62 | sets the lowest screen brightness for the next and later reboots, |
| 63 | # echo "8" > /sys/devices/platform/sony-laptop/brightness_default |
| 64 | sets the highest screen brightness for the next and later reboots, |
| 65 | # cat /sys/devices/platform/sony-laptop/brightness_default |
| 66 | retrieves the value. |
| 67 | |
| 68 | # echo "0" > /sys/devices/platform/sony-laptop/audiopower |
| 69 | powers off the sound card, |
| 70 | # echo "1" > /sys/devices/platform/sony-laptop/audiopower |
| 71 | powers on the sound card. |
| 72 | |
Mattia Dongili | 54286fd | 2011-02-19 11:52:26 +0900 | [diff] [blame] | 73 | |
| 74 | RFkill control: |
| 75 | --------------- |
| 76 | More recent Vaio models expose a consistent set of ACPI methods to |
| 77 | control radio frequency emitting devices. If you are a lucky owner of |
| 78 | such 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 Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 83 | Development: |
| 84 | ------------ |
| 85 | |
| 86 | If you want to help with the development of this driver (and |
| 87 | you are not afraid of any side effects doing strange things with |
| 88 | your ACPI BIOS could have on your laptop), load the driver and |
| 89 | pass the option 'debug=1'. |
| 90 | |
| 91 | REPEAT: DON'T DO THIS IF YOU DON'T LIKE RISKY BUSINESS. |
| 92 | |
| 93 | In your kernel logs you will find the list of all ACPI methods |
Mattia Dongili | 54286fd | 2011-02-19 11:52:26 +0900 | [diff] [blame] | 94 | the SNC device has on your laptop. |
| 95 | |
| 96 | * For new models you will see a long list of meaningless method names, |
| 97 | reading 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. |
| 103 | Some values in the capability lookup table are more or less known, see |
| 104 | the 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 |
| 107 | the CD drive, but there are others and they are usually different from |
| 108 | model to model. |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 109 | |
| 110 | I HAVE NO IDEA WHAT THOSE METHODS DO. |
| 111 | |
| 112 | The sony-laptop driver creates, for some of those methods (the most |
| 113 | current ones found on several Vaio models), an entry under |
| 114 | /sys/devices/platform/sony-laptop, just like the 'cdpower' one. |
| 115 | You can create other entries corresponding to your own laptop methods by |
malattia@linux.it | 3d2b8a9 | 2007-04-09 19:31:16 +0200 | [diff] [blame] | 116 | further editing the source (see the 'sony_nc_values' table, and add a new |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 117 | entry to this table with your get/set method names using the |
malattia@linux.it | 3d2b8a9 | 2007-04-09 19:31:16 +0200 | [diff] [blame] | 118 | SNC_HANDLE_NAMES macro). |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 119 | |
| 120 | Your mission, should you accept it, is to try finding out what |
| 121 | those entries are for, by reading/writing random values from/to those |
| 122 | files and find out what is the impact on your laptop. |
| 123 | |
| 124 | Should you find anything interesting, please report it back to me, |
| 125 | I will not disavow all knowledge of your actions :) |
| 126 | |
malattia@linux.it | 3d2b8a9 | 2007-04-09 19:31:16 +0200 | [diff] [blame] | 127 | See also http://www.linux.it/~malattia/wiki/index.php/Sony_drivers for other |
| 128 | useful info. |
| 129 | |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 130 | Bugs/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 Dongili | 54286fd | 2011-02-19 11:52:26 +0900 | [diff] [blame] | 140 | future, sonypi will be removed and replaced by sony-laptop. |
Mattia Dongili | ab5bd20 | 2007-02-08 20:16:41 +0100 | [diff] [blame] | 141 | |
| 142 | * spicctrl, which is the userspace tool used to communicate with the |
Mattia Dongili | 54286fd | 2011-02-19 11:52:26 +0900 | [diff] [blame] | 143 | sonypi driver (through /dev/sonypi) is deprecated as well since all |
| 144 | its features are now available under the sysfs tree via sony-laptop. |