From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Sen Chu" <sen.chu@mediatek.com>,
"Sean Wang" <sean.wang@mediatek.com>,
"Macpaul Lin" <macpaul.lin@mediatek.com>,
"Lee Jones" <lee@kernel.org>, "Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>
Cc: kernel@collabora.com, linux-sound@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 01/13] ASoC: dt-bindings: Add document for mt6359-accdet
Date: Tue, 18 Feb 2025 14:18:17 +0100 [thread overview]
Message-ID: <89fb495b-0171-49b3-a34b-022ba04f54df@collabora.com> (raw)
In-Reply-To: <20250214-mt6359-accdet-dts-v1-1-677a151b9b4c@collabora.com>
Il 14/02/25 18:18, Nícolas F. R. A. Prado ha scritto:
> Add dt-binding for the MT6359 ACCDET hardware block.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
> .../bindings/sound/mediatek,mt6359-accdet.yaml | 293 +++++++++++++++++++++
> 1 file changed, 293 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt6359-accdet.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt6359-accdet.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..8922003d3b9d039d2a0355add7a90cf42b1a9da6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/mediatek,mt6359-accdet.yaml
> @@ -0,0 +1,293 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/mediatek,mt6359-accdet.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MT6359 Accessory Detection
> +
> +maintainers:
> + - Nícolas F. R. A. Prado <nfraprado@collabora.com>
> +
> +description: |
> + The MT6359 Accessory Detection block is part of the MT6359 PMIC and allows
> + detecting audio jack insertion and removal, as well as identifying the type of
> + events connected to the jack.
> +
> +properties:
> + compatible:
> + const: mediatek,mt6359-accdet
> +
> + mediatek,mic-vol:
mediatek,micbias1-microvolts = <1700000>;
enum: [1700000, 1800000 ... etc ]
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: MIC bias1 output voltage setting
> + enum:
> + - 0 # 1.7V
> + - 1 # 1.8V
> + - 2 # 1.9V
> + - 3 # 2.0V
> + - 4 # 2.1V
> + - 5 # 2.5V
> + - 6 # 2.6V
> + - 7 # 2.7V
> + - 8 # 2.8V
> + - 9 # 2.85V
> +
> + mediatek,mic-mode:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Mic mode setting
> + enum:
> + - 1 # ACC
> + - 2 # DCC mode. Low cost mode without internal bias
> + - 6 # DCC mode. Low cost mode with internal bias
This is already defined in mt6359.yaml....?!
> +
> + mediatek,eint-cmpmen-pwm-width:
mediatek,eint-cmpm-pwm-width-ms:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: EINT CMPMEN PWM width
P.S.: CMPMEN = CoMParator Monitor ENable
description: EINT Comparator Monitor PWM Width
enum: [50, 80, 100, 200, 400, 500, 800, 1000]
> + enum:
> + - 0 # 50ms
> + - 1 # 80ms
> + - 2 # 100ms
> + - 3 # 200ms
> + - 4 # 400ms
> + - 5 # 500ms
> + - 6 # 800ms
> + - 7 # 1000ms
> +
> + mediatek,eint-cmpmen-pwm-thresh:
mediatek,eint-cmpm-pwm-threshold-ms:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: EINT CMPMEN PWM threshold
description: EINT Comparator Monitor PWM Threshold
enum: [1, 2, 3, 4, 5, 8, 10, 20, 30]
> + enum:
> + - 0 # 1ms
> + - 1 # 2ms
> + - 2 # 4ms
> + - 3 # 5ms
> + - 4 # 8ms
> + - 5 # 10ms
> + - 6 # 20ms
> + - 7 # 30ms
> +
> + mediatek,pwm-width:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: PWM width
> + minimum: 0
> + maximum: 65535
> +
> + mediatek,pwm-thresh:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: PWM threshold
> + minimum: 0
> + maximum: 65535
You can simplify those two with one param "mediatek,pwm-duty-cycle", I think.
But then, regardless, you still need to express this in decent units...
make a few calculations - but the equation is...
PWM Width = (32768 / (mediatek,pwm-width + 1)) [hertz]
PWM Duty Cycle = ((mediatek,pwm-thresh + 1) / (mediatek,pwm-width + 1)) [ns?]
PWM High Time = (mediatek,pwm-thresh + 1) / 32768 [seconds]
> +
> + mediatek,pwm-rise-delay:
mediatek,pwm-rise-delay-cycle:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Rise delay for PWM
description: Rising delay of PWM waveform in cycles
> + minimum: 0
> + maximum: 65535
> +
> + mediatek,pwm-fall-delay:
same for the falling one
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Fall delay for PWM
> + minimum: 0
> + maximum: 65535
> +
> + mediatek,debounce0:
mediatek,adc-debounce-ns = < debounce0 debounce1 debounce2 debounce3 >
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for state 0
> + minimum: 0
> + maximum: 65535
> +
> + mediatek,debounce1:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for state 1
> + minimum: 0
> + maximum: 65535
> +
> + mediatek,debounce3:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for state 3
> + minimum: 0
> + maximum: 65535
> +
> + mediatek,debounce-auxadc:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for AUXADC
> + minimum: 0
> + maximum: 65535
> +
mediatek,eint-debounce-ns = < same as adc-debounce-ns >
> + mediatek,eint-debounce0:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for EINT state 0
> + enum:
> + - 0 # 0ms
> + - 1 # 0.12ms
> + - 2 # 0.25ms
> + - 3 # 0.5ms
> + - 4 # 0.75ms
> + - 5 # 1ms
> + - 6 # 2ms
> + - 7 # 4ms
> + - 8 # 8ms
> + - 9 # 16ms
> + - 10 # 32ms
> + - 11 # 48ms
> + - 12 # 64ms
> + - 13 # 128ms
> + - 14 # 256ms
> + - 15 # 512ms
> +
> + mediatek,eint-debounce1:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for EINT state 1
> + enum:
> + - 0 # 0ms
> + - 1 # 0.5ms
> + - 2 # 0.75ms
> + - 3 # 0.9ms
> + - 4 # 1.5ms
> + - 5 # 1.8ms
> + - 6 # 3ms
> + - 7 # 3.5ms
> + - 8 # 3.8ms
> + - 9 # 16ms
> + - 10 # 32ms
> + - 11 # 48ms
> + - 12 # 64ms
> + - 13 # 128ms
> + - 14 # 256ms
> + - 15 # 512ms
> +
> + mediatek,eint-debounce2:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for EINT state 2
> + enum:
> + - 0 # 0ms
> + - 1 # 0.5ms
> + - 2 # 0.75ms
> + - 3 # 0.9ms
> + - 4 # 1.5ms
> + - 5 # 1.8ms
> + - 6 # 3ms
> + - 7 # 3.5ms
> + - 8 # 3.8ms
> + - 9 # 4ms
> + - 10 # 4.5ms
> + - 11 # 5ms
> + - 12 # 7ms
> + - 13 # 9ms
> + - 14 # 19ms
> + - 15 # 25ms
> +
> + mediatek,eint-debounce3:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for EINT state 3
> + enum:
> + - 0 # 0ms
> + - 1 # 0.12ms
> + - 2 # 0.25ms
> + - 3 # 0.5ms
> + - 4 # 0.75ms
> + - 5 # 1ms
> + - 6 # 2ms
> + - 7 # 4ms
> + - 8 # 8ms
> + - 9 # 16ms
> + - 10 # 32ms
> + - 11 # 48ms
> + - 12 # 64ms
> + - 13 # 128ms
> + - 14 # 256ms
> + - 15 # 512ms
> +
> + mediatek,eint-inverter-debounce:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Debounce time for EINT inverter
> + enum:
> + - 0 # 0ms
> + - 1 # 0.12ms
> + - 2 # 0.25ms
> + - 3 # 0.5ms
> + - 4 # 0.75ms
> + - 5 # 1ms
> + - 6 # 2ms
> + - 7 # 4ms
> + - 8 # 8ms
> + - 9 # 16ms
> + - 10 # 32ms
> + - 11 # 48ms
> + - 12 # 64ms
> + - 13 # 128ms
> + - 14 # 256ms
> + - 15 # 512ms
> +
> + mediatek,eint-detect-mode:
This is fine, I think.
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: EINT detection mode
> + enum:
> + - 0 # Higher detection power
> + - 1 # Lower detection power
> + - 2 # SW moisture detection mode1
> + - 3 # HW moisture detection mode1
> + - 4 # HW moisture detection mode2
> +
> + mediatek,eint-num:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: EINT interrupt that should be enabled
> + enum:
> + - 0 # EINT0
> + - 1 # EINT1
> + - 2 # EINT0 | EINT1
> +
> + mediatek,eint-use-ext-res:
> + type: boolean
> + description:
> + Whether an external resistor should be used for the HP_EINT signal.
> + By default an internal pull-up resistor is used.
> +
> + mediatek,eint-comp-vth:
mediatek,eint-comp-vth-microvolts = ....
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: EINT comparator threshold
> + enum:
> + - 0 # 2.4V
> + - 1 # 2V
> + - 2 # 1.6V
> + - 3 # 1.2V
> + - 4 # 0.8V
> +
...and that's more or less it....
Cheers,
Angelo
> + mediatek,eint-level-pol:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: EINT interrupt polarity
> +
> +required:
> + - compatible
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> +
> + accdet: accdet {
> + compatible = "mediatek,mt6359-accdet";
> + mediatek,mic-vol = <8>;
> + mediatek,mic-mode = <2>;
> + mediatek,pwm-width = <0x500>;
> + mediatek,pwm-thresh = <0x500>;
> + mediatek,pwm-fall-delay = <1>;
> + mediatek,pwm-rise-delay = <0x1f0>;
> + mediatek,debounce0 = <0x800>;
> + mediatek,debounce1 = <0x800>;
> + mediatek,debounce3 = <0x20>;
> + mediatek,debounce-auxadc = <0x44>;
> + mediatek,eint-cmpmen-pwm-width = <4>;
> + mediatek,eint-cmpmen-pwm-thresh = <1>;
> + mediatek,eint-debounce0 = <5>;
> + mediatek,eint-debounce1 = <3>;
> + mediatek,eint-debounce2 = <3>;
> + mediatek,eint-debounce3 = <5>;
> + mediatek,eint-inverter-debounce = <0xe>;
> + mediatek,eint-detect-mode = <4>;
> + mediatek,eint-num = <0>;
> + mediatek,eint-comp-vth = <2>;
> + mediatek,eint-level-pol = <IRQ_TYPE_LEVEL_LOW>;
> + };
>
next prev parent reply other threads:[~2025-02-18 13:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 01/13] ASoC: dt-bindings: Add document for mt6359-accdet Nícolas F. R. A. Prado
2025-02-18 13:18 ` AngeloGioacchino Del Regno [this message]
2025-02-14 17:18 ` [PATCH 02/13] dt-bindings: mfd: mediatek: mt6397: Add accdet subnode Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 03/13] mfd: mt6397-core: Add mfd_cell for mt6359-accdet Nícolas F. R. A. Prado
2025-02-27 16:16 ` Lee Jones
2025-02-14 17:18 ` [PATCH 04/13] ASoC: mediatek: mt6359-accdet: Add compatible property Nícolas F. R. A. Prado
2025-02-18 13:18 ` AngeloGioacchino Del Regno
2025-02-14 17:18 ` [PATCH 05/13] ASoC: mediatek: mt6359-accdet: Implement EINT IRQ polarity configuration Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 06/13] ASoC: mediatek: mt6359-accdet: Use IRQ_TYPE_LEVEL_LOW not raw value Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 07/13] ASoC: mediatek: mt6359-accdet: Drop dead code for EINT/GPIO IRQ handling Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 08/13] ASoC: mediatek: mt6359-accdet: Drop dead code for EINT trigger setting Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 09/13] ASoC: mediatek: mt6359-accdet: Drop dead code for button detection Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 10/13] ASoC: mediatek: mt6359-accdet: Drop dead code for plugout-debounce Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 11/13] ASoC: mediatek: mt6359-accdet: Handle mediatek,eint-use-ext-res as bool Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 12/13] ASoC: mediatek: mt6359-accdet: Split mediatek,pwm-deb-setting properties Nícolas F. R. A. Prado
2025-02-14 17:18 ` [PATCH 13/13] arm64: dts: mt6359: Add accessory detect node Nícolas F. R. A. Prado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89fb495b-0171-49b3-a34b-022ba04f54df@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=macpaul.lin@mediatek.com \
--cc=matthias.bgg@gmail.com \
--cc=nfraprado@collabora.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=sean.wang@mediatek.com \
--cc=sen.chu@mediatek.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox