Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jin Yao <yao.jin@linux.intel.com>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: mengdong.lin@intel.com, alsa-devel@alsa-project.org,
	subhransu.s.prusty@intel.com, yao.jin@linux.intel.com,
	bardliao@realtek.com
Subject: [PATCH 2/2] ASoC: Intel: move the jack creation to Braswell machine driver
Date: Tue, 17 Mar 2015 10:23:31 +0800	[thread overview]
Message-ID: <1426559011-8499-3-git-send-email-yao.jin@linux.intel.com> (raw)
In-Reply-To: <1426559011-8499-1-git-send-email-yao.jin@linux.intel.com>

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

  parent reply	other threads:[~2015-03-17  2:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-03-17 12:17 ` [PATCH 0/2] ASoC: Intel: fixup patches for Braswell machine driver Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426559011-8499-3-git-send-email-yao.jin@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bardliao@realtek.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=mengdong.lin@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox