sony-laptop.txt 5.6 KB

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