sony-laptop.rst 6.0 KB

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