diff mbox series

ASoC: rt711-sdca: remove capture switch controls

Message ID 20210415091609.13695-1-shumingf@realtek.com (mailing list archive)
State New, archived
Headers show
Series ASoC: rt711-sdca: remove capture switch controls | expand

Commit Message

Shuming [范書銘] April 15, 2021, 9:16 a.m. UTC
From: Shuming Fan <shumingf@realtek.com>

The settings of the switch control already set by DAPM event.
These switch controls might the user confused why it can't disable the capture.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 sound/soc/codecs/rt711-sdca.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Pierre-Louis Bossart April 15, 2021, 11:25 a.m. UTC | #1
On 4/15/21 4:16 AM, shumingf@realtek.com wrote:
> From: Shuming Fan <shumingf@realtek.com>
> 
> The settings of the switch control already set by DAPM event.
> These switch controls might the user confused why it can't disable the capture.

Sorry, not following. This control is used in the alsa-ucm-conf that was 
just merged

https://github.com/alsa-project/alsa-ucm-conf/commit/197025656ec456331d1a34357b113913ec3b187f#diff-0e1c627ea89ee148fdb41aa6b3ba7851ba9c20eb43c1b87b9e0ce92164273dc3R7

Is this saying this commit needs to be fixed with a follow-up PR? Libin, 
are you working on this?


> 
> Signed-off-by: Shuming Fan <shumingf@realtek.com>
> ---
>   sound/soc/codecs/rt711-sdca.c | 8 --------
>   1 file changed, 8 deletions(-)
> 
> diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c
> index bfb7f1c8ec8f..2a09c305f4e4 100644
> --- a/sound/soc/codecs/rt711-sdca.c
> +++ b/sound/soc/codecs/rt711-sdca.c
> @@ -652,14 +652,6 @@ static const struct snd_kcontrol_new rt711_sdca_snd_controls[] = {
>   		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_R),
>   		0x57, 0x57, 0,
>   		rt711_sdca_set_gain_get, rt711_sdca_set_gain_put, out_vol_tlv),
> -	SOC_DOUBLE_R("FU1E Capture Switch",
> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_L),
> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_R),
> -		0, 1, 1),
> -	SOC_DOUBLE_R("FU0F Capture Switch",
> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L),
> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R),
> -		0, 1, 1),
>   	SOC_DOUBLE_R_EXT_TLV("FU1E Capture Volume",
>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_L),
>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_R),
>
Yang, Libin April 19, 2021, 5:14 a.m. UTC | #2
Hi Pierre,


> -----Original Message-----
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Sent: 2021年4月15日 19:26
> To: shumingf@realtek.com; broonie@kernel.org; lgirdwood@gmail.com
> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
> project.org; lars@metafoo.de; Yang, Libin <libin.yang@intel.com>;
> derek.fang@realtek.com; flove@realtek.com
> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
> 
> 
> 
> On 4/15/21 4:16 AM, shumingf@realtek.com wrote:
> > From: Shuming Fan <shumingf@realtek.com>
> >
> > The settings of the switch control already set by DAPM event.
> > These switch controls might the user confused why it can't disable the
> capture.
> 
> Sorry, not following. This control is used in the alsa-ucm-conf that was just
> merged
> 
> https://github.com/alsa-project/alsa-ucm-
> conf/commit/197025656ec456331d1a34357b113913ec3b187f#diff-
> 0e1c627ea89ee148fdb41aa6b3ba7851ba9c20eb43c1b87b9e0ce92164273dc3R
> 7
> 
> Is this saying this commit needs to be fixed with a follow-up PR? Libin, are
> you working on this?

Yes, I will submit a patch for UCM after this patch is merged.

The background is Jaroslav requires using codec HW kcontrol for capture
volume/switch. Shuming and I worked on it. At first we wanted to use
FU0F to replace PGA kcontrol. But Shuming found FU0F is used in DAPM.
So it is not proper for the capture volume/switch. And Shuming will remove
the FU0F kcontrol.

Regards,
Libin

