Skip to contentSkip to conversation

ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card

PATCH Applied Jin Yao 3 participants 8 messages Mar 11, 2015 – Mar 13, 2015

Subsystems (4)
lore
Share & tools
lore

Jin Yao

author
#0 lore raw

PATCH 1/1 ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card

On Braswell, we need to add some machine specific setting before suspend and after resume. For example, disable/enable jack detection in codec so use snd_soc_card suspend_pre and resume_post ops for this purpose.

---
 sound/soc/intel/cht_bsw_rt5672.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
sound/soc/intel/cht_bsw_rt5672.c +31 -0
index 279df4c..c41fae3 100644
@@ -267,6 +267,35 @@ static struct snd_soc_dai_link cht_dailink[] = {
 	},
 };
 
+static int cht_suspend_pre(struct snd_soc_card *card)
+{
+	struct snd_soc_codec *codec;
+
+	list_for_each_entry(codec, &card->codec_dev_list, card_list) {
+		if (!strcmp(codec->component.name, "i2c-10EC5670:00")) {
+			dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n");
+			rt5670_jack_suspend(codec);
+			break;
+		}
+	}
+	return 0;
+}
+
+static int cht_resume_post(struct snd_soc_card *card)
+{
+	struct snd_soc_codec *codec;
+
+	list_for_each_entry(codec, &card->codec_dev_list, card_list) {
+		if (!strcmp(codec->component.name, "i2c-10EC5670:00")) {
+			dev_dbg(codec->dev, "enabling jack detect for resume.\n");
+			rt5670_jack_resume(codec);
+			break;
+		}
+	}
+
+	return 0;
+}
+
 /* SoC card */
 static struct snd_soc_card snd_soc_card_cht = {
 	.name = "cherrytrailcraudio",
@@ -278,6 +307,8 @@ static struct snd_soc_card snd_soc_card_cht = {
 	.num_dapm_routes = ARRAY_SIZE(cht_audio_map),
 	.controls = cht_mc_controls,
 	.num_controls = ARRAY_SIZE(cht_mc_controls),
+	.suspend_pre = cht_suspend_pre,
+	.resume_post = cht_resume_post,
 };
 
 static int snd_cht_mc_probe(struct platform_device *pdev)
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 3 lines · Jin Yao

On Braswell, we need to add some machine specific setting before suspend and after resume. For example, disable/enable jack detection in codec so use snd_soc_card suspend_pre and resume_post ops for this purpose.

Applied, thanks.

maintainer
#2 lore raw
In reply to Jin Yao
Quoted 3 lines · Jin Yao

On Braswell, we need to add some machine specific setting before suspend and after resume. For example, disable/enable jack detection in codec so use snd_soc_card suspend_pre and resume_post ops for this purpose.

Reverted since it doesn't build!

author
#3 lore raw

Hi Mark, Bard,

This patch has dependency on Bard's patch "ASoC: rt5670: export jack suspend/resume APIs". I pull the Mark's for-next branch right now and I can see Bard's patch "ASoC: rt5670: export jack suspend/resume APIs" has been integrated.

So there now is only one build error in rt5670.c:

sound/soc/codecs/rt5670.c: In function 'is_sys_clk_from_pll':
sound/soc/codecs/rt5670.c:702:38: error: 'struct snd_soc_dapm_widget' has no member named 'codec'

  struct snd_soc_codec *codec = source->codec;
                                      ^

After I fix it with my change as following, the build is successful.

sound/soc/codecs/rt5670.c +1 -1
@@ -699,7 +699,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
-       struct snd_soc_codec *codec = source->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
 
        if (rt5670->sysclk_src == RT5670_SCLK_S_PLL1)

Could Bard take a look at it?

For my patch, the build is successful.

ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
ASoC: Intel: move the jack creation to Braswell machine driver

Thanks
Jin Yao

Quoted 7 lines · Mark Brown
Quoted 3 lines · Jin Yao

On Braswell, we need to add some machine specific setting before suspend and after resume. For example, disable/enable jack detection in codec so use snd_soc_card suspend_pre and resume_post ops for this purpose.

Reverted since it doesn't build!

#4 lore raw
Quoted 9 lines

-----Original Message-----
From: Jin, Yao [mailto:[email protected]]
Sent: Thursday, March 12, 2015 8:52 AM
To: Mark Brown
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Bard Liao
Subject: Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card

Quoted 6 lines

Hi Mark, Bard,

This patch has dependency on Bard's patch "ASoC: rt5670: export jack suspend/resume APIs". I pull the Mark's for-next branch right now and I can see Bard's patch "ASoC: rt5670: export jack suspend/resume APIs" has been integrated.

I think we should send the dependency patches in a series.

Quoted 3 lines

function 'snd_soc_card_jack_new' [-Werror=implicit-function-declaration]

            ret = snd_soc_card_jack_new(runtime->card, "Headset",
            ^

I think it is due to Lars-Peter's "ASoC: simple-card: Register jacks at the card level" patch is not applied on branch topic/intel.

Quoted 22 lines

So there now is only one build error in rt5670.c:

sound/soc/codecs/rt5670.c: In function 'is_sys_clk_from_pll':
sound/soc/codecs/rt5670.c:702:38: error: 'struct snd_soc_dapm_widget' has no member named 'codec'

  struct snd_soc_codec *codec = source->codec;
                                      ^

After I fix it with my change as following, the build is successful.

sound/soc/codecs/rt5670.c +0 -0
@@ -699,7 +699,7 @@ static int set_dmic_clk(struct

snd_soc_dapm_widget *w, static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,

                         struct snd_soc_dapm_widget *sink)  {
sound/soc/codecs/rt5670.c +2 -1
-       struct snd_soc_codec *codec = source->codec;
+       struct snd_soc_codec *codec =
+ snd_soc_dapm_to_codec(source->dapm);
        struct rt5670_priv *rt5670 =

snd_soc_codec_get_drvdata(codec);

Quoted 3 lines
        if (rt5670->sysclk_src == RT5670_SCLK_S_PLL1)

Could Bard take a look at it?

It is already in Lars-Peter's "ASoC: rt5670: Replace w->codec snd_soc_dapm_to_codec(w->dapm)" patch

Quoted 20 lines

For my patch, the build is successful.

ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
ASoC: Intel: move the jack creation to Braswell machine driver

Thanks
Jin Yao

Quoted 4 lines · Mark Brown
Quoted 3 lines · Jin Yao

On Braswell, we need to add some machine specific setting before suspend and after resume. For example, disable/enable jack detection in codec so use snd_soc_card suspend_pre and resume_post ops for

this purpose.

Quoted 3 lines

Reverted since it doesn't build!

------Please consider the environment before printing this e-mail.

author
#5 lore raw

Hi Bard, Mark,

I pull the for-next branch right now and I can see the following rt5670 patches have been integrated.

66454b3 ASoC: rt5670: Replace w->codec snd_soc_dapm_to_codec(w->dapm) cc3c340 ASoC: rt5670: export jack suspend/resume APIs d3ef705 ASoC: rt5670: Add IRQ function

Then I build the for-next branch with my patches (reverted before):

ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
ASoC: Intel: move the jack creation to Braswell machine driver

The build is successful. So it looks we don't need to resend the patch series, just re-applying my patches should be OK.

Thanks
Jin Yao

Quoted 74 lines · Bard Liao
Quoted 9 lines

-----Original Message-----
From: Jin, Yao [mailto:[email protected]]
Sent: Thursday, March 12, 2015 8:52 AM
To: Mark Brown
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Bard Liao
Subject: Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card

Quoted 6 lines

Hi Mark, Bard,

This patch has dependency on Bard's patch "ASoC: rt5670: export jack suspend/resume APIs". I pull the Mark's for-next branch right now and I can see Bard's patch "ASoC: rt5670: export jack suspend/resume APIs" has been integrated.

I think we should send the dependency patches in a series.

Quoted 3 lines

function 'snd_soc_card_jack_new' [-Werror=implicit-function-declaration]

            ret = snd_soc_card_jack_new(runtime->card, "Headset",
            ^

I think it is due to Lars-Peter's "ASoC: simple-card: Register jacks at the card level" patch is not applied on branch topic/intel.

Quoted 22 lines

So there now is only one build error in rt5670.c:

sound/soc/codecs/rt5670.c: In function 'is_sys_clk_from_pll':
sound/soc/codecs/rt5670.c:702:38: error: 'struct snd_soc_dapm_widget' has no member named 'codec'

  struct snd_soc_codec *codec = source->codec;
                                      ^

After I fix it with my change as following, the build is successful.

sound/soc/codecs/rt5670.c +0 -0
@@ -699,7 +699,7 @@ static int set_dmic_clk(struct

snd_soc_dapm_widget *w, static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,

                         struct snd_soc_dapm_widget *sink)  {
sound/soc/codecs/rt5670.c +2 -1
-       struct snd_soc_codec *codec = source->codec;
+       struct snd_soc_codec *codec =
+ snd_soc_dapm_to_codec(source->dapm);
        struct rt5670_priv *rt5670 =

snd_soc_codec_get_drvdata(codec);

Quoted 3 lines
        if (rt5670->sysclk_src == RT5670_SCLK_S_PLL1)

Could Bard take a look at it?

It is already in Lars-Peter's "ASoC: rt5670: Replace w->codec snd_soc_dapm_to_codec(w->dapm)" patch

Quoted 20 lines

For my patch, the build is successful.

ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
ASoC: Intel: move the jack creation to Braswell machine driver

Thanks
Jin Yao

Quoted 4 lines · Mark Brown
Quoted 3 lines · Jin Yao

On Braswell, we need to add some machine specific setting before suspend and after resume. For example, disable/enable jack detection in codec so use snd_soc_card suspend_pre and resume_post ops for

this purpose.

Quoted 3 lines

Reverted since it doesn't build!

------Please consider the environment before printing this e-mail.

maintainer
#6 lore raw
Quoted 7 lines · Yao

I pull the for-next branch right now and I can see the following rt5670 patches have been integrated.

66454b3 ASoC: rt5670: Replace w->codec snd_soc_dapm_to_codec(w->dapm) cc3c340 ASoC: rt5670: export jack suspend/resume APIs d3ef705 ASoC: rt5670: Add IRQ function

Quoted 7 lines

Then I build the for-next branch with my patches (reverted before):

ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
ASoC: Intel: move the jack creation to Braswell machine driver

The build is successful. So it looks we don't need to resend the patch series, just re-applying my patches should be OK.

These are two separate branches, if there's dependencies between the two branches we need to merge them before applying new patches - I think that's the missing piece of information here.

author
#7 lore raw

Hi Mark,

Sorry for forgetting to mention the patch dependency information in previous mail.

Now since all the dependency rt5670 patches have been merged in for-next branch, I just want to know what we need to do for next step to let following patches be applied?

ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
ASoC: Intel: move the jack creation to Braswell machine drive

Thanks
Jin Yao

Quoted 21 lines · Mark Brown
Quoted 7 lines · Yao

I pull the for-next branch right now and I can see the following rt5670 patches have been integrated.

66454b3 ASoC: rt5670: Replace w->codec snd_soc_dapm_to_codec(w->dapm) cc3c340 ASoC: rt5670: export jack suspend/resume APIs d3ef705 ASoC: rt5670: Add IRQ function

Quoted 7 lines

Then I build the for-next branch with my patches (reverted before):

ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
ASoC: Intel: move the jack creation to Braswell machine driver

The build is successful. So it looks we don't need to resend the patch series, just re-applying my patches should be OK.

These are two separate branches, if there's dependencies between the two branches we need to merge them before applying new patches - I think that's the missing piece of information here.