Message ID | 20230509163828.86003-1-povik+lin@cutebit.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3027127vqo; Tue, 9 May 2023 09:48:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Sdw8QLzsQn8CLlJ3AnVXijGRiVShg8v5sJ+CgC4CAvmCycljxl/D3MUhVt2/99iMB72ZM X-Received: by 2002:a17:902:a609:b0:1ac:946e:4690 with SMTP id u9-20020a170902a60900b001ac946e4690mr3256272plq.49.1683650894708; Tue, 09 May 2023 09:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683650894; cv=none; d=google.com; s=arc-20160816; b=MQhStew6fv9nsWMUHFFp91QEg/8geTVoP/7CZOXwCj1uiTUYZHtV0rQsLhDrZZIdid sJdDZR4mqiSlcZRcFLezK+vxk/3NWl4ChqVgyyz+XmxRA1Zu4AiBGTPlUrnmmC1S4OQO x3s9F5SuFeTghTBL/XZRXqGIQ0k1RoCwaSAqx16jhT6Uoa5AeuW8vFxo0nFKNtOHTP6S ysHZ2HF8/5PHMlaBF2tKV+bhE5d2E5DCHR8BNlhq5Um1U1XPkjstsb6lv8GouyduYsub wN7DIWmfCBcRh11fQJ71sHQ0aBVbbVDBXxEgQdIW4fVO2YcyZ6cr8Ut1+QiqemJSxSHH Ut0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:dkim-signature:from; bh=ABTxy/stFVOVt1ZnRJ5L55xUikl5p+QPvUWPKUSFmjk=; b=NZ/TZQWc7/MT+WmyxCwj3hd/TCcmGk0XoyzkolGoFH9QeDkaiJ/W72pl9QUkMAD8wv u6PnreXynzFhsF7wbkxiYE7jvZRdrDR/lQTT5hS6XI7RneQVeTHXjfR/madVdgYZodVO Q+K0zT6vO0exj3lybri/JMfKF55o7ngHF8L0TnfNHo2tEmvcJWndWkjP/liiOZhMr+LJ Wmyg04NWsCKJUniBRLIOsSbAUVh2sqaYqx9vBHz0YPBdKlN3nqmwv0BYjviiTcz26H/L E1GimPvknH1VQhn2ZwQyvBwNOeXWR9S8yZwKVHAFU0RKWEhLCabmui8XGmN1I6HqWPxf O0Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b=nhq0S7wC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cutebit.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r3-20020a170902be0300b0019c93e0dce0si1836026pls.254.2023.05.09.09.48.01; Tue, 09 May 2023 09:48:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b=nhq0S7wC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cutebit.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233913AbjEIQji (ORCPT <rfc822;baris.duru.linux@gmail.com> + 99 others); Tue, 9 May 2023 12:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233784AbjEIQjQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 9 May 2023 12:39:16 -0400 Received: from hutie.ust.cz (hutie.ust.cz [185.8.165.127]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF0A421F; Tue, 9 May 2023 09:39:12 -0700 (PDT) From: =?utf-8?q?Martin_Povi=C5=A1er?= <povik+lin@cutebit.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1683650348; bh=ABTxy/stFVOVt1ZnRJ5L55xUikl5p+QPvUWPKUSFmjk=; h=From:To:Cc:Subject:Date; b=nhq0S7wCSrUJDK+cnhpl+JVIGu2eawlnCHn/smmgpzByShlV32rpleACMS0RKmBfV Ts4/R/5dLoOUeNQA2j/4I295DWWYEyQF/6Y4zTGVYKYciu8dKj9ypXUNR0/+Z3U/A+ +gj+p/hOcv+IXy6xyDB29PpJ5drijU/wRkOaib2g= To: =?utf-8?q?Martin_Povi=C5=A1er?= <povik+lin@cutebit.org>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Lars-Peter Clausen <lars@metafoo.de>, =?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@analog.com> Cc: asahi@lists.linux.dev, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ASoC: dt-bindings: Add adi,ssm3515 amp schema Date: Tue, 9 May 2023 18:38:27 +0200 Message-Id: <20230509163828.86003-1-povik+lin@cutebit.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765435920375432810?= X-GMAIL-MSGID: =?utf-8?q?1765435920375432810?= |
Series |
[1/2] ASoC: dt-bindings: Add adi,ssm3515 amp schema
|
|
Commit Message
Martin Povišer
May 9, 2023, 4:38 p.m. UTC
Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple
mono amplifier with digital input.
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
---
.../bindings/sound/adi,ssm3515.yaml | 66 +++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/adi,ssm3515.yaml
Comments
Hey Martin, On Tue, May 09, 2023 at 06:38:27PM +0200, Martin Povišer wrote: > Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple > mono amplifier with digital input. > > Signed-off-by: Martin Povišer <povik+lin@cutebit.org> > --- > .../bindings/sound/adi,ssm3515.yaml | 66 +++++++++++++++++++ > 1 file changed, 66 insertions(+) > create mode 100644 Documentation/devicetree/bindings/sound/adi,ssm3515.yaml > > diff --git a/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml b/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml > new file mode 100644 > index 000000000000..19b7185ae8e2 > --- /dev/null > +++ b/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml > @@ -0,0 +1,66 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +# Copyright (C) 2019-20 Texas Instruments Incorporated Copyright here looks a little odd, copy & paste from the TI bindings you send patches for earlier, or intended? > +%YAML 1.2 > +--- > +$id: "http://devicetree.org/schemas/sound/adi,ssm3515.yaml#" > +$schema: "http://devicetree.org/meta-schemas/core.yaml#" Drop the quotes on these please. > + > +title: Analog Devices SSM3515 Audio Amplifier > + > +maintainers: > + - Martin Povišer <povik+lin@cutebit.org> > + > +description: | > + SSM3515 is a mono Class-D audio amplifier with digital input. > + > + https://www.analog.com/media/en/technical-documentation/data-sheets/SSM3515.pdf > + > +allOf: > + - $ref: dai-common.yaml# > + > +properties: > + compatible: > + enum: > + - adi,ssm3515 > + > + reg: > + maxItems: 1 > + > + adi,ana-gain: > + $ref: /schemas/types.yaml#/definitions/uint32 > + enum: [0, 1, 2, 3] > + description: | > + The value to be set in the ANA_GAIN register field on the codec. This determines > + the full voltage span of the codec's analog output. > + > + To quote the datasheet on the available options: > + > + 00: 8.4 V Full-Scale Gain Mapping > + 01: 12.6 V Full-Scale Gain Mapping > + 10: 14 V Full-Scale Gain Mapping > + 11: 15 V Full-Scale Gain Mapping Putting register values into the DT does not seem correct, although I know nothing about sound and will have to defer to Krzysztof & Co. on that front. Cheers, Conor. > + > + '#sound-dai-cells': > + const: 0 > + > +required: > + - compatible > + - reg > + - adi,ana-gain > + > +additionalProperties: true > + > +examples: > + - | > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + codec@14 { > + compatible = "adi,ssm3515"; > + reg = <0x14>; > + #sound-dai-cells = <0>; > + adi,ana-gain = <0>; > + sound-name-prefix = "Left Tweeter"; > + }; > + }; > -- > 2.38.3 >
Hello Conor, > On 9. 5. 2023, at 20:25, Conor Dooley <conor@kernel.org> wrote: > > Hey Martin, > > On Tue, May 09, 2023 at 06:38:27PM +0200, Martin Povišer wrote: >> Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple >> mono amplifier with digital input. >> >> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> >> --- >> .../bindings/sound/adi,ssm3515.yaml | 66 +++++++++++++++++++ >> 1 file changed, 66 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/sound/adi,ssm3515.yaml >> >> diff --git a/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml b/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml >> new file mode 100644 >> index 000000000000..19b7185ae8e2 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml >> @@ -0,0 +1,66 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +# Copyright (C) 2019-20 Texas Instruments Incorporated > > Copyright here looks a little odd, copy & paste from the TI bindings you > send patches for earlier, or intended? Yeah, that must have been a copypaste from the other schemas. Not intended in any case. Thanks for the catch. > >> +%YAML 1.2 >> +--- >> +$id: "http://devicetree.org/schemas/sound/adi,ssm3515.yaml#" >> +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > > Drop the quotes on these please. OK >> + >> + adi,ana-gain: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + enum: [0, 1, 2, 3] >> + description: | >> + The value to be set in the ANA_GAIN register field on the codec. This determines >> + the full voltage span of the codec's analog output. >> + >> + To quote the datasheet on the available options: >> + >> + 00: 8.4 V Full-Scale Gain Mapping >> + 01: 12.6 V Full-Scale Gain Mapping >> + 10: 14 V Full-Scale Gain Mapping >> + 11: 15 V Full-Scale Gain Mapping > > Putting register values into the DT does not seem correct, although > I know nothing about sound and will have to defer to Krzysztof & Co. on > that front. It’s an analog gain selection, it just seemed most honest and convenient to defer to the register field in describing of what this property does. I thought this should be here, and not with the other gain controls to be exported to userspace, since it relates to the supply voltage. You probably can’t select a gain value close or over the amp’s supply and expect proper functioning, so the value here should be the system’s integrator choice. On second thought there doesn’t seem to be any risk of damage to the amp itself, so the knowledge of what’s the optimal value could be left up to ALSA use-case configuration, and there’s no real downside in treating it like other gain controls. I think I will remove it in the next iteration. > Cheers, > Conor. Cheers, Martin
On Tue, May 09, 2023 at 09:38:46PM +0200, Martin Povišer wrote: > > On 9. 5. 2023, at 20:25, Conor Dooley <conor@kernel.org> wrote: > >> + 00: 8.4 V Full-Scale Gain Mapping > >> + 01: 12.6 V Full-Scale Gain Mapping > >> + 10: 14 V Full-Scale Gain Mapping > >> + 11: 15 V Full-Scale Gain Mapping > > Putting register values into the DT does not seem correct, although > > I know nothing about sound and will have to defer to Krzysztof & Co. on > > that front. > I thought this should be here, and not with the other gain controls to be > exported to userspace, since it relates to the supply voltage. You probably > can’t select a gain value close or over the amp’s supply and expect proper > functioning, so the value here should be the system’s integrator choice. > On second thought there doesn’t seem to be any risk of damage to the amp > itself, so the knowledge of what’s the optimal value could be left up to > ALSA use-case configuration, and there’s no real downside in treating it > like other gain controls. Alternatively why not just query the supply voltage via the regulator API? Those are kind of weird numbers (eg, 12.6V rather than 12V) though, it looks like they're not expected to be the actual maximum supply values but rather something slightly less.
On 09/05/2023 18:38, Martin Povišer wrote: > Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple > mono amplifier with digital input. > > Signed-off-by: Martin Povišer <povik+lin@cutebit.org> > + reg: > + maxItems: 1 > + > + adi,ana-gain: > + $ref: /schemas/types.yaml#/definitions/uint32 > + enum: [0, 1, 2, 3] > + description: | > + The value to be set in the ANA_GAIN register field on the codec. This determines > + the full voltage span of the codec's analog output. > + > + To quote the datasheet on the available options: > + > + 00: 8.4 V Full-Scale Gain Mapping > + 01: 12.6 V Full-Scale Gain Mapping > + 10: 14 V Full-Scale Gain Mapping > + 11: 15 V Full-Scale Gain Mapping > + > + '#sound-dai-cells': > + const: 0 > + > +required: > + - compatible > + - reg > + - adi,ana-gain > + > +additionalProperties: true uinevaluatedProperties: false instead, so users can have name-prefix. Best regards, Krzysztof
On 09/05/2023 20:25, Conor Dooley wrote: > Hey Martin, > > On Tue, May 09, 2023 at 06:38:27PM +0200, Martin Povišer wrote: >> Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple >> mono amplifier with digital input. >> >> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> >> --- >> .../bindings/sound/adi,ssm3515.yaml | 66 +++++++++++++++++++ >> 1 file changed, 66 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/sound/adi,ssm3515.yaml >> >> diff --git a/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml b/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml >> new file mode 100644 >> index 000000000000..19b7185ae8e2 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml >> @@ -0,0 +1,66 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +# Copyright (C) 2019-20 Texas Instruments Incorporated > > Copyright here looks a little odd, copy & paste from the TI bindings you > send patches for earlier, or intended? > >> +%YAML 1.2 >> +--- >> +$id: "http://devicetree.org/schemas/sound/adi,ssm3515.yaml#" >> +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > > Drop the quotes on these please. > >> + >> +title: Analog Devices SSM3515 Audio Amplifier >> + >> +maintainers: >> + - Martin Povišer <povik+lin@cutebit.org> >> + >> +description: | >> + SSM3515 is a mono Class-D audio amplifier with digital input. >> + >> + https://www.analog.com/media/en/technical-documentation/data-sheets/SSM3515.pdf >> + >> +allOf: >> + - $ref: dai-common.yaml# >> + >> +properties: >> + compatible: >> + enum: >> + - adi,ssm3515 >> + >> + reg: >> + maxItems: 1 >> + >> + adi,ana-gain: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + enum: [0, 1, 2, 3] >> + description: | >> + The value to be set in the ANA_GAIN register field on the codec. This determines >> + the full voltage span of the codec's analog output. >> + >> + To quote the datasheet on the available options: >> + >> + 00: 8.4 V Full-Scale Gain Mapping >> + 01: 12.6 V Full-Scale Gain Mapping >> + 10: 14 V Full-Scale Gain Mapping >> + 11: 15 V Full-Scale Gain Mapping > > Putting register values into the DT does not seem correct, although > I know nothing about sound and will have to defer to Krzysztof & Co. on > that front. Depends whether these are really voltages or something else (e.g. gain) just related to voltage. Best regards, Krzysztof
> On 10. 5. 2023, at 9:51, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > On 09/05/2023 18:38, Martin Povišer wrote: >> Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple >> mono amplifier with digital input. >> >> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> > > >> + reg: >> + maxItems: 1 >> + >> + adi,ana-gain: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + enum: [0, 1, 2, 3] >> + description: | >> + The value to be set in the ANA_GAIN register field on the codec. This determines >> + the full voltage span of the codec's analog output. >> + >> + To quote the datasheet on the available options: >> + >> + 00: 8.4 V Full-Scale Gain Mapping >> + 01: 12.6 V Full-Scale Gain Mapping >> + 10: 14 V Full-Scale Gain Mapping >> + 11: 15 V Full-Scale Gain Mapping >> + >> + '#sound-dai-cells': >> + const: 0 >> + >> +required: >> + - compatible >> + - reg >> + - adi,ana-gain >> + >> +additionalProperties: true > > uinevaluatedProperties: false instead, so users can have name-prefix. I actually tweaked this to have the example passing, which has sound-name-prefix, which I guess is what you have in mind. Not that I exactly understand what these options do (both additionalProperties and unevaluatedProperties), the schema docs didn’t enlighten me right away when I looked into it. If 'unevaluatedProperties: false' is the way to go here, I will change it. Kind regards, Martin > Best regards, > Krzysztof
On 10/05/2023 10:15, Martin Povišer wrote: > >> On 10. 5. 2023, at 9:51, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: >> >> On 09/05/2023 18:38, Martin Povišer wrote: >>> Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple >>> mono amplifier with digital input. >>> >>> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> >> >> >>> + reg: >>> + maxItems: 1 >>> + >>> + adi,ana-gain: >>> + $ref: /schemas/types.yaml#/definitions/uint32 >>> + enum: [0, 1, 2, 3] >>> + description: | >>> + The value to be set in the ANA_GAIN register field on the codec. This determines >>> + the full voltage span of the codec's analog output. >>> + >>> + To quote the datasheet on the available options: >>> + >>> + 00: 8.4 V Full-Scale Gain Mapping >>> + 01: 12.6 V Full-Scale Gain Mapping >>> + 10: 14 V Full-Scale Gain Mapping >>> + 11: 15 V Full-Scale Gain Mapping >>> + >>> + '#sound-dai-cells': >>> + const: 0 >>> + >>> +required: >>> + - compatible >>> + - reg >>> + - adi,ana-gain >>> + >>> +additionalProperties: true >> >> uinevaluatedProperties: false instead, so users can have name-prefix. > > I actually tweaked this to have the example passing, which has sound-name-prefix, true is not allowed anyway - it makes your schema simply not effective almost at all as it allows anything... > which I guess is what you have in mind. Not that I exactly understand what these > options do (both additionalProperties and unevaluatedProperties), the schema docs > didn’t enlighten me right away when I looked into it. The way to go and to start always is to look at example-schema. It tells you explicitly to use additionalProperties:false and switch to unevaluated "If and only if another schema is referenced". Best regards, Krzysztof
> On 10. 5. 2023, at 10:23, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > On 10/05/2023 10:15, Martin Povišer wrote: >> >>> On 10. 5. 2023, at 9:51, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: >>> >>> On 09/05/2023 18:38, Martin Povišer wrote: >>>> Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple >>>> mono amplifier with digital input. >>>> >>>> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> >>>> +additionalProperties: true >>> >>> uinevaluatedProperties: false instead, so users can have name-prefix. >> >> I actually tweaked this to have the example passing, which has sound-name-prefix, > > true is not allowed anyway - it makes your schema simply not effective > almost at all as it allows anything... That makes sense. >> which I guess is what you have in mind. Not that I exactly understand what these >> options do (both additionalProperties and unevaluatedProperties), the schema docs >> didn’t enlighten me right away when I looked into it. > > The way to go and to start always is to look at example-schema. It tells > you explicitly to use additionalProperties:false and switch to > unevaluated "If and only if another schema is referenced". OK. While I have you on the line, what does unevaluated do? In what sense are props unevaluated? > Best regards, > Krzysztof Regards, Martin
On 10/05/2023 10:29, Martin Povišer wrote: > > >> On 10. 5. 2023, at 10:23, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: >> >> On 10/05/2023 10:15, Martin Povišer wrote: >>> >>>> On 10. 5. 2023, at 9:51, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: >>>> >>>> On 09/05/2023 18:38, Martin Povišer wrote: >>>>> Add a DT schema for the SSM3515 amp by Analog Devices. It's a simple >>>>> mono amplifier with digital input. >>>>> >>>>> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> > >>>>> +additionalProperties: true >>>> >>>> uinevaluatedProperties: false instead, so users can have name-prefix. >>> >>> I actually tweaked this to have the example passing, which has sound-name-prefix, >> >> true is not allowed anyway - it makes your schema simply not effective >> almost at all as it allows anything... > > That makes sense. > >>> which I guess is what you have in mind. Not that I exactly understand what these >>> options do (both additionalProperties and unevaluatedProperties), the schema docs >>> didn’t enlighten me right away when I looked into it. >> >> The way to go and to start always is to look at example-schema. It tells >> you explicitly to use additionalProperties:false and switch to >> unevaluated "If and only if another schema is referenced". > > OK. While I have you on the line, what does unevaluated do? In what sense are props > unevaluated? Properties can be evaluated by some other referenced schema (e.g. dai-common.yaml). If nothing evaluated them, they are unevaluated, thus unknown and not allowed. Best regards, Krzysztof
On Wed, May 10, 2023 at 09:51:50AM +0200, Krzysztof Kozlowski wrote: > On 09/05/2023 20:25, Conor Dooley wrote: > > On Tue, May 09, 2023 at 06:38:27PM +0200, Martin Povišer wrote: > >> + 00: 8.4 V Full-Scale Gain Mapping > >> + 01: 12.6 V Full-Scale Gain Mapping > >> + 10: 14 V Full-Scale Gain Mapping > >> + 11: 15 V Full-Scale Gain Mapping > > Putting register values into the DT does not seem correct, although > > I know nothing about sound and will have to defer to Krzysztof & Co. on > > that front. > Depends whether these are really voltages or something else (e.g. gain) > just related to voltage. They are configuring the voltage range that the output will generate.
diff --git a/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml b/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml new file mode 100644 index 000000000000..19b7185ae8e2 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/adi,ssm3515.yaml @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2019-20 Texas Instruments Incorporated +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/sound/adi,ssm3515.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Analog Devices SSM3515 Audio Amplifier + +maintainers: + - Martin Povišer <povik+lin@cutebit.org> + +description: | + SSM3515 is a mono Class-D audio amplifier with digital input. + + https://www.analog.com/media/en/technical-documentation/data-sheets/SSM3515.pdf + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + enum: + - adi,ssm3515 + + reg: + maxItems: 1 + + adi,ana-gain: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + description: | + The value to be set in the ANA_GAIN register field on the codec. This determines + the full voltage span of the codec's analog output. + + To quote the datasheet on the available options: + + 00: 8.4 V Full-Scale Gain Mapping + 01: 12.6 V Full-Scale Gain Mapping + 10: 14 V Full-Scale Gain Mapping + 11: 15 V Full-Scale Gain Mapping + + '#sound-dai-cells': + const: 0 + +required: + - compatible + - reg + - adi,ana-gain + +additionalProperties: true + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + codec@14 { + compatible = "adi,ssm3515"; + reg = <0x14>; + #sound-dai-cells = <0>; + adi,ana-gain = <0>; + sound-name-prefix = "Left Tweeter"; + }; + };