From 1f86677848a69f26ba60ec46b2a58b7283e7dead Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Wed, 17 Jan 2024 16:31:26 -0500 Subject: [PATCH] alsa-ucm-conf-google-kukui: improvements for mt8183 ucm (MR 4733) Krane doesn't have a headphone jack, which caused audio server issues for me. Add a check to only enable the headphone and headset mic device on non-Krane boards. Also improve the formatting and remove ChromeOS-specifc options. [ci:skip-build]: already built successfully in CI --- .../alsa-ucm-conf-google-kukui/APKBUILD | 15 +- .../mt8183_da7219_HiFi.conf | 115 ++++++------ .../mt8183_da7219_rt1015p.conf | 22 ++- .../mt8183_mt6358_HiFi.conf | 170 ++++++------------ .../mt8183_mt6358_ts3a227_max98357.conf | 29 ++- 5 files changed, 171 insertions(+), 180 deletions(-) diff --git a/device/community/alsa-ucm-conf-google-kukui/APKBUILD b/device/community/alsa-ucm-conf-google-kukui/APKBUILD index a304764d7..ae785c195 100644 --- a/device/community/alsa-ucm-conf-google-kukui/APKBUILD +++ b/device/community/alsa-ucm-conf-google-kukui/APKBUILD @@ -1,7 +1,8 @@ -# Maintainer: Jenneron +# Maintainer: WeirdTreeThing +# Co-Maintainer: Jenneron pkgname=alsa-ucm-conf-google-kukui -pkgver=1 -pkgrel=3 +pkgver=2 +pkgrel=0 pkgdesc="ALSA Use Case Manager configuration for Google Kukui Chromebooks" url="https://alsa-project.org" arch="aarch64" @@ -33,8 +34,8 @@ package() { } sha512sums=" -d998860ca82ec9277a7b660dbdc644fc8ec84d5f3703dc72eac44a6b70b61ea9f733eeae94d21d9d2cadf25f95e951ce3c804593b4f0a4c715770b4b422d4ca7 mt8183_da7219_HiFi.conf -c8ce246275beaa3e89eb4e06bed825935122c9f6a9fff9f8e3188dec47f37db92d908148cd7551785de5282c13386134bd6daf8ed033de122218b698d67bab33 mt8183_da7219_rt1015p.conf -749180019ca12ec342604fc6924aa60c5f4ff2892ce22d2199b78d707947a8b91e71fa7a71643f3475bf2dba6e94c36e4fc57cb98f7a96519c83106b08ebc5c3 mt8183_mt6358_HiFi.conf -c8ce246275beaa3e89eb4e06bed825935122c9f6a9fff9f8e3188dec47f37db92d908148cd7551785de5282c13386134bd6daf8ed033de122218b698d67bab33 mt8183_mt6358_ts3a227_max98357.conf +9755c2eaf4bc28a9f3734b6778550ebd77bbee8f6aa353642bc5a35d68e009a17b05d9b09f1c62fe592eb16a2d342e3d2abcda98f2c53142bd4905e4a883a88b mt8183_da7219_HiFi.conf +13ffff0471c29d4e624ba7089d8df811f6578bebc4a9da2e8e82e247430fd41dbc95204fdf1891cfb76f1d90303fcdb8501ecf47b8ca40c7429066bf2ff1379b mt8183_da7219_rt1015p.conf +3656cb0cc76994aab39bd0d0cfe283339bce0689448612f74a0d09a30b19516950132456945096a13bd5700d0e7f868c413e268ced810046ec70252ca8b07603 mt8183_mt6358_HiFi.conf +171e9e3376e5bd56e133a5b19309f60f6326f052922064e6f95c53b4345ea12cc205adde7305a7bd840722a29b7fb393c71d2b39e60952b0979ecc2e5ec03efa mt8183_mt6358_ts3a227_max98357.conf " diff --git a/device/community/alsa-ucm-conf-google-kukui/mt8183_da7219_HiFi.conf b/device/community/alsa-ucm-conf-google-kukui/mt8183_da7219_HiFi.conf index ab695e19f..0f4183773 100644 --- a/device/community/alsa-ucm-conf-google-kukui/mt8183_da7219_HiFi.conf +++ b/device/community/alsa-ucm-conf-google-kukui/mt8183_da7219_HiFi.conf @@ -1,81 +1,90 @@ -SectionVerb { - EnableSequence [ - cdev "hw:mt8183da7219rt1" - cset "name='Headphone Volume' 0" -# cset "name='UL3_CH1 ADDA_UL_CH1' 0" -# cset "name='UL3_CH2 ADDA_UL_CH2' 0" - cset "name='I2S3_CH1 DL1_CH1' 1" - cset "name='I2S3_CH2 DL1_CH2' 1" - cset "name='MTKAIF_DMIC' 1" - cset "name='Mt6358 Mic Type Mux' 2" - cset "name='UL3_CH1 ADDA_UL_CH1' 1" - cset "name='UL3_CH2 ADDA_UL_CH2' 1" - ] - DisableSequence [ - ] -} -SectionDevice."Headphone" { - Value { - PlaybackPCM "hw:mt8183da7219rt1,0" - JackDev "mt8183_da7219_rt1015p Headset Jack" - JackSwitch "2" - } - - ConflictingDevice [ - "Speaker" - ] - - EnableSequence [ - cdev "hw:mt8183da7219rt1" - cset "name='I2S3_CH1 DL1_CH1' 1" - cset "name='I2S3_CH2 DL1_CH2' 1" - ] - DisableSequence [ - cdev "hw:mt8183da7219rt1" - cset "name='I2S3_CH1 DL1_CH1' 0" - cset "name='I2S3_CH2 DL1_CH2' 0" - ] -} SectionDevice."Speaker" { + Comment "Speaker" + Value { - PlaybackPCM "hw:mt8183da7219rt1,0" - DspName "speaker_eq" + PlaybackPCM "hw:${CardId},0" } - - ConflictingDevice [ - "Headphone" - ] - EnableSequence [ - cdev "hw:mt8183da7219rt1" + cset "name='I2S3_CH1 DL1_CH1' 1" + cset "name='I2S3_CH2 DL1_CH2' 1" + cset "name='Speakers Switch' 1" + ] + DisableSequence [ + cset "name='I2S3_CH1 DL1_CH1' 0" + cset "name='I2S3_CH2 DL1_CH2' 0" + cset "name='Speakers Switch' 0" + ] +} + +SectionDevice."Headphones" { + Comment "Headphones" + + Value { + PlaybackPCM "hw:${CardId},0" + } + EnableSequence [ + cset "name='Playback Digital Switch' 1" + cset "name='Headphone Switch' 1" + cset "name='ST Mixer Out FilterL Out FilterL Switch' 1" + cset "name='Mixer Out FilterL DACL Switch' 1" + cset "name='ST Mixer Out FilterR Out FilterR Switch' 1" + cset "name='Mixer Out FilterR DACR Switch' 1" + cset "name='Out DACL Mux' DAIL" + cset "name='Out DACR Mux' DAIR" cset "name='I2S3_CH1 DL1_CH1' 1" cset "name='I2S3_CH2 DL1_CH2' 1" ] DisableSequence [ - cdev "hw:mt8183da7219rt1" + cset "name='Playback Digital Switch' 0" + cset "name='Headphone Switch' 0" + cset "name='ST Mixer Out FilterL Out FilterL Switch' 0" + cset "name='Mixer Out FilterL DACL Switch' 0" + cset "name='ST Mixer Out FilterR Out FilterR Switch' 0" + cset "name='Mixer Out FilterR DACR Switch' 0" cset "name='I2S3_CH1 DL1_CH1' 0" cset "name='I2S3_CH2 DL1_CH2' 0" ] } -SectionDevice."Internal Mic" { +SectionDevice."Mic" { + Comment "Internal Microphone" + Value { - CapturePCM "hw:mt8183da7219rt1,5" - CaptureChannelMap "0 1 -1 -1 -1 -1 -1 -1 -1 -1 -1" - IntrinsicSensitivity "-600" + CapturePCM "hw:${CardId},5" } EnableSequence [ - cdev "hw:mt8183da7219rt1" cset "name='MTKAIF_DMIC' 1" cset "name='Mt6358 Mic Type Mux' 2" cset "name='UL3_CH1 ADDA_UL_CH1' 1" cset "name='UL3_CH2 ADDA_UL_CH2' 1" ] DisableSequence [ - cdev "hw:mt8183da7219rt1" cset "name='MTKAIF_DMIC' 0" cset "name='Mt6358 Mic Type Mux' 0" cset "name='UL3_CH1 ADDA_UL_CH1' 0" cset "name='UL3_CH2 ADDA_UL_CH2' 0" ] } + +SectionDevice."Headset" { + Comment "Headset Microphone" + + Value { + CapturePCM "hw:${CardId},5" + } + EnableSequence [ + cset "name='Capture Digital Switch' 1" + cset "name='Mixin Switch' 1" + cset "name='Mic Switch' 1" + cset "name='Mixer In Mic Switch' 1" + cset "name='Out DAIL Mux' ADC" + cset "name='UL3_CH1 I2S2_CH1' 1" + ] + DisableSequence [ + cset "name='Capture Digital Switch' 0" + cset "name='Mixin Switch' 0" + cset "name='Mic Switch' 0" + cset "name='Mixer In Mic Switch' 0" + cset "name='UL3_CH1 I2S2_CH1' 0" + ] +} diff --git a/device/community/alsa-ucm-conf-google-kukui/mt8183_da7219_rt1015p.conf b/device/community/alsa-ucm-conf-google-kukui/mt8183_da7219_rt1015p.conf index 37c54da69..e5fcd7821 100644 --- a/device/community/alsa-ucm-conf-google-kukui/mt8183_da7219_rt1015p.conf +++ b/device/community/alsa-ucm-conf-google-kukui/mt8183_da7219_rt1015p.conf @@ -1,8 +1,24 @@ -Syntax 2 - -Comment "Kukui internal card" +Syntax 6 SectionUseCase."HiFi" { File "HiFi.conf" Comment "Default" } + +BootSequence [ + # Speaker + cset "name='I2S3_CH1 DL1_CH1' 1" + cset "name='I2S3_CH2 DL1_CH2' 1" + cset "name='Speakers Switch' 1" + + # Internal Mic + cset "name='MTKAIF_DMIC' 1" + cset "name='Mt6358 Mic Type Mux' 2" + cset "name='UL3_CH1 ADDA_UL_CH1' 1" + cset "name='UL3_CH2 ADDA_UL_CH2' 1" + + # Headset + cset "name='Headphone Volume' 56" + cset "name='Capture Digital Volume' 113" + cset "name='Mic Volume' 3" +] diff --git a/device/community/alsa-ucm-conf-google-kukui/mt8183_mt6358_HiFi.conf b/device/community/alsa-ucm-conf-google-kukui/mt8183_mt6358_HiFi.conf index ea618aafb..5bea05746 100644 --- a/device/community/alsa-ucm-conf-google-kukui/mt8183_mt6358_HiFi.conf +++ b/device/community/alsa-ucm-conf-google-kukui/mt8183_mt6358_HiFi.conf @@ -1,144 +1,86 @@ -SectionVerb { - EnableSequence [ - cdev "hw:mt8183mt6358ts3" - cset "name='Headphone Volume' 0" - cset "name='ADDA_DL_CH1 DL1_CH1' 0" - cset "name='ADDA_DL_CH2 DL1_CH2' 0" - cset "name='HPL Mux' 0" - cset "name='HPR Mux' 0" - cset "name='I2S3_CH1 DL1_CH1' 1" - cset "name='I2S3_CH2 DL1_CH2' 1" - cset "name='MTKAIF_DMIC' 1" - cset "name='Mic Type Mux' 2" - cset "name='UL3_CH1 ADDA_UL_CH1' 1" - cset "name='UL3_CH2 ADDA_UL_CH2' 1" -# from headset mic - does not work -see below -# cset "name='PGA L Mux' 0" -# cset "name='ADC L Mux' 0" -# cset "name='PGA Volume' 0" - ] - - DisableSequence [ - ] -} - -SectionDevice."Headphones" { - Comment "Headphones" - - Value { - PlaybackPCM "hw:mt8183mt6358ts3,0" - JackControl "mt8183_mt6358_ts3a227_max98357 Headset Jack" - } - - ConflictingDevice [ - "Speaker" - ] - - EnableSequence [ - cdev "hw:mt8183mt6358ts3" - cset "name='ADDA_DL_CH1 DL1_CH1' 1" - cset "name='ADDA_DL_CH2 DL1_CH2' 1" - cset "name='HPL Mux' 2" - cset "name='HPR Mux' 2" - ] - - DisableSequence [ - cdev "hw:mt8183mt6358ts3" - cset "name='ADDA_DL_CH1 DL1_CH1' 0" - cset "name='ADDA_DL_CH2 DL1_CH2' 0" - cset "name='HPL Mux' 0" - cset "name='HPR Mux' 0" - ] -} - SectionDevice."Speaker" { Comment "Speaker" Value { - PlaybackPCM "hw:mt8183mt6358ts3,0" - DspName "speaker_eq" + PlaybackPCM "hw:${CardId},0" } - - ConflictingDevice [ - "Headphones" - ] - EnableSequence [ - cdev "hw:mt8183mt6358ts3" cset "name='I2S3_CH1 DL1_CH1' 1" cset "name='I2S3_CH2 DL1_CH2' 1" ] - DisableSequence [ - cdev "hw:mt8183mt6358ts3" cset "name='I2S3_CH1 DL1_CH1' 0" cset "name='I2S3_CH2 DL1_CH2' 0" ] } -# headset mic does not work for some reason - if enabled there is no signal -# from it and after switching back to internal mic even that does not give -# any signal anymore -#SectionDevice."HeadsetMic" { -# Comment "Headset Microphone" -# -# Value { -# CapturePCM "hw:mt8183mt6358ts3,5" -# # i guess this one is chromeos specific and not used otherwise -# CaptureChannelMap "0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1" -# JackControl "mt8183_mt6358_ts3a227_max98357 Headset Jack" -# } -# -# ConflictingDevice [ -# "InternalMic" -# ] -# -# EnableSequence [ -# cdev "hw:mt8183mt6358ts3" -# cset "name='PGA L Mux' 2" -# cset "name='ADC L Mux' 2" -# cset "name='Mic Type Mux' 1" -# cset "name='PGA Volume' 4" -# cset "name='UL3_CH1 ADDA_UL_CH1' 1" -# ] -# -# DisableSequence [ -# cdev "hw:mt8183mt6358ts3" -# cset "name='PGA L Mux' 0" -# cset "name='ADC L Mux' 0" -# cset "name='Mic Type Mux' 0" -# cset "name='PGA Volume' 0" -# cset "name='UL3_CH1 ADDA_UL_CH1' 0" -# ] -#} - -SectionDevice."InternalMic" { - Comment "Intrernal Microphone" +SectionDevice."Mic" { + Comment "Internal Microphone" Value { - CapturePCM "hw:mt8183mt6358ts3,5" - # i guess those two are chromeos specific and not used otherwise - CaptureChannelMap "0 1 -1 -1 -1 -1 -1 -1 -1 -1 -1" - IntrinsicSensitivity "-2600" + CapturePCM "hw:${CardId},5" } - -# from headset mic - does not work -see above -# ConflictingDevice [ -# "HeadsetMic" -# ] - EnableSequence [ - cdev "hw:mt8183mt6358ts3" cset "name='MTKAIF_DMIC' 1" cset "name='Mic Type Mux' 2" cset "name='UL3_CH1 ADDA_UL_CH1' 1" cset "name='UL3_CH2 ADDA_UL_CH2' 1" ] - DisableSequence [ - cdev "hw:mt8183mt6358ts3" cset "name='MTKAIF_DMIC' 0" cset "name='UL3_CH1 ADDA_UL_CH1' 0" cset "name='UL3_CH2 ADDA_UL_CH2' 0" ] } + +If.krane { + Condition { + Type String + Haystack "${sys:firmware/devicetree/base/compatible}" + Needle "google,krane" + } + False { + SectionDevice."Headphones" { + Comment "Headphones" + + Value { + PlaybackPCM "hw:${CardId},0" + } + EnableSequence [ + cset "name='ADDA_DL_CH1 DL1_CH1' 1" + cset "name='ADDA_DL_CH2 DL1_CH2' 1" + cset "name='HPL Mux' 2" + cset "name='HPR Mux' 2" + ] + DisableSequence [ + cset "name='ADDA_DL_CH1 DL1_CH1' 0" + cset "name='ADDA_DL_CH2 DL1_CH2' 0" + cset "name='HPL Mux' 0" + cset "name='HPR Mux' 0" + ] + } + + SectionDevice."Headset" { + Comment "Headset Microphone" + + Value { + CapturePCM "hw:${CardId},5" + } + EnableSequence [ + cset "name='PGA L Mux' 2" + cset "name='ADC L Mux' 2" + cset "name='Mic Type Mux' 1" + cset "name='PGA Volume' 4" + cset "name='UL3_CH1 ADDA_UL_CH1' 1" + ] + DisableSequence [ + cset "name='PGA L Mux' 0" + cset "name='ADC L Mux' 0" + cset "name='Mic Type Mux' 0" + cset "name='PGA Volume' 0" + cset "name='UL3_CH1 ADDA_UL_CH1' 0" + + ] + } + } +} diff --git a/device/community/alsa-ucm-conf-google-kukui/mt8183_mt6358_ts3a227_max98357.conf b/device/community/alsa-ucm-conf-google-kukui/mt8183_mt6358_ts3a227_max98357.conf index 37c54da69..40dc0b3bd 100644 --- a/device/community/alsa-ucm-conf-google-kukui/mt8183_mt6358_ts3a227_max98357.conf +++ b/device/community/alsa-ucm-conf-google-kukui/mt8183_mt6358_ts3a227_max98357.conf @@ -1,8 +1,31 @@ -Syntax 2 - -Comment "Kukui internal card" +Syntax 6 SectionUseCase."HiFi" { File "HiFi.conf" Comment "Default" } + +BootSequence [ + # Speakers + cset "name='I2S3_CH1 DL1_CH1' 1" + cset "name='I2S3_CH2 DL1_CH2' 1" + + # Headphones + cset "name='Headphone Volume' 17" + cset "name='ADDA_DL_CH1 DL1_CH1' 0" + cset "name='ADDA_DL_CH2 DL1_CH2' 0" + cset "name='HPL Mux' 0" + cset "name='HPR Mux' 0" + + # Internal Mic + cset "name='MTKAIF_DMIC' 1" + cset "name='Mic Type Mux' 2" + cset "name='UL3_CH1 ADDA_UL_CH1' 1" + cset "name='UL3_CH2 ADDA_UL_CH2' 1" + + # Headset Mic + cset "name='PGA L Mux' 0" + cset "name='ADC L Mux' 0" + cset "name='PGA Volume' 0" + cset "name='UL3_CH1 ADDA_UL_CH1' 0" +]