Add ucm rules to support playback on Excelsior.

Change-Id: I1cab0268c8bdd87d191049ef1aa5c9c9b570b3fd
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..f0787a1
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,6 @@
+mtk-board-audio (0.0-1) unstable; urgency=medium
+
+  * Initial release.
+
+ -- AIY Projects <support-aiyprojects@google.com>  Wed, 27 Feb 2019 11:18:30 -0800
+
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..5294254
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,17 @@
+Source: mtk-board-audio
+Maintainer: AIY Projects <support-aiyprojects@google.com>
+Build-Depends: debhelper
+Section: sound
+Priority: optional
+
+Package: mtk-board-audio
+Section: sound
+Priority: optional
+Architecture: all
+Depends: pulseaudio
+Description: Audio and routing settings for the Excelsior Board
+ This package is a semi-metapackage that includes audio route settings,
+ as well as dependencies on pulseaudio.
+ .
+ This package and its dependencies are required to make the Excelsior
+ Board's audio components function as intended.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..d9aa46d
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,7 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: mtk-board-audio
+Source: https://excelsior.git.corp.google.com/excelsior-mendel/packages/mtk-board-audio/
+
+Files: *
+Copyright: Copyright 2018 Google, LLC <support-aiyprojects@google.com>
+License: Apache-2.0
diff --git a/debian/mtk-board-audio.install b/debian/mtk-board-audio.install
new file mode 100644
index 0000000..93b32df
--- /dev/null
+++ b/debian/mtk-board-audio.install
@@ -0,0 +1,3 @@
+etc /
+usr /
+
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..ea37544
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+%:
+	dh $@
diff --git a/etc/runonce.d/00-disable-tsched.sh b/etc/runonce.d/00-disable-tsched.sh
new file mode 100755
index 0000000..c077db5
--- /dev/null
+++ b/etc/runonce.d/00-disable-tsched.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+sed -i -e 's/load-module module-udev-detect$/load-module module-udev-detect tsched=0/' /etc/pulse/default.pa
+
diff --git a/usr/share/alsa/ucm/excelsior-card/HiFi.conf b/usr/share/alsa/ucm/excelsior-card/HiFi.conf
new file mode 100644
index 0000000..97183e2
--- /dev/null
+++ b/usr/share/alsa/ucm/excelsior-card/HiFi.conf
@@ -0,0 +1,78 @@
+SectionVerb {
+	Value {
+		TQ "HiFi"
+		# ALSA PCM device for HiFi
+		PlaybackPCM "hw:0"
+
+	}
+	EnableSequence [
+		cdev "hw:0"
+		cset "name='LINEOUT Mux' OPEN"
+		cset "name='HPOUT Mux' OPEN"
+		cset "name='AIF TX Mux' Analog Mic"
+		cset "name='Left PGA Mux' OPEN"
+		cset "name='Right PGA Mux' OPEN"
+		cset "name='INT ADDA O03_O04 Switch' 1"
+		cset "name='AIN Mux' INT ADC"
+		cset "name='O03 I05 Switch' 1"
+		cset "name='O04 I06 Switch' 1"
+		cset "name='O10 I04 Switch' 0"
+		cset "name='O09 I03 Switch' 1"
+		cset "name='O05 I05 Switch' 1"
+		cset "name='O06 I06 Switch' 1"
+		cset "name='O05 I07 Switch' 1"
+		cset "name='O06 I08 Switch' 1"
+		cset "name='I2S O03_O04 Switch' 1"
+		cset "name='AIF TX Mux' 2"
+
+	]
+	DisableSequence [
+	]
+}
+
+SectionDevice."Speaker" {
+
+	Value {
+		PlaybackChannels "1"
+		CaptureChannels "1"
+	}
+	ConflictingDevice [
+		"Headphone"
+	]
+	EnableSequence [
+		cdev "hw:0"
+		cset "name='LINEOUT Mux' 1"
+		cset "name='AIF TX Mux' 1"
+	]
+	DisableSequence [
+		cdev "hw:0"
+		cset "name='LINEOUT Mux' 0"
+		cset "name='AIF TX Mux' 2"
+	]
+}
+
+SectionDevice."Headphone" {
+	Value {
+		PlaybackChannels "2"
+		CaptureChannels "1"
+		JackControl "Headphone Jack"
+		JackDev "/dev/input/by-path/platform-sound-event"
+	}
+	ConflictingDevice [
+		"Speaker"
+	]
+	EnableSequence [
+		cdev "hw:0"
+		cset "name='HPOUT Mux' 1"
+		cset "name='AIF TX Mux' 0"
+		cset "name='Left PGA Mux' CH1"
+		cset "name='Right PGA Mux' CH1"
+	]
+	DisableSequence [
+		cdev "hw:0"
+		cset "name='HPOUT Mux' 0"
+		cset "name='AIF TX Mux' 2"
+		cset "name='Left PGA Mux' OPEN"
+		cset "name='Right PGA Mux' OPEN"
+	]
+}
diff --git a/usr/share/alsa/ucm/excelsior-card/excelsior-card.conf b/usr/share/alsa/ucm/excelsior-card/excelsior-card.conf
new file mode 100644
index 0000000..856485f
--- /dev/null
+++ b/usr/share/alsa/ucm/excelsior-card/excelsior-card.conf
@@ -0,0 +1,9 @@
+Comment "Excelsior card"
+SectionUseCase."HiFi" {
+	File "HiFi.conf"
+	Comment "Default"
+}
+
+SectionDefaults [
+	cdev "hw:excelsiorcard"
+]