add: pinebook-pro

This commit is contained in:
Andrea Ciceri 2022-03-28 12:11:57 +02:00
parent feceb4d24f
commit e1b2cf65a7
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
9 changed files with 586 additions and 3 deletions

View file

@ -47,7 +47,6 @@ There is also experimental flake support. In your `/etc/nixos/flake.nix` add the
}
```
### Using fetchGit
You can fetch the git repository directly:
@ -66,7 +65,7 @@ you can easily pin to a particular revision if you desire more stability.
See code for all available configurations.
| Model | Path |
|---------------------------------------------------------------------|----------------------------------------------------|
| ------------------------------------------------------------------- | -------------------------------------------------- |
| [Acer Aspire 4810T](acer/aspire/4810t) | `<nixos-hardware/acer/aspire/4810t>` |
| [Airis N990](airis/n990) | `<nixos-hardware/airis/n990>` |
| [Apple MacBook Air 3,X](apple/macbook-air/3) | `<nixos-hardware/apple/macbook-air/3>` |
@ -110,7 +109,7 @@ See code for all available configurations.
| [Intel NUC 8i7BEH](intel/nuc/8i7beh/) | `<nixos-hardware/intel/nuc/8i7beh>` |
| [Lenovo IdeaPad Z510](lenovo/ideapad/z510) | `<nixos-hardware/lenovo/ideapad/z510>` |
| [Lenovo Legion 5 15arh05h](lenovo/legion/15arh05h) | `<nixos-hardware/lenovo/legion/15arh05h>` |
| [Lenovo Legion 7 Slim 15ach6](lenovo/legion/15ach6) | `<nixos-hardware/lenovo/legion/15ach6>` |
| [Lenovo Legion 7 Slim 15ach6](lenovo/legion/15ach6) | `<nixos-hardware/lenovo/legion/15ach6>` |
| [Lenovo ThinkPad E14 (AMD)](lenovo/thinkpad/e14/amd) | `<nixos-hardware/lenovo/thinkpad/e14/amd>` |
| [Lenovo ThinkPad E14 (Intel)](lenovo/thinkpad/e14/intel) | `<nixos-hardware/lenovo/thinkpad/e14/intel>` |
| [Lenovo ThinkPad E470](lenovo/thinkpad/e470) | `<nixos-hardware/lenovo/thinkpad/e470>` |
@ -162,6 +161,7 @@ See code for all available configurations.
| [Microsoft Surface Range](microsoft/surface) | `<nixos-hardware/microsoft/surface>` |
| [One-Netbook OneNetbook 4](onenetbook/4) | `<nixos-hardware/onenetbook/4>` |
| [PC Engines APU](pcengines/apu) | `<nixos-hardware/pcengines/apu>` |
| [PINE64 Pinebook Pro](pine64/pinebook-pro/) | `<nixos-hardware/pine64/pinebook-pro>` |
| [Purism Librem 13v3](purism/librem/13v3) | `<nixos-hardware/purism/librem/13v3>` |
| [Purism Librem 15v3](purism/librem/13v3) | `<nixos-hardware/purism/librem/15v3>` |
| [Raspberry Pi 2](raspberry-pi/2) | `<nixos-hardware/raspberry-pi/2>` |

View file

@ -103,6 +103,7 @@
msi-gs60 = import ./msi/gs60;
onenetbook-4 = import ./onenetbook/4;
pcengines-apu = import ./pcengines/apu;
pine64-pinebook-pro = import ./pine64/pinebook-pro;
purism-librem-13v3 = import ./purism/librem/13v3;
purism-librem-15v3 = import ./purism/librem/15v3;
raspberry-pi-2 = import ./raspberry-pi/2;

View file

@ -0,0 +1,97 @@
> **NOTE**: This is an attempt to port [samueldr](https://github.com/samueldr/)'s [wip-pinebookpro](https://github.com/samueldr/wip-pinebook-pro) to [nixos-hardware](https://github.com/NixOS/nixos-hardware). Credit for the work done goes to the original authors.
## Using in your configuration
To use this configuration simply add this module to your configuration.
```nix
{
imports = [
${nixos-hardware}/pine64/pinebook-pro
];
}
```
That entry point will try to maximize the hardware compatibility.
## Current state
Currently everything seems to work but this is not guaranteed it will be forever.
### Kernel
This uses a pinned kernel that imitates a manually tested version of [Manjaro ARM kernel](https://gitlab.manjaro.org/manjaro-arm/packages/core/linux/-/blob/master/PKGBUILD), this way one can update `nixpkgs` without worrying too much.
This is default kernel but the current mainline kernel `linuxPackages_latest` seems to work too.
### Known issues
#### HDMI over Type-C
HDMI over Type-C works only for the custom kernel and the audio dosen't work (it's an upstream problem).
#### `rockchipdrm` and `efifb`
This can be worked around by booting with the `efifb=off` kernel command-line.
This is already handled for you by this configuration. If using the generic
UEFI AArch64 iso, you will need to add the option yourself to the command-line
using GRUB.
#### _EFI_ and poweroff
When booted using EFI, the system will not power off. It will stay seemingly
stuck with the LED and display turned off.
A [workaround exists](https://github.com/Tow-Boot/Tow-Boot/commit/818cae1b84a7702f2a509927f2819900c2881979#diff-20f50d9d8d5d6c059b87ad66fbc5df26d9fc46251763547ca9bdcc75564a4368),
and is built in recent Tow-Boot (make sure your release is 2021.10-004 or more recent).
### _Tow-Boot_
We highly suggest installing _Tow-Boot_ to the SPI Flash.
- https://github.com/Tow-Boot/Tow-Boot
Having the firmware installed to SPI makes the device act basically like a
normal computer. No need for weird incantations to setup the platform boot
firmware.
Alternatively, starting from the _Tow-Boot_ disk image on eMMC is easier to
deal with and understand than having to deal with _U-Boot_ manually.
### Mainline _U-Boot_
Mainline U-Boot has full support for graphics since 2021.04. The current
unstable relases of Nixpkgs are at 2021.04 at least.
```
$ nix-build -A pkgs.ubootPinebookPro
```
Note that the default U-Boot build does not do anything with LED on startup.
## Keyboard firmware
> **WARNING**: Some hardware batches for the Pinebook Pro ship with the
> wrong chip for the keyboard controller. While it will work with the
> firmware it ships with, it _may brick_ while flashing the updated
> firmware. [See this comment on the firmware repository](https://github.com/jackhumbert/pinebook-pro-keyboard-updater/issues/33#issuecomment-850889285).
>
> It is unclear how to identify said hardware from a running system.
To determine which keyboard controller you have, you will need to disassemble
the Pinebook Pro as per [the Pine64
wiki](https://wiki.pine64.org/wiki/Pinebook_Pro#Keyboard), and make sure that
the IC next to the U23 marking on the main board is an **SH68F83**.
```sh
$ nix-build -A pkgs.pinebookpro-keyboard-updater
$ sudo ./result/bin/updater step-1 <iso|ansi>
$ sudo poweroff
# ...
$ sudo ./result/bin/updater step-2 <iso|ansi>
$ sudo poweroff
# ...
$ sudo ./result/bin/updater flash-kb-revised <iso|ansi>
```
Note: poweroff must be used, reboot does not turn the hardware "off" enough.

View file

@ -0,0 +1,90 @@
# This configuration file can be safely imported in your system configuration.
{ config, pkgs, lib, ... }:
{
nixpkgs.overlays = [
(import ./overlay.nix)
];
boot.kernelPackages = lib.mkDefault pkgs.pinebookpro-manjaro-kernel;
# This list of modules is not entirely minified, but represents
# a set of modules that is required for the display to work in stage-1.
# Further minification can be done, but requires trial-and-error mainly.
boot.initrd.kernelModules = [
# Rockchip modules
"rockchip_rga"
"rockchip_saradc"
"rockchip_thermal"
"rockchipdrm"
# GPU/Display modules
"analogix_dp"
"cec"
"drm"
"drm_kms_helper"
"dw_hdmi"
"dw_mipi_dsi"
"gpu_sched"
"panel_edp"
"panel_simple"
"panfrost"
"pwm_bl"
# USB / Type-C related modules
"fusb302"
"tcpm"
"typec"
# Misc. modules
"cw2015_battery"
"gpio_charger"
"rtc_rk808"
];
services.udev.extraHwdb = lib.mkMerge [
# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/blob/master/10-usb-kbd.hwdb
''
evdev:input:b0003v258Ap001E*
KEYBOARD_KEY_700a5=brightnessdown
KEYBOARD_KEY_700a6=brightnessup
KEYBOARD_KEY_70066=sleep
''
# https://github.com/elementary/os/blob/05a5a931806d4ed8bc90396e9e91b5ac6155d4d4/build-pinebookpro.sh#L253-L257
# Disable the "keyboard mouse" in libinput. This is reported by the keyboard firmware
# and is probably a placeholder for a TrackPoint style mouse that doesn't exist
''
evdev:input:b0003v258Ap001Ee0110-e0,1,2,4,k110,111,112,r0,1,am4,lsfw
ID_INPUT=0
ID_INPUT_MOUSE=0
''
];
# https://github.com/elementary/os/blob/05a5a931806d4ed8bc90396e9e91b5ac6155d4d4/build-pinebookpro.sh#L253-L257
# Mark the keyboard as internal, so that "disable when typing" works for the touchpad
environment.etc."libinput/local-overrides.quirks".text = ''
[Pinebook Pro Keyboard]
MatchUdevType=keyboard
MatchBus=usb
MatchVendor=0x258A
MatchProduct=0x001E
AttrKeyboardIntegration=internal
'';
hardware.enableRedistributableFirmware = true;
hardware.firmware = [
pkgs.pinebookpro-ap6256-firmware
];
systemd.tmpfiles.rules = [
# Tweak the minimum frequencies of the GPU and CPU governors to get a bit more performance
# https://github.com/elementary/os/blob/05a5a931806d4ed8bc90396e9e91b5ac6155d4d4/build-pinebookpro.sh#L288-L294
"w- /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq - - - - 1200000"
"w- /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq - - - - 1008000"
"w- /sys/class/devfreq/ff9a0000.gpu/min_freq - - - - 600000000"
];
# The default powersave makes the wireless connection unusable.
networking.networkmanager.wifi.powersave = lib.mkDefault false;
}

View file

@ -0,0 +1,41 @@
{ lib
, fetchFromGitLab
, fetchurl
, runCommandNoCC
}:
let
src = fetchFromGitLab {
domain = "gitlab.manjaro.org";
owner = "manjaro-arm";
repo = "packages/community/ap6256-firmware";
rev = "007c6dd132263624db9ea6ce8dde4fc2108f21b7";
sha256 = "sha256-Agqz05W7Rhl0NNQwpW4aQqs9YZmYyci9OXKzEKA30uk=";
};
in
runCommandNoCC "pinebookpro-ap6256-firmware"
{
meta = with lib; {
license = licenses.unfreeRedistributable;
};
} ''
(PS4=" $ "; set -x
cp ${src}/"BCM4345C5.hcd" "BCM4345C5.hcd"
cp ${src}/"fw_bcm43456c5_ag.bin" "fw_bcm43456c5_ag.bin"
cp ${src}/"brcmfmac43456-sdio.clm_blob" "brcmfmac43456-sdio.clm_blob"
cp ${src}/"nvram_ap6256.txt" "nvram_ap6256.txt"
mkdir -p $out/lib/firmware/brcm
# Bluetooth firmware
install -Dm644 "BCM4345C5.hcd" -t "$out/lib/firmware/"
install -Dm644 "BCM4345C5.hcd" "$out/lib/firmware/brcm/BCM.hcd"
install -Dm644 "BCM4345C5.hcd" -t "$out/lib/firmware/brcm/"
# Wifi firmware
install -Dm644 "nvram_ap6256.txt" -t "$out/lib/firmware/"
install -Dm644 "fw_bcm43456c5_ag.bin" "$out/lib/firmware/brcm/brcmfmac43456-sdio.bin"
install -Dm644 "brcmfmac43456-sdio.clm_blob" "$out/lib/firmware/brcm/brcmfmac43456-sdio.clm_blob"
install -Dm644 "nvram_ap6256.txt" "$out/lib/firmware/brcm/brcmfmac43456-sdio.radxa,rockpi4b.txt"
install -Dm644 "nvram_ap6256.txt" "$out/lib/firmware/brcm/brcmfmac43456-sdio.radxa,rockpi4c.txt"
install -Dm644 "nvram_ap6256.txt" "$out/lib/firmware/brcm/brcmfmac43456-sdio.pine64,pinebook-pro.txt"
install -Dm644 "nvram_ap6256.txt" "$out/lib/firmware/brcm/brcmfmac43456-sdio.pine64,rockpro64-v2.1.txt"
)
''

View file

@ -0,0 +1,90 @@
{ pkgs, ... }:
let
pinnedNixpkgs = import
(builtins.fetchTarball {
name = "nixos-unstable-2022-03-28";
url = "https://github.com/nixos/nixpkgs/archive/ce8cbe3c01fd8ee2de526ccd84bbf9b82397a510.tar.gz";
sha256 = "19xfad7pxsp6nkrkjhn36w77w92m60ysq7njn711slw74yj6ibxv";
})
{
system = "aarch64-linux";
};
patches = [
# Assorted Manjaro ARM patches
"1001-arm64-dts-allwinner-add-hdmi-sound-to-pine-devices.patch" # Pine64
"1002-arm64-dts-allwinner-add-ohci-ehci-to-h5-nanopi.patch" # Nanopi Neo Plus 2
"1003-drm-bridge-analogix_dp-Add-enable_psr-param.patch" # Pinebook Pro
"1004-gpu-drm-add-new-display-resolution-2560x1440.patch" # Odroid
"1005-panfrost-Silence-Panfrost-gem-shrinker-loggin.patch" # Panfrost
"1006-arm64-dts-rockchip-Add-Firefly-Station-p1-support.patch" # Firelfy Station P1
"1007-drm-rockchip-add-support-for-modeline-32MHz-e.patch" # DP Alt Mode
"1008-rk3399-rp64-pcie-Reimplement-rockchip-PCIe-bus-scan-delay.patch" # RockPro64
"1010-arm64-dts-amlogic-add-initial-Beelink-GT1-Ultimate-dev.patch" # Beelink
"1011-arm64-dts-amlogic-add-meson-g12b-ugoos-am6-plus.patch" # Meson Ugoos
"1012-drm-panfrost-scheduler-improvements.patch" # Panfrost
"1013-arm64-dts-rockchip-Add-PCIe-bus-scan-delay-to-RockPr.patch" # RockPro64
"1014-drm-rockchip-support-gamma-control-on-RK3399.patch" # RK3399 VOP
"1015-media-rockchip-rga-do-proper-error-checking-in-probe.patch" # Rockchip RGA
"1016-arm64-dts-rockchip-switch-to-hs200-on-rockpi4.patch" # Radxa Rock Pi 4
"1017-arm64-dts-meson-remove-CPU-opps-below-1GHz-for-G12B-boards.patch" # AMLogic [1/2]
"1018-arm64-dts-meson-remove-CPU-opps-below-1GHz-for-SM1-boards.patch" # AMLogic [2/2]
"1019-arm64-dts-rockchip-Add-PCIe-bus-scan-delay-to-Rock-P.patch" # Radxa Rock Pi 4
# Assorted Pinebook, PinePhone and PineTab patches
"2001-Bluetooth-Add-new-quirk-for-broken-local-ext-features.patch" # Bluetooth
"2002-Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch" # Bluetooth
"2003-arm64-allwinner-a64-enable-Bluetooth-On-Pinebook.patch" # Bluetooth
"2004-arm64-dts-allwinner-enable-bluetooth-pinetab-pinepho.patch" # Bluetooth
"2005-staging-add-rtl8723cs-driver.patch" # Realtek WiFi
"2006-arm64-dts-allwinner-pinetab-add-accelerometer.patch" # Accelerometer
"2007-arm64-dts-allwinner-pinetab-enable-jack-detection.patch" # Audio
"2008-brcmfmac-USB-probing-provides-no-board-type.patch" # Bluetooth
"2009-dts-rockchip-Adapt-and-adopt-Type-C-support-from-Pin.patch" # DP Alt Mode
# Pinebook Pro Type-C patches from megous; original patch numbers found
# on https://xff.cz/kernels/5.17/patches/ are retained, with just the first
# digit changed from 0 to 3, to make tracking easier
"3170-arm64-dts-rk3399-pinebook-pro-Fix-USB-PD-charging.patch"
"3172-arm64-dts-rk3399-pinebook-pro-Improve-Type-C-support.patch"
"3174-arm64-dts-rk3399-pinebook-pro-Remove-redundant-pinct.patch"
"3178-arm64-dts-rk3399-pinebook-pro-Don-t-allow-usb2-phy-d.patch"
"3339-drm-rockchip-cdn-dp-Disable-CDN-DP-on-disconnect.patch"
"3355-usb-typec-fusb302-Set-the-current-before-enabling-pu.patch"
"3359-usb-typec-fusb302-Update-VBUS-state-even-if-VBUS-int.patch"
"3361-usb-typec-fusb302-Add-OF-extcon-support.patch"
"3362-usb-typec-fusb302-Fix-register-definitions.patch"
"3363-usb-typec-fusb302-Clear-interrupts-before-we-start-t.patch"
"3364-usb-typec-typec-extcon-Add-typec-extcon-bridge-drive.patch"
"3365-phy-rockchip-typec-Make-sure-the-plug-orientation-is.patch"
"3372-phy-rockchip-inno-usb2-More-robust-charger-detection.patch"
"3373-usb-typec-extcon-Don-t-touch-charger-proprties.patch"
];
manjaro-patches = pinnedNixpkgs.fetchgit {
url = "https://gitlab.manjaro.org/manjaro-arm/packages/core/linux.git";
rev = "d68667dfeb33a40a1ee5d6563ff4815e57ed9084";
sha256 = "04wb8nx5yw1r044i2cnd1dy4fc7whgn343iid0gqmyg5rk1ack2v";
};
create-patch = p: {
name = p;
patch = "${manjaro-patches}/${p}";
};
manjaro-kernel = pinnedNixpkgs.linuxPackagesFor (pinnedNixpkgs.linuxKernel.kernels.linux_5_16.override {
argsOverride = rec {
kernelPatches = map create-patch patches;
version = "5.16.18";
modDirVersion = version;
src = builtins.fetchurl {
url = "https://www.kernel.org/pub/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "sha256:096f80m2czj8khvil7s037pqdf1s6pklqn5d9419jqkz7v70piry";
};
};
});
in
{
inherit manjaro-kernel;
}

View file

@ -0,0 +1,26 @@
{ stdenv, fetchFromGitHub, xxd, libusb }:
stdenv.mkDerivation {
pname = "pinebook-pro-keyboard-updater";
version = "2021-07-28";
nativeBuildInputs = [
xxd
];
buildInputs = [
libusb
];
installPhase = ''
mkdir -p $out/bin
cp -v updater $out/bin
'';
src = fetchFromGitHub {
owner = "dragan-simic";
repo = "pinebook-pro-keyboard-updater";
rev = "bd8d2ea48992b3e6ddd0b9435d21b74cdcf97224";
hash = "sha256-3+Qsa5lk1EJrLvPSyWthqBMTqJCigbJSmnsS6hdu+w8=";
};
}

View file

@ -0,0 +1,11 @@
final: super:
let
inherit (final) callPackage kernelPatches linuxPackagesFor;
kernels = callPackage ./kernel { };
in
{
pinebookpro-manjaro-kernel = kernels.manjaro-kernel;
pinebookpro-ap6256-firmware = callPackage ./firmware/ap6256-firmware { };
pinebookpro-keyboard-updater = callPackage ./keyboard-updater { };
}

View file

@ -0,0 +1,227 @@
#!/usr/bin/env nix-shell
#! nix-shell -p ruby alsaUtils -i ruby
# This script resets the sound state to the minimum required for it to work.
# It will set the control that pulseaudio uses to 20%, everything else to the
# level expected for it to work. The rest will be off or to their default.
require "open3"
require "shellwords"
def run(*cmd)
puts " $ #{cmd.shelljoin}"
system(*cmd)
end
FINAL_STATE = {
## Simple mixer control 'Headphone',0
## Capabilities: pvolume
## Playback channels: Front Left - Front Right
## Limits: Playback 0 - 3
## Mono:
## Front Left: Playback 0 [0%] [-48.00dB]
## Front Right: Playback 0 [0%] [-48.00dB]
"Headphone,0" => "20%",
## Simple mixer control 'Headphone Mixer',0
## Capabilities: volume
## Playback channels: Front Left - Front Right
## Capture channels: Front Left - Front Right
## Limits: 0 - 11
## Front Left: 0 [0%] [-12.00dB]
## Front Right: 0 [0%] [-12.00dB]
"Headphone Mixer,0" => "0",
## Simple mixer control 'Mic Boost',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [on]
"Mic Boost,0" => "off",
## Simple mixer control 'Playback Polarity',0
## Capabilities: enum
## Items: 'Normal' 'R Invert' 'L Invert' 'L + R Invert'
## Item0: 'Normal'
"Playback Polarity,0" => "L Invert",
## Simple mixer control 'Capture Polarity',0
## Capabilities: enum
## Items: 'Normal' 'Invert'
## Item0: 'Normal'
"Capture Polarity,0" => "Normal",
## Simple mixer control 'ADC',0
## Capabilities: cvolume cvolume-joined
## Capture channels: Mono
## Limits: Capture 0 - 192
## Mono: Capture 0 [0%] [-99999.99dB]
"ADC,0" => "0",
## Simple mixer control 'ADC Double Fs',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"ADC Double Fs,0" => "off",
## Simple mixer control 'ADC PGA Gain',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 10
## Mono: 0 [0%]
"ADC PGA Gain,0" => "0",
## Simple mixer control 'ADC Soft Ramp',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [on]
"ADC Soft Ramp,0" => "on",
## Simple mixer control 'ALC',0
## Capabilities: cswitch cswitch-joined
## Capture channels: Mono
## Mono: Capture [off]
"ALC,0" => "nocap",
## Simple mixer control 'ALC Capture Attack Time',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 10
## Mono: 0 [0%]
"ALC Capture Attack Time,0" => "0",
## Simple mixer control 'ALC Capture Decay Time',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 10
## Mono: 0 [0%]
"ALC Capture Decay Time,0" => "0",
## Simple mixer control 'ALC Capture Hold Time',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 10
## Mono: 0 [0%]
"ALC Capture Hold Time,0" => "0",
## Simple mixer control 'ALC Capture Max',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 28
## Mono: 0 [0%] [-6.50dB]
"ALC Capture Max,0" => "0",
## Simple mixer control 'ALC Capture Min',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 28
## Mono: 0 [0%] [-12.00dB]
"ALC Capture Min,0" => "0",
## Simple mixer control 'ALC Capture Noise Gate',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"ALC Capture Noise Gate,0" => "off",
## Simple mixer control 'ALC Capture Noise Gate Threshold',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 31
## Mono: 0 [0%]
"ALC Capture Noise Gate Threshold,0" => "0",
## Simple mixer control 'ALC Capture Noise Gate Type',0
## Capabilities: enum
## Items: 'Constant PGA Gain' 'Mute ADC Output'
## Item0: 'Constant PGA Gain'
"ALC Capture Noise Gate Type,0" => "Constant PGA Gain",
## Simple mixer control 'ALC Capture Target',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 10
## Mono: 0 [0%] [-16.50dB]
"ALC Capture Target,0" => "0",
## Simple mixer control 'DAC',0
## Capabilities: pvolume
## Playback channels: Front Left - Front Right
## Limits: Playback 0 - 192
## Mono:
## Front Left: Playback 0 [0%] [-99999.99dB]
## Front Right: Playback 0 [0%] [-99999.99dB]
"DAC,0" => "100%",
## Simple mixer control 'DAC Double Fs',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"DAC Double Fs,0" => "off",
## Simple mixer control 'DAC Mono Mix',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"DAC Mono Mix,0" => "off",
## Simple mixer control 'DAC Notch Filter',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"DAC Notch Filter,0" => "off",
## Simple mixer control 'DAC Soft Ramp',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [on]
"DAC Soft Ramp,0" => "on",
## Simple mixer control 'DAC Soft Ramp Rate',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 4
## Mono: 0 [0%]
"DAC Soft Ramp Rate,0" => "0",
## Simple mixer control 'DAC Source Mux',0
## Capabilities: enum
## Items: 'LDATA TO LDAC, RDATA TO RDAC' 'LDATA TO LDAC, LDATA TO RDAC' 'RDATA TO LDAC, RDATA TO RDAC' 'RDATA TO LDAC, LDATA TO RDAC'
## Item0: 'LDATA TO LDAC, RDATA TO RDAC'
"DAC Source Mux,0" => "LDATA TO LDAC, RDATA TO RDAC",
## Simple mixer control 'DAC Stereo Enhancement',0
## Capabilities: volume volume-joined
## Playback channels: Mono
## Capture channels: Mono
## Limits: 0 - 7
## Mono: 0 [0%]
"DAC Stereo Enhancement,0" => "0",
## Simple mixer control 'Differential Mux',0
## Capabilities: enum
## Items: 'lin1-rin1' 'lin2-rin2' 'lin1-rin1 with 20db Boost' 'lin2-rin2 with 20db Boost'
## Item0: 'lin1-rin1'
"Differential Mux,0" => "lin1-rin1",
## Simple mixer control 'Digital Mic Mux',0
## Capabilities: enum
## Items: 'dmic disable' 'dmic data at high level' 'dmic data at low level'
## Item0: 'dmic disable'
"Digital Mic Mux,0" => "dmic disable",
## Simple mixer control 'Left Headphone Mixer LLIN',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"Left Headphone Mixer LLIN,0" => "off",
## Simple mixer control 'Left Headphone Mixer Left DAC',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"Left Headphone Mixer Left DAC,0" => "on",
## Simple mixer control 'Left Headphone Mux',0
## Capabilities: enum
## Items: 'lin1-rin1' 'lin2-rin2' 'lin-rin with Boost' 'lin-rin with Boost and PGA'
## Item0: 'lin1-rin1'
"Left Headphone Mux,0" => "lin1-rin1",
## Simple mixer control 'Right Headphone Mixer RLIN',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"Right Headphone Mixer RLIN,0" => "off",
## Simple mixer control 'Right Headphone Mixer Right DAC',0
## Capabilities: pswitch pswitch-joined
## Playback channels: Mono
## Mono: Playback [off]
"Right Headphone Mixer Right DAC,0" => "on",
## Simple mixer control 'Right Headphone Mux',0
## Capabilities: enum
## Items: 'lin1-rin1' 'lin2-rin2' 'lin-rin with Boost' 'lin-rin with Boost and PGA'
## Item0: 'lin1-rin1'
"Right Headphone Mux,0" => "lin1-rin1",
}
FINAL_STATE.each do |name, value|
run("amixer", "-c0", "sset", name, value.to_s)
raise "Error setting #{name} to #{value}" unless $?.success?
end