tvogel / vaio-f11-linux

Automatically exported from code.google.com/p/vaio-f11-linux
7 stars 2 forks source link

Sony-Laptop Module Support #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The Vaio comes with a Windows utility for changing the keyboard backlight 
settings. There is currently no way to access these settings on Linux.

Original issue reported on code.google.com by Jason.Donenfeld on 10 Feb 2010 at 10:10

GoogleCodeExporter commented 9 years ago

Original comment by Jason.Donenfeld on 10 Feb 2010 at 10:11

GoogleCodeExporter commented 9 years ago
I hope this could be fixed soon. It`s annoyng having the keyboard glowing 
whenever I
press a key. I suspect this could affect the already poor batery life.

Original comment by mruf...@gmail.com on 25 Feb 2010 at 6:32

GoogleCodeExporter commented 9 years ago
any update on this issue? I would like just to be able to turn completely off 
the 
keyboard backlight

Original comment by mar.ro...@gmail.com on 29 May 2010 at 4:31

GoogleCodeExporter commented 9 years ago
It seems that the ambient light sensor and keyboard back light are controlled 
via
ACPI.  I disassembled the DSDT from our BIOS and found them (and the methods), 
and
have been looking into the sony-laptop module in the kernel.  Anyone else 
interested
in collaborating and or swapping info to augment the sony-laptop module?

Original comment by c.ra...@gmail.com on 31 May 2010 at 12:10

GoogleCodeExporter commented 9 years ago
2 c.rammy
can you say, what methods (name) did you found?
I will try add they in sony-laptop module

Original comment by MFalal...@gmail.com on 1 Jul 2010 at 5:21

GoogleCodeExporter commented 9 years ago
Hello, just got a F121FX. Looking through the .dsl file... what are those 
methods called that control the keyboard backlight?
Thanks, Sam

Original comment by samini...@gmail.com on 6 Sep 2010 at 3:36

GoogleCodeExporter commented 9 years ago
Same issue in VPCS120FL

Original comment by suga92 on 25 Sep 2010 at 7:26

GoogleCodeExporter commented 9 years ago
Hello, I can control keyboard backlight on my VAIO VPCS12A7R, but not trough 
ACPI, I'm use embedded controller. I'm write tiny code to do this.
May be this help to hack this option.

With best regards!

P.S. Sorry for my bad english.

Original comment by AlKo...@gmail.com on 14 Dec 2010 at 9:26

Attachments:

GoogleCodeExporter commented 9 years ago
Same issue on VPCS12C5E

Original comment by alec...@toshiba-connect.it on 15 Dec 2010 at 1:10

GoogleCodeExporter commented 9 years ago
Hmm. On Your laptop would work my small util. Please try it.
If this util would work on Your laptop, tell me please.

Original comment by AlKo...@gmail.com on 15 Dec 2010 at 2:57

Attachments:

GoogleCodeExporter commented 9 years ago
Hello. I have the S13.

Alkozel , your util can manage the backlight ? How it is set? In linux natively 
backlight is activated when we type. In windows it is based on the ambient 
light.

Original comment by dheraul...@gmail.com on 21 Dec 2010 at 9:27

GoogleCodeExporter commented 9 years ago
Yes, but not based on ALS, this util can set off, or on (backlight is activated 
when we type)

Original comment by AlKo...@gmail.com on 23 Dec 2010 at 10:03

GoogleCodeExporter commented 9 years ago
Warning this util write to the EC, this util testet on VPCS12 models only.
on other models i recomend to check the address that control backlight. You can 
use the ectool (http://www.coreboot.org/Laptop) to check this.

With best regards!

Original comment by AlKo...@gmail.com on 23 Dec 2010 at 10:08

GoogleCodeExporter commented 9 years ago
Ouch , looks very hard !

What is the risk if i try with a S13 without ectool ? 

And when he is installed , what we should type to put on or off your tool ? 

Original comment by dheraul...@gmail.com on 23 Dec 2010 at 8:36

GoogleCodeExporter commented 9 years ago
Sorry, but i don't known. This util write directly to the EC...
I'm help You, if help my.
Download the ectool.
Compile it, and run these command (need root)

ectool > 1.txt
sleep 5; ectool > 2.txt
sleep 20; ectool > 3.txt

after You run command, please don't touch keyboard.

Send these files to me.

Original comment by AlKo...@gmail.com on 25 Dec 2010 at 3:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I can do this.. I have a vpcs12c5e. Might be useful trying it on my laptop? 

Two question:
1. if I compile it, it can somehow dangerous for my computer?
2. this tool will control the keyboard backlight; but it will use the light 
sensor or I have to set it manually?

Original comment by alec...@toshiba-connect.it on 26 Jan 2011 at 12:02

GoogleCodeExporter commented 9 years ago
@10: Works on Sony Vaio VPCS11E7E! Thank you very much!

Original comment by shibo...@gmail.com on 27 Jan 2011 at 11:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have confirmation for your model - this util worked on VPCS12C5
Sorry this util not use backlight sensor, You can manually switch off keyboard 
backlight or switch on (automatic on backlit, when You touch any key on 
keyboard).

Original comment by AlKo...@gmail.com on 27 Jan 2011 at 11:31

GoogleCodeExporter commented 9 years ago
Thanks! It works!
Now my laptop is running with almost full of its power.. it lacks only the 
ambient light sensor to tune the keyboard backlight!

Thanks again!

Original comment by alec...@toshiba-connect.it on 28 Jan 2011 at 10:46

GoogleCodeExporter commented 9 years ago
I tried decoding ectool's output for an hour but failed to see a pattern for my 
VPCF127FX. There were a lot of changes for a seemingly idle laptop. What I did 
is to "watch" it every 0.5s. In the course of 1 minute, there were more than a 
dozen changes to the controller's memory.

I ruled out all these changing spots when I lit the keyboard up, but there were 
no newly changed spot as far as I could tell.

AlKozel, if it works the same as in your laptop. Can you tell me what trick you 
used/what to look out for to discover the right memory range?.

Thanks.

Original comment by vanhtu1...@gmail.com on 2 Feb 2011 at 9:18

GoogleCodeExporter commented 9 years ago
watch -n0 ectool

please give me output of these commands:

ectool > 1.txt
sleep 5; ectool > 2.txt
sleep 20; ectool > 3.txt

Original comment by AlKo...@gmail.com on 2 Feb 2011 at 8:21

GoogleCodeExporter commented 9 years ago
Here it is: http://tinypaste.com/590b6

I tried watching the output in real time and diffing the output at different 
times with no fruits. I can give out a series of output at predefined interval 
(say 0.1s) if that is helpful.

Thanks.

Original comment by vanhtu1...@gmail.com on 3 Feb 2011 at 3:16

GoogleCodeExporter commented 9 years ago
@ AIKo, 

 I am having the same issue with my VAIO VPCF111FX. If I can't get it fixed I am going to have to go back to Windows because my battery drains way to fast with the screen at maximum brightness and the keyboard always lighting up with ever key I hit. Do you think your utility will fix my issue? If so you are my hero! 

Original comment by anthony....@googlemail.com on 6 Feb 2011 at 9:08

GoogleCodeExporter commented 9 years ago
Hello,
I'm working on my VPCS12C5E laptop, and I can say that the keyboard backlight 
control will be available in sony-laptop, hopefully, soon (using the ACPI 
interface). May I have a couple of VPCF DSDT files to check whether it might 
work there too? Thanks!

Original comment by ma...@absence.it on 8 Feb 2011 at 5:30

GoogleCodeExporter commented 9 years ago
Here it is, there are a bunch more files that the tool outputs, please tell me 
if you need anything else. My laptop is VPCF127FX.

Thanks.

Original comment by vanhtu1...@gmail.com on 8 Feb 2011 at 6:00

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for your quick reply. I just had a really quick look but it seems 
that stuff like the ALS sensor, the keyboard backlight and the battery charge 
limiter can be controlled in the same way I do with my vpcs. Please, have some 
more patience until the code is ready, I might attach here a patch later, for 
testing purpose only.
Thanks.

Original comment by ma...@absence.it on 8 Feb 2011 at 7:12

GoogleCodeExporter commented 9 years ago
PS: your exact VPCF model?

Original comment by ma...@absence.it on 8 Feb 2011 at 7:13

GoogleCodeExporter commented 9 years ago
The exact name is VPCF127FX, which I suppose F is the series, 127F the model 
name and X being black.

It is very good to know that this can be fixed. I have been battling with the 
backlight every once in a while,

Thanks.

Original comment by vanhtu1...@gmail.com on 8 Feb 2011 at 7:29

GoogleCodeExporter commented 9 years ago
I would love to give it a try if you will kindly provide a patch for kernel 
2.6.36.3 or to the specific files changed :) .

Original comment by vanhtu1...@gmail.com on 8 Feb 2011 at 7:32

GoogleCodeExporter commented 9 years ago
Hello, can you confirm that under linux the keyboard backlight default settings 
are: on, 10 sec timeout (+ fade out)? A patch is coming...
And may I ask you to perform a couple of tests with the ALS as soon as I 
prepare the code? Thanks

Original comment by ma...@absence.it on 10 Feb 2011 at 8:12

GoogleCodeExporter commented 9 years ago
It is precisely 15 seconds since I press a key (+keyboard lights up) until it 
completely fades out. When a key is pressed, it lights up at medium brightness 
for 1 sec, stays lit up at maximum level for 13 secs then fades out in 1 sec.

Original comment by vanhtu1...@gmail.com on 10 Feb 2011 at 8:26

GoogleCodeExporter commented 9 years ago
Does the Vaio Control Center show four possible settings (10 secs, 30 secs, 60 
secs, nerver)? Is it something like this: 
http://absence.it/vaio-acpi/VPCS-ves_vcc/tastiera.png ?
I'm attaching the patch (apply against 2.6.36.3) with some more stuff you have 
to test as well. Ok, you should be now able to see in 
/sys/device/platform/sony-laptop these files:
- kbd_backlight: 1 backlight enabled on key pressure, 0 disabled (default on 
module loading)
- kbd_backlight_timeout: 0 -> 10 secs (default), 1 -> 30 secs, 2 -> 60 secs, 3 
-> always on
- battery_charge_limiter: 0 disabled (full 100% charge), 1 limit at 80%, 2 
limit at 50%
- touchpad: read -> touchpad status, write -> enable (1)/ disable (0).
The touchpad control use to fail on my Vaio S, but might work for you, please 
let me know (about the status changes too). You could also check whether the 
wireless interfaces on/off status is preserved across reboot/power off.
After trying all this stuff please attach a "dmesg > dmesg.log" and/or the 
kern.log file. Feedback and testers are very welcome.
I'm going to provide another patch for the ALS in the next days. See you soon.

Original comment by ma...@absence.it on 11 Feb 2011 at 11:55

Attachments:

GoogleCodeExporter commented 9 years ago
I couldn't recall how it looked like since I don't have Windows on my laptop 
anymore, but it's very likely to be the same as yours. Although I measured the 
time with a stopwatch so 15 secs were accurate.

The patch applied successfully against drivers/platform/x86/sony-laptop.c , but 
gave errors when I compiled it:
-------------
$ make -j12 SHELL=/bin/bash M=drivers/platform/x86/
  CC [M]  drivers/platform/x86/sony-laptop.o
drivers/platform/x86/sony-laptop.c:980:10: error: 
‘SONYPI_EVENT_VENDOR_PRESSED’ undeclared here (not in a function)
drivers/platform/x86/sony-laptop.c:2109:10: error: ‘SONYPI_EVENT_IGNORE’ 
undeclared here (not in a function)
drivers/platform/x86/sony-laptop.c:2109:2: error: initializer element is not 
constant
drivers/platform/x86/sony-laptop.c:2109:2: error: (near initialization for 
‘sonypi_wlessev[0].event’)
drivers/platform/x86/sony-laptop.c:2110:2: error: initializer element is not 
constant
drivers/platform/x86/sony-laptop.c:2110:2: error: (near initialization for 
‘sonypi_wlessev[1].event’)
drivers/platform/x86/sony-laptop.c:1473:13: warning: 
‘sony_nc_optdev_update’ defined but not used
drivers/platform/x86/sony-laptop.c:1523:12: warning: ‘sony_nc_optdev_setup’ 
defined but not used
drivers/platform/x86/sony-laptop.c:1552:12: warning: 
‘sony_nc_optdev_cleanup’ defined but not used
make[1]: *** [drivers/platform/x86/sony-laptop.o] Error 1
make: *** [_module_drivers/platform/x86] Error 2
-------------

After reverse-applied the patch, I could compile the module again. One thing to 
note is that applying the patch showed a lot of offsets warning (Hunk #64 
succeeded at 3284 (offset 4 lines), etc.) . Can you make sure that this is for 
2.6.36.3?. Running 2.6.37 is not an option for me since I've had a lot of 
stability problems with it.

Thank you

Original comment by vanhtu1...@gmail.com on 11 Feb 2011 at 12:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I added these two lines to sonypi.h and it compiled well, I'm testing the 
module at the moment.

#define SONYPI_EVENT_VENDOR_PRESSED             73
#define SONYPI_EVENT_IGNORE                     74

Original comment by vanhtu1...@gmail.com on 11 Feb 2011 at 1:04

GoogleCodeExporter commented 9 years ago
Thank you!. I have tested all the new settings and they worked great, took 
effect immediately. The touchpad could be enabled/disabled without problem. 
Finally the wait is over (bar the ALS issue :) .

I'm reluctant to reboot (what I did was reloading the module) so I cannot check 
if wifi state will be consistent at the moment. But I am sure others will be 
eager to verify that for you. Here are the relevant logs when I loaded the old 
module and the patched one:
-----------
Feb 11 12:54:55 foobar dhclient: DHCPREQUEST on wlan0 to 1.1.1.1 port 67
Feb 11 12:54:55 foobar dhclient: DHCPACK from 1.1.1.1
Feb 11 12:54:55 foobar dhclient: bound to 10.32.65.95 -- renewal in 237 seconds.
Feb 11 12:57:14 foobar kernel: sony-laptop: Sony Notebook Control Driver v0.6.
Feb 11 12:57:14 foobar NetworkManager[5809]: <info> found WiFi radio killswitch 
rfkill15 (at 
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/SNY5001:00/rfkill/rfki
ll15) (driver Sony Notebook Control Driver)
Feb 11 12:57:14 foobar kernel: input: Sony Vaio Keys as 
/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/SNY5001:00/input/input48
Feb 11 12:57:14 foobar kernel: input: Sony Vaio Jogdial as 
/devices/virtual/input/input49
Feb 11 12:57:16 foobar blueman-mechanism: Starting blueman-mechanism
Feb 11 12:57:46 foobar blueman-mechanism: Exiting
Feb 11 12:58:53 foobar dhclient: DHCPREQUEST on wlan0 to 1.1.1.1 port 67
Feb 11 12:58:53 foobar dhclient: DHCPACK from 1.1.1.1
Feb 11 12:58:53 foobar dhclient: bound to 10.32.65.95 -- renewal in 253 seconds.
Feb 11 13:02:12 foobar NetworkManager[5809]: <info> radio killswitch 
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/SNY5001:00/rfkill/rfki
ll15 disappeared
Feb 11 13:02:27 foobar kernel: sony-laptop: Sony Notebook Control Driver v0.6.
Feb 11 13:02:27 foobar NetworkManager[5809]: <info> found WiFi radio killswitch 
rfkill17 (at 
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/SNY5001:00/rfkill/rfki
ll17) (driver Sony Notebook Control Driver)
Feb 11 13:02:27 foobar kernel: input: Sony Vaio Keys as 
/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/SNY5001:00/input/input50
Feb 11 13:02:27 foobar kernel: input: Sony Vaio Jogdial as 
/devices/virtual/input/input51
Feb 11 13:03:06 foobar dhclient: DHCPREQUEST on wlan0 to 1.1.1.1 port 67
Feb 11 13:03:06 foobar dhclient: DHCPACK from 1.1.1.1
Feb 11 13:03:06 foobar dhclient: bound to 10.32.65.95 -- renewal in 300 seconds.
Feb 11 13:03:09 foobar -- MARK --
-----------

I hope to be the first to test the ALS patch. Thanks.

Original comment by vanhtu1...@gmail.com on 11 Feb 2011 at 1:14

GoogleCodeExporter commented 9 years ago
Yeah, I'm sorry, I forgot about the header file changes. A new patch is 
attached.
I also forgot to tell you to load the sony-laptop module with the "debug=1" 
parameter, otherwise the log files are useless. I'd like to see whether the 
kernel complains about the touchpad state change. Thanks

Original comment by ma...@absence.it on 11 Feb 2011 at 8:16

Attachments:

GoogleCodeExporter commented 9 years ago
Here is the relevant lines in my everything.log: http://pastebin.com/DLkVMcWE . 
The patch compiled and worked fine and it seemed there were no errors reported 
about the touchpad.

Thanks

Original comment by vanhtu1...@gmail.com on 11 Feb 2011 at 8:37

GoogleCodeExporter commented 9 years ago
Thank you very much :) It looks like today I can't help but making mistakes 
(the battery_charge_limiter was reporting incorrect values), the right patch 
attached.
Ok, good, but I have to ask you: when disabled, does the touchpad preserve its 
state when exiting from the suspend or hibernation mode? And... do you remember 
whether it was possible, in Windows, to power down the DVD drive? Is this 
feature available on this notebook?

Original comment by ma...@absence.it on 11 Feb 2011 at 10:02

Attachments:

GoogleCodeExporter commented 9 years ago
The battery_charge_limiter reported the correct value for me (1) but that might 
be a coincidence. The touchpad remained disabled when I suspended and resumed 
the laptop, enabling it worked fine after that.

I'm not aware that you can power down the DVD drive. I made a search for that 
feature in Sony laptops without success, so I think it is unlikely (or it was 
hidden for access by software). What I have been doing is blacklisting sr_mod 
in the hopes that would save some power.

I did a reboot today and it looked like my Wifi stayed off at boot up (it was 
off when restarted).

Original comment by vanhtu1...@gmail.com on 12 Feb 2011 at 12:59

GoogleCodeExporter commented 9 years ago
An unrelated issue: Sometimes around kernel 2.6.36 to 2.6.37 I experienced odd 
USB errors for the built-in Bluetooth USB device:
---
usb 1-1.6: device descriptor read/8, error -110
usb 1-1.6: device descriptor read/8, error -110
hub 1-1:1.0: unable to enumerate USB device on port 6
(6-9 lines more)
---

It only happens at boot up and other USB devices are not functional. The errors 
happen between 2 to 3 minutes and stopped. Afterwards, all USB devices work. 
Except for the bluetooth that I have to disable, enable, disable and enable 
again to make it work.

I'm not sure where to report this issue so I'm sorry if this is not the right 
place.

Original comment by vanhtu1...@gmail.com on 12 Feb 2011 at 1:00

GoogleCodeExporter commented 9 years ago
Ok, very good :)
About the DVD device, some portable Vaios (such as the S and Z series) have the 
ability to turn the drive off, while some others have not (the E and, I now 
suppose [1], the F series). The patch applies to the S and Z series as well, if 
someone cares.
Regarding the USB issue, have a look at bugzilla.kernel.org, maybe it's an 
already known issue.

[1] and the DSDT you provided seems to prove it.

Original comment by ma...@absence.it on 12 Feb 2011 at 8:30

GoogleCodeExporter commented 9 years ago
Hello again. Even though an ALS related issue is already present at this site, 
I'm posting here the patch for testing the light sensor (it also includes a new 
fine grain lcd backlight control). Apply against a clean 2.6.36.3. Load the 
module with the debug=1 parameter and please attach a "dmesg > dmesg.log" 
and/or the kern.log file after the following tests.
Once done, I need some feedback, I need to understand whether the ALS present 
on your vaio acts like the one I have on mine.
So, follow:
- echo 1 > /sys/device/platform/sony-laptop/als_power
- echo 3 > /sys/device/platform/sony-laptop/als_interrupt_enable
- cat /sys/device/platform/sony-laptop/als_interrupt_enable
tell me whether you see 3 or 0.
Then:
- start acpi_listen in a new terminal
- echo 1 > /sys/device/platform/sony-laptop/als_lsen
- echo 1 > /sys/device/platform/sony-laptop/als_interrupt_enable
- cat /sys/device/platform/sony-laptop/als_interrupt_enable
tell me whether you read 1 or 0, the event shown by acpi_listen and how many 
times it's been notified, and whether you can change the backlight through the 
Fn-F5/F6 combos. Please provide your ALS model too (read als_model). It should 
be enough at the moment.

Original comment by ma...@absence.it on 21 Feb 2011 at 12:30

Attachments:

GoogleCodeExporter commented 9 years ago
I have moved on to kernel 2.6.37.1 as it seems to have fixed the USB issue 
(among others). Your latest patch (along with vaio-test3.patch) can apply 
cleanly against 2.6.37.1 if the hunk at 3573 is removed. Just FYI.

I'm testing the patch and will report soon.

Original comment by vanhtu1...@gmail.com on 21 Feb 2011 at 1:13

GoogleCodeExporter commented 9 years ago
Here is the relevant log: http://tinypaste.com/e4446

als_power was already set to 1 .
als_interrupt_enable was 0, I changed it to 3, but it remained 0 afterward.

I have removed support for the deprecated /proc/acpi in the kernel so I cannot 
run acpid (I haven't used acpid for quite a while). If there is other way to 
listen for event, I'll be happy to test.

als_lsen was 2560 .
als_interrupt_enable was 0, I changed it to 1, but it remained 0 afterward.

I can change the backlight with nvidia_bl and have bound the keys to Fn-F5/F6, 
although nvidia_bl exposes it through 
/sys/class/backlight/nvidia_backlight/brightness so I am not sure if your 
method is the same.

als_model says "Unknown ALS model" :( . Is there a kernel module that I need to 
enable? (I disabled most ALS devices in the config).

Thanks

Original comment by vanhtu1...@gmail.com on 21 Feb 2011 at 1:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I found that TSL2550 is in the kernel config, but TSL256[0-3] is in staging 
section. Do you suppose enabling those modules will allow sony-laptop to 
control it?.

The ALS device name seems to be hard-coded in a look up table in the patch so 
it looks like enabling the modules won't do anything. But I might be wrong.

Update: I have looked at the files under /sys/class/backlight/ . There are 
acpi_video0, nvidia_backlight and sony . nvidia_backlight shows the correct 
values when I change brightness, but the files in the other two directories 
remained the same:
$ ls /sys/class/backlight/sony/
actual_brightness  bl_power  brightness  max_brightness  power  subsystem  
uevent
$ cat /sys/class/backlight/sony/*
255
0
255
255
cat: /sys/class/backlight/sony/power: Is a directory
cat: /sys/class/backlight/sony/subsystem: Is a directory

$ ls /sys/class/backlight/nvidia_backlight/
actual_brightness  bl_power  brightness  max_brightness  power  subsystem  
uevent
$ cat /sys/class/backlight/nvidia_backlight/*
2300
0
2300
3968
cat: /sys/class/backlight/nvidia_backlight/power: Is a directory
cat: /sys/class/backlight/nvidia_backlight/subsystem: Is a directory

Original comment by vanhtu1...@gmail.com on 21 Feb 2011 at 2:05