From c148a16236422ad36320029cb72b920e3fc589f0 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Tue, 3 Sep 2013 13:35:35 +0200
Subject: [PATCH 4/4] Add UCM config files for Nexus 10

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 configure.ac                              |   2 +
 src/conf/ucm/Makefile.am                  |   2 +-
 src/conf/ucm/Manta-I2S/HiFi               | 211 ++++++++++++++++++++++++++++++
 src/conf/ucm/Manta-I2S/Makefile.am        |   4 +
 src/conf/ucm/Manta-I2S/Manta-I2S.conf     |   7 +
 src/conf/ucm/Manta-SPDIF/Dummy            |   3 +
 src/conf/ucm/Manta-SPDIF/Makefile.am      |   4 +
 src/conf/ucm/Manta-SPDIF/Manta-SPDIF.conf |   6 +
 8 files changed, 238 insertions(+), 1 deletion(-)
 create mode 100644 src/conf/ucm/Manta-I2S/HiFi
 create mode 100644 src/conf/ucm/Manta-I2S/Makefile.am
 create mode 100644 src/conf/ucm/Manta-I2S/Manta-I2S.conf
 create mode 100644 src/conf/ucm/Manta-SPDIF/Dummy
 create mode 100644 src/conf/ucm/Manta-SPDIF/Makefile.am
 create mode 100644 src/conf/ucm/Manta-SPDIF/Manta-SPDIF.conf

