[RESEND,v2,1/5] dt-bindings: sound: Add jack-type property to sun8i-a33-codec

Message ID 20240224135501.3822390-2-megi@xff.cz
State New
Headers
Series Add support for jack detection to codec present in A64 SoC |

Commit Message

Ondřej Jirman Feb. 24, 2024, 1:54 p.m. UTC
  From: Ondrej Jirman <megi@xff.cz>

The codec driver needs to know what jack connector it is connected to
on the board. Add proprty to describe the type of connector.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 .../bindings/sound/allwinner,sun8i-a33-codec.yaml        | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Rob Herring Feb. 26, 2024, 7:47 p.m. UTC | #1
On Sat, Feb 24, 2024 at 02:54:54PM +0100, Ondřej Jirman wrote:
> From: Ondrej Jirman <megi@xff.cz>
> 
> The codec driver needs to know what jack connector it is connected to
> on the board. Add proprty to describe the type of connector.
> 
> Signed-off-by: Ondrej Jirman <megi@xff.cz>
> ---
>  .../bindings/sound/allwinner,sun8i-a33-codec.yaml        | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> index 63eadc4200ac..399fc00ad3f4 100644
> --- a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> +++ b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> @@ -44,6 +44,15 @@ properties:
>        - const: bus
>        - const: mod
>  
> +  jack-type:

I'm all for a generic property name, but it needs to be documented 
somewhere common. Perhaps dai-common.yaml.

I'm sure there is some prior art here to consider as well.

Rob
  
Ondřej Jirman Feb. 26, 2024, 11:57 p.m. UTC | #2
On Mon, Feb 26, 2024 at 01:47:27PM -0600, Rob Herring wrote:
> On Sat, Feb 24, 2024 at 02:54:54PM +0100, Ondřej Jirman wrote:
> > From: Ondrej Jirman <megi@xff.cz>
> > 
> > The codec driver needs to know what jack connector it is connected to
> > on the board. Add proprty to describe the type of connector.
> > 
> > Signed-off-by: Ondrej Jirman <megi@xff.cz>
> > ---
> >  .../bindings/sound/allwinner,sun8i-a33-codec.yaml        | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> > index 63eadc4200ac..399fc00ad3f4 100644
> > --- a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> > +++ b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> > @@ -44,6 +44,15 @@ properties:
> >        - const: bus
> >        - const: mod
> >  
> > +  jack-type:
> 
> I'm all for a generic property name, but it needs to be documented 
> somewhere common. Perhaps dai-common.yaml.
> 
> I'm sure there is some prior art here to consider as well.

There's only a mention in the code. But there's no use of similar property
on the codec nodes.

https://elixir.bootlin.com/linux/latest/source/sound/soc/soc-component.c#L288

/**
 * snd_soc_component_get_jack_type
 * @component: COMPONENTs
 *
 * Returns the jack type of the component
 * This can either be the supported type or one read from
 * devicetree with the property: jack-type.
 */

This is part of a component, so maybe in sound/component-common.yaml ?

Kind regards,
	o.

> Rob
  
Rob Herring March 1, 2024, 9:36 p.m. UTC | #3
On Tue, Feb 27, 2024 at 12:57:08AM +0100, Ondřej Jirman wrote:
> On Mon, Feb 26, 2024 at 01:47:27PM -0600, Rob Herring wrote:
> > On Sat, Feb 24, 2024 at 02:54:54PM +0100, Ondřej Jirman wrote:
> > > From: Ondrej Jirman <megi@xff.cz>
> > > 
> > > The codec driver needs to know what jack connector it is connected to
> > > on the board. Add proprty to describe the type of connector.
> > > 
> > > Signed-off-by: Ondrej Jirman <megi@xff.cz>
> > > ---
> > >  .../bindings/sound/allwinner,sun8i-a33-codec.yaml        | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> > > index 63eadc4200ac..399fc00ad3f4 100644
> > > --- a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> > > +++ b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
> > > @@ -44,6 +44,15 @@ properties:
> > >        - const: bus
> > >        - const: mod
> > >  
> > > +  jack-type:
> > 
> > I'm all for a generic property name, but it needs to be documented 
> > somewhere common. Perhaps dai-common.yaml.
> > 
> > I'm sure there is some prior art here to consider as well.
> 
> There's only a mention in the code. But there's no use of similar property
> on the codec nodes.
> 
> https://elixir.bootlin.com/linux/latest/source/sound/soc/soc-component.c#L288

git grep 'jack' Documentation/devicetree/bindings/sound

There's lots of things related to jack. I don't see type, but I didn't 
go looking for 'mic' or 'headphone' or 'headset' or ...

> 
> /**
>  * snd_soc_component_get_jack_type
>  * @component: COMPONENTs
>  *
>  * Returns the jack type of the component
>  * This can either be the supported type or one read from
>  * devicetree with the property: jack-type.
>  */
> 
> This is part of a component, so maybe in sound/component-common.yaml ?

A comment with no other usage I can find doesn't make it documented.

Rob
  

Patch

diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
index 63eadc4200ac..399fc00ad3f4 100644
--- a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
@@ -44,6 +44,15 @@  properties:
       - const: bus
       - const: mod
 
+  jack-type:
+    enum:
+      - headset
+      - headphone
+    description:
+      Type of jack connector connected to the codec. This can be either
+      a 3-pin headphone connector or 4-pin headset connector. If not
+      specified, jack detection is disabled.
+
 required:
   - "#sound-dai-cells"
   - compatible