> 
> 
> >
> > Signed-off-by: Shuming Fan <shumingf@realtek.com>
> > ---
> >   sound/soc/codecs/rt711-sdca.c | 8 --------
> >   1 file changed, 8 deletions(-)
> >
> > diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-
> sdca.c
> > index bfb7f1c8ec8f..2a09c305f4e4 100644
> > --- a/sound/soc/codecs/rt711-sdca.c
> > +++ b/sound/soc/codecs/rt711-sdca.c
> > @@ -652,14 +652,6 @@ static const struct snd_kcontrol_new
> rt711_sdca_snd_controls[] = {
> >   		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_R),
> >   		0x57, 0x57, 0,
> >   		rt711_sdca_set_gain_get, rt711_sdca_set_gain_put,
> out_vol_tlv),
> > -	SOC_DOUBLE_R("FU1E Capture Switch",
> > -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_L),
> > -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_R),
> > -		0, 1, 1),
> > -	SOC_DOUBLE_R("FU0F Capture Switch",
> > -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L),
> > -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R),
> > -		0, 1, 1),
> >   	SOC_DOUBLE_R_EXT_TLV("FU1E Capture Volume",
> >   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_L),
> >   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_R),
> >
Jaroslav Kysela April 19, 2021, 6:32 a.m. UTC | #3
Dne 19. 04. 21 v 7:14 Yang, Libin napsal(a):
> Hi Pierre,
> 
> 
>> -----Original Message-----
>> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> Sent: 2021年4月15日 19:26
>> To: shumingf@realtek.com; broonie@kernel.org; lgirdwood@gmail.com
>> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
>> project.org; lars@metafoo.de; Yang, Libin <libin.yang@intel.com>;
>> derek.fang@realtek.com; flove@realtek.com
>> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
>>
>>
>>
>> On 4/15/21 4:16 AM, shumingf@realtek.com wrote:
>>> From: Shuming Fan <shumingf@realtek.com>
>>>
>>> The settings of the switch control already set by DAPM event.
>>> These switch controls might the user confused why it can't disable the
>> capture.
>>
>> Sorry, not following. This control is used in the alsa-ucm-conf that was just
>> merged
>>
>> https://github.com/alsa-project/alsa-ucm-
>> conf/commit/197025656ec456331d1a34357b113913ec3b187f#diff-
>> 0e1c627ea89ee148fdb41aa6b3ba7851ba9c20eb43c1b87b9e0ce92164273dc3R
>> 7
>>
>> Is this saying this commit needs to be fixed with a follow-up PR? Libin, are
>> you working on this?
> 
> Yes, I will submit a patch for UCM after this patch is merged.
> 
> The background is Jaroslav requires using codec HW kcontrol for capture
> volume/switch. Shuming and I worked on it. At first we wanted to use
> FU0F to replace PGA kcontrol. But Shuming found FU0F is used in DAPM.
> So it is not proper for the capture volume/switch. And Shuming will remove
> the FU0F kcontrol.

Is switch control name aligned with the volume control name after this change?
I mean "A Capture Switch" + "A Capture Volume" not "A Capture Switch" + "B
Capture Volume".

						Jaroslav

> 
> Regards,
> Libin
> 
>>
>>
>>>
>>> Signed-off-by: Shuming Fan <shumingf@realtek.com>
>>> ---
>>>   sound/soc/codecs/rt711-sdca.c | 8 --------
>>>   1 file changed, 8 deletions(-)
>>>
>>> diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-
>> sdca.c
>>> index bfb7f1c8ec8f..2a09c305f4e4 100644
>>> --- a/sound/soc/codecs/rt711-sdca.c
>>> +++ b/sound/soc/codecs/rt711-sdca.c
>>> @@ -652,14 +652,6 @@ static const struct snd_kcontrol_new
>> rt711_sdca_snd_controls[] = {
>>>   		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
>> RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_R),
>>>   		0x57, 0x57, 0,
>>>   		rt711_sdca_set_gain_get, rt711_sdca_set_gain_put,
>> out_vol_tlv),
>>> -	SOC_DOUBLE_R("FU1E Capture Switch",
>>> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_L),
>>> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_R),
>>> -		0, 1, 1),
>>> -	SOC_DOUBLE_R("FU0F Capture Switch",
>>> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
>> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L),
>>> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
>> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R),
>>> -		0, 1, 1),
>>>   	SOC_DOUBLE_R_EXT_TLV("FU1E Capture Volume",
>>>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_L),
>>>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_R),
>>>
Yang, Libin April 19, 2021, 6:50 a.m. UTC | #4
Hi Jaroslav,

> -----Original Message-----
> From: Jaroslav Kysela <perex@perex.cz>
> Sent: 2021年4月19日 14:32
> To: Yang, Libin <libin.yang@intel.com>; Pierre-Louis Bossart <pierre-
> louis.bossart@linux.intel.com>; shumingf@realtek.com; broonie@kernel.org;
> lgirdwood@gmail.com
> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
> project.org; lars@metafoo.de; derek.fang@realtek.com; flove@realtek.com
> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
> 
> Dne 19. 04. 21 v 7:14 Yang, Libin napsal(a):
> > Hi Pierre,
> >
> >
> >> -----Original Message-----
> >> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> >> Sent: 2021年4月15日 19:26
> >> To: shumingf@realtek.com; broonie@kernel.org; lgirdwood@gmail.com
> >> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
> >> project.org; lars@metafoo.de; Yang, Libin <libin.yang@intel.com>;
> >> derek.fang@realtek.com; flove@realtek.com
> >> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
> >>
> >>
> >>
> >> On 4/15/21 4:16 AM, shumingf@realtek.com wrote:
> >>> From: Shuming Fan <shumingf@realtek.com>
> >>>
> >>> The settings of the switch control already set by DAPM event.
> >>> These switch controls might the user confused why it can't disable
> >>> the
> >> capture.
> >>
> >> Sorry, not following. This control is used in the alsa-ucm-conf that
> >> was just merged
> >>
> >> https://github.com/alsa-project/alsa-ucm-
> >> conf/commit/197025656ec456331d1a34357b113913ec3b187f#diff-
> >>
> 0e1c627ea89ee148fdb41aa6b3ba7851ba9c20eb43c1b87b9e0ce92164273dc3R
> >> 7
> >>
> >> Is this saying this commit needs to be fixed with a follow-up PR?
> >> Libin, are you working on this?
> >
> > Yes, I will submit a patch for UCM after this patch is merged.
> >
> > The background is Jaroslav requires using codec HW kcontrol for
> > capture volume/switch. Shuming and I worked on it. At first we wanted
> > to use FU0F to replace PGA kcontrol. But Shuming found FU0F is used in
> DAPM.
> > So it is not proper for the capture volume/switch. And Shuming will
> > remove the FU0F kcontrol.
> 
> Is switch control name aligned with the volume control name after this
> change?

