Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: simple-card: add 'hp-pin-name-headphone' property
@ 2025-12-29 11:18 Shengjiu Wang
  2025-12-29 11:18 ` [PATCH 1/2] ASoC: dt-bindings: " Shengjiu Wang
  2025-12-29 11:18 ` [PATCH 2/2] ASoC: simple-card-utils: Add support of "hp-pin-name-headphone" property Shengjiu Wang
  0 siblings, 2 replies; 6+ messages in thread
From: Shengjiu Wang @ 2025-12-29 11:18 UTC (permalink / raw)
  To: broonie, kuninori.morimoto.gx, lgirdwood, perex, tiwai,
	linux-sound, linux-kernel, robh, krzk+dt, conor+dt, devicetree

The 'Headphones Jack' name used in current simple-card and audio-graph
card driver can't be recognized by user space service daemon like
pulseaudio and pipewire, which only recognize the 'Headphone Jack',
so add 'hp-pin-name-headphone' property for this case and it won't block
original use cases for 'Headphones Jack'

Shengjiu Wang (2):
  ASoC: dt-bindings: simple-card: add 'hp-pin-name-headphone' property
  ASoC: simple-card-utils: Add support of "hp-pin-name-headphone"
    property

 .../bindings/sound/audio-graph-card2.yaml     |  3 +++
 .../bindings/sound/audio-graph.yaml           |  3 +++
 .../bindings/sound/simple-card.yaml           |  3 +++
 sound/soc/generic/simple-card-utils.c         | 22 +++++++++++++++++--
 4 files changed, 29 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] ASoC: dt-bindings: simple-card: add 'hp-pin-name-headphone' property
  2025-12-29 11:18 [PATCH 0/2] ASoC: simple-card: add 'hp-pin-name-headphone' property Shengjiu Wang
@ 2025-12-29 11:18 ` Shengjiu Wang
  2025-12-29 11:41   ` Krzysztof Kozlowski
  2025-12-29 11:18 ` [PATCH 2/2] ASoC: simple-card-utils: Add support of "hp-pin-name-headphone" property Shengjiu Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Shengjiu Wang @ 2025-12-29 11:18 UTC (permalink / raw)
  To: broonie, kuninori.morimoto.gx, lgirdwood, perex, tiwai,
	linux-sound, linux-kernel, robh, krzk+dt, conor+dt, devicetree

The 'Headphones Jack' name used in current simple-card and audio-graph
card driver can't be recognized by user space service daemon like
pulseaudio and pipewire, which only recognize the 'Headphone Jack',
so add 'hp-pin-name-headphone' property for this case and it won't block
original use cases for 'Headphones Jack'

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 Documentation/devicetree/bindings/sound/audio-graph-card2.yaml | 3 +++
 Documentation/devicetree/bindings/sound/audio-graph.yaml       | 3 +++
 Documentation/devicetree/bindings/sound/simple-card.yaml       | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml b/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
index 40eb1d7d6cf1..803e0a960d2e 100644
--- a/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
+++ b/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
@@ -39,6 +39,9 @@ properties:
     $ref: audio-graph.yaml#/properties/mic-det-gpios
   widgets:
     $ref: audio-graph.yaml#/properties/widgets
+  hp-pin-name-headphone:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Specify 'Headphone' as headphone pin name.
 
 required:
   - compatible
diff --git a/Documentation/devicetree/bindings/sound/audio-graph.yaml b/Documentation/devicetree/bindings/sound/audio-graph.yaml
index 9899d9d1958d..8cb2be122a6c 100644
--- a/Documentation/devicetree/bindings/sound/audio-graph.yaml
+++ b/Documentation/devicetree/bindings/sound/audio-graph.yaml
@@ -46,6 +46,9 @@ properties:
     maxItems: 1
   mic-det-gpios:
     maxItems: 1
+  hp-pin-name-headphone:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Specify 'Headphone' as headphone pin name.
 
 required:
   - dais
diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml
index 533d0a1da56e..9453089dc5f2 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.yaml
+++ b/Documentation/devicetree/bindings/sound/simple-card.yaml
@@ -271,6 +271,9 @@ patternProperties:
         maxItems: 1
       mic-det-gpios:
         maxItems: 1
+      hp-pin-name-headphone:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description: Specify 'Headphone' as headphone pin name.
 
     patternProperties:
       "^cpu(-[0-9]+)?$":
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] ASoC: simple-card-utils: Add support of "hp-pin-name-headphone" property
  2025-12-29 11:18 [PATCH 0/2] ASoC: simple-card: add 'hp-pin-name-headphone' property Shengjiu Wang
  2025-12-29 11:18 ` [PATCH 1/2] ASoC: dt-bindings: " Shengjiu Wang
@ 2025-12-29 11:18 ` Shengjiu Wang
  2025-12-29 11:43   ` Krzysztof Kozlowski
  2026-01-06  7:58   ` Shengjiu Wang
  1 sibling, 2 replies; 6+ messages in thread
From: Shengjiu Wang @ 2025-12-29 11:18 UTC (permalink / raw)
  To: broonie, kuninori.morimoto.gx, lgirdwood, perex, tiwai,
	linux-sound, linux-kernel, robh, krzk+dt, conor+dt, devicetree

The 'Headphones Jack' name used in current simple-card and audio-graph
card driver can't be recognized by user space service daemon like
pulseaudio and pipewire, which only recognize the 'Headphone Jack',
so add 'hp-pin-name-headphone' property for this case and it won't block
original use cases for 'Headphones Jack'

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/generic/simple-card-utils.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index bdc02e85b089..3d2194e23373 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -779,6 +779,24 @@ int simple_util_parse_pin_switches(struct snd_soc_card *card,
 }
 EXPORT_SYMBOL_GPL(simple_util_parse_pin_switches);
 
+static const char *simple_util_parse_hp_pin_name(struct snd_soc_card *card,
+						 char *prefix, char *pin)
+{
+	struct device_node *node = card->dev->of_node;
+	const char *str = NULL;
+	char prop[128];
+
+	if (!prefix)
+		prefix = "";
+
+	snprintf(prop, sizeof(prop), "%s%s", prefix, "hp-pin-name-headphone");
+
+	if (of_property_present(node, prop))
+		str = "Headphone";
+
+	return pin ? pin : (str ? str : "Headphones");
+}
+
 int simple_util_init_jack(struct snd_soc_card *card,
 			  struct simple_util_jack *sjack,
 			  int is_hp, char *prefix,
@@ -787,7 +805,7 @@ int simple_util_init_jack(struct snd_soc_card *card,
 	struct device *dev = card->dev;
 	struct gpio_desc *desc;
 	char prop[128];
-	char *pin_name;
+	const char *pin_name;
 	char *gpio_name;
 	int mask;
 	int error;
@@ -797,7 +815,7 @@ int simple_util_init_jack(struct snd_soc_card *card,
 
 	if (is_hp) {
 		snprintf(prop, sizeof(prop), "%shp-det", prefix);
-		pin_name	= pin ? pin : "Headphones";
+		pin_name = simple_util_parse_hp_pin_name(card, prefix, pin);
 		gpio_name	= "Headphone detection";
 		mask		= SND_JACK_HEADPHONE;
 	} else {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ASoC: dt-bindings: simple-card: add 'hp-pin-name-headphone' property
  2025-12-29 11:18 ` [PATCH 1/2] ASoC: dt-bindings: " Shengjiu Wang
@ 2025-12-29 11:41   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-29 11:41 UTC (permalink / raw)
  To: Shengjiu Wang, broonie, kuninori.morimoto.gx, lgirdwood, perex,
	tiwai, linux-sound, linux-kernel, robh, krzk+dt, conor+dt,
	devicetree

On 29/12/2025 12:18, Shengjiu Wang wrote:
> The 'Headphones Jack' name used in current simple-card and audio-graph
> card driver can't be recognized by user space service daemon like
> pulseaudio and pipewire, which only recognize the 'Headphone Jack',
> so add 'hp-pin-name-headphone' property for this case and it won't block
> original use cases for 'Headphones Jack'
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  Documentation/devicetree/bindings/sound/audio-graph-card2.yaml | 3 +++
>  Documentation/devicetree/bindings/sound/audio-graph.yaml       | 3 +++
>  Documentation/devicetree/bindings/sound/simple-card.yaml       | 3 +++
>  3 files changed, 9 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml b/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
> index 40eb1d7d6cf1..803e0a960d2e 100644
> --- a/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
> +++ b/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
> @@ -39,6 +39,9 @@ properties:
>      $ref: audio-graph.yaml#/properties/mic-det-gpios
>    widgets:
>      $ref: audio-graph.yaml#/properties/widgets
> +  hp-pin-name-headphone:
> +    $ref: /schemas/types.yaml#/definitions/flag
> +    description: Specify 'Headphone' as headphone pin name.

