Skip to content

ASoC: rt715: add main capture switch and main capture volume control - #2615

Merged
bardliao merged 1 commit into
thesofproject:topic/sof-devfrom
jack-cy-yu:topic/sof-dev
Dec 14, 2020
Merged

bardliao merged 1 commit into
thesofproject:topic/sof-devfrom
jack-cy-yu:topic/sof-dev

Conversation

@jack-cy-yu

Copy link
Copy Markdown

Add main capture switch and main capture volume for callback to be in
single operation.

Signed-off-by: Jack Yu jack.yu@realtek.com

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only cosmetic comments below. Thanks @jack-cy-yu

Comment thread sound/soc/codecs/rt715.c Resolved
Comment thread sound/soc/codecs/rt715.c Outdated

addr_h = mc->reg;
addr_l = mc->rreg;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spurious line change?

Comment thread sound/soc/codecs/rt715.c Outdated
break;
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spurious line change?

@plbossart

Copy link
Copy Markdown
Member

Will this need UCM2 config also changed the Capture Switch to this new Kcontrol Name ?
If needed, I can help to create new PR for the rt715 codec.

diff --git a/ucm2/sof-soundwire/rt715.conf b/ucm2/sof-soundwire/rt715.conf
index 7b8ca59..2db41f3 100644
--- a/ucm2/sof-soundwire/rt715.conf
+++ b/ucm2/sof-soundwire/rt715.conf
@@ -4,17 +4,17 @@ SectionDevice."Mic" {
        Comment "SoundWire microphones"

        EnableSequence [
-               cset "name='PGA5.0 5 Master Capture Switch' 1"
+               cset "name='Main Capture Switch' 1"
        ]

        DisableSequence [
-               cset "name='PGA5.0 5 Master Capture Switch' 0"
+               cset "name='Main Capture Switch' 0"
        ]

        Value {
              CapturePriority 100
              CapturePCM "hw:${CardId},4"
-             CaptureSwitch "PGA5.0 5 Master Capture Switch"
-             CaptureVolume "PGA5.0 5 Master Capture Volume"
+             CaptureSwitch "Main Capture Switch"
+             CaptureVolume "Main Capture Volume"
        }
 }

This sounds good @GoPerry but we will have to deal with previous versions of the kernel which did not include this Capture control, so this has to be done conditionally - we first test if this 'Main Capture Switch' is available and if yes we use it, else we fall back on the previous solution with PGA.

@libinyang @bardliao can you help @GoPerry with UCM trickery? I am running out of time here.

plbossart
plbossart previously approved these changes Dec 10, 2020

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @jack-cy-yu
@bardliao I will let you review and merge, thanks!

Comment thread sound/soc/codecs/rt715.c Outdated
/* R Channel */
if (mc->invert) {
regmap_write(rt715->regmap,
RT715_SET_AUDIO_POWER_STATE, AC_PWRST_D0);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jack-cy-yu Is the power control right place? Why do we need it only if mc->invert? The other question is what will happen if we don't handle power state in this function? These registers are not volatile, and regmap will cache them when codec is suspended. And they will be restored when codec is resumed. Can we move the power control to the resume function? @shumingfan The same question for #2620

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bardliao I move the power control to outside of the mc-invert, since some of the registers need to be set under power state D0, I'll still keep power control in rt715_set_amp_gain_put but move it to proper place. Thanks.

Add main capture switch and main capture volume for callback to be in
single operation.

Signed-off-by: Jack Yu <jack.yu@realtek.com>

@bardliao bardliao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now thanks @jack-cy-yu Could you send it to upstream?

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bardliao I will let you merge

@GoPerry @libinyang @mengdonglin this patch is needed for the required TGL privacy feature, the UCM file needs to use the new control conditionally.

@GoPerry

GoPerry commented Dec 13, 2020

Copy link
Copy Markdown

@bardliao I will let you merge

@GoPerry @libinyang @mengdonglin this patch is needed for the required TGL privacy feature, the UCM file needs to use the new control conditionally.

Thanks @plbossart
I will push one new patch for the ucm2 : sof-soundwire rt715 config file.
And a new privacy patch based on this patch.
I did some testing this patch, micmute is working well with the new "rt715 Main Capture Switch"

@libinyang

Copy link
Copy Markdown

@bardliao I will let you merge
@GoPerry @libinyang @mengdonglin this patch is needed for the required TGL privacy feature, the UCM file needs to use the new control conditionally.

Thanks @plbossart
I will push one new patch for the ucm2 : sof-soundwire rt715 config file.
And a new privacy patch based on this patch.
I did some testing this patch, micmute is working well with the new "rt715 Main Capture Switch"

@GoPerry Please send out the PR of the UCM2 when it is ready. I can help to review.

@bardliao
bardliao merged commit 4958022 into thesofproject:topic/sof-dev Dec 14, 2020
@GoPerry

GoPerry commented Dec 15, 2020

Copy link
Copy Markdown

@bardliao I will let you merge
@GoPerry @libinyang @mengdonglin this patch is needed for the required TGL privacy feature, the UCM file needs to use the new control conditionally.

Thanks @plbossart
I will push one new patch for the ucm2 : sof-soundwire rt715 config file.
And a new privacy patch based on this patch.
I did some testing this patch, micmute is working well with the new "rt715 Main Capture Switch"

@GoPerry Please send out the PR of the UCM2 when it is ready. I can help to review.
Hi BinYang:
The PR has been submitted.Please help to take a look.
I test this patch on TGL system with Ubuntu 20.04 5.6 kernel and got positive result .
alsa-project/alsa-ucm-conf#67

@libinyang

Copy link
Copy Markdown

@GoPerry Bard told me that the patch may be changed from "rt715 Main Capture Switch" to "rt715 Capture Switch". Could you please confirm. And do you have plan to do the same change to rt711, rt715 sdca and rt711 sdca codec drivers?

@GoPerry

GoPerry commented Dec 16, 2020

Copy link
Copy Markdown

@GoPerry Bard told me that the patch may be changed from "rt715 Main Capture Switch" to "rt715 Capture Switch". Could you please confirm. And do you have plan to do the same change to rt711, rt715 sdca and rt711 sdca codec drivers?

@libinyang @bardliao
The Mixer name list from amixer controls as below.
I test the patch on my system.
Mic mute /unmute is working well , Gnome Mute Notification GUI also can be showed.

numid=14,iface=MIXER,name='rt715 Main Capture Switch'
numid=19,iface=MIXER,name='rt715 Main Capture Volume'
'
numid=10,iface=MIXER,name='rt715 ADC 07 Capture Switch'
numid=15,iface=MIXER,name='rt715 ADC 07 Capture Volume'
numid=11,iface=MIXER,name='rt715 ADC 08 Capture Switch'
numid=16,iface=MIXER,name='rt715 ADC 08 Capture Volume'
numid=12,iface=MIXER,name='rt715 ADC 09 Capture Switch'
numid=17,iface=MIXER,name='rt715 ADC 09 Capture Volume'
numid=68,iface=MIXER,name='rt715 ADC 22 Mux'
numid=69,iface=MIXER,name='rt715 ADC 23 Mux'
numid=70,iface=MIXER,name='rt715 ADC 24 Mux'
numid=71,iface=MIXER,name='rt715 ADC 25 Mux'
numid=13,iface=MIXER,name='rt715 ADC 27 Capture Switch'
numid=18,iface=MIXER,name='rt715 ADC 27 Capture Volume'
numid=20,iface=MIXER,name='rt715 DMIC1 Boost'
numid=21,iface=MIXER,name='rt715 DMIC2 Boost'
numid=22,iface=MIXER,name='rt715 DMIC3 Boost'
numid=23,iface=MIXER,name='rt715 DMIC4 Boost'
numid=26,iface=MIXER,name='rt715 LINE1 Boost'
numid=27,iface=MIXER,name='rt715 LINE2 Boost'
numid=24,iface=MIXER,name='rt715 MIC1 Boost'
numid=25,iface=MIXER,name='rt715 MIC2 Boost'
numid=14,iface=MIXER,name='rt715 Main Capture Switch'
numid=19,iface=MIXER,name='rt715 Main Capture Volume'
'

@bardliao

Copy link
Copy Markdown
Collaborator

@libinyang @GoPerry, The patch is still under discussion on mailing list. See https://www.spinics.net/lists/alsa-devel/msg119863.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants