Unverified Commit 35bccf46 authored by David Lin's avatar David Lin Committed by Mark Brown
Browse files

ASoC: dt-bindings: nau8825: Convert to dtschema



Convert the NAU8825 audio CODEC bindings to DT schema.

Signed-off-by: default avatarDavid Lin <CTLIN0@nuvoton.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230511113607.595184-1-CTLIN0@nuvoton.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c7895b75
Loading
Loading
Loading
Loading
+0 −111
Original line number Diff line number Diff line
Nuvoton NAU8825 audio codec

This device supports I2C only.

Required properties:
  - compatible : Must be "nuvoton,nau8825"

  - reg : the I2C address of the device. This is either 0x1a (CSB=0) or 0x1b (CSB=1).

Optional properties:
  - nuvoton,jkdet-enable: Enable jack detection via JKDET pin.
  - nuvoton,jkdet-pull-enable: Enable JKDET pin pull. If set - pin pull enabled,
      otherwise pin in high impedance state.
  - nuvoton,jkdet-pull-up: Pull-up JKDET pin. If set then JKDET pin is pull up, otherwise pull down.
  - nuvoton,jkdet-polarity: JKDET pin polarity. 0 - active high, 1 - active low.

  - nuvoton,vref-impedance: VREF Impedance selection
      0 - Open
      1 - 25 kOhm
      2 - 125 kOhm
      3 - 2.5 kOhm

  - nuvoton,micbias-voltage: Micbias voltage level.
      0 - VDDA
      1 - VDDA
      2 - VDDA * 1.1
      3 - VDDA * 1.2
      4 - VDDA * 1.3
      5 - VDDA * 1.4
      6 - VDDA * 1.53
      7 - VDDA * 1.53

  - nuvoton,sar-threshold-num: Number of buttons supported
  - nuvoton,sar-threshold: Impedance threshold for each button. Array that contains up to 8 buttons configuration. SAR value is calculated as
    SAR = 255 * MICBIAS / SAR_VOLTAGE * R / (2000 + R)
    where MICBIAS is configured by 'nuvoton,micbias-voltage', SAR_VOLTAGE is configured by 'nuvoton,sar-voltage', R - button impedance.
    Refer datasheet section 10.2 for more information about threshold calculation.

  - nuvoton,sar-hysteresis: Button impedance measurement hysteresis.

  - nuvoton,sar-voltage: Reference voltage for button impedance measurement.
      0 - VDDA
      1 - VDDA
      2 - VDDA * 1.1
      3 - VDDA * 1.2
      4 - VDDA * 1.3
      5 - VDDA * 1.4
      6 - VDDA * 1.53
      7 - VDDA * 1.53

  - nuvoton,sar-compare-time: SAR compare time
      0 - 500 ns
      1 - 1 us
      2 - 2 us
      3 - 4 us

  - nuvoton,sar-sampling-time: SAR sampling time
      0 - 2 us
      1 - 4 us
      2 - 8 us
      3 - 16 us

  - nuvoton,short-key-debounce: Button short key press debounce time.
      0 - 30 ms
      1 - 50 ms
      2 - 100 ms
      3 - 30 ms

  - nuvoton,jack-insert-debounce: number from 0 to 7 that sets debounce time to 2^(n+2) ms
  - nuvoton,jack-eject-debounce: number from 0 to 7 that sets debounce time to 2^(n+2) ms

  - nuvoton,crosstalk-enable: make crosstalk function enable if set.

  - nuvoton,adcout-drive-strong: make the drive strength of ADCOUT IO PIN strong if set.
      Otherwise, the drive keeps normal strength.

  - nuvoton,adc-delay-ms: Delay (in ms) to make input path stable and avoid pop noise. The
      default value is 125 and range between 125 to 500 ms.

  - clocks: list of phandle and clock specifier pairs according to common clock bindings for the
      clocks described in clock-names
  - clock-names: should include "mclk" for the MCLK master clock

Example:

  headset: nau8825@1a {
      compatible = "nuvoton,nau8825";
      reg = <0x1a>;
      interrupt-parent = <&gpio>;
      interrupts = <TEGRA_GPIO(E, 6) IRQ_TYPE_LEVEL_LOW>;
      nuvoton,jkdet-enable;
      nuvoton,jkdet-pull-enable;
      nuvoton,jkdet-pull-up;
      nuvoton,jkdet-polarity = <GPIO_ACTIVE_LOW>;
      nuvoton,vref-impedance = <2>;
      nuvoton,micbias-voltage = <6>;
      // Setup 4 buttons impedance according to Android specification
      nuvoton,sar-threshold-num = <4>;
      nuvoton,sar-threshold = <0xc 0x1e 0x38 0x60>;
      nuvoton,sar-hysteresis = <1>;
      nuvoton,sar-voltage = <0>;
      nuvoton,sar-compare-time = <0>;
      nuvoton,sar-sampling-time = <0>;
      nuvoton,short-key-debounce = <2>;
      nuvoton,jack-insert-debounce = <7>;
      nuvoton,jack-eject-debounce = <7>;
      nuvoton,crosstalk-enable;

      clock-names = "mclk";
      clocks = <&tegra_pmc TEGRA_PMC_CLK_OUT_2>;
  };
+239 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/nuvoton,nau8825.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NAU8825 audio CODEC

