Message ID | 20220301123742.72146-2-stephan@gerhold.net |
---|---|
State | New |
Headers | show |
Series | ASoC: codecs: Add Awinic AW8738 audio amplifier driver | expand |
On Tue, Mar 01, 2022 at 01:37:41PM +0100, Stephan Gerhold wrote: > + awinic,mode: > + description: Amplifier mode (number of pulses for one-wire pulse control) > + $ref: /schemas/types.yaml#/definitions/uint32 > + minimum: 1 No maximum? > + sound-name-prefix: true While it's very likely that someone will want to use this it shouldn't be *mandatory* that they do so, there may be no other controls for it to collide with (eg, if none of the other components in the audio path have controls).
On Tue, Mar 01, 2022 at 01:36:33PM +0000, Mark Brown wrote: > On Tue, Mar 01, 2022 at 01:37:41PM +0100, Stephan Gerhold wrote: > > > + awinic,mode: > > + description: Amplifier mode (number of pulses for one-wire pulse control) > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + minimum: 1 > > No maximum? > I wasn't sure if we really want to maintain maxima for several different Awinic part numbers here. For the AW8738 the maximum is 7, for the AW87318 (note the additional 1 in the name) it would be 10. The driver part would be identical for both. ... But it's probably cleaner to have the schema check for the real maximum of the selected compatible. I will add a "maximum" in v2. > > + sound-name-prefix: true > > While it's very likely that someone will want to use this it shouldn't > be *mandatory* that they do so, there may be no other controls for it to > collide with (eg, if none of the other components in the audio path have > controls). This line just enables the "sound-name-prefix" from the included name-prefix.yaml. It's not listed in "required" so it's actually already optional. Thanks! Stephan
On Tue, Mar 01, 2022 at 02:54:06PM +0100, Stephan Gerhold wrote: > On Tue, Mar 01, 2022 at 01:36:33PM +0000, Mark Brown wrote: > > On Tue, Mar 01, 2022 at 01:37:41PM +0100, Stephan Gerhold wrote: > > > + awinic,mode: > > > + description: Amplifier mode (number of pulses for one-wire pulse control) > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > + minimum: 1 > > No maximum? > I wasn't sure if we really want to maintain maxima for several different > Awinic part numbers here. For the AW8738 the maximum is 7, for the > AW87318 (note the additional 1 in the name) it would be 10. The driver > part would be identical for both. > ... But it's probably cleaner to have the schema check for the real > maximum of the selected compatible. I will add a "maximum" in v2. Even if it's just a maximum for any of the supported chips it'd still be something. > > > + sound-name-prefix: true > > While it's very likely that someone will want to use this it shouldn't > > be *mandatory* that they do so, there may be no other controls for it to > > collide with (eg, if none of the other components in the audio path have > > controls). > This line just enables the "sound-name-prefix" from the included > name-prefix.yaml. It's not listed in "required" so it's actually > already optional. Of, that's a really confusing way of importing things.
On Tue, Mar 01, 2022 at 01:37:41PM +0100, Stephan Gerhold wrote: > Add a DT schema for describing Awinic AW8738 audio amplifiers. They are > fairly simple and controlled using a single GPIO. The number of pulses > during power up selects one of a few pre-defined amplifier modes. > > Signed-off-by: Stephan Gerhold <stephan@gerhold.net> > --- > .../bindings/sound/awinic,aw8738.yaml | 48 +++++++++++++++++++ > 1 file changed, 48 insertions(+) > create mode 100644 Documentation/devicetree/bindings/sound/awinic,aw8738.yaml Reviewed-by: Rob Herring <robh@kernel.org>
diff --git a/Documentation/devicetree/bindings/sound/awinic,aw8738.yaml b/Documentation/devicetree/bindings/sound/awinic,aw8738.yaml new file mode 100644 index 000000000000..83934a835fd7 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/awinic,aw8738.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/awinic,aw8738.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Awinic AW8738 Audio Amplifier + +maintainers: + - Stephan Gerhold <stephan@gerhold.net> + +description: + The Awinic AW8738 is a simple audio amplifier using + one-wire pulse control to set the amplifier mode. + +allOf: + - $ref: name-prefix.yaml# + +properties: + compatible: + const: awinic,aw8738 + + enable-gpios: + maxItems: 1 + + awinic,mode: + description: Amplifier mode (number of pulses for one-wire pulse control) + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + + sound-name-prefix: true + +required: + - compatible + - enable-gpios + - awinic,mode + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + audio-amplifier { + compatible = "awinic,aw8738"; + enable-gpios = <&msmgpio 114 GPIO_ACTIVE_HIGH>; + awinic,mode = <5>; + sound-name-prefix = "Speaker Amp"; + };
Add a DT schema for describing Awinic AW8738 audio amplifiers. They are fairly simple and controlled using a single GPIO. The number of pulses during power up selects one of a few pre-defined amplifier modes. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> --- .../bindings/sound/awinic,aw8738.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/awinic,aw8738.yaml