Sony-laptop

From MalaWiki
Jump to: navigation, search

This driver enables the use of the SNY5001 (a.k.a. SNC)[1] and SNY6001 (a.k.a. SPIC)[2] ACPI devices functions available on many (you may have one of them, both or none(?)) Sony Vaio notebooks.
The device signature in the disassembled DSDT looks like the following:

Device (SNC)
{
    Name (_HID, EisaId ("SNY5001"))
    ...
}

and

Device (SPIC)
{
    Name (_HID, EisaId ("SNY6001"))
    ...
}
[1] from kernel 2.6.21-rc1, when the driver has been merged mainline
[2] only from kernel 2.6.22-rc1, previous kernel handled this device with sonypi only

Contents

Warning!

This driver is not based on official documentation from Sony (because there is none), so there is no guarantee this driver will work at all, or do the right thing. Although this hasn't happened to me, this driver could do very bad things to your laptop, including permanent damage.

SNY5001 (a.k.a. SNC)

In the SNC device section you will find many Method declarations.
Please see http://tjworld.net/sony-laptop/ for an overview of Methods available on different VAIO models built on using DSDT files that many users kindly submitted (send me yours as well).

Known Methods

Some (or all) of these methods may be missing on your specific notebook model. Loading the driver with debug=1 can help discovering methods.

Brightness

  • set: SBRT
  • get: GBRT

Brightness control is specially handled registering through the kernel's backlight subsystem. A new backlight device is registered and will appear under

/sys/class/backlight/sony/

Allowed values range from 0 to 7.
Note: some Vaios using an NVidia graphic card will need a different utility[3] to modify the screen brightness, even though the ACPI bios provides SBRT/GBRT Methods. Moreover the NVidia bundle provides the nvidia-settings utility which can be used to change the screen brightness:

$ nvidia-settings --assign GreenBrightness=0.5                                                                             
$ nvidia-settings --assign RedBrightness=0.5                                                                               
$ nvidia-settings --assign BlueBrightness=0.5

Note 2: Some FZ and SZ vaios using the Intel GM965/GL960 card can hopefully use xbacklight to control the brightness level.

[3] you can use the smartdimmer helper or a recent version of nvclock

Power on Brightness

  • set: SPBR
  • get: GPBR

You can set the brightness value for the next (and later) boot.

/sys/devices/platform/sony-laptop/brightness_default

Allowed values range from 1 to 8.

CD/DVD device power

  • set: SCDP, CDPW (depending on the model)
  • get: GCDP
/sys/devices/platform/sony-laptop/cdpower

Write 0 to poweroff the device, 1 to power it on.

Sound card power

  • set: AZPW
  • get: GAZP
/sys/devices/platform/sony-laptop/audiopower

Write 0 to poweroff the device, 1 to power it on.

Ethernet adapter power

  • set: LNPW
  • get: GLNP
/sys/devices/platform/sony-laptop/lanpower

Write 0 to poweroff the device, 1 to power it on. Be careful! I myself have never been able to resurrect the lan adapter without rebooting (ACPI tells the device is disabled).

Bass boost

  • GMGB: get current
  • CMGB: set current
  • SMGB: set default (will boot with this value)

Arguments can be 0 or 1.

Programmable key

  • GPKC
  • SPKC

"If you set SPKC to 0 and turn off the computer, subsequently pressing this key has no effect. But if SPKC had been set to 1 then pressing this key will turn on the computer and set PWAK to 1."

PPK Timer Led

  • GILS (get)
  • SILS (set)

"Takes values of 0 or 1. When set to 1, the yellow information light on the left front edge begins blinking. This happens in Windows when the PPK timer applet is set or the computer is hibernating."

Lid status

  • GLID

Returns 0 if the lid is closed, 1 if open.

Other users' findings

SNY6001 (a.k.a. SPIC)

This device was formerly managed by the sonypi driver. From kernel 2.6.22-rc1 support has been added to sony-laptop to support the SNY6001. Sony-laptop uses a lot of code from sonypi, the main difference being that sony-laptop uses ACPI to initialize the device and get the possible resources.

Backward compatibility

For some time sony-laptop will retain (or aims to) compatibility with the sonypi userspace interface, set SONYPI_COMPAT=y in your .config to make the driver create and manage the /dev/sonypi device node. Most of the sonypi functions are managed differently:

  • the battery, ac and temperature informations can be obtained by the ACPI subsystem (/proc/acpi)
  • bluetooth_power and fan_speed are platform_device attributes (see /sys/devices/platform/sony-laptop)
  • brightness control is available through the backlight subsystem (see /sys/class/backlight/sony)

The MEYE driver has switched to using sony-laptop as well.

Uses

Fan speed control

The speed of the fan can be user-controlled only partially in my experience. Fortunately the BIOS will re-increase the fan speed when necessary, you don't really want to fry your CPU right? Anyway, one way to change the fan speed is writing a positive integer value to

/sys/devices/platform/sony-laptop/fanspeed

If you have SONYPI_COMPAT set (see above), you can also change the fan speed using spicctrl or similar utilities.

Bluetooth power

You can power on/off the the integrated bluetooth device writing 1 (enable) or 0 (disable) to

/sys/devices/platform/sony-laptop/bluetoothpower

If you have SONYPI_COMPAT set (see above), you can also switch the bluetooth power using spicctrl or similar utilities.

WWAN power

Some newer Vaio models (currently some SZ models) have an integrated GPRS/EDGE modem that can be powered on/off by writing 1 (enable) or 0 (disable) to

/sys/devices/platform/sony-laptop/wwanpower

C1VE/C1VN camera

Not working up to 2.6.24, in previous versions there was a bug that prevented usage of sony-laptop on C1VE/C1VN and Z505 models.
The MEYE driver is now using sony-laptop to enable/disable the integrated camera and change the video device settings.

Sonypi deprecation

Yes, sonypi will be deprecated sooner or later, so test sony-laptop and report problems to have them fixed in the new driver if it doesn't work as expected.

Fn keys (hotkeys)

Fn keys are managed either through SNC or SPIC depending on the model. In either case the driver creates two new input devices Sony Vaio Keys and Sony Vaio Jogdial to forward key/button events to the input subsystem.

Fn keys in X

Recent X.Org server version can automatically detect (among other features) input devices and will automatically add the Sony Vaio Keys device for you.
One issue though is that the X11 protocol can only handle keycodes up to 255.
Don't panic yet.
The Linux kernel allows remapping internal scancodes (those emitted by the driver) to meaningful keycodes (those understood by userspace applications) and udev is already configured to do so without you having to do anything.
So, the kernel finds the Sony Vaio Keys device:

input: Sony Vaio Keys as /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:09/SNY6001:00/input/input4

and X.Org finds it too:

(II) config/udev: Adding input device Sony Vaio Keys (/dev/input/event4)
(**) Sony Vaio Keys: Applying InputClass "evdev keyboard catchall"
(**) Sony Vaio Keys: always reports core events
(**) Sony Vaio Keys: Device: "/dev/input/event4"
(II) Sony Vaio Keys: Found keys
(II) Sony Vaio Keys: Configuring as keyboard
(II) XINPUT: Adding extended input device "Sony Vaio Keys" (type: KEYBOARD)
(**) Option "xkb_rules" "evdev"
(**) Option "xkb_model" "a4techKB21"
(**) Option "xkb_layout" "jp"
(**) Option "xkb_options" "lv3:ralt_switch"

And finally you can use input-kbd or /lib/udev/keymap to display the current keymap, i.e.:

sudo /lib/udev/keymap -i /dev/input/event4
Press ESC to finish
...
scan code: 0x10   key code: brightnessdown
...

or

sudo input-kbd 4
0x0000 = 212  # KEY_CAMERA
0x0004 = 465  # KEY_FN_ESC
0x0005 = 466  # KEY_FN_F1
...

In theory your desktop manager should Just Work (tm).

Possible issues

TODO

  • My hotkeys are not working!

Fn keys in X - the old way

You can configure X.Org to receive those key-presses adding the a new InputDevice Section to your xorg.conf:

Section "InputDevice"
        Identifier  "Vaio keys"
        Driver      "evdev"
        Option      "Name" "Sony Vaio Keys"
        Option      "XkbLayout" "jp"
        Option      "XkbModel" "jp106"
EndSection

Section "ServerLayout"
        ...
        InputDevice    "Vaio keys" "SendCoreEvents"
EndSection

Fn key events are also forwarded as ACPI events so they can also be managed through acpid.
See also http://people.freedesktop.org/~hughsient/quirk/quirk-keymap-modules.html for an example on how to remap sony-laptop (in kernels >= 2.6.23-rc1) scancodes with hal (you ned a very recent version of hal as well).
Note: many recent Vaio FE models still have problems with Fn key management. With the help of some user I'm trying to debug and understand where the problem lies. Stay tuned. Update: this has been resolved in kernels >= 2.6.23-rc1.


Mattia Dongili 00:13, 22 November 2010 (CET)

Personal tools