alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Jaroslav Kysela <perex@perex.cz>
Cc: alsa-devel@alsa-project.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: Re: [alsa-devel] [PATCH alsa-ucm-conf 2/7] DB410c: Split devices into re-usable fragments in codecs/msm8916-wcd
Date: Tue, 11 Feb 2020 16:55:37 +0100	[thread overview]
Message-ID: <20200211155537.GA16850@gerhold.net> (raw)
In-Reply-To: <20200114112110.51983-3-stephan@gerhold.net>

Hi Jaroslav,

On Tue, Jan 14, 2020 at 12:21:05PM +0100, Stephan Gerhold wrote:
> The DB410c use case configuration is also useful for other MSM8916 devices.
> 
> However, the available devices usually depend on the exact device model.
> For example, DB410c has nothing connected to the Earpiece,
> most MSM8916 smartphones do not have a DigitalMic, and some use
> a custom speaker amplifier (connected via I2S) instead of the
> speaker amplifier provided by PM8916.
> 
> Similar differences across devices are handled using re-usable
> device fragments in the codecs/ directory. Do the same for msm8916-wcd
> and move the device fragments to codecs/msm8916-wcd.

I'm trying to rebase this patch series on top of master after the
"corrections and fixes" commits you did a few days ago.

Unfortunately one change made there breaks an assumption required for
this patch: in DB410c/HiFi.conf PlaybackPCM/CapturePCM used to be
defined globally like:

	SectionVerb {
		Value {
			# ALSA PCM device for HiFi
			PlaybackPCM "plughw:${CardId},1"
			CapturePCM "plughw:${CardId},2"
		}
	}

	<codecs/msm8916-wcd/Speaker.conf>
	/* ... */

Now it is defined separately for each SectionDevice.
This means I would need to put one specific PlaybackPCM/CapturePCM
into the device fragments added in this patch.

e.g. ucm2/codecs/msm8916-wcd/Speaker.conf would now contain

	SectionDevice."Speaker" {
		/* ... */
		Value {
			PlaybackPCM "plughw:${CardId},1"
		}
	}

This does not work properly in my case because the numbering differs
depending on which board the UCM configuration is used.

DB410c has HDMI at index 0, playback at 1 and capture at 2.
My other MSM8916 boards do not have HDMI audio, so playback is index 0
and capture is index 1.

This used to work fine because I simply had a different HiFi.conf,
e.g. msm8916-samsung-a2015/HiFi.conf looked like

	SectionVerb {
		Value {
			PlaybackPCM "plughw:${CardId},0"
			CapturePCM "plughw:${CardId},1"
		}
	}

	<codecs/msm8916-wcd/Speaker.conf>
	/* ... */

(Note the different numbers compared to DB410c/HiFi.conf above...)

Do you have any suggestions how to handle this now?

Thanks,
Stephan

> 
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  ucm2/DB410c/HiFi.conf                     | 128 +---------------------
>  ucm2/codecs/msm8916-wcd/DigitalMic.conf   |  12 ++
>  ucm2/codecs/msm8916-wcd/Earpiece.conf     |   8 ++
>  ucm2/codecs/msm8916-wcd/Headphones.conf   |  30 +++++
>  ucm2/codecs/msm8916-wcd/HeadsetMic.conf   |  16 +++
>  ucm2/codecs/msm8916-wcd/PrimaryMic.conf   |  14 +++
>  ucm2/codecs/msm8916-wcd/SecondaryMic.conf |  16 +++
>  ucm2/codecs/msm8916-wcd/Speaker.conf      |  20 ++++
>  8 files changed, 122 insertions(+), 122 deletions(-)
>  create mode 100644 ucm2/codecs/msm8916-wcd/DigitalMic.conf
>  create mode 100644 ucm2/codecs/msm8916-wcd/Earpiece.conf
>  create mode 100644 ucm2/codecs/msm8916-wcd/Headphones.conf
>  create mode 100644 ucm2/codecs/msm8916-wcd/HeadsetMic.conf
>  create mode 100644 ucm2/codecs/msm8916-wcd/PrimaryMic.conf
>  create mode 100644 ucm2/codecs/msm8916-wcd/SecondaryMic.conf
>  create mode 100644 ucm2/codecs/msm8916-wcd/Speaker.conf
> 
> diff --git a/ucm2/DB410c/HiFi.conf b/ucm2/DB410c/HiFi.conf
> index a0ef42c..4b82fbf 100644
> --- a/ucm2/DB410c/HiFi.conf
> +++ b/ucm2/DB410c/HiFi.conf
> @@ -13,126 +13,10 @@ SectionVerb {
>  	}
>  }
>  
> +<codecs/msm8916-wcd/Speaker.conf>
> +<codecs/msm8916-wcd/Headphones.conf>
>  
> -SectionDevice."Speaker" {
> -	Comment "Speaker playback"
> -
> -	ConflictingDevice [
> -		"Headphones"
> -		"Earpiece"
> -	]
> -
> -	EnableSequence [
> -		cset "name='SPK DAC Switch' 1"
> -		cset "name='RX3 MIX1 INP1' RX1"
> -		## gain to  0dB
> -		cset "name='RX3 Digital Volume' 128"
> -	]
> -
> -	DisableSequence [
> -		cset "name='SPK DAC Switch' 0"
> -		cset "name='RX3 MIX1 INP1' ZERO"
> -	]
> -}
> -
> -
> -SectionDevice."Headphones" {
> -	Comment "Headphones playback"
> -
> -	ConflictingDevice [
> -		"Speaker"
> -		"Earpiece"
> -	]
> -	EnableSequence [
> -		cset "name='RX1 MIX1 INP1' RX1"
> -		cset "name='RX2 MIX1 INP1' RX2"
> -		cset "name='RDAC2 MUX' RX2"
> -		cset "name='HPHL' 1"
> -		cset "name='HPHR' 1"
> -		## gain to  0dB
> -		cset "name='RX1 Digital Volume' 128"
> -		## gain to  0dB
> -		cset "name='RX2 Digital Volume' 128"
> -	]
> -
> -	DisableSequence [
> -		cset "name='RX1 Digital Volume' 0"
> -		cset "name='RX2 Digital Volume' 0"
> -		cset "name='HPHL' 0"
> -		cset "name='HPHR' 0"
> -		cset "name='RDAC2 MUX' ZERO"
> -		cset "name='RX1 MIX1 INP1' ZERO"
> -		cset "name='RX2 MIX1 INP1' ZERO"
> -	]
> -}
> -
> -SectionDevice."Earpiece" {
> -	Comment "Earpiece playback"
> -
> -	ConflictingDevice [
> -		"Speaker"
> -		"Headphones"
> -	]
> -}
> -
> -SectionDevice."HeadsetMic" {
> -	Comment "Headset Microphone"
> -
> -	EnableSequence [
> -		cset "name='DEC1 MUX' ADC2"
> -		cset "name='CIC1 MUX' AMIC"
> -		cset "name='ADC2 Volume' 8"
> -		cset "name='ADC2 MUX' INP2"
> -	]
> -
> -	DisableSequence [
> -		cset "name='ADC2 MUX' ZERO"
> -		cset "name='ADC2 Volume' 0"
> -		cset "name='DEC1 MUX' ZERO"
> -	]
> -}
> -
> -SectionDevice."PrimaryMic" {
> -	Comment "Primary Microphone"
> -
> -	EnableSequence [
> -		cset "name='DEC1 MUX' ADC1"
> -		cset "name='CIC1 MUX' AMIC"
> -		cset "name='ADC1 Volume' 8"
> -	]
> -
> -	DisableSequence [
> -		cset "name='DEC1 MUX' ZERO"
> -		cset "name='ADC1 Volume' 0"
> -	]
> -}
> -
> -SectionDevice."SecondaryMic" {
> -	Comment "Secondary Microphone"
> -
> -	EnableSequence [
> -		cset "name='DEC1 MUX' ADC2"
> -		cset "name='CIC1 MUX' AMIC"
> -		cset "name='ADC2 Volume' 8"
> -		cset "name='ADC2 MUX' INP2"
> -	]
> -
> -	DisableSequence [
> -		cset "name='DEC1 MUX' ZERO"
> -		cset "name='ADC2 Volume' 0"
> -		cset "name='ADC2 MUX' ZERO"
> -	]
> -}
> -
> -SectionDevice."DigitalMic" {
> -	Comment "Digital Microphone"
> -
> -	EnableSequence [
> -		cset "name='DEC1 MUX' DMIC1"
> -		cset "name='CIC1 MUX' DMIC"
> -	]
> -
> -	DisableSequence [
> -		cset "name='DEC1 MUX' ZERO"
> -	]
> -}
> +<codecs/msm8916-wcd/PrimaryMic.conf>
> +<codecs/msm8916-wcd/HeadsetMic.conf>
> +<codecs/msm8916-wcd/SecondaryMic.conf>
> +<codecs/msm8916-wcd/DigitalMic.conf>
> diff --git a/ucm2/codecs/msm8916-wcd/DigitalMic.conf b/ucm2/codecs/msm8916-wcd/DigitalMic.conf
> new file mode 100644
> index 0000000..35dfb1b
> --- /dev/null
> +++ b/ucm2/codecs/msm8916-wcd/DigitalMic.conf
> @@ -0,0 +1,12 @@
> +SectionDevice."DigitalMic" {
> +	Comment "Digital Microphone"
> +
> +	EnableSequence [
> +		cset "name='DEC1 MUX' DMIC1"
> +		cset "name='CIC1 MUX' DMIC"
> +	]
> +
> +	DisableSequence [
> +		cset "name='DEC1 MUX' ZERO"
> +	]
> +}
> diff --git a/ucm2/codecs/msm8916-wcd/Earpiece.conf b/ucm2/codecs/msm8916-wcd/Earpiece.conf
> new file mode 100644
> index 0000000..e9f8b9d
> --- /dev/null
> +++ b/ucm2/codecs/msm8916-wcd/Earpiece.conf
> @@ -0,0 +1,8 @@
> +SectionDevice."Earpiece" {
> +	Comment "Earpiece playback"
> +
> +	ConflictingDevice [
> +		"Speaker"
> +		"Headphones"
> +	]
> +}
> diff --git a/ucm2/codecs/msm8916-wcd/Headphones.conf b/ucm2/codecs/msm8916-wcd/Headphones.conf
> new file mode 100644
> index 0000000..7a2090e
> --- /dev/null
> +++ b/ucm2/codecs/msm8916-wcd/Headphones.conf
> @@ -0,0 +1,30 @@
> +SectionDevice."Headphones" {
> +	Comment "Headphones playback"
> +
> +	ConflictingDevice [
> +		"Speaker"
> +		"Earpiece"
> +	]
> +
> +	EnableSequence [
> +		cset "name='RX1 MIX1 INP1' RX1"
> +		cset "name='RX2 MIX1 INP1' RX2"
> +		cset "name='RDAC2 MUX' RX2"
> +		cset "name='HPHL' 1"
> +		cset "name='HPHR' 1"
> +		## gain to  0dB
> +		cset "name='RX1 Digital Volume' 128"
> +		## gain to  0dB
> +		cset "name='RX2 Digital Volume' 128"
> +	]
> +
> +	DisableSequence [
> +		cset "name='RX1 Digital Volume' 0"
> +		cset "name='RX2 Digital Volume' 0"
> +		cset "name='HPHL' 0"
> +		cset "name='HPHR' 0"
> +		cset "name='RDAC2 MUX' ZERO"
> +		cset "name='RX1 MIX1 INP1' ZERO"
> +		cset "name='RX2 MIX1 INP1' ZERO"
> +	]
> +}
> diff --git a/ucm2/codecs/msm8916-wcd/HeadsetMic.conf b/ucm2/codecs/msm8916-wcd/HeadsetMic.conf
> new file mode 100644
> index 0000000..538d895
> --- /dev/null
> +++ b/ucm2/codecs/msm8916-wcd/HeadsetMic.conf
> @@ -0,0 +1,16 @@
> +SectionDevice."HeadsetMic" {
> +	Comment "Headset Microphone"
> +
> +	EnableSequence [
> +		cset "name='DEC1 MUX' ADC2"
> +		cset "name='CIC1 MUX' AMIC"
> +		cset "name='ADC2 Volume' 8"
> +		cset "name='ADC2 MUX' INP2"
> +	]
> +
> +	DisableSequence [
> +		cset "name='ADC2 MUX' ZERO"
> +		cset "name='ADC2 Volume' 0"
> +		cset "name='DEC1 MUX' ZERO"
> +	]
> +}
> diff --git a/ucm2/codecs/msm8916-wcd/PrimaryMic.conf b/ucm2/codecs/msm8916-wcd/PrimaryMic.conf
> new file mode 100644
> index 0000000..6998458
> --- /dev/null
> +++ b/ucm2/codecs/msm8916-wcd/PrimaryMic.conf
> @@ -0,0 +1,14 @@
> +SectionDevice."PrimaryMic" {
> +	Comment "Primary Microphone"
> +
> +	EnableSequence [
> +		cset "name='DEC1 MUX' ADC1"
> +		cset "name='CIC1 MUX' AMIC"
> +		cset "name='ADC1 Volume' 8"
> +	]
> +
> +	DisableSequence [
> +		cset "name='DEC1 MUX' ZERO"
> +		cset "name='ADC1 Volume' 0"
> +	]
> +}
> diff --git a/ucm2/codecs/msm8916-wcd/SecondaryMic.conf b/ucm2/codecs/msm8916-wcd/SecondaryMic.conf
> new file mode 100644
> index 0000000..7811509
> --- /dev/null
> +++ b/ucm2/codecs/msm8916-wcd/SecondaryMic.conf
> @@ -0,0 +1,16 @@
> +SectionDevice."SecondaryMic" {
> +	Comment "Secondary Microphone"
> +
> +	EnableSequence [
> +		cset "name='DEC1 MUX' ADC2"
> +		cset "name='CIC1 MUX' AMIC"
> +		cset "name='ADC2 Volume' 8"
> +		cset "name='ADC2 MUX' INP2"
> +	]
> +
> +	DisableSequence [
> +		cset "name='DEC1 MUX' ZERO"
> +		cset "name='ADC2 Volume' 0"
> +		cset "name='ADC2 MUX' ZERO"
> +	]
> +}
> diff --git a/ucm2/codecs/msm8916-wcd/Speaker.conf b/ucm2/codecs/msm8916-wcd/Speaker.conf
> new file mode 100644
> index 0000000..2b1dd8a
> --- /dev/null
> +++ b/ucm2/codecs/msm8916-wcd/Speaker.conf
> @@ -0,0 +1,20 @@
> +SectionDevice."Speaker" {
> +	Comment "Speaker playback"
> +
> +	ConflictingDevice [
> +		"Headphones"
> +		"Earpiece"
> +	]
> +
> +	EnableSequence [
> +		cset "name='SPK DAC Switch' 1"
> +		cset "name='RX3 MIX1 INP1' RX1"
> +		## gain to  0dB
> +		cset "name='RX3 Digital Volume' 128"
> +	]
> +
> +	DisableSequence [
> +		cset "name='SPK DAC Switch' 0"
> +		cset "name='RX3 MIX1 INP1' ZERO"
> +	]
> +}
> -- 
> 2.24.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2020-02-11 16:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 11:21 [alsa-devel] [PATCH alsa-ucm-conf 0/7] DB410c/msm8916-wcd UCM fixes/additions Stephan Gerhold
2020-01-14 11:21 ` [alsa-devel] [PATCH alsa-ucm-conf 1/7] DB410c: Rename Handset to HeadsetMic Stephan Gerhold
2020-01-14 11:21 ` [alsa-devel] [PATCH alsa-ucm-conf 2/7] DB410c: Split devices into re-usable fragments in codecs/msm8916-wcd Stephan Gerhold
2020-02-11 15:55   ` Stephan Gerhold [this message]
2020-01-14 11:21 ` [alsa-devel] [PATCH alsa-ucm-conf 3/7] codecs/msm8916-wcd: Speaker: Reset volume on disable Stephan Gerhold
2020-01-14 11:21 ` [alsa-devel] [PATCH alsa-ucm-conf 4/7] codecs/msm8916-wcd: Headphones: Drop invalid RDAC2 MUX value Stephan Gerhold
2020-01-14 11:21 ` [alsa-devel] [PATCH alsa-ucm-conf 5/7] codecs/msm8916-wcd: Earpiece: Add missing Enable/DisableSequence Stephan Gerhold
2020-01-14 11:21 ` [alsa-devel] [PATCH alsa-ucm-conf 6/7] codecs/msm8916-wcd: SecondaryMic: Select correct input Stephan Gerhold
2020-01-14 11:21 ` [alsa-devel] [PATCH alsa-ucm-conf 7/7] codecs/msm8916-wcd: Add ConflictingDevice for capture devices Stephan Gerhold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200211155537.GA16850@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).