Index: alsa-lib-1.1.2/configure.ac
===================================================================
--- alsa-lib-1.1.2.orig/configure.ac
+++ alsa-lib-1.1.2/configure.ac
@@ -680,6 +680,8 @@ AC_OUTPUT(Makefile doc/Makefile doc/pict
 	  src/conf/ucm/apq8064-tabla-snd-card/Makefile \
 	  src/conf/ucm/Tuna/Makefile \
 	  src/conf/ucm/tegra-rt5640/Makefile \
+	  src/conf/ucm/Manta-I2S/Makefile \
+	  src/conf/ucm/Manta-SPDIF/Makefile \
 	  src/conf/topology/Makefile \
 	  src/conf/topology/broadwell/Makefile \
 	  modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
Index: alsa-lib-1.1.2/src/conf/ucm/Manta-I2S/HiFi
===================================================================
--- /dev/null
+++ alsa-lib-1.1.2/src/conf/ucm/Manta-I2S/HiFi
@@ -0,0 +1,211 @@
+# By David Henningsson <david.henningsson@canonical.com>
+# Translated from mixer_paths.xml in Manta repository
+
+SectionVerb {
+
+	EnableSequence [
+		cdev "hw:MantaI2S"
+
+		# A lot of defaults
+		cset "name='DAC2 Switch' 0"
+		cset "name='AIF1DRC1 Mode' Default"
+		cset "name='AIF1DAC1 DRC Switch' 0"
+		cset "name='Speaker Switch' 0"
+		cset "name='SPKR DAC1 Switch' 0"
+		cset "name='SPKL DAC1 Switch' 0"
+		cset "name='Speaker Mixer Volume' 0"
+
+		cset "name='Headphone Switch' 0"
+		cset "name='Left Output Mixer DAC Switch' 0"
+		cset "name='Right Output Mixer DAC Switch' 0"
+
+		cset "name='MIXINL IN1L Switch' 0"
+		cset "name='IN1L Switch' 0"
+		cset "name='IN1L PGA IN1LP Switch' 0"
+		cset "name='IN1L PGA IN1LN Switch' 1"
+
+		cset "name='MIXINL IN2L Switch' 0"
+		cset "name='IN2L Switch' 0"
+		cset "name='IN2L PGA IN2LP Switch' 0"
+		cset "name='IN2L PGA IN2LN Switch' 1"
+
+		cset "name='MIXINR IN1R Switch' 0"
+		cset "name='IN1R Switch' 0"
+		cset "name='IN1R PGA IN1RP Switch' 0"
+		cset "name='IN1R PGA IN1RN Switch' 1"
+
+		cset "name='MIXINR IN2R Switch' 0"
+		cset "name='IN2R Switch' 0"
+		cset "name='IN2R PGA IN2RP Switch' 0"
+		cset "name='IN2R PGA IN2RN Switch' 1"
+
+		cset "name='AIF2DACL Mux' AIF3"
+		cset "name='AIF2DACR Mux' AIF3"
+		cset "name='AIF2DAC Mux' AIF3DACDAT"
+		cset "name='AIF3ADC Mux' AIF2ADCDAT"
+
+		cset "name='AIF1ADC1L Mixer AIF2 Switch' 0"
+		cset "name='AIF1ADC1R Mixer AIF2 Switch' 0"
+		cset "name='AIF1ADC2L Mixer AIF2 Switch' 0"
+		cset "name='AIF1ADC2R Mixer AIF2 Switch' 0"
+
+		# Enable dac1
+		cset "name='DAC1R Mixer AIF1.1 Switch' 1"
+		cset "name='DAC1L Mixer AIF1.1 Switch' 1"
+		cset "name='DAC1 Switch' 1"
+
+		# Enable adc to aif1adc
+		cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 1"
+		cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 1"
+	]
+
+	DisableSequence [
+		cdev "hw:MantaI2S"
+
+		# Disable dac1
+		cset "name='DAC1R Mixer AIF1.1 Switch' 0"
+		cset "name='DAC1L Mixer AIF1.1 Switch' 0"
+		cset "name='DAC1 Switch' 0"
+
+		# Disable adc to aif1adc
+		cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 0"
+		cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 0"
+	]
+
+	# ALSA PCM
+	Value {
+
+		TQ "HiFi"
+
+		# ALSA PCM device for HiFi
+		PlaybackPCM "hw:MantaI2S,0"
+		CapturePCM "hw:MantaI2S,0"
+	}
+
+}
+
+SectionDevice."Speaker" {
+	Comment "Main speaker"
+
+	EnableSequence [
+		cdev "hw:MantaI2S"
+
+		# Enable speaker
+		cset "name='Speaker Switch' 1"
+		cset "name='SPKR DAC1 Switch' 1"
+		cset "name='SPKL DAC1 Switch' 1"
+		cset "name='Speaker Mixer Volume' 3"
+		cset "name='Speaker Boost Volume' 5"
+		cset "name='AIF1DRC1 Mode' 'Speakers Media'"
+		cset "name='AIF1DAC1 DRC Switch' 1"
+
+		# Set EQ for speaker
+		cset "name='AIF1DAC1 EQ Switch' 1"
+		cset "name='AIF1DAC1 EQ1 Volume' 3"
+		cset "name='AIF1DAC1 EQ2 Volume' 8"
+		cset "name='AIF1DAC1 EQ3 Volume' 16"
+		cset "name='AIF1DAC1 EQ4 Volume' 10"
+		cset "name='AIF1DAC1 EQ5 Volume' 11"
+
+		# Set Volume for speaker
+		cset "name='Speaker Volume' 61,62"
+	]
+
+	DisableSequence [
+		cdev "hw:MantaI2S"
+
+		cset "name='Speaker Switch' 0"
+		cset "name='AIF1DAC1 EQ Switch' 0"
+	]
+
+	Value {
+		PlaybackChannels "2"
+		PlaybackPriority "150"
+	}
+}
+
+SectionDevice."Headphones" {
+	Comment "Headphone jack"
+
+	EnableSequence [
+		cdev "hw:MantaI2S"
+
+		cset "name='Headphone Switch' 1"
+		cset "name='AIF1DAC1 EQ Switch' 0"
+		cset "name='Headphone Volume' 55,55"
+		cset "name='Left Headphone Mux' 'DAC'"
+		cset "name='Right Headphone Mux' 'DAC'"
+	]
+
+	DisableSequence [
+		cdev "hw:MantaI2S"
+
+		cset "name='Headphone Switch' 0"
+	]
+
+	Value {
+		PlaybackChannels "2"
+	}
+}
+
+SectionDevice."Microphone" {
+	Comment "Internal microphone"
+
+	EnableSequence [
+		cdev "hw:MantaI2S"
+
+		# Main mic
+		cset "name='MIXINR IN2R Switch' 1"
+		cset "name='MIXINR IN2R Volume' 1"
+		cset "name='IN2R Switch' 1"
+		cset "name='AIF1ADCL Source' Right"
+
+		# Second mic right
+		cset "name='MIXINL IN2L Switch' 1"
+		cset "name='MIXINL IN2L Volume' 1"
+		cset "name='IN2L Switch' 1"
+		cset "name='AIF1ADCR Source' Left"
+
+		# Volume
+		cset "name='IN2R Volume' 16"
+		cset "name='IN2L Volume' 16"
+		cset "name='AIF1ADC1 HPF Switch' 1"
+		cset "name='AIF1ADC1 HPF Mode' HiFi"
+	]
+
+	DisableSequence [
+		cdev "hw:MantaI2S"
+
+	]
+
+	Value {
+		CaptureChannels "2"
+	}
+}
+
+SectionDevice."HeadsetMic" {
+	Comment "Headset microphone"
+
+	EnableSequence [
+		cdev "hw:MantaI2S"
+
+		# Headset Mic
+		# Is this really correct? It looks a lot like main mic
+		cset "name='MIXINR IN2R Switch' 1"
+		cset "name='MIXINR IN2R Volume' 1"
+		cset "name='IN2R Switch' 1"
+		cset "name='AIF1ADCL Source' Right"
+
+		cset "name='IN2R Volume' 16"
+		cset "name='AIF1ADC1 HPF Mode' HiFi"
+	]
+
+	DisableSequence [
+		cdev "hw:MantaI2S"
+
+	]
+
+	Value {
+		CaptureChannels "1"
+	}
+}
Index: alsa-lib-1.1.2/src/conf/ucm/Manta-I2S/Makefile.am
===================================================================
--- /dev/null
+++ alsa-lib-1.1.2/src/conf/ucm/Manta-I2S/Makefile.am
@@ -0,0 +1,4 @@
+alsaconfigdir = @ALSA_CONFIG_DIR@
+ucmdir = $(alsaconfigdir)/ucm/Manta-I2S
+ucm_DATA = Manta-I2S.conf HiFi
+EXTRA_DIST = $(ucm_DATA)
Index: alsa-lib-1.1.2/src/conf/ucm/Manta-I2S/Manta-I2S.conf
===================================================================
--- /dev/null
+++ alsa-lib-1.1.2/src/conf/ucm/Manta-I2S/Manta-I2S.conf
@@ -0,0 +1,7 @@
+# UCM configuration for Manta / Nexus 10
+
+SectionUseCase."HiFi" {
+	File "HiFi"
+	Comment "Play HiFi quality Music."
+}
+
Index: alsa-lib-1.1.2/src/conf/ucm/Manta-SPDIF/Dummy
===================================================================
--- /dev/null
+++ alsa-lib-1.1.2/src/conf/ucm/Manta-SPDIF/Dummy
@@ -0,0 +1,3 @@
+SectionVerb {
+}
+SectionDevice.Dummy { }
Index: alsa-lib-1.1.2/src/conf/ucm/Manta-SPDIF/Makefile.am
===================================================================
--- /dev/null
+++ alsa-lib-1.1.2/src/conf/ucm/Manta-SPDIF/Makefile.am
@@ -0,0 +1,4 @@
+alsaconfigdir = @ALSA_CONFIG_DIR@
+ucmdir = $(alsaconfigdir)/ucm/Manta-SPDIF
+ucm_DATA = Manta-SPDIF.conf Dummy
+EXTRA_DIST = $(ucm_DATA)
Index: alsa-lib-1.1.2/src/conf/ucm/Manta-SPDIF/Manta-SPDIF.conf
===================================================================
--- /dev/null
+++ alsa-lib-1.1.2/src/conf/ucm/Manta-SPDIF/Manta-SPDIF.conf
@@ -0,0 +1,6 @@
+# This empty file makes PulseAudio avoid the card.
+
+SectionUseCase."Dummy" {
+	File Dummy
+	Comment "Dummy"
+}
Index: alsa-lib-1.1.2/src/conf/ucm/Makefile.am
===================================================================
--- alsa-lib-1.1.2.orig/src/conf/ucm/Makefile.am
+++ alsa-lib-1.1.2/src/conf/ucm/Makefile.am
@@ -1 +1 @@
-SUBDIRS=DAISY-I2S PandaBoard PandaBoardES SDP4430 tegraalc5632 PAZ00 GoogleNyan broadwell-rt286 skylake-rt286 VEYRON-I2S chtrt5645 DB410c apq8064-tabla-snd-card Tuna tegra-rt5640
+SUBDIRS=DAISY-I2S PandaBoard PandaBoardES SDP4430 tegraalc5632 PAZ00 GoogleNyan broadwell-rt286 skylake-rt286 VEYRON-I2S chtrt5645 DB410c apq8064-tabla-snd-card Tuna tegra-rt5640 Manta-I2S Manta-SPDIF