maintainers:
  - John Hsu <KCHSU0@nuvoton.com>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - nuvoton,nau8825

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  nuvoton,jkdet-enable:
    description:
      Enable jack detection via JKDET pin.
    type: boolean

  nuvoton,jkdet-pull-enable:
    description:
      Enable JKDET pin pull.
      If set - pin pull enabled, otherwise pin in high impedance state.
    type: boolean

  nuvoton,jkdet-pull-up:
    description:
      Pull-up JKDET pin.
      If set then JKDET pin is pull up, otherwise pull down.
    type: boolean

  nuvoton,jkdet-polarity:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      JKDET pin polarity.
    enum:
      - 0 # active high
      - 1 # active low
    default: 1

  nuvoton,vref-impedance:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      VREF Impedance selection.
    enum:
      - 0 # Open
      - 1 # 25 kOhm
      - 2 # 125 kOhm
      - 3 # 2.5 kOhm
    default: 2

  nuvoton,micbias-voltage:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Micbias voltage level.
    enum:
      - 0 # VDDA
      - 1 # VDDA
      - 2 # VDDA * 1.1
      - 3 # VDDA * 1.2
      - 4 # VDDA * 1.3
      - 5 # VDDA * 1.4
      - 6 # VDDA * 1.53
      - 7 # VDDA * 1.53
    default: 6

  nuvoton,sar-threshold-num:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Number of buttons supported.
    minimum: 1
    maximum: 4
    default: 4

  nuvoton,sar-threshold:
    $ref: /schemas/types.yaml#/definitions/uint32-array
    description:
      Impedance threshold for each button. Array that contains up to 8 buttons
      configuration. SAR value is calculated as
      SAR = 255 * MICBIAS / SAR_VOLTAGE * R / (2000 + R) where MICBIAS is
      configured by 'nuvoton,micbias-voltage', SAR_VOLTAGE is configured by
      'nuvoton,sar-voltage', R - button impedance.
      Refer datasheet section 10.2 for more information about threshold
      calculation.
    minItems: 1
    maxItems: 4
    items:
      minimum: 0
      maximum: 255

  nuvoton,sar-hysteresis:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Button impedance measurement hysteresis.
    default: 0

  nuvoton,sar-voltage:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Reference voltage for button impedance measurement.
    enum:
      - 0 # VDDA
      - 1 # VDDA
      - 2 # VDDA * 1.1
      - 3 # VDDA * 1.2
      - 4 # VDDA * 1.3
      - 5 # VDDA * 1.4
      - 6 # VDDA * 1.53
      - 7 # VDDA * 1.53
    default: 6

  nuvoton,sar-compare-time:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      SAR compare time.
    enum:
      - 0 # 500 ns
      - 1 # 1 us
      - 2 # 2 us
      - 3 # 4 us
    default: 1

  nuvoton,sar-sampling-time:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      SAR sampling time.
    enum:
      - 0 # 2 us
      - 1 # 4 us
      - 2 # 8 us
      - 3 # 16 us
    default: 1

  nuvoton,short-key-debounce:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Button short key press debounce time.
    enum:
      - 0 # 30 ms
      - 1 # 50 ms
      - 2 # 100 ms
      - 3 # 30 ms
    default: 3

  nuvoton,jack-insert-debounce:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      number from 0 to 7 that sets debounce time to 2^(n+2) ms.
    maximum: 7
    default: 7

  nuvoton,jack-eject-debounce:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      number from 0 to 7 that sets debounce time to 2^(n+2) ms
    maximum: 7
    default: 0

  nuvoton,crosstalk-enable:
    description:
      make crosstalk function enable if set.
    type: boolean

  nuvoton,adcout-drive-strong:
    description:
      make the drive strength of ADCOUT IO PIN strong if set.
      Otherwise, the drive keeps normal strength.
    type: boolean

  nuvoton,adc-delay-ms:
    description:
      Delay (in ms) to make input path stable and avoid pop noise.
      The default value is 125 and range between 125 to 500 ms.
    minimum: 125
    maximum: 500
    default: 125

  clocks:
    maxItems: 1

  clock-names:
    items:
      - const: mclk

  '#sound-dai-cells':
    const: 0

required:
  - compatible
  - reg

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    i2c {
        #address-cells = <1>;
        #size-cells = <0>;
        codec@1a {
            #sound-dai-cells = <0>;
            compatible = "nuvoton,nau8825";
            reg = <0x1a>;
            interrupt-parent = <&gpio>;
            interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
            nuvoton,jkdet-enable;
            nuvoton,jkdet-pull-enable;
            nuvoton,jkdet-pull-up;
            nuvoton,jkdet-polarity = <GPIO_ACTIVE_LOW>;
            nuvoton,vref-impedance = <2>;
            nuvoton,micbias-voltage = <6>;
            // Setup 4 buttons impedance according to Android specification
            nuvoton,sar-threshold-num = <4>;
            nuvoton,sar-threshold = <0xc 0x1e 0x38 0x60>;
            nuvoton,sar-hysteresis = <1>;
            nuvoton,sar-voltage = <0>;
            nuvoton,sar-compare-time = <0>;
            nuvoton,sar-sampling-time = <0>;
            nuvoton,short-key-debounce = <2>;
            nuvoton,jack-insert-debounce = <7>;
            nuvoton,jack-eject-debounce = <7>;
            nuvoton,crosstalk-enable;

            clock-names = "mclk";
            clocks = <&tegra_pmc 1>;
        };
    };