Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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