All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
@ 2015-03-11  3:48 Jin Yao
  2015-03-11 11:50 ` Mark Brown
  2015-03-11 12:50 ` Mark Brown
  0 siblings, 2 replies; 8+ messages in thread
From: Jin Yao @ 2015-03-11  3:48 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, yao.jin, bardliao

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.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 sound/soc/intel/cht_bsw_rt5672.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index 279df4c..c41fae3 100644
--- a/sound/soc/intel/cht_bsw_rt5672.c
+++ b/sound/soc/intel/cht_bsw_rt5672.c
@@ -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)
-- 
1.9.1

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

* Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2015-03-11  3:48 [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card Jin Yao
@ 2015-03-11 11:50 ` Mark Brown
  2015-03-11 12:50 ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2015-03-11 11:50 UTC (permalink / raw)
  To: Jin Yao; +Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, lgirdwood, bardliao


[-- Attachment #1.1: Type: text/plain, Size: 294 bytes --]

On Wed, Mar 11, 2015 at 11:48:33AM +0800, Jin Yao wrote:
> 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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2015-03-11  3:48 [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card Jin Yao
  2015-03-11 11:50 ` Mark Brown
@ 2015-03-11 12:50 ` Mark Brown
  2015-03-12  0:52   ` Jin, Yao
  1 sibling, 1 reply; 8+ messages in thread
From: Mark Brown @ 2015-03-11 12:50 UTC (permalink / raw)
  To: Jin Yao; +Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, lgirdwood, bardliao


[-- Attachment #1.1: Type: text/plain, Size: 310 bytes --]

On Wed, Mar 11, 2015 at 11:48:33AM +0800, Jin Yao wrote:
> 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!

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2015-03-11 12:50 ` Mark Brown
@ 2015-03-12  0:52   ` Jin, Yao
  2015-03-12  2:38     ` Bard Liao
  0 siblings, 1 reply; 8+ messages in thread
From: Jin, Yao @ 2015-03-12  0:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, lgirdwood, bardliao

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.

--- a/sound/soc/codecs/rt5670.c
+++ b/sound/soc/codecs/rt5670.c
@@ -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

On 2015/3/11 20:50, Mark Brown wrote:
> On Wed, Mar 11, 2015 at 11:48:33AM +0800, Jin Yao wrote:
>> 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!
> 

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

* Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2015-03-12  0:52   ` Jin, Yao
@ 2015-03-12  2:38     ` Bard Liao
  2015-03-12 12:42       ` Jin, Yao
  0 siblings, 1 reply; 8+ messages in thread
From: Bard Liao @ 2015-03-12  2:38 UTC (permalink / raw)
  To: Jin, Yao, Mark Brown
  Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, lgirdwood

> -----Original Message-----
> From: Jin, Yao [mailto:yao.jin@linux.intel.com]
> Sent: Thursday, March 12, 2015 8:52 AM
> To: Mark Brown
> Cc: lgirdwood@gmail.com; alsa-devel@alsa-project.org;
> mengdong.lin@intel.com; subhransu.s.prusty@intel.com; Bard Liao
> Subject: Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for
> Braswell snd_soc_card
> 
> 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.

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

> 
> 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.
> 
> --- a/sound/soc/codecs/rt5670.c
> +++ b/sound/soc/codecs/rt5670.c
> @@ -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?

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

> 
> 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
> 
> On 2015/3/11 20:50, Mark Brown wrote:
> > On Wed, Mar 11, 2015 at 11:48:33AM +0800, Jin Yao wrote:
> >> 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!
> >
> 
> ------Please consider the environment before printing this e-mail.

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

* Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2015-03-12  2:38     ` Bard Liao
@ 2015-03-12 12:42       ` Jin, Yao
  2015-03-12 18:01         ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Jin, Yao @ 2015-03-12 12:42 UTC (permalink / raw)
  To: Bard Liao, Mark Brown
  Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, lgirdwood

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

On 2015/3/12 10:38, Bard Liao wrote:
>> -----Original Message-----
>> From: Jin, Yao [mailto:yao.jin@linux.intel.com]
>> Sent: Thursday, March 12, 2015 8:52 AM
>> To: Mark Brown
>> Cc: lgirdwood@gmail.com; alsa-devel@alsa-project.org;
>> mengdong.lin@intel.com; subhransu.s.prusty@intel.com; Bard Liao
>> Subject: Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for
>> Braswell snd_soc_card
>>
>> 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.
> 
>> 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.
> 
>>
>> 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.
>>
>> --- a/sound/soc/codecs/rt5670.c
>> +++ b/sound/soc/codecs/rt5670.c
>> @@ -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?
> 
> It is already in Lars-Peter's "ASoC: rt5670: Replace w->codec
> snd_soc_dapm_to_codec(w->dapm)" patch
> 
>>
>> 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
>>
>> On 2015/3/11 20:50, Mark Brown wrote:
>>> On Wed, Mar 11, 2015 at 11:48:33AM +0800, Jin Yao wrote:
>>>> 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!
>>>
>>
>> ------Please consider the environment before printing this e-mail.

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

* Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2015-03-12 12:42       ` Jin, Yao
@ 2015-03-12 18:01         ` Mark Brown
  2015-03-13  3:17           ` Jin, Yao
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2015-03-12 18:01 UTC (permalink / raw)
  To: Jin, Yao
  Cc: Bard Liao, alsa-devel, subhransu.s.prusty, lgirdwood, mengdong.lin


[-- Attachment #1.1: Type: text/plain, Size: 860 bytes --]

On Thu, Mar 12, 2015 at 08:42:55PM +0800, Jin, Yao wrote:

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

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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2015-03-12 18:01         ` Mark Brown
@ 2015-03-13  3:17           ` Jin, Yao
  0 siblings, 0 replies; 8+ messages in thread
From: Jin, Yao @ 2015-03-13  3:17 UTC (permalink / raw)
  To: Mark Brown
  Cc: Bard Liao, alsa-devel, subhransu.s.prusty, lgirdwood, mengdong.lin

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

On 2015/3/13 2:01, Mark Brown wrote:
> On Thu, Mar 12, 2015 at 08:42:55PM +0800, Jin, Yao wrote:
> 
>> 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.
> 
> 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.
> 

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

end of thread, other threads:[~2015-03-13  3:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11  3:48 [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card Jin Yao
2015-03-11 11:50 ` Mark Brown
2015-03-11 12:50 ` Mark Brown
2015-03-12  0:52   ` Jin, Yao
2015-03-12  2:38     ` Bard Liao
2015-03-12 12:42       ` Jin, Yao
2015-03-12 18:01         ` Mark Brown
2015-03-13  3:17           ` Jin, Yao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.