alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output
@ 2021-12-08 18:55 Ajit Kumar Pandey
  2021-12-08 18:55 ` [PATCH v2 1/1] " Ajit Kumar Pandey
  2021-12-08 18:57 ` [PATCH v2 0/1] " Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Ajit Kumar Pandey @ 2021-12-08 18:55 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: Alexander.Deucher, Basavaraj.Hiregoudar, Sunil-kumar.Dommati,
	Ajit Kumar Pandey, Vijendar.Mukunda

changes since v1:
- Fix typo in commit description

Ajit Kumar Pandey (1):
  ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output

 sound/soc/codecs/rt5682s.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output
  2021-12-08 18:55 [PATCH v2 0/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output Ajit Kumar Pandey
@ 2021-12-08 18:55 ` Ajit Kumar Pandey
       [not found]   ` <126eab881bb540bc84ecc5cb9c6865a8@realtek.com>
  2021-12-08 18:57 ` [PATCH v2 0/1] " Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Ajit Kumar Pandey @ 2021-12-08 18:55 UTC (permalink / raw)
  To: broonie, alsa-devel
  Cc: Oder Chiou, Sunil-kumar.Dommati, Ajit Kumar Pandey, open list,
	Basavaraj.Hiregoudar, Takashi Iwai, Liam Girdwood,
	Vijendar.Mukunda, Alexander.Deucher

Add dapm switch in playback path to mute or unmute HP output data.
We will set and reset MUTE_SFT bit in RT5682S_HP_CTRL_1 register
based on switch value to mute or unmute respective channel.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
---
 sound/soc/codecs/rt5682s.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt5682s.c b/sound/soc/codecs/rt5682s.c
index d49a4f68566d..21ab5f7df422 100644
--- a/sound/soc/codecs/rt5682s.c
+++ b/sound/soc/codecs/rt5682s.c
@@ -1573,6 +1573,14 @@ static const char * const rt5682s_adcdat_pin_select[] = {
 	"ADCDAT1", "ADCDAT2",
 };
 
+/* Out Switch */
+static const struct snd_kcontrol_new hpol_switch =
+	SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT5682S_HP_CTRL_1,
+		RT5682S_L_MUTE_SFT, 1, 1);
+static const struct snd_kcontrol_new hpor_switch =
+	SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT5682S_HP_CTRL_1,
+		RT5682S_R_MUTE_SFT, 1, 1);
+
 static SOC_VALUE_ENUM_SINGLE_DECL(rt5682s_adcdat_pin_enum,
 	RT5682S_GPIO_CTRL_1, RT5682S_GP4_PIN_SFT, RT5682S_GP4_PIN_MASK,
 	rt5682s_adcdat_pin_select, rt5682s_adcdat_pin_values);
@@ -1746,6 +1754,11 @@ static const struct snd_soc_dapm_widget rt5682s_dapm_widgets[] = {
 	SND_SOC_DAPM_PGA_S("HP Amp", 1, SND_SOC_NOPM, 0, 0, rt5682s_hp_amp_event,
 		SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_POST_PMU),
 
+	SND_SOC_DAPM_SWITCH("HPOL Playback", SND_SOC_NOPM, 0, 0,
+		&hpol_switch),
+	SND_SOC_DAPM_SWITCH("HPOR Playback", SND_SOC_NOPM, 0, 0,
+		&hpor_switch),
+
 	/* CLK DET */
 	SND_SOC_DAPM_SUPPLY("CLKDET SYS", RT5682S_CLK_DET,
 		RT5682S_SYS_CLK_DET_SFT, 0, NULL, 0),
@@ -1895,8 +1908,10 @@ static const struct snd_soc_dapm_route rt5682s_dapm_routes[] = {
 	{"HP Amp", NULL, "CLKDET SYS"},
 	{"HP Amp", NULL, "SAR"},
 
-	{"HPOL", NULL, "HP Amp"},
-	{"HPOR", NULL, "HP Amp"},
+	{"HPOL Playback", "Switch", "HP Amp"},
+	{"HPOR Playback", "Switch", "HP Amp"},
+	{"HPOL", NULL, "HPOL Playback"},
+	{"HPOR", NULL, "HPOR Playback"},
 };
 
 static int rt5682s_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output
  2021-12-08 18:55 [PATCH v2 0/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output Ajit Kumar Pandey
  2021-12-08 18:55 ` [PATCH v2 1/1] " Ajit Kumar Pandey
@ 2021-12-08 18:57 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-12-08 18:57 UTC (permalink / raw)
  To: Ajit Kumar Pandey
  Cc: Alexander.Deucher, alsa-devel, Sunil-kumar.Dommati,
	Basavaraj.Hiregoudar, Vijendar.Mukunda

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

On Thu, Dec 09, 2021 at 12:25:16AM +0530, Ajit Kumar Pandey wrote:
> changes since v1:
> - Fix typo in commit description

Please don't send cover letters for single patches, if there is anything
that needs saying put it in the changelog of the patch or after the ---
if it's administrative stuff.  This reduces mail volume and ensures that 
any important information is recorded in the changelog rather than being
lost. 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output
       [not found]   ` <126eab881bb540bc84ecc5cb9c6865a8@realtek.com>
@ 2021-12-16 11:43     ` Ajit Kumar Pandey
  2021-12-17  2:25       ` Derek [方德義]
  0 siblings, 1 reply; 5+ messages in thread
From: Ajit Kumar Pandey @ 2021-12-16 11:43 UTC (permalink / raw)
  To: Shuming [范書銘], broonie, alsa-devel
  Cc: Oder Chiou, Jack Yu, Sunil-kumar.Dommati, Basavaraj.Hiregoudar,
	Takashi Iwai, Liam Girdwood, open list, Albert Chen,
	Derek [方德義],
	Vijendar.Mukunda, Alexander.Deucher, Flove(HsinFu)



On 12/9/2021 7:55 AM, Shuming [范書銘] wrote:
> [CAUTION: External Email]
> 
>> Subject: [PATCH v2 1/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP
>> playback output
>>
>> Add dapm switch in playback path to mute or unmute HP output data.
>> We will set and reset MUTE_SFT bit in RT5682S_HP_CTRL_1 register based on
>> switch value to mute or unmute respective channel.
>>
>> Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
>> ---
>>   sound/soc/codecs/rt5682s.c | 19 +++++++++++++++++--
>>   1 file changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/sound/soc/codecs/rt5682s.c b/sound/soc/codecs/rt5682s.c index
>> d49a4f68566d..21ab5f7df422 100644
>> --- a/sound/soc/codecs/rt5682s.c
>> +++ b/sound/soc/codecs/rt5682s.c
>> @@ -1573,6 +1573,14 @@ static const char * const
>> rt5682s_adcdat_pin_select[] = {
>>        "ADCDAT1", "ADCDAT2",
>>   };
>>
>> +/* Out Switch */
>> +static const struct snd_kcontrol_new hpol_switch =
>> +     SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT5682S_HP_CTRL_1,
>> +             RT5682S_L_MUTE_SFT, 1, 1);
>> +static const struct snd_kcontrol_new hpor_switch =
>> +     SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT5682S_HP_CTRL_1,
>> +             RT5682S_R_MUTE_SFT, 1, 1);
>> +
>>   static SOC_VALUE_ENUM_SINGLE_DECL(rt5682s_adcdat_pin_enum,
>>        RT5682S_GPIO_CTRL_1, RT5682S_GP4_PIN_SFT,
>> RT5682S_GP4_PIN_MASK,
>>        rt5682s_adcdat_pin_select, rt5682s_adcdat_pin_values); @@ -1746,6
>> +1754,11 @@ static const struct snd_soc_dapm_widget
>> rt5682s_dapm_widgets[] = {
>>        SND_SOC_DAPM_PGA_S("HP Amp", 1, SND_SOC_NOPM, 0, 0,
>> rt5682s_hp_amp_event,
>>                SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_POST_PMU),
>>
>> +     SND_SOC_DAPM_SWITCH("HPOL Playback", SND_SOC_NOPM, 0, 0,
>> +             &hpol_switch),
>> +     SND_SOC_DAPM_SWITCH("HPOR Playback", SND_SOC_NOPM, 0, 0,
>> +             &hpor_switch),
>> +
>>        /* CLK DET */
>>        SND_SOC_DAPM_SUPPLY("CLKDET SYS", RT5682S_CLK_DET,
>>                RT5682S_SYS_CLK_DET_SFT, 0, NULL, 0), @@ -1895,8 +1908,10 @@
>> static const struct snd_soc_dapm_route rt5682s_dapm_routes[] = {
>>        {"HP Amp", NULL, "CLKDET SYS"},
>>        {"HP Amp", NULL, "SAR"},
>>
>> -     {"HPOL", NULL, "HP Amp"},
>> -     {"HPOR", NULL, "HP Amp"},
>> +     {"HPOL Playback", "Switch", "HP Amp"},
>> +     {"HPOR Playback", "Switch", "HP Amp"},
>> +     {"HPOL", NULL, "HPOL Playback"},
>> +     {"HPOR", NULL, "HPOR Playback"},
>>   };
> 
> RT5682S enables the 1 bit control for HP output.
> Therefore, the setting of RT5682S_HP_CTRL_1[15][7] will be not effective.
> 
>
Ok, it was actually effective and muted audio when we test in our 
platform, possible because i'm tearing down dapm path based on switch
value. If we don't have register bits available to mute i'll resubmit 
the change with virtual switch widget to disable DAPM and stop audio.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2 1/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output
  2021-12-16 11:43     ` Ajit Kumar Pandey
@ 2021-12-17  2:25       ` Derek [方德義]
  0 siblings, 0 replies; 5+ messages in thread
From: Derek [方德義] @ 2021-12-17  2:25 UTC (permalink / raw)
  To: Ajit Kumar Pandey, Shuming [范書銘],
	broonie, alsa-devel
  Cc: Oder Chiou, Jack Yu, Sunil-kumar.Dommati, Basavaraj.Hiregoudar,
	Takashi Iwai, Liam Girdwood, open list, Albert Chen,
	Vijendar.Mukunda, Alexander.Deucher, Flove(HsinFu)

> Subject: Re: [PATCH v2 1/1] ASoC: rt5682s: Add dapm switch to mute/unmute
> HP playback output
> 
> On 12/9/2021 7:55 AM, Shuming [范書銘] wrote:
> > [CAUTION: External Email]
> >
> >> Subject: [PATCH v2 1/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP
> >> playback output
> >>
> >> Add dapm switch in playback path to mute or unmute HP output data.
> >> We will set and reset MUTE_SFT bit in RT5682S_HP_CTRL_1 register based on
> >> switch value to mute or unmute respective channel.
> >>
> >> Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
> >> ---
> >>   sound/soc/codecs/rt5682s.c | 19 +++++++++++++++++--
> >>   1 file changed, 17 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/sound/soc/codecs/rt5682s.c b/sound/soc/codecs/rt5682s.c index
> >> d49a4f68566d..21ab5f7df422 100644
> >> --- a/sound/soc/codecs/rt5682s.c
> >> +++ b/sound/soc/codecs/rt5682s.c
> >> @@ -1573,6 +1573,14 @@ static const char * const
> >> rt5682s_adcdat_pin_select[] = {
> >>        "ADCDAT1", "ADCDAT2",
> >>   };
> >>
> >> +/* Out Switch */
> >> +static const struct snd_kcontrol_new hpol_switch =
> >> +     SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT5682S_HP_CTRL_1,
> >> +             RT5682S_L_MUTE_SFT, 1, 1);
> >> +static const struct snd_kcontrol_new hpor_switch =
> >> +     SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT5682S_HP_CTRL_1,
> >> +             RT5682S_R_MUTE_SFT, 1, 1);
> >> +
> >>   static SOC_VALUE_ENUM_SINGLE_DECL(rt5682s_adcdat_pin_enum,
> >>        RT5682S_GPIO_CTRL_1, RT5682S_GP4_PIN_SFT,
> >> RT5682S_GP4_PIN_MASK,
> >>        rt5682s_adcdat_pin_select, rt5682s_adcdat_pin_values); @@
> -1746,6
> >> +1754,11 @@ static const struct snd_soc_dapm_widget
> >> rt5682s_dapm_widgets[] = {
> >>        SND_SOC_DAPM_PGA_S("HP Amp", 1, SND_SOC_NOPM, 0, 0,
> >> rt5682s_hp_amp_event,
> >>                SND_SOC_DAPM_POST_PMD |
> SND_SOC_DAPM_POST_PMU),
> >>
> >> +     SND_SOC_DAPM_SWITCH("HPOL Playback", SND_SOC_NOPM, 0, 0,
> >> +             &hpol_switch),
> >> +     SND_SOC_DAPM_SWITCH("HPOR Playback", SND_SOC_NOPM, 0, 0,
> >> +             &hpor_switch),
> >> +
> >>        /* CLK DET */
> >>        SND_SOC_DAPM_SUPPLY("CLKDET SYS", RT5682S_CLK_DET,
> >>                RT5682S_SYS_CLK_DET_SFT, 0, NULL, 0), @@ -1895,8
> +1908,10 @@
> >> static const struct snd_soc_dapm_route rt5682s_dapm_routes[] = {
> >>        {"HP Amp", NULL, "CLKDET SYS"},
> >>        {"HP Amp", NULL, "SAR"},
> >>
> >> -     {"HPOL", NULL, "HP Amp"},
> >> -     {"HPOR", NULL, "HP Amp"},
> >> +     {"HPOL Playback", "Switch", "HP Amp"},
> >> +     {"HPOR Playback", "Switch", "HP Amp"},
> >> +     {"HPOL", NULL, "HPOL Playback"},
> >> +     {"HPOR", NULL, "HPOR Playback"},
> >>   };
> >
> > RT5682S enables the 1 bit control for HP output.
> > Therefore, the setting of RT5682S_HP_CTRL_1[15][7] will be not effective.
> >
> >
> Ok, it was actually effective and muted audio when we test in our
> platform, possible because i'm tearing down dapm path based on switch
> value. If we don't have register bits available to mute i'll resubmit
> the change with virtual switch widget to disable DAPM and stop audio.
> 
What purpose do you want to add an additional switch to power up/down 
the dapm in the codec driver instead of using existing controls?
And we thought the virtual switch you talked about could be implemented 
in the machine driver.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-17  2:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 18:55 [PATCH v2 0/1] ASoC: rt5682s: Add dapm switch to mute/unmute HP playback output Ajit Kumar Pandey
2021-12-08 18:55 ` [PATCH v2 1/1] " Ajit Kumar Pandey
     [not found]   ` <126eab881bb540bc84ecc5cb9c6865a8@realtek.com>
2021-12-16 11:43     ` Ajit Kumar Pandey
2021-12-17  2:25       ` Derek [方德義]
2021-12-08 18:57 ` [PATCH v2 0/1] " Mark Brown

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).