Skip to content

Commit

Permalink
Fix alsa rules (#18)
Browse files Browse the repository at this point in the history
* Simplify and fix alsa rules&config

* Fix naming
  • Loading branch information
pvizeli authored Apr 2, 2020
1 parent 554fc59 commit 14579c9
Show file tree
Hide file tree
Showing 31 changed files with 71 additions and 1,436 deletions.
6 changes: 1 addition & 5 deletions rootfs/lib/udev/rules.d/90-alsa-restore.rules
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2014 Stephan Raue ([email protected])

# When a sound device is detected, restore the volume settings
KERNEL=="controlC[0-9]*", NAME="snd/%k", ACTION=="add", RUN+="soundconfig %k"
ACTION=="add|move", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", RUN+="soundconfig %k"
147 changes: 70 additions & 77 deletions rootfs/lib/udev/soundconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,134 +16,127 @@ mixer() {
(
. /etc/profile

if [ -f /data/internal/sound.conf ]; then

alsactl restore -f /data/internal/sound.conf

else

# get card num
card=`echo $1 | sed 's/[^0-9]*//g'`
card=`echo $1 | sed 's/[^0-9]*//g'`

# set common mixer params
mixer $card Master 0db
mixer $card Front 100%
mixer $card PCM 0db
mixer $card Synth 100%
mixer $card Master 0db
mixer $card Front 100%
mixer $card PCM 0db
mixer $card Synth 100%

# mute CD, since using digital audio instead
mixer $card CD 0% mute
mixer $card CD 0% mute

# Only unmute Line and Aux if they are possibly used.
# mixer $card Line 100%
# mixer $card Aux 100%

# mute mic
mixer $card Mic 0% mute
mixer $card Mic 0% mute

# ESS 1969 chipset has 2 PCM channels
mixer $card PCM,1 100%
mixer $card PCM,1 100%

# Trident/YMFPCI/emu10k1
mixer $card Wave 100%
mixer $card Music 100%
mixer $card AC97 100%
mixer $card Surround 90%
mixer $card 'Surround Digital' 90%
mixer $card 'Wave Surround' 90%
mixer $card 'Duplicate Front' 90%
mixer $card 'Sigmatel 4-Speaker Stereo' 90%
mixer $card Wave 100%
mixer $card Music 100%
mixer $card AC97 100%
mixer $card Surround 90%
mixer $card 'Surround Digital' 90%
mixer $card 'Wave Surround' 90%
mixer $card 'Duplicate Front' 90%
mixer $card 'Sigmatel 4-Speaker Stereo' 90%

# CS4237B chipset:
mixer $card 'Master Digital' 100%
mixer $card 'Master Digital' 100%

# DRC
mixer $card 'Dynamic Range Compression' 90%
mixer $card 'Dynamic Range Compression' 90%

# Envy24 chips with analog outs
mixer $card DAC 100%
mixer $card DAC,0 100%
mixer $card DAC,1 100%
mixer $card DAC 100%
mixer $card DAC,0 100%
mixer $card DAC,1 100%

# some notebooks use headphone instead of master
mixer $card Headphone 100%
mixer $card Speaker 100%
mixer $card 'Internal Speaker' 0% mute
mixer $card Playback 100%
mixer $card Headphone 100%
mixer $card Speaker 100%
mixer $card Center 100%
mixer $card LFE 100%
mixer $card Center/LFE 100%
mixer $card Headphone 100%
mixer $card Speaker 100%
mixer $card 'Internal Speaker' 0% mute
mixer $card Playback 100%
mixer $card Headphone 100%
mixer $card Speaker 100%
mixer $card Center 100%
mixer $card LFE 100%
mixer $card Center/LFE 100%

# Intel P4P800-MX (Ubuntu bug #5813)
mixer $card 'Master Playback Switch' on
mixer $card 'Master Playback Switch' on

# set digital output mixer params
mixer $card 'IEC958' 100% on
mixer $card 'IEC958 Output' 100%
mixer $card 'IEC958 Coaxial' 100%
mixer $card 'IEC958 LiveDrive' 100%
mixer $card 'IEC958 Optical Raw' 100%
mixer $card 'SPDIF Out' 100%
mixer $card 'SPDIF Front' 100%
mixer $card 'SPDIF Rear' 100%
mixer $card 'SPDIF Center/LFE' 100%
mixer $card 'Master Digital' 100%

mixer $card 'Analog Front' 100%
mixer $card 'Analog Rear' 100%
mixer $card 'Analog Center/LFE' 100%
mixer $card 'IEC958' 100% on
mixer $card 'IEC958 Output' 100%
mixer $card 'IEC958 Coaxial' 100%
mixer $card 'IEC958 LiveDrive' 100%
mixer $card 'IEC958 Optical Raw' 100%
mixer $card 'SPDIF Out' 100%
mixer $card 'SPDIF Front' 100%
mixer $card 'SPDIF Rear' 100%
mixer $card 'SPDIF Center/LFE' 100%
mixer $card 'Master Digital' 100%

mixer $card 'Analog Front' 100%
mixer $card 'Analog Rear' 100%
mixer $card 'Analog Center/LFE' 100%

# ASRock ION 330 (and perhaps others) has 2 IEC958 channels
mixer $card IEC958,0 on
mixer $card IEC958,1 on
mixer $card IEC958,0 on
mixer $card IEC958,1 on

# some ION2 has much more IEC958 channels ...
mixer $card IEC958,2 on
mixer $card IEC958,3 on
mixer $card IEC958,2 on
mixer $card IEC958,3 on

# ASRock ION 330 has Master Front set to 0
mixer $card 'Master Front' 100%
mixer $card 'Master Front' 100%

# Shuttle XS35GT needs this too
mixer $card 'Master',0 100% on
mixer $card 'Master',0 100% on

# and this for various Fusion devices like Zotac ZBOX
mixer $card 'Front',0 100% on
mixer $card 'Front',0 100% on

# NVidia CK804 sound devices
mixer $card 'IEC958 Playback AC97-SPSA' 100%
mixer $card 'IEC958 Playback AC97-SPSA' 100%

# Allwinner H3 Analog
mixer $card 'Line Out' 0db on
mixer $card 'Line Out' 0db on

# Allwinner A20 Analog
mixer $card 'Power Amplifier' 0db
mixer $card 'Power Amplifier DAC' on
mixer $card 'Power Amplifier Mute' on
mixer $card 'Power Amplifier' 0db
mixer $card 'Power Amplifier DAC' on
mixer $card 'Power Amplifier Mute' on

# Allwinner A64 Analog
mixer $card Headphone 0db on
mixer $card 'AIF1 Slot 0 Digital DAC' on
mixer $card Headphone 0db on
mixer $card 'AIF1 Slot 0 Digital DAC' on

# Amlogic G12 HDMI to PCM0
mixer $card 'FRDDR_A SINK 1 SEL' 'OUT 1'
mixer $card 'FRDDR_A SRC 1 EN' on
mixer $card 'TDMOUT_B SRC SEL' 'IN 0'
mixer $card 'TOHDMITX I2S SRC' 'I2S B'
mixer $card 'TOHDMITX' on
mixer $card 'FRDDR_A SINK 1 SEL' 'OUT 1'
mixer $card 'FRDDR_A SRC 1 EN' on
mixer $card 'TDMOUT_B SRC SEL' 'IN 0'
mixer $card 'TOHDMITX I2S SRC' 'I2S B'
mixer $card 'TOHDMITX' on

# Amlogic G12 S/PDIF to PCM1
mixer $card 'FRDDR_B SINK 1 SEL' 'OUT 3'
mixer $card 'FRDDR_B SRC 1 EN' on
mixer $card 'SPDIFOUT SRC SEL' 'IN 1'
mixer $card 'SPDIFOUT Playback' on
mixer $card 'FRDDR_B SINK 1 SEL' 'OUT 3'
mixer $card 'FRDDR_B SRC 1 EN' on
mixer $card 'SPDIFOUT SRC SEL' 'IN 1'
mixer $card 'SPDIFOUT Playback' on

# Amlogic GX HDMI and S/PDIF
mixer $card 'AIU HDMI CTRL SRC' 'I2S'
mixer $card 'AIU SPDIF SRC SEL' 'SPDIF'
fi
mixer $card 'AIU HDMI CTRL SRC' 'I2S'
mixer $card 'AIU SPDIF SRC SEL' 'SPDIF'

exit 0
)&
34 changes: 0 additions & 34 deletions rootfs/usr/share/alsa/cards/G12A-SEI510.conf

This file was deleted.

66 changes: 0 additions & 66 deletions rootfs/usr/share/alsa/cards/G12A-TANIX-TX5MAX.conf

This file was deleted.

66 changes: 0 additions & 66 deletions rootfs/usr/share/alsa/cards/G12A-U200.conf

This file was deleted.

Loading

0 comments on commit 14579c9

Please sign in to comment.