Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: Intel: fixup patches for Braswell machine driver
@ 2015-03-17  2:23 Jin Yao
  2015-03-17  2:23 ` [PATCH 1/2] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card Jin Yao
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jin Yao @ 2015-03-17  2:23 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, yao.jin, bardliao

Hi Mark,

These are Braswell machine driver fixup patches.

Jin Yao (2):
  1) ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2) ASoC: Intel: move the jack creation to Braswell machine driver

For 1), it requires following dependency patches to build:
     ASoC: rt5670: Add IRQ function
     ASoC: rt5670: export jack suspend/resume APIs

For 2), it requires following dependency patch to build:
     ASoC: Allow to register jacks at the card level

These dependency patches have been integrated in for-next branch but not in
intel branch.

Thanks
Jin Yao

 sound/soc/intel/cht_bsw_rt5672.c | 55 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

-- 
1.9.1

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

* [PATCH 1/2] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
  2015-03-17  2:23 [PATCH 0/2] ASoC: Intel: fixup patches for Braswell machine driver Jin Yao
@ 2015-03-17  2:23 ` Jin Yao
  2015-03-17  2:23 ` [PATCH 2/2] ASoC: Intel: move the jack creation to Braswell machine driver Jin Yao
  2015-03-17 12:17 ` [PATCH 0/2] ASoC: Intel: fixup patches for " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Jin Yao @ 2015-03-17  2:23 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] 4+ messages in thread

* [PATCH 2/2] ASoC: Intel: move the jack creation to Braswell machine driver
  2015-03-17  2:23 [PATCH 0/2] ASoC: Intel: fixup patches for Braswell machine driver Jin Yao
  2015-03-17  2:23 ` [PATCH 1/2] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card Jin Yao
@ 2015-03-17  2:23 ` Jin Yao
  2015-03-17 12:17 ` [PATCH 0/2] ASoC: Intel: fixup patches for " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Jin Yao @ 2015-03-17  2:23 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, yao.jin, bardliao

The jack creation code was in rt5670 codec driver before due to the
jack resources (gpio/irq) were defined under the node of codec device
in ACPI on Braswell. We used the snd_soc_jack_new() to create a jack
instance.

But now snd_soc_jack_new() is removed from upstream and we can't
use snd_soc_card_jack_new() in codec driver, so we move the jack
creation code to machine driver and pass the jack instance to codec
driver for further processing.

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

diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index c41fae3..4204fc4 100644
--- a/sound/soc/intel/cht_bsw_rt5672.c
+++ b/sound/soc/intel/cht_bsw_rt5672.c
@@ -22,6 +22,7 @@
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
+#include <sound/jack.h>
 #include "../codecs/rt5670.h"
 #include "sst-atom-controls.h"
 
@@ -29,6 +30,20 @@
 #define CHT_PLAT_CLK_3_HZ	19200000
 #define CHT_CODEC_DAI	"rt5670-aif1"
 
+static struct snd_soc_jack cht_bsw_headset;
+
+/* Headset jack detection DAPM pins */
+static struct snd_soc_jack_pin cht_bsw_headset_pins[] = {
+	{
+		.pin = "Headset Mic",
+		.mask = SND_JACK_MICROPHONE,
+	},
+	{
+		.pin = "Headphone",
+		.mask = SND_JACK_HEADPHONE,
+	},
+};
+
 static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card)
 {
 	int i;
@@ -178,6 +193,15 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 				| RT5670_AD_MONO_L_FILTER
 				| RT5670_AD_MONO_R_FILTER,
 				RT5670_CLK_SEL_I2S1_ASRC);
+
+        ret = snd_soc_card_jack_new(runtime->card, "Headset",
+                SND_JACK_HEADSET | SND_JACK_BTN_0 |
+                SND_JACK_BTN_1 | SND_JACK_BTN_2, &cht_bsw_headset,
+                cht_bsw_headset_pins, ARRAY_SIZE(cht_bsw_headset_pins));
+        if (ret)
+                return ret;
+
+	rt5670_set_jack_detect(codec, &cht_bsw_headset);
 	return 0;
 }
 
-- 
1.9.1

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

* Re: [PATCH 0/2] ASoC: Intel: fixup patches for Braswell machine driver
  2015-03-17  2:23 [PATCH 0/2] ASoC: Intel: fixup patches for Braswell machine driver Jin Yao
  2015-03-17  2:23 ` [PATCH 1/2] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card Jin Yao
  2015-03-17  2:23 ` [PATCH 2/2] ASoC: Intel: move the jack creation to Braswell machine driver Jin Yao
@ 2015-03-17 12:17 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2015-03-17 12:17 UTC (permalink / raw)
  To: Jin Yao; +Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, lgirdwood, bardliao


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

On Tue, Mar 17, 2015 at 10:23:29AM +0800, Jin Yao wrote:
> Hi Mark,
> 
> These are Braswell machine driver fixup patches.

Applied both, 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] 4+ messages in thread

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-17  2:23 [PATCH 0/2] ASoC: Intel: fixup patches for Braswell machine driver Jin Yao
2015-03-17  2:23 ` [PATCH 1/2] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card Jin Yao
2015-03-17  2:23 ` [PATCH 2/2] ASoC: Intel: move the jack creation to Braswell machine driver Jin Yao
2015-03-17 12:17 ` [PATCH 0/2] ASoC: Intel: fixup patches for " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox