ASoC: imx-rpmsg: Add headphone jack detection and driver_name support

Chancel Liu <chancel.liu@nxp.com> says:

This series adds two features to the i.MX RPMSG ASoC card:
1. Headphone jack detection via GPIO: Introduce the "hp-det-gpios"
   device tree property and use simple_util_init_jack() to
   register a headphone jack with GPIO-based insertion detection.

2. driver_name assignment: Set driver_name on the snd_soc_card to
   "imx-audio-rpmsg", enabling userspace tools such as UCM to reliably
   identify the card by driver name regardless of the board-specific
   card name.

Link: https://patch.msgid.link/20260528020725.2265321-1-chancel.liu@nxp.com
This commit is contained in:
Mark Brown 2026-06-08 18:53:24 +01:00
commit 0f2dfa4096
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
3 changed files with 17 additions and 0 deletions

View File

@ -98,6 +98,10 @@ properties:
- rpmsg-audio-channel
- rpmsg-micfil-channel
hp-det-gpios:
maxItems: 1
description: The GPIO that detect headphones are plugged in
required:
- compatible

View File

@ -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)

View File

@ -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;
@ -239,6 +250,7 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
data->card.dapm_widgets = imx_rpmsg_dapm_widgets;
data->card.num_dapm_widgets = ARRAY_SIZE(imx_rpmsg_dapm_widgets);
data->card.late_probe = imx_rpmsg_late_probe;
data->card.driver_name = "imx-audio-rpmsg";
/*
* Inoder to use common api to get card name and audio routing.
* Use parent of_node for this device, revert it after finishing using