summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel
diff options
context:
space:
mode:
authorJin Yao <yao.jin@linux.intel.com>2015-03-17 03:23:31 +0100
committerMark Brown <broonie@kernel.org>2015-03-17 13:17:13 +0100
commit6b3b58d97fb2d03f8f1d009a77baece311aa0d16 (patch)
tree7a91cdb8649abea683e0fcbd81fb3cd835cb4295 /sound/soc/intel
parentASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card (diff)
downloadlinux-6b3b58d97fb2d03f8f1d009a77baece311aa0d16.tar.xz
linux-6b3b58d97fb2d03f8f1d009a77baece311aa0d16.zip
ASoC: Intel: move the jack creation to Braswell machine driver
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> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel')
-rw-r--r--sound/soc/intel/cht_bsw_rt5672.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index c41fae3eb9ca..4204fc4f1bad 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;
}