diff mbox series

[2/4] ASoC: dt-bindings: qcom: sm8250: Document "pin-switches" and "widgets"

Message ID 20211214142049.20422-3-stephan@gerhold.net
State Accepted
Commit 37a49da9a7d5ac1f7128000de42ff222da46ba7a
Headers show
Series ASoC: qcom: Parse "pin-switches" and "widgets" from DT | expand

Commit Message

Stephan Gerhold Dec. 14, 2021, 2:20 p.m. UTC
Some sound card setups might require extra pin switches to allow
turning off certain audio components. There are two real examples for
this in smartphones/tablets based on MSM8916:

  1. Analog speaker amplifiers connected to headphone outputs.

     The MSM8916 analog codec does not have a separate "Line Out" port
     so some devices have an analog speaker amplifier connected to one
     of the headphone outputs. A pin switch is necessary to allow
     playback on headphones without also activating the speaker.

  2. External speaker codec also used as earpiece.

     Some smartphones have two front-facing (stereo) speakers that can
     be also configured to act as an earpiece during voice calls. A pin
     switch is needed to allow disabling the second speaker during
     voice calls.

There are existing bindings that allow setting up such pin switches in
simple-card.yaml. Document the same for Qcom sound cards.

One variant of example 1 above is added to the examples in the DT
schema: There is an analog speaker amplifier connected to the HPH_R
(right headphone channel) output. Adding a "Speaker" pin switch and
widget allows turning off the speaker when audio should be only played
via the connected headphones.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 .../devicetree/bindings/sound/qcom,sm8250.yaml   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Rob Herring (Arm) Dec. 16, 2021, 6:02 p.m. UTC | #1
On Tue, Dec 14, 2021 at 03:20:47PM +0100, Stephan Gerhold wrote:
> Some sound card setups might require extra pin switches to allow
> turning off certain audio components. There are two real examples for
> this in smartphones/tablets based on MSM8916:
> 
>   1. Analog speaker amplifiers connected to headphone outputs.
> 
>      The MSM8916 analog codec does not have a separate "Line Out" port
>      so some devices have an analog speaker amplifier connected to one
>      of the headphone outputs. A pin switch is necessary to allow
>      playback on headphones without also activating the speaker.
> 
>   2. External speaker codec also used as earpiece.
> 
>      Some smartphones have two front-facing (stereo) speakers that can
>      be also configured to act as an earpiece during voice calls. A pin
>      switch is needed to allow disabling the second speaker during
>      voice calls.

This all makes sense, but how that translates to the DT properties I 
don't have a clue.

> There are existing bindings that allow setting up such pin switches in
> simple-card.yaml. Document the same for Qcom sound cards.

And that description is equally as bad.

> One variant of example 1 above is added to the examples in the DT
> schema: There is an analog speaker amplifier connected to the HPH_R
> (right headphone channel) output. Adding a "Speaker" pin switch and
> widget allows turning off the speaker when audio should be only played
> via the connected headphones.
> 
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>  .../devicetree/bindings/sound/qcom,sm8250.yaml   | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

But nothing new here really, so

Acked-by: Rob Herring <robh@kernel.org>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
index e50964c54bb9..4bfda04b4608 100644
--- a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
@@ -39,6 +39,14 @@  properties:
     $ref: /schemas/types.yaml#/definitions/string
     description: User visible long sound card name
 
+  pin-switches:
+    description: List of widget names for which pin switches should be created.
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+  widgets:
+    description: User specified audio sound widgets.
+    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
+
   # Only valid for some compatibles (see allOf if below)
   reg: true
   reg-names: true
@@ -251,7 +259,15 @@  examples:
         reg-names = "mic-iomux", "spkr-iomux";
 
         model = "msm8916";
+        widgets =
+            "Speaker", "Speaker",
+            "Headphone", "Headphones";
+        pin-switches = "Speaker";
         audio-routing =
+            "Speaker", "Speaker Amp OUT",
+            "Speaker Amp IN", "HPH_R",
+            "Headphones", "HPH_L",
+            "Headphones", "HPH_R",
             "AMIC1", "MIC BIAS Internal1",
             "AMIC2", "MIC BIAS Internal2",
             "AMIC3", "MIC BIAS Internal3";