public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Chancel Liu <chancel.liu@nxp•com>
To: broonie@kernel•org, lgirdwood@gmail•com, robh@kernel•org,
	krzk+dt@kernel•org, conor+dt@kernel•org
Cc: shengjiu.wang@nxp•com, shengjiu.wang@gmail•com,
	Xiubo.Lee@gmail•com, festevam@gmail•com, nicoleotsuka@gmail•com,
	perex@perex•cz, tiwai@suse•com, Frank.Li@nxp•com,
	s.hauer@pengutronix•de, linux-sound@vger•kernel.org,
	devicetree@vger•kernel.org, linux-arm-kernel@lists•infradead.org,
	imx@lists•linux.dev, linux-kernel@vger•kernel.org
Subject: [PATCH v2 2/3] ASoC: imx-rpmsg: Support headphone jack detection
Date: Thu, 28 May 2026 11:07:24 +0900	[thread overview]
Message-ID: <20260528020725.2265321-3-chancel.liu@nxp.com> (raw)
In-Reply-To: <20260528020725.2265321-1-chancel.liu@nxp.com>

Add headphone jack detection support for i.MX RPMSG audio cards.
When the "hp-det-gpios" property is present in the device tree node,
use simple_util_init_jack() from the ASoC simple card utilities to
register a headphone jack with GPIO-based insertion detection.

Signed-off-by: Chancel Liu <chancel.liu@nxp•com>
---
 sound/soc/fsl/Kconfig     |  1 +
 sound/soc/fsl/imx-rpmsg.c | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index ae8774e11873..8ae59c094878 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -358,6 +358,7 @@ config SND_SOC_IMX_RPMSG
 	depends on OF && I2C
 	select SND_SOC_IMX_PCM_RPMSG
 	select SND_SOC_IMX_AUDIO_RPMSG
+	select SND_SIMPLE_CARD_UTILS
 	help
 	  SoC Audio support for i.MX boards with rpmsg.
 	  There should be rpmsg devices defined in other core (M core)
diff --git a/sound/soc/fsl/imx-rpmsg.c b/sound/soc/fsl/imx-rpmsg.c
index fd4624786b62..48fe471499ba 100644
--- a/sound/soc/fsl/imx-rpmsg.c
+++ b/sound/soc/fsl/imx-rpmsg.c
@@ -12,6 +12,7 @@
 #include <sound/control.h>
 #include <sound/pcm_params.h>
 #include <sound/soc-dapm.h>
+#include <sound/simple_card_utils.h>
 #include "imx-pcm-rpmsg.h"
 
 struct imx_rpmsg {
@@ -19,6 +20,7 @@ struct imx_rpmsg {
 	struct snd_soc_card card;
 	unsigned long sysclk;
 	bool lpa;
+	struct simple_util_jack hp_jack;
 };
 
 static struct dev_pm_ops lpa_pm;
@@ -86,6 +88,15 @@ static int imx_rpmsg_late_probe(struct snd_soc_card *card)
 	struct device *dev = card->dev;
 	int ret;
 
+	if (of_property_present(card->dev->of_node, "hp-det-gpios")) {
+		ret = simple_util_init_jack(card, &data->hp_jack,
+					    1, NULL, "Headphone Jack");
+		if (ret) {
+			dev_err(dev, "failed to init hp jack\n");
+			return ret;
+		}
+	}
+
 	if (data->lpa) {
 		struct device_node *codec_np;
 		struct device_driver *codec_drv;
-- 
2.50.1



  parent reply	other threads:[~2026-05-28  2:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  5:38 [PATCH 0/3] ASoC: imx-rpmsg: Add headphone jack detection and driver_name support Chancel Liu
2026-05-26  5:38 ` [PATCH 1/3] ASoC: dt-bindings: fsl,rpmsg: Add hp-det-gpios property Chancel Liu
2026-05-26  5:38 ` [PATCH 2/3] ASoC: imx-rpmsg: Support headphone jack detection Chancel Liu
2026-05-26 15:34   ` Mark Brown
2026-05-27  3:05     ` Chancel Liu (OSS)
2026-05-26  5:38 ` [PATCH 3/3] ASoC: imx-rpmsg: Set driver_name for snd_soc_card Chancel Liu
2026-05-28  2:07 ` [PATCH v2 0/3] ASoC: imx-rpmsg: Add headphone jack detection and driver_name support Chancel Liu
2026-05-28  2:07   ` [PATCH v2 1/3] ASoC: dt-bindings: fsl,rpmsg: Add hp-det-gpios property Chancel Liu
2026-05-28  2:07   ` Chancel Liu [this message]
2026-05-28  2:07   ` [PATCH v2 3/3] ASoC: imx-rpmsg: Set driver_name for snd_soc_card Chancel Liu
2026-05-28 14:12   ` [PATCH v2 0/3] ASoC: imx-rpmsg: Add headphone jack detection and driver_name support Andrew Lunn
2026-05-28 14:18     ` Mark Brown
2026-05-28 14:41       ` Andrew Lunn

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=20260528020725.2265321-3-chancel.liu@nxp.com \
    --to=chancel.liu@nxp$(echo .)com \
    --cc=Frank.Li@nxp$(echo .)com \
    --cc=Xiubo.Lee@gmail$(echo .)com \
    --cc=broonie@kernel$(echo .)org \
    --cc=conor+dt@kernel$(echo .)org \
    --cc=devicetree@vger$(echo .)kernel.org \
    --cc=festevam@gmail$(echo .)com \
    --cc=imx@lists$(echo .)linux.dev \
    --cc=krzk+dt@kernel$(echo .)org \
    --cc=lgirdwood@gmail$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-sound@vger$(echo .)kernel.org \
    --cc=nicoleotsuka@gmail$(echo .)com \
    --cc=perex@perex$(echo .)cz \
    --cc=robh@kernel$(echo .)org \
    --cc=s.hauer@pengutronix$(echo .)de \
    --cc=shengjiu.wang@gmail$(echo .)com \
    --cc=shengjiu.wang@nxp$(echo .)com \
    --cc=tiwai@suse$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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