mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
To: alsa-devel@alsa-project.org
Cc: "Cezary Rojewski" <cezary.rojewski@intel.com>,
	"Alper Nebi Yasak" <alpernebiyasak@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Takashi Iwai" <tiwai@suse.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	linux-kernel@vger.kernel.org,
	"Akihiko Odaki" <akihiko.odaki@gmail.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Nícolas F . R . A . Prado" <nfraprado@collabora.com>
Subject: [PATCH 01/27] ASoC: amd: acp-da7219-max98357a: Map missing jack kcontrols
Date: Wed,  2 Aug 2023 20:57:11 +0300	[thread overview]
Message-ID: <20230802175737.263412-2-alpernebiyasak@gmail.com> (raw)
In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com>

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The DA7219 codec used
here can detect Headphones, Headset Mic and Line Out connections. Expose
each to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---

 sound/soc/amd/acp-da7219-max98357a.c | 41 +++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c
index 7464ca2b596c..9e3133bec2b1 100644
--- a/sound/soc/amd/acp-da7219-max98357a.c
+++ b/sound/soc/amd/acp-da7219-max98357a.c
@@ -28,6 +28,21 @@
 #define RT5682_PLL_FREQ (48000 * 512)
 
 static struct snd_soc_jack cz_jack;
+static struct snd_soc_jack_pin cz_jack_pins[] = {
+	{
+		.pin = "Headphone Jack",
+		.mask = SND_JACK_HEADPHONE,
+	},
+	{
+		.pin = "Headset Mic",
+		.mask = SND_JACK_MICROPHONE,
+	},
+	{
+		.pin = "Line Out",
+		.mask = SND_JACK_LINEOUT,
+	},
+};
+
 static struct clk *da7219_dai_wclk;
 static struct clk *da7219_dai_bclk;
 static struct clk *rt5682_dai_wclk;
@@ -66,11 +81,13 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 	if (IS_ERR(da7219_dai_bclk))
 		return PTR_ERR(da7219_dai_bclk);
 
-	ret = snd_soc_card_jack_new(card, "Headset Jack",
-				SND_JACK_HEADSET | SND_JACK_LINEOUT |
-				SND_JACK_BTN_0 | SND_JACK_BTN_1 |
-				SND_JACK_BTN_2 | SND_JACK_BTN_3,
-				&cz_jack);
+	ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
+					 SND_JACK_HEADSET | SND_JACK_LINEOUT |
+					 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+					 SND_JACK_BTN_2 | SND_JACK_BTN_3,
+					 &cz_jack,
+					 cz_jack_pins,
+					 ARRAY_SIZE(cz_jack_pins));
 	if (ret) {
 		dev_err(card->dev, "HP jack creation failed %d\n", ret);
 		return ret;
@@ -146,11 +163,13 @@ static int cz_rt5682_init(struct snd_soc_pcm_runtime *rtd)
 	if (IS_ERR(rt5682_dai_bclk))
 		return PTR_ERR(rt5682_dai_bclk);
 
-	ret = snd_soc_card_jack_new(card, "Headset Jack",
-				    SND_JACK_HEADSET | SND_JACK_LINEOUT |
-				    SND_JACK_BTN_0 | SND_JACK_BTN_1 |
-				    SND_JACK_BTN_2 | SND_JACK_BTN_3,
-				    &cz_jack);
+	ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
+					 SND_JACK_HEADSET | SND_JACK_LINEOUT |
+					 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+					 SND_JACK_BTN_2 | SND_JACK_BTN_3,
+					 &cz_jack,
+					 cz_jack_pins,
+					 ARRAY_SIZE(cz_jack_pins));
 	if (ret) {
 		dev_err(card->dev, "HP jack creation failed %d\n", ret);
 		return ret;
@@ -631,6 +650,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = {
 static const struct snd_soc_dapm_widget cz_widgets[] = {
 	SND_SOC_DAPM_HP("Headphones", NULL),
 	SND_SOC_DAPM_SPK("Speakers", NULL),
+	SND_SOC_DAPM_LINE("Line Out", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
 	SND_SOC_DAPM_MIC("Int Mic", NULL),
 };
@@ -654,6 +674,7 @@ static const struct snd_soc_dapm_route cz_rt5682_audio_route[] = {
 static const struct snd_kcontrol_new cz_mc_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphones"),
 	SOC_DAPM_PIN_SWITCH("Speakers"),
+	SOC_DAPM_PIN_SWITCH("Line Out"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
 	SOC_DAPM_PIN_SWITCH("Int Mic"),
 };
-- 
2.40.1


  reply	other threads:[~2023-08-02 17:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 17:57 [PATCH 00/27] ASoC: " Alper Nebi Yasak
2023-08-02 17:57 ` Alper Nebi Yasak [this message]
2023-08-02 17:57 ` [PATCH 02/27] ASoC: amd: acp-rt5645: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 03/27] ASoC: amd: acp: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 04/27] ASoC: amd: acp3x-rt5682-max9836: " Alper Nebi Yasak
2023-08-04  8:04   ` Akihiko Odaki
2023-08-04 13:11     ` Mark Brown
2023-08-04 13:19       ` Akihiko Odaki
2023-08-04 13:22         ` Mark Brown
2023-08-08  7:47   ` Akihiko Odaki
2023-08-08  7:49     ` Akihiko Odaki
2023-08-02 17:57 ` [PATCH 05/27] ASoC: Intel: avs: da7219: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 06/27] ASoC: Intel: bxt_da7219_max98357a: Map missing Line Out jack kcontrol Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 07/27] ASoC: Intel: bytcr_wm5102: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 08/27] ASoC: Intel: kbl_da7219_max98357a: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 09/27] ASoC: Intel: kbl_da7219_max98927: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 10/27] ASoC: Intel: sof_da7219_max98373: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 11/27] ASoC: imx-es8328: Map missing jack kcontrols Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 12/27] ASoC: mediatek: mt8173-max98090: Configure jack as a Headset jack Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 13/27] ASoC: mediatek: mt8173-rt5650-rt5514: Map missing jack kcontrols Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 14/27] ASoC: mediatek: mt8173-rt5650-rt5676: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 15/27] ASoC: mediatek: mt8173-rt5650: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 16/27] ASoC: mediatek: mt8183-da7219-max98357: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 17/27] ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 18/27] ASoC: mediatek: mt8186-mt6366-da7219-max98357: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 19/27] ASoC: qcom: apq8016_sbc: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 20/27] ASoC: qcom: sc7180: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 21/27] ASoC: qcom: sc7280: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 22/27] ASoC: qcom: sdm845: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 23/27] ASoC: rk3399-gru-sound: Map missing Line Out jack kcontrol Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 24/27] ASoC: rockchip: rockchip_rt5645: Map missing jack kcontrols Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 25/27] ASoC: samsung: littlemill: " Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 26/27] ASoC: samsung: lowland: Split Line Out jack kcontrol from Headphone Alper Nebi Yasak
2023-08-02 17:57 ` [PATCH 27/27] ASoC: samsung: midas_wm1811: Map missing jack kcontrols Alper Nebi Yasak
2023-08-07 19:54 ` [PATCH 00/27] ASoC: " 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=20230802175737.263412-2-alpernebiyasak@gmail.com \
    --to=alpernebiyasak@gmail.com \
    --cc=akihiko.odaki@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nfraprado@collabora.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --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: 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

all inboxes | Powered by JetHome®