This patch is removing "FU0F Capture Switch". Before this patch,
there is "FU0F Capture Switch" and "FU0F Capture Volume". After this
patch is applied, "FU0F Capture Switch" is removed. So the UCM 
https://github.com/alsa-project/alsa-ucm-conf/blob/57ead84278f641d411e3ccbb5c8a4b64141904ba/ucm2/codecs/rt711-sdca/init.conf#L7
of "FU0F Capture Switch" setting needs to be removed.

> I mean "A Capture Switch" + "A Capture Volume" not "A Capture Switch" + "B
> Capture Volume".

We couldn't find a proper codec kcontrol for RT711 capture. So we
have to continue using PGA kcontrol.

Regards,
Libin

> 
> 						Jaroslav
> 
> >
> > Regards,
> > Libin
> >
> >>
> >>
> >>>
> >>> Signed-off-by: Shuming Fan <shumingf@realtek.com>
> >>> ---
> >>>   sound/soc/codecs/rt711-sdca.c | 8 --------
> >>>   1 file changed, 8 deletions(-)
> >>>
> >>> diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-
> >> sdca.c
> >>> index bfb7f1c8ec8f..2a09c305f4e4 100644
> >>> --- a/sound/soc/codecs/rt711-sdca.c
> >>> +++ b/sound/soc/codecs/rt711-sdca.c
> >>> @@ -652,14 +652,6 @@ static const struct snd_kcontrol_new
> >> rt711_sdca_snd_controls[] = {
> >>>   		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> >> RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_R),
> >>>   		0x57, 0x57, 0,
> >>>   		rt711_sdca_set_gain_get, rt711_sdca_set_gain_put,
> >> out_vol_tlv),
> >>> -	SOC_DOUBLE_R("FU1E Capture Switch",
> >>> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> >> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_L),
> >>> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> >> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_R),
> >>> -		0, 1, 1),
> >>> -	SOC_DOUBLE_R("FU0F Capture Switch",
> >>> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> >> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L),
> >>> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> >> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R),
> >>> -		0, 1, 1),
> >>>   	SOC_DOUBLE_R_EXT_TLV("FU1E Capture Volume",
> >>>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> >> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_L),
> >>>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> >> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_R),
> >>>
> 
> 
> --
> Jaroslav Kysela <perex@perex.cz>
> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Jaroslav Kysela April 19, 2021, 6:56 a.m. UTC | #5
Dne 19. 04. 21 v 8:50 Yang, Libin napsal(a):
> Hi Jaroslav,
> 
>> -----Original Message-----
>> From: Jaroslav Kysela <perex@perex.cz>
>> Sent: 2021年4月19日 14:32
>> To: Yang, Libin <libin.yang@intel.com>; Pierre-Louis Bossart <pierre-
>> louis.bossart@linux.intel.com>; shumingf@realtek.com; broonie@kernel.org;
>> lgirdwood@gmail.com
>> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
>> project.org; lars@metafoo.de; derek.fang@realtek.com; flove@realtek.com
>> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
>>
>> Dne 19. 04. 21 v 7:14 Yang, Libin napsal(a):
>>> Hi Pierre,
>>>
>>>
>>>> -----Original Message-----
>>>> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>>>> Sent: 2021年4月15日 19:26
>>>> To: shumingf@realtek.com; broonie@kernel.org; lgirdwood@gmail.com
>>>> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
>>>> project.org; lars@metafoo.de; Yang, Libin <libin.yang@intel.com>;
>>>> derek.fang@realtek.com; flove@realtek.com
>>>> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
>>>>
>>>>
>>>>
>>>> On 4/15/21 4:16 AM, shumingf@realtek.com wrote:
>>>>> From: Shuming Fan <shumingf@realtek.com>
>>>>>
>>>>> The settings of the switch control already set by DAPM event.
>>>>> These switch controls might the user confused why it can't disable
>>>>> the
>>>> capture.
>>>>
>>>> Sorry, not following. This control is used in the alsa-ucm-conf that
>>>> was just merged
>>>>
>>>> https://github.com/alsa-project/alsa-ucm-
>>>> conf/commit/197025656ec456331d1a34357b113913ec3b187f#diff-
>>>>
>> 0e1c627ea89ee148fdb41aa6b3ba7851ba9c20eb43c1b87b9e0ce92164273dc3R
>>>> 7
>>>>
>>>> Is this saying this commit needs to be fixed with a follow-up PR?
>>>> Libin, are you working on this?
>>>
>>> Yes, I will submit a patch for UCM after this patch is merged.
>>>
>>> The background is Jaroslav requires using codec HW kcontrol for
>>> capture volume/switch. Shuming and I worked on it. At first we wanted
>>> to use FU0F to replace PGA kcontrol. But Shuming found FU0F is used in
>> DAPM.
>>> So it is not proper for the capture volume/switch. And Shuming will
>>> remove the FU0F kcontrol.
>>
>> Is switch control name aligned with the volume control name after this
>> change?
> 
> This patch is removing "FU0F Capture Switch". Before this patch,
> there is "FU0F Capture Switch" and "FU0F Capture Volume". After this
> patch is applied, "FU0F Capture Switch" is removed. So the UCM 
> https://github.com/alsa-project/alsa-ucm-conf/blob/57ead84278f641d411e3ccbb5c8a4b64141904ba/ucm2/codecs/rt711-sdca/init.conf#L7
> of "FU0F Capture Switch" setting needs to be removed.
> 
>> I mean "A Capture Switch" + "A Capture Volume" not "A Capture Switch" + "B
>> Capture Volume".
> 
> We couldn't find a proper codec kcontrol for RT711 capture. So we
> have to continue using PGA kcontrol.

It's really confusing then. What does "FU0F Capture Volume" ? It's really
difficult to judge something when I don't know the codec diagram.

Anyway, the switch and volume for the given I/O should have identical name and
they should differ only in the suffix describing the stream and functionality.

						Jaroslav

> 
> Regards,
> Libin
> 
>>
>> 						Jaroslav
>>
>>>
>>> Regards,
>>> Libin
>>>
>>>>
>>>>
>>>>>
>>>>> Signed-off-by: Shuming Fan <shumingf@realtek.com>
>>>>> ---
>>>>>   sound/soc/codecs/rt711-sdca.c | 8 --------
>>>>>   1 file changed, 8 deletions(-)
>>>>>
>>>>> diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-
>>>> sdca.c
>>>>> index bfb7f1c8ec8f..2a09c305f4e4 100644
>>>>> --- a/sound/soc/codecs/rt711-sdca.c
>>>>> +++ b/sound/soc/codecs/rt711-sdca.c
>>>>> @@ -652,14 +652,6 @@ static const struct snd_kcontrol_new
>>>> rt711_sdca_snd_controls[] = {
>>>>>   		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
>>>> RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_R),
>>>>>   		0x57, 0x57, 0,
>>>>>   		rt711_sdca_set_gain_get, rt711_sdca_set_gain_put,
>>>> out_vol_tlv),
>>>>> -	SOC_DOUBLE_R("FU1E Capture Switch",
>>>>> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
>>>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_L),
>>>>> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
>>>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_R),
>>>>> -		0, 1, 1),
>>>>> -	SOC_DOUBLE_R("FU0F Capture Switch",
>>>>> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
>>>> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L),
>>>>> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
>>>> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R),
>>>>> -		0, 1, 1),
>>>>>   	SOC_DOUBLE_R_EXT_TLV("FU1E Capture Volume",
>>>>>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
>>>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_L),
>>>>>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
>>>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_R),
>>>>>
>>
>>
>> --
>> Jaroslav Kysela <perex@perex.cz>
>> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Yang, Libin April 19, 2021, 7:17 a.m. UTC | #6
Hi Jaroslav,

> -----Original Message-----
> From: Jaroslav Kysela <perex@perex.cz>
> Sent: 2021年4月19日 14:57
> To: Yang, Libin <libin.yang@intel.com>; Pierre-Louis Bossart <pierre-
> louis.bossart@linux.intel.com>; shumingf@realtek.com; broonie@kernel.org;
> lgirdwood@gmail.com
> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
> project.org; lars@metafoo.de; derek.fang@realtek.com; flove@realtek.com
> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
> 
> Dne 19. 04. 21 v 8:50 Yang, Libin napsal(a):
> > Hi Jaroslav,
> >
> >> -----Original Message-----
> >> From: Jaroslav Kysela <perex@perex.cz>
> >> Sent: 2021年4月19日 14:32
> >> To: Yang, Libin <libin.yang@intel.com>; Pierre-Louis Bossart <pierre-
> >> louis.bossart@linux.intel.com>; shumingf@realtek.com;
> >> broonie@kernel.org; lgirdwood@gmail.com
> >> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
> >> project.org; lars@metafoo.de; derek.fang@realtek.com;
> >> flove@realtek.com
> >> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
> >>
> >> Dne 19. 04. 21 v 7:14 Yang, Libin napsal(a):
> >>> Hi Pierre,
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> >>>> Sent: 2021年4月15日 19:26
> >>>> To: shumingf@realtek.com; broonie@kernel.org;
> lgirdwood@gmail.com
> >>>> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
> >>>> project.org; lars@metafoo.de; Yang, Libin <libin.yang@intel.com>;
> >>>> derek.fang@realtek.com; flove@realtek.com
> >>>> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch
> >>>> controls
> >>>>
> >>>>
> >>>>
> >>>> On 4/15/21 4:16 AM, shumingf@realtek.com wrote:
> >>>>> From: Shuming Fan <shumingf@realtek.com>
> >>>>>
> >>>>> The settings of the switch control already set by DAPM event.
> >>>>> These switch controls might the user confused why it can't disable
> >>>>> the
> >>>> capture.
> >>>>
> >>>> Sorry, not following. This control is used in the alsa-ucm-conf
> >>>> that was just merged
> >>>>
> >>>> https://github.com/alsa-project/alsa-ucm-
> >>>> conf/commit/197025656ec456331d1a34357b113913ec3b187f#diff-
> >>>>
> >>
> 0e1c627ea89ee148fdb41aa6b3ba7851ba9c20eb43c1b87b9e0ce92164273dc3R
> >>>> 7
> >>>>
> >>>> Is this saying this commit needs to be fixed with a follow-up PR?
> >>>> Libin, are you working on this?
> >>>
> >>> Yes, I will submit a patch for UCM after this patch is merged.
> >>>
> >>> The background is Jaroslav requires using codec HW kcontrol for
> >>> capture volume/switch. Shuming and I worked on it. At first we
> >>> wanted to use FU0F to replace PGA kcontrol. But Shuming found FU0F
> >>> is used in
> >> DAPM.
> >>> So it is not proper for the capture volume/switch. And Shuming will
> >>> remove the FU0F kcontrol.
> >>
> >> Is switch control name aligned with the volume control name after
> >> this change?
> >
> > This patch is removing "FU0F Capture Switch". Before this patch, there
> > is "FU0F Capture Switch" and "FU0F Capture Volume". After this patch
> > is applied, "FU0F Capture Switch" is removed. So the UCM
> > https://github.com/alsa-project/alsa-ucm-
> conf/blob/57ead84278f641d411e
> > 3ccbb5c8a4b64141904ba/ucm2/codecs/rt711-sdca/init.conf#L7
> > of "FU0F Capture Switch" setting needs to be removed.
> >
> >> I mean "A Capture Switch" + "A Capture Volume" not "A Capture Switch"
> >> + "B Capture Volume".
> >
> > We couldn't find a proper codec kcontrol for RT711 capture. So we have
> > to continue using PGA kcontrol.
> 
> It's really confusing then. What does "FU0F Capture Volume" ? It's really
> difficult to judge something when I don't know the codec diagram.

"FU0F Capture Volume" will still control the volume of rt711 capture.
But "FU0F Capture Switch" will be removed. Because DAPM is using
this the same node. These is a conflict when we do below:
1. mute "FU0F Capture Switch". And the kcontrol will mute the
    Corresponding node in codec.
2. use arecord to capture from the rt711-sdca headset
3. DAPM will auto unmute the node which "FU0F Capture Switch" has 
     muted.
4. So we will capture the sound, even "FU0F Capture Switch" shows the 
    state is "muted" (this is wrong)

So Shuming decided to remove the "FU0F Capture Switch" kcontrol.

> 
> Anyway, the switch and volume for the given I/O should have identical name
> and they should differ only in the suffix describing the stream and
> functionality.

We won't touch "CaptureSwitch" and "CaptureVolume" for rt711-sdca.

The patch will be like what I submitted just now:
https://github.com/alsa-project/alsa-ucm-conf/pull/89

Regards,
Libin

> 
> 						Jaroslav
> 
> >
> > Regards,
> > Libin
> >
> >>
> >> 						Jaroslav
> >>
> >>>
> >>> Regards,
> >>> Libin
> >>>
> >>>>
> >>>>
> >>>>>
> >>>>> Signed-off-by: Shuming Fan <shumingf@realtek.com>
> >>>>> ---
> >>>>>   sound/soc/codecs/rt711-sdca.c | 8 --------
> >>>>>   1 file changed, 8 deletions(-)
> >>>>>
> >>>>> diff --git a/sound/soc/codecs/rt711-sdca.c
> >>>>> b/sound/soc/codecs/rt711-
> >>>> sdca.c
> >>>>> index bfb7f1c8ec8f..2a09c305f4e4 100644
> >>>>> --- a/sound/soc/codecs/rt711-sdca.c
> >>>>> +++ b/sound/soc/codecs/rt711-sdca.c
> >>>>> @@ -652,14 +652,6 @@ static const struct snd_kcontrol_new
> >>>> rt711_sdca_snd_controls[] = {
> >>>>>   		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> >>>> RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_R),
> >>>>>   		0x57, 0x57, 0,
> >>>>>   		rt711_sdca_set_gain_get, rt711_sdca_set_gain_put,
> >>>> out_vol_tlv),
> >>>>> -	SOC_DOUBLE_R("FU1E Capture Switch",
> >>>>> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> >>>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_L),
> >>>>> -		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> >>>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_R),
> >>>>> -		0, 1, 1),
> >>>>> -	SOC_DOUBLE_R("FU0F Capture Switch",
> >>>>> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> >>>> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L),
> >>>>> -		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
> >>>> RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R),
> >>>>> -		0, 1, 1),
> >>>>>   	SOC_DOUBLE_R_EXT_TLV("FU1E Capture Volume",
> >>>>>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> >>>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_L),
> >>>>>   		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
> >>>> RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_R),
> >>>>>
> >>
> >>
> >> --
> >> Jaroslav Kysela <perex@perex.cz>
> >> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
> 
> 
> --
> Jaroslav Kysela <perex@perex.cz>
> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Jaroslav Kysela April 19, 2021, 8:52 a.m. UTC | #7
Dne 19. 04. 21 v 9:17 Yang, Libin napsal(a):
> Hi Jaroslav,
> 
>> -----Original Message-----
>> From: Jaroslav Kysela <perex@perex.cz>
>> Sent: 2021年4月19日 14:57
>> To: Yang, Libin <libin.yang@intel.com>; Pierre-Louis Bossart <pierre-
>> louis.bossart@linux.intel.com>; shumingf@realtek.com; broonie@kernel.org;
>> lgirdwood@gmail.com
>> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
>> project.org; lars@metafoo.de; derek.fang@realtek.com; flove@realtek.com
>> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
>>
>> Dne 19. 04. 21 v 8:50 Yang, Libin napsal(a):
>>> Hi Jaroslav,
>>>
>>>> -----Original Message-----
>>>> From: Jaroslav Kysela <perex@perex.cz>
>>>> Sent: 2021年4月19日 14:32
>>>> To: Yang, Libin <libin.yang@intel.com>; Pierre-Louis Bossart <pierre-
>>>> louis.bossart@linux.intel.com>; shumingf@realtek.com;
>>>> broonie@kernel.org; lgirdwood@gmail.com
>>>> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
>>>> project.org; lars@metafoo.de; derek.fang@realtek.com;
>>>> flove@realtek.com
>>>> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch controls
>>>>
>>>> Dne 19. 04. 21 v 7:14 Yang, Libin napsal(a):
>>>>> Hi Pierre,
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>>>>>> Sent: 2021年4月15日 19:26
>>>>>> To: shumingf@realtek.com; broonie@kernel.org;
>> lgirdwood@gmail.com
>>>>>> Cc: oder_chiou@realtek.com; jack.yu@realtek.com; alsa-devel@alsa-
>>>>>> project.org; lars@metafoo.de; Yang, Libin <libin.yang@intel.com>;
>>>>>> derek.fang@realtek.com; flove@realtek.com
>>>>>> Subject: Re: [PATCH] ASoC: rt711-sdca: remove capture switch
>>>>>> controls
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 4/15/21 4:16 AM, shumingf@realtek.com wrote:
>>>>>>> From: Shuming Fan <shumingf@realtek.com>
>>>>>>>
>>>>>>> The settings of the switch control already set by DAPM event.
>>>>>>> These switch controls might the user confused why it can't disable
>>>>>>> the
>>>>>> capture.
>>>>>>
>>>>>> Sorry, not following. This control is used in the alsa-ucm-conf
>>>>>> that was just merged
>>>>>>
>>>>>> https://github.com/alsa-project/alsa-ucm-
>>>>>> conf/commit/197025656ec456331d1a34357b113913ec3b187f#diff-
>>>>>>
>>>>
>> 0e1c627ea89ee148fdb41aa6b3ba7851ba9c20eb43c1b87b9e0ce92164273dc3R
>>>>>> 7
>>>>>>
>>>>>> Is this saying this commit needs to be fixed with a follow-up PR?
>>>>>> Libin, are you working on this?
>>>>>
>>>>> Yes, I will submit a patch for UCM after this patch is merged.
>>>>>
>>>>> The background is Jaroslav requires using codec HW kcontrol for
>>>>> capture volume/switch. Shuming and I worked on it. At first we
>>>>> wanted to use FU0F to replace PGA kcontrol. But Shuming found FU0F
>>>>> is used in
>>>> DAPM.
>>>>> So it is not proper for the capture volume/switch. And Shuming will
>>>>> remove the FU0F kcontrol.
>>>>
>>>> Is switch control name aligned with the volume control name after
>>>> this change?
>>>
>>> This patch is removing "FU0F Capture Switch". Before this patch, there
>>> is "FU0F Capture Switch" and "FU0F Capture Volume". After this patch
>>> is applied, "FU0F Capture Switch" is removed. So the UCM
>>> https://github.com/alsa-project/alsa-ucm-
>> conf/blob/57ead84278f641d411e
>>> 3ccbb5c8a4b64141904ba/ucm2/codecs/rt711-sdca/init.conf#L7
>>> of "FU0F Capture Switch" setting needs to be removed.
>>>
>>>> I mean "A Capture Switch" + "A Capture Volume" not "A Capture Switch"
>>>> + "B Capture Volume".
>>>
>>> We couldn't find a proper codec kcontrol for RT711 capture. So we have
>>> to continue using PGA kcontrol.
>>
>> It's really confusing then. What does "FU0F Capture Volume" ? It's really
>> difficult to judge something when I don't know the codec diagram.
> 
> "FU0F Capture Volume" will still control the volume of rt711 capture.
> But "FU0F Capture Switch" will be removed. Because DAPM is using
> this the same node. These is a conflict when we do below:
> 1. mute "FU0F Capture Switch". And the kcontrol will mute the
>     Corresponding node in codec.
> 2. use arecord to capture from the rt711-sdca headset
> 3. DAPM will auto unmute the node which "FU0F Capture Switch" has 
>      muted.
> 4. So we will capture the sound, even "FU0F Capture Switch" shows the 
>     state is "muted" (this is wrong)
> 
> So Shuming decided to remove the "FU0F Capture Switch" kcontrol.

I see. In this case, the auto-route settings should differ from the mixer
settings. So the mute flag should be logical _OR_ from both DAPM and the mixer
settings. And because the codec is able to do the hw mute, why to prevent the
export of this feature?

So I propose do do (pseudo code):

struct rt711_sdca_priv {
	bool fu0f_dapm_mute;
	bool fu0f_mixer_mute;
};

/* called from both dapm event and kontrol put callback (on change) */
/* the dapm event and put callback will modify only rt711_sdca_priv fields */
static void set_f0f_mute(rt711_priv)
{
	int mute = rt711_priv->fu0f_dapm_mute || rt711_priv->fu0f_mixer_mute;
	set_fu0f_mute_register(mute);
}

With this implementation, all is consistent to the user space.

>> Anyway, the switch and volume for the given I/O should have identical name
>> and they should differ only in the suffix describing the stream and
>> functionality.
> 
> We won't touch "CaptureSwitch" and "CaptureVolume" for rt711-sdca.

Yes, but the hw controls should be used instead DSP controls, if they are
available.

					Jaroslav
Yang, Libin April 20, 2021, 12:17 a.m. UTC | #8
Hi Jaroslav,

> >>>>>>
> >>>>>>
> >>>>>> On 4/15/21 4:16 AM, shumingf@realtek.com wrote:
> >>>>>>> From: Shuming Fan <shumingf@realtek.com>
> >>>>>>>
> >>>>>>> The settings of the switch control already set by DAPM event.
> >>>>>>> These switch controls might the user confused why it can't
> >>>>>>> disable the
> >>>>>> capture.
> >>>>>>
> >>>>>> Sorry, not following. This control is used in the alsa-ucm-conf
> >>>>>> that was just merged
> >>>>>>
> >>>>>> https://github.com/alsa-project/alsa-ucm-
> >>>>>> conf/commit/197025656ec456331d1a34357b113913ec3b187f#diff-
> >>>>>>
> >>>>
> >>
> 0e1c627ea89ee148fdb41aa6b3ba7851ba9c20eb43c1b87b9e0ce92164273dc3R
> >>>>>> 7
> >>>>>>
> >>>>>> Is this saying this commit needs to be fixed with a follow-up PR?
> >>>>>> Libin, are you working on this?
> >>>>>
> >>>>> Yes, I will submit a patch for UCM after this patch is merged.
> >>>>>
> >>>>> The background is Jaroslav requires using codec HW kcontrol for
> >>>>> capture volume/switch. Shuming and I worked on it. At first we
> >>>>> wanted to use FU0F to replace PGA kcontrol. But Shuming found FU0F
> >>>>> is used in
> >>>> DAPM.
> >>>>> So it is not proper for the capture volume/switch. And Shuming
> >>>>> will remove the FU0F kcontrol.
> >>>>
> >>>> Is switch control name aligned with the volume control name after
> >>>> this change?
> >>>
> >>> This patch is removing "FU0F Capture Switch". Before this patch,
> >>> there is "FU0F Capture Switch" and "FU0F Capture Volume". After this
> >>> patch is applied, "FU0F Capture Switch" is removed. So the UCM
> >>> https://github.com/alsa-project/alsa-ucm-
> >> conf/blob/57ead84278f641d411e
> >>> 3ccbb5c8a4b64141904ba/ucm2/codecs/rt711-sdca/init.conf#L7
> >>> of "FU0F Capture Switch" setting needs to be removed.
> >>>
> >>>> I mean "A Capture Switch" + "A Capture Volume" not "A Capture
> Switch"
> >>>> + "B Capture Volume".
> >>>
> >>> We couldn't find a proper codec kcontrol for RT711 capture. So we
> >>> have to continue using PGA kcontrol.
> >>
> >> It's really confusing then. What does "FU0F Capture Volume" ? It's
> >> really difficult to judge something when I don't know the codec diagram.
> >
> > "FU0F Capture Volume" will still control the volume of rt711 capture.
> > But "FU0F Capture Switch" will be removed. Because DAPM is using this
> > the same node. These is a conflict when we do below:
> > 1. mute "FU0F Capture Switch". And the kcontrol will mute the
> >     Corresponding node in codec.
> > 2. use arecord to capture from the rt711-sdca headset 3. DAPM will
> > auto unmute the node which "FU0F Capture Switch" has
> >      muted.
> > 4. So we will capture the sound, even "FU0F Capture Switch" shows the
> >     state is "muted" (this is wrong)
> >
> > So Shuming decided to remove the "FU0F Capture Switch" kcontrol.
> 
> I see. In this case, the auto-route settings should differ from the mixer
> settings. So the mute flag should be logical _OR_ from both DAPM and the
> mixer settings. And because the codec is able to do the hw mute, why to
> prevent the export of this feature?
> 
> So I propose do do (pseudo code):
> 
> struct rt711_sdca_priv {
> 	bool fu0f_dapm_mute;
> 	bool fu0f_mixer_mute;
> };
> 
> /* called from both dapm event and kontrol put callback (on change) */
> /* the dapm event and put callback will modify only rt711_sdca_priv fields */
> static void set_f0f_mute(rt711_priv) {
> 	int mute = rt711_priv->fu0f_dapm_mute || rt711_priv-
> >fu0f_mixer_mute;
> 	set_fu0f_mute_register(mute);
> }
> 
> With this implementation, all is consistent to the user space.

If so:
When capture, if user setting is mute, it will always mute and if
user setting is unmute, it will always unmute.

When stop capture, it will always mute regardless the user setting.

Shuming, what do you think?

> 
> >> Anyway, the switch and volume for the given I/O should have identical
> >> name and they should differ only in the suffix describing the stream
> >> and functionality.
> >
> > We won't touch "CaptureSwitch" and "CaptureVolume" for rt711-sdca.
> 
> Yes, but the hw controls should be used instead DSP controls, if they are
> available.

Yes, we will try to use the codec hw controls instead of the DSP controls.

Regards,
Libin
Shuming [范書銘] April 20, 2021, 1:10 a.m. UTC | #9
> > I see. In this case, the auto-route settings should differ from the
> > mixer settings. So the mute flag should be logical _OR_ from both DAPM
> > and the mixer settings. And because the codec is able to do the hw
> > mute, why to prevent the export of this feature?
> >
> > So I propose do do (pseudo code):
> >
> > struct rt711_sdca_priv {
> > 	bool fu0f_dapm_mute;
> > 	bool fu0f_mixer_mute;
> > };
> >
> > /* called from both dapm event and kontrol put callback (on change) */
> > /* the dapm event and put callback will modify only rt711_sdca_priv
> > fields */ static void set_f0f_mute(rt711_priv) {
> > 	int mute = rt711_priv->fu0f_dapm_mute || rt711_priv-
> > >fu0f_mixer_mute;
> > 	set_fu0f_mute_register(mute);
> > }
> >
> > With this implementation, all is consistent to the user space.
> 
> If so:
> When capture, if user setting is mute, it will always mute and if user setting is
> unmute, it will always unmute.
> 
> When stop capture, it will always mute regardless the user setting.
> 
> Shuming, what do you think?

I think the function could mute/unmute both. It could avoid that the setting always mutes if the user setting is unmute.
e.g.
static void set_fu0f_capture_ctl(rt711_priv) {
    int mute = rt711_priv->fu0f_dapm_mute || rt711_priv->fu0f_mixer_mute;
    if (mute)
        set_fu0f_mute_register();
    else
        set_fu0f_unmute_register();
}

Hi Jaroslav,
Thanks for your suggestions. After the testing, I will send the v2 version.

> >
> > >> Anyway, the switch and volume for the given I/O should have
> > >> identical name and they should differ only in the suffix describing
> > >> the stream and functionality.
> > >
> > > We won't touch "CaptureSwitch" and "CaptureVolume" for rt711-sdca.
> >
> > Yes, but the hw controls should be used instead DSP controls, if they
> > are available.
> 
> Yes, we will try to use the codec hw controls instead of the DSP controls.
> 
> Regards,
> Libin
> ------Please consider the environment before printing this e-mail.
Jaroslav Kysela April 20, 2021, 6:20 a.m. UTC | #10
Dne 20. 04. 21 v 3:10 Shuming [范書銘] napsal(a):
>>> I see. In this case, the auto-route settings should differ from the
>>> mixer settings. So the mute flag should be logical _OR_ from both DAPM
>>> and the mixer settings. And because the codec is able to do the hw
>>> mute, why to prevent the export of this feature?
>>>
>>> So I propose do do (pseudo code):
>>>
>>> struct rt711_sdca_priv {
>>> 	bool fu0f_dapm_mute;
>>> 	bool fu0f_mixer_mute;
>>> };
>>>
>>> /* called from both dapm event and kontrol put callback (on change) */
>>> /* the dapm event and put callback will modify only rt711_sdca_priv
>>> fields */ static void set_f0f_mute(rt711_priv) {
>>> 	int mute = rt711_priv->fu0f_dapm_mute || rt711_priv-
>>>> fu0f_mixer_mute;
>>> 	set_fu0f_mute_register(mute);
>>> }
>>>
>>> With this implementation, all is consistent to the user space.
>>
>> If so:
>> When capture, if user setting is mute, it will always mute and if user setting is
>> unmute, it will always unmute.
>>
>> When stop capture, it will always mute regardless the user setting.
>>
>> Shuming, what do you think?
> 
> I think the function could mute/unmute both. It could avoid that the setting always mutes if the user setting is unmute.
> e.g.
> static void set_fu0f_capture_ctl(rt711_priv) {
>     int mute = rt711_priv->fu0f_dapm_mute || rt711_priv->fu0f_mixer_mute;
>     if (mute)
>         set_fu0f_mute_register();
>     else
>         set_fu0f_unmute_register();
> }

Yes, I passed the mute value in the pseudo code to the
set_fu0f_mute_register() function as argument for the further evaluation, but
I meant exactly this.

					Thank you,
						Jaroslav
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c
index bfb7f1c8ec8f..2a09c305f4e4 100644
--- a/sound/soc/codecs/rt711-sdca.c
+++ b/sound/soc/codecs/rt711-sdca.c
@@ -652,14 +652,6 @@  static const struct snd_kcontrol_new rt711_sdca_snd_controls[] = {
 		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_R),
 		0x57, 0x57, 0,
 		rt711_sdca_set_gain_get, rt711_sdca_set_gain_put, out_vol_tlv),
-	SOC_DOUBLE_R("FU1E Capture Switch",
-		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_L),
-		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_R),
-		0, 1, 1),
-	SOC_DOUBLE_R("FU0F Capture Switch",
-		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L),
-		SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R),
-		0, 1, 1),
 	SOC_DOUBLE_R_EXT_TLV("FU1E Capture Volume",
 		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_L),
 		SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_R),