Not a DT property. You described ASoC drivers / core code, not hardware.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] ASoC: simple-card-utils: Add support of "hp-pin-name-headphone" property
  2025-12-29 11:18 ` [PATCH 2/2] ASoC: simple-card-utils: Add support of "hp-pin-name-headphone" property Shengjiu Wang
@ 2025-12-29 11:43   ` Krzysztof Kozlowski
  2026-01-06  7:58   ` Shengjiu Wang
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-29 11:43 UTC (permalink / raw)
  To: Shengjiu Wang, broonie, kuninori.morimoto.gx, lgirdwood, perex,
	tiwai, linux-sound, linux-kernel, robh, krzk+dt, conor+dt,
	devicetree

On 29/12/2025 12:18, Shengjiu Wang wrote:
> The 'Headphones Jack' name used in current simple-card and audio-graph
> card driver can't be recognized by user space service daemon like
> pulseaudio and pipewire, which only recognize the 'Headphone Jack',
> so add 'hp-pin-name-headphone' property for this case and it won't block
> original use cases for 'Headphones Jack'
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  sound/soc/generic/simple-card-utils.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
> index bdc02e85b089..3d2194e23373 100644
> --- a/sound/soc/generic/simple-card-utils.c
> +++ b/sound/soc/generic/simple-card-utils.c
> @@ -779,6 +779,24 @@ int simple_util_parse_pin_switches(struct snd_soc_card *card,
>  }
>  EXPORT_SYMBOL_GPL(simple_util_parse_pin_switches);
>  
> +static const char *simple_util_parse_hp_pin_name(struct snd_soc_card *card,
> +						 char *prefix, char *pin)
> +{
> +	struct device_node *node = card->dev->of_node;
> +	const char *str = NULL;
> +	char prop[128];
> +
> +	if (!prefix)
> +		prefix = "";
> +
> +	snprintf(prop, sizeof(prop), "%s%s", prefix, "hp-pin-name-headphone");
> +

That's different name than you defined in the bindings.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] ASoC: simple-card-utils: Add support of "hp-pin-name-headphone" property
  2025-12-29 11:18 ` [PATCH 2/2] ASoC: simple-card-utils: Add support of "hp-pin-name-headphone" property Shengjiu Wang
  2025-12-29 11:43   ` Krzysztof Kozlowski
@ 2026-01-06  7:58   ` Shengjiu Wang
  1 sibling, 0 replies; 6+ messages in thread
From: Shengjiu Wang @ 2026-01-06  7:58 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: broonie, kuninori.morimoto.gx, lgirdwood, perex, tiwai,
	linux-sound, linux-kernel, robh, krzk+dt, conor+dt, devicetree

On Mon, Dec 29, 2025 at 7:23 PM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> The 'Headphones Jack' name used in current simple-card and audio-graph
> card driver can't be recognized by user space service daemon like
> pulseaudio and pipewire, which only recognize the 'Headphone Jack',
> so add 'hp-pin-name-headphone' property for this case and it won't block
> original use cases for 'Headphones Jack'
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  sound/soc/generic/simple-card-utils.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
> index bdc02e85b089..3d2194e23373 100644
> --- a/sound/soc/generic/simple-card-utils.c
> +++ b/sound/soc/generic/simple-card-utils.c
> @@ -779,6 +779,24 @@ int simple_util_parse_pin_switches(struct snd_soc_card *card,
>  }
>  EXPORT_SYMBOL_GPL(simple_util_parse_pin_switches);
>
> +static const char *simple_util_parse_hp_pin_name(struct snd_soc_card *card,
> +                                                char *prefix, char *pin)
> +{
> +       struct device_node *node = card->dev->of_node;
> +       const char *str = NULL;
> +       char prop[128];
> +
> +       if (!prefix)
> +               prefix = "";
> +
> +       snprintf(prop, sizeof(prop), "%s%s", prefix, "hp-pin-name-headphone");
> +
> +       if (of_property_present(node, prop))
> +               str = "Headphone";
> +
> +       return pin ? pin : (str ? str : "Headphones");
> +}
> +
>  int simple_util_init_jack(struct snd_soc_card *card,
>                           struct simple_util_jack *sjack,
>                           int is_hp, char *prefix,
> @@ -787,7 +805,7 @@ int simple_util_init_jack(struct snd_soc_card *card,
>         struct device *dev = card->dev;
>         struct gpio_desc *desc;
>         char prop[128];
> -       char *pin_name;
> +       const char *pin_name;
>         char *gpio_name;
>         int mask;
>         int error;
> @@ -797,7 +815,7 @@ int simple_util_init_jack(struct snd_soc_card *card,
>
>         if (is_hp) {
>                 snprintf(prop, sizeof(prop), "%shp-det", prefix);
> -               pin_name        = pin ? pin : "Headphones";

If the DT binding is not a choice,  shall I change the "Headphones" to
"Headphone"
directly?  I don't know if this change will block any case?

    pin_name        = pin ? pin : "Headphone";

best regards
Shengjiu Wang

> +               pin_name = simple_util_parse_hp_pin_name(card, prefix, pin);
>                 gpio_name       = "Headphone detection";
>                 mask            = SND_JACK_HEADPHONE;
>         } else {
> --
> 2.34.1
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-06  7:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-29 11:18 [PATCH 0/2] ASoC: simple-card: add 'hp-pin-name-headphone' property Shengjiu Wang
2025-12-29 11:18 ` [PATCH 1/2] ASoC: dt-bindings: " Shengjiu Wang
2025-12-29 11:41   ` Krzysztof Kozlowski
2025-12-29 11:18 ` [PATCH 2/2] ASoC: simple-card-utils: Add support of "hp-pin-name-headphone" property Shengjiu Wang
2025-12-29 11:43   ` Krzysztof Kozlowski
2026-01-06  7:58   ` Shengjiu Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox