* [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree
@ 2025-02-14 17:18 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
` (12 more replies)
0 siblings, 13 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado,
Andrew Perepech
This series prepares the MT6359 ACCDET for actual usage in the
Devicetree. Patches 1 and 2 add the required DT bindings, patches 3 and
4 get the mt6359-accdet driver probing, patches 5-12 clean up code
related to DT property parsing, and patch 13 adds the node in the
Devicetree.
Together with the series "Allow retrieving accessory detection reference
on MT8188" [1], and one extra patch on top enabling it on the
genio-700-evk DT, this series was tested on the Genio 700 EVK to get
audio jack detection working on it.
[1] https://lore.kernel.org/all/20250214-mt8188-accdet-v1-0-6bbd5483855b@collabora.com
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
Andrew Perepech (3):
mfd: mt6397-core: Add mfd_cell for mt6359-accdet
ASoC: mediatek: mt6359-accdet: Implement EINT IRQ polarity configuration
ASoC: mediatek: mt6359-accdet: Use IRQ_TYPE_LEVEL_LOW not raw value
Nícolas F. R. A. Prado (10):
ASoC: dt-bindings: Add document for mt6359-accdet
dt-bindings: mfd: mediatek: mt6397: Add accdet subnode
ASoC: mediatek: mt6359-accdet: Add compatible property
ASoC: mediatek: mt6359-accdet: Drop dead code for EINT/GPIO IRQ handling
ASoC: mediatek: mt6359-accdet: Drop dead code for EINT trigger setting
ASoC: mediatek: mt6359-accdet: Drop dead code for button detection
ASoC: mediatek: mt6359-accdet: Drop dead code for plugout-debounce
ASoC: mediatek: mt6359-accdet: Handle mediatek,eint-use-ext-res as bool
ASoC: mediatek: mt6359-accdet: Split mediatek,pwm-deb-setting properties
arm64: dts: mt6359: Add accessory detect node
.../devicetree/bindings/mfd/mediatek,mt6397.yaml | 7 +
.../bindings/sound/mediatek,mt6359-accdet.yaml | 293 +++++++++++++++++++++
arch/arm64/boot/dts/mediatek/mt6359.dtsi | 24 ++
drivers/mfd/mt6397-core.c | 12 +
sound/soc/codecs/mt6359-accdet.c | 208 +++++----------
sound/soc/codecs/mt6359-accdet.h | 18 +-
6 files changed, 404 insertions(+), 158 deletions(-)
---
base-commit: dab2734f8e9ecba609d66d1dd087a392a7774c04
change-id: 20250214-mt6359-accdet-dts-00b189847f3c
Best regards,
--
Nícolas F. R. A. Prado <nfraprado@collabora.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/13] ASoC: dt-bindings: Add document for mt6359-accdet
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 ` Nícolas F. R. A. Prado
2025-02-18 13:18 ` AngeloGioacchino Del Regno
2025-02-14 17:18 ` [PATCH 02/13] dt-bindings: mfd: mediatek: mt6397: Add accdet subnode Nícolas F. R. A. Prado
` (11 subsequent siblings)
12 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado
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:
+ $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
+
+ mediatek,eint-cmpmen-pwm-width:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: EINT CMPMEN PWM width
+ enum:
+ - 0 # 50ms
+ - 1 # 80ms
+ - 2 # 100ms
+ - 3 # 200ms
+ - 4 # 400ms
+ - 5 # 500ms
+ - 6 # 800ms
+ - 7 # 1000ms
+
+ mediatek,eint-cmpmen-pwm-thresh:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: EINT CMPMEN PWM threshold
+ 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
+
+ mediatek,pwm-rise-delay:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Rise delay for PWM
+ minimum: 0
+ maximum: 65535
+
+ mediatek,pwm-fall-delay:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Fall delay for PWM
+ minimum: 0
+ maximum: 65535
+
+ mediatek,debounce0:
+ $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-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:
+ $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:
+ $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
+
+ 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>;
+ };
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/13] dt-bindings: mfd: mediatek: mt6397: Add accdet subnode
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-14 17:18 ` 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
` (10 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado
Describe the accdet as a possible subnode of the MT6359 PMIC.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
index 6a89b479d10fad3c8b61cab5a3af1453baca4d1a..1a8c5748a28da6ad8aa091f8c0a74bc1dc709644 100644
--- a/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
+++ b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
@@ -224,6 +224,13 @@ properties:
description:
Pin controller
+ accdet:
+ type: object
+ $ref: /schemas/sound/mediatek,mt6359-accdet.yaml
+ unevaluatedProperties: false
+ description:
+ Accessory Detection
+
required:
- compatible
- regulators
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/13] mfd: mt6397-core: Add mfd_cell for mt6359-accdet
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-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 ` 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
` (9 subsequent siblings)
12 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado,
Andrew Perepech
From: Andrew Perepech <andrew.perepech@mediatek.com>
Add an mfd_cell for mt6359-accdet and describe its IRQ resources to
allow the mt6359-accdet driver to probe.
Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
drivers/mfd/mt6397-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 0e5d59ae064a696ae2111e2b558b316667c14773..5f8ed898890783c0ce4e34c7eae0d8f678e7d7bc 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -84,6 +84,12 @@ static const struct resource mt6359_keys_resources[] = {
DEFINE_RES_IRQ_NAMED(MT6359_IRQ_HOMEKEY_R, "homekey_r"),
};
+static const struct resource mt6359_accdet_resources[] = {
+ DEFINE_RES_IRQ_NAMED(MT6359_IRQ_ACCDET, "accdet_irq"),
+ DEFINE_RES_IRQ_NAMED(MT6359_IRQ_ACCDET_EINT0, "accdet_eint0"),
+ DEFINE_RES_IRQ_NAMED(MT6359_IRQ_ACCDET_EINT1, "accdet_eint1"),
+};
+
static const struct resource mt6323_keys_resources[] = {
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
@@ -239,6 +245,12 @@ static const struct mfd_cell mt6359_devs[] = {
.resources = mt6359_keys_resources,
.of_compatible = "mediatek,mt6359-keys"
},
+ {
+ .name = "mt6359-accdet",
+ .of_compatible = "mediatek,mt6359-accdet",
+ .num_resources = ARRAY_SIZE(mt6359_accdet_resources),
+ .resources = mt6359_accdet_resources,
+ },
};
static const struct mfd_cell mt6397_devs[] = {
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/13] ASoC: mediatek: mt6359-accdet: Add compatible property
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (2 preceding siblings ...)
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-14 17:18 ` 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
` (8 subsequent siblings)
12 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado,
Andrew Perepech
Add a compatible property and add it to the module device table for the
mt6359-accdet platform driver to allow automatic module loading and
probing when the compatible is present in DT.
Co-developed-by: Andrew Perepech <andrew.perepech@mediatek.com>
Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index ed34cc15b80e856356c07fd53af22207124e0d19..6f07db879c6a56ce4843954f51bb9602373e4aa5 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -1047,9 +1047,19 @@ static int mt6359_accdet_probe(struct platform_device *pdev)
return ret;
}
+const struct of_device_id accdet_of_match[] = {
+ {
+ .compatible = "mediatek,mt6359-accdet",
+ }, {
+ /* sentinel */
+ },
+};
+MODULE_DEVICE_TABLE(of, accdet_of_match);
+
static struct platform_driver mt6359_accdet_driver = {
.driver = {
.name = "pmic-codec-accdet",
+ .of_match_table = accdet_of_match,
},
.probe = mt6359_accdet_probe,
};
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/13] ASoC: mediatek: mt6359-accdet: Implement EINT IRQ polarity configuration
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (3 preceding siblings ...)
2025-02-14 17:18 ` [PATCH 04/13] ASoC: mediatek: mt6359-accdet: Add compatible property Nícolas F. R. A. Prado
@ 2025-02-14 17:18 ` 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
` (7 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado,
Andrew Perepech
From: Andrew Perepech <andrew.perepech@mediatek.com>
The driver currently reads the EINT IRQ polarity from the
"mediatek,eint-level-pol" property but never actually configures the
hardware accordingly.
Implement the IRQ polarity configuration in hardware.
Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index 6f07db879c6a56ce4843954f51bb9602373e4aa5..eee676d1faef2076bc837a12a2ee3615216752b7 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -733,6 +733,22 @@ static void config_digital_init_by_mode(struct mt6359_accdet *priv)
BIT(ACCDET_EINT1_INVERTER_SW_EN_SFT));
}
}
+
+ if (priv->data->eint_pol == IRQ_TYPE_LEVEL_LOW) {
+ /* EINT polarity normal */
+ regmap_update_bits(priv->regmap,
+ ACCDET_EINT_IN_INVERSE_ADDR,
+ ACCDET_EINT_IN_INVERSE_MASK_SFT,
+ 0);
+ } else if (priv->data->eint_pol == IRQ_TYPE_LEVEL_HIGH) {
+ /* EINT polarity inverse */
+ regmap_update_bits(priv->regmap,
+ ACCDET_EINT_IN_INVERSE_ADDR,
+ ACCDET_EINT_IN_INVERSE_MASK_SFT,
+ BIT(ACCDET_EINT_IN_INVERSE_SFT));
+ } else {
+ dev_warn(priv->dev, "Unacceptable EINT level type, using default\n");
+ }
}
static void config_eint_init_by_mode(struct mt6359_accdet *priv)
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/13] ASoC: mediatek: mt6359-accdet: Use IRQ_TYPE_LEVEL_LOW not raw value
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (4 preceding siblings ...)
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 ` 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
` (6 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado,
Andrew Perepech
From: Andrew Perepech <andrew.perepech@mediatek.com>
The symbol IRQ_TYPE_LEVEL_LOW is equivalent to 8, but the former should
be used for legibility. Update the code accordingly.
Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index eee676d1faef2076bc837a12a2ee3615216752b7..b71957f7a2edb352add23884fd9e231e36b08621 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -581,7 +581,7 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
ret = of_property_read_u32(node, "mediatek,eint-level-pol",
&priv->data->eint_pol);
if (ret)
- priv->data->eint_pol = 8;
+ priv->data->eint_pol = IRQ_TYPE_LEVEL_LOW;
ret = of_property_read_u32(node, "mediatek,eint-use-ap", &tmp);
if (ret)
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/13] ASoC: mediatek: mt6359-accdet: Drop dead code for EINT/GPIO IRQ handling
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (5 preceding siblings ...)
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 ` 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
` (5 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado
The ACCDET supports two modes for IRQ generation: PMIC EINT or AP GPIO,
which in principle could be configured through a DT property. However
this DT property has no user nor is documented in a binding, and the
driver only implements the PMIC EINT case, so drop the unused code
intended to handle both cases.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index b71957f7a2edb352add23884fd9e231e36b08621..57a70867b4b80fc904ae07ee05d0e554495ed6e7 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -31,9 +31,6 @@
#define REGISTER_VAL(x) ((x) - 1)
/* mt6359 accdet capability */
-#define ACCDET_PMIC_EINT_IRQ BIT(0)
-#define ACCDET_AP_GPIO_EINT BIT(1)
-
#define ACCDET_PMIC_EINT0 BIT(2)
#define ACCDET_PMIC_EINT1 BIT(3)
#define ACCDET_PMIC_BI_EINT BIT(4)
@@ -448,8 +445,7 @@ static void mt6359_accdet_jd_work(struct work_struct *work)
mt6359_accdet_recover_jd_setting(priv);
}
- if (priv->caps & ACCDET_PMIC_EINT_IRQ)
- recover_eint_setting(priv);
+ recover_eint_setting(priv);
mutex_unlock(&priv->res_lock);
}
@@ -583,14 +579,6 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
if (ret)
priv->data->eint_pol = IRQ_TYPE_LEVEL_LOW;
- ret = of_property_read_u32(node, "mediatek,eint-use-ap", &tmp);
- if (ret)
- tmp = 0;
- if (tmp == 0)
- priv->caps |= ACCDET_PMIC_EINT_IRQ;
- else if (tmp == 1)
- priv->caps |= ACCDET_AP_GPIO_EINT;
-
ret = of_property_read_u32(node, "mediatek,eint-detect-mode",
&priv->data->eint_detect_mode);
if (ret) {
@@ -910,10 +898,8 @@ static void mt6359_accdet_init(struct mt6359_accdet *priv)
0x3 << RG_ANALOGFDEN_SFT);
}
- if (priv->caps & ACCDET_PMIC_EINT_IRQ) {
- config_eint_init_by_mode(priv);
- config_digital_init_by_mode(priv);
- }
+ config_eint_init_by_mode(priv);
+ config_digital_init_by_mode(priv);
}
int mt6359_accdet_enable_jack_detect(struct snd_soc_component *component,
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/13] ASoC: mediatek: mt6359-accdet: Drop dead code for EINT trigger setting
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (6 preceding siblings ...)
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 ` 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
` (4 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado
None of the EINT trigger options are implemented and the DT property is
not described in the binding. Remove the unused code.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index 57a70867b4b80fc904ae07ee05d0e554495ed6e7..e45630a134bb3a27bb52a80f43901c9fe4eac105 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -35,8 +35,6 @@
#define ACCDET_PMIC_EINT1 BIT(3)
#define ACCDET_PMIC_BI_EINT BIT(4)
-#define ACCDET_PMIC_GPIO_TRIG_EINT BIT(5)
-#define ACCDET_PMIC_INVERTER_TRIG_EINT BIT(6)
#define ACCDET_PMIC_RSV_EINT BIT(7)
#define ACCDET_THREE_KEY BIT(8)
@@ -596,15 +594,6 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
else if (tmp == 2)
priv->caps |= ACCDET_PMIC_BI_EINT;
- ret = of_property_read_u32(node, "mediatek,eint-trig-mode",
- &tmp);
- if (ret)
- tmp = 0;
- if (tmp == 0)
- priv->caps |= ACCDET_PMIC_GPIO_TRIG_EINT;
- else if (tmp == 1)
- priv->caps |= ACCDET_PMIC_INVERTER_TRIG_EINT;
-
ret = of_property_read_u32(node, "mediatek,eint-use-ext-res",
&priv->data->eint_use_ext_res);
if (ret) {
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/13] ASoC: mediatek: mt6359-accdet: Drop dead code for button detection
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (7 preceding siblings ...)
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 ` 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
` (3 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado
The button detection functionality depends on a calibration voltage
value which is currently not updated anywhere in the driver code, and
hence it doesn't actually do anything. Remove this unused code.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 88 +---------------------------------------
sound/soc/codecs/mt6359-accdet.h | 15 -------
2 files changed, 2 insertions(+), 101 deletions(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index e45630a134bb3a27bb52a80f43901c9fe4eac105..d2841b1385c7cbc5603100a56576eae3b6273b20 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -37,9 +37,6 @@
#define ACCDET_PMIC_RSV_EINT BIT(7)
-#define ACCDET_THREE_KEY BIT(8)
-#define ACCDET_FOUR_KEY BIT(9)
-#define ACCDET_TRI_KEY_CDD BIT(10)
#define ACCDET_RSV_KEY BIT(11)
#define ACCDET_ANALOG_FASTDISCHARGE BIT(12)
@@ -322,41 +319,6 @@ static void mt6359_accdet_jack_report(struct mt6359_accdet *priv)
snd_soc_jack_report(priv->jack, report, MT6359_ACCDET_JACK_MASK);
}
-static unsigned int check_button(struct mt6359_accdet *priv, unsigned int v)
-{
- if (priv->caps & ACCDET_FOUR_KEY) {
- if (v < priv->data->four_key.down &&
- v >= priv->data->four_key.up)
- priv->btn_type = SND_JACK_BTN_1;
- if (v < priv->data->four_key.up &&
- v >= priv->data->four_key.voice)
- priv->btn_type = SND_JACK_BTN_2;
- if (v < priv->data->four_key.voice &&
- v >= priv->data->four_key.mid)
- priv->btn_type = SND_JACK_BTN_3;
- if (v < priv->data->four_key.mid)
- priv->btn_type = SND_JACK_BTN_0;
- } else {
- if (v < priv->data->three_key.down &&
- v >= priv->data->three_key.up)
- priv->btn_type = SND_JACK_BTN_1;
- if (v < priv->data->three_key.up &&
- v >= priv->data->three_key.mid)
- priv->btn_type = SND_JACK_BTN_2;
- if (v < priv->data->three_key.mid)
- priv->btn_type = SND_JACK_BTN_0;
- }
- return 0;
-}
-
-static void is_key_pressed(struct mt6359_accdet *priv, bool pressed)
-{
- priv->btn_type = priv->jack_type & ~MT6359_ACCDET_BTN_MASK;
-
- if (pressed)
- check_button(priv, priv->cali_voltage);
-}
-
static inline void check_jack_btn_type(struct mt6359_accdet *priv)
{
unsigned int val = 0;
@@ -368,15 +330,11 @@ static inline void check_jack_btn_type(struct mt6359_accdet *priv)
switch (priv->accdet_status) {
case 0:
- if (priv->jack_type == SND_JACK_HEADSET)
- is_key_pressed(priv, true);
- else
+ if (priv->jack_type != SND_JACK_HEADSET)
priv->jack_type = SND_JACK_HEADPHONE;
break;
case 1:
- if (priv->jack_type == SND_JACK_HEADSET) {
- is_key_pressed(priv, false);
- } else {
+ if (priv->jack_type != SND_JACK_HEADSET) {
priv->jack_type = SND_JACK_HEADSET;
accdet_set_debounce(priv, eint_state011, 0x1);
}
@@ -606,48 +564,6 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
if (ret)
priv->data->eint_comp_vth = 0x0;
- ret = of_property_read_u32(node, "mediatek,key-mode", &tmp);
- if (ret)
- tmp = 0;
- if (tmp == 0) {
- int three_key[4];
-
- priv->caps |= ACCDET_THREE_KEY;
- ret = of_property_read_u32_array(node,
- "mediatek,three-key-thr",
- three_key,
- ARRAY_SIZE(three_key));
- if (!ret)
- memcpy(&priv->data->three_key, three_key + 1,
- sizeof(struct three_key_threshold));
- } else if (tmp == 1) {
- int four_key[5];
-
- priv->caps |= ACCDET_FOUR_KEY;
- ret = of_property_read_u32_array(node,
- "mediatek,four-key-thr",
- four_key,
- ARRAY_SIZE(four_key));
- if (!ret) {
- memcpy(&priv->data->four_key, four_key + 1,
- sizeof(struct four_key_threshold));
- } else {
- dev_warn(priv->dev,
- "accdet no 4-key-thrsh dts, use efuse\n");
- }
- } else if (tmp == 2) {
- int three_key[4];
-
- priv->caps |= ACCDET_TRI_KEY_CDD;
- ret = of_property_read_u32_array(node,
- "mediatek,tri-key-cdd-thr",
- three_key,
- ARRAY_SIZE(three_key));
- if (!ret)
- memcpy(&priv->data->three_key, three_key + 1,
- sizeof(struct three_key_threshold));
- }
-
of_node_put(node);
dev_warn(priv->dev, "accdet caps=%x\n", priv->caps);
diff --git a/sound/soc/codecs/mt6359-accdet.h b/sound/soc/codecs/mt6359-accdet.h
index c234f2f4276a12853a6fe0b13c4198dfc551b6b4..0ad5c8660a0bf4a87136a700698b04dff121b175 100644
--- a/sound/soc/codecs/mt6359-accdet.h
+++ b/sound/soc/codecs/mt6359-accdet.h
@@ -50,19 +50,6 @@ enum {
eint_inverter_state000,
};
-struct three_key_threshold {
- unsigned int mid;
- unsigned int up;
- unsigned int down;
-};
-
-struct four_key_threshold {
- unsigned int mid;
- unsigned int voice;
- unsigned int up;
- unsigned int down;
-};
-
struct pwm_deb_settings {
unsigned int pwm_width;
unsigned int pwm_thresh;
@@ -88,8 +75,6 @@ struct dts_data {
unsigned int plugout_deb;
unsigned int eint_pol;
struct pwm_deb_settings *pwm_deb;
- struct three_key_threshold three_key;
- struct four_key_threshold four_key;
unsigned int moisture_detect_enable;
unsigned int eint_detect_mode;
unsigned int eint_use_ext_res;
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/13] ASoC: mediatek: mt6359-accdet: Drop dead code for plugout-debounce
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (8 preceding siblings ...)
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 ` 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
` (2 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado
The mediatek,plugout-debounce property is undocumented in the binding
and unhandled by the driver. Remove it.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 5 -----
sound/soc/codecs/mt6359-accdet.h | 1 -
2 files changed, 6 deletions(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index d2841b1385c7cbc5603100a56576eae3b6273b20..c3d51c0753c815cd92935736300f57fd18e033f7 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -514,11 +514,6 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
if (ret)
priv->data->mic_vol = 8;
- ret = of_property_read_u32(node, "mediatek,plugout-debounce",
- &priv->data->plugout_deb);
- if (ret)
- priv->data->plugout_deb = 1;
-
ret = of_property_read_u32(node, "mediatek,mic-mode",
&priv->data->mic_mode);
if (ret)
diff --git a/sound/soc/codecs/mt6359-accdet.h b/sound/soc/codecs/mt6359-accdet.h
index 0ad5c8660a0bf4a87136a700698b04dff121b175..148e181fc00048ea349c029b382507542a33202e 100644
--- a/sound/soc/codecs/mt6359-accdet.h
+++ b/sound/soc/codecs/mt6359-accdet.h
@@ -72,7 +72,6 @@ struct pwm_deb_settings {
struct dts_data {
unsigned int mic_vol;
unsigned int mic_mode;
- unsigned int plugout_deb;
unsigned int eint_pol;
struct pwm_deb_settings *pwm_deb;
unsigned int moisture_detect_enable;
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/13] ASoC: mediatek: mt6359-accdet: Handle mediatek,eint-use-ext-res as bool
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (9 preceding siblings ...)
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 ` 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
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado
The code currently allows for values between 0 and 4 for the
eint_use_ext_res property, but it should be handled as a boolean, either
configuring the internal resistor to be used or not. Update the code
accordingly.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 12 +++---------
sound/soc/codecs/mt6359-accdet.h | 2 +-
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index c3d51c0753c815cd92935736300f57fd18e033f7..646cdd4e0b57f2a007fdcfcaecb7534e08ae61c4 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -82,8 +82,7 @@ static unsigned int adjust_eint_analog_setting(struct mt6359_accdet *priv)
RG_EINT1CONFIGACCDET_MASK_SFT,
BIT(RG_EINT1CONFIGACCDET_SFT));
}
- if (priv->data->eint_use_ext_res == 0x3 ||
- priv->data->eint_use_ext_res == 0x4) {
+ if (!priv->data->eint_use_ext_res) {
/*select 500k, use internal resistor */
regmap_update_bits(priv->regmap,
RG_EINT0HIRENB_ADDR,
@@ -547,12 +546,7 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
else if (tmp == 2)
priv->caps |= ACCDET_PMIC_BI_EINT;
- ret = of_property_read_u32(node, "mediatek,eint-use-ext-res",
- &priv->data->eint_use_ext_res);
- if (ret) {
- /* eint use internal resister */
- priv->data->eint_use_ext_res = 0x0;
- }
+ priv->data->eint_use_ext_res = of_property_read_bool(node, "mediatek,eint-use-ext-res");
ret = of_property_read_u32(node, "mediatek,eint-comp-vth",
&priv->data->eint_comp_vth);
@@ -660,7 +654,7 @@ static void config_eint_init_by_mode(struct mt6359_accdet *priv)
if (priv->data->eint_detect_mode == 0x1 ||
priv->data->eint_detect_mode == 0x2 ||
priv->data->eint_detect_mode == 0x3) {
- if (priv->data->eint_use_ext_res == 0x1) {
+ if (priv->data->eint_use_ext_res) {
if (priv->caps & ACCDET_PMIC_EINT0) {
regmap_update_bits(priv->regmap,
RG_EINT0CONFIGACCDET_ADDR,
diff --git a/sound/soc/codecs/mt6359-accdet.h b/sound/soc/codecs/mt6359-accdet.h
index 148e181fc00048ea349c029b382507542a33202e..1a255a360b2319396e9b7a5a145a9317e575587f 100644
--- a/sound/soc/codecs/mt6359-accdet.h
+++ b/sound/soc/codecs/mt6359-accdet.h
@@ -76,7 +76,7 @@ struct dts_data {
struct pwm_deb_settings *pwm_deb;
unsigned int moisture_detect_enable;
unsigned int eint_detect_mode;
- unsigned int eint_use_ext_res;
+ bool eint_use_ext_res;
unsigned int eint_comp_vth;
unsigned int moisture_detect_mode;
unsigned int moisture_comp_vth;
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/13] ASoC: mediatek: mt6359-accdet: Split mediatek,pwm-deb-setting properties
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (10 preceding siblings ...)
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 ` 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
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado
Instead of parsing an array of 15 integers from the
mediatek,pwm-deb-setting property, which makes them harder to identify,
parse each value individually from its own property.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 44 +++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index 646cdd4e0b57f2a007fdcfcaecb7534e08ae61c4..eca8a0eeb1f868a41c808cc0b853e77db3b0bf59 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -501,9 +501,13 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
int ret;
struct device *dev = priv->dev;
struct device_node *node = NULL;
- int pwm_deb[15] = {0};
+ struct pwm_deb_settings *pwm_deb;
unsigned int tmp = 0;
+ pwm_deb = devm_kzalloc(dev, sizeof(struct pwm_deb_settings), GFP_KERNEL);
+ if (!pwm_deb)
+ return -ENOMEM;
+
node = of_get_child_by_name(dev->parent->of_node, "accdet");
if (!node)
return -EINVAL;
@@ -518,11 +522,33 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
if (ret)
priv->data->mic_mode = 2;
- ret = of_property_read_u32_array(node, "mediatek,pwm-deb-setting",
- pwm_deb, ARRAY_SIZE(pwm_deb));
- /* debounce8(auxadc debounce) is default, needn't get from dts */
- if (!ret)
- memcpy(priv->data->pwm_deb, pwm_deb, sizeof(pwm_deb));
+ of_property_read_u32(node, "mediatek,pwm-width", &pwm_deb->pwm_width);
+ of_property_read_u32(node, "mediatek,pwm-thresh", &pwm_deb->pwm_thresh);
+ of_property_read_u32(node, "mediatek,pwm-rise-delay",
+ &pwm_deb->rise_delay);
+ of_property_read_u32(node, "mediatek,pwm-fall-delay",
+ &pwm_deb->fall_delay);
+ of_property_read_u32(node, "mediatek,debounce0", &pwm_deb->debounce0);
+ of_property_read_u32(node, "mediatek,debounce1", &pwm_deb->debounce1);
+ of_property_read_u32(node, "mediatek,debounce3", &pwm_deb->debounce3);
+ of_property_read_u32(node, "mediatek,debounce-auxadc",
+ &pwm_deb->debounce4);
+ of_property_read_u32(node, "mediatek,eint-cmpmen-pwm-width",
+ &pwm_deb->eint_pwm_width);
+ of_property_read_u32(node, "mediatek,eint-cmpmen-pwm-thresh",
+ &pwm_deb->eint_pwm_thresh);
+ of_property_read_u32(node, "mediatek,eint-debounce0",
+ &pwm_deb->eint_debounce0);
+ of_property_read_u32(node, "mediatek,eint-debounce1",
+ &pwm_deb->eint_debounce1);
+ of_property_read_u32(node, "mediatek,eint-debounce2",
+ &pwm_deb->eint_debounce2);
+ of_property_read_u32(node, "mediatek,eint-debounce3",
+ &pwm_deb->eint_debounce3);
+ of_property_read_u32(node, "mediatek,eint-inverter-debounce",
+ &pwm_deb->eint_inverter_debounce);
+
+ priv->data->pwm_deb = pwm_deb;
ret = of_property_read_u32(node, "mediatek,eint-level-pol",
&priv->data->eint_pol);
@@ -834,12 +860,6 @@ static int mt6359_accdet_probe(struct platform_device *pdev)
if (!priv->data)
return -ENOMEM;
- priv->data->pwm_deb = devm_kzalloc(&pdev->dev,
- sizeof(struct pwm_deb_settings),
- GFP_KERNEL);
- if (!priv->data->pwm_deb)
- return -ENOMEM;
-
priv->regmap = mt6397->regmap;
if (IS_ERR(priv->regmap)) {
ret = PTR_ERR(priv->regmap);
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/13] arm64: dts: mt6359: Add accessory detect node
2025-02-14 17:18 [PATCH 00/13] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
` (11 preceding siblings ...)
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 ` Nícolas F. R. A. Prado
12 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2025-02-14 17:18 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Nícolas F. R. A. Prado,
Andrew Perepech
Add audio jack detection node. PMIC accessory detect driver will
create an input device that will send key events on jack
insertion/removal or accessory device key presses.
Co-developed-by: Andrew Perepech <andrew.perepech@mediatek.com>
Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
arch/arm64/boot/dts/mediatek/mt6359.dtsi | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt6359.dtsi b/arch/arm64/boot/dts/mediatek/mt6359.dtsi
index 150ad84d5d2b30ab6064c71e1375ce5df5ae4b36..44631fa046b88fffe888d94bfb9b5943b8a66b24 100644
--- a/arch/arm64/boot/dts/mediatek/mt6359.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt6359.dtsi
@@ -15,6 +15,30 @@ pmic_adc: adc {
#io-channel-cells = <1>;
};
+ 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>;
+ };
+
mt6359codec: mt6359codec {
};
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 01/13] ASoC: dt-bindings: Add document for mt6359-accdet
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
0 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-02-18 13:18 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Liam Girdwood, Mark Brown,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm
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>;
> + };
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 04/13] ASoC: mediatek: mt6359-accdet: Add compatible property
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
0 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-02-18 13:18 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Liam Girdwood, Mark Brown,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
Sen Chu, Sean Wang, Macpaul Lin, Lee Jones, Jaroslav Kysela,
Takashi Iwai
Cc: kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Andrew Perepech
Il 14/02/25 18:18, Nícolas F. R. A. Prado ha scritto:
> Add a compatible property and add it to the module device table for the
> mt6359-accdet platform driver to allow automatic module loading and
> probing when the compatible is present in DT.
>
> Co-developed-by: Andrew Perepech <andrew.perepech@mediatek.com>
> Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
> sound/soc/codecs/mt6359-accdet.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
> index ed34cc15b80e856356c07fd53af22207124e0d19..6f07db879c6a56ce4843954f51bb9602373e4aa5 100644
> --- a/sound/soc/codecs/mt6359-accdet.c
> +++ b/sound/soc/codecs/mt6359-accdet.c
> @@ -1047,9 +1047,19 @@ static int mt6359_accdet_probe(struct platform_device *pdev)
> return ret;
> }
>
> +const struct of_device_id accdet_of_match[] = {
> + {
> + .compatible = "mediatek,mt6359-accdet",
> + }, {
> + /* sentinel */
> + },
Compress that stuff please...
{ .compatible .. },
{ /* sentinel */ }
};
after which:
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> +};
> +MODULE_DEVICE_TABLE(of, accdet_of_match);
> +
> static struct platform_driver mt6359_accdet_driver = {
> .driver = {
> .name = "pmic-codec-accdet",
> + .of_match_table = accdet_of_match,
> },
> .probe = mt6359_accdet_probe,
> };
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 03/13] mfd: mt6397-core: Add mfd_cell for mt6359-accdet
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
0 siblings, 0 replies; 17+ messages in thread
From: Lee Jones @ 2025-02-27 16:16 UTC (permalink / raw)
To: Nícolas F. R. A. Prado
Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Sen Chu, Sean Wang, Macpaul Lin, Jaroslav Kysela, Takashi Iwai,
kernel, linux-sound, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, linux-pm, Andrew Perepech
On Fri, 14 Feb 2025, Nícolas F. R. A. Prado wrote:
> From: Andrew Perepech <andrew.perepech@mediatek.com>
>
> Add an mfd_cell for mt6359-accdet and describe its IRQ resources to
> allow the mt6359-accdet driver to probe.
>
> Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
> drivers/mfd/mt6397-core.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
Looks okay.
Not sure why the other patches are yet to gain attention though.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2025-02-27 19:39 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.