From: Damien Riegel <damien.riegel@savoirfairelinux.com> To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Patrick Lai <plai@codeaurora.org>, Banajit Goswami <bgoswami@codeaurora.org>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, kernel@savoirfairelinux.com, Damien Riegel <damien.riegel@savoirfairelinux.com> Subject: [PATCH v1 3/3] ASoC: qcom: apq8016-sbc: enable jack detection Date: Tue, 25 Jul 2017 13:51:26 -0400 [thread overview] Message-ID: <20170725175126.26578-4-damien.riegel@savoirfairelinux.com> (raw) In-Reply-To: <20170725175126.26578-1-damien.riegel@savoirfairelinux.com> Now that the pm8916 audio codec has support for jack detection, let the sound card driver use it. Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- sound/soc/qcom/apq8016_sbc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index d084d7468299..5f03f6249397 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -19,11 +19,14 @@ #include <linux/of.h> #include <linux/clk.h> #include <linux/platform_device.h> +#include <sound/jack.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> #include <dt-bindings/sound/apq8016-lpass.h> +#include "../codecs/msm8916-wcd-analog.h" + struct apq8016_sbc_data { void __iomem *mic_iomux; void __iomem *spkr_iomux; @@ -35,13 +38,26 @@ struct apq8016_sbc_data { #define MIC_CTRL_TLMM_SCLK_EN BIT(1) #define SPKR_CTL_PRI_WS_SLAVE_SEL_11 (BIT(17) | BIT(16)) +static struct snd_soc_jack apq8016_jack; + static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_card *card = rtd->card; + struct snd_soc_codec *codec = rtd->codec; struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card); int rval = 0; + if (!apq8016_jack.jack) { + rval = snd_soc_card_jack_new(card, "headset", + SND_JACK_MECHANICAL, + &apq8016_jack, NULL, 0); + if (rval) + return rval; + + pm8916_wcd_analog_jack_detect(codec, &apq8016_jack); + } + switch (cpu_dai->id) { case MI2S_PRIMARY: writel(readl(pdata->spkr_iomux) | SPKR_CTL_PRI_WS_SLAVE_SEL_11, -- 2.13.3
WARNING: multiple messages have this Message-ID (diff)
From: Damien Riegel <damien.riegel@savoirfairelinux.com> To: alsa-devel@alsa-project.org Cc: Banajit Goswami <bgoswami@codeaurora.org>, Liam Girdwood <lgirdwood@gmail.com>, Damien Riegel <damien.riegel@savoirfairelinux.com>, linux-kernel@vger.kernel.org, Patrick Lai <plai@codeaurora.org>, Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, kernel@savoirfairelinux.com Subject: [PATCH v1 3/3] ASoC: qcom: apq8016-sbc: enable jack detection Date: Tue, 25 Jul 2017 13:51:26 -0400 [thread overview] Message-ID: <20170725175126.26578-4-damien.riegel@savoirfairelinux.com> (raw) In-Reply-To: <20170725175126.26578-1-damien.riegel@savoirfairelinux.com> Now that the pm8916 audio codec has support for jack detection, let the sound card driver use it. Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- sound/soc/qcom/apq8016_sbc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index d084d7468299..5f03f6249397 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -19,11 +19,14 @@ #include <linux/of.h> #include <linux/clk.h> #include <linux/platform_device.h> +#include <sound/jack.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> #include <dt-bindings/sound/apq8016-lpass.h> +#include "../codecs/msm8916-wcd-analog.h" + struct apq8016_sbc_data { void __iomem *mic_iomux; void __iomem *spkr_iomux; @@ -35,13 +38,26 @@ struct apq8016_sbc_data { #define MIC_CTRL_TLMM_SCLK_EN BIT(1) #define SPKR_CTL_PRI_WS_SLAVE_SEL_11 (BIT(17) | BIT(16)) +static struct snd_soc_jack apq8016_jack; + static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_card *card = rtd->card; + struct snd_soc_codec *codec = rtd->codec; struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card); int rval = 0; + if (!apq8016_jack.jack) { + rval = snd_soc_card_jack_new(card, "headset", + SND_JACK_MECHANICAL, + &apq8016_jack, NULL, 0); + if (rval) + return rval; + + pm8916_wcd_analog_jack_detect(codec, &apq8016_jack); + } + switch (cpu_dai->id) { case MI2S_PRIMARY: writel(readl(pdata->spkr_iomux) | SPKR_CTL_PRI_WS_SLAVE_SEL_11, -- 2.13.3
next prev parent reply other threads:[~2017-07-25 17:53 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-07-25 17:51 [PATCH v1 0/3] add jack detection to MSM8916 analog Damien Riegel 2017-07-25 17:51 ` [PATCH v1 1/3] ASoC: codecs: msm8916-analog: fix DIG_CLK_CTL_RXD3_CLK_EN define Damien Riegel 2017-07-25 17:51 ` Damien Riegel 2017-07-25 19:27 ` Srinivas Kandagatla 2017-07-25 19:27 ` Srinivas Kandagatla 2017-07-27 19:02 ` Applied "ASoC: codecs: msm8916-analog: fix DIG_CLK_CTL_RXD3_CLK_EN define" to the asoc tree Mark Brown 2017-07-27 19:02 ` Mark Brown 2017-07-25 17:51 ` [PATCH v1 2/3] ASoC: codecs: msm8916-analog: support jack detection Damien Riegel 2017-07-25 17:51 ` Damien Riegel 2017-07-26 16:21 ` Mark Brown 2017-07-26 16:23 ` Mark Brown 2017-07-26 16:44 ` Srinivas Kandagatla 2017-07-26 16:44 ` Srinivas Kandagatla 2017-07-26 19:44 ` Damien Riegel 2017-07-25 17:51 ` Damien Riegel [this message] 2017-07-25 17:51 ` [PATCH v1 3/3] ASoC: qcom: apq8016-sbc: enable " Damien Riegel 2017-07-26 16:31 ` Srinivas Kandagatla
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=20170725175126.26578-4-damien.riegel@savoirfairelinux.com \ --to=damien.riegel@savoirfairelinux.com \ --cc=alsa-devel@alsa-project.org \ --cc=bgoswami@codeaurora.org \ --cc=broonie@kernel.org \ --cc=kernel@savoirfairelinux.com \ --cc=lgirdwood@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=perex@perex.cz \ --cc=plai@codeaurora.org \ --cc=srinivas.kandagatla@linaro.org \ --cc=tiwai@suse.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.