samsung-galaxybook.rst 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. .. SPDX-License-Identifier: GPL-2.0-or-later
  2. ==========================
  3. Samsung Galaxy Book Driver
  4. ==========================
  5. Joshua Grisham <josh@joshuagrisham.com>
  6. This is a Linux x86 platform driver for Samsung Galaxy Book series notebook
  7. devices which utilizes Samsung's ``SCAI`` ACPI device in order to control
  8. extra features and receive various notifications.
  9. Supported devices
  10. =================
  11. Any device with one of the supported ACPI device IDs should be supported. This
  12. covers most of the "Samsung Galaxy Book" series notebooks that are currently
  13. available as of this writing, and could include other Samsung notebook devices
  14. as well.
  15. Status
  16. ======
  17. The following features are currently supported:
  18. - :ref:`Keyboard backlight <keyboard-backlight>` control
  19. - :ref:`Performance mode <performance-mode>` control implemented using the
  20. platform profile interface
  21. - :ref:`Battery charge control end threshold
  22. <battery-charge-control-end-threshold>` (stop charging battery at given
  23. percentage value) implemented as a battery hook
  24. - :ref:`Firmware Attributes <firmware-attributes>` to allow control of various
  25. device settings
  26. - :ref:`Handling of Fn hotkeys <keyboard-hotkey-actions>` for various actions
  27. - :ref:`Handling of ACPI notifications and hotkeys
  28. <acpi-notifications-and-hotkey-actions>`
  29. Because different models of these devices can vary in their features, there is
  30. logic built within the driver which attempts to test each implemented feature
  31. for a valid response before enabling its support (registering additional devices
  32. or extensions, adding sysfs attributes, etc). Therefore, it can be important to
  33. note that not all features may be supported for your particular device.
  34. The following features might be possible to implement but will require
  35. additional investigation and are therefore not supported at this time:
  36. - "Dolby Atmos" mode for the speakers
  37. - "Outdoor Mode" for increasing screen brightness on models with ``SAM0427``
  38. - "Silent Mode" on models with ``SAM0427``
  39. .. _keyboard-backlight:
  40. Keyboard backlight
  41. ==================
  42. A new LED class named ``samsung-galaxybook::kbd_backlight`` is created which
  43. will then expose the device using the standard sysfs-based LED interface at
  44. ``/sys/class/leds/samsung-galaxybook::kbd_backlight``. Brightness can be
  45. controlled by writing the desired value to the ``brightness`` sysfs attribute or
  46. with any other desired userspace utility.
  47. .. note::
  48. Most of these devices have an ambient light sensor which also turns
  49. off the keyboard backlight under well-lit conditions. This behavior does not
  50. seem possible to control at this time, but can be good to be aware of.
  51. .. _performance-mode:
  52. Performance mode
  53. ================
  54. This driver implements the
  55. Documentation/userspace-api/sysfs-platform_profile.rst interface for working
  56. with the "performance mode" function of the Samsung ACPI device.
  57. Mapping of each Samsung "performance mode" to its respective platform profile is
  58. performed dynamically by the driver, as not all models support all of the same
  59. performance modes. Your device might have one or more of the following mappings:
  60. - "Silent" maps to ``low-power``
  61. - "Quiet" maps to ``quiet``
  62. - "Optimized" maps to ``balanced``
  63. - "High performance" maps to ``performance``
  64. The result of the mapping can be printed in the kernel log when the module is
  65. loaded. Supported profiles can also be retrieved from
  66. ``/sys/firmware/acpi/platform_profile_choices``, while
  67. ``/sys/firmware/acpi/platform_profile`` can be used to read or write the
  68. currently selected profile.
  69. The ``balanced`` platform profile will be set during module load if no profile
  70. has been previously set.
  71. .. _battery-charge-control-end-threshold:
  72. Battery charge control end threshold
  73. ====================================
  74. This platform driver will add the ability to set the battery's charge control
  75. end threshold, but does not have the ability to set a start threshold.
  76. This feature is typically called "Battery Saver" by the various Samsung
  77. applications in Windows, but in Linux we have implemented the standardized
  78. "charge control threshold" sysfs interface on the battery device to allow for
  79. controlling this functionality from the userspace.
  80. The sysfs attribute
  81. ``/sys/class/power_supply/BAT1/charge_control_end_threshold`` can be used to
  82. read or set the desired charge end threshold.
  83. If you wish to maintain interoperability with the Samsung Settings application
  84. in Windows, then you should set the value to 100 to represent "off", or enable
  85. the feature using only one of the following values: 50, 60, 70, 80, or 90.
  86. Otherwise, the driver will accept any value between 1 and 100 as the percentage
  87. that you wish the battery to stop charging at.
  88. .. note::
  89. Some devices have been observed as automatically "turning off" the charge
  90. control end threshold if an input value of less than 30 is given.
  91. .. _firmware-attributes:
  92. Firmware Attributes
  93. ===================
  94. The following enumeration-typed firmware attributes are set up by this driver
  95. and should be accessible under
  96. ``/sys/class/firmware-attributes/samsung-galaxybook/attributes/`` if your device
  97. supports them:
  98. - ``power_on_lid_open`` (device should power on when the lid is opened)
  99. - ``usb_charging`` (USB ports can deliver power to connected devices even when
  100. the device is powered off or in a low sleep state)
  101. - ``block_recording`` (blocks access to camera and microphone)
  102. All of these attributes are simple boolean-like enumeration values which use 0
  103. to represent "off" and 1 to represent "on". Use the ``current_value`` attribute
  104. to get or change the setting on the device.
  105. Note that when ``block_recording`` is updated, the input device "Samsung Galaxy
  106. Book Lens Cover" will receive a ``SW_CAMERA_LENS_COVER`` switch event which
  107. reflects the current state.
  108. .. _keyboard-hotkey-actions:
  109. Keyboard hotkey actions (i8042 filter)
  110. ======================================
  111. The i8042 filter will swallow the keyboard events for the Fn+F9 hotkey (Multi-
  112. level keyboard backlight toggle) and Fn+F10 hotkey (Block recording toggle)
  113. and instead execute their actions within the driver itself.
  114. Fn+F9 will cycle through the brightness levels of the keyboard backlight. A
  115. notification will be sent using ``led_classdev_notify_brightness_hw_changed``
  116. so that the userspace can be aware of the change. This mimics the behavior of
  117. other existing devices where the brightness level is cycled internally by the
  118. embedded controller and then reported via a notification.
  119. Fn+F10 will toggle the value of the "block recording" setting, which blocks
  120. or allows usage of the built-in camera and microphone (and generates the same
  121. Lens Cover switch event mentioned above).
  122. .. _acpi-notifications-and-hotkey-actions:
  123. ACPI notifications and hotkey actions
  124. =====================================
  125. ACPI notifications will generate ACPI netlink events under the device class
  126. ``samsung-galaxybook`` and bus ID matching the Samsung ACPI device ID found on
  127. your device. The events can be received using userspace tools such as
  128. ``acpi_listen`` and ``acpid``.
  129. The Fn+F11 Performance mode hotkey will be handled by the driver; each keypress
  130. will cycle to the next available platform profile.