Blob Blame History Raw
From c1bc8d61ddcdd0a569b3b12ff5ff1f6df79e0e15 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Thu, 5 Feb 2009 12:58:42 +0100
Subject: [PATCH] alsactl: init - modify default rule to better support some HDA codecs

Some HDA codecs have shifted dB range (-34.5dB - 12dB) for PCM and CD
inputs. Use default 0dB value for them.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 alsactl/init/default |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/alsactl/init/default b/alsactl/init/default
index 66692b3..e2dcfd6 100644
--- a/alsactl/init/default
+++ b/alsactl/init/default
@@ -11,6 +11,7 @@
 # **************************************************************************
 
 ENV{volume}:="-20dB"
+ENV{cvolume}:="12dB"
 
 CTL{reset}="mixer"
 CTL{name}="Playback Volume",PROGRAM=="__ctl_search", \
@@ -55,14 +56,21 @@ CTL{name}="PC Speaker Playback Switch",PROGRAM=="__ctl_search", \
   CTL{values}="on"
 
 CTL{reset}="mixer"
-CTL{name}="PCM Playback Volume",PROGRAM=="__ctl_search", \
-  CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="PCM Playback Volume",PROGRAM!="__ctl_search",GOTO="pcm0_end"
+# exception - some HDA codecs have shifted dB range
+CTL{dBmin}=="-34.50dB",CTL{dBmax}=="12.00dB",CTL{values}="0dB",GOTO="pcm0_end"
+CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+LABEL="pcm0_end"
 CTL{name}="PCM Playback Switch",PROGRAM=="__ctl_search", \
   CTL{values}="on"
 
 CTL{reset}="mixer"
-CTL{name}="PCM Playback Volume",CTL{index}="1",PROGRAM=="__ctl_search", \
-  CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="PCM Playback Volume",CTL{index}="1",PROGRAM!="__ctl_search", \
+  GOTO="pcm1_end"
+# exception - some HDA codecs have shifted dB range
+CTL{dBmin}=="-34.50dB",CTL{dBmax}=="12.00dB",CTL{values}="0dB",GOTO="pcm1_end"
+CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+LABEL="pcm1_end"
 CTL{name}="PCM Playback Switch",CTL{index}="1",PROGRAM=="__ctl_search", \
   CTL{values}="on"
 
@@ -91,8 +99,11 @@ CTL{name}="Music Playback Switch",PROGRAM=="__ctl_search", \
   CTL{values}="on"
 
 CTL{reset}="mixer"
-CTL{name}="CD Playback Volume",PROGRAM=="__ctl_search", \
-  CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="CD Playback Volume",PROGRAM!="__ctl_search", GOTO="cd0_end"
+# exception - some HDA codecs have shifted dB range
+CTL{dBmin}=="-34.50dB",CTL{dBmax}=="12.00dB",CTL{values}="0dB",GOTO="cd0_end"
+CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+LABEL="cd0_end"
 CTL{name}="CD Playback Switch",PROGRAM=="__ctl_search", \
   CTL{values}="on"
 
@@ -130,15 +141,14 @@ ENV{volume}:="20dB"
 
 CTL{reset}="mixer"
 CTL{name}="Capture Volume",PROGRAM=="__ctl_search", \
-  CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+  CTL{values}="$env{cvolume}",RESULT!="0",CTL{values}="75%"
 CTL{name}="Capture Switch",PROGRAM=="__ctl_search", \
   CTL{values}="on"
 
-CTL{name}="Input Source",PROGRAM=="__ctl_search", \
-  CTL{enums}=="*|Internal Mic|*",CTL{values}="Internal Mic", \
+CTL{name}="Input Source",PROGRAM!="__ctl_search", GOTO="end_input_source"
+CTL{enums}=="*|Internal Mic|*",CTL{values}="Internal Mic", \
   GOTO="end_input_source"
-CTL{name}="Input Source",PROGRAM=="__ctl_search", \
-  CTL{enums}=="*|Mic|*",CTL{values}="Mic"
+CTL{enums}=="*|Mic|*",CTL{values}="Mic"
 LABEL="end_input_source"
 
 CTL{name}="Internal Mic Boost",PROGRAM=="__ctl_search", \
-- 
1.5